From de5837ab9066e2809cbc125d42f68a84ebd69c81 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 29 Aug 2024 15:33:52 +0800 Subject: [PATCH] update --- ble_through/ble_proto_utils.c | 6 ++++-- ble_through/ble_proto_utils.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ble_through/ble_proto_utils.c b/ble_through/ble_proto_utils.c index 10a260d..5f50a46 100644 --- a/ble_through/ble_proto_utils.c +++ b/ble_through/ble_proto_utils.c @@ -55,8 +55,10 @@ void zble_proto_utils_create_cmd_packet(zble_proto_packet_t *packet, uint16_t cm BLE_THROUGH_PACKET_SET_TAIL(packet); } -void zble_proto_utils_create_cmd_packet_int32(zble_proto_packet_t *packet, uint16_t cmd, uint8_t index, int32_t *data, int32_t ndata) { - zble_proto_utils_create_cmd_packet(packet, cmd, index, (uint8_t *)data, ndata * 4); +void zble_proto_utils_create_cmd_packet_int32(zble_proto_packet_t *packet, uint16_t cmd, uint8_t index, int32_t *data, int32_t ndata) { zble_proto_utils_create_cmd_packet(packet, cmd, index, (uint8_t *)data, ndata * 4); } +void zble_proto_utils_set_packet_to(zble_proto_packet_t *packet, zble_proto_role_t to) { + packet->to = to; + BLE_THROUGH_PACKET_SET_CHECKSUM(packet); } void zble_proto_utils_create_error_receipt(zble_proto_packet_t *packet, zble_proto_packet_t *rxpacket, int32_t errorcode) { diff --git a/ble_through/ble_proto_utils.h b/ble_through/ble_proto_utils.h index 6a33904..cd1f0fb 100644 --- a/ble_through/ble_proto_utils.h +++ b/ble_through/ble_proto_utils.h @@ -32,6 +32,9 @@ void zble_proto_utils_create_error_receipt(zble_proto_packet_t *packet, zble_pro void zble_proto_utils_create_receipt(zble_proto_packet_t *packet, zble_proto_packet_t *rxpacket, uint8_t *data, int32_t len); void zble_proto_utils_create_report(zble_proto_packet_t *packet, uint16_t index, uint16_t cmd, uint8_t *data, int32_t len); +void zble_proto_utils_set_packet_to(zble_proto_packet_t *packet, zble_proto_role_t to); + + #ifdef __cplusplus } #endif