mia_hand_driver
rel 1.0.0
|
Class to handle a serial port and its serial communication protocol. More...
#include <serial_port.h>
Public Member Functions | |
SerialPort (std::mutex *p_finger_data_mtx, std::mutex *p_connection_mtx, bool *p_is_connected) | |
Class destructor. More... | |
~SerialPort () | |
Class destructor. More... | |
bool | open (uint16_t port_num) |
Open a serial port. More... | |
bool | close () |
Close the serial port. More... | |
void | sendCommand (const std::string &command) |
Send a command to the Mia hand attached to the serial port. More... | |
void | parseStream (FingerSerialInfo &thumb, FingerSerialInfo &index, FingerSerialInfo &mrl, bool &is_checking_on) |
Parse message received from the Mia hand. More... | |
Private Attributes | |
std::string | stream_msg_ |
Message received from the Mia hand. More... | |
std::mutex | serial_write_mtx_ |
std::mutex * | p_finger_data_mtx_ |
std::mutex * | p_connection_mtx_ |
bool * | p_is_connected_ |
Class to handle a serial port and its serial communication protocol.
Definition at line 42 of file serial_port.h.
mia_hand::SerialPort::SerialPort | ( | std::mutex * | p_finger_data_mtx, |
std::mutex * | p_connection_mtx, | ||
bool * | p_is_connected | ||
) |
Class destructor.
Definition at line 14 of file serial_port.cpp.
mia_hand::SerialPort::~SerialPort | ( | ) |
Class destructor.
Definition at line 23 of file serial_port.cpp.
bool mia_hand::SerialPort::close | ( | ) |
Close the serial port.
Definition at line 65 of file serial_port.cpp.
bool mia_hand::SerialPort::open | ( | uint16_t | port_num | ) |
Open a serial port.
port_num | integer number of the serial port to open. |
Definition at line 31 of file serial_port.cpp.
void mia_hand::SerialPort::parseStream | ( | FingerSerialInfo & | thumb, |
FingerSerialInfo & | index, | ||
FingerSerialInfo & | mrl, | ||
bool & | is_checking_on | ||
) |
Parse message received from the Mia hand.
thumb | Received info regarding the thumb flexion motor. |
index | Received info regarding the index flexion motor. |
mrl | Received info regarding the mrl flexion motor. |
is_checking_on | boolean to handle the check of the Mia hand connection. |
Definition at line 109 of file serial_port.cpp.
void mia_hand::SerialPort::sendCommand | ( | const std::string & | command | ) |
Send a command to the Mia hand attached to the serial port.
This commands add to the input message the proper tail and send the composed message to the Mia hand.
command | command to be sent. |
Definition at line 85 of file serial_port.cpp.
|
private |
Definition at line 91 of file serial_port.h.
|
private |
Definition at line 90 of file serial_port.h.
|
private |
Definition at line 93 of file serial_port.h.
|
private |
Definition at line 89 of file serial_port.h.
|
private |
Message received from the Mia hand.
Definition at line 87 of file serial_port.h.