#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
use super::{
BACnetDeviceObjectPropertyReference, BACnetDeviceObjectReference, BACnetPropertyStates,
BACnetPropertyValue,
};
use crate::enums::{
AccessEvent, EventState, EventType, LifeSafetyMode, LifeSafetyOperation, LifeSafetyState,
NotifyType, Reliability, TimerState, TimerTransition,
};
use crate::primitives::{BACnetTimeStamp, Date, ObjectIdentifier, StatusFlags, Time};
#[derive(Debug, Clone, PartialEq)]
pub struct EventNotificationRequest {
pub process_identifier: u32,
pub initiating_device_identifier: ObjectIdentifier,
pub event_object_identifier: ObjectIdentifier,
pub timestamp: BACnetTimeStamp,
pub notification_class: u32,
pub priority: u8,
pub event_type: EventType,
pub message_text: Option<String>,
pub notify_type: NotifyType,
pub ack_required: bool,
pub from_state: EventState,
pub to_state: EventState,
pub event_values: Option<NotificationParameters>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum NotificationParameters {
ChangeOfBitstring {
referenced_bitstring: (u8, Vec<u8>),
status_flags: StatusFlags,
},
ChangeOfState {
new_state: BACnetPropertyStates,
status_flags: StatusFlags,
},
ChangeOfValue {
new_value: ChangeOfValueChoice,
status_flags: StatusFlags,
},
CommandFailure {
command_value: Vec<u8>,
status_flags: StatusFlags,
feedback_value: Vec<u8>,
},
FloatingLimit {
reference_value: f32,
status_flags: StatusFlags,
setpoint_value: f32,
error_limit: f32,
},
OutOfRange {
exceeding_value: f32,
status_flags: StatusFlags,
deadband: f32,
exceeded_limit: f32,
},
ComplexEventType {
property_values: Vec<BACnetPropertyValue>,
},
ChangeOfLifeSafety {
new_state: LifeSafetyState,
new_mode: LifeSafetyMode,
status_flags: StatusFlags,
operation_expected: LifeSafetyOperation,
},
Extended {
vendor_id: u16,
extended_event_type: u32,
parameters: Vec<u8>,
},
BufferReady {
buffer_property: BACnetDeviceObjectPropertyReference,
previous_notification: u32,
current_notification: u32,
},
UnsignedRange {
exceeding_value: u64,
status_flags: StatusFlags,
exceeded_limit: u64,
},
AccessEvent {
access_event: AccessEvent,
status_flags: StatusFlags,
access_event_tag: u32,
access_event_time: (Date, Time),
access_credential: BACnetDeviceObjectReference,
authentication_factor: Option<Vec<u8>>,
},
DoubleOutOfRange {
exceeding_value: f64,
status_flags: StatusFlags,
deadband: f64,
exceeded_limit: f64,
},
SignedOutOfRange {
exceeding_value: i32,
status_flags: StatusFlags,
deadband: u64,
exceeded_limit: i32,
},
UnsignedOutOfRange {
exceeding_value: u64,
status_flags: StatusFlags,
deadband: u64,
exceeded_limit: u64,
},
ChangeOfCharacterstring {
changed_value: String,
status_flags: StatusFlags,
alarm_value: String,
},
ChangeOfStatusFlags {
present_value: Option<Vec<u8>>,
referenced_flags: StatusFlags,
},
ChangeOfReliability {
reliability: Reliability,
status_flags: StatusFlags,
property_values: Vec<u8>,
},
ChangeOfDiscreteValue {
new_value: Vec<u8>,
status_flags: StatusFlags,
},
ChangeOfTimer {
new_state: TimerState,
status_flags: StatusFlags,
update_time: (Date, Time),
last_state_change: Option<TimerTransition>,
initial_timeout: Option<u32>,
expiration_time: Option<(Date, Time)>,
},
}
#[derive(Debug, Clone, PartialEq)]
pub enum ChangeOfValueChoice {
ChangedBits {
unused_bits: u8,
data: Vec<u8>,
},
ChangedValue(f32),
}