48 virtual int serialize(
unsigned char *outbuffer)
const = 0;
50 virtual const char *
getType() = 0;
51 virtual const char *
getMD5() = 0;
66 const int32_t* val = (int32_t*) &f;
67 int32_t exp = ((*val >> 23) & 255);
77 *(outbuffer++) = (sig << 5) & 0xff;
78 *(outbuffer++) = (sig >> 3) & 0xff;
79 *(outbuffer++) = (sig >> 11) & 0xff;
80 *(outbuffer++) = ((exp << 4) & 0xF0) | ((sig >> 19) & 0x0F);
81 *(outbuffer++) = (exp >> 4) & 0x7F;
86 *(outbuffer - 1) |= 0x80;
104 uint32_t* val = (uint32_t*)f;
108 *val = ((uint32_t)(*(inbuffer++)) >> 5 & 0x07);
109 *val |= ((uint32_t)(*(inbuffer++)) & 0xff) << 3;
110 *val |= ((uint32_t)(*(inbuffer++)) & 0xff) << 11;
111 *val |= ((uint32_t)(*inbuffer) & 0x0f) << 19;
114 uint32_t exp = ((uint32_t)(*(inbuffer++)) & 0xf0) >> 4;
115 exp |= ((uint32_t)(*inbuffer) & 0x7f) << 4;
118 *val |= ((exp) - 1023 + 127) << 23;
122 *val |= ((uint32_t)(*(inbuffer++)) & 0x80) << 24;
128 template<
typename A,
typename V>
131 for (
size_t i = 0; i <
sizeof(V); i++)
132 arr[i] = (var >> (8 * i));
136 template<
typename V,
typename A>
140 for (
size_t i = 0; i <
sizeof(V); i++)
141 var |= (arr[i] << (8 * i));
static int serializeAvrFloat64(unsigned char *outbuffer, const float f)
This tricky function handles promoting a 32bit float to a 64bit double, so that AVR can publish messa...
static void arrToVar(V &var, const A arr)
virtual int deserialize(unsigned char *data)=0
virtual const char * getType()=0
static void varToArr(A arr, const V var)
virtual const char * getMD5()=0
virtual int serialize(unsigned char *outbuffer) const =0
static int deserializeAvrFloat64(const unsigned char *inbuffer, float *f)
This tricky function handles demoting a 64bit double to a 32bit float, so that AVR can understand mes...