Skip to content

Commit 68148af

Browse files
authored
docs: add next-gen profile (#71)
1 parent 4e556ab commit 68148af

File tree

2 files changed

+391
-5
lines changed

2 files changed

+391
-5
lines changed

BadgeBLE.md

Lines changed: 168 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,33 @@
22

33
### Connection Information
44

5-
The pixel data is transferred to the badge via BLE. The badge advertizes the name "LSLED" and uses a vendor specific service/characteristic:
5+
#### OEM Firmware
66

7-
- Service-UUID: 0000fee0-0000-1000-8000-00805f9b34fb
8-
- Characteristic: 0000fee1-0000-1000-8000-00805f9b34fb
7+
The pixel data is transferred to the badge via BLE. The OEM firmware advertises
8+
the name 'LSLED' and a 16-bit vendor-specific service/characteristic pair:
99

10-
The characteristic accepts 16 byte long data packets.
10+
- Service-UUID: 0xFEE0 (128-bit equivalent:
11+
0000fee0-0000-1000-8000-00805f9b34fb)
12+
- Characteristic: 0xFEE1 (128-bit equivalent:
13+
0000fee1-0000-1000-8000-00805f9b34fb)
1114

12-
### Data Format
15+
The characteristic of the OEM firmware has Read/Write/Notify properties. It
16+
accepts 16 byte long data packets on writing. Its Read/Notify behavior is
17+
currently unknown and needs to be investigated.
18+
19+
#### Open Firmware
20+
21+
This open firmware advertises the service/characteristic pair 0xFEE0/0xFEE1 in
22+
the same way as the OEM firmware and uses the name "LED Badge Magic" which can
23+
be renamed via the [next-gen profile](#next-gen-profile). The characteristic
24+
0xFEE1, marked as the legacy profile, is write-only. Read/Notify functionality
25+
will be supported once its behavior is fully understood.
26+
27+
An additional custom profile has been implemented, enabling more remote features
28+
and configuration over the BLE connection, see the [next-gen
29+
profile](#next-gen-profile) for details.
30+
31+
### Data Format (Legacy)
1332

1433
The badge supports up to 8 bitmaps which can have various features enabled.
1534

@@ -50,3 +69,147 @@ The "mode" bytes are a combination of two 4 bit values. The high nibble describe
5069
| 0x07 | "picture" |
5170
| 0x08 | "laser" |
5271

72+
### Next-Gen profile
73+
74+
16-bit Service/characteristic:
75+
76+
- Service-UUID: 0xF055 (128-bit equivalent:
77+
0000f055-0000-1000-8000-00805f9b34fb)
78+
- Characteristic: 0xF056 (128-bit equivalent:
79+
0000f056-0000-1000-8000-00805f9b34fb)
80+
- Write property: to receive controls and configs
81+
- Notify property: to return error codes
82+
- Read property: to be implemented
83+
84+
#### Protocol
85+
86+
The next-gen characteristic accepts messages of varying lengths (0 to 512
87+
bytes). The first byte represents the function/command code, while the remaining
88+
bytes contain parameters for the corresponding function/command.
89+
90+
![next-gen message format](/assets/ng-protocol.svg)
91+
92+
Supported functions/commands:
93+
94+
- power_setting
95+
- streaming_setting
96+
- stream_bitmap
97+
- ble_setting
98+
- flash_splash_screen
99+
- save_cfg
100+
- load_fallback_cfg
101+
102+
The client app should enable notifications for the characteristic to receive the
103+
returned error code (e.g., by using setCharacteristicNotification() on Android).
104+
105+
##### power_setting
106+
107+
Function/Command code: `0x01`.
108+
109+
Parameters:
110+
111+
- Power off: `0x00`.
112+
- Enable resetting after uploading is done: `[0x01, 0x00]`. Note: call
113+
the [save_cfg](#save_cfg) command to save this config.
114+
- Disable resetting after uploading is done: `[0x01, 0x01]`. Note: call
115+
the [save_cfg](#save_cfg) command to save this config.
116+
- Power off: `0x02`.
117+
118+
Returns:
119+
120+
- Parameters out of range: `0xff`.
121+
- Success: `0x00`.
122+
123+
##### streaming_setting
124+
125+
Function/Command code: `0x02`.
126+
127+
Parameters:
128+
129+
- Enter streaming mode `0x00`. This command stops all animations, clears the
130+
screen, and switches the device to streaming mode.
131+
- Leave streaming mode `0x01`. This command resumes all normal operations.
132+
133+
Returns:
134+
135+
- Parameters out of range: `0xff`.
136+
- Success: `0x00`.
137+
138+
##### stream_bitmap
139+
140+
Function/Command code: `0x03`.
141+
142+
Parameters:
143+
144+
- Array of bitmap in word (16-bit). Each word represents a column. The
145+
least-significant bit of each word represents the top pixel of each column.
146+
The length of the word array must be less than the number of columns on the
147+
screen; otherwise, any overflow pixels will be ignored.
148+
149+
Returns:
150+
151+
- Parameters out of range or streaming not enabled: `0xff`.
152+
- Success: `0x00`.
153+
154+
##### ble_setting
155+
156+
Function/Command code: `0x04`.
157+
158+
Parameters:
159+
160+
- Disable always-on BLE: `[0x00, 0x00]`. Note: Call the save_cfg command to save
161+
this configuration.
162+
- Enable always-on BLE: `[0x00, 0x01]`. Note: Call the save_cfg command to save
163+
this configuration.
164+
- Change BLE device name: `[0x01, "This is name"]`. The name must be less than
165+
or equal to 20 characters. Note: Call the save_cfg command to save this
166+
configuration.
167+
168+
Returns:
169+
170+
- Parameters out of range: `0xff`.
171+
- Success: `0x00`.
172+
173+
##### flash_splash_screen
174+
175+
Function/Command code: `0x05`.
176+
177+
Parameters:
178+
179+
- The first byte describes the width of the image.
180+
- The second byte describes the height of the image.
181+
- The third byte describes the frame height that will be displayed on the
182+
screen.
183+
- The rest are pixel content in `xbm` format.
184+
185+
Returns:
186+
187+
- Parameters out of range: `0xff`.
188+
- The width is larger than the maximum allowed (currently 48 pixels): `0xff`.
189+
- The height is larger than the maximum allowed (currently 44 pixels): `0xfe`.
190+
- Message length is not matched (currently 44 pixels): `0xfd`.
191+
- Missing pixel contents: `0xfc`.
192+
- Success: `0x00`.
193+
194+
##### save_cfg
195+
196+
Save configs to flash.
197+
198+
Command code: `0x06`.
199+
200+
Returns:
201+
202+
- Parameters out of range: `0xff`.
203+
- Flash writing error: `0x01`.
204+
- Success: `0x00`.
205+
206+
##### load_fallback_cfg
207+
208+
Load firmware default configuration. Note: call the [save_cfg](#save_cfg)
209+
command to save this config.
210+
211+
Function/Command code: `0x07`.
212+
213+
Returns:
214+
215+
- Success: `0x00`.

0 commit comments

Comments
 (0)