private void getUserStructs() {
    for (Struct struct : userStructs) {
      List<FieldDescription> fieldDescs = new ArrayList<FieldDescription>();

      List<Field> fields = struct.getFields();
      for (Field field : fields) {
        Srl srlType = Srl.valueOf(field.getType().getId());
        switch (srlType) {
          case t_srl_I32:
            fieldDescs.add(new FieldDescription(field.getName(), FieldType.INT64));
            break;
          case t_srl_U32:
            fieldDescs.add(new FieldDescription(field.getName(), FieldType.INT64));
            break;
          default:
        }
      }
      client.typeDescRead(new TypeDescription(struct.getId(), struct.getName(), fieldDescs));
    }
  }
  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));
  }
 private Object getValue(final TypedCircularMessage message, final int i) {
   final Field f = message.getStruct().getFields().get(i);
   final String name = f.getName();
   return getValue(message, name);
 }