diff options
Diffstat (limited to 'src/components/protocol_handler/include/protocol_handler/protocol_packet.h')
-rw-r--r-- | src/components/protocol_handler/include/protocol_handler/protocol_packet.h | 65 |
1 files changed, 12 insertions, 53 deletions
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h index 1c427533e6..de4af84915 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h @@ -64,58 +64,6 @@ class ProtocolPacket { }; /** - * \class ProtocolVersion - * \brief Used for storing the full protocol version of a service - * (major.minor.patch). - */ - class ProtocolVersion { - public: - ProtocolVersion(); - ProtocolVersion(uint8_t majorVersion, - uint8_t minorVersion, - uint8_t patchVersion); - ProtocolVersion(ProtocolVersion& other); - ProtocolVersion(std::string versionString); - uint8_t majorVersion; - uint8_t minorVersion; - uint8_t patchVersion; - static inline int16_t cmp(const ProtocolVersion& version1, - const ProtocolVersion& version2) { - int16_t diff = - static_cast<int16_t>(version1.majorVersion - version2.majorVersion); - if (diff == 0) { - diff = - static_cast<int16_t>(version1.minorVersion - version2.minorVersion); - if (diff == 0) { - diff = static_cast<int16_t>(version1.patchVersion - - version2.patchVersion); - } - } - return diff; - } - inline bool operator==(const ProtocolVersion& other) { - return ProtocolVersion::cmp(*this, other) == 0; - } - inline bool operator<(const ProtocolVersion& other) { - return ProtocolVersion::cmp(*this, other) < 0; - } - bool operator>(const ProtocolVersion& other) { - return ProtocolVersion::cmp(*this, other) > 0; - } - inline bool operator<=(const ProtocolVersion& other) { - return ProtocolVersion::cmp(*this, other) <= 0; - } - bool operator>=(const ProtocolVersion& other) { - return ProtocolVersion::cmp(*this, other) >= 0; - } - static inline ProtocolVersion* min(ProtocolVersion& version1, - ProtocolVersion& version2) { - return (version1 < version2) ? &version1 : &version2; - } - std::string to_string(); - }; - - /** * \class ProtocolHeader * \brief Used for storing protocol header of a message. */ @@ -252,6 +200,12 @@ class ProtocolPacket { const size_t messageSize); /** + * @brief Calculates FIRST_FRAME data for further handling of consecutive + * frames + */ + void HandleRawFirstFrameData(const uint8_t* message); + + /** * \brief Getter of protocol version. */ uint8_t protocol_version() const; @@ -326,6 +280,11 @@ class ProtocolPacket { ConnectionID connection_id() const; /** + * \brief Setter of Connection Identifier + */ + void set_connection_id(ConnectionID connection_id); + + /** * \brief Getter for data payload size */ uint32_t payload_size() const; @@ -364,7 +323,7 @@ class ProtocolPacket { * @brief Type definition for variable that hold shared pointer to protocolol * packet */ -typedef utils::SharedPtr<protocol_handler::ProtocolPacket> ProtocolFramePtr; +typedef std::shared_ptr<protocol_handler::ProtocolPacket> ProtocolFramePtr; typedef std::list<ProtocolFramePtr> ProtocolFramePtrList; template <typename _CharT> |