Add 'history' endpoint that returns of list of all actions/updates run so far
Why? When problems are seen on boards, should allow us diagnose how they occurred more easily.
Suggested endpoint:
GET /history
The response should include:
- Timestamp of each event
- Lease request & renewal
- FSMs: Engage, disengage & reset
- Incl. ID of FSM
- Commands & FSM transitions:
- Both the parameters for them, and their status snapshot - initial status if the command/transition is still running, final status when complete.
- For file parameters, to avoid bloated responses and large memory growths we may just want to remove the content (and possibly replace with a hash)
Example for encoding of response:
{
"data": [
{
"eventType": "fsm:engage",
"device": "x0",
"fsm": "someFSM",
"time": 1670420413 // seconds since epoch
},
{
"eventType": "command",
"device": "x0",
"command": "myCommand",
"parameters": {"parameterX": 1, "parameterY": 2},
"status": { }, // <-- Same format as response for running command or checking its status
"time": 1670420415 // seconds since epoch
}
]
}
Notes for implementation:
- Probably easiest to start off by just adding the FSM engage/reset/disengage and lease events (then add command/transitions as 2nd step)
- The endpoints are implemented in the
Server
class. The exact list of endpoints and associated callbacks are specified inServer::kGetCallbacks
andServer::kPutCallbacks
insrc/common/Server.cpp
Edited by Tom Williams