Exemplo n.º 1
0
 private void getSRLSend(SRLSend send, long ts) {
   FieldValues values = new FieldValues();
   // addProcess(event.getSenderProcess());
   // addProcess(event.getAddresseeProcess());
   values.addIntValue(send.getSenderInstance());
   values.addStringValue(send.getPort());
   values.addIntValue(send.getPortIndex().intValue());
   values.addIntValue(send.getMessageAddress().intValue());
   sentTsByMsgAddr.put(send.getMessageAddress(), send.getTs());
   client.eventRead(
       new RoseSendEventInfo(
           ts,
           send.getSenderId(),
           send.getReceiverId(),
           send.getReceivedAt(),
           send.getSignal(),
           send.getReceiverInstance(),
           EventFactory.ROSE_SEND_EVENT_TYPE_ID,
           values));
 }
Exemplo n.º 2
0
  private void getSRLReceive(SRLReceive receive, long ts) {
    FieldValues values = new FieldValues();
    // addProcess(event.getSenderProcess());
    // addProcess(event.getAddresseeProcess());
    values.addIntValue(receive.getReceiverInstance());
    values.addStringValue(receive.getPort().toString());
    values.addIntValue(receive.getPortIndex().intValue());
    values.addIntValue(receive.getMessageAddress().intValue());

    client.eventRead(
        new RoseReceiveEventInfo(
            ts,
            777,
            receive.getReceiverId(),
            receive.getSentAt(),
            receive.getSignal(),
            receive.getStateId(),
            receive.getTs(),
            EventFactory.ROSE_RECEIVE_EVENT_TYPE_ID,
            values));
  }
Exemplo n.º 3
0
  private void getUserEvent(TypedCircularMessage message, long ts) {
    Struct struct = message.getStruct();
    userStructs.add(struct);

    int structId = struct.getId();
    FieldValues values = new FieldValues();
    List<Field> fields = struct.getFields();
    for (Field field : fields) {
      String fieldName = field.getName();
      Object value = message.getValue(fieldName);
      Type type = field.getType();
      if (field.isNullTerminated()) {
        if (type.getId() == Type.Srl.t_char.getId()) {
          String s = (String) value;
          values.addStringValue(s);
        } else {
          throw new UnsupportedOperationException(
              "Only null terminated 'char' sequences are currently supported, type is " + type);
        }
      } else if (field.getNumElements() == 1) {
        Srl srlType = Srl.valueOf(type.getId());
        switch (srlType) {
          case t_srl_I32:
          case t_srl_U32:
            Long i = (Long) value;
            values.addLongValue(i);
            break;
          default:
            throw new UnsupportedOperationException("Unsupported type: " + type);
        }

      } else {
        throw new UnsupportedOperationException(
            "Arrays are currently not supported, type is " + type);
      }
    }
    client.eventRead(new GenericEventInfo(ts, structId, values));
  }