Skip to content

Commit c113611

Browse files
committed
aioble: Fix descriptor flag handling.
Removes the workaround for micropython/issues/6864. Sets the default flags for discovered descriptors to be WRITE, so that d.write() will implicitly set response=True. Signed-off-by: Jim Mussared <[email protected]>
1 parent 01db3da commit c113611

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

micropython/bluetooth/aioble-client/manifest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(version="0.2.0")
1+
metadata(version="0.3.0")
22

33
require("aioble-core")
44

micropython/bluetooth/aioble-server/manifest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(version="0.2.0")
1+
metadata(version="0.3.0")
22

33
require("aioble-core")
44

micropython/bluetooth/aioble/aioble/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class ClientDescriptor(BaseClientCharacteristic):
439439
def __init__(self, characteristic, dsc_handle, uuid):
440440
self.characteristic = characteristic
441441

442-
super().__init__(dsc_handle, _FLAG_READ | _FLAG_WRITE_NO_RESPONSE, uuid)
442+
super().__init__(dsc_handle, _FLAG_READ | _FLAG_WRITE, uuid)
443443

444444
def __str__(self):
445445
return "Descriptor: {} {} {}".format(self._value_handle, self.properties, self.uuid)

micropython/bluetooth/aioble/aioble/server.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838

3939
_FLAG_WRITE_CAPTURE = const(0x10000)
4040

41-
_FLAG_DESC_READ = const(1)
42-
_FLAG_DESC_WRITE = const(2)
43-
4441

4542
_WRITE_CAPTURE_QUEUE_LIMIT = const(10)
4643

@@ -307,14 +304,13 @@ class Descriptor(BaseCharacteristic):
307304
def __init__(self, characteristic, uuid, read=False, write=False, initial=None):
308305
characteristic.descriptors.append(self)
309306

310-
# Workaround for https://github.com/micropython/micropython/issues/6864
311307
flags = 0
312308
if read:
313-
flags |= _FLAG_DESC_READ
309+
flags |= _FLAG_READ
314310
if write:
311+
flags |= _FLAG_WRITE
315312
self._write_event = asyncio.ThreadSafeFlag()
316313
self._write_data = None
317-
flags |= _FLAG_DESC_WRITE
318314

319315
self.uuid = uuid
320316
self.flags = flags

micropython/bluetooth/aioble/manifest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# code. This allows (for development purposes) all the files to live in the
44
# one directory.
55

6-
metadata(version="0.2.1")
6+
metadata(version="0.3.1")
77

88
# Default installation gives you everything. Install the individual
99
# components (or a combination of them) if you want a more minimal install.

0 commit comments

Comments
 (0)