var YAML, config, fs, robot, socket, zmq;

robot = require('robotjs');

zmq = require('zmq');

YAML = require('yamljs');

fs = require('fs');

window.config = YAML.parse(fs.readFileSync('etc/config.yml', 'utf8'));

config = window.config;

console.log("Config: ", config);

window.feedback = new window.FeedbackController;

window.actionHero = new window.ActionController;

window.translator = new window.GestureController;

socket = zmq.socket('sub');

socket.on('connect_delay', function(fd, ep) {
  console.log('connect_delay, endpoint:', ep);
});

socket.on('connect_retry', function(fd, ep) {
  console.log('connect_retry, endpoint:', ep);
});

socket.on('listen', function(fd, ep) {
  console.log('listen, endpoint:', ep);
});

socket.on('bind_error', function(fd, ep) {
  console.log('bind_error, endpoint:', ep);
});

socket.on('accept', function(fd, ep) {
  console.log('accept, endpoint:', ep);
});

socket.on('accept_error', function(fd, ep) {
  console.log('accept_error, endpoint:', ep);
});

socket.on('close', function(fd, ep) {
  console.log('close, endpoint:', ep);
});

socket.on('close_error', function(fd, ep) {
  console.log('close_error, endpoint:', ep);
});

socket.on('disconnect', function(fd, ep) {
  console.log('disconnect, endpoint:', ep);
});

console.log('Start monitoring...');

socket.monitor(500, 0);

socket.on('connect', function(fd, ep) {
  console.log('connect, endpoint:', ep);
  socket.subscribe('update');
  socket.on('message', function(topic, message) {
    var e, error, model, str_message, str_topic;
    try {
      str_topic = topic.toString();
      str_message = message.toString();
      if (topic.toString() === 'update') {
        model = JSON.parse(str_message);
        translator.parseGestures(model);
      }
    } catch (error) {
      e = error;
      console.log("error", e);
    }
  });
});

console.log("Connect to " + config.socket);

socket.connect(config.socket);

//# sourceMappingURL=maps/App.js.map
