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.

Commands:

ByteNameUsageData Content
0x01Set Datasets a part of specified data or all if in blockmode2 bytes, index and value (or all values and no index if only one index exists or blockmode is on)
0x02Request Datarequests specified datano data
0x03Enable Streamrequest to get updates of specified datano data
0x04Disable Streamrequest to stop geting updates of specified datano data
0x05Response Dataresponse of a data requestfull dataset of given datatype
0x06Stream Dataupdate notification of given datatypefull dataset of given datatype
0x07Switch to 'Block' protocollswitch to blockmode, datatype has to have the same value as validationno data

Datatypes:

ByteNamenumber of bytes
0x01PositionNUM_TRAINS = 11
0x02DestinationNUM_TRAINS = 11
0x03Cleanup1
0x04Randommode1
0x05LampsNUM_LAMPS = 24
0x06Schedule(actually Station)NUM_TRAINS = 11
0x07SubstationNUM_TRAINS = 11

Running the WebProvider:

go into code/interface

run 'make web'

run './web'

Ideas for a new version: