当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionObject类代码示例

本文整理汇总了Java中com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject的典型用法代码示例。如果您正苦于以下问题:Java ExtensionObject类的具体用法?Java ExtensionObject怎么用?Java ExtensionObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExtensionObject类属于com.digitalpetri.opcua.stack.core.types.builtin包,在下文中一共展示了ExtensionObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: returnKeepAlive

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
private void returnKeepAlive(ServiceRequest<PublishRequest, PublishResponse> service) {
    ResponseHeader header = service.createResponseHeader();

    UInteger sequenceNumber = uint(currentSequenceNumber());

    NotificationMessage notificationMessage = new NotificationMessage(
            sequenceNumber, DateTime.now(), new ExtensionObject[0]);

    UInteger[] available = getAvailableSequenceNumbers();

    UInteger requestHandle = service.getRequest().getRequestHeader().getRequestHandle();
    StatusCode[] acknowledgeResults = subscriptionManager.getAcknowledgeResults(requestHandle);

    PublishResponse response = new PublishResponse(
            header, subscriptionId, available,
            moreNotifications, notificationMessage,
            acknowledgeResults, new DiagnosticInfo[0]);

    service.setResponse(response);

    logger.debug("[id={}] returned keep-alive NotificationMessage sequenceNumber={}.",
            subscriptionId, sequenceNumber);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:24,代码来源:Subscription.java

示例2: returnStatusChangeNotification

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
void returnStatusChangeNotification(ServiceRequest<PublishRequest, PublishResponse> service) {
    StatusChangeNotification statusChange = new StatusChangeNotification(
            new StatusCode(StatusCodes.Bad_Timeout), null);

    UInteger sequenceNumber = uint(nextSequenceNumber());

    NotificationMessage notificationMessage = new NotificationMessage(
            sequenceNumber,
            new DateTime(),
            new ExtensionObject[]{ExtensionObject.encode(statusChange)}
    );

    ResponseHeader header = service.createResponseHeader();

    PublishResponse response = new PublishResponse(
            header, subscriptionId,
            new UInteger[0], false, notificationMessage,
            new StatusCode[0], new DiagnosticInfo[0]);

    service.setResponse(response);

    logger.debug("[id={}] returned StatusChangeNotification sequenceNumber={}.", subscriptionId, sequenceNumber);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:24,代码来源:Subscription.java

示例3: modify

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public synchronized void modify(TimestampsToReturn timestamps,
                                UInteger clientHandle,
                                double samplingInterval,
                                ExtensionObject filter,
                                UInteger queueSize,
                                boolean discardOldest) throws UaException {

    installFilter(filter);

    this.timestamps = timestamps;
    this.clientHandle = clientHandle.longValue();
    this.samplingInterval = samplingInterval;
    this.discardOldest = discardOldest;

    if (queueSize.intValue() != this.queueSize) {
        setQueueSize(queueSize);

        RingBuffer<ValueType> oldQueue = queue;
        queue = new RingBuffer<>(this.queueSize);

        while (oldQueue.size() > 0) {
            enqueue(oldQueue.remove());
        }
    }
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:26,代码来源:BaseMonitoredItem.java

示例4: encodeExtensionObject

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
@Override
public void encodeExtensionObject(String field, ExtensionObject value) {
    if (value != null) {
        write(field, Unchecked.consumer(w -> {
            encodeNodeId("TypeId", value.getEncodingTypeId());

            Object object = value.getEncoded();

            if (object instanceof UaSerializable) {
                UaSerializable serializable = (UaSerializable) object;

                encodeSerializable("Body", serializable);
            } else if (object instanceof ByteString) {
                ByteString byteString = (ByteString) object;

                streamWriter.writeStartElement("Body");
                encodeByteString("ByteString", byteString);
                streamWriter.writeEndElement();
            } else if (object instanceof XmlElement) {
                XmlElement xmlElement = (XmlElement) object;

                encodeXmlElement("Body", xmlElement);
            }
        }));
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:27,代码来源:XmlEncoder.java

示例5: decodeExtensionObject

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
@Override
public ExtensionObject decodeExtensionObject(String field) throws UaSerializationException {
    NodeId encodingTypeId = decodeNodeId(null);
    int encoding = buffer.readByte();

    if (encoding == 0) {
        return new ExtensionObject((ByteString) null, encodingTypeId);
    } else if (encoding == 1) {
        ByteString byteString = decodeByteString(null);

        return new ExtensionObject(byteString, encodingTypeId);
    } else if (encoding == 2) {
        XmlElement xmlElement = decodeXmlElement(null);

        return new ExtensionObject(xmlElement, encodingTypeId);
    } else {
        throw new UaSerializationException(StatusCodes.Bad_DecodingError, "unknown ExtensionObject encoding: " + encoding);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:20,代码来源:BinaryDecoder.java

示例6: MonitoredDataItem

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public MonitoredDataItem(UInteger id,
                         UInteger subscriptionId,
                         ReadValueId readValueId,
                         MonitoringMode monitoringMode,
                         TimestampsToReturn timestamps,
                         UInteger clientHandle,
                         double samplingInterval,
                         ExtensionObject filter,
                         UInteger queueSize,
                         boolean discardOldest) throws UaException {

    super(id, subscriptionId, readValueId, monitoringMode, timestamps, clientHandle, samplingInterval, queueSize, discardOldest);

    installFilter(filter);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:16,代码来源:MonitoredDataItem.java

示例7: 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);
        }
    }
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:32,代码来源:MonitoredDataItem.java

示例8: MonitoredEventItem

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public MonitoredEventItem(UInteger id,
                          UInteger subscriptionId,
                          ReadValueId readValueId,
                          MonitoringMode monitoringMode,
                          TimestampsToReturn timestamps,
                          UInteger clientHandle,
                          double samplingInterval,
                          UInteger queueSize,
                          boolean discardOldest,
                          ExtensionObject filter) throws UaException {

    super(id, subscriptionId, readValueId, monitoringMode, timestamps, clientHandle, samplingInterval, queueSize, discardOldest);

    installFilter(filter);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:16,代码来源:MonitoredEventItem.java

示例9: decodeExtensionObject

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
@Override
public ExtensionObject decodeExtensionObject(String field) {
    if (nextStartElement(field)) {
        NodeId encodingTypeId = NodeId.NULL_VALUE;
        Object body = null;

        if (nextStartElement("TypeId")) {
            encodingTypeId = decodeNodeId(null);

            requireNextEndElement("TypeId");
        }

        if (nextStartElement("Body")) {
            try {
                body = decodeExtensionObjectBody();
            } catch (XMLStreamException e) {
                throw new UaSerializationException(StatusCodes.Bad_DecodingError, e);
            }

            requireNextEndElement("Body");
        }

        requireNextEndElement(field);

        if (body instanceof XmlElement) {
            return new ExtensionObject((XmlElement) body, encodingTypeId);
        } else if (body instanceof ByteString) {
            return new ExtensionObject((ByteString) body, encodingTypeId);
        } else {
            throw new UaSerializationException(StatusCodes.Bad_DecodingError,
                    "unrecognized ExtensionObject body: " + body);
        }
    } else {
        return new ExtensionObject(ByteString.NULL_VALUE, NodeId.NULL_VALUE);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:37,代码来源:XmlDecoder.java

示例10: encodeExtensionObject

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
@Override
public void encodeExtensionObject(String field, ExtensionObject value) throws UaSerializationException {
    if (value == null || value.getEncoded() == null) {
        encodeNodeId(null, NodeId.NULL_VALUE);
        buffer.writeByte(0); // No body is encoded
    } else {
        Object object = value.getEncoded();

        switch (value.getBodyType()) {
            case ByteString: {
                ByteString byteString = (ByteString) object;

                encodeNodeId(null, value.getEncodingTypeId());
                buffer.writeByte(1); // Body is binary encoded

                encodeByteString(null, byteString);

                break;
            }
            case XmlElement: {
                XmlElement xmlElement = (XmlElement) object;

                encodeNodeId(null, value.getEncodingTypeId());
                buffer.writeByte(2);

                encodeXmlElement(null, xmlElement);

                break;
            }
        }
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:33,代码来源:BinaryEncoder.java

示例11: encodeValue

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
private void encodeValue(Object value, int typeId, boolean structure, boolean enumeration) {
    if (structure) {
        ExtensionObject extensionObject = ExtensionObject.encode((UaStructure) value);

        encodeBuiltinType(typeId, extensionObject);
    } else if (enumeration) {
        encodeBuiltinType(typeId, ((UaEnumeration) value).getValue());
    } else {
        encodeBuiltinType(typeId, value);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:12,代码来源:BinaryEncoder.java

示例12: decode

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public static MonitoredItemModifyResult decode(UaDecoder decoder) {
    StatusCode _statusCode = decoder.decodeStatusCode("StatusCode");
    Double _revisedSamplingInterval = decoder.decodeDouble("RevisedSamplingInterval");
    UInteger _revisedQueueSize = decoder.decodeUInt32("RevisedQueueSize");
    ExtensionObject _filterResult = decoder.decodeExtensionObject("FilterResult");

    return new MonitoredItemModifyResult(_statusCode, _revisedSamplingInterval, _revisedQueueSize, _filterResult);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:9,代码来源:MonitoredItemModifyResult.java

示例13: HistoryReadRequest

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public HistoryReadRequest(RequestHeader _requestHeader, ExtensionObject _historyReadDetails, TimestampsToReturn _timestampsToReturn, Boolean _releaseContinuationPoints, HistoryReadValueId[] _nodesToRead) {
    this._requestHeader = _requestHeader;
    this._historyReadDetails = _historyReadDetails;
    this._timestampsToReturn = _timestampsToReturn;
    this._releaseContinuationPoints = _releaseContinuationPoints;
    this._nodesToRead = _nodesToRead;
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:8,代码来源:HistoryReadRequest.java

示例14: decode

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public static HistoryReadRequest decode(UaDecoder decoder) {
    RequestHeader _requestHeader = decoder.decodeSerializable("RequestHeader", RequestHeader.class);
    ExtensionObject _historyReadDetails = decoder.decodeExtensionObject("HistoryReadDetails");
    TimestampsToReturn _timestampsToReturn = decoder.decodeEnumeration("TimestampsToReturn", TimestampsToReturn.class);
    Boolean _releaseContinuationPoints = decoder.decodeBoolean("ReleaseContinuationPoints");
    HistoryReadValueId[] _nodesToRead = decoder.decodeArray("NodesToRead", decoder::decodeSerializable, HistoryReadValueId.class);

    return new HistoryReadRequest(_requestHeader, _historyReadDetails, _timestampsToReturn, _releaseContinuationPoints, _nodesToRead);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:10,代码来源:HistoryReadRequest.java

示例15: MonitoredItemCreateResult

import com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject; //导入依赖的package包/类
public MonitoredItemCreateResult(StatusCode _statusCode, UInteger _monitoredItemId, Double _revisedSamplingInterval, UInteger _revisedQueueSize, ExtensionObject _filterResult) {
    this._statusCode = _statusCode;
    this._monitoredItemId = _monitoredItemId;
    this._revisedSamplingInterval = _revisedSamplingInterval;
    this._revisedQueueSize = _revisedQueueSize;
    this._filterResult = _filterResult;
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:8,代码来源:MonitoredItemCreateResult.java


注:本文中的com.digitalpetri.opcua.stack.core.types.builtin.ExtensionObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。