mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
feat: command ops for socket protocol 2
shadeCommand, groupCommand, tiltCommand, repeatCommand, setPositions, setSensor, setMyPosition, unpairShade, setRollingCode (types 16-24) are read on async_tcp by ProtoOps and handed to loop() through the LoopQueue, which replies once the request has run: ok, not found or radio unavailable. A bad payload, a paused radio or a full queue is answered straight away. sendRemoteCommand (25) touches nothing of the shade model, so it goes to the radio from async_tcp like its route. ShadeRequests::run() now says how a request went, not only whether the radio took it. An op reads only the fields that were sent, so setPositions can leave the tilt as it is. The shadeCommand event is renamed shadeCommanded, since the op has the route's name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9fe05105ff
commit
0b54264ee3
18 changed files with 812 additions and 50 deletions
|
|
@ -85,16 +85,20 @@ class ShadeOps {
|
|||
virtual bool sendGroupSensorCommand(uint8_t groupId, int8_t windy, int8_t sunny, uint8_t repeat) = 0;
|
||||
};
|
||||
|
||||
// How a request went. One with nothing in range to do is done.
|
||||
enum class shade_request_result_t : uint8_t {
|
||||
done,
|
||||
not_found, // no shade or group with that id; nothing was done
|
||||
radio_refused // the radio didn't take a command it sent
|
||||
};
|
||||
|
||||
// Carries out shade requests, whichever entry point they came from: finds
|
||||
// the shade or group, turns client positions into stored ones, checks
|
||||
// ranges and fills in default repeats. Runs on loop() only.
|
||||
class ShadeRequests {
|
||||
public:
|
||||
explicit ShadeRequests(ShadeOps &ops) : ops(ops) {}
|
||||
// False when the radio refused a command it sent. A request for a shade
|
||||
// or group that doesn't exist, or with nothing in range to do, is dropped
|
||||
// and returns true.
|
||||
bool run(const shade_request_t &req);
|
||||
shade_request_result_t run(const shade_request_t &req);
|
||||
private:
|
||||
ShadeOps &ops;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue