本文整理汇总了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;
}
示例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));
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例9: decodeMessage
import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
@Override
public <T extends UaStructure> T decodeMessage(String field) {
return null;
}
示例10: encode
import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
public static ExtensionObject encode(UaStructure structure) throws UaSerializationException {
return encodeAsByteString(structure, structure.getBinaryEncodingId());
}
示例11: encodeMessage
import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
@Override
public <T extends UaStructure> void encodeMessage(String field, T message) {
}
示例12: wrapQueueValue
import com.digitalpetri.opcua.stack.core.serialization.UaStructure; //导入依赖的package包/类
protected abstract UaStructure wrapQueueValue(ValueType value);