Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DmTftLibrary eeprom SX1280Lib filesystem mbed
Fork of MSNV2-Terminal_V1-5 by
Diff: Value.hpp
- Branch:
- Integration
- Revision:
- 38:9b43b2415093
- Parent:
- 24:92c30dabfda4
- Child:
- 39:13e66d087ae9
--- a/Value.hpp Tue Oct 16 11:28:33 2018 +0000 +++ b/Value.hpp Fri Oct 19 06:32:59 2018 +0000 @@ -34,12 +34,13 @@ INT16_T = 6, UINT32_T = 7, INT32_T = 8, - FLOAT = 9, // Floating value on 32 bits - DOUBLE = 10, // Floating value on 64 bits - TIME = 11, // Unix time - TRIPLE_DOUBLE = 12 // Used for accelerometer values - // or other values of the same kind - } ; + UINT64_T = 9, + INT64_T = 10, + FLOAT = 11, // Floating value on 32 bits + DOUBLE = 12, // Floating value on 64 bits + TIME = 13, // Unix time + TRIPLE_DOUBLE = 14 // Used for accelerometer values or other values of the same kind + }; typedef struct { union { @@ -47,13 +48,13 @@ char char_value; uint8_t uint8_value; int8_t int8_value; - uint16_t uint16_value; + uint16_t uint16_value; int16_t int16_value; - uint32_t uint32_value; + uint32_t uint32_value; int32_t int32_value; float float_value; double double_value; - uint32_t time_value; + uint32_t time_value; double triple_double_values[3]; } value; VALUE_TYPE type; @@ -113,6 +114,16 @@ this->_value.value.int32_value = value; } + void setUint64Value(uint64_t value) { + this->_value.type = UINT64_T; + this->_value.value.uint64_value = value; + } + + void setInt64Value(int64_t value) { + this->_value.type = INT64_T; + this->_value.value.int64_value = value; + } + void setFloatValue(float value) { this->_value.type = FLOAT; this->_value.value.float_value = value; @@ -174,6 +185,14 @@ return this->_value.value.int32_value; } + uint64_t getUint64Value() { + return this->_value.value.uint64_value; + } + + int64_t getInt64Value() { + return this->_value.value.int64_value; + } + float getFloatValue() { return this->_value.value.float_value; } @@ -221,8 +240,13 @@ */ bool isDifferentFrom(Value& otherValue); +#ifdef TEST_ENVIRONMENT + // Used for debugging purpose + std::string toString(); +#endif - std::string toString(); + // Used to format messages + std::string toHex(); GENERIC_VALUE _value;