LED Control Protocol
Since Tag is low power and memory-constrained device we use binary TLV encoding to be efficient.
Set the LED State
Turn OFF LED
This request does not have any additional parameters. Once the APP on the tag side receives this request, it immediately turns off the LED.
Request:
APP ID (2B) | length (1B) [B] | request-id |
---|---|---|
0x0400 | 0x01 | 0x00 |
Resulting request body: “6400040100”
Note: “64“ prefix must be added to all requests. It’s a universal message type, and it will be processed by the presentation layer at the tag side. See Presentation Layer.
Response:
Once the APP on the tag side receives this request, it replies to the server with the response, with a new LED state. In this case, the response has an equal body to the Request.
APP ID (2B) | length (1B) [B] | current state of the LED |
---|---|---|
0x0400 | 0x01 | 0x00 |
Response body: “00040100”
Turn ON LED
This request must be set together with parameter time, which determines for how long the LED should be turned ON.
The time can be set in range <10ms; 511s>. If the time is set to 0, the LED will be turned ON forever.
If the APP on the tag side receives this request, it immediately turns ON the LED and sets the timer for a defined time, once the time has elapsed, the application turns the LED OFF.
Request:
APP ID (2B) | length (1B) [B] | request-id | time (2B) [10ms] |
---|---|---|---|
0x0400 | 0x03 | 0x01 | 0x01F4* |
*this value can be set in range <0x0000,0xC79C>.
Resulting request body: “6400040301F401”
Response:
Once the APP on the tag side receives this request, it replies to the server with the response, with a new LED state. The response also contains the remaining time (how long the tag will be ON since now)
APP ID (2B) | length (1B) [B] | current state of the LED | remaining time (2B) [10ms] |
---|---|---|---|
0x0400 | 0x03 | 0x01 | 0x01F3 |
Response body: “00040301F301”
Set LED Blinking
This request must contain the following parameters:
request-id: 0x02
duration of blinking in multiples of 10ms
period of blinking in multiples of 10ms
pulse width - the ratio of LED ON/period from 0 to 255, where 0 is 0% and 255 is 100%.
Request:
APP ID (2B) | length (1B) [B] | request-id (1B) | time | period | pw (1B) |
---|---|---|---|---|---|
0x0400 | 0x06 | 0x02 | 0x01F4* | 0x0032** | 0x80** |
*this value can be set in range <0x0000,0xC79C>
**this value can be set in range <0x0000,0xC79C>
***this value can be set in range <0x00,0xFF>
Resulting request body: “6400040602F401320080”
Response:
Once the APP on the tag side receives this request, it replies to the server with the response, with a new LED state. The response also contains the remaining time (how long the tag will blinking since now), blinking period, and blinking pulse width.
APP ID (2B) | length (1B) [B] | current state of the LED (1B) | remaining time (2B) [10ms] | period | pw (1B) |
---|---|---|---|---|---|
0x0400 | 0x03 | 0x01 | 0x01F3 | 0x0032 | 0x80 |
Response body: “00040602F301320080”
Get LED State
Get LED State Once
Using this response can get the current state of the LED. It does not affect the behavior of the LED in any way.
Request:
APP ID (2B) | length (1B) [B] | request-id (1B) |
---|---|---|
0x0400 | 0x01 | 0x10 |
Resulting request body: “6400040110”
Response:
The response for this request can vary in length, depending on the state of the LED. The response will be the same as the responses of SET requests (depending on the state of the LED).
Get LED State Periodically
This request is very similar to the previous one, the only difference is that the APP will send LED state periodically (with a defined period). It will send it forever (or until it will be stoped by other BC requests).
Request
APP ID (2B) | length (1B) [B] | request-id (1B) | period |
---|---|---|---|
0x0400 | 0x01 | 0x11 | 0x0A* |
*if the value is set to 0, the periodical sent of LED state will be disabled, otherwise, it will be sent in every Nth blink.
Resulting request body: “64000401100A”
Response
Same as for the previous request.
ERR Responses
In some cases, the APP can respond with an error code. It can occur in the following cases.
1) Parameter time or period is out of the allowed range.
Response:
APP ID (2B) | length (1B) [B] | err-code (1B) |
---|---|---|
0x0400 | 0x01 | 0xFD |
Response body: ”000401FD”
2) Unknown request-id was received.
Response:
APP ID (2B) | length (1B) [B] | err-code (1B) |
---|---|---|
0x0400 | 0x01 | 0xFE |
Response body: ”000401FE”
3) The length of the request is different than expected.
Response:
APP ID (2B) | length (1B) [B] | err-code (1B) |
---|---|---|
0x0400 | 0x01 | 0xFF |
Response body: ”000401FF”
On this page: