SVHSerialInterface.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of the SCHUNK SVH Driver suite.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
00012 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00013 //
00014 // -- END LICENSE BLOCK ------------------------------------------------
00015 
00016 //----------------------------------------------------------------------
00030 //----------------------------------------------------------------------
00031 #ifndef DRIVER_SVH_SVH_SERIAL_INTERFACE_H_INCLUDED
00032 #define DRIVER_SVH_SVH_SERIAL_INTERFACE_H_INCLUDED
00033 
00034 // Windows declarations
00035 #include <driver_svh/ImportExport.h>
00036 
00037 #include <driver_svh/SVHSerialPacket.h>
00038 #include <driver_svh/SVHReceiveThread.h>
00039 #include <icl_comm_serial/Serial.h>
00040 #include <boost/shared_ptr.hpp>
00041 using icl_comm::serial::Serial;
00042 
00043 namespace driver_svh {
00044 
00048 class DRIVER_SVH_IMPORT_EXPORT SVHSerialInterface
00049 {
00050 public:
00055   SVHSerialInterface(const ReceivedPacketCallback &received_packet_callback);
00056 
00058   ~SVHSerialInterface();
00059 
00065   bool connect(const std::string &dev_name);
00066 
00070   void close();
00071 
00076   bool isConnected() { return m_connected; }
00077 
00083   bool sendPacket(SVHSerialPacket &packet);
00084 
00089   unsigned int transmittedPacketCount() { return m_packets_transmitted; }
00090 
00094   void resetTransmitPackageCount();
00095 
00100   void printPacketOnConsole(SVHSerialPacket &packet);
00101 
00102 private:
00104   void receivedPacketCallback(const SVHSerialPacket& packet, unsigned int packet_count);
00105 
00107   bool m_connected;
00108 
00110   uint8_t last_index;
00111 
00113   boost::shared_ptr<Serial> m_serial_device;
00114 
00116   void calcCheckSum(uint8_t &check_sum1, uint8_t &check_sum2, const SVHSerialPacket& packet);
00117 
00119   boost::shared_ptr<SVHReceiveThread> m_receive_thread;
00120 
00122   ReceivedPacketCallback m_received_packet_callback;
00123 
00125   unsigned int m_packets_transmitted;
00126 
00128   unsigned int m_dummy_packets_printed;
00129 };
00130 
00131 }
00132 
00133 #endif


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Thu Jun 6 2019 18:29:08