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


Java SetTriggeringRequest类代码示例

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


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

示例1: addServiceSet

import com.digitalpetri.opcua.stack.core.types.structured.SetTriggeringRequest; //导入依赖的package包/类
default void addServiceSet(MonitoredItemServiceSet serviceSet) {
    addRequestHandler(CreateMonitoredItemsRequest.class, serviceSet::onCreateMonitoredItems);
    addRequestHandler(ModifyMonitoredItemsRequest.class, serviceSet::onModifyMonitoredItems);
    addRequestHandler(DeleteMonitoredItemsRequest.class, serviceSet::onDeleteMonitoredItems);
    addRequestHandler(SetMonitoringModeRequest.class, serviceSet::onSetMonitoringMode);
    addRequestHandler(SetTriggeringRequest.class, serviceSet::onSetTriggering);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:8,代码来源:UaStackServer.java

示例2: onSetTriggering

import com.digitalpetri.opcua.stack.core.types.structured.SetTriggeringRequest; //导入依赖的package包/类
@Override
public void onSetTriggering(ServiceRequest<SetTriggeringRequest, SetTriggeringResponse> service) throws UaException {
    Session session = session(service);

    session.getMonitoredItemServices().onSetTriggering(service);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:7,代码来源:SessionManager.java

示例3: setTriggering

import com.digitalpetri.opcua.stack.core.types.structured.SetTriggeringRequest; //导入依赖的package包/类
public void setTriggering(ServiceRequest<SetTriggeringRequest, SetTriggeringResponse> service) {
    SetTriggeringRequest request = service.getRequest();

    UInteger subscriptionId = request.getSubscriptionId();
    Subscription subscription = subscriptions.get(subscriptionId);

    if (subscription == null) {
        service.setServiceFault(StatusCodes.Bad_SubscriptionIdInvalid);
        return;
    }

    if (request.getLinksToAdd().length == 0 && request.getLinksToRemove().length == 0) {
        service.setServiceFault(StatusCodes.Bad_NothingToDo);
        return;
    }

    UInteger triggerId = request.getTriggeringItemId();
    UInteger[] linksToAdd = request.getLinksToAdd();
    UInteger[] linksToRemove = request.getLinksToRemove();


    synchronized (subscription) {
        Map<UInteger, BaseMonitoredItem<?>> itemsById = subscription.getMonitoredItems();

        BaseMonitoredItem<?> triggerItem = itemsById.get(triggerId);
        if (triggerItem == null) {
            service.setServiceFault(StatusCodes.Bad_MonitoredItemIdInvalid);
            return;
        }

        List<StatusCode> removeResults = Arrays.stream(linksToRemove)
                .map(linkedItemId -> {
                    BaseMonitoredItem<?> item = itemsById.get(linkedItemId);
                    if (item != null) {
                        if (triggerItem.getTriggeredItems().remove(linkedItemId) != null) {
                            return StatusCode.GOOD;
                        } else {
                            return new StatusCode(StatusCodes.Bad_MonitoredItemIdInvalid);
                        }
                    } else {
                        return new StatusCode(StatusCodes.Bad_MonitoredItemIdInvalid);
                    }
                })
                .collect(toList());

        List<StatusCode> addResults = Arrays.stream(linksToAdd)
                .map(linkedItemId -> {
                    BaseMonitoredItem<?> linkedItem = itemsById.get(linkedItemId);
                    if (linkedItem != null) {
                        triggerItem.getTriggeredItems().put(linkedItemId, linkedItem);
                        return StatusCode.GOOD;
                    } else {
                        return new StatusCode(StatusCodes.Bad_MonitoredItemIdInvalid);
                    }
                })
                .collect(toList());

        SetTriggeringResponse response = new SetTriggeringResponse(
                service.createResponseHeader(),
                addResults.toArray(new StatusCode[addResults.size()]),
                new DiagnosticInfo[0],
                removeResults.toArray(new StatusCode[removeResults.size()]),
                new DiagnosticInfo[0]
        );

        service.setResponse(response);
    }
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:69,代码来源:SubscriptionManager.java

示例4: onSetTriggering

import com.digitalpetri.opcua.stack.core.types.structured.SetTriggeringRequest; //导入依赖的package包/类
@Override
public void onSetTriggering(ServiceRequest<SetTriggeringRequest, SetTriggeringResponse> service) throws UaException {
    setTriggeringMetric.record(service);

    subscriptionManager.setTriggering(service);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:7,代码来源:MonitoredItemServices.java

示例5: onSetTriggering

import com.digitalpetri.opcua.stack.core.types.structured.SetTriggeringRequest; //导入依赖的package包/类
default void onSetTriggering(ServiceRequest<SetTriggeringRequest, SetTriggeringResponse> serviceRequest) throws UaException {
    serviceRequest.setServiceFault(Bad_ServiceUnsupported);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:4,代码来源:MonitoredItemServiceSet.java


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