-
Notifications
You must be signed in to change notification settings - Fork 1
MessageIO
MessageIO is a class used to centralise all communication between device and use a unified message format. All message send by the MessageIO use the ControlMessage format.
To create an object, you only need to call the messageIO constructor :
msgManager = MessageIO
you can use any comm device interface as long as they provide a sendJSon(Json), readJSon() and isMessageAvailable()
methode for example to add a serial device :
msgManager.addDevice(SerialDevice)
the package currently support two type of device the SerialComm and EthernetComm
To send a controlMessage you only need to use the methode MessageIO.sendMessage(deviceIndex,ControlMessage)
where de deviceIndex is simply the index of the device you want to communicate with.
msg = ControlMessage(7,[3,5])
msgManager.sendMessage(0,msg)
To read a controlMessage you only need to use the methode MessageIO.readMessage(deviceIndex)
where de deviceIndex is simply the index of the device you want to communicate with.
msg = msgManager.sendMessage(0)
if there is currently no message the readMessage methode will return None otherwise it will return a ControlMessage