15namespace opcua::services::detail {
18auto* getPointer(T& value)
noexcept {
20 return const_cast<std::remove_const_t<T>*
>(&value);
24auto* getPointer(
Span<T> array)
noexcept {
26 return const_cast<std::remove_const_t<T>*
>(array.data());
30auto* getNativePointer(T& wrapper)
noexcept {
31 return asNative(getPointer(wrapper));
35auto* getNativePointer(
Span<T> array)
noexcept {
40ExtensionObject wrapNodeAttributes(
const T& attributes)
noexcept {
42 return ExtensionObject(
const_cast<T*
>(&attributes));
47 const NodeId& referenceType,
49 std::string_view browseName,
51 const ExtensionObject& nodeAttributes,
52 const NodeId& typeDefinition
56 item.referenceTypeId = referenceType;
57 item.requestedNewNodeId.nodeId = id;
59 item.browseName.name = opcua::detail::toNativeString(browseName);
61 item.nodeAttributes = nodeAttributes;
62 item.typeDefinition.nodeId = typeDefinition;
69 request.nodesToAdd = &item;
74 const NodeId& sourceId,
const NodeId& referenceType,
bool forward,
const NodeId& targetId
78 item.referenceTypeId = referenceType;
79 item.isForward = forward;
80 item.targetNodeId.nodeId = targetId;
87 request.referencesToAdd = &item;
101 request.nodesToDelete = &item;
107 const NodeId& referenceType,
110 bool deleteBidirectional
114 item.referenceTypeId = referenceType;
115 item.isForward = isForward;
116 item.targetNodeId.nodeId = targetId;
117 item.deleteBidirectional = deleteBidirectional;
125 request.referencesToDelete = &item;
131 item.
nodeId = *
id.handle();
132 item.attributeId =
static_cast<uint32_t
>(attributeId);
141 request.nodesToReadSize = 1;
142 request.nodesToRead = &item;
151 request.nodesToReadSize = nodesToRead.size();
152 request.nodesToRead = getNativePointer(nodesToRead);
160 item.
nodeId = *
id.handle();
161 item.attributeId =
static_cast<uint32_t
>(attributeId);
162 item.value = *value.handle();
163 item.value.hasValue =
true;
170 request.nodesToWrite = &item;
177 request.nodesToWrite = getNativePointer(nodesToWrite);
181#ifdef UA_ENABLE_METHODCALLS
188 request.methodId = methodId;
189 request.inputArgumentsSize = inputArguments.size();
190 request.inputArguments = getNativePointer(inputArguments);
197 request.methodsToCallSize = 1;
204 const BrowseDescription& bd, uint32_t maxReferences
208 request.nodesToBrowseSize = 1;
209 request.nodesToBrowse = getNativePointer(bd);
214 bool releaseContinuationPoint,
const ByteString& continuationPoint
218 request.continuationPointsSize = 1;
219 request.continuationPoints = getNativePointer(continuationPoint);
224 const BrowsePath& browsePath
228 request.browsePaths = getNativePointer(browsePath);
233 std::vector<RelativePathElement> relativePathElements(browsePath.size());
237 relativePathElements.begin(),
239 return RelativePathElement(ReferenceTypeId::HierarchicalReferences, false, true, qn);
245#ifdef UA_ENABLE_SUBSCRIPTIONS
247template <
typename SubscriptionParameters>
253 request.requestedLifetimeCount = parameters.lifetimeCount;
254 request.requestedMaxKeepAliveCount = parameters.maxKeepAliveCount;
255 request.maxNotificationsPerPublish = parameters.maxNotificationsPerPublish;
256 request.publishingEnabled = publishingEnabled;
257 request.priority = parameters.priority;
261template <
typename SubscriptionParameters>
267 request.requestedPublishingInterval = parameters.publishingInterval;
268 request.requestedLifetimeCount = parameters.lifetimeCount;
269 request.requestedMaxKeepAliveCount = parameters.maxKeepAliveCount;
270 request.maxNotificationsPerPublish = parameters.maxNotificationsPerPublish;
271 request.priority = parameters.priority;
280 request.subscriptionIdsSize = subscriptionIds.size();
281 request.subscriptionIds = getPointer(subscriptionIds);
289 request.subscriptionIds = &subscriptionId;
293template <
typename MonitoringParameters>
294inline void copyMonitoringParametersToNative(
297 native.samplingInterval = parameters.samplingInterval;
298 native.filter = parameters.filter;
299 native.queueSize = parameters.queueSize;
300 native.discardOldest = parameters.discardOldest;
303template <
typename MonitoringParameters>
305 const ReadValueId& itemToMonitor,
307 MonitoringParameters& parameters
312 copyMonitoringParametersToNative(parameters, request.requestedParameters);
324 request.itemsToCreateSize = itemsToCreate.size();
325 request.itemsToCreate = getPointer(itemsToCreate);
329template <
typename MonitoringParameters>
331 IntegerId monitoredItemId, MonitoringParameters& parameters
335 copyMonitoringParametersToNative(parameters, item.requestedParameters);
339template <
typename MonitoringParameters>
346 request.itemsToModifySize = 1;
347 request.itemsToModify = &item;
357 request.monitoredItemIdsSize = monitoredItemIds.size();
358 request.monitoredItemIds = getPointer(monitoredItemIds);
370 request.triggeringItemId = triggeringItemId;
371 request.linksToAddSize = linksToAdd.size();
372 request.linksToAdd = getPointer(linksToAdd);
373 request.linksToRemoveSize = linksToRemove.size();
374 request.linksToRemove = getPointer(linksToRemove);
383 request.monitoredItemIdsSize = monitoredItemIds.size();
384 request.monitoredItemIds = getPointer(monitoredItemIds);
Span(Container &) -> Span< typename Container::value_type >
DeleteReferencesResponse deleteReferences(Client &connection, const DeleteReferencesRequest &request) noexcept
Delete one or more references (client only).
constexpr NativeType * asNative(WrapperType *wrapper) noexcept
Cast Wrapper object pointers to native object pointers.
MonitoringMode
Monitoring mode.
TimestampsToReturn
Timestamps to return.
uint32_t IntegerId
IntegerId.
services::SubscriptionParameters SubscriptionParameters
AttributeId
Attribute identifiers.
@ NodeId
Unambiguous identifier of a node.
UA_ExpandedNodeId parentNodeId
size_t referencesToAddSize
UA_Boolean releaseContinuationPoints
UA_UInt32 requestedMaxReferencesPerNode
UA_CallMethodRequest * methodsToCall
UA_Double requestedPublishingInterval
size_t referencesToDeleteSize
size_t subscriptionIdsSize
UA_ReadValueId itemToMonitor
UA_UInt32 monitoredItemId
UA_TimestampsToReturn timestampsToReturn
UA_Boolean publishingEnabled