File tree 2 files changed +18
-0
lines changed
micropython/bluetooth/aioble/aioble 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,10 @@ async def exchange_mtu(self, mtu=None):
274
274
await self ._mtu_event .wait ()
275
275
return self .mtu
276
276
277
+ def indicate_service_changed (self , handle_start = None , handle_end = None ):
278
+ from .server import indicate_service_changed
279
+ indicate_service_changed (self ._conn_handle , handle_start , handle_end )
280
+
277
281
# Wait for a connection on an L2CAP connection-oriented-channel.
278
282
async def l2cap_accept (self , psm , mtu , timeout_ms = None ):
279
283
from .l2cap import accept
Original file line number Diff line number Diff line change @@ -282,3 +282,17 @@ def register_services(*services):
282
282
for descriptor in characteristic .descriptors :
283
283
descriptor ._register (service_handles [n ])
284
284
n += 1
285
+
286
+
287
+ # Send indication on the service changed characteristic.
288
+ # Targets specific connection if provided, else sends to all connected and/or bonded devices.
289
+ # Flags specific changed characteristics if provided else all will be indicated.
290
+ def indicate_service_changed (conn_handle = None , changed : List [Characteristic ] = None ):
291
+ handle_start = 0x0000
292
+ handle_end = 0xFFFF
293
+ if changed :
294
+ print (_registered_characteristics )
295
+ handles = sorted ([c ._value_handle for c in changed ])
296
+ handle_start = handles [0 ] - 1 # def handle is one less than value_handle
297
+ handle_end = handles [- 1 ]
298
+ ble .gap_indicate_service_changed (conn_handle , handle_start , handle_end )
You can’t perform that action at this time.
0 commit comments