The
Navigator-Node interface is currently implemented as an XMLRPC
connection.
The node hosts an XML-RPC server, listening on a fixed port (the
default being 8550). The navigator connects to this port and issues
commands to the node.
There can be several simultaneous connections, each receiving a
different connection ID. Also, the node could easily be extended to
listen for other remote control protocols (e.g. SOAP).
Interface description
Methods
The Navigator can invoke the following methods on the Node:
- Connect(): connects the Navigator to an existing Node.
- Disconnect(connect_id): closes the given connection. The connection ID will become invalid.
- GetEvents(connect_id): returns the events since the last call to GetEvents (or since the connection began if this is the first call to GetEvents).
- returns a list of events (possibly empty)
- this method can take some seconds before it returns, so as to avoid too many round-trips between the node and the navigator
- GetAllPeers(connect_id): returns the list of current
peers. This should only be called once after connecting. Then new or
lost peers will be returned as events by the GetEvents method.
- GetNodeInfo(connect_id): returns the node's current characteristics.
- GetStatus(connect_id): returns the current status. Three return values are defined:
- READY: the node is connected to the Solipsis world
- BUSY: the node is an unstable state w.r.t. the Solipsis network: it is either trying to connect or to repair its connectivity
- UNAVAILABLE: the node is not connected to the Solipsis world. The navigator must ask the node to connect (e.g. by calling the Move method) before anything else.
- Move(connect_id, x, y, z): move the node to the given position. If the node is not connected, it will attempt to launch itself in the Solipsis world.
Events
Each event sent by the node (in reply to the GetEvents
method) is a three-element tuple: the first element is a timestamp (in
Unix format), the second element is the event type (a string), and the
third is the event's contents (whose format depends on the event type).
The following types of events are sent to the navigator :
- NEW: the node has connected to a new peer. The event contains the peer's characteristics.
- LOST: the node has lost connection with a peer. The event contains the peer ID.
- STATUS: the current status has changed (possible values are defined above). The event contains the new status.
Current implementation
On the node side
The node instantiates a RemoteControl object for each hosted node (see control.py). Depending on the configuration, each RemoteControl can be geared by one or several controllers (see files in the controllers subdirectory).
On the navigator side
The RemoteConnector (see remote.py) connects to the node and sends information to the graphical interface.