-
Notifications
You must be signed in to change notification settings - Fork 0
Display POST
Set data for the displayController
.
URL : /api/display/
Method : POST
Auth required : CONDITIONAL (see "Authentication")
{
"indicators": {
"1": true,
"2": false
},
"tubes": {
"1": {
"val": 1,
"pwm": 255
},
"2": {
"val": 1,
"pwm": 255
}
},
"onboardLed": {
"pwm": 255,
"mode": 0,
"blinkAmount": 0
},
"leds": 255,
}
This endpoint only accepts POST
requests using the application/json
content header.
Failure to provide this header will result in a 404
response.
Not all parameters must be supplied when POSTing to the endpoint.
Only the parameters specified in your body will be changed.
There is no way to "clear" settings as the system will either supplement them with fallback values or just ignore them altogether.
Below is a list of all parameters that can be presented in the request body:
Controls the IN-4 tubes.
Payload
"tubes": {
"<tubeIndex>": {
"val": <int>,
"pwm": <int>
}
}
-
tubeindex
(int
)- Which tube to address (left to right).
- Must be between
1
and4
.
- Must be between
- Which tube to address (left to right).
-
val
(int
)- The number to display on the tube.
- If this number exceeds
9
, the tube will be turned off instead.`.
- If this number exceeds
- The number to display on the tube.
-
pwm
(int
)- Brightness of the tube.
- Must be an 8-bit number whereas
255
is the maximum.
- Must be an 8-bit number whereas
- Brightness of the tube.
Controls the INS-1 tubes.
Payload
"indicators": {
"<indicatorIndex>": <state>
}
-
indicatorIndex
(int
)- Which indicator tube to address (left to right).
- Must be either
1
or2
.
- Must be either
- Which indicator tube to address (left to right).
-
state
(bool
)- If the indicator should light up or not.
-
true
> turn on -
false
> turn off
-
- If the indicator should light up or not.
Controls the onboard LED next to the ESP32.
Payload
"onboardLed": {
"pwm": <int>,
"mode": <int>,
"blinkAmount": <int>
}
-
pwm
(int
)- Brightness of the LED.
- Must be an 8-bit number whereas
255
is the maximum.
- Must be an 8-bit number whereas
- Brightness of the LED.
-
mode
(int
)- Behavior of the LED.
-
0
> Steady light -
1
> Blinking (Off -> On) -
2
> Blinking (On -> Off) -
3
> Pulsate
-
- If
mode
is neither of these values, it will default to mode0
.
- Behavior of the LED.
-
blinkAmount
(int
)- Amount of times the LED should blink.
- Must be between
1
and8
. - Only applicable if
mode
is set to2
(blinking).
- Must be between
- Amount of times the LED should blink.
Controls the LEDs beneath the IN-4 tubes.
Payload
"leds": <pwm>
-
pwm
(int
)- Brightness of the LEDs.
- Must be an 8-bit number whereas
255
is the maximum.
- Must be an 8-bit number whereas
- Brightness of the LEDs.
This endpoint has a conditional authentication mechanism:
To authenticate, supply an auth code using the auth
URI-parameter, like so:
http://.../api/endpoint?auth=<authcode>
The authentication code must be a number larger than 0
and may not exceed the 32 bit integer limit.
- Authentication is only required if an authentication code has been set.
- Initially, meaning at system boot, no code will be set.
- The first call with the
auth
URI parameter, successful or not, will set an immutable authentication code. - To clear the authentication code, the system must be rebooted again.
- To see whether authentication is required or not, perform a
GET
on/api/display
, checking for the value of theauthRequired
property.
ℹ️ The intent of this auth mechanism is not to offer "true" security, but rather to prevent multiple devices from accessing the display simultaneously.
Invalid authentication attempts will return a 403
response.
The whole request body gets validated once received by the system.
If a parameter or value violates the authentication set as dictated by the system, the whole request gets discarded and will instead return a 400
response.