#pragma once #include "protocol.h" #define HYDROLINK_MSG_ID_SET_RESPONSE 3 #define HYDROLINK_MSG_ID_SET_RESPONSE_LEN 2 #define HYDROLINK_MSG_ID_3_LEN 2 #define HYDROLINK_MSG_ID_SET_RESPONSE_CRC_EXTRA 250 typedef struct hydrolink_msg_set_response_t_s { uint8_t result; /// uint8_t cmd_id; /// } hydrolink_msg_set_response_t; static inline void hydrolink_set_response_msg_encode(uint8_t src_id, uint8_t dst_id, const hydrolink_msg_set_response_t *msg, hydrolink_msg_t *packet) { packet->id = HYDROLINK_MSG_ID_SET_RESPONSE; packet->src_id = src_id; packet->dst_id = dst_id; packet->payload_length = HYDROLINK_MSG_ID_3_LEN + HYDROLINK_NON_PAYLOAD_LEN; hydrolink_put_uint8_t(HYDROLINK_PAYLOAD_NON_CONST(packet), 0, msg->result); hydrolink_put_uint8_t(HYDROLINK_PAYLOAD_NON_CONST(packet), 1, msg->cmd_id); } static inline uint8_t hydrolink_msg_set_response_get_result(const hydrolink_msg_t *packet) { return HYDROLINK_RETURN_uint8_t(packet, 0); } static inline uint8_t hydrolink_msg_set_response_get_cmd_id(const hydrolink_msg_t *packet) { return HYDROLINK_RETURN_uint8_t(packet, 1); } static inline void hydrolink_msgset_response_decode(const hydrolink_msg_t *packet, hydrolink_msg_set_response_t *set_response) { set_response->result = hydrolink_msg_set_response_get_result(packet); set_response->cmd_id = hydrolink_msg_set_response_get_cmd_id(packet); }