use of org.eclipse.milo.opcua.stack.core.types.structured.ReadRequest in project milo by eclipse.
the class ClientServerTest method setReadRequestHandler.
private void setReadRequestHandler(Variant variant) {
server.addServiceHandler("/test", ReadRequest.TYPE_ID, service -> {
ReadRequest request = (ReadRequest) service.getRequest();
ResponseHeader header = new ResponseHeader(DateTime.now(), request.getRequestHeader().getRequestHandle(), StatusCode.GOOD, null, null, null);
List<ReadValueId> nodesToRead = l(request.getNodesToRead());
List<DataValue> results = Collections.nCopies(nodesToRead.size(), new DataValue(variant));
ReadResponse response = new ReadResponse(header, a(results, DataValue.class), null);
service.setResponse(response);
});
}
Aggregations