|
32 | 32 | #include <vector>
|
33 | 33 | #include <iostream>
|
34 | 34 | #include <sstream>
|
35 |
| -#include <climits> |
36 | 35 | #include <cmath>
|
37 | 36 | #include <thread>
|
38 | 37 | #include <map>
|
|
46 | 45 | #include <bitset>
|
47 | 46 | #include <mutex>
|
48 | 47 | #include <atomic>
|
49 |
| -#include <algorithm> |
50 | 48 | #include <deque>
|
51 | 49 | #include <condition_variable>
|
52 | 50 | #include <chrono>
|
@@ -75,8 +73,9 @@ extern "C" {
|
75 | 73 | #define PRIORITY_P3 0b01100000 // God-mode priority (not implemented)
|
76 | 74 | #define UNDEFINED_FLAG 0b10000000 // TBD
|
77 | 75 |
|
78 |
| -#define EFP_MAJOR_VERSION 0 |
79 |
| -#define EFP_MINOR_VERSION 4 |
| 76 | +constexpr uint8_t EFP_MAJOR_VERSION = 0; |
| 77 | +constexpr uint8_t EFP_MINOR_VERSION = 4; |
| 78 | +constexpr uint16_t EFP_VERSION = static_cast<uint16_t>(EFP_MAJOR_VERSION) << 8 | EFP_MINOR_VERSION; |
80 | 79 |
|
81 | 80 | // Bitwise operations are used on members therefore the namespace is wrapping enum instead of 'enum class'
|
82 | 81 | /// Definition of the data types supported by EFP
|
@@ -220,7 +219,7 @@ class ElasticFrameProtocolSender {
|
220 | 219 | virtual ~ElasticFrameProtocolSender();
|
221 | 220 |
|
222 | 221 | ///Return the version of the current implementation (Uint16)((8 MSB Major) + (8 LSB Minor))
|
223 |
| - uint16_t getVersion() { return ((uint16_t)EFP_MAJOR_VERSION << 8) | (uint16_t)EFP_MINOR_VERSION; } |
| 222 | + static uint16_t getVersion() { return EFP_VERSION; } |
224 | 223 |
|
225 | 224 | /**
|
226 | 225 | * Converts the original data from a vector to EFP packets/fragments
|
@@ -343,7 +342,7 @@ class ElasticFrameProtocolSender {
|
343 | 342 | private:
|
344 | 343 | //Private methods ----- START ------
|
345 | 344 | // Used by the C - API
|
346 |
| - void sendData(const std::vector<uint8_t> &rSubPacket, uint8_t lStreamID, ElasticFrameProtocolContext* pCTX); |
| 345 | + void sendData(const std::vector<uint8_t> &rSubPacket, uint8_t lStreamID, ElasticFrameProtocolContext* pCTX) const; |
347 | 346 | //Private methods ----- END ------
|
348 | 347 |
|
349 | 348 | // Internal lists and variables ----- START ------
|
@@ -439,8 +438,7 @@ class ElasticFrameProtocolReceiver {
|
439 | 438 | virtual ~ElasticFrameProtocolReceiver();
|
440 | 439 |
|
441 | 440 | ///Return the version of the current implementation
|
442 |
| - uint16_t getVersion() { return ((uint16_t)EFP_MAJOR_VERSION << 8) | (uint16_t)EFP_MINOR_VERSION; } |
443 |
| - |
| 441 | + static uint16_t getVersion() { return EFP_VERSION; } |
444 | 442 | /**
|
445 | 443 | * Function assembling received fragments from a vector
|
446 | 444 | *
|
@@ -593,7 +591,7 @@ class ElasticFrameProtocolReceiver {
|
593 | 591 | ElasticFrameMessages stopReceiver();
|
594 | 592 |
|
595 | 593 | // C-API callback. If C++ is used this is a dummy callback
|
596 |
| - void gotData(pFramePtr &rPacket, ElasticFrameProtocolContext* pCTX); |
| 594 | + void gotData(pFramePtr &rPacket, ElasticFrameProtocolContext* pCTX) const; |
597 | 595 |
|
598 | 596 | // Method unpacking Type1 fragments
|
599 | 597 | ElasticFrameMessages unpackType1(const uint8_t *pSubPacket, size_t lPacketSize, uint8_t lFromSource);
|
|
0 commit comments