Start adding push message support

master
PgSocks 7 months ago
parent 9de914dfa8
commit 72b9a2ba92

@ -280,6 +280,28 @@ struct PACKED StreamCtrlResp {
struct Footer footer; struct Footer footer;
}; };
struct PACKED AddSubMsgReq {
struct Header header;
uint8_t node_id;
uint8_t msg_id;
uint8_t reserved;
uint8_t sub_mode;
uint8_t subject_count;
uint64_t subject_uuid;
uint16_t freq;
struct Footer footer;
};
struct PACKED AddSubMsgResp {
struct Header header;
uint8_t retcode;
uint8_t pub_node_id;
uint8_t ack_node_id;
uint8_t ack_msg_id;
uint32_t ack_err_uid_data;
struct Footer footer;
};
union Request { union Request {
struct Header header; struct Header header;
struct SetSdkConnectionReq sdkconn; struct SetSdkConnectionReq sdkconn;
@ -295,6 +317,7 @@ union Request {
struct GimbalCtrlSpeedReq gimbspeed; struct GimbalCtrlSpeedReq gimbspeed;
struct BlasterFireReq blaster; struct BlasterFireReq blaster;
struct StreamCtrlReq stream; struct StreamCtrlReq stream;
struct AddSubMsgReq sub;
}; };
union Response { union Response {
struct Header header; struct Header header;
@ -311,6 +334,7 @@ union Response {
struct GimbalCtrlSpeedResp gimbspeed; struct GimbalCtrlSpeedResp gimbspeed;
struct BlasterFireResp blaster; struct BlasterFireResp blaster;
struct StreamCtrlResp stream; struct StreamCtrlResp stream;
struct AddSubMsgResp sub;
}; };
union Message { union Message {
struct Header header; struct Header header;

@ -108,3 +108,33 @@ subscribe_add_node (
uint16_t seq, uint16_t seq,
bool ack ); bool ack );
#define ADD_SUB_MSG_CMD 0x0348
#define DDS_BATTERY 0x000200096862229f
#define DDS_GIMBAL_BASE 0x00020009f5882874
#define DDS_VELOCITY 0x0002000949a4009c
#define DDS_ESC 0x00020009c14cb7c5
#define DDS_ATTITUDE 0x000200096b986306
#define DDS_IMU 0x00020009a7985b8d
#define DDS_POSITION 0x00020009eeb7cece
#define DDS_SA_STATUS 0x000200094a2c6d55
#define DDS_CHASSIS_MODE 0x000200094fcb1146
#define DDS_SBUS 0x0002000988223568
#define DDS_SERVO 0x000200095f0059e7
#define DDS_ARM 0x0002000926abd64d
#define DDS_GRIPPER 0x00020009124d156a
#define DDS_GIMBAL_POS 0x00020009f79b3c97
#define DDS_STICK 0x0002000955e9a0fa
#define DDS_MOVE_MODE 0x00020009784c7bfd
#define DDS_TOF 0x0002000986e4c05a
#define DDS_PINBOARD 0x00020009eebb9ffc
void
add_sub_msg (
union Request* req,
uint16_t seq,
bool ack,
uint8_t node_id,
uint8_t msg_id,
uint8_t freq,
uint64_t subject_uuid );

@ -41,6 +41,8 @@ message_length(int cmd) {
return sizeof(struct BlasterFireReq); return sizeof(struct BlasterFireReq);
case STREAM_CTRL_CMD: case STREAM_CTRL_CMD:
return sizeof(struct StreamCtrlReq); return sizeof(struct StreamCtrlReq);
case ADD_SUB_MSG_CMD:
return sizeof(struct AddSubMsgReq);
default: default:
return 0; return 0;
} }
@ -58,6 +60,7 @@ message_module(int cmd) {
case SET_ROBOT_MODE_CMD: case SET_ROBOT_MODE_CMD:
case SUBNODE_RESET_CMD: case SUBNODE_RESET_CMD:
case SUBSCRIBE_ADD_NODE_CMD: case SUBSCRIBE_ADD_NODE_CMD:
case ADD_SUB_MSG_CMD:
return host2byte(SDK_HOST, SDK_INDEX); return host2byte(SDK_HOST, SDK_INDEX);
case SET_WHEEL_SPEED_CMD: case SET_WHEEL_SPEED_CMD:
case CHASSIS_SPEED_MODE_CMD: case CHASSIS_SPEED_MODE_CMD:

@ -96,3 +96,25 @@ set_system_led (
req_finalize(seq, SET_SYSTEM_LED_CMD, ack, req); req_finalize(seq, SET_SYSTEM_LED_CMD, ack, req);
} }
void
add_sub_msg (
union Request* req,
uint16_t seq,
bool ack,
uint8_t node_id,
uint8_t msg_id,
uint8_t freq,
uint64_t subject_uuid ) {
req->sub.node_id = node_id;
req->sub.msg_id = msg_id;
req->sub.reserved = 0; // NOTE: Always 0
req->sub.sub_mode = 0; // NOTE: Always 0
req->sub.subject_count = 1; // TODO: Add support for multiple
req->sub.subject_uuid = subject_uuid; // TODO: Add support for multiple
req->sub.freq = freq;
req_finalize(seq, ADD_SUB_MSG_CMD, ack, req);
}

Loading…
Cancel
Save