@@ -51,10 +51,10 @@ def irq(event, data):
51
51
elif event == _IRQ_PERIPHERAL_DISCONNECT :
52
52
print ("_IRQ_PERIPHERAL_DISCONNECT" )
53
53
elif event == _IRQ_GATTC_CHARACTERISTIC_RESULT :
54
- # conn_handle, def_handle , value_handle, properties, uuid = data
54
+ # conn_handle, end_handle , value_handle, properties, uuid = data
55
55
if data [- 1 ] == CHAR_UUID :
56
56
print ("_IRQ_GATTC_CHARACTERISTIC_RESULT" , data [- 1 ])
57
- waiting_events [event ] = data [2 ]
57
+ waiting_events [event ] = ( data [2 ], data [ 1 ])
58
58
else :
59
59
return
60
60
elif event == _IRQ_GATTC_CHARACTERISTIC_DONE :
@@ -179,11 +179,11 @@ def instance1():
179
179
180
180
# Discover characteristics.
181
181
ble .gattc_discover_characteristics (conn_handle , 1 , 65535 )
182
- value_handle = wait_for_event (_IRQ_GATTC_CHARACTERISTIC_RESULT , TIMEOUT_MS )
182
+ value_handle , end_handle = wait_for_event (_IRQ_GATTC_CHARACTERISTIC_RESULT , TIMEOUT_MS )
183
183
wait_for_event (_IRQ_GATTC_CHARACTERISTIC_DONE , TIMEOUT_MS )
184
184
185
185
# Discover CCCD.
186
- ble .gattc_discover_descriptors (conn_handle , value_handle , value_handle + 5 )
186
+ ble .gattc_discover_descriptors (conn_handle , value_handle , end_handle )
187
187
cccd_handle = wait_for_event (_IRQ_GATTC_DESCRIPTOR_RESULT , TIMEOUT_MS )
188
188
wait_for_event (_IRQ_GATTC_DESCRIPTOR_DONE , TIMEOUT_MS )
189
189
0 commit comments