Class SVHSerialInterface

Class Documentation

class SVHSerialInterface

Basic communication handler for the SCHUNK five finger hand.

Public Functions

SVHSerialInterface(const ReceivedPacketCallback &received_packet_callback)

Constructs a serial interface class for basic communication with the SCHUNK five finger hand.

Parameters:

received_packet_callback – function to call whenever a packet was received

~SVHSerialInterface()

Default DTOR.

bool connect(const std::string &dev_name)

connecting to serial device and starting receive thread

Parameters:

dev_name – Filehandle of the device i.e. dev/ttyUSB0

Returns:

bool true if connection was succesfull

void close()

canceling receive thread and closing connection to serial port

inline bool isConnected()

returns connected state of serial device

Returns:

bool true if the device is connected

bool sendPacket(SVHSerialPacket &packet)

function for sending packets via serial device to the SVH

Parameters:

packet – the prepared Serial Packet

Returns:

true if successful

inline unsigned int transmittedPacketCount()

get number of transmitted packets

Returns:

number of successfully sent packets

void resetTransmitPackageCount()

resetTransmitPackageCount Resets the transmitpackage count to zero

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.

Parameters:

packet – the prepared Serial Packet(without header information and such)