FAQs
Subscribing to events
BB-Core enables users to subscribe to events. These events provide information about the change in LEDs and power on the BB-400.
The user can subscribe to these events by using the following curl command:
sudo curl --no-buffer -XGET --unix-socket /var/run/bb-core.sock http://localhost/events
bb@bb400-00b0:~ $ sudo curl --no-buffer -XGET --unix-socket /var/run/bb-core.sock http://localhost/events
{"ETH0_LINK": "ON", "DIO1": "OFF", "DIO4": "OFF", "ETH1_LINK": "OFF", "DIO6": "OFF", "WIFI_LINK": "FLASH", "DIO0": "OFF", "DIO3": "OFF", "DIO2": "OFF", "LABEL_C": "OFF", "ETH1_STATUS": "OFF", "WIFI_WEB": "FLASH", "DIO7": "OFF", "ETH0_WEB": "ON", "LABEL_A": "OFF", "LABEL_D": "OFF", "LABEL_B": "OFF", "DIO5": "OFF"}{"POWER": "RUNNING"}
By subscribing to the events path, the user gets updated whenever there is a change in the BB-400’s LEDs on the front of the panel. It also reports about changes in the power state.
The 4 possible power states are:
- PRECHARGE
The capacitors in the BB-400 are charging. The BB-400 is not running. - RUNNING
The device boots up and starts to run. The capacitors are charged. - UPS ALERT
BB-400 goes into UPS Alert when the power is lost or switched off. The capacitors are discharging. The Ethernet, WiFi and DIO will no longer work. If the power is restored, then the Ethernet, WiFi and DIO will start working again. - STOPPING
The capacitors have reached a threshold level and the BB-400 will start to shutdown.
GET request
Users can also use the GET request commands to get information about the LEDs and power states.
- Power state: To get the current power state
sudo curl -X GET --unix-socket /var/run/bb-core.sock http://localhost/power
It returns the current power state as a JSON.
Example:
bb@bb400-00b0:~ $ sudo curl -X GET --unix-socket /var/run/bb-core.sock http://localhost/power
{"POWER": "RUNNING"}
bb@bb400-00b0:~ $
- LED states: To get the current LED states.
sudo curl -X GET --unix-socket /var/run/bb-core.sock http://localhost/leds
Example:
bb@bb400-00b0:~ $ sudo curl -X GET --unix-socket /var/run/bb-core.sock http://localhost/leds
{"ETH0_LINK": "ON", "DIO1": "OFF", "DIO4": "OFF", "ETH1_LINK": "OFF", "DIO6": "OFF", "WIFI_LINK": "FLASH", "DIO0": "OFF", "DIO3": "OFF", "DIO2": "OFF", "LABEL_C": "OFF", "ETH1_STATUS": "OFF", "WIFI_WEB": "FLASH", "DIO7": "OFF", "ETH0_WEB": "ON", "LABEL_A": "OFF", "LABEL_D": "OFF", "LABEL_B": "OFF", "DIO5": "OFF"}
bb@bb400-00b0:~ $
POST request
Users can use this command to do an action.
- Locate: Flashes the A, B, C and D LEDs on the BB-400.
sudo curl -X POST --unix-socket /var/run/bb-core.sock http://localhost/locate