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


Java UaStructure类代码示例

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


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

示例1: getNotifications

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
public synchronized boolean getNotifications(List<UaStructure> notifications, int max) {
    int queueSize = queue.size();
    int count = Math.min(queueSize, max);

    for (int i = 0; i < count; i++) {
        notifications.add(wrapQueueValue(queue.remove()));
    }

    boolean queueIsEmpty = queue.isEmpty();

    if (queueIsEmpty && triggered) {
        triggered = false;
    }

    return queueIsEmpty;
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:17,代码来源:BaseMonitoredItem.java

示例2: getDataType

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
public Optional<NodeId> getDataType() {
    if (value == null) return Optional.empty();

    if (value instanceof UaStructure) {
        return Optional.of(((UaStructure) value).getTypeId());
    } else if (value instanceof UaEnumeration) {
        return Optional.of(Identifiers.Int32);
    } else {
        Class<?> clazz = value.getClass().isArray() ?
                ArrayUtil.getType(value) : value.getClass();

        int typeId = TypeUtil.getBuiltinTypeId(clazz);

        return typeId == -1 ?
                Optional.empty() : Optional.of(new NodeId(0, typeId));
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:18,代码来源:Variant.java

示例3: gatherAndSend

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
/**
 * Gather {@link MonitoredItemNotification}s and send them using {@code service}, if present.
 *
 * @param iterator a {@link PeekingIterator} over the current {@link BaseMonitoredItem}s.
 * @param service  a {@link ServiceRequest}, if available.
 */
private void gatherAndSend(PeekingIterator<BaseMonitoredItem<?>> iterator,
                           Optional<ServiceRequest<PublishRequest, PublishResponse>> service) {

    if (service.isPresent()) {
        List<UaStructure> notifications = Lists.newArrayList();

        while (notifications.size() < maxNotificationsPerPublish && iterator.hasNext()) {
            BaseMonitoredItem<?> item = iterator.peek();

            boolean gatheredAllForItem = gather(item, notifications, maxNotificationsPerPublish);

            if (gatheredAllForItem && iterator.hasNext()) {
                iterator.next();
            }
        }

        moreNotifications = iterator.hasNext();

        sendNotifications(service.get(), notifications);

        if (moreNotifications) {
            gatherAndSend(iterator, Optional.ofNullable(publishQueue().poll()));
        }
    } else {
        if (moreNotifications) {
            publishQueue().addSubscription(this);
        }
    }
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:36,代码来源:Subscription.java

示例4: decodeMessage

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T extends UaStructure> T decodeMessage(String field) throws UaSerializationException {
    NodeId encodingId = decodeNodeId(null);

    DecoderDelegate<?> delegate = DelegateRegistry.getDecoder(encodingId);

    return (T) delegate.decode(this);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:10,代码来源:BinaryDecoder.java

示例5: encodeValue

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的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

示例6: encodeMessage

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
@Override
public <T extends UaStructure> void encodeMessage(String field, T message) throws UaSerializationException {
    EncoderDelegate<T> delegate = DelegateRegistry.getEncoder(message.getBinaryEncodingId());

    encodeNodeId(null, message.getBinaryEncodingId());

    delegate.encode(message, this);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:9,代码来源:BinaryEncoder.java

示例7: gather

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
private boolean gather(BaseMonitoredItem<?> item, List<UaStructure> notifications, int maxNotifications) {
    int max = maxNotifications - notifications.size();

    return item.getNotifications(notifications, max);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:6,代码来源:Subscription.java

示例8: sendNotifications

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
private void sendNotifications(ServiceRequest<PublishRequest, PublishResponse> service,
                               List<UaStructure> notifications) {

    List<MonitoredItemNotification> dataNotifications = Lists.newArrayList();
    List<EventFieldList> eventNotifications = Lists.newArrayList();

    notifications.forEach(notification -> {
        if (notification instanceof MonitoredItemNotification) {
            dataNotifications.add((MonitoredItemNotification) notification);
        } else if (notification instanceof EventFieldList) {
            eventNotifications.add((EventFieldList) notification);
        }
    });

    List<ExtensionObject> notificationData = Lists.newArrayList();

    if (dataNotifications.size() > 0) {
        DataChangeNotification dataChange = new DataChangeNotification(
                dataNotifications.toArray(new MonitoredItemNotification[dataNotifications.size()]),
                new DiagnosticInfo[0]);

        notificationData.add(ExtensionObject.encode(dataChange));
    }

    if (eventNotifications.size() > 0) {
        EventNotificationList eventChange = new EventNotificationList(
                eventNotifications.toArray(new EventFieldList[eventNotifications.size()]));

        notificationData.add(ExtensionObject.encode(eventChange));
    }

    UInteger sequenceNumber = uint(nextSequenceNumber());

    NotificationMessage notificationMessage = new NotificationMessage(
            sequenceNumber,
            new DateTime(),
            notificationData.toArray(new ExtensionObject[notificationData.size()])
    );

    availableMessages.put(notificationMessage.getSequenceNumber(), notificationMessage);
    UInteger[] available = getAvailableSequenceNumbers();

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

    ResponseHeader header = service.createResponseHeader();

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

    service.setResponse(response);

    logger.debug("[id={}] returning {} DataChangeNotification(s) and {} EventNotificationList(s) sequenceNumber={}.",
            subscriptionId, dataNotifications.size(), eventNotifications.size(), sequenceNumber);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:58,代码来源:Subscription.java

示例9: decodeMessage

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
@Override
public <T extends UaStructure> T decodeMessage(String field) {
    return null;
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:5,代码来源:XmlDecoder.java

示例10: encode

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
public static ExtensionObject encode(UaStructure structure) throws UaSerializationException {
    return encodeAsByteString(structure, structure.getBinaryEncodingId());
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:4,代码来源:ExtensionObject.java

示例11: encodeMessage

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
@Override
public <T extends UaStructure> void encodeMessage(String field, T message) {

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

示例12: wrapQueueValue

import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
protected abstract UaStructure wrapQueueValue(ValueType value); 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:2,代码来源:BaseMonitoredItem.java


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