Skip to content

Commit ee280f1

Browse files
committed
Use newly exposed BLE constants
1 parent 84909cf commit ee280f1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

adafruit_ble_radio.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
from adafruit_ble import BLERadio
2929
from adafruit_ble.advertising import Advertisement, LazyObjectField
3030
from adafruit_ble.advertising.standard import ManufacturerData
31+
from adafruit_ble.advertising.adafruit import (
32+
MANUFACTURING_DATA_ADT,
33+
ADAFRUIT_COMPANY_ID,
34+
)
3135

3236

3337
__version__ = "0.0.0-auto.0"
@@ -40,20 +44,18 @@
4044
#: Amount of time to advertise a message (in seconds).
4145
AD_DURATION = 0.5
4246

43-
_MANUFACTURING_DATA_ADT = const(0xFF)
44-
_ADAFRUIT_COMPANY_ID = const(0x0822)
4547
_RADIO_DATA_ID = const(0x0001) # TODO: check this isn't already taken.
4648

4749

4850
class _RadioAdvertisement(Advertisement):
4951
"""Broadcast arbitrary bytes as a radio message."""
5052

51-
match_prefixes = (struct.pack("<BH", 0xFF, _ADAFRUIT_COMPANY_ID),)
53+
match_prefixes = (struct.pack("<BH", 0xFF, ADAFRUIT_COMPANY_ID),)
5254
manufacturer_data = LazyObjectField(
5355
ManufacturerData,
5456
"manufacturer_data",
55-
advertising_data_type=_MANUFACTURING_DATA_ADT,
56-
company_id=_ADAFRUIT_COMPANY_ID,
57+
advertising_data_type=MANUFACTURING_DATA_ADT,
58+
company_id=ADAFRUIT_COMPANY_ID,
5759
key_encoding="<H",
5860
)
5961

0 commit comments

Comments
 (0)