Public Member Functions | Private Member Functions | Private Attributes | List of all members
driver_svh::SVHSerialInterface Class Reference

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 More...
 
bool connect (const std::string &dev_name)
 connecting to serial device and starting receive thread More...
 
bool isConnected ()
 returns connected state of serial device More...
 
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. More...
 
void resetTransmitPackageCount ()
 resetTransmitPackageCount Resets the transmitpackage count to zero More...
 
bool sendPacket (SVHSerialPacket &packet)
 function for sending packets via serial device to the SVH More...
 
 SVHSerialInterface (const ReceivedPacketCallback &received_packet_callback)
 Constructs a serial interface class for basic communication with the SCHUNK five finger hand. More...
 
unsigned int transmittedPacketCount ()
 get number of transmitted packets More...
 
 ~SVHSerialInterface ()
 Default DTOR. More...
 

Private Member Functions

void calcCheckSum (uint8_t &check_sum1, uint8_t &check_sum2, const SVHSerialPacket &packet)
 cecksum calculation More...
 
void receivedPacketCallback (const SVHSerialPacket &packet, unsigned int packet_count)
 

Private Attributes

bool m_connected
 serial device connected state More...
 
unsigned int m_dummy_packets_printed
 packet counter simulation for pure showing purposes More...
 
uint8_t m_last_index
 
unsigned int m_packets_transmitted
 packet counters More...
 
std::thread m_receive_thread
 thread for receiving serial packets More...
 
ReceivedPacketCallback m_received_packet_callback
 Callback function for received packets. More...
 
std::shared_ptr< Serialm_serial_device
 pointer to serial interface object More...
 
std::unique_ptr< SVHReceiveThreadm_svh_receiver
 handle to manage the actual receiving of data More...
 

Detailed Description

Basic communication handler for the SCHUNK five finger hand.

Definition at line 57 of file SVHSerialInterface.h.

Constructor & Destructor Documentation

◆ SVHSerialInterface()

driver_svh::SVHSerialInterface::SVHSerialInterface ( const ReceivedPacketCallback received_packet_callback)

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

Parameters
received_packet_callbackfunction to call whenever a packet was received

Definition at line 51 of file SVHSerialInterface.cpp.

◆ ~SVHSerialInterface()

driver_svh::SVHSerialInterface::~SVHSerialInterface ( )

Default DTOR.

Definition at line 58 of file SVHSerialInterface.cpp.

Member Function Documentation

◆ calcCheckSum()

void driver_svh::SVHSerialInterface::calcCheckSum ( uint8_t &  check_sum1,
uint8_t &  check_sum2,
const SVHSerialPacket packet 
)
private

cecksum calculation

◆ close()

void driver_svh::SVHSerialInterface::close ( )

canceling receive thread and closing connection to serial port

Definition at line 109 of file SVHSerialInterface.cpp.

◆ connect()

bool driver_svh::SVHSerialInterface::connect ( const std::string &  dev_name)

connecting to serial device and starting receive thread

Parameters
dev_nameFilehandle of the device i.e. dev/ttyUSB0
Returns
bool true if connection was succesfull

Definition at line 63 of file SVHSerialInterface.cpp.

◆ isConnected()

bool driver_svh::SVHSerialInterface::isConnected ( )
inline

returns connected state of serial device

Returns
bool true if the device is connected

Definition at line 85 of file SVHSerialInterface.h.

◆ printPacketOnConsole()

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.

Parameters
packetthe prepared Serial Packet(without header information and such)

Definition at line 198 of file SVHSerialInterface.cpp.

◆ receivedPacketCallback()

void driver_svh::SVHSerialInterface::receivedPacketCallback ( const SVHSerialPacket packet,
unsigned int  packet_count 
)
private

Definition at line 225 of file SVHSerialInterface.cpp.

◆ resetTransmitPackageCount()

void driver_svh::SVHSerialInterface::resetTransmitPackageCount ( )

resetTransmitPackageCount Resets the transmitpackage count to zero

Definition at line 191 of file SVHSerialInterface.cpp.

◆ sendPacket()

bool driver_svh::SVHSerialInterface::sendPacket ( SVHSerialPacket packet)

function for sending packets via serial device to the SVH

Parameters
packetthe prepared Serial Packet
Returns
true if successful

Definition at line 134 of file SVHSerialInterface.cpp.

◆ transmittedPacketCount()

unsigned int driver_svh::SVHSerialInterface::transmittedPacketCount ( )
inline

get number of transmitted packets

Returns
number of successfully sent packets

Definition at line 98 of file SVHSerialInterface.h.

Member Data Documentation

◆ m_connected

bool driver_svh::SVHSerialInterface::m_connected
private

serial device connected state

Definition at line 116 of file SVHSerialInterface.h.

◆ m_dummy_packets_printed

unsigned int driver_svh::SVHSerialInterface::m_dummy_packets_printed
private

packet counter simulation for pure showing purposes

Definition at line 139 of file SVHSerialInterface.h.

◆ m_last_index

uint8_t driver_svh::SVHSerialInterface::m_last_index
private

Definition at line 118 of file SVHSerialInterface.h.

◆ m_packets_transmitted

unsigned int driver_svh::SVHSerialInterface::m_packets_transmitted
private

packet counters

Definition at line 136 of file SVHSerialInterface.h.

◆ m_receive_thread

std::thread driver_svh::SVHSerialInterface::m_receive_thread
private

thread for receiving serial packets

Definition at line 127 of file SVHSerialInterface.h.

◆ m_received_packet_callback

ReceivedPacketCallback driver_svh::SVHSerialInterface::m_received_packet_callback
private

Callback function for received packets.

Definition at line 133 of file SVHSerialInterface.h.

◆ m_serial_device

std::shared_ptr<Serial> driver_svh::SVHSerialInterface::m_serial_device
private

pointer to serial interface object

Definition at line 121 of file SVHSerialInterface.h.

◆ m_svh_receiver

std::unique_ptr<SVHReceiveThread> driver_svh::SVHSerialInterface::m_svh_receiver
private

handle to manage the actual receiving of data

Definition at line 130 of file SVHSerialInterface.h.


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


schunk_svh_library
Author(s): Georg Heppner, Lars Pfotzer, Felix Exner, Johannes Mangler, Stefan Scherzinger, Pascal Becker
autogenerated on Fri Apr 14 2023 02:53:52