public PVStructure createRequest() { PVDataCreate dataCreate = PVDataFactory.getPVDataCreate(); PVStructure request = dataCreate.createPVStructure(requestType); PVString commandField = request.getStringField("command"); commandField.put(commandName); return request; }
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; }
/** 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)); }