open62541pp 0.17.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
monitoreditem.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <functional>
5#include <memory>
6#include <utility> // forward
7#include <vector>
8
10#include "open62541pp/config.hpp"
11#include "open62541pp/detail/client_utils.hpp" // getHandle
18#include "open62541pp/span.hpp"
19#include "open62541pp/types.hpp"
21
22#ifdef UA_ENABLE_SUBSCRIPTIONS
23
24namespace opcua {
25class Client;
26} // namespace opcua
27
28namespace opcua::services {
29
30/**
31 * @defgroup MonitoredItem MonitoredItem service set
32 * Subscribe to data and events.
33 *
34 * Note the difference between Subscriptions and MonitoredItems. Subscriptions are used to report
35 * back notifications. Monitored items are used to generate notifications. Every monitored item is
36 * attached to exactly one subscription. And a subscription can contain many monitored items.
37 *
38 * Monitored items can also be registered locally (server-side). Notifications are then forwarded
39 * to a user-defined callback instead of a remote client.
40 *
41 * @see Subscription
42 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13
43 * @ingroup Services
44 * @{
45 */
46
47/**
48 * Extended monitoring parameters with default values from open62541.
49 * This is an extended version of `UA_MonitoringParameters` with the `timestamps` parameter.
50 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.21
51 */
53 /// Timestamps to be transmitted.
54 TimestampsToReturn timestamps = TimestampsToReturn::Both;
55 /// Interval in milliseconds that defines the fastest rate at which the MonitoredItem should be
56 /// accessed and evaluated. The following values have special meaning:
57 /// - `0.0` to use the fastest practical rate
58 /// - `-1.0` to use the default sampling interval (publishing interval of the subscription)
59 double samplingInterval = 250.0;
60 /// Filter is used by the server to determine if the MonitoredItem should generate
61 /// notifications. The filter parameter type is an extensible parameter type and can be, for
62 /// example, of type DataChangeFilter, EventFilter or AggregateFilter.
63 /// @see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.22
65 /// Size of the MonitoringItem queue.
66 /// The following values have special meaning:
67 /// - `0` to retrieve the server's default queue size
68 /// - `1` to retrieve the server's minimum queue size
69 /// In the case of a queue overflow, an Event of the type EventQueueOverflowEventType is
70 /// generated.
71 uint32_t queueSize = 1;
72 /// Discard policy when the queue is full.
73 /// - `true`: the oldest (first) notification in the queue is discarded
74 /// - `false`: the last notification added to the queue gets replaced with the new notification
75 bool discardOldest = true;
76};
77
78/**
79 * @defgroup CreateMonitoredItems CreateMonitoredItems service
80 * Create and add a monitored item to a subscription.
81 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.2
82 * @{
83 */
84
85/**
86 * MonitoredItem deletion callback.
87 * @param subId Subscription identifier
88 * @param monId MonitoredItem identifier
89 */
90using DeleteMonitoredItemCallback = std::function<void(IntegerId subId, IntegerId monId)>;
91
92/**
93 * Data change notification callback.
94 * @param subId Subscription identifier (`0U` for local (server-side) monitored item)
95 * @param monId MonitoredItem identifier
96 * @param value Changed value
97 */
99 std::function<void(IntegerId subId, IntegerId monId, const DataValue& value)>;
100
101/**
102 * Event notification callback.
103 * @param subId Subscription identifier (`0U` for local (server-side) monitored item)
104 * @param monId MonitoredItem identifier
105 * @param eventFields Event fields
106 */
108 std::function<void(IntegerId subId, IntegerId monId, Span<const Variant> eventFields)>;
109
110namespace detail {
111std::vector<std::unique_ptr<MonitoredItemContext>> createMonitoredItemContexts(
112 Client& connection,
113 const CreateMonitoredItemsRequest& request,
114 DataChangeNotificationCallback dataChangeCallback,
115 EventNotificationCallback eventCallback,
116 DeleteMonitoredItemCallback deleteCallback
117);
118
119void convertMonitoredItemContexts(
120 Span<const std::unique_ptr<MonitoredItemContext>> contexts,
121 Span<MonitoredItemContext*> contextsPtr,
122 Span<UA_Client_DataChangeNotificationCallback> dataChangeCallbacksNative,
125) noexcept;
126
127void storeMonitoredItemContexts(
128 Client& connection,
129 IntegerId subscriptionId,
130 const CreateMonitoredItemsResponse& response,
131 Span<std::unique_ptr<MonitoredItemContext>> contexts
132);
133} // namespace detail
134
135/**
136 * Create and add monitored items to a subscription for data change notifications.
137 * Don't use this function to monitor the `EventNotifier` attribute.
138 * Create monitored items with @ref createMonitoredItemsEvent instead.
139 *
140 * @param connection Instance of type Client
141 * @param request Create monitored items request
142 * @param dataChangeCallback Invoked when the monitored item is changed
143 * @param deleteCallback Invoked when the monitored item is deleted
144 */
146 Client& connection,
147 const CreateMonitoredItemsRequest& request,
148 DataChangeNotificationCallback dataChangeCallback,
149 DeleteMonitoredItemCallback deleteCallback
150);
151
152#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
153/**
154 * @copydoc createMonitoredItemsDataChange(Client&, const CreateMonitoredItemsRequest&,
155 * DataChangeNotificationCallback, DeleteMonitoredItemCallback)
156 * @param token @completiontoken{void(CreateMonitoredItemsResponse&)}
157 * @return @asyncresult{CreateMonitoredItemsResponse}
158 */
159template <typename CompletionToken>
161 Client& connection,
162 const CreateMonitoredItemsRequest& request,
163 DataChangeNotificationCallback dataChangeCallback,
164 DeleteMonitoredItemCallback deleteCallback,
165 CompletionToken&& token
166) {
167 auto contexts = detail::createMonitoredItemContexts(
168 connection, request, std::move(dataChangeCallback), {}, std::move(deleteCallback)
169 );
170 std::vector<detail::MonitoredItemContext*> contextsPtr(contexts.size());
171 std::vector<UA_Client_DataChangeNotificationCallback> dataChangeCallbacks(contexts.size());
172 std::vector<UA_Client_DeleteMonitoredItemCallback> deleteCallbacks(contexts.size());
173 detail::convertMonitoredItemContexts(
174 contexts, contextsPtr, dataChangeCallbacks, {}, deleteCallbacks
175 );
176 return detail::AsyncServiceAdapter<CreateMonitoredItemsResponse>::initiate(
177 connection,
178 [&](UA_ClientAsyncServiceCallback callback, void* userdata) {
180 opcua::detail::getHandle(connection),
181 asNative(request),
182 reinterpret_cast<void**>(contextsPtr.data()), // NOLINT
183 dataChangeCallbacks.data(),
184 deleteCallbacks.data(),
185 callback,
186 userdata,
187 nullptr
188 ));
189 },
190 detail::HookToken(
191 [&connection,
192 subscriptionId = request.subscriptionId(),
193 contexts = std::move(contexts)](const auto& response) mutable {
194 detail::storeMonitoredItemContexts(connection, subscriptionId, response, contexts);
195 },
196 std::forward<CompletionToken>(token)
197 )
198 );
199}
200#endif
201
202/**
203 * Create and add a monitored item to a subscription for data change notifications.
204 * Don't use this function to monitor the `EventNotifier` attribute.
205 * Create a monitored item with @ref createMonitoredItemEvent instead.
206 *
207 * @param connection Instance of type Server or Client
208 * @param subscriptionId Identifier of the subscription returned by @ref createSubscription.
209 * Use `0U` for a local server-side monitored item.
210 * @param itemToMonitor Item to monitor
211 * @param monitoringMode Monitoring mode
212 * @param parameters Monitoring parameters
213 * @param dataChangeCallback Invoked when the monitored item is changed
214 * @param deleteCallback Invoked when the monitored item is deleted
215 */
216template <typename T>
218 T& connection,
219 IntegerId subscriptionId,
220 const ReadValueId& itemToMonitor,
221 MonitoringMode monitoringMode,
222 const MonitoringParametersEx& parameters,
223 DataChangeNotificationCallback dataChangeCallback,
224 DeleteMonitoredItemCallback deleteCallback
225);
226
227#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
228/**
229 * @copydoc createMonitoredItemDataChange(Client&, IntegerId, const ReadValueId&, MonitoringMode,
230 * const MonitoringParametersEx&, DataChangeNotificationCallback,
231 * DeleteMonitoredItemCallback)
232 * @param token @completiontoken{void(MonitoredItemCreateResult&)}
233 * @return @asyncresult{MonitoredItemCreateResult}
234 */
235template <typename CompletionToken>
237 Client& connection,
238 IntegerId subscriptionId,
239 const ReadValueId& itemToMonitor,
240 MonitoringMode monitoringMode,
241 const MonitoringParametersEx& parameters,
242 DataChangeNotificationCallback dataChangeCallback,
243 DeleteMonitoredItemCallback deleteCallback,
244 CompletionToken&& token
245) {
246 auto item = detail::createMonitoredItemCreateRequest(itemToMonitor, monitoringMode, parameters);
247 const auto request = detail::createCreateMonitoredItemsRequest(
248 subscriptionId, parameters.timestamps, {&item, 1}
249 );
251 connection,
253 std::move(dataChangeCallback),
254 std::move(deleteCallback),
255 detail::TransformToken(
256 detail::wrapSingleResultWithStatus<
259 std::forward<CompletionToken>(token)
260 )
261 );
262}
263#endif
264
265/**
266 * Create and add monitored items to a subscription for event notifications.
267 * The `attributeId` of ReadValueId must be set to AttributeId::EventNotifier.
268 *
269 * @param connection Instance of type Client
270 * @param request Create monitored items request
271 * @param eventCallback Invoked when an event is published
272 * @param deleteCallback Invoked when the monitored item is deleted
273 */
275 Client& connection,
276 const CreateMonitoredItemsRequest& request,
277 EventNotificationCallback eventCallback,
278 DeleteMonitoredItemCallback deleteCallback
279);
280
281#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
282/**
283 * @copydoc createMonitoredItemsEvent(Client&, const CreateMonitoredItemsRequest&,
284 * EventNotificationCallback, DeleteMonitoredItemCallback)
285 * @param token @completiontoken{void(CreateMonitoredItemsResponse&)}
286 * @return @asyncresult{CreateMonitoredItemsResponse}
287 */
288template <typename CompletionToken>
290 Client& connection,
291 const CreateMonitoredItemsRequest& request,
292 EventNotificationCallback eventCallback,
293 DeleteMonitoredItemCallback deleteCallback,
294 CompletionToken&& token
295) {
296 auto contexts = detail::createMonitoredItemContexts(
297 connection, request, {}, std::move(eventCallback), std::move(deleteCallback)
298 );
299 std::vector<detail::MonitoredItemContext*> contextsPtr(contexts.size());
300 std::vector<UA_Client_EventNotificationCallback> eventCallbacks(contexts.size());
301 std::vector<UA_Client_DeleteMonitoredItemCallback> deleteCallbacks(contexts.size());
302 detail::convertMonitoredItemContexts(
303 contexts, contextsPtr, {}, eventCallbacks, deleteCallbacks
304 );
305 return detail::AsyncServiceAdapter<CreateMonitoredItemsResponse>::initiate(
306 connection,
307 [&](UA_ClientAsyncServiceCallback callback, void* userdata) {
309 opcua::detail::getHandle(connection),
310 asNative(request),
311 reinterpret_cast<void**>(contextsPtr.data()), // NOLINT
312 eventCallbacks.data(),
313 deleteCallbacks.data(),
314 callback,
315 userdata,
316 nullptr
317 ));
318 },
319 detail::HookToken(
320 [&connection,
321 subscriptionId = request.subscriptionId(),
322 contexts = std::move(contexts)](const auto& response) mutable {
323 detail::storeMonitoredItemContexts(connection, subscriptionId, response, contexts);
324 },
325 std::forward<CompletionToken>(token)
326 )
327 );
328}
329#endif
330
331/**
332 * Create and add a monitored item to a subscription for event notifications.
333 * The `attributeId` of ReadValueId must be set to AttributeId::EventNotifier.
334 *
335 * @param connection Instance of type Client
336 * @param subscriptionId Identifier of the subscription returned by @ref createSubscription
337 * @param itemToMonitor Item to monitor
338 * @param monitoringMode Monitoring mode
339 * @param parameters Monitoring parameters
340 * @param eventCallback Invoked when an event is published
341 * @param deleteCallback Invoked when the monitored item is deleted
342 */
344 Client& connection,
345 IntegerId subscriptionId,
346 const ReadValueId& itemToMonitor,
347 MonitoringMode monitoringMode,
348 const MonitoringParametersEx& parameters,
349 EventNotificationCallback eventCallback,
350 DeleteMonitoredItemCallback deleteCallback = {}
351);
352
353#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
354/**
355 * @copydoc createMonitoredItemEvent(Client&, IntegerId, const ReadValueId&, MonitoringMode,
356 * const MonitoringParametersEx&, EventNotificationCallback, DeleteMonitoredItemCallback)
357 * @param token @completiontoken{void(MonitoredItemCreateResult&)}
358 * @return @asyncresult{MonitoredItemCreateResult}
359 */
360template <typename CompletionToken>
362 Client& connection,
363 IntegerId subscriptionId,
364 const ReadValueId& itemToMonitor,
365 MonitoringMode monitoringMode,
366 const MonitoringParametersEx& parameters,
367 EventNotificationCallback eventCallback,
368 DeleteMonitoredItemCallback deleteCallback,
369 CompletionToken&& token
370) {
371 auto item = detail::createMonitoredItemCreateRequest(itemToMonitor, monitoringMode, parameters);
372 const auto request = detail::createCreateMonitoredItemsRequest(
373 subscriptionId, parameters.timestamps, {&item, 1}
374 );
376 connection,
378 std::move(eventCallback),
379 std::move(deleteCallback),
380 detail::TransformToken(
381 detail::wrapSingleResultWithStatus<
384 std::forward<CompletionToken>(token)
385 )
386 );
387}
388#endif
389
390/**
391 * @}
392 * @defgroup ModifyMonitoredItems ModifyMonitoredItems service
393 * Modify a monitored items of a subscription.
394 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.3
395 * @{
396 */
397
398/**
399 * Modify monitored items of a subscription.
400 *
401 * @param connection Instance of type Client
402 * @param request Modify monitored items request
403 */
405 Client& connection, const ModifyMonitoredItemsRequest& request
406) noexcept;
407
408#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
409/**
410 * @copydoc modifyMonitoredItems(Client&, const ModifyMonitoredItemsRequest&)
411 * @param token @completiontoken{void(ModifyMonitoredItemsResponse&)}
412 * @return @asyncresult{ModifyMonitoredItemsResponse}
413 */
414template <typename CompletionToken>
416 Client& connection, const ModifyMonitoredItemsRequest& request, CompletionToken&& token
417) {
418 return detail::AsyncServiceAdapter<ModifyMonitoredItemsResponse>::initiate(
419 connection,
420 [&](UA_ClientAsyncServiceCallback callback, void* userdata) {
421 throwIfBad(UA_Client_MonitoredItems_modify_async(
422 opcua::detail::getHandle(connection), asNative(request), callback, userdata, nullptr
423 ));
424 },
425 std::forward<CompletionToken>(token)
426 );
427}
428#endif
429
430/**
431 * Modify a monitored item of a subscription.
432 *
433 * @param connection Instance of type Client
434 * @param subscriptionId Identifier of the subscription returned by @ref createSubscription
435 * @param monitoredItemId Identifier of the monitored item
436 * @param parameters Monitoring parameters
437 */
439 Client& connection,
440 IntegerId subscriptionId,
441 IntegerId monitoredItemId,
442 const MonitoringParametersEx& parameters
443) noexcept {
444 auto item = detail::createMonitoredItemModifyRequest(monitoredItemId, parameters);
445 auto request = detail::createModifyMonitoredItemsRequest(subscriptionId, parameters, item);
446 auto response = modifyMonitoredItems(
447 connection, asWrapper<ModifyMonitoredItemsRequest>(request)
448 );
449 return detail::wrapSingleResultWithStatus<MonitoredItemModifyResult>(response);
450}
451
452#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
453/**
454 * @copydoc modifyMonitoredItems(Client&, IntegerId, IntegerId, const MonitoringParametersEx&)
455 * @param token @completiontoken{void(MonitoredItemModifyResult&)}
456 * @return @asyncresult{MonitoredItemModifyResult}
457 */
458template <typename CompletionToken>
460 Client& connection,
461 IntegerId subscriptionId,
462 IntegerId monitoredItemId,
463 const MonitoringParametersEx& parameters,
464 CompletionToken&& token
465) {
466 auto item = detail::createMonitoredItemModifyRequest(monitoredItemId, parameters);
467 auto request = detail::createModifyMonitoredItemsRequest(subscriptionId, parameters, item);
469 connection,
471 detail::TransformToken(
472 detail::wrapSingleResultWithStatus<
475 std::forward<CompletionToken>(token)
476 )
477 );
478}
479#endif
480
481/**
482 * @}
483 * @defgroup SetMonitoringMode SetMonitoringMode service
484 * Set the monitoring mode of a monitored items.
485 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.4
486 * @{
487 */
488
489/**
490 * Set the monitoring mode of monitored items.
491 *
492 * @param connection Instance of type Client
493 * @param request Set monitoring mode request
494 */
496 Client& connection, const SetMonitoringModeRequest& request
497) noexcept;
498
499/**
500 * @copydoc setMonitoringMode(Client&, const SetMonitoringModeRequest&)
501 * @param token @completiontoken{void(SetMonitoringModeResponse&)}
502 * @return @asyncresult{SetMonitoringModeResponse}
503 */
504template <typename CompletionToken>
506 Client& connection, const SetMonitoringModeRequest& request, CompletionToken&& token
507) {
508 return detail::sendRequestAsync<SetMonitoringModeRequest, SetMonitoringModeResponse>(
509 connection, request, std::forward<CompletionToken>(token)
510 );
511}
512
513/**
514 * Set the monitoring mode of a monitored item.
515 *
516 * @param connection Instance of type Client
517 * @param subscriptionId Identifier of the subscription returned by @ref createSubscription
518 * @param monitoredItemId Identifier of the monitored item
519 * @param monitoringMode Monitoring mode
520 */
522 Client& connection,
523 IntegerId subscriptionId,
524 IntegerId monitoredItemId,
525 MonitoringMode monitoringMode
526) noexcept {
527 const auto request = detail::createSetMonitoringModeRequest(
528 subscriptionId, {&monitoredItemId, 1}, monitoringMode
529 );
530 return detail::getSingleStatus(
532 );
533}
534
535/**
536 * @copydoc setMonitoringMode(Client&, IntegerId, IntegerId, MonitoringMode)
537 * @param token @completiontoken{void(StatusCode)}
538 * @return @asyncresult{StatusCode}
539 */
540template <typename CompletionToken>
542 Client& connection,
543 IntegerId subscriptionId,
544 IntegerId monitoredItemId,
545 MonitoringMode monitoringMode,
546 CompletionToken&& token
547) {
548 const auto request = detail::createSetMonitoringModeRequest(
549 subscriptionId, {&monitoredItemId, 1}, monitoringMode
550 );
552 connection,
554 detail::TransformToken(
555 detail::getSingleStatus<SetMonitoringModeResponse>, std::forward<CompletionToken>(token)
556 )
557 );
558}
559
560/**
561 * @}
562 * @defgroup SetTriggering SetTriggering service
563 * Create and delete triggering links for a triggering item.
564 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.1.6
565 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.5
566 * @{
567 */
568
569/**
570 * Add and delete triggering links of monitored items.
571 * The triggering item and the items to report shall belong to the same subscription.
572 * @note Supported since open62541 v1.2
573 *
574 * @param connection Instance of type Client
575 * @param request Set triggering request
576 */
578 Client& connection, const SetTriggeringRequest& request
579) noexcept;
580
581/**
582 * @copydoc setTriggering
583 * @param token @completiontoken{void(SetTriggeringResponse&)}
584 * @return @asyncresult{SetTriggeringResponse}
585 */
586template <typename CompletionToken>
588 Client& connection, const SetTriggeringRequest& request, CompletionToken&& token
589) {
590 return detail::sendRequestAsync<SetTriggeringRequest, SetTriggeringResponse>(
591 connection, request, std::forward<CompletionToken>(token)
592 );
593}
594
595/**
596 * @}
597 * @defgroup DeleteMonitoredItems DeleteMonitoredItems service
598 * Delete a monitored items from subscriptions.
599 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.6
600 * @{
601 */
602
603/**
604 * Delete monitored items from a subscription.
605 *
606 * @param connection Instance of type Client
607 * @param request Delete monitored items request
608 */
610 Client& connection, const DeleteMonitoredItemsRequest& request
611) noexcept;
612
613#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
614/**
615 * @copydoc deleteMonitoredItems
616 * @param token @completiontoken{void(DeleteMonitoredItemsResponse&)}
617 * @return @asyncresult{DeleteMonitoredItemsResponse}
618 */
619template <typename CompletionToken>
621 Client& connection, const DeleteMonitoredItemsRequest& request, CompletionToken&& token
622) {
623 return detail::AsyncServiceAdapter<DeleteMonitoredItemsResponse>::initiate(
624 connection,
625 [&](UA_ClientAsyncServiceCallback callback, void* userdata) {
627 opcua::detail::getHandle(connection), asNative(request), callback, userdata, nullptr
628 ));
629 },
630 std::forward<CompletionToken>(token)
631 );
632}
633#endif
634
635/**
636 * Delete a monitored item from a subscription.
637 *
638 * @param connection Instance of type Server or Client
639 * @param subscriptionId Identifier of the subscription returned by @ref createSubscription.
640 * Use `0U` for a local server-side monitored item.
641 * @param monitoredItemId Identifier of the monitored item
642 */
643template <typename T>
644StatusCode deleteMonitoredItem(T& connection, IntegerId subscriptionId, IntegerId monitoredItemId);
645
646#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
647/**
648 * @copydoc deleteMonitoredItem
649 * @param token @completiontoken{void(StatusCode)}
650 * @return @asyncresult{StatusCode}
651 */
652template <typename CompletionToken>
654 Client& connection, IntegerId subscriptionId, IntegerId monitoredItemId, CompletionToken&& token
655) {
656 const auto request = detail::createDeleteMonitoredItemsRequest(
657 subscriptionId, {&monitoredItemId, 1}
658 );
660 connection,
662 detail::TransformToken(
663 detail::getSingleStatus<DeleteMonitoredItemsResponse>,
664 std::forward<CompletionToken>(token)
665 )
666 );
667}
668#endif
669
670/**
671 * @}
672 * @}
673 */
674
675} // namespace opcua::services
676
677#endif
High-level client class.
Definition client.hpp:122
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
UA_DataValue wrapper class.
Definition types.hpp:1832
UA_ExtensionObject wrapper class.
Definition types.hpp:2077
View to a contiguous sequence of objects, similar to std::span in C++20.
Definition span.hpp:28
UA_StatusCode wrapper class.
Definition types.hpp:46
UA_CreateMonitoredItemsRequest wrapper class.
Definition types.hpp:2052
IntegerId subscriptionId() const noexcept
Definition types.hpp:2070
UA_CreateMonitoredItemsResponse wrapper class.
Definition types.hpp:2082
UA_DeleteMonitoredItemsRequest wrapper class.
Definition types.hpp:2275
UA_DeleteMonitoredItemsResponse wrapper class.
Definition types.hpp:2300
UA_ModifyMonitoredItemsRequest wrapper class.
Definition types.hpp:2133
UA_CreateMonitoredItemsResponse wrapper class.
Definition types.hpp:2163
UA_MonitoredItemCreateResult wrapper class.
Definition types.hpp:2036
UA_MonitoredItemModifyResult wrapper class.
Definition types.hpp:2118
UA_ReadValueId wrapper class.
Definition types.hpp:1393
UA_SetMonitoringModeRequest wrapper class.
Definition types.hpp:2179
UA_SetMonitoringModeResponse wrapper class.
Definition types.hpp:2207
UA_SetTriggeringRequest wrapper class.
Definition types.hpp:2223
UA_SetTriggeringResponse wrapper class.
Definition types.hpp:2255
void(* UA_ClientAsyncServiceCallback)(UA_Client *client, void *userdata, UA_UInt32 requestId, void *response)
UA_StatusCode UA_Client_MonitoredItems_createEvents_async(UA_Client *client, const UA_CreateMonitoredItemsRequest request, void **contexts, UA_Client_EventNotificationCallback *callbacks, UA_Client_DeleteMonitoredItemCallback *deleteCallbacks, UA_ClientAsyncServiceCallback createCallback, void *userdata, UA_UInt32 *requestId)
UA_StatusCode UA_Client_MonitoredItems_delete_async(UA_Client *client, const UA_DeleteMonitoredItemsRequest request, UA_ClientAsyncServiceCallback callback, void *userdata, UA_UInt32 *requestId)
UA_StatusCode UA_Client_MonitoredItems_createDataChanges_async(UA_Client *client, const UA_CreateMonitoredItemsRequest request, void **contexts, UA_Client_DataChangeNotificationCallback *callbacks, UA_Client_DeleteMonitoredItemCallback *deleteCallbacks, UA_ClientAsyncServiceCallback createCallback, void *userdata, UA_UInt32 *requestId)
CreateMonitoredItemsResponse createMonitoredItemsDataChange(Client &connection, const CreateMonitoredItemsRequest &request, DataChangeNotificationCallback dataChangeCallback, DeleteMonitoredItemCallback deleteCallback)
Create and add monitored items to a subscription for data change notifications.
MonitoredItemCreateResult createMonitoredItemEvent(Client &connection, IntegerId subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx &parameters, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback={})
Create and add a monitored item to a subscription for event notifications.
auto createMonitoredItemsEventAsync(Client &connection, const CreateMonitoredItemsRequest &request, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback, CompletionToken &&token)
Create and add monitored items to a subscription for event notifications.
auto createMonitoredItemEventAsync(Client &connection, IntegerId subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx &parameters, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback, CompletionToken &&token)
Create and add a monitored item to a subscription for event notifications.
std::function< void(IntegerId subId, IntegerId monId)> DeleteMonitoredItemCallback
MonitoredItem deletion callback.
MonitoredItemCreateResult createMonitoredItemDataChange(T &connection, IntegerId subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx &parameters, DataChangeNotificationCallback dataChangeCallback, DeleteMonitoredItemCallback deleteCallback)
Create and add a monitored item to a subscription for data change notifications.
auto createMonitoredItemDataChangeAsync(Client &connection, IntegerId subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx &parameters, DataChangeNotificationCallback dataChangeCallback, DeleteMonitoredItemCallback deleteCallback, CompletionToken &&token)
CreateMonitoredItemsResponse createMonitoredItemsEvent(Client &connection, const CreateMonitoredItemsRequest &request, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback)
Create and add monitored items to a subscription for event notifications.
std::function< void(IntegerId subId, IntegerId monId, const DataValue &value)> DataChangeNotificationCallback
Data change notification callback.
auto createMonitoredItemsDataChangeAsync(Client &connection, const CreateMonitoredItemsRequest &request, DataChangeNotificationCallback dataChangeCallback, DeleteMonitoredItemCallback deleteCallback, CompletionToken &&token)
Create and add monitored items to a subscription for data change notifications.
std::function< void(IntegerId subId, IntegerId monId, Span< const Variant > eventFields)> EventNotificationCallback
Event notification callback.
StatusCode deleteMonitoredItem(T &connection, IntegerId subscriptionId, IntegerId monitoredItemId)
Delete a monitored item from a subscription.
auto deleteMonitoredItemAsync(Client &connection, IntegerId subscriptionId, IntegerId monitoredItemId, CompletionToken &&token)
Delete a monitored item from a subscription.
DeleteMonitoredItemsResponse deleteMonitoredItems(Client &connection, const DeleteMonitoredItemsRequest &request) noexcept
Delete monitored items from a subscription.
auto deleteMonitoredItemsAsync(Client &connection, const DeleteMonitoredItemsRequest &request, CompletionToken &&token)
Delete monitored items from a subscription.
ModifyMonitoredItemsResponse modifyMonitoredItems(Client &connection, const ModifyMonitoredItemsRequest &request) noexcept
Modify monitored items of a subscription.
MonitoredItemModifyResult modifyMonitoredItem(Client &connection, IntegerId subscriptionId, IntegerId monitoredItemId, const MonitoringParametersEx &parameters) noexcept
Modify a monitored item of a subscription.
auto modifyMonitoredItemsAsync(Client &connection, const ModifyMonitoredItemsRequest &request, CompletionToken &&token)
Modify monitored items of a subscription.
auto modifyMonitoredItemAsync(Client &connection, IntegerId subscriptionId, IntegerId monitoredItemId, const MonitoringParametersEx &parameters, CompletionToken &&token)
auto setMonitoringModeAsync(Client &connection, const SetMonitoringModeRequest &request, CompletionToken &&token)
Set the monitoring mode of monitored items.
SetMonitoringModeResponse setMonitoringMode(Client &connection, const SetMonitoringModeRequest &request) noexcept
Set the monitoring mode of monitored items.
SetTriggeringResponse setTriggering(Client &connection, const SetTriggeringRequest &request) noexcept
Add and delete triggering links of monitored items.
auto setTriggeringAsync(Client &connection, const SetTriggeringRequest &request, CompletionToken &&token)
Add and delete triggering links of monitored items.
constexpr NativeType * asNative(WrapperType *wrapper) noexcept
Cast Wrapper object pointers to native object pointers.
Definition wrapper.hpp:223
MonitoringMode
Monitoring mode.
Definition types.hpp:1664
TimestampsToReturn
Timestamps to return.
Definition types.hpp:1379
OPC UA services as free functions.
Definition attribute.hpp:21
uint32_t IntegerId
IntegerId.
Definition types.hpp:123
constexpr void throwIfBad(UA_StatusCode code)
Check the status code and throw a BadStatus exception if the status code is bad.
Definition exception.hpp:85
Extended monitoring parameters with default values from open62541.
uint32_t queueSize
Size of the MonitoringItem queue.
TimestampsToReturn timestamps
Timestamps to be transmitted.
ExtensionObject filter
Filter is used by the server to determine if the MonitoredItem should generate notifications.
double samplingInterval
Interval in milliseconds that defines the fastest rate at which the MonitoredItem should be accessed ...
bool discardOldest
Discard policy when the queue is full.