本文整理汇总了Java中com.digitalpetri.opcua.stack.core.types.structured.SetMonitoringModeResponse类的典型用法代码示例。如果您正苦于以下问题:Java SetMonitoringModeResponse类的具体用法?Java SetMonitoringModeResponse怎么用?Java SetMonitoringModeResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SetMonitoringModeResponse类属于com.digitalpetri.opcua.stack.core.types.structured包,在下文中一共展示了SetMonitoringModeResponse类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSetMonitoringMode
import com.digitalpetri.opcua.stack.core.types.structured.SetMonitoringModeResponse; //导入依赖的package包/类
@Override
public void onSetMonitoringMode(ServiceRequest<SetMonitoringModeRequest, SetMonitoringModeResponse> service) throws UaException {
Session session = session(service);
session.getMonitoredItemServices().onSetMonitoringMode(service);
}
示例2: setMonitoringMode
import com.digitalpetri.opcua.stack.core.types.structured.SetMonitoringModeResponse; //导入依赖的package包/类
public void setMonitoringMode(ServiceRequest<SetMonitoringModeRequest, SetMonitoringModeResponse> service) {
SetMonitoringModeRequest request = service.getRequest();
UInteger subscriptionId = request.getSubscriptionId();
try {
Subscription subscription = subscriptions.get(subscriptionId);
UInteger[] itemsToModify = request.getMonitoredItemIds();
if (subscription == null) {
throw new UaException(StatusCodes.Bad_SubscriptionIdInvalid);
}
if (itemsToModify.length == 0) {
throw new UaException(StatusCodes.Bad_NothingToDo);
}
/*
* Set MonitoringMode on each monitored item, if it exists.
*/
MonitoringMode monitoringMode = request.getMonitoringMode();
StatusCode[] results = new StatusCode[itemsToModify.length];
List<BaseMonitoredItem<?>> modified = newArrayListWithCapacity(itemsToModify.length);
for (int i = 0; i < itemsToModify.length; i++) {
UInteger itemId = itemsToModify[i];
BaseMonitoredItem<?> item = subscription.getMonitoredItems().get(itemId);
if (item != null) {
item.setMonitoringMode(monitoringMode);
modified.add(item);
results[i] = StatusCode.GOOD;
} else {
results[i] = new StatusCode(StatusCodes.Bad_MonitoredItemIdInvalid);
}
}
/*
* Notify namespaces of the items whose MonitoringMode has been modified.
*/
Map<UShort, List<MonitoredItem>> byNamespace = modified.stream()
.collect(Collectors.groupingBy(item -> item.getReadValueId().getNodeId().getNamespaceIndex()));
byNamespace.keySet().forEach(namespaceIndex -> {
List<MonitoredItem> items = byNamespace.get(namespaceIndex);
server.getNamespaceManager().getNamespace(namespaceIndex).onMonitoringModeChanged(items);
});
/*
* Build and return results.
*/
ResponseHeader header = service.createResponseHeader();
SetMonitoringModeResponse response = new SetMonitoringModeResponse(
header, results, new DiagnosticInfo[0]);
service.setResponse(response);
} catch (UaException e) {
service.setServiceFault(e);
}
}
示例3: onSetMonitoringMode
import com.digitalpetri.opcua.stack.core.types.structured.SetMonitoringModeResponse; //导入依赖的package包/类
@Override
public void onSetMonitoringMode(ServiceRequest<SetMonitoringModeRequest, SetMonitoringModeResponse> service) {
setMonitoringModeMetric.record(service);
subscriptionManager.setMonitoringMode(service);
}
示例4: onSetMonitoringMode
import com.digitalpetri.opcua.stack.core.types.structured.SetMonitoringModeResponse; //导入依赖的package包/类
default void onSetMonitoringMode(ServiceRequest<SetMonitoringModeRequest, SetMonitoringModeResponse> serviceRequest) throws UaException {
serviceRequest.setServiceFault(Bad_ServiceUnsupported);
}