@@ -1010,21 +1010,22 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
1010
1010
}
1011
1011
1012
1012
int att_read_group_req (uint16_t conn_handle , uint16_t start_handle , uint16_t end_handle , uint16_t uuid , uint8_t response_buffer []) {
1013
- struct __packed {
1013
+
1014
+ typedef struct __packed {
1014
1015
struct bt_att_hdr h ;
1015
1016
struct bt_att_read_group_req r ;
1016
- } req = { {
1017
- .code = BT_ATT_OP_READ_GROUP_REQ ,
1018
- }, {
1019
- .start_handle = start_handle ,
1020
- .end_handle = end_handle ,
1021
- }
1022
- };
1023
- req .r .uuid [0 ] = uuid & 0xff ;
1024
- req .r .uuid [1 ] = uuid >> 8 ;
1017
+ } req_t ;
1025
1018
1019
+ uint8_t req_bytes [sizeof (req_t ) + sizeof (uuid )];
1020
+ req_t * req = (req_t * ) req_bytes ;
1026
1021
1027
- return send_req_wait_for_rsp (conn_handle , sizeof (req ), (uint8_t * ) & req , response_buffer );
1022
+ req -> h .code = BT_ATT_OP_READ_GROUP_REQ ;
1023
+ req -> r .start_handle = start_handle ;
1024
+ req -> r .end_handle = end_handle ;
1025
+ req -> r .uuid [0 ] = uuid & 0xff ;
1026
+ req -> r .uuid [1 ] = uuid >> 8 ;
1027
+
1028
+ return send_req_wait_for_rsp (conn_handle , sizeof (req_bytes ), req_bytes , response_buffer );
1028
1029
}
1029
1030
1030
1031
STATIC void process_read_group_rsp (uint16_t conn_handle , uint8_t dlen , uint8_t data []) {
@@ -1305,20 +1306,21 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
1305
1306
}
1306
1307
1307
1308
int att_read_type_req (uint16_t conn_handle , uint16_t start_handle , uint16_t end_handle , uint16_t type , uint8_t response_buffer []) {
1308
- struct __packed {
1309
+ typedef struct __packed {
1309
1310
struct bt_att_hdr h ;
1310
1311
struct bt_att_read_type_req r ;
1311
- } req = { {
1312
- .code = BT_ATT_OP_READ_TYPE_REQ ,
1313
- }, {
1314
- .start_handle = start_handle ,
1315
- .end_handle = end_handle ,
1316
- }
1317
- };
1318
- req .r .uuid [0 ] = type & 0xff ;
1319
- req .r .uuid [1 ] = type >> 8 ;
1312
+ } req_t ;
1320
1313
1321
- return send_req_wait_for_rsp (conn_handle , sizeof (req ), (uint8_t * ) & req , response_buffer );
1314
+ uint8_t req_bytes [sizeof (req_t ) + sizeof (type )];
1315
+ req_t * req = (req_t * ) req_bytes ;
1316
+
1317
+ req -> h .code = BT_ATT_OP_READ_TYPE_REQ ;
1318
+ req -> r .start_handle = start_handle ;
1319
+ req -> r .end_handle = end_handle ;
1320
+ req -> r .uuid [0 ] = type & 0xff ;
1321
+ req -> r .uuid [1 ] = type >> 8 ;
1322
+
1323
+ return send_req_wait_for_rsp (conn_handle , sizeof (req_bytes ), req_bytes , response_buffer );
1322
1324
}
1323
1325
1324
1326
STATIC void process_read_type_rsp (uint16_t conn_handle , uint8_t dlen , uint8_t data []) {
0 commit comments