SVHSerialInterface.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of the SCHUNK SVH Driver suite.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
12 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
13 //
14 // -- END LICENSE BLOCK ------------------------------------------------
15 
16 //----------------------------------------------------------------------
30 //----------------------------------------------------------------------
31 #ifndef DRIVER_SVH_SVH_SERIAL_INTERFACE_H_INCLUDED
32 #define DRIVER_SVH_SVH_SERIAL_INTERFACE_H_INCLUDED
33 
34 // Windows declarations
36 
39 #include <icl_comm_serial/Serial.h>
40 #include <boost/shared_ptr.hpp>
41 using icl_comm::serial::Serial;
42 
43 namespace driver_svh {
44 
49 {
50 public:
55  SVHSerialInterface(const ReceivedPacketCallback &received_packet_callback);
56 
59 
65  bool connect(const std::string &dev_name);
66 
70  void close();
71 
76  bool isConnected() { return m_connected; }
77 
83  bool sendPacket(SVHSerialPacket &packet);
84 
89  unsigned int transmittedPacketCount() { return m_packets_transmitted; }
90 
94  void resetTransmitPackageCount();
95 
100  void printPacketOnConsole(SVHSerialPacket &packet);
101 
102 private:
104  void receivedPacketCallback(const SVHSerialPacket& packet, unsigned int packet_count);
105 
108 
111 
114 
116  void calcCheckSum(uint8_t &check_sum1, uint8_t &check_sum2, const SVHSerialPacket& packet);
117 
120 
123 
125  unsigned int m_packets_transmitted;
126 
129 };
130 
131 }
132 
133 #endif
ReceivedPacketCallback m_received_packet_callback
Callback function for received packets.
boost::function< void(const SVHSerialPacket &packet, unsigned int packet_count)> ReceivedPacketCallback
definition of boost function callback for received packages
unsigned int transmittedPacketCount()
get number of transmitted packets
#define DRIVER_SVH_IMPORT_EXPORT
Definition: ImportExport.h:43
unsigned int m_dummy_packets_printed
packet counter simulation for pure showing purposes
unsigned char uint8_t
unsigned int m_packets_transmitted
packet counters
boost::shared_ptr< SVHReceiveThread > m_receive_thread
thread for receiving serial packets
bool m_connected
serial device connected state
boost::shared_ptr< Serial > m_serial_device
pointer to serial interface object
uint8_t last_index
used to wait to the response of the sending packet
Basic communication handler for the SCHUNK five finger hand.
bool isConnected()
returns connected state of serial device
The SerialPacket holds the (non generated) header and data of one message to the SVH-Hardware.


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Mon Jun 10 2019 15:04:59