示例#1
0
  public void messageReceived(int to, Message message) {
    long t = System.currentTimeMillis();
    // System.out.print("" + t + ": ");
    // System.out.println(message);

    MessageProcessor messageProcessor = new MessageProcessor((SerialMsg) message, t);

    JSONObject json = messageProcessor.getJSON();
    client.sendCollectionJSON(json);

    JSONObject processingJson = messageProcessor.getCouchJSON();
    client.sendProcessingJSON(processingJson);

    fireStatus[messageProcessor.nodeToSensorID()] = messageProcessor.getFire();

    if (fireStatus[0] || fireStatus[1] || fireStatus[2]) {
      client.sendFireRepresentation(fireStatus);
    }
  }