The Communication is handled by a WebProvider, wich is a central server in a star pattern. This server waits for clients and applies theire changes and distributes these changes to all interested clients.
The provided WebProvider listens on port 8089 and is accesed by the Controller which does a protocoll-upgrade to enable full block data-writeing and PHP-instances which provide data for a webside or ServerSendEvents(SSE)
The communication protocoll is a use-case limmited binary protocol which sends a one byte command followed by a one byte datatype byte followed by a specific number of data bytes specified by the command and datatype.
Byte | Name | Usage | Data Content |
---|---|---|---|
0x01 | Set Data | sets a part of specified data or all if in blockmode | 2 bytes, index and value (or all values and no index if only one index exists or blockmode is on) |
0x02 | Request Data | requests specified data | no data |
0x03 | Enable Stream | request to get updates of specified data | no data |
0x04 | Disable Stream | request to stop geting updates of specified data | no data |
0x05 | Response Data | response of a data request | full dataset of given datatype |
0x06 | Stream Data | update notification of given datatype | full dataset of given datatype |
0x07 | Switch to 'Block' protocoll | switch to blockmode, datatype has to have the same value as validation | no data |
Byte | Name | number of bytes |
---|---|---|
0x01 | Position | NUM_TRAINS = 11 |
0x02 | Destination | NUM_TRAINS = 11 |
0x03 | Cleanup | 1 |
0x04 | Randommode | 1 |
0x05 | Lamps | NUM_LAMPS = 24 |
0x06 | Schedule(actually Station) | NUM_TRAINS = 11 |
0x07 | Substation | NUM_TRAINS = 11 |
go into code/interface
run 'make web'
run './web'