There are rather too many OPC's for this:
This can be simplified to the following 5 commands, 2 of which are used by the loader.
This creates some limits for event data:
Format: <DC><NNhigh><NNlow><EN1><EN2><EN3><EN4>
The node should erase all events that match the event number. If the event number is zero then it erases all events, and re-initialize all node variables. The reply should be 7C OPC_ACK=OK, even if there is nothing to do.
Format: <DC><NNhigh><NNlow><EN1><EN2><EN3><EN4><INDEX>
If the event number is zero then read all events. The first read should have index = 0. Each read should increase the index until the error return no data is received. This returns one event, in an OPC_EVWRITE for the event number and a number of OPC_DATA packets. The index is used to decide which event data to read if there is more than one set of event data with a matching event number. The module should send an error reply (opcode FC) if there is no data corresponding to this index.
Format: <FD><NNhigh><NNlow><EN1><EN2><EN3><EN4><B>
The 4 byte event number is never zero. B is number of bytes of data that will follow. This packet is followed by enough event data packets (opcode FC) to contain the data. The module should send opcode 7C, ack after storing the data, or timeout if a packet gets lost, or error if there is no space to store it.
Format: <53><NNhigh><NNlow>
The node should enter learn mode, and the yellow LED go on.
Format: <54><NNhigh><NNlow>
Exit learn mode and the Yellow LED should go off.
Format: <55><NNhigh><NNlow>
Clear all events in a node.
Format: <56><NNhigh><NNlow>
Read the number of event spaces left, reply is opc=70.
Format: <0x70><NN hi><NN lo><number left>
The reply to an opc=56, the number of spaces left for events.
Format: <94><EN3><EN2><EN1><EN0>
Read an event variable, the reply is sent with opc=D3.
Format: <95><EN3><EN2><EN1><EN0>
This removes the event and all its EVs.
Format: <D2><EN3><EN2><EN1><EN0><EV hi><EV lo>
EN is the 32 bit event number. The current SLiM nodes have two bytes for the event action variable. As implemented just now, these are EV hi and EV lo. This allows a complete event to be taught with one frame.
An alternative is to have the EV set by <EV#><EV val> Where EV# is the index number of the EV val associated with an event. This would allow up to 256 EV values per event but would need one EVLRN frame per byte.
Format: <D2><EN3><EN2><EN1><EN0><EV hi><EV lo>
Response to a request for an EV value in a node in learn mode.
A node response to a request from a device for the EVs associated with an event (REQEV). For multiple EVs, there will be one response per request.
Format: <E4><NNhigh><NNlow><EVOPC><SNNHI><SNNLO><EVHIGH><EVLOW>
This is issued if a learn session is exited without learning an event, for self documenting purposes.
Format: <E5><NNhigh><NNlow><EVOPC><SNNHI><SNNLO><EVHIGH><EVLOW>
This is issued on exit from a good learn session, for self documenting.
Format: <E6><Etype><EN3><EN2><EN1><EN0><EV#><EVval>
The CANRPI64 will be capable of issuing and responding to ( 0x92 AREQ ) AND ( 0X93 ARSP ) events, stored in a separate table. This OPCODE is used in learn mode and is the equivalent to 0xD2 and 0xD3 only with the extra [EVOPC] byte to determine which table to use. Each Event is able to invoke multiple 'Actions', these are stored as a string, the EV# determines where in the 'Action String' the EVVAL belongs.
Format: <E7><Etype><EN3><EN2><EN1><EN0><EV#><EVval>
The CANRPI64 will be capable of issuing and responding to ( 0x92 AREQ ) AND ( 0X93 ARSP ) events, stored in a separate table. This OPCODE is used in learn mode and is the equivalent to 0xD2 and 0xD3 only with the extra [EVOPC] byte to determine which table to use. Each Event is able to invoke multiple 'Actions', these are stored as a string, the EV# determines where in the 'Action String' the EVVAL belongs.