|
@@ -18,6 +18,7 @@ import org.eclipse.milo.opcua.stack.core.security.SecurityPolicy;
|
|
|
import org.eclipse.milo.opcua.stack.core.types.builtin.*;
|
|
|
import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UShort;
|
|
|
import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.Unsigned;
|
|
|
+import org.eclipse.milo.opcua.stack.core.types.enumerated.IdType;
|
|
|
import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn;
|
|
|
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription;
|
|
|
|
|
@@ -150,14 +151,23 @@ public class OpcUaUtil {
|
|
|
}
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("label", nd.getBrowseName().getName());
|
|
|
-// jsonObject.put("nodeId", nd.getNodeId());
|
|
|
+ jsonObject.put("nodeId", nd.getNodeId());
|
|
|
jsonObject.put("nodeIndex", nd.getNodeId().getNamespaceIndex());
|
|
|
- jsonObject.put("nodeIndentifier", nd.getNodeId().getIdentifier());
|
|
|
- jsonObject.put("dataType", client.readValue(0.0, TimestampsToReturn.Neither, nd.getNodeId()).get().getValue().getDataType().get().getType());
|
|
|
+ jsonObject.put("nodeIdentifier", nd.getNodeId().getIdentifier());
|
|
|
+ jsonObject.put("dataType", nd.getNodeId().getType());
|
|
|
+// jsonObject.put("value", client.readValue(0.0, TimestampsToReturn.Both, nd.getNodeId()).get());
|
|
|
+// jsonObject.put("dataType", client.readValue(0.0, TimestampsToReturn.Neither, nd.getNodeId()).get().getValue().getDataType().get().getType());
|
|
|
jsonObject.put("description", nd.getDescription());
|
|
|
// PropertyTypeNode nd1 = (PropertyTypeNode) nd;
|
|
|
// nd1.getMinimumSamplingInterval();
|
|
|
-// DataValue dataValue = client.readValue(0.0, TimestampsToReturn.Neither, nd.getNodeId()).get();
|
|
|
+ DataValue dataValue = client.readValue(0.0, TimestampsToReturn.Both, nd.getNodeId()).get();
|
|
|
+ StatusCode statusCode = dataValue.getStatusCode();
|
|
|
+ if (Blank.isNotEmpty(statusCode)) {
|
|
|
+ if (statusCode.isGood()) {
|
|
|
+ jsonObject.put("value", dataValue.getValue().getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// Variant value = dataValue.getValue();
|
|
|
// Object value1 = value.getValue();
|
|
|
// Optional<ExpandedNodeId> dataType = value.getDataType();
|
|
@@ -182,7 +192,7 @@ public class OpcUaUtil {
|
|
|
}
|
|
|
List<NodeId> nodeIdList = new ArrayList<>();
|
|
|
for (Item item : itemList) {
|
|
|
- NodeId nodeId = new NodeId(item.getNodeIndex(), item.getNodeIndentifier());
|
|
|
+ NodeId nodeId = new NodeId(item.getNodeIndex(), item.getNodeIdentifier());
|
|
|
nodeIdList.add(nodeId);
|
|
|
}
|
|
|
return nodeIdList;
|