MAPS websocket interface
MAPS devices can be operated in a mode where the device is returning data and can be controller over websocket connection.
In websocket mode, the user can connect to the device with any application over using the websocket protocol. The device is by default listening for connection on port 9002, but port number can vary in devices. Please refer to the information card supplied with your devices for more specific information.
Upon connection the device communicates by sending and receiving data and commands in a json format. For example:
{
type: "output",
msg: "position",
data: "[00001024], ...",
time: "07/12/2023 14:20:15.123456"
}
The above example shows a position output of the MAPS device.
Message structure
The messages have some common and variable fields. Most common fields are:
- type: Type of the message. Value is usually , "output" or "info".
- "control" messages denote commands that influence the operation of the device or messages that indicate information about the status of the device.
- "output" type messages contain intended output of the device, i.e., some variant of position information.
- "info" type messages hold some kind of information about the device, or a notification for an event that happened.
- "msg" is the usually the message itself, or some kind of further information about the content of the message.
- "data" is a larges chink of embedded data, in case the message. In the example it is the position data from the device.
- "time" is the timestamp of the sender at the exact time of sending the message. Time information is in a Template:Inline-code format.
Messages
In this section we will supply a list of most common messages that the MAPS device can receive and send
Device output
By default, the device provides output in the following structure:
{
type: 'output',
msg: 'position',
data: '[index], X, Y, Z, aX, aY, aZ, "good"/"bad", "*****", capture_timestamp, sensore_timestamp, monotonic_timestamp',
time: 'day/mo/year hh:mm:ss.usec'
}