SVHSerialPacket.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 //----------------------------------------------------------------------
00028 //----------------------------------------------------------------------
00029 #ifndef SVHSERIALPACKET_H
00030 #define SVHSERIALPACKET_H
00031 
00032 #include <icl_comm/ByteOrderConversion.h>
00033 
00034 namespace driver_svh {
00035 
00036 //===============
00037 // Some constants
00038 //===============
00039 
00040 // packet sizes
00041 const size_t cPACKET_APPENDIX_SIZE = 8; 
00042 const size_t cDEFAULT_PACKET_SIZE = 48; 
00043 
00044 // packet headers
00045 const uint8_t PACKET_HEADER1 = 0x4C;    
00046 const uint8_t PACKET_HEADER2 = 0xAA;    
00047 
00048 // adress constants for commands
00049 const uint8_t SVH_GET_CONTROL_FEEDBACK      = 0x00; 
00050 const uint8_t SVH_SET_CONTROL_COMMAND       = 0x01; 
00051 const uint8_t SVH_GET_CONTROL_FEEDBACK_ALL  = 0x02; 
00052 const uint8_t SVH_SET_CONTROL_COMMAND_ALL   = 0x03; 
00053 const uint8_t SVH_GET_POSITION_SETTINGS     = 0x04; 
00054 const uint8_t SVH_SET_POSITION_SETTINGS     = 0x05; 
00055 const uint8_t SVH_GET_CURRENT_SETTINGS      = 0x06; 
00056 const uint8_t SVH_SET_CURRENT_SETTINGS      = 0x07; 
00057 const uint8_t SVH_GET_CONTROLLER_STATE      = 0x08; 
00058 const uint8_t SVH_SET_CONTROLLER_STATE      = 0x09; 
00059 const uint8_t SVH_GET_ENCODER_VALUES        = 0x0A; 
00060 const uint8_t SVH_SET_ENCODER_VALUES        = 0x0B; 
00061 const uint8_t SVH_GET_FIRMWARE_INFO         = 0x0C; 
00062 
00066 struct SVHSerialPacket
00067 {
00070   uint8_t index;
00072   uint8_t address;
00074   std::vector <uint8_t> data;
00075 
00080   SVHSerialPacket(size_t _data_length=0,uint8_t _address = SVH_GET_CONTROL_FEEDBACK):
00081     address(_address),
00082     data(_data_length,0)
00083   {
00084   }
00085 
00087   bool operator == (const SVHSerialPacket& other) const
00088   {
00089     return
00090       (index == other.index
00091        && address == other.address
00092        && data == other.data);
00093   }
00094 };
00095 
00097 icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHSerialPacket& data);
00098 
00100 icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHSerialPacket& data);
00101 
00103 std::ostream& operator << (std::ostream& o, const SVHSerialPacket& sp);
00104 
00105 }
00106 #endif // SVHSERIALPACKET_H


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