Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions adafruit_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ def start_scan(self, *advertisement_types, buffer_size=512, extended=False, time
for possible_type in advertisement_types:
if possible_type.matches(entry) and issubclass(possible_type, adv_type):
adv_type = possible_type
# Double check the adv_type is requested. We may return Advertisement accidentally
# otherwise.
if adv_type not in advertisement_types:
continue
advertisement = adv_type.from_entry(entry)
if advertisement:
yield advertisement
Expand Down
16 changes: 0 additions & 16 deletions adafruit_ble/advertising/adafruit.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
_MANUFACTURING_DATA_ADT = const(0xff)
_ADAFRUIT_COMPANY_ID = const(0x0822)
_COLOR_DATA_ID = const(0x0000)
_RADIO_DATA_ID = const(0x0001) # TODO: check this isn't already taken.


class AdafruitColor(Advertisement):
Expand All @@ -62,18 +61,3 @@ class AdafruitColor(Advertisement):
key_encoding="<H")
color = ManufacturerDataField(_COLOR_DATA_ID, "<I")
"""Color to broadcast as RGB integer."""


class AdafruitRadio(Advertisement):
"""Broadcast arbitrary bytes as a radio message."""
prefix = struct.pack("<BBHH",
0x6,
_MANUFACTURING_DATA_ADT,
_ADAFRUIT_COMPANY_ID,
_RADIO_DATA_ID)
manufacturer_data = LazyObjectField(ManufacturerData,
"manufacturer_data",
advertising_data_type=_MANUFACTURING_DATA_ADT,
company_id=_ADAFRUIT_COMPANY_ID,
key_encoding="<H")
msg = ManufacturerDataField(_RADIO_DATA_ID, "<248s") # 255 byte ads