bacnet_types/constructed/action.rs
1//! The elements of a Command object's Action array (Clause 12.10.8):
2//! `BACnetActionList` and the `BACnetActionCommand` writes it holds
3//! (Clause 21).
4
5#[cfg(not(feature = "std"))]
6use alloc::vec::Vec;
7
8use crate::enums::PropertyIdentifier;
9use crate::primitives::{ObjectIdentifier, PropertyValue};
10
11/// One write a Command object makes when it runs an action list
12/// (`BACnetActionCommand`, Clause 21).
13///
14/// On the wire every member is context tagged, numbered `[0]` to `[8]` in
15/// field order. The device, array index, priority and post delay are
16/// optional; the value sits inside an opening/closing tag pair `[4]`. The
17/// codec is `bacnet_encoding::constructed::{encode_action_command,
18/// decode_action_command}`.
19#[derive(Debug, Clone, PartialEq)]
20pub struct BACnetActionCommand {
21 /// The device holding the target object; `None` for this device.
22 pub device_identifier: Option<ObjectIdentifier>,
23 /// The object written.
24 pub object_identifier: ObjectIdentifier,
25 /// The property written.
26 pub property_identifier: PropertyIdentifier,
27 /// The element written, for an array property; `None` writes it whole.
28 pub property_array_index: Option<u32>,
29 /// The value written.
30 pub property_value: PropertyValue,
31 /// The command priority, 1 to 16, for a commandable property.
32 pub priority: Option<u8>,
33 /// How long to wait after this write before the next one.
34 pub post_delay: Option<u32>,
35 /// Whether a failed write stops the rest of the list.
36 pub quit_on_failure: bool,
37 /// Whether the last attempt at this write succeeded.
38 pub write_successful: bool,
39}
40
41/// One element of a Command object's Action array: the writes taken, in
42/// order, when Present_Value selects it (`BACnetActionList`, Clause 21).
43///
44/// On the wire the commands go back to back inside an opening/closing tag
45/// pair `[0]`, so an empty list is that pair alone. The codec is
46/// `bacnet_encoding::constructed::{encode_action_list, decode_action_list}`.
47#[derive(Debug, Clone, Default, PartialEq)]
48pub struct BACnetActionList {
49 /// The writes, in the order they're made.
50 pub commands: Vec<BACnetActionCommand>,
51}