Skip to content

Protocol

SG-O edited this page Jul 11, 2018 · 1 revision

Overview

This server enables easy access to the vacuums maps. To achieve this it uses Protcol Buffers for the information interchange. The server only sends out maps after the client has authorized itself to the server. It listens on TCP port 54331.

The client sens a request to the server and the server in turn answers with the requested information. If this isn't possible an error is returned describing the reason for the failure.

The message definitions are available here: miIOMapServer protos

Request

The request consists of a RequestCode describing the information you want to retrieve or the action you want to perform, an optional string and an optional signed integer.

RequestCodes

  • MAP_INFO

Get information about the available maps.

  • GET_ACTIVE_MAP

Get the map during a cleanup. This will not return a map if the vacuum is not cleaning at the moment.

  • GET_OLD_MAP

Get an older map. The maps name must be specified in the optional string

  • GET_PREVIOUS_MAP

Get the map of the latest cleanup. If the vacuum is currently cleaning, the map of the previous cleanup is returned.

  • GET_ACTIVE_MAP_SLAM

Get the vacuums path during a cleanup. This will not return a path if the vacuum is not cleaning at the moment. If a starting point has been specified in the optional integer, the returned path will start at the point with that index.

  • GET_OLD_MAP_SLAM

Get an older maps path. The maps name must be specified in the optional string

  • GET_PREVIOUS_MAP_SLAM

Get the path of the latest cleanup. If the vacuum is currently cleaning, the path of the previous cleanup is returned.

  • AUTHENTICATE

Authenticate this connection to the server (has to be done once per connection). Any request without prior authentication will fail and the connection will be terminated.

  • END_COMMUNICATION

End the communication with the server after this transaction

Authentication

The authentication is done by encrypting 68 65 6c 6c 6f (hello) with the devices token and sending the encrypted message to the server. If the authentication was successful the server will answer with (ok) encrypted the same way. If the authentication failed the server will answer with garbage (not ok) and then terminate the connection.

The message is encrypted using AES/CBC/PKCS5Padding. The key is the MD5 sum of the devices token (md5(token)). The Iv of the cypher is the md5 sum of the tokken appended to the md5 sum of the token (md5(md5(token) + token)).

Map info

The response to a map info request contains a boolean that is true if an active map is available. Repeated strings containing all of the old maps names and a MapError telling you whether there has been an error executing the command and the reason.

Map package

The map package contains all of the information to draw a map. It does not contain any path information. The map package provides you with information about the maps bounding box (deffined by x, y from left, top and the regions width and height). It also contains repeated MapPackageColor objects. Finally it contains a MapError telling you whether there has been an error executing the command and the reason.

MapPackageColor

The MapPackageColor contains repeated coordinates of points (deffined by x, y from left, top) of one color (as an unsigned integer (AARRGGBB)).

Map Path (MapSlam)

The MapSlam message contains the sequential repeated points of the vacuums path (deffined by x, y from left, top). The points' coordinates are scaled to fit the map and require no further manipulation. The message also contains a MapError telling you whether there has been an error executing the command and the reason.

Map Error

The map error contains an error code and an optional string providing further information. These are the possible error codes:

  • UNKNOWN

The error encountered is unknown.

  • NONE

No error has occured. Everythings fine. These aren't the droids you're looking for! Move along!

  • NOT_AUTHENTICATED

The client isn't authenticated. The connection will be closed after receiving this message.

  • MAP_NOT_FOUND

The requested map was not found.

  • MAP_NOT_AVAILABLE

The requested map is currently unavailable.

  • COMMUNICATION_ERROR

There has been an error during the communication between client and server.

  • SLAM_OUT_OF_RANGE

The points index from which to read the path is larger then there are points available.

Clone this wiki locally