1 #include "message_27.hpp"
8 message_27::message_27()
14 std::unique_ptr
<message
> message_27::parse(const raw
& data
)
17 throw std::invalid_argument
{"invalid number of bytes in message_27::parse"};
19 throw std::invalid_argument
{"invalid size specified in message"};
21 std::unique_ptr
<message
> result
= utils::make_unique
<message_27
>();
22 message_27
& msg
= static_cast<message_27
&>(*result
);
29 msg
.temperature
= value
;
30 msg
.temperature
-= 100;
35 raw
message_27::get_data() const
37 uint16_t value
= (temperature
+ 100) & 0xffff;
39 return raw
{static_cast<uint8_t>(ID
), 0x01, static_cast<uint8_t>((value
>> 8) & 0xff),
40 static_cast<uint8_t>((value
>> 0) & 0xff)};