firmware.hpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10 ** Preprocessor
11 *****************************************************************************/
12 
13 #ifndef KOBUKI_FW_DATA_HPP__
14 #define KOBUKI_FW_DATA_HPP__
15 
16 /*****************************************************************************
17 ** Include
18 *****************************************************************************/
19 
20 #include <vector>
21 
22 #include "../packet_handler/payload_base.hpp"
23 #include "../packet_handler/payload_headers.hpp"
24 
25 /*****************************************************************************
26 ** Namespace
27 *****************************************************************************/
28 
29 namespace kobuki
30 {
31 
32 /*****************************************************************************
33 ** Interface
34 *****************************************************************************/
35 
36 class Firmware : public packet_handler::payloadBase
37 {
38 public:
39  static const uint32_t COMPATIBLE_MAJOR_VERSION; // protocol communication will fail
40  static const std::vector<uint32_t> RECOMMENDED_VERSIONS; // advisory minor.patch recommendations
41 
43 
44  // methods
45  bool serialise(ecl::PushAndPop<unsigned char> & byteStream)
46  {
47  unsigned char length = 4;
48  buildBytes(Header::Firmware, byteStream);
49  buildBytes(length, byteStream);
50  buildBytes(data.version, byteStream);
51  return true;
52  }
53 
55 
56  bool constrain()
57  {
58  return true;
59  }
60 
61  void showMe()
62  {
63  }
64 
65  const uint32_t& version() const { return data.version; }
66  int majorVersion() const { return VersionInfo::majorVersion(data.version); }
67  int minorVersion() const { return VersionInfo::minorVersion(data.version); }
68  int patchVersion() const { return VersionInfo::patchVersion(data.version); }
69 
70  int checkMajorVersion() const;
71  int checkRecommendedVersion() const;
72 
73 private:
74  struct Data {
75  uint32_t version;
76  };
77  Data data;
78 };
79 
80 } // namespace kobuki
81 
82 #endif /* KOBUKI_FW_DATA_HPP__ */
83 
kobuki::Firmware::Data
Definition: firmware.hpp:88
packet_handler::payloadBase::length
const unsigned char length
Definition: payload_base.hpp:73
kobuki::Firmware::RECOMMENDED_VERSIONS
static const std::vector< uint32_t > RECOMMENDED_VERSIONS
Definition: firmware.hpp:54
kobuki
Definition: command.hpp:31
packet_handler::payloadBase::payloadBase
payloadBase(const bool is_dynamic_=false, const unsigned char length_=0)
Definition: payload_base.hpp:78
kobuki::Firmware::majorVersion
int majorVersion() const
Definition: firmware.hpp:80
kobuki::Header::Firmware
@ Firmware
Definition: payload_headers.hpp:54
kobuki::Firmware::serialise
bool serialise(ecl::PushAndPop< unsigned char > &byteStream)
Definition: firmware.hpp:59
kobuki::Firmware::constrain
bool constrain()
Definition: firmware.hpp:70
kobuki::Firmware::version
const uint32_t & version() const
Definition: firmware.hpp:79
packet_handler::payloadBase
Provides base class for payloads.
Definition: payload_base.hpp:44
kobuki::Firmware::patchVersion
int patchVersion() const
Definition: firmware.hpp:82
kobuki::VersionInfo::patchVersion
static int patchVersion(const uint32_t &version)
Definition: version_info.hpp:78
kobuki::Firmware::checkMajorVersion
int checkMajorVersion() const
Definition: firmware.cpp:91
kobuki::Firmware::Firmware
Firmware()
Definition: firmware.hpp:56
kobuki::Firmware::Data::version
uint32_t version
Definition: firmware.hpp:89
kobuki::Firmware::COMPATIBLE_MAJOR_VERSION
static const uint32_t COMPATIBLE_MAJOR_VERSION
Definition: firmware.hpp:53
kobuki::Firmware::minorVersion
int minorVersion() const
Definition: firmware.hpp:81
packet_handler::payloadBase::buildBytes
void buildBytes(const T &V, ecl::PushAndPop< unsigned char > &buffer)
Definition: payload_base.hpp:110
kobuki::Firmware::showMe
void showMe()
Definition: firmware.hpp:75
ecl::PushAndPop< unsigned char >
kobuki::VersionInfo::minorVersion
static int minorVersion(const uint32_t &version)
Definition: version_info.hpp:74
kobuki::Firmware::data
Data data
Definition: firmware.hpp:91
kobuki::Firmware::deserialise
bool deserialise(ecl::PushAndPop< unsigned char > &byteStream)
Definition: firmware.cpp:48
kobuki::Firmware::checkRecommendedVersion
int checkRecommendedVersion() const
Definition: firmware.cpp:99
packet_handler
Definition: payload_base.hpp:27
kobuki::VersionInfo::majorVersion
static int majorVersion(const uint32_t &version)
Definition: version_info.hpp:70


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Wed Mar 2 2022 00:26:14