electric
electric copied to clipboard
Refactor worker to hold operation per channel
This came about because of a discussion re measureIR.
Overall idea:
- Add state to the worker. The worker should know what the last command requested by the client was. i.e: store (not charge). A store might result in the charger discharging. Or charging.
- If we do above, then adding measureIR is simpler. It becomes a first class operation on server, and the client can react to it the way it does with other commands.
- Returning "what the hell is a channel doing" will need to change. We will want to return a better "channel run state", so the client can just display it. i.e: Charging, because of 'store' operation.
MeasureIR:
- Safe measureIR, performed in server, including a timeout so the client doesn't have to monitor it.
- Client changes to kicking off the task, and then monitoring it much like a charge / store / discharge
- Client has to be able to response to user stopping + kicking off some other task. i.e: if we are executing a measureIR/discharge and a RESTful call for stop/run comes in - at least the server can control that.
- Ensure we discharge only for a maximum of 25 seconds