Vitrall in CoolEmAll

This page contains CoolEmAll project specific documentation of Vitrall APIs.

General Usage

Generally, you need to retrieve a specific channel from the client. Then you can add a message handler for this channel in which you need to process all the messages (JSON objects, see below).

  var client = new vitrall.Client(...);
  var object = { foo: 123 };

  var channel = client.findChannelByType('coolemall');
 
  // Add a channel message handler
  channel.addHandler(function (message) {
    var object = JSON.parse(message);

    ... process channel message/object ...
  });

  // Send a message (JSON object) to the server
  channel.send(JSON.stringify(object));

CoolEmAll Channel Specification

The coolemall channel is used for communication with the CoolEmAll module on the server side. The channel protocol is based on JSON objects which are sent both by the client and the server.

Events sent by the server

  {
    type: 'selectionEvent',
    hostname: 'hostname-that-was-selected'
  }

  {
    type: 'deselectionEvent',
    hostname: 'hostname-that-was-deselected'
  }

Selection and deselection

To select and deselect a particular host send one of these objects:

  {
     type: 'select',
     hostname: 'hostname-to-be-selected'
  }
  {
     type: 'deselect',
     hostname: 'hostname-to-be-deselected'
  }

To get a list of currently selected hosts send:

  {
     type: 'getCurrentlySelected'
  }

In response the server will send the following object:

  {
     type: 'currentlySelected',
     hostnames: ['host1', 'host2']
  }

To clear host selection send:

  {
     type: 'deselectAll'
  }

Get the structure of DEBB

  {
     type: 'getDebbStructure'
  }

Sample response

Modes and timestamp

To change mode to monitoring send:

  {
    type: 'setMonitoringMode',
    refreshTime: 5 
  }

To change mode to history browsing:

  {
    type: 'setHistoryMode'
  }

Whenever a timestamp is set with a slider, send:

  {
    type: 'setTimestamp',
    timestamp: 1350387026
  }

DEBB loading

  {
    type: 'loadDEBB',
    path: 'path_to_the_PLMXML_file_in_SVN',
    revision: <revision>,
    timacs_path: <string>
  }

View synchronization (work in progess)

First get the session identifier from one of the vitrall clients and then send the synchronization request from the other client:

  var client = new vitrall.Client(...);
  var client2 = new vitrall.Client(...);
  ...
  var channel2 = client2.findChannelByType('coolemall');
  channel2.send(JSON.stringify({type: 'synchronizeView', otherSessionId: client.sessionId}));

To desynchronize, send:

   channel2.send(JSON.stringify({type: 'desynchronizeView'}));

You can also send the desynchronieView request to the first client.

Examples

  var client = new vitrall.Client(...);
  var channel = client.findChannelByType('coolemall');
  
  // Add selection handlers
  channel.addHandler(function (message) {
    var object = JSON.parse(message);

    if (object.type == 'selectionEvent') {
       console.log(object.hostname);
    } else if (object.type == 'deselectionEvent') {
       console.log(object.hostname);
    }
  });

  // Set monitoring mode
  channel.send(JSON.stringify({type: 'setMonitoringMode',  refreshTime: 5}));

  // Set history mode
  channel.send(JSON.stringify({type: 'setHistoryMode'}));

  // Set timestamp in history mode
  channel.send(JSON.stringify({type: 'setTimestamp', timestamp: 1350387026}));

Vitrall package

Vitrall installation package can be found at  http://dl.dropbox.com/u/69674055/vitrall-0.7.0-x86_64.tar.gz.

tar -xvf vitrall-0.7.0-x86_64.tar.gz
cd vitrall-0.7.0-x86_64/usr/local/bin
./vitralld-start.sh ../etc/vitrall/coolemall.xml --var debb=path_to_DEBB_file

Required libraries are listed at http://apps.man.poznan.pl/trac/vitrall/wiki/Server/Dependencies For the compiled package following libraries versions are required:

  • Boost 1.49
  • OpenSceneGraph revision 13345
  • gcc 4.7.2
  • system libraries from debian testing

Attachments