SVHFirmwareInfo.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 //----------------------------------------------------------------------
00026 //----------------------------------------------------------------------
00027 #ifndef SVHFIRMWAREINFO_H
00028 #define SVHFIRMWAREINFO_H
00029 
00030 namespace driver_svh {
00031 
00035 struct SVHFirmwareInfo
00036 {
00038   std::string svh;
00040   uint16_t version_major;
00042   uint16_t version_minor;
00044   std::string text;
00045 
00047   bool operator == (const SVHFirmwareInfo& other) const
00048   {
00049     return (version_major == other.version_major && version_minor == other.version_minor);
00050   }
00051 };
00052 
00054 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, SVHFirmwareInfo& data)
00055 {
00056   // Stream operator can not handle arrays (due to missing size information) to make things easy we just copy the data around. Feel free to do something else
00057   // Todo: The conversion in this direction is not properly working, as the readout is working fine so far this is a fix for later.
00058   // It is probably something that has to do with the data types and how that is interpreted by the arrayBuilder
00059   std::vector<int8_t> text(48);
00060   std::vector<int8_t> svh(4);
00061   svh.insert(svh.begin(),data.svh.begin(),data.svh.end());
00062   text.insert(text.begin(),data.text.begin(),data.text.end());
00063 
00064   ab << svh
00065      << data.version_major
00066      << data.version_minor
00067      << text;
00068   return ab;
00069 }
00070 
00071 
00072 
00074 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHFirmwareInfo& data)
00075 {
00076   // Stream operator can not handle arrays (due to missing size information) to make things easy we just copy the data around. Feel free to do something else
00077   std::vector<uint8_t> text(48);
00078   std::vector<uint8_t> svh(4);
00079 
00080   ab >> svh
00081      >> data.version_major
00082      >> data.version_minor
00083      >> text;
00084 
00085 
00086   data.text = std::string(text.begin(),text.end());
00087   data.svh = std::string(svh.begin(),svh.end());
00088 //  std::copy (text.begin(),text.end(),data.text);
00089 //  std::copy (svh.begin(),svh.end(),data.svh);
00090 
00091   return ab;
00092 }
00093 
00095 inline std::ostream& operator << (std::ostream& o, const SVHFirmwareInfo& fw)
00096 {
00097   o << fw.svh.c_str()  << " " << fw.version_major << "." << fw.version_minor << " : " << fw.text.c_str() << endl;
00098   return o;
00099 }
00100 
00101 
00102 
00103 }
00104 
00105 
00106 
00107 #endif // SVHFIRMWAREINFO_H


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Apr 28 2017 02:31:08