Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

Presently the components of OpenVisualizer operate within a single process. We wish to experiment with extending this operation across processes and machines, as shown in the diagram below.

Messaging

Presently we implement EventBus messaging with PyDispatch, which provides communication between threads in a single process. However, we must split the GUI from the LBR when the LBR is headless, like an embedded Linux device. In addition to host-to-host communication, we also may wish to segment the components in the LBR into separate processes, for example to reimplement serial communication in C.

Remote GUI host and LBR

We wish to minimize the processing required by the LBR due to its limited resources, particularly for a sub-Linux implementation. Therefore, the LBR pushes information to the Remote GUI. However, the GUI also may signal to the LBR, for example to toggle DAGroot status.

Although the LBR is the messaging client, the GUI must make the initial contact to the LBR to establish a tunnel for communication. It simply is not feasible to expect a PC user to open a port for access, even ports 80/443. However, we plan to use a reverse SSH tunnel, as shown in the diagram above. The reverse nature of the tunnel allows the LBR to access the server port on the GUI host.

We implement messaging with the bi-directional WebSockets (RFC 6455) protocol. As a standard, it supports OpenWSN's implementation approach. The LBR includes a UI Proxy component that pushes mote status reports and event counts, and receives notification of UI events. We encapsulate this messaging in JSON, as described in detail later on this page.

Implementation Tools

LBR

RoleToolNotes
WebSocket clientwebsocket-clientv0.11; Installed with pip.

GUI Host

RoleToolNotes
WebSocket servergevent-websocketv0.3.6; Includes dependencies below
server dependencygeventv0.13.8; Python network library; statically linked with libevent
gevent dependencygreenletv0.4.1; Python concurrency library
Tunnel to LBRPuTTY

Command line:
plink -ssh -N -T -R 8000:localhost:8000 -pw <xxx> user@lbrAddr

For reference, installed on Windows 7 Home Professional. Also installed pip, v1.3.1 for component setup, which required setuptools, where we used v0.7.7.

JSON Messages

JSON provides a convenient and widely accepted mechanism for implementation of the structured messages we must pass between LBR and GUI host. Messages include:

MessageDescription
mote-inventoryA list of the connected motes. Sent just after establishing the connection to the GUI host
mote-statusA dictionary of the elements of a Mote Status report. Like OpenVisualizer, these reports are generated at some defined rate.
event-countA dictionary of the current count of events

Messaging Between Processes

As future work on an embedded LBR, we plan to use the native POSIX message queue for inter-process messaging, due to its built-in availability. The posix_ipc module for Python provides access to this functionality.

Alternative Messaging Approaches

We researched the projects below, but they are not our first choice. We may investigate further at a later date.

Nanomsg and ZeroMQ provides a common messaging API for a variety of endpoints – threads, processes, and machines. They are open source, but not standards. However, it would be efficient to use a single tool for messaging across all domains.

Nanomsg is developed by Martin Sústrik, the original author of ZeroMQ. Sústrik left ZeroMQ due to a dispute over trademarks, as described in a Linux Weekly News article.

Celery provides a distributed message queue, but is more heavy-duty and requires a message broker.

  • No labels