public PVStructure createRequest() {

    PVDataCreate dataCreate = PVDataFactory.getPVDataCreate();

    PVStructure request = dataCreate.createPVStructure(requestType);

    PVString commandField = request.getStringField("command");
    commandField.put(commandName);

    return request;
  }
  /** Read info from data server */
  public void read(RPCClientImpl client, double REQUEST_TIMEOUT) throws Exception {

    PVStructure pvRequest = createRequest();

    PVInt keyField = pvRequest.getIntField("key");
    keyField.put(key);
    PVString patternField = pvRequest.getStringField("pattern");
    patternField.put(pattern);

    PVStructure pvResult = client.request(pvRequest, REQUEST_TIMEOUT);

    // process result

    PVStructureArray infos = pvResult.getStructureArrayField("channels");

    StructureArrayData data = new StructureArrayData();
    infos.get(0, infos.getLength(), data);

    this.chNames = new String[data.data.length];
    this.starts = new Instant[data.data.length];
    this.ends = new Instant[data.data.length];

    for (int i = 0; i < data.data.length; i++) {

      PVStructure info = data.data[i];

      chNames[i] = info.getStringField("name").get();

      int start_secs = info.getIntField("start_sec").get();
      int start_nano = info.getIntField("start_nano").get();
      starts[i] = Instant.ofEpochSecond(start_secs, start_nano);

      int end_secs = info.getIntField("end_sec").get();
      int end_nano = info.getIntField("end_nano").get();
      ends[i] = Instant.ofEpochSecond(end_secs, end_nano);
    }
  }
 @Override
 public void populatePVStructure(Serialiser serialiser, SpiralModel model, PVStructure pvStructure)
     throws Exception {
   PVString name = pvStructure.getSubField(PVString.class, "name");
   name.put(model.getName());
   PVString fastAxisName = pvStructure.getSubField(PVString.class, "fastAxisName");
   fastAxisName.put(model.getFastAxisName());
   PVString slowAxisName = pvStructure.getSubField(PVString.class, "slowAxisName");
   slowAxisName.put(model.getSlowAxisName());
   PVDouble scale = pvStructure.getSubField(PVDouble.class, "scale");
   scale.put(model.getScale());
   PVStructure bbStructure = pvStructure.getStructureField("boundingBox");
   serialiser.setValues(model.getBoundingBox(), bbStructure);
 }
Ejemplo n.º 4
0
 public void process() {
   pvResultValue.put("Hello " + pvArgumentValue.get());
   super.process();
 }