use of org.apache.plc4x.java.spi.messages.DefaultPlcWriteResponse in project plc4x by apache.
the class SimulatedConnection method write.
@Override
public CompletableFuture<PlcWriteResponse> write(PlcWriteRequest writeRequest) {
Map<String, PlcResponseCode> fields = new HashMap<>();
for (String fieldName : writeRequest.getFieldNames()) {
SimulatedField field = (SimulatedField) writeRequest.getField(fieldName);
PlcValue value = writeRequest.getPlcValue(fieldName);
device.set(field, value);
fields.put(fieldName, PlcResponseCode.OK);
}
PlcWriteResponse response = new DefaultPlcWriteResponse(writeRequest, fields);
return CompletableFuture.completedFuture(response);
}
Aggregations