コード例 #1
0
  private void createResponseType() {

    createInfoType();

    FieldCreate fieldCreate = FieldFactory.getFieldCreate();

    String[] names = new String[1];
    Field[] fields = new Field[1];

    names[0] = "channels";
    fields[0] = fieldCreate.createStructureArray(infoType);

    responseType = fieldCreate.createStructure(names, fields);
  }
コード例 #2
0
  @Override
  public Structure buildStructure(Serialiser serialiser, PerimeterBoxROI roi)
      throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    FieldCreate fieldCreate = FieldFactory.getFieldCreate();

    Structure structure =
        fieldCreate
            .createFieldBuilder()
            .add("angle", ScalarType.pvDouble)
            .addArray("lengths", ScalarType.pvDouble)
            .addArray("point", ScalarType.pvDouble)
            .setId("PerimeterBoxROI")
            .createStructure();
    return structure;
  }
コード例 #3
0
  @Override
  public Structure buildStructure(Serialiser serialiser, SpiralModel model) throws Exception {
    FieldCreate fieldCreate = FieldFactory.getFieldCreate();

    Structure boundingBoxStructure = serialiser.buildStructure(model.getBoundingBox());

    Structure structure =
        fieldCreate
            .createFieldBuilder()
            .add("name", ScalarType.pvString)
            .add("boundingBox", boundingBoxStructure)
            .add("fastAxisName", ScalarType.pvString)
            .add("slowAxisName", ScalarType.pvString)
            .add("scale", ScalarType.pvDouble)
            .setId("SpiralModel")
            .createStructure();
    return structure;
  }
コード例 #4
0
  private void createRequestType() {

    FieldCreate fieldCreate = FieldFactory.getFieldCreate();

    String[] names = new String[3];
    Field[] fields = new Field[3];

    names[0] = "command";
    fields[0] = fieldCreate.createScalar(ScalarType.pvString);

    names[1] = "key";
    fields[1] = fieldCreate.createScalar(ScalarType.pvInt);

    names[2] = "pattern";
    fields[2] = fieldCreate.createScalar(ScalarType.pvString);

    requestType = fieldCreate.createStructure(names, fields);
  }
コード例 #5
0
  public static HelloPutGetRecord create(String recordName) {
    StandardField standardField = StandardFieldFactory.getStandardField();
    FieldCreate fieldCreate = FieldFactory.getFieldCreate();
    PVDataCreate pvDataCreate = PVDataFactory.getPVDataCreate();
    Structure topStructure =
        fieldCreate
            .createFieldBuilder()
            .add("timeStamp", standardField.timeStamp())
            .addNestedStructure("argument")
            .add("value", ScalarType.pvString)
            .endNested()
            .addNestedStructure("result")
            .add("value", ScalarType.pvString)
            .endNested()
            .createStructure();
    PVStructure pvStructure = pvDataCreate.createPVStructure(topStructure);

    HelloPutGetRecord pvRecord = new HelloPutGetRecord(recordName, pvStructure);
    if (!pvRecord.init()) return null;
    return pvRecord;
  }
コード例 #6
0
  private void createInfoType() {

    FieldCreate fieldCreate = FieldFactory.getFieldCreate();

    String[] names = new String[5];
    Field[] fields = new Field[5];

    names[0] = "name";
    fields[0] = fieldCreate.createScalar(ScalarType.pvString);

    names[1] = "start_sec";
    fields[1] = fieldCreate.createScalar(ScalarType.pvInt);

    names[2] = "start_nano";
    fields[2] = fieldCreate.createScalar(ScalarType.pvInt);

    names[3] = "end_sec";
    fields[3] = fieldCreate.createScalar(ScalarType.pvInt);

    names[4] = "end_nano";
    fields[4] = fieldCreate.createScalar(ScalarType.pvInt);

    infoType = fieldCreate.createStructure(names, fields);
  }
コード例 #7
0
  /** Initialize data stuctures. */
  private void initialize() {
    FieldCreate fieldCreate = PVFactory.getFieldCreate();
    PVDataCreate pvDataCreate = PVFactory.getPVDataCreate();
    // TODO hierarchy can be used...
    String[] fieldNames =
        new String[] {
          "connections",
          "allocatedMemory",
          "freeMemory",
          "threads",
          "deadlocks",
          "averageSystemLoad"
        };

    Field[] fields = new Field[6];
    fields[0] = fieldCreate.createScalar(ScalarType.pvInt);
    fields[1] = fieldCreate.createScalar(ScalarType.pvLong);
    fields[2] = fieldCreate.createScalar(ScalarType.pvLong);
    fields[3] = fieldCreate.createScalar(ScalarType.pvInt);
    fields[4] = fieldCreate.createScalar(ScalarType.pvInt);
    fields[5] = fieldCreate.createScalar(ScalarType.pvDouble);

    status = pvDataCreate.createPVStructure(fieldCreate.createStructure(fieldNames, fields));
  }