本文整理汇总了Java中com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject.decode方法的典型用法代码示例。如果您正苦于以下问题:Java ExtensionObject.decode方法的具体用法?Java ExtensionObject.decode怎么用?Java ExtensionObject.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject
的用法示例。
在下文中一共展示了ExtensionObject.decode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installFilter
import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入方法依赖的package包/类
@Override
protected void installFilter(ExtensionObject filterXo) throws UaException {
if (filterXo == null || filterXo.decode() == null) {
this.filter = DefaultFilter;
} else {
Object filterObject = filterXo.decode();
if (filterObject instanceof MonitoringFilter) {
if (filterObject instanceof DataChangeFilter) {
this.filter = ((DataChangeFilter) filterObject);
DeadbandType deadbandType = DeadbandType.from(filter.getDeadbandType().intValue());
if (deadbandType == null) {
throw new UaException(StatusCodes.Bad_DeadbandFilterInvalid);
}
if (deadbandType != DeadbandType.None &&
getReadValueId().getAttributeId().intValue() != AttributeIds.Value) {
throw new UaException(StatusCodes.Bad_FilterNotAllowed);
}
} else if (filterObject instanceof AggregateFilter) {
throw new UaException(StatusCodes.Bad_MonitoredItemFilterUnsupported);
} else if (filterObject instanceof EventFilter) {
throw new UaException(StatusCodes.Bad_FilterNotAllowed);
}
} else {
throw new UaException(StatusCodes.Bad_MonitoredItemFilterInvalid);
}
}
}
示例2: testVariant_UaStructure
import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入方法依赖的package包/类
@Test
public void testVariant_UaStructure() {
ServiceCounterDataType sc1 = new ServiceCounterDataType(Unsigned.uint(1), Unsigned.uint(2));
Variant v = new Variant(sc1);
encoder.encodeVariant(null, v);
Variant decoded = decoder.decodeVariant(null);
ExtensionObject extensionObject = (ExtensionObject) decoded.getValue();
ServiceCounterDataType sc2 = extensionObject.decode();
Assert.assertEquals(sc1.getTotalCount(), sc2.getTotalCount());
Assert.assertEquals(sc1.getErrorCount(), sc2.getErrorCount());
}