Veethree D7 SDK
Loading...
Searching...
No Matches
vsdk::io::event_notification Class Referenceabstract

Detailed Description

The event_notification class.

#include <io_event_notification.h>

Public Member Functions

virtual event_notification_id add_notification (const event_notification_descriptor &desc)
 Add a definition when an event must be notified.
virtual bool remove_notification (event_notification_id id)
 Remove a notification identified by 'id'.
virtual void remove_all_notifications ()
 Remove all notifications.
virtual void start_notifications ()
 Start the event notifications.
virtual void stop_notifications ()
 Stop the event notifications.
 event_notification ()
 Class constructors.
 event_notification (const event_notification &other)=delete
 Class constructors.
 event_notification (event_notification &&other) noexcept
 Class constructors.
event_notification & operator= (const event_notification &other)=delete
 Assignment operators.
event_notification & operator= (event_notification &&other) noexcept
 Assignment operators.

Protected Member Functions

virtual bool process_notification (const event_notification_descriptor &desc) const noexcept=0
 Notification processing interface.

Detailed Description

The event_notification class.

Member Function Documentation

◆ add_notification()

virtual event_notification_id vsdk::io::event_notification::add_notification ( const event_notification_descriptor & desc)
virtual

Add a definition when an event must be notified.

Also see vsdk::io::event_notification::process_notification for more details.

Parameters
descAn event_notification_descriptor object. event_notification_descriptor.
Returns
A event_notification_id value used to identify a notification.

Sample code:

#include <libio/i420.h>
using namespace vsdk::io;
void fn()
{
auto evt_queue = std::make_shared<event_queue>();
auto i420 = i420::instance();
auto const n2 = i420->add_notification({
.queue = evt_queue,
.source = event_source::i420_isns,
.interval = 100ms, },
.value = 1050.0,
});
auto const n3 = i420->add_notification({
.queue = evt_queue,
.source = event_source::i420_isns,
.interval = 50ms, },
.value = range_value(1000.0, 1030.0),
});
i420->start_notifications();
// configure queue handlers, see event_queue::add_handler interface
// ...
// no longer interested in notifications
i420->stop_notifications();
}
virtual event_notification_id add_notification(const event_notification_descriptor &desc)
Add a definition when an event must be notified.
The i420 class.
Definition i420.h:32
@ in_range
any value inside of [start, end) - including start, excluding end.
Definition io_event_common.h:46
@ threshold_above
any value greater than the threshold specified.
Definition io_event_common.h:43
@ continuous
continuous means a notification will be rescheduled
Definition io_event_notification.h:34
i420 interface
IO event queue interface.
IO range event interface.
IO threshold event interface.
Any entities that belong to the IO library.
@ i420
4-20 mA
Definition io_error_codes.h:25
A range value start-end pair.
Definition io_event_common.h:54

◆ process_notification()

virtual bool vsdk::io::event_notification::process_notification ( const event_notification_descriptor & desc) const
protectedpure virtualnoexcept

Notification processing interface.

When a notification is a vsdk::io::event_notification_frequency::single_shot, once that notification is generated it is automatically removed, so attempting to use its vsdk::io::event_notification_id in the remove_notification function will result in a false return value.

Parameters
descA notification description, see vsdk::io::event_notification_descriptor.
Returns
It returns true when the notification has been handled, otherwise false.

Implemented in vsdk::io::analog::analog, vsdk::io::digital_in_channel, vsdk::io::i420, and vsdk::io::pwm_in_channel.

◆ remove_notification()

virtual bool vsdk::io::event_notification::remove_notification ( event_notification_id id)
virtual

Remove a notification identified by 'id'.

Parameters
idA vsdk::io::event_notification_id value.
Returns
Returns true if a notification has been removed, otherwise false.

The documentation for this class was generated from the following file: