Skip to content

Commit 6639ca6

Browse files
authored
Merge pull request #72 from tannewt/remove_radio
Remove radio and fix scan
2 parents 0658d8d + 5022f8f commit 6639ca6

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

adafruit_ble/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ def start_scan(self, *advertisement_types, buffer_size=512, extended=False, time
222222
for possible_type in advertisement_types:
223223
if possible_type.matches(entry) and issubclass(possible_type, adv_type):
224224
adv_type = possible_type
225+
# Double check the adv_type is requested. We may return Advertisement accidentally
226+
# otherwise.
227+
if adv_type not in advertisement_types:
228+
continue
225229
advertisement = adv_type.from_entry(entry)
226230
if advertisement:
227231
yield advertisement

adafruit_ble/advertising/adafruit.py

-16
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
_MANUFACTURING_DATA_ADT = const(0xff)
4444
_ADAFRUIT_COMPANY_ID = const(0x0822)
4545
_COLOR_DATA_ID = const(0x0000)
46-
_RADIO_DATA_ID = const(0x0001) # TODO: check this isn't already taken.
4746

4847

4948
class AdafruitColor(Advertisement):
@@ -62,18 +61,3 @@ class AdafruitColor(Advertisement):
6261
key_encoding="<H")
6362
color = ManufacturerDataField(_COLOR_DATA_ID, "<I")
6463
"""Color to broadcast as RGB integer."""
65-
66-
67-
class AdafruitRadio(Advertisement):
68-
"""Broadcast arbitrary bytes as a radio message."""
69-
prefix = struct.pack("<BBHH",
70-
0x6,
71-
_MANUFACTURING_DATA_ADT,
72-
_ADAFRUIT_COMPANY_ID,
73-
_RADIO_DATA_ID)
74-
manufacturer_data = LazyObjectField(ManufacturerData,
75-
"manufacturer_data",
76-
advertising_data_type=_MANUFACTURING_DATA_ADT,
77-
company_id=_ADAFRUIT_COMPANY_ID,
78-
key_encoding="<H")
79-
msg = ManufacturerDataField(_RADIO_DATA_ID, "<248s") # 255 byte ads

0 commit comments

Comments
 (0)