Regilo
A simple C++ library for controlling the Neato XV robot and the Hokuyo scanner.
regilo::SerialController Class Reference

The SerialController class is used to communicate with a device using the serial port. More...

#include <serialcontroller.hpp>

Inheritance diagram for regilo::SerialController:
regilo::StreamController< ba::serial_port > regilo::IController

Public Member Functions

virtual void connect (const std::string &endpoint) override
 Connect the controller to a device. More...
 
virtual std::string getEndpoint () const override
 Get the endpoint of device. More...
 
- Public Member Functions inherited from regilo::StreamController< ba::serial_port >
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< ILoggetLog () override
 Get the current Log. More...
 
virtual std::shared_ptr< const ILoggetLog () 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...
 
- Public Member Functions inherited from regilo::IController
virtual ~IController ()=default
 Default destructor.
 

Additional Inherited Members

- Public Types inherited from regilo::StreamController< ba::serial_port >
typedef ba::serial_port Stream
 The stream type for this Controller.
 
- Public Attributes inherited from regilo::StreamController< ba::serial_port >
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.
 
- Protected Member Functions inherited from regilo::StreamController< ba::serial_port >
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...
 
- Protected Attributes inherited from regilo::StreamController< ba::serial_port >
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.
 
ba::serial_port stream
 A stream (TCP, socket, etc.) that is used for read/write operations.
 
std::shared_ptr< Loglog
 A log that is connected to the controller.
 

Detailed Description

The SerialController class is used to communicate with a device using the serial port.

Member Function Documentation

virtual void regilo::SerialController::connect ( const std::string &  endpoint)
overridevirtual

Connect the controller to a device.

Parameters
endpointThe endpoint with the path to the device (e.g. "/dev/ttyACM0").

Implements regilo::IController.

virtual std::string regilo::SerialController::getEndpoint ( ) const
inlineoverridevirtual

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: