Skip to content

Commit d9bc565

Browse files
authored
Explain magic number in BLE advertisement
This code snippet threw me for a loop trying to understand what "961" meant. After a good amount of digging I found the appearance numbers in the bluetooth spec, to see that 961 is 0x03C1 or "keyboard". Add a comment to hopefully guide future readers.
1 parent cdb71d4 commit d9bc565

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

CPB_Keybutton_BLE/code.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
device_info = DeviceInfoService(software_revision=adafruit_ble.__version__,
3838
manufacturer="Adafruit Industries")
3939
advertisement = ProvideServicesAdvertisement(hid)
40+
# Advertise as "Keyboard" (0x03C1) icon when pairing
41+
# https://www.bluetooth.com/specifications/assigned-numbers/
4042
advertisement.appearance = 961
4143
scan_response = Advertisement()
4244
scan_response.complete_name = "CircuitPython HID"

0 commit comments

Comments
 (0)