OPC process in Java data type register

1. In milo, a type of data such as processing WORD

 

Examples are as follows:

VariableNode node = client.getAddressSpace().createVariableNode(
new NodeId(2, "ch1.d1.tag1"));

Variant newVal = new Variant(Unsigned.ushort(111));
DataValue va = new DataValue(newVal, null, null);
StatusCode writeStatus = node.writeValue(va).get();

It can also be used UaOpcClient

 client.writeValue(
  new NodeId(2, "ch1.d1.tag1"),
  va
 ).get();

Variant is milo processed VARIANT class variables, milo in Identifiers defines various types of initialization and the like, such as a LONG WORD class, Unsigned.ushort here (111) is initialized to 111 WORD

2. utgard, the processing of various types

Utgard jinterop employed in the JIVariant type for various types of processing, including boolean, floate, double, short, int , etc., can be processed on the following boolean:

Group group = server.addGroup();
Item item = group.addItem(mitem);

final JIVariant value = new JIVariant(val);
item.write(value);

Where val is a boolean

Guess you like

Origin www.cnblogs.com/myboat/p/11890308.html