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 
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
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; }
69 
70  int checkMajorVersion() const;
71  int checkRecommendedVersion() const;
72 
73 private:
74  struct Data {
75  uint32_t version;
76  };
78 };
79 
80 } // namespace kobuki
81 
82 #endif /* KOBUKI_FW_DATA_HPP__ */
83 
int checkMajorVersion() const
Definition: firmware.cpp:87
int majorVersion() const
Definition: firmware.hpp:66
static int majorVersion(const uint32_t &version)
int minorVersion() const
Definition: firmware.hpp:67
const unsigned char length
Provides base class for payloads.
payloadBase(const bool is_dynamic_=false, const unsigned char length_=0)
int checkRecommendedVersion() const
Definition: firmware.cpp:95
bool serialise(ecl::PushAndPop< unsigned char > &byteStream)
Definition: firmware.hpp:45
static const std::vector< uint32_t > RECOMMENDED_VERSIONS
Definition: firmware.hpp:40
const uint32_t & version() const
Definition: firmware.hpp:65
bool constrain()
Definition: firmware.hpp:56
bool deserialise(ecl::PushAndPop< unsigned char > &byteStream)
Definition: firmware.cpp:44
static int patchVersion(const uint32_t &version)
static int minorVersion(const uint32_t &version)
static const uint32_t COMPATIBLE_MAJOR_VERSION
Definition: firmware.hpp:39
void buildBytes(const T &V, ecl::PushAndPop< unsigned char > &buffer)
int patchVersion() const
Definition: firmware.hpp:68


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Fri Sep 18 2020 03:22:01