mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
feat: edit ops and the reads their forms need, for socket protocol 2
The edit routes become ops 26-44 (addRoom ... groupSortOrder): ProtoEdits turns an op's payload into the route's request, full names and real booleans, and loop() applies it with applyModelEdit() as the route does. The reply goes to the client that sent it, with an add's new id, or the route's reason and a shade's validation code; the HTTP routes keep sending requestResult. getNextRoom, getNextShade, getNextGroup and groupOptions (45-48) are answered by loop() from the shade model, through a new LoopQueue item. Messages that arrive in pieces, a frame over one TCP segment or several frames, are put back together by ProtoAssembly: one at a time across clients, up to 4 KB, in a buffer held only while one is on its way. A message in pieces is now told from its first frame's opcode, which also stops a fragmented message's last frame drawing a second reply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ea973809e2
commit
77237111ea
22 changed files with 851 additions and 22 deletions
|
|
@ -24,7 +24,8 @@ enum class loop_item_type_t : uint8_t {
|
|||
restore_shades, // restore from /shades.tmp, then reboot
|
||||
load_shades, // replace the shades with /shades.tmp
|
||||
snapshot_fill, // fill a read's ModelSnapshot
|
||||
model_edit // apply an edit with ModelEditor
|
||||
model_edit, // apply an edit with ModelEditor
|
||||
proto_read // answer a protocol 2 read op from the shade model
|
||||
};
|
||||
struct model_edit_t;
|
||||
struct loop_item_t {
|
||||
|
|
@ -33,10 +34,12 @@ struct loop_item_t {
|
|||
uint8_t restoreParts = 0; // restore_shades: RESTORE_* bits
|
||||
uint8_t slot = 0; // snapshot_fill: the SnapshotSlots slot
|
||||
model_edit_t *edit = nullptr; // model_edit: loop() runs and frees it
|
||||
// shade_request from a protocol 2 client: loop() replies to this socket
|
||||
// client with replyId once the request has run. 0 for no reply.
|
||||
// shade_request and proto_read from a protocol 2 client: loop() replies to
|
||||
// this socket client with replyId once it has run. 0 for no reply.
|
||||
uint32_t replyClient = 0;
|
||||
uint32_t replyId = 0;
|
||||
uint8_t readOp = 0; // proto_read: the op's type
|
||||
uint8_t readId = 0; // proto_read: the group, for groupOptions
|
||||
};
|
||||
|
||||
// Whether the item sends anything on air.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue