Busy Tag Local Server API

1.How to activate local web server

1.1 Using USB CDC commands


Any type of software that supports USB serial communication (HTerm, MobaXterm, PuTTy, etc.) can be used. To recognize which is the Busy Tag device in the serial device list, iterate through serial ports and send the AT command: AT+GDN. The Busy Tag device will respond with +DN:busytag-XXXXXX\r\n.

1. Illustration: Getting a Busy Tag name using the AT command


The next action is to transmit the AT command, AT+GLHA, to obtain the local host address. In response, the device will return +LHA:http://busytag-XXXXXX.local. Keep that address somewhere. This address is unique to the device and is not affected by disk formatting, reboots, or other changes.

2. Illustration: Getting a Busy Tag local host address using the AT command


Sending the Wi-Fi access point passwords (router, mobile hotspot, etc.) is required. To enable those settings, send the AT command AT+WC=ssid, password. Send AT+WC? to double-check that the parameters are saved correctly. When the device is configured to host a local web server, those settings will be applied.

3. Illustration: Setting the Busy Tags Wi-Fi configuration


If the above-listed requirements are met, the device can go into local web server mode. Send the AT command AT+AWFS=1 to activate mode. After receiving the OK command, it automatically disconnects USB communication and activates the device's webserver.

4. Illustration: Activate the Busy Tags local web server


More detailed information on USB CDC commands can be found at https://luxafor.helpscoutdocs.com/article/47-busy-tag-usb-cdc-command-reference-guide

Note: In case the local host addresses are not stored or remembered, the device can be reset to its default settings by pressing the reset button located on the back of the device and repeating the previous instructions.


1.2 Using device mass storage files

A device should show up as device mass storage when it is attached to a PC. It contains readme.txt, wifi_config.json, and config.json as default files.

5. Illustration: Default files in Busy Tag mass storage


First, the readme.txtfile should be opened, and the local link should be copied and stored appropriately. It needs to be done before web server mode is active because, in that mode, USB communication is closed.

6. Illustration: Readme file


The subsequent step involves opening the wifi_config.json file with text editor software and entering the desired access point configuration. That new configuration file needs to be saved in the device storage.

7. Illustration: Wi-Fi config file


By following the aforementioned steps, the device's local web server can be activated. Open the config.json file with a text editor and set the "allow_file_server" parameter to true. Save the changes to the device's storage. Upon saving the updated configuration file, USB communication will be automatically terminated.

8. Illustration: Config file

Note: Renaming files will prevent settings from being active, therefore avoid doing so.

To verify if the local web server is active, open terminal software and ping the device's local address, which was copied and stored previously.

9. Illustration: Pinging to the local address

Note: Occasionally, web server mode will not correctly activate after the previous steps have been followed to enable it. A little reboot is therefore necessary for a gadget. Recommending turning the gadget on and off. The new device settings won't be affected by this procedure.


2. Web API

2.1 Get file list

Method: GET
Endpoint: http://busytag-XXXXXX.local/list
Body: <empty>
Response message example:
[
    {
        "name": "readme.txt",
        "type": "file",
        "size": 120
    },
    {
        "name": "wifi_config.json",
        "type": "file",
        "size": 40
    },
    {
        "name": "config.json",
        "type": "file",
        "size": 348
    },
    {
        "name": "def.png",
        "type": "file",
        "size": 16224
    },
    {
        "name": "System Volume Information",
        "type": "directory",
        "size": 0
    }
]

10. Illustration: Getting file list


2.2 Upload file

Method: POST
Endpoint: http://busytag-XXXXXX.local/upload/<path/to/file>
Body: image binary
Response message example: File uploaded successfully

11. Illustration: Uploading image


2.3 Get file

Method: GET
Endpoint: http://busytag-XXXXXX.local/<path/to/file>
Body: <empty>
The response message depends on the file content.

12. Illustration: Getting config file


13. Illustration: Getting image file



2.4 Delete file

Method: POST
Endpoint: http://busytag-XXXXXX.local/delete/<path/to/file>
Body: <empty>
Response message example: File deleted successfully

14. Illustration: Delete file



2.5 Configuration file

2.5.1 How to set the desired image to display

15. Illustration: Choosing the image to be shown


In the config.json file, the parameter "show_after_drop" needs to be set to false. Replace "image" with the name of the desired image that is stored on the device.


2.5.2 How to set the desired display brightness

To adjust the brightness of the device display, set the "disp_brightness" parameter in the config.json file within the range of 0 to 100.

16. Illustration: Configuring display brightness


2.5.3 How to set LED color

There are two parameters to configure: "led_bits" and "color". The "led_bits" parameter specifies which LEDs need to be set and uses binary logic for LED identification. For instance, 127 (0b01111111) will address all LEDs on the device, which has a total of seven LED elements. To seta new solid color for only the first two LEDs, the parameter should be set to 3(0b00000011). An 8-bit value can also be used. If a specific bit is set, for example, 67 (0b10000011), it will set the first two LEDs to the desired color while clearing the remaining LEDs. The second parameter, "color," is RGB color in hexadecimal format. To set the red color to max brightness, set the value to "FF0000," green to "00FF00," and blue to"0000FF".

17. Illustration: Activate solid color for the device


2.5.4 How to activate LED pattern

18. Illustration: Setting police LED pattern


There are three main parameters to configure: "activate_pattern," "pattern_repeat,” and “custom_pattern_arr,” each with sub-elements. If the "activate_pattern" parameter is set to true, it allows the device to play a pattern upon receiving a new configuration file. The "pattern_repeat" parameter can be set from 0 to 255, representing the loop count for the playing pattern. If "pattern_repeat" is set to255, the pattern will loop endlessly. The "custom_pattern_arr" parameter is an array of pattern line elements. Each pattern line contains four parameters:"led_bits," "color," "speed," and" delay." The "led_bits" parameter specifies which LEDs need to be set and uses binary logic for LED identification. The "color" parameter is an RGB color in hexadecimal format. The "speed" parameter sets the speed for changing the LED step level. The "delay" parameter sets the delay, in milliseconds, before activating a new pattern line. The maximum array of the parameter " custom_pattern_arr" can be 40 pattern line elements.


2.5.5 How to deactivate a web server

To deactivate the webserver, you need to set the parameter "allow_file_server" to false. If that parameter is set to false, it will deactivate the web server and activate USB communication.

19. Illustration: Deactivate web server

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us