Topic RSS8:25, EET
December 21, 2011
OfflineThis sample is available in SampleConsoleServer.createStaticArrayVariable:
NodeId dataType, Object initialValue) throws StatusException {
final NodeId nodeId = new NodeId(complianceNamespaceIndex, dataTypeName);
UaType type = server.getNodeManagerRoot().getType(dataType);
UaVariableNode node = new CacheVariable(complianceNodeManager, nodeId,
dataTypeName, Locale.ENGLISH);
node.setDataType(type);
node.setTypeDefinition(type);
node.setValueRank(ValueRanks.OneDimension);
node.setArrayDimensions(new UnsignedInteger[] { UnsignedInteger
.valueOf(Array.getLength(initialValue)) });
node.setValue(new DataValue(new Variant(initialValue), StatusCode.GOOD,
new DateTime(), new DateTime()));
staticArrayVariableFolder.addReference(node, Identifiers.HasComponent,
false);
}
and it is called from createComplianceNodes, e.g.
new Boolean[] { true, false, true, false, false });
createStaticArrayVariable(
"ByteArray",
Identifiers.Byte,
new UnsignedByte[] { UnsignedByte.valueOf(1),
UnsignedByte.valueOf(2), UnsignedByte.valueOf(3),
UnsignedByte.valueOf(4), UnsignedByte.valueOf(5) });
18:24, EEST
June 29, 2017
OfflineHello,
I am using the code above ( createStaticArrayVariable ) to generate a UaVariableNode but as an Identifiers.Int16 data type. When updating the value I can see that the value was changed, but subscribing (via UaExpert) doesn’t work (i.e. the initial value is shown but is not updated). Is this a general issue with array types or am I missing something? I tried UaVariableNode.setValue as well as UaVariableNode.updateValue.
16:03, EEST
April 17, 2013
OfflineHello Sergej,
The above code should still work despite being 4 years old. And UaExpert should be able to create subscriptions to Array variables without issues.
How have you confirmed that the value was updated correctly on the server side?
Do you think you could compose an example project showing the issue so that we could reproduce this? I tested the above code snippets and UaExpert and I cannot find anything going wrong.
18:45, EEST
June 29, 2017
Offline

Log In
Register