bacnet_types/constructed/lift.rs
1//! Constructed values used by the Elevator Group (Clause 12.58) and Lift
2//! (Clause 12.59) objects.
3
4#[cfg(not(feature = "std"))]
5use alloc::{string::String, vec::Vec};
6
7use crate::enums::{DoorStatus, LiftCarDirection};
8
9/// The `command` CHOICE of a [`BACnetLandingCallStatus`] (Clause 21).
10///
11/// A landing call asks either for a direction of travel or for a destination
12/// floor. The CHOICE is untagged inside the SEQUENCE, so each alternative's
13/// own context tag appears directly on the wire.
14#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
15pub enum LandingCallCommand {
16 /// Context tag 1: the direction the caller wants to travel.
17 ///
18 /// Decoding keeps any value, including reserved and proprietary ones;
19 /// whoever accepts a write decides which values are in range.
20 Direction(LiftCarDirection),
21 /// Context tag 2: the destination floor the caller selected (Unsigned8).
22 Destination(u8),
23}
24
25/// `BACnetLandingCallStatus` (Clause 21): one call placed at a landing.
26///
27/// The Elevator Group object serves this as Landing_Call_Control and as each
28/// element of its Landing_Calls list (Clause 12.58, Table 12-76). The
29/// `bacnet-encoding` crate owns the wire codec.
30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
31pub struct BACnetLandingCallStatus {
32 /// Context tag 0: the floor where the call was placed (Unsigned8).
33 pub floor_number: u8,
34 /// Context tags 1 and 2: the requested direction or destination floor.
35 pub command: LandingCallCommand,
36 /// Context tag 3, optional: a label for the floor.
37 pub floor_text: Option<String>,
38}
39
40/// One landing door in a [`BACnetLandingDoorStatus`]: the floor it serves
41/// and its current status.
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
43pub struct LandingDoor {
44 /// Context tag 0: the universal floor number of the landing (Unsigned8).
45 pub floor_number: u8,
46 /// Context tag 1: the landing door's status.
47 ///
48 /// Decoding keeps any value, including reserved and proprietary ones;
49 /// whoever stores the value decides which ones are in range.
50 pub door_status: DoorStatus,
51}
52
53/// `BACnetLandingDoorStatus` (Clause 21): the landing doors that pair with one
54/// car door, floor by floor.
55///
56/// The Lift object serves an array of these as Landing_Door_Status, one
57/// element per car door (Clause 12.59, Table 12-77). The `bacnet-encoding`
58/// crate owns the wire codec.
59#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
60pub struct BACnetLandingDoorStatus {
61 /// Context tag 0: the landing doors, in the order they are encoded.
62 pub landing_doors: Vec<LandingDoor>,
63}
64
65/// One landing call in a [`BACnetAssignedLandingCalls`]: the floor it was
66/// placed at and the direction it asks for.
67#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
68pub struct AssignedLandingCall {
69 /// Context tag 0: the landing's floor, by universal floor number
70 /// (Unsigned8).
71 pub floor_number: u8,
72 /// Context tag 1: the direction of travel the call asks for.
73 ///
74 /// Decoding keeps any value, including reserved and proprietary ones;
75 /// whoever stores the value decides which ones are in range.
76 pub direction: LiftCarDirection,
77}
78
79/// `BACnetAssignedLandingCalls` (Clause 21): the landing calls assigned to
80/// one car door.
81///
82/// The Lift object serves an array of these as Assigned_Landing_Calls, one
83/// element per car door (Clause 12.59, Table 12-77). The `bacnet-encoding`
84/// crate owns the wire codec.
85#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
86pub struct BACnetAssignedLandingCalls {
87 /// Context tag 0: the landing calls, in the order they are encoded.
88 pub landing_calls: Vec<AssignedLandingCall>,
89}
90
91/// `BACnetLiftCarCallList` (Clause 21): the floors with a car call registered
92/// for one car door.
93///
94/// The Lift object serves an array of these as Registered_Car_Call, one
95/// element per car door (Clause 12.59, Table 12-77). The `bacnet-encoding`
96/// crate owns the wire codec.
97#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
98pub struct BACnetLiftCarCallList {
99 /// Context tag 0: the universal floor numbers (each an Unsigned8), in the
100 /// order they are encoded.
101 pub floor_numbers: Vec<u8>,
102}