| | |
| | | * @return {@link List<DataValue>} |
| | | * @throws |
| | | */ |
| | | public static List<DataValue> readValues(Set<String> keys){ |
| | | List<NodeId> nodeIdList=new ArrayList<>(500); |
| | | keys.forEach(e->{ |
| | | NodeId nodeId = new NodeId(2, e); |
| | | nodeIdList.add(nodeId); |
| | | }); |
| | | // public static List<DataValue> readValues2(Set<String> keys){ |
| | | // List<NodeId> nodeIdList=new ArrayList<>(500); |
| | | // keys.forEach(e->{ |
| | | // NodeId nodeId = new NodeId(2, e); |
| | | // nodeIdList.add(nodeId); |
| | | // }); |
| | | // try { |
| | | // List<DataValue> dataValues=client.readValues(0.0, TimestampsToReturn.Both,nodeIdList).get(); |
| | | // return dataValues; |
| | | // } catch (InterruptedException | ExecutionException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 方法描述: 读取多个点位的值 |
| | | * |
| | | * @param nodeIdList 点位集合 |
| | | * @return {@link List<DataValue>} |
| | | * @throws |
| | | */ |
| | | public static List<DataValue> readValues(List<NodeId> nodeIdList){ |
| | | try { |
| | | List<DataValue> dataValues=client.readValues(0.0, TimestampsToReturn.Both,nodeIdList).get(); |
| | | return dataValues; |