Struct opcua_server::subscriptions::subscription::Subscription
source · pub struct Subscription {
pub subscription_id: u32,
pub publishing_interval: Duration,
pub max_lifetime_count: u32,
pub max_keep_alive_count: u32,
pub priority: u8,
pub monitored_items: HashMap<u32, MonitoredItem>,
pub state: SubscriptionState,
pub current_lifetime_count: u32,
pub current_keep_alive_count: u32,
pub message_sent: bool,
pub publishing_enabled: bool,
pub diagnostics_on_drop: bool,
/* private fields */
}Fields§
§subscription_id: u32Subscription id
publishing_interval: DurationPublishing interval in milliseconds
max_lifetime_count: u32The lifetime count reset value
max_keep_alive_count: u32Keep alive count reset value
priority: u8Relative priority of the subscription. When more than one subscriptio needs to send notifications the highest priority subscription should be sent first.
monitored_items: HashMap<u32, MonitoredItem>Map of monitored items
state: SubscriptionStateState of the subscription
current_lifetime_count: u32A value that contains the number of consecutive publishing timer expirations without Client activity before the Subscription is terminated.
current_keep_alive_count: u32Keep alive counter decrements when there are no notifications to publish and when it expires requests to send an empty notification as a keep alive event
message_sent: boolboolean value that is set to true to mean that either a NotificationMessage or a keep-alive Message has been sent on the Subscription. It is a flag that is used to ensure that either a NotificationMessage or a keep-alive Message is sent out the first time the publishing timer expires.
publishing_enabled: boolThe parameter that requests publishing to be enabled or disabled.
diagnostics_on_drop: boolStops the subscription calling diagnostics on drop
Implementations§
source§impl Subscription
impl Subscription
pub fn new(
diagnostics: Arc<RwLock<ServerDiagnostics>>,
subscription_id: u32,
publishing_enabled: bool,
publishing_interval: Duration,
lifetime_count: u32,
keep_alive_count: u32,
priority: u8
) -> Subscription
sourcepub fn create_monitored_items(
&mut self,
timestamps_to_return: TimestampsToReturn,
items_to_create: &[MonitoredItemCreateRequest]
) -> Vec<MonitoredItemCreateResult> ⓘ
pub fn create_monitored_items(
&mut self,
timestamps_to_return: TimestampsToReturn,
items_to_create: &[MonitoredItemCreateRequest]
) -> Vec<MonitoredItemCreateResult> ⓘ
Creates monitored items on the specified subscription, returning the creation results
sourcepub fn modify_monitored_items(
&mut self,
timestamps_to_return: TimestampsToReturn,
items_to_modify: &[MonitoredItemModifyRequest]
) -> Vec<MonitoredItemModifyResult> ⓘ
pub fn modify_monitored_items(
&mut self,
timestamps_to_return: TimestampsToReturn,
items_to_modify: &[MonitoredItemModifyRequest]
) -> Vec<MonitoredItemModifyResult> ⓘ
Modify the specified monitored items, returning a result for each
sourcepub fn delete_monitored_items(
&mut self,
items_to_delete: &[u32]
) -> Vec<StatusCode> ⓘ
pub fn delete_monitored_items(
&mut self,
items_to_delete: &[u32]
) -> Vec<StatusCode> ⓘ
Delete the specified monitored items (by item id), returning a status code for each
pub fn get_handles(&self) -> (Vec<u32>, Vec<u32>)
sourcepub fn set_resend_data(&mut self)
pub fn set_resend_data(&mut self)
Sets the resend data flag which means the next publish request will receive the latest value of every monitored item whether it has changed in this cycle or not.
sourcepub fn tick(
&mut self,
address_space: &AddressSpace,
tick_reason: TickReason,
publishing_req_queued: bool,
now: &DateTime<Utc>
) -> Option<NotificationMessage>
pub fn tick(
&mut self,
address_space: &AddressSpace,
tick_reason: TickReason,
publishing_req_queued: bool,
now: &DateTime<Utc>
) -> Option<NotificationMessage>
Checks the subscription and monitored items for state change, messages. If the tick does nothing, the function returns None. Otherwise it returns one or more messages in an Vec.
pub fn update_state(
&mut self,
tick_reason: TickReason,
p: SubscriptionStateParams
) -> UpdateStateResult
sourcepub fn reset_keep_alive_counter(&mut self)
pub fn reset_keep_alive_counter(&mut self)
Reset the keep-alive counter to the maximum keep-alive count of the Subscription. The maximum keep-alive count is set by the Client when the Subscription is created and may be modified using the ModifySubscription Service
sourcepub fn reset_lifetime_counter(&mut self)
pub fn reset_lifetime_counter(&mut self)
Reset the lifetime counter to the value specified for the life time of the subscription in the create subscription service
sourcepub fn start_publishing_timer(&mut self)
pub fn start_publishing_timer(&mut self)
Start or restart the publishing timer and decrement the LifetimeCounter Variable.
Trait Implementations§
source§impl Clone for Subscription
impl Clone for Subscription
source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more