Basic communication handler for the SCHUNK five finger hand. More...
#include <SVHSerialInterface.h>
Public Member Functions | |
void | close () |
canceling receive thread and closing connection to serial port | |
bool | connect (const std::string &dev_name) |
connecting to serial device and starting receive thread | |
bool | isConnected () |
returns connected state of serial device | |
void | printPacketOnConsole (SVHSerialPacket &packet) |
printPacketOnConsole is a pure helper function to show what raw data is actually sent. This is not meant for any productive use other than understand whats going on. | |
void | resetTransmitPackageCount () |
resetTransmitPackageCount Resets the transmitpackage count to zero | |
bool | sendPacket (SVHSerialPacket &packet) |
function for sending packets via serial device to the SVH | |
SVHSerialInterface (const ReceivedPacketCallback &received_packet_callback) | |
Constructs a serial interface class for basic communication with the SCHUNK five finger hand. | |
unsigned int | transmittedPacketCount () |
get number of transmitted packets | |
~SVHSerialInterface () | |
Default DTOR. | |
Private Member Functions | |
void | calcCheckSum (uint8_t &check_sum1, uint8_t &check_sum2, const SVHSerialPacket &packet) |
cecksum calculation | |
void | receivedPacketCallback (const SVHSerialPacket &packet, unsigned int packet_count) |
called on received packets, calls m_received_packet_callback | |
Private Attributes | |
uint8_t | last_index |
used to wait to the response of the sending packet | |
bool | m_connected |
serial device connected state | |
unsigned int | m_dummy_packets_printed |
packet counter simulation for pure showing purposes | |
unsigned int | m_packets_transmitted |
packet counters | |
boost::shared_ptr < SVHReceiveThread > | m_receive_thread |
thread for receiving serial packets | |
ReceivedPacketCallback | m_received_packet_callback |
Callback function for received packets. | |
boost::shared_ptr< Serial > | m_serial_device |
pointer to serial interface object |
Basic communication handler for the SCHUNK five finger hand.
Definition at line 48 of file SVHSerialInterface.h.
driver_svh::SVHSerialInterface::SVHSerialInterface | ( | const ReceivedPacketCallback & | received_packet_callback | ) |
Constructs a serial interface class for basic communication with the SCHUNK five finger hand.
received_packet_callback | function to call whenever a packet was received |
Definition at line 41 of file SVHSerialInterface.cpp.
Default DTOR.
Definition at line 48 of file SVHSerialInterface.cpp.
void driver_svh::SVHSerialInterface::calcCheckSum | ( | uint8_t & | check_sum1, |
uint8_t & | check_sum2, | ||
const SVHSerialPacket & | packet | ||
) | [private] |
cecksum calculation
canceling receive thread and closing connection to serial port
Definition at line 100 of file SVHSerialInterface.cpp.
bool driver_svh::SVHSerialInterface::connect | ( | const std::string & | dev_name | ) |
connecting to serial device and starting receive thread
dev_name | Filehandle of the device i.e. dev/ttyUSB0 |
Definition at line 53 of file SVHSerialInterface.cpp.
bool driver_svh::SVHSerialInterface::isConnected | ( | ) | [inline] |
returns connected state of serial device
Definition at line 76 of file SVHSerialInterface.h.
void driver_svh::SVHSerialInterface::printPacketOnConsole | ( | SVHSerialPacket & | packet | ) |
printPacketOnConsole is a pure helper function to show what raw data is actually sent. This is not meant for any productive use other than understand whats going on.
packet | the prepared Serial Packet(without header information and such) |
Definition at line 194 of file SVHSerialInterface.cpp.
void driver_svh::SVHSerialInterface::receivedPacketCallback | ( | const SVHSerialPacket & | packet, |
unsigned int | packet_count | ||
) | [private] |
called on received packets, calls m_received_packet_callback
Definition at line 222 of file SVHSerialInterface.cpp.
resetTransmitPackageCount Resets the transmitpackage count to zero
Definition at line 187 of file SVHSerialInterface.cpp.
bool driver_svh::SVHSerialInterface::sendPacket | ( | SVHSerialPacket & | packet | ) |
function for sending packets via serial device to the SVH
packet | the prepared Serial Packet |
Definition at line 125 of file SVHSerialInterface.cpp.
unsigned int driver_svh::SVHSerialInterface::transmittedPacketCount | ( | ) | [inline] |
get number of transmitted packets
Definition at line 89 of file SVHSerialInterface.h.
used to wait to the response of the sending packet
Definition at line 110 of file SVHSerialInterface.h.
bool driver_svh::SVHSerialInterface::m_connected [private] |
serial device connected state
Definition at line 107 of file SVHSerialInterface.h.
unsigned int driver_svh::SVHSerialInterface::m_dummy_packets_printed [private] |
packet counter simulation for pure showing purposes
Definition at line 128 of file SVHSerialInterface.h.
unsigned int driver_svh::SVHSerialInterface::m_packets_transmitted [private] |
packet counters
Definition at line 125 of file SVHSerialInterface.h.
boost::shared_ptr<SVHReceiveThread> driver_svh::SVHSerialInterface::m_receive_thread [private] |
thread for receiving serial packets
Definition at line 119 of file SVHSerialInterface.h.
Callback function for received packets.
Definition at line 122 of file SVHSerialInterface.h.
boost::shared_ptr<Serial> driver_svh::SVHSerialInterface::m_serial_device [private] |
pointer to serial interface object
Definition at line 113 of file SVHSerialInterface.h.