|
28 | 28 | F_READ_NOTIFY = bluetooth.FLAG_READ | bluetooth.FLAG_NOTIFY |
29 | 29 | F_READ_WRITE_NORESPONSE = bluetooth.FLAG_READ | bluetooth.FLAG_WRITE | bluetooth.FLAG_WRITE_NO_RESPONSE |
30 | 30 |
|
31 | | -ATT_F_READ = 0x01 |
32 | | -ATT_F_WRITE = 0x02 |
33 | | -ATT_F_READ_WRITE = ATT_F_READ | ATT_F_WRITE |
| 31 | +DSC_F_READ = 0x02 |
| 32 | +DSC_F_WRITE = 0x03 |
34 | 33 |
|
35 | 34 | # Advertising payloads are repeated packets of the following form: |
36 | 35 | # 1 byte data length (N + 1) |
@@ -250,8 +249,8 @@ def __init__(self, device_name="Generic HID Device"): |
250 | 249 | UUID(0x180F), # 0x180F = Battery Information. |
251 | 250 | ( |
252 | 251 | (UUID(0x2A19), F_READ_NOTIFY, ( # 0x2A19 = Battery level, to be read by client after being notified of change. |
253 | | - (UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration. |
254 | | - (UUID(0x2904), ATT_F_READ), # 0x2904 = Characteristic Presentation Format. |
| 252 | + (UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration. |
| 253 | + (UUID(0x2904), DSC_F_READ), # 0x2904 = Characteristic Presentation Format. |
255 | 254 | )), |
256 | 255 | ), |
257 | 256 | ) |
@@ -626,8 +625,8 @@ def __init__(self, name="Bluetooth Joystick"): |
626 | 625 | (UUID(0x2A4B), F_READ), # 0x2A4B = HID USB report map, to be read by client. |
627 | 626 | (UUID(0x2A4C), F_READ_WRITE_NORESPONSE), # 0x2A4C = HID control point, to be written by client. |
628 | 627 | (UUID(0x2A4D), F_READ_NOTIFY, ( # 0x2A4D = HID report, to be read by client after notification. |
629 | | - (UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration. |
630 | | - (UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug). |
| 628 | + (UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration. |
| 629 | + (UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client. |
631 | 630 | )), |
632 | 631 | (UUID(0x2A4E), F_READ_WRITE_NORESPONSE), # 0x2A4E = HID protocol mode, to be written & read by client. |
633 | 632 | ), |
@@ -753,8 +752,8 @@ def __init__(self, name="Bluetooth Mouse"): |
753 | 752 | (UUID(0x2A4B), F_READ), # 0x2A4B = HID report map, to be read by client. |
754 | 753 | (UUID(0x2A4C), F_READ_WRITE_NORESPONSE), # 0x2A4C = HID control point, to be written by client. |
755 | 754 | (UUID(0x2A4D), F_READ_NOTIFY, ( # 0x2A4D = HID report, to be read by client after notification. |
756 | | - (UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration. |
757 | | - (UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug). |
| 755 | + (UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration. |
| 756 | + (UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client. |
758 | 757 | )), |
759 | 758 | (UUID(0x2A4E), F_READ_WRITE_NORESPONSE), # 0x2A4E = HID protocol mode, to be written & read by client. |
760 | 759 | ), |
@@ -886,12 +885,12 @@ def __init__(self, name="Bluetooth Keyboard"): |
886 | 885 | (UUID(0x2A4B), F_READ), # 0x2A4B = HID report map, to be read by client. |
887 | 886 | (UUID(0x2A4C), F_READ_WRITE_NORESPONSE), # 0x2A4C = HID control point, to be written by client. |
888 | 887 | (UUID(0x2A4D), F_READ_NOTIFY, ( # 0x2A4D = HID report, to be read by client after notification. |
889 | | - (UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration. |
890 | | - (UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug). |
| 888 | + (UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration. |
| 889 | + (UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client. |
891 | 890 | )), |
892 | 891 | (UUID(0x2A4D), F_READ_WRITE, ( # 0x2A4D = HID report |
893 | | - (UUID(0x2902), ATT_F_READ_WRITE), # 0x2902 = Client Characteristic Configuration. |
894 | | - (UUID(0x2908), ATT_F_READ_WRITE), # 0x2908 = HID reference, to be read by client (allow write because MicroPython v1.20+ bug). |
| 892 | + (UUID(0x2902), DSC_F_WRITE), # 0x2902 = Client Characteristic Configuration. |
| 893 | + (UUID(0x2908), DSC_F_READ), # 0x2908 = HID reference, to be read by client. |
895 | 894 | )), |
896 | 895 | (UUID(0x2A4E), F_READ_WRITE_NORESPONSE), # 0x2A4E = HID protocol mode, to be written & read by client. |
897 | 896 | ), |
|
0 commit comments