Skip to content

Commit 78900af

Browse files
FlantasticDandpgeorge
authored andcommitted
aioble: Add short name support to scan results.
Signed-off-by: Damien George <[email protected]>
1 parent 23018a8 commit 78900af

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

micropython/bluetooth/aioble-central/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.2.1")
22

33
require("aioble-core")
44

micropython/bluetooth/aioble/aioble/central.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
_ADV_TYPE_FLAGS = const(0x01)
3535
_ADV_TYPE_NAME = const(0x09)
36+
_ADV_TYPE_SHORT_NAME = const(0x08)
3637
_ADV_TYPE_UUID16_INCOMPLETE = const(0x2)
3738
_ADV_TYPE_UUID16_COMPLETE = const(0x3)
3839
_ADV_TYPE_UUID32_INCOMPLETE = const(0x4)
@@ -187,9 +188,9 @@ def _decode_field(self, *adv_type):
187188
yield payload[i + 2 : i + payload[i] + 1]
188189
i += 1 + payload[i]
189190

190-
# Returns the value of the advertised name, otherwise empty string.
191+
# Returns the value of the complete (or shortened) advertised name, if available.
191192
def name(self):
192-
for n in self._decode_field(_ADV_TYPE_NAME):
193+
for n in self._decode_field(_ADV_TYPE_NAME, _ADV_TYPE_SHORT_NAME):
193194
return str(n, "utf-8") if n else ""
194195

195196
# Generator that enumerates the service UUIDs that are advertised.

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.0")
6+
metadata(version="0.2.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)