File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
examples/bluetooth/nimble/ble_spp/spp_client/main Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,27 @@ static void
67
67
ble_spp_client_set_handle (const struct peer * peer )
68
68
{
69
69
const struct peer_chr * chr ;
70
+ const struct peer_dsc * dsc ;
71
+ uint8_t value [2 ];
70
72
chr = peer_chr_find_uuid (peer ,
71
73
BLE_UUID16_DECLARE (GATT_SPP_SVC_UUID ),
72
74
BLE_UUID16_DECLARE (GATT_SPP_CHR_UUID ));
73
75
attribute_handle [peer -> conn_handle ] = chr -> chr .val_handle ;
76
+ MODLOG_DFLT (INFO , "attribute_handle %x\n" , attribute_handle [peer -> conn_handle ]);
74
77
78
+ dsc = peer_dsc_find_uuid (peer ,
79
+ BLE_UUID16_DECLARE (GATT_SPP_SVC_UUID ),
80
+ BLE_UUID16_DECLARE (GATT_SPP_CHR_UUID ),
81
+ BLE_UUID16_DECLARE (BLE_GATT_DSC_CLT_CFG_UUID16 ));
82
+ if (dsc == NULL ) {
83
+ MODLOG_DFLT (ERROR , "Error: Peer lacks a CCCD for the subscribable characteristic\n" );
84
+ return ;
85
+ }
86
+
87
+ value [0 ] = 1 ;
88
+ value [1 ] = 0 ;
89
+ ble_gattc_write_flat (peer -> conn_handle , dsc -> dsc .handle ,
90
+ value , sizeof (value ), NULL , NULL );
75
91
}
76
92
77
93
You can’t perform that action at this time.
0 commit comments