Implemented crc16 calculation for DevControlCommand
This commit is contained in:
parent
cfdbf5963c
commit
d998271944
@ -1,8 +1,16 @@
|
||||
#include "DevControlCommand.h"
|
||||
#include "crc.h"
|
||||
|
||||
DevControlCommand::DevControlCommand(uint64_t target_address, uint64_t router_address)
|
||||
: CommandAbstract(target_address, router_address)
|
||||
{
|
||||
_payload[0] = 0x51;
|
||||
_payload[9] = 0x81;
|
||||
}
|
||||
|
||||
void DevControlCommand::udpateCRC(uint8_t len)
|
||||
{
|
||||
uint16_t crc = crc16(&_payload[10], len);
|
||||
_payload[10 + len] = (uint8_t)(crc >> 8);
|
||||
_payload[10 + len + 1] = (uint8_t)(crc);
|
||||
}
|
||||
@ -5,4 +5,7 @@
|
||||
class DevControlCommand : public CommandAbstract {
|
||||
public:
|
||||
explicit DevControlCommand(uint64_t target_address = 0, uint64_t router_address = 0);
|
||||
|
||||
protected:
|
||||
void udpateCRC(uint8_t len);
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user