Veethree D7 SDK
Loading...
Searching...
No Matches

Detailed Description

Event-based notification system for asynchronous I/O operations.

The Events module provides a notification system that enables asynchronous monitoring of I/O state changes without requiring continuous polling. It allows applications to:

Key classes:

Usage pattern:

  1. Create an event queue using std::make_shared<vsdk::io::event_queue>()
  2. Define event handlers to process different event types
  3. Register handlers with the event queue using vsdk::io::event_queue::add_handler()
  4. Add notifications using vsdk::io::event_notification::add_notification with the appropriate vsdk::io::event_notification_descriptor :
  5. For your I/O defined channel, start notifications with start_notifications method in vsdk::io::event_notification
  6. Process events in your application's event loop
  7. Stop notifications with stop_notifications method in vsdk::io::event_notification when finished

The event system is integrated throughout the I/O library components, with both digital, 4-20mA and analog channels supporting event-based operations.

See Events Examples for usage examples of the events system with an analog pin.

Classes

class  vsdk::io::event
 The event class interface. More...
struct  vsdk::io::range_value
 A range value start-end pair. More...
class  vsdk::io::event_data
 The event_data class. More...
struct  vsdk::io::event_notification_schedule
 The event_notification_schedule class. More...
struct  vsdk::io::event_notification_descriptor
 The event_notification_descriptor class. More...
class  vsdk::io::event_notification
 The event_notification class. More...
class  vsdk::io::event_queue
 The event_queue class. More...
class  vsdk::io::event_source
 Describes the source of an event. More...
class  vsdk::io::range_event
 The range_event class. More...
class  vsdk::io::range_event_data
 The range_event_data class. More...
class  vsdk::io::state_event
 The state_event class. More...
class  vsdk::io::state_event_data
 The state_event_data class. More...
class  vsdk::io::threshold_event
 The threshold_event class. More...
class  vsdk::io::threshold_event_data
 The threshold_event_data class. More...

Typedefs

using vsdk::io::event_notification_id = uint32_t
 Identifies a specific notification entry.
using vsdk::io::event_handler = std::function<void(std::shared_ptr<event>)>
 Event handler function definition.
using vsdk::io::event_handler_id = uint32_t
 Event handler Id.

Enumerations

enum class  vsdk::io::event_type : uint8_t {
  vsdk::io::event_type::none , vsdk::io::event_type::threshold_above , vsdk::io::event_type::threshold_below , vsdk::io::event_type::out_of_range ,
  vsdk::io::event_type::in_range , vsdk::io::event_type::state_change , vsdk::io::event_type::target_state
}
 Describes the event type. More...
enum class  vsdk::io::event_notification_frequency : uint8_t { vsdk::io::event_notification_frequency::continuous , vsdk::io::event_notification_frequency::single_shot }
 Specifies the type of notifications. More...

Detailed Description

Event-based notification system for asynchronous I/O operations.

The Events module provides a notification system that enables asynchronous monitoring of I/O state changes without requiring continuous polling. It allows applications to:

Key classes:

Usage pattern:

  1. Create an event queue using std::make_shared<vsdk::io::event_queue>()
  2. Define event handlers to process different event types
  3. Register handlers with the event queue using vsdk::io::event_queue::add_handler()
  4. Add notifications using vsdk::io::event_notification::add_notification with the appropriate vsdk::io::event_notification_descriptor :
  5. For your I/O defined channel, start notifications with start_notifications method in vsdk::io::event_notification
  6. Process events in your application's event loop
  7. Stop notifications with stop_notifications method in vsdk::io::event_notification when finished

The event system is integrated throughout the I/O library components, with both digital, 4-20mA and analog channels supporting event-based operations.

See Events Examples for usage examples of the events system with an analog pin.

Typedef Documentation

◆ event_handler

using vsdk::io::event_handler = std::function<void(std::shared_ptr<event>)>

Event handler function definition.

The base type is std::function, so all the flexibility that std::function offers can be used as the handler implementation.

◆ event_handler_id

using vsdk::io::event_handler_id = uint32_t

Event handler Id.

Used to identify a specific event handler, used to remove the handler if required.

Enumeration Type Documentation

◆ event_notification_frequency

enum class vsdk::io::event_notification_frequency : uint8_t
strong

Specifies the type of notifications.

Enumerator
continuous 

continuous means a notification will be rescheduled

single_shot 

single_shot means a notification is generated once

◆ event_type

enum class vsdk::io::event_type : uint8_t
strong

Describes the event type.

Threshold events examples:
threshold_above, threshold 10.0 - value > threshold will trigger the event.
threshold_below, threshold 10.0 - value < threshold will trigger the event.
threshold_below, threshold 10.0 - value = threshold will NOT trigger the event.
Range events examples: out_of_range, start 5.0, end 10.0 - value < start or value > end will trigger the event. out_of_range, start 5.0, end 10.0 - value = start or value = end will NOT trigger the event. in_range, start 5.0, end 10.0 - value = start will trigger the event. in_range, start 5.0, end 10.0 - value = end will NOT trigger the event. in_range, start 5.0, end 10.0 - value >= start and value < end will trigger the event. in_range, start 5.0, end 10.0 - value < start or value >= end will NOT trigger the event.

You can use in_range to form bands of values as the end of the range is excluded. Example: in_range start 5.0 end 10.0, in_range start 10.0 end 15.0, etc.

State events examples: An input changed from inactive to active high.

Enumerator
none 

indicates event_type default value.

threshold_above 

any value greater than the threshold specified.

threshold_below 

any value less than the threshold specified.

out_of_range 

any value outside of (start, end) - excluding start and end.

in_range 

any value inside of [start, end) - including start, excluding end.

state_change 

indicates a digital input value has changed state.

target_state 

indicates a digital input value has changed to a specific state.