Add function to get size of message by command ID
This commit is contained in:
@@ -259,3 +259,27 @@ enum MESSAGEERR {
|
|||||||
|
|
||||||
enum MESSAGEERR
|
enum MESSAGEERR
|
||||||
message_validate(const union Message* message);
|
message_validate(const union Message* message);
|
||||||
|
|
||||||
|
static
|
||||||
|
inline
|
||||||
|
size_t
|
||||||
|
message_length(uint16_t cmd) {
|
||||||
|
switch(cmd) {
|
||||||
|
case SET_SDK_CONNECTION_CMD:
|
||||||
|
return sizeof(struct SetSdkConnectionReq);
|
||||||
|
case SDK_HEARTBEAT_CMD:
|
||||||
|
return sizeof(struct SdkHeartbeatReq);
|
||||||
|
case SET_SDK_MODE_CMD:
|
||||||
|
return sizeof(struct SetSdkModeReq);
|
||||||
|
case SET_SYSTEM_LED_CMD:
|
||||||
|
return sizeof(struct SetSystemLedReq);
|
||||||
|
case SET_ROBOT_MODE_CMD:
|
||||||
|
return sizeof(struct SetRobotModeReq);
|
||||||
|
case SUBNODE_RESET_CMD:
|
||||||
|
return sizeof(struct SubNodeResetReq);
|
||||||
|
case SUBSCRIBE_ADD_NODE_CMD:
|
||||||
|
return sizeof(struct SubscribeAddNodeReq);
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user