Attendance
We continued to beat on the state diagrams. We then did a function breakdown, based mostly on the diagrams.
| Byte# | What | Comment | |
| 1 | Start | Always '$'. | |
| 3 | Dest | This is the node number of the destination device. | |
| 2 | Src | This is the node number of the sourcing device. | |
| 4 | Commands | This is one or more commands. See the command table | |
| n-2 | End | Always '\n'. | |
| n-1 | CKSUM1 | High Nibble of the Checksum | |
| n | CKSUM0 | Low Nibble of the Checksum |
Changes made to the table above:
| Message Name | Char Length | Mess. Char [1st byte] | Mod. Char | Time | Len. | Data Chars | Comments | |
| WRITE | 4 | 1 | Addr: [0-F] | - | - | [0-F] [0-F] | Write one byte of decoded data to the port. | |
| READ | 2 | 2 | Addr: [0-F] | - | - | - | Request read from specified port. | |
| DATAIS | 4 | 3 | Addr: [0-F] | - | - | [0-F] [0-F] | The value of the requested port is supplied as data. This is the reply to a 'READ' message. | |
| CONFIGWR | 4 | 4 | Addr: [0-F] | - | - | [0-F] [0-F] | Write configuration for port X. Data byte following is mode, where 1 bits are OUTPUT and 0 bits are input. | |
| CONFIGRD | 2 | 5 | Addr: [0-F] | - | - | - | Read configuration for port X. No data following. Port config byte is returned in a reply message. | |
| CONFIGIS | 4 | 6 | Addr: [0-F] | - | - | [0-F] [0-F] | Read configuration reply from port X. This is the reply to a CONFIGRD message. | |
| - | - | [7-9A-D] | - | - | - | - | not used. | |
| PERIODIC | >=6 | E | Addr: [0-F] | [0-F] [0-F] | [0-F] [0-F] | any even number of [0-F] |
Set a periodic process. The time field is delay in milliseconds, high nibble first. The data field contains twice the number of nibbles specified by "length". That field is treated as a message that is processed at an interval specified by the time value. A periodic process X can be cancelled by sending it a zero length process string. Example: E50000
| |
| ERROR | >6 | F | Level: [0-F] | - | [0-F] [0-F] | any even number of [0-F] | Error report or other message to be logged or reported to humans. |
For example, if the packet was:
$12D51A02122059\n
Changes made to the table above:
This ASCII diagram naturally has to be viewed with a monospaced font.
The commands() function gets passed a pointer to here. (char *packetPayloadSrc)
//============================================================================
||
||
|| The command() function gets passed a pointer to here. (char *packetPayload)
|| //========================================================================
|| ||
|| || Replaced with a null
|| || //====================
|| || ||
|| || ||
\\// \\// \\//
\/ \/ \/
/-|-|-|-|-|-|-|----------------------------|-|-|-|-|-|-|-\
| Start | Dest| Src | Payload commands | End | Cksum |
\-|-|-|-|-|-|-|----------------------------|-|-|-|-|-|-|-/
The sections of the packet with |-|-|-| are the sections that have been stripped out before the commands() function gets ahold of the packet.