11#include "open62541pp/config.hpp"
23#ifdef UA_ENABLE_SUBSCRIPTIONS
100 std::function<void(uint32_t subId, uint32_t monId,
const DataValue& value)>;
121 Span<
const std::unique_ptr<MonitoredItemContext>> contexts,
130 uint32_t subscriptionId,
132 Span<std::unique_ptr<MonitoredItemContext>> contexts
153#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
160template <
typename CompletionToken>
166 CompletionToken&& token
169 connection, request, std::move(dataChangeCallback), {}, std::move(deleteCallback)
171 std::vector<detail::MonitoredItemContext*> contextsPtr(contexts.size());
172 std::vector<UA_Client_DataChangeNotificationCallback> dataChangeCallbacks(contexts.size());
173 std::vector<UA_Client_DeleteMonitoredItemCallback> deleteCallbacks(contexts.size());
175 contexts, contextsPtr, dataChangeCallbacks, {}, deleteCallbacks
183 reinterpret_cast<void**
>(contextsPtr.data()),
184 dataChangeCallbacks.data(),
185 deleteCallbacks.data(),
194 contexts = std::move(contexts)](
const auto& response)
mutable {
195 detail::storeMonitoredItemContexts(connection, subscriptionId, response, contexts);
197 std::forward<CompletionToken>(token)
220 uint32_t subscriptionId,
228#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
236template <
typename CompletionToken>
239 uint32_t subscriptionId,
245 CompletionToken&& token
249 subscriptionId, parameters.
timestamps, {&item, 1}
254 std::move(dataChangeCallback),
255 std::move(deleteCallback),
260 std::forward<CompletionToken>(token)
282#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
289template <
typename CompletionToken>
295 CompletionToken&& token
298 connection, request, {}, std::move(eventCallback), std::move(deleteCallback)
300 std::vector<detail::MonitoredItemContext*> contextsPtr(contexts.size());
301 std::vector<UA_Client_EventNotificationCallback> eventCallbacks(contexts.size());
302 std::vector<UA_Client_DeleteMonitoredItemCallback> deleteCallbacks(contexts.size());
304 contexts, contextsPtr, {}, eventCallbacks, deleteCallbacks
312 reinterpret_cast<void**
>(contextsPtr.data()),
313 eventCallbacks.data(),
314 deleteCallbacks.data(),
323 contexts = std::move(contexts)](
const auto& response)
mutable {
324 detail::storeMonitoredItemContexts(connection, subscriptionId, response, contexts);
326 std::forward<CompletionToken>(token)
346 uint32_t subscriptionId,
354#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
361template <
typename CompletionToken>
364 uint32_t subscriptionId,
370 CompletionToken&& token
374 subscriptionId, parameters.
timestamps, {&item, 1}
379 std::move(eventCallback),
380 std::move(deleteCallback),
385 std::forward<CompletionToken>(token)
409#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
415template <
typename CompletionToken>
422 throwIfBad(UA_Client_MonitoredItems_modify_async(
426 std::forward<CompletionToken>(token)
441 uint32_t subscriptionId,
442 uint32_t monitoredItemId,
453#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
459template <
typename CompletionToken>
462 uint32_t subscriptionId,
463 uint32_t monitoredItemId,
465 CompletionToken&& token
476 std::forward<CompletionToken>(token)
505template <
typename CompletionToken>
510 connection, request, std::forward<CompletionToken>(token)
524 uint32_t subscriptionId,
525 uint32_t monitoredItemId,
529 subscriptionId, {&monitoredItemId, 1}, monitoringMode
541template <
typename CompletionToken>
544 uint32_t subscriptionId,
545 uint32_t monitoredItemId,
547 CompletionToken&& token
550 subscriptionId, {&monitoredItemId, 1}, monitoringMode
587template <
typename CompletionToken>
592 connection, request, std::forward<CompletionToken>(token)
614#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
620template <
typename CompletionToken>
631 std::forward<CompletionToken>(token)
647#if UAPP_HAS_ASYNC_SUBSCRIPTIONS
653template <
typename CompletionToken>
655 Client& connection, uint32_t subscriptionId, uint32_t monitoredItemId, CompletionToken&& token
658 subscriptionId, {&monitoredItemId, 1}
665 std::forward<CompletionToken>(token)
UA_CreateMonitoredItemsRequest wrapper class.
uint32_t getSubscriptionId() const noexcept
UA_CreateMonitoredItemsResponse wrapper class.
UA_DataValue wrapper class.
UA_DeleteMonitoredItemsRequest wrapper class.
UA_DeleteMonitoredItemsResponse wrapper class.
UA_ExtensionObject wrapper class.
UA_ModifyMonitoredItemsRequest wrapper class.
UA_CreateMonitoredItemsResponse wrapper class.
UA_MonitoredItemCreateResult wrapper class.
UA_MonitoredItemModifyResult wrapper class.
UA_ReadValueId wrapper class.
UA_SetMonitoringModeRequest wrapper class.
UA_SetMonitoringModeResponse wrapper class.
UA_SetTriggeringRequest wrapper class.
UA_SetTriggeringResponse wrapper class.
View to a contiguous sequence of objects, similar to std::span in C++20.
UA_StatusCode wrapper class.
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.
auto createMonitoredItemsEventAsync(Client &connection, const CreateMonitoredItemsRequest &request, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback, CompletionToken &&token)
Create and add monitored items to a subscription for event notifications.
MonitoredItemCreateResult createMonitoredItemDataChange(T &connection, uint32_t subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx ¶meters, DataChangeNotificationCallback dataChangeCallback, DeleteMonitoredItemCallback deleteCallback)
Create and add a monitored item to a subscription for data change notifications.
std::function< void(uint32_t subId, uint32_t monId)> DeleteMonitoredItemCallback
MonitoredItem deletion callback.
auto createMonitoredItemEventAsync(Client &connection, uint32_t subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx ¶meters, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback, CompletionToken &&token)
Create and add a monitored item to a subscription for event notifications.
std::function< void(uint32_t subId, uint32_t monId, const DataValue &value)> DataChangeNotificationCallback
Data change notification callback.
auto createMonitoredItemDataChangeAsync(Client &connection, uint32_t subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx ¶meters, 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.
MonitoredItemCreateResult createMonitoredItemEvent(Client &connection, uint32_t subscriptionId, const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, const MonitoringParametersEx ¶meters, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback={})
Create and add a monitored item to a subscription for event notifications.
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(uint32_t subId, uint32_t monId, Span< const Variant > eventFields)> EventNotificationCallback
Event notification callback.
StatusCode deleteMonitoredItem(T &connection, uint32_t subscriptionId, uint32_t monitoredItemId)
Delete a monitored item from a subscription.
auto deleteMonitoredItemAsync(Client &connection, uint32_t subscriptionId, uint32_t 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.
auto modifyMonitoredItemAsync(Client &connection, uint32_t subscriptionId, uint32_t monitoredItemId, const MonitoringParametersEx ¶meters, CompletionToken &&token)
auto modifyMonitoredItemsAsync(Client &connection, const ModifyMonitoredItemsRequest &request, CompletionToken &&token)
Modify monitored items of a subscription.
MonitoredItemModifyResult modifyMonitoredItem(Client &connection, uint32_t subscriptionId, uint32_t monitoredItemId, const MonitoringParametersEx ¶meters) noexcept
Modify a monitored item of a subscription.
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.
UA_Client * getHandle(Client &client) noexcept
UA_MonitoredItemModifyRequest createMonitoredItemModifyRequest(uint32_t monitoredItemId, MonitoringParameters ¶meters) noexcept
std::vector< std::unique_ptr< MonitoredItemContext > > createMonitoredItemContexts(Client &connection, const CreateMonitoredItemsRequest &request, DataChangeNotificationCallback dataChangeCallback, EventNotificationCallback eventCallback, DeleteMonitoredItemCallback deleteCallback)
UA_CreateMonitoredItemsRequest createCreateMonitoredItemsRequest(uint32_t subscriptionId, TimestampsToReturn timestampsToReturn, Span< const UA_MonitoredItemCreateRequest > itemsToCreate) noexcept
UA_MonitoredItemCreateRequest createMonitoredItemCreateRequest(const ReadValueId &itemToMonitor, MonitoringMode monitoringMode, MonitoringParameters ¶meters) noexcept
HookToken(HookFunction &&, CompletionToken &&) -> HookToken< HookFunction, CompletionToken >
void convertMonitoredItemContexts(Span< const std::unique_ptr< MonitoredItemContext > > contexts, Span< MonitoredItemContext * > contextsPtr, Span< UA_Client_DataChangeNotificationCallback > dataChangeCallbacksNative, Span< UA_Client_EventNotificationCallback > eventCallbacksNative, Span< UA_Client_DeleteMonitoredItemCallback > deleteCallbacksNative) noexcept
WrapperType wrapSingleResultWithStatus(Response &response) noexcept
StatusCode getSingleStatus(const Response &response) noexcept
UA_SetMonitoringModeRequest createSetMonitoringModeRequest(uint32_t subscriptionId, Span< const uint32_t > monitoredItemIds, MonitoringMode monitoringMode) noexcept
UA_DeleteMonitoredItemsRequest createDeleteMonitoredItemsRequest(uint32_t subscriptionId, Span< const uint32_t > monitoredItemIds) noexcept
auto sendRequestAsync(Client &client, const Request &request, CompletionToken &&token)
Async client service requests.
UA_ModifyMonitoredItemsRequest createModifyMonitoredItemsRequest(uint32_t subscriptionId, MonitoringParameters ¶meters, UA_MonitoredItemModifyRequest &item) noexcept
void storeMonitoredItemContexts(Client &connection, uint32_t subscriptionId, const CreateMonitoredItemsResponse &response, Span< std::unique_ptr< MonitoredItemContext > > contexts)
OPC UA services as free functions.
constexpr void throwIfBad(UA_StatusCode code)
Check the status code and throw a BadStatus exception if the status code is bad.
TimestampsToReturn
Timestamps to return.
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
MonitoringMode
Monitoring mode.
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.
static auto initiate(Client &client, Initiation &&initiation, CompletionToken &&token)
Initiate open62541 async client operation with user-defined completion token.