38AbsoluteTime::AbsoluteTime(
const uint8_t * data_le,
const int size) {
39 if(
nullptr == data_le || 0 == size ) {
43 if( 2 > size )
return;
44 year = (int16_t) ( data_le[i+0] | data_le[i+1] << 8 );
46 if( 3 > size )
return;
47 month =
static_cast<int8_t
>(data_le[i++]);
48 if( 4 > size )
return;
49 day =
static_cast<int8_t
>(data_le[i++]);
50 if( 5 > size )
return;
51 hour =
static_cast<int8_t
>(data_le[i++]);
52 if( 6 > size )
return;
53 minute =
static_cast<int8_t
>(data_le[i++]);
54 if( 7 > size )
return;
55 second =
static_cast<int8_t
>(data_le[i++]);
56 if( 8 > size )
return;
62 const size_t count = snprintf(cbuf,
sizeof(cbuf),
"%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
64 if( count >=
sizeof(cbuf) ) {
67 std::string res(cbuf);
82 uint16_t mantissa = raw_bt_float16_le & 0x0FFF;
83 int8_t exponent = (int8_t) ( ( raw_bt_float16_le >> 12 ) & 0xFF );
85 if( exponent >= 0x0008) {
86 exponent = (int8_t) ( - ( (0x000F + 1) - (int)exponent ) );
90 mantissa <= ReservedSFloatValues::MDER_S_NEGATIVE_INFINITY ) {
93 if ( mantissa >= 0x0800 ) {
94 mantissa = - ( ( 0x0FFF + 1 ) - mantissa );
96 return (
float)mantissa * ::powf(10.0f, (
float)exponent);
100 int32_t mantissa = (int32_t) ( raw_bt_float32_le & 0xFFFFFF );
101 int8_t exponent = (int8_t) ( ( raw_bt_float32_le >> 24 ) & 0xFF );
104 mantissa <= ReservedFloatValues::MDER_NEGATIVE_INFINITY ) {
107 if( mantissa >= 0x800000 ) {
108 mantissa = - ( ( 0xFFFFFF + 1 ) - mantissa );
110 return (
float)mantissa * ::powf(10.0f, (
float)exponent);
static const float reserved_float_values[5]
static const uint32_t FIRST_S_RESERVED_VALUE
static const int32_t FIRST_RESERVED_VALUE
std::string toString() const
static float float16_IEEE11073_to_IEEE754(const uint16_t raw_bt_float16_le)
Converts a 'IEEE-11073 16-bit SFLOAT' to std IEEE754 float.
static float float32_IEEE11073_to_IEEE754(const uint32_t raw_bt_float32_le)
Converts a 'IEEE-11073 32-bit FLOAT' to std IEEE754 float.
std::string to_string(const alphabet &v) noexcept