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:
00103 
00105   bool m_connected;
00106 
00108   boost::shared_ptr<Serial> m_serial_device;
00109 
00111   void calcCheckSum(uint8_t &check_sum1, uint8_t &check_sum2, const SVHSerialPacket& packet);
00112 
00114   boost::shared_ptr<SVHReceiveThread> m_receive_thread;
00115 
00117   ReceivedPacketCallback m_received_packet_callback;
00118 
00120   unsigned int m_packets_transmitted;
00121 
00123   unsigned int m_dummy_packets_printed;
00124 };
00125 
00126 }
00127 
00128 #endif


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19