The SocketController class is used to communicate with a device using a TCP socket.
More...
#include <socketcontroller.hpp>
|
virtual | ~SocketController () |
| Default destructor.
|
|
virtual void | connect (const std::string &endpoint) override |
| Connect the controller to a device. More...
|
|
void | connect (const std::string &ip, unsigned short port) |
| Connect the controller to a device. More...
|
|
void | connect (const bai::tcp::endpoint &endpoint) |
| Connect the controller to a device. More...
|
|
virtual std::string | getEndpoint () const override |
| Get the endpoint of device. More...
|
|
virtual std::string | sendCommand (const std::string &command) final override |
| Send a command to the device. More...
|
|
Response | sendCommand (const Command &command) |
| Send a command to the device. More...
|
|
Response | sendCommand (const Command &command, const Args &...params) |
| Send a command to the device. More...
|
|
| StreamController () |
| Default constructor.
|
|
| StreamController (const std::string &logPath) |
| Controller with a log file specified by a path. More...
|
|
| StreamController (std::iostream &logStream) |
| Controller with a log specified by a stream. More...
|
|
virtual | ~StreamController () |
| Default destructor.
|
|
virtual bool | isConnected () const override |
| Test if the controller is connected. More...
|
|
virtual std::shared_ptr< ILog > | getLog () override |
| Get the current Log. More...
|
|
virtual std::shared_ptr< const ILog > | getLog () const override |
| Get the current Log (a const variant). More...
|
|
virtual void | setLog (std::shared_ptr< ILog > log) override |
| Set a Log (it can be shared between more controllers). More...
|
|
Response | sendFormattedCommand (const std::string &commandFormat, Args...params) |
| Create a command with the specified parameters (printf formatting is used) and send it to the device. More...
|
|
std::string | createFormattedCommand (const std::string &commandFormat, Args...params) const |
| Create a command with the specified parameters (printf formatting is used). More...
|
|
virtual | ~IController ()=default |
| Default destructor.
|
|
|
typedef bai::tcp::socket | Stream |
| The stream type for this Controller.
|
|
std::string | REQUEST_END |
| A string that the request ends with.
|
|
std::string | RESPONSE_END |
| A string that the response ends with.
|
|
bool | readResponse |
| If true the sendCommand method reads a response.
|
|
bool | readCommand |
| If true the input command is read from the response at first.
|
|
void | sendCommand () |
| Send a command from the device input to the device.
|
|
Response | sendCommand () |
| Send a command from the device input to the device. More...
|
|
std::istringstream | deviceOutput |
| A buffer for the device output.
|
|
std::ostringstream | deviceInput |
| A buffer for the device input.
|
|
ba::io_service | ioService |
| The Boost IO service.
|
|
bai::tcp::socket | stream |
| A stream (TCP, socket, etc.) that is used for read/write operations.
|
|
std::shared_ptr< Log > | log |
| A log that is connected to the controller.
|
|
The SocketController class is used to communicate with a device using a TCP socket.
virtual void regilo::SocketController::connect |
( |
const std::string & |
endpoint | ) |
|
|
overridevirtual |
Connect the controller to a device.
- Parameters
-
endpoint | The endpoint with the IP address and port of the device (e.g. "10.0.0.1:12345"). |
Implements regilo::IController.
void regilo::SocketController::connect |
( |
const std::string & |
ip, |
|
|
unsigned short |
port |
|
) |
| |
Connect the controller to a device.
- Parameters
-
ip | The IP address of the device (e.g. "10.0.0.1"). |
port | The port number of the device (e.g. 12345). |
void regilo::SocketController::connect |
( |
const bai::tcp::endpoint & |
endpoint | ) |
|
Connect the controller to a device.
- Parameters
-
endpoint | The endpoint of the device. |
virtual std::string regilo::SocketController::getEndpoint |
( |
| ) |
const |
|
overridevirtual |
Get the endpoint of device.
- Returns
- The device endpoint or empty string.
Implements regilo::IController.
The documentation for this class was generated from the following file: