Public Member Functions | Private Member Functions | Private Attributes | List of all members
roboteq::serial_controller Class Reference

#include <serial_controller.h>

Public Member Functions

bool addCallback (const callback_data_t &callback, const string data)
 addCallback Add callback message More...
 
template<class T >
bool addCallback (void(T::*fp)(const string), T *obj, const string data)
 
bool command (string msg, string params="", string type="!")
 
bool downloadScript ()
 downloadScript Launch the script update for the Roboteq board More...
 
bool echo (bool type)
 echo Enable or disable the echo message More...
 
bool factoryReset ()
 factoryReset Factory reset of Roboteq board More...
 
string get ()
 get Get the message parsed More...
 
string getParam (string msg, string params="")
 
string getQuery (string msg, string params="")
 
string getVersionScript ()
 getVersionScript The version of the script loaded More...
 
bool loadFromEEPROM ()
 loadFromEEPROM More...
 
bool maintenance (string msg, string params="")
 
bool query (string msg, string params="", string type="?")
 
void reset ()
 reset Reset the Roboteq board More...
 
bool saveInEEPROM ()
 saveInEEPROM The EESAV it's a real-time Command must be used to copy the RAM array to Flash. The Flash is copied to RAM every time the device powers up. More...
 
bool script (bool status)
 script Run and stop the script inside the Roboteq More...
 
 serial_controller (string port, unsigned long baudrate)
 serial_controller Open the serial controller More...
 
bool setParam (string msg, string params="")
 
bool start ()
 start Initialize the serial communcation More...
 
bool stop ()
 stop More...
 
 ~serial_controller ()
 

Private Member Functions

void async_reader ()
 async_reader Thread to read realtime all charachters sent from roboteq board More...
 
bool enableDownload ()
 enableDownload Enable writing script More...
 

Private Attributes

string _script_ver
 
std::condition_variable cv
 
bool data
 
std::thread first
 
map< string, callback_data_thashmap
 
bool isHLD
 
uint32_t mBaudrate
 
string mMessage
 
mutex mReaderMutex
 
serial::Serial mSerial
 
string mSerialPort
 
bool mStopping
 
uint32_t mTimeout
 
mutex mWriteMutex
 
string sub_data
 
bool sub_data_cmd
 

Detailed Description

Definition at line 49 of file serial_controller.h.

Constructor & Destructor Documentation

roboteq::serial_controller::serial_controller ( string  port,
unsigned long  baudrate 
)

serial_controller Open the serial controller

Parameters
portset the port
setthe baudrate

Definition at line 42 of file serial_controller.cpp.

roboteq::serial_controller::~serial_controller ( )

Definition at line 50 of file serial_controller.cpp.

Member Function Documentation

bool roboteq::serial_controller::addCallback ( const callback_data_t callback,
const string  data 
)

addCallback Add callback message

Parameters
callbackThe callback function
typeThe type of message to check

Definition at line 129 of file serial_controller.cpp.

template<class T >
bool roboteq::serial_controller::addCallback ( void(T::*)(const string fp,
T *  obj,
const string  data 
)
inline

Template to connect a method in callback

Definition at line 201 of file serial_controller.h.

void roboteq::serial_controller::async_reader ( )
private

async_reader Thread to read realtime all charachters sent from roboteq board

Definition at line 262 of file serial_controller.cpp.

bool roboteq::serial_controller::command ( string  msg,
string  params = "",
string  type = "!" 
)

Definition at line 190 of file serial_controller.cpp.

bool roboteq::serial_controller::downloadScript ( )

downloadScript Launch the script update for the Roboteq board

Returns
Return true if the script is fully updated

Definition at line 163 of file serial_controller.cpp.

bool roboteq::serial_controller::echo ( bool  type)
inline

echo Enable or disable the echo message

Parameters
typestatus of echo
Returns
The status of command

Definition at line 179 of file serial_controller.h.

bool roboteq::serial_controller::enableDownload ( )
private

enableDownload Enable writing script

Returns
Status of HLD reference [pag. 183]

Definition at line 141 of file serial_controller.cpp.

bool roboteq::serial_controller::factoryReset ( )
inline

factoryReset Factory reset of Roboteq board

Returns
the status of write

Definition at line 139 of file serial_controller.h.

string roboteq::serial_controller::get ( )
inline

get Get the message parsed

Returns
Return the string received

Definition at line 111 of file serial_controller.h.

string roboteq::serial_controller::getParam ( string  msg,
string  params = "" 
)
inline

Definition at line 91 of file serial_controller.h.

string roboteq::serial_controller::getQuery ( string  msg,
string  params = "" 
)
inline

Definition at line 75 of file serial_controller.h.

string roboteq::serial_controller::getVersionScript ( )
inline

getVersionScript The version of the script loaded

Returns
The string of roboteq control version

Definition at line 119 of file serial_controller.h.

bool roboteq::serial_controller::loadFromEEPROM ( )
inline

loadFromEEPROM

Returns
the status of write

Definition at line 147 of file serial_controller.h.

bool roboteq::serial_controller::maintenance ( string  msg,
string  params = "" 
)
inline

Definition at line 102 of file serial_controller.h.

bool roboteq::serial_controller::query ( string  msg,
string  params = "",
string  type = "?" 
)

Definition at line 226 of file serial_controller.cpp.

void roboteq::serial_controller::reset ( )
inline

reset Reset the Roboteq board

Definition at line 127 of file serial_controller.h.

bool roboteq::serial_controller::saveInEEPROM ( )
inline

saveInEEPROM The EESAV it's a real-time Command must be used to copy the RAM array to Flash. The Flash is copied to RAM every time the device powers up.

Returns
the status of write

Definition at line 156 of file serial_controller.h.

bool roboteq::serial_controller::script ( bool  status)
inline

script Run and stop the script inside the Roboteq

Parameters
statusThe status of the script
Returns
the status of command

Definition at line 165 of file serial_controller.h.

bool roboteq::serial_controller::setParam ( string  msg,
string  params = "" 
)
inline

Definition at line 87 of file serial_controller.h.

bool roboteq::serial_controller::start ( )

start Initialize the serial communcation

Returns
if open the connection return true

Definition at line 55 of file serial_controller.cpp.

bool roboteq::serial_controller::stop ( )

stop

Returns

Definition at line 116 of file serial_controller.cpp.

Member Data Documentation

string roboteq::serial_controller::_script_ver
private

Definition at line 231 of file serial_controller.h.

std::condition_variable roboteq::serial_controller::cv
private

Definition at line 225 of file serial_controller.h.

bool roboteq::serial_controller::data
private

Definition at line 219 of file serial_controller.h.

std::thread roboteq::serial_controller::first
private

Definition at line 221 of file serial_controller.h.

map<string, callback_data_t> roboteq::serial_controller::hashmap
private

Definition at line 227 of file serial_controller.h.

bool roboteq::serial_controller::isHLD
private

Definition at line 229 of file serial_controller.h.

uint32_t roboteq::serial_controller::mBaudrate
private

Definition at line 210 of file serial_controller.h.

string roboteq::serial_controller::mMessage
private

Definition at line 216 of file serial_controller.h.

mutex roboteq::serial_controller::mReaderMutex
private

Definition at line 224 of file serial_controller.h.

serial::Serial roboteq::serial_controller::mSerial
private

Definition at line 206 of file serial_controller.h.

string roboteq::serial_controller::mSerialPort
private

Definition at line 208 of file serial_controller.h.

bool roboteq::serial_controller::mStopping
private

Definition at line 214 of file serial_controller.h.

uint32_t roboteq::serial_controller::mTimeout
private

Definition at line 212 of file serial_controller.h.

mutex roboteq::serial_controller::mWriteMutex
private

Definition at line 223 of file serial_controller.h.

string roboteq::serial_controller::sub_data
private

Definition at line 217 of file serial_controller.h.

bool roboteq::serial_controller::sub_data_cmd
private

Definition at line 218 of file serial_controller.h.


The documentation for this class was generated from the following files:


roboteq_control
Author(s): Raffaello Bonghi
autogenerated on Wed Jan 3 2018 03:48:23