9#include "open62541pp/config.hpp"
15#ifdef UA_ENABLE_SUBSCRIPTIONS
42template <
typename Connection>
49 subscriptionId_(std::is_same_v<Connection, Server> ? 0U :
subscriptionId) {}
63 return subscriptionId_;
76 response.getResponseHeader().getServiceResult().throwIfBad();
100 std::move(onDataChange),
158 Connection* connection_;
159 uint32_t subscriptionId_{0U};
166 return (lhs.connection() == rhs.connection()) && (lhs.subscriptionId() == rhs.subscriptionId());
171 return !(lhs == rhs);
UA_EventFilter wrapper class.
static ExtensionObject fromDecodedCopy(const T &data)
Create an ExtensionObject from a decoded object (copy).
const StatusCode & getStatusCode() const noexcept
High-level monitored item class.
constexpr void throwIfBad() const
Throw a BadStatus exception if the status code is bad.
High-level subscription class.
void deleteSubscription()
Delete this subscription.
MonitoredItem< Connection > subscribeDataChange(const NodeId &id, AttributeId attribute, MonitoringMode monitoringMode, const MonitoringParametersEx ¶meters, DataChangeNotificationCallback onDataChange)
Create a monitored item for data change notifications.
uint32_t subscriptionId() const noexcept
Get the server-assigned identifier of this subscription.
const Connection & connection() const noexcept
Get the server/client instance.
void setSubscriptionParameters(const SubscriptionParameters ¶meters)
Modify this subscription.
Connection & connection() noexcept
Get the server/client instance.
MonitoredItem< Connection > subscribeDataChange(const NodeId &id, AttributeId attribute, DataChangeNotificationCallback onDataChange)
Create a monitored item for data change notifications (default settings).
MonitoredItem< Connection > subscribeEvent(const NodeId &id, const EventFilter &eventFilter, EventNotificationCallback onEvent)
Create a monitored item for event notifications (default settings).
void setPublishingMode(bool publishing)
Enable/disable publishing of notification messages.
Subscription(Connection &connection, uint32_t subscriptionId) noexcept
Wrap an existing subscription.
MonitoredItem< Connection > subscribeEvent(const NodeId &id, MonitoringMode monitoringMode, const MonitoringParametersEx ¶meters, EventNotificationCallback onEvent)
Create a monitored item for event notifications.
std::vector< MonitoredItem< Connection > > getMonitoredItems()
Get all local monitored items.
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, const DataValue &value)> DataChangeNotificationCallback
Data change notification callback.
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.
std::function< void(uint32_t subId, uint32_t monId, Span< const Variant > eventFields)> EventNotificationCallback
Event notification callback.
StatusCode deleteSubscription(Client &connection, uint32_t subscriptionId) noexcept
Delete a single subscription.
ModifySubscriptionResponse modifySubscription(Client &connection, const ModifySubscriptionRequest &request) noexcept
Modify a subscription.
SetPublishingModeResponse setPublishingMode(Client &connection, const SetPublishingModeRequest &request) noexcept
Enable/disable publishing of notification messages of subscriptions.
MonitoringMode
Monitoring mode.
services::EventNotificationCallback EventNotificationCallback
services::DataChangeNotificationCallback DataChangeNotificationCallback
bool operator!=(const Client &lhs, const Client &rhs) noexcept
AttributeId
Attribute identifiers.
@ EventNotifier
Indicates if the node can be used to subscribe to events or the read/write historic events.
bool operator==(const Client &lhs, const Client &rhs) noexcept
Extended monitoring parameters with default values from open62541.
ExtensionObject filter
Filter is used by the server to determine if the MonitoredItem should generate notifications.
Subscription parameters with default values from open62541.