Skip to main content

bacnet_types/
enums.rs

1//! BACnet enumeration types per ASHRAE 135-2020.
2//!
3//! Uses newtype wrappers (e.g. `ObjectType(u32)`) with associated constants
4//! rather than Rust enums so that vendor-proprietary values pass through
5//! without panicking. Every type provides `from_raw` / `to_raw` for
6//! wire-level conversion and a human-readable `Display` impl.
7
8#[cfg(not(feature = "std"))]
9use alloc::format;
10
11// ---------------------------------------------------------------------------
12// Macro to reduce boilerplate for newtype enum wrappers
13// ---------------------------------------------------------------------------
14
15/// Generates a newtype wrapper struct with associated constants, `from_raw`,
16/// `to_raw`, `Display`, and optional `Debug` that shows the symbolic name.
17macro_rules! bacnet_enum {
18    (
19        $(#[$meta:meta])*
20        $vis:vis struct $Name:ident($inner:ty);
21        $(
22            $(#[$vmeta:meta])*
23            const $VARIANT:ident = $val:expr;
24        )*
25    ) => {
26        $(#[$meta])*
27        #[derive(Clone, Copy, PartialEq, Eq, Hash)]
28        $vis struct $Name($inner);
29
30        impl $Name {
31            $(
32                $(#[$vmeta])*
33                pub const $VARIANT: Self = Self($val);
34            )*
35
36            /// Create from a raw wire value.
37            #[inline]
38            pub const fn from_raw(value: $inner) -> Self {
39                Self(value)
40            }
41
42            /// Return the raw wire value.
43            #[inline]
44            pub const fn to_raw(self) -> $inner {
45                self.0
46            }
47
48            /// All named constants as (name, value) pairs.
49            pub const ALL_NAMED: &[(&str, Self)] = &[
50                $( (stringify!($VARIANT), Self($val)), )*
51            ];
52        }
53
54        impl core::fmt::Debug for $Name {
55            fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
56                match self.0 {
57                    $( $val => f.write_str(concat!(stringify!($Name), "::", stringify!($VARIANT))), )*
58                    other => write!(f, "{}({})", stringify!($Name), other),
59                }
60            }
61        }
62
63        impl core::fmt::Display for $Name {
64            fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
65                match self.0 {
66                    $( $val => f.write_str(stringify!($VARIANT)), )*
67                    other => write!(f, "{}", other),
68                }
69            }
70        }
71    };
72}
73
74// ===========================================================================
75// ObjectType (Clause 12)
76// ===========================================================================
77
78bacnet_enum! {
79    /// BACnet object types (Clause 12).
80    ///
81    /// Standard types are 0-63; vendor-proprietary types are 128-1023.
82    /// The 10-bit type field allows values 0-1023.
83    pub struct ObjectType(u32);
84
85    const ANALOG_INPUT = 0;
86    const ANALOG_OUTPUT = 1;
87    const ANALOG_VALUE = 2;
88    const BINARY_INPUT = 3;
89    const BINARY_OUTPUT = 4;
90    const BINARY_VALUE = 5;
91    const CALENDAR = 6;
92    const COMMAND = 7;
93    const DEVICE = 8;
94    const EVENT_ENROLLMENT = 9;
95    const FILE = 10;
96    const GROUP = 11;
97    const LOOP = 12;
98    const MULTI_STATE_INPUT = 13;
99    const MULTI_STATE_OUTPUT = 14;
100    const NOTIFICATION_CLASS = 15;
101    const PROGRAM = 16;
102    const SCHEDULE = 17;
103    const AVERAGING = 18;
104    const MULTI_STATE_VALUE = 19;
105    const TREND_LOG = 20;
106    const LIFE_SAFETY_POINT = 21;
107    const LIFE_SAFETY_ZONE = 22;
108    const ACCUMULATOR = 23;
109    const PULSE_CONVERTER = 24;
110    const EVENT_LOG = 25;
111    const GLOBAL_GROUP = 26;
112    const TREND_LOG_MULTIPLE = 27;
113    const LOAD_CONTROL = 28;
114    const STRUCTURED_VIEW = 29;
115    const ACCESS_DOOR = 30;
116    const TIMER = 31;
117    const ACCESS_CREDENTIAL = 32;
118    const ACCESS_POINT = 33;
119    const ACCESS_RIGHTS = 34;
120    const ACCESS_USER = 35;
121    const ACCESS_ZONE = 36;
122    const CREDENTIAL_DATA_INPUT = 37;
123    /// Deprecated in 135-2020 (Clause 24 deleted).
124    const NETWORK_SECURITY = 38;
125    const BITSTRING_VALUE = 39;
126    const CHARACTERSTRING_VALUE = 40;
127    const DATEPATTERN_VALUE = 41;
128    const DATE_VALUE = 42;
129    const DATETIMEPATTERN_VALUE = 43;
130    const DATETIME_VALUE = 44;
131    const INTEGER_VALUE = 45;
132    const LARGE_ANALOG_VALUE = 46;
133    const OCTETSTRING_VALUE = 47;
134    const POSITIVE_INTEGER_VALUE = 48;
135    const TIMEPATTERN_VALUE = 49;
136    const TIME_VALUE = 50;
137    const NOTIFICATION_FORWARDER = 51;
138    const ALERT_ENROLLMENT = 52;
139    const CHANNEL = 53;
140    const LIGHTING_OUTPUT = 54;
141    const BINARY_LIGHTING_OUTPUT = 55;
142    const NETWORK_PORT = 56;
143    const ELEVATOR_GROUP = 57;
144    const ESCALATOR = 58;
145    const LIFT = 59;
146    /// New in 135-2020.
147    const STAGING = 60;
148    /// New in 135-2020.
149    const AUDIT_REPORTER = 61;
150    /// New in 135-2020.
151    const AUDIT_LOG = 62;
152    /// New in 135-2020.
153    const COLOR = 63;
154    /// New in 135-2020.
155    const COLOR_TEMPERATURE = 64;
156}
157
158// ===========================================================================
159// PropertyIdentifier (Clause 21)
160// ===========================================================================
161
162bacnet_enum! {
163    /// BACnet property identifiers (Clause 21).
164    ///
165    /// Standard properties are 0-511; vendor-proprietary IDs are 512+.
166    /// The 22-bit property field allows values 0-4,194,303.
167    pub struct PropertyIdentifier(u32);
168
169    // 0-50
170    const ACKED_TRANSITIONS = 0;
171    const ACK_REQUIRED = 1;
172    const ACTION = 2;
173    const ACTION_TEXT = 3;
174    const ACTIVE_TEXT = 4;
175    const ACTIVE_VT_SESSIONS = 5;
176    const ALARM_VALUE = 6;
177    const ALARM_VALUES = 7;
178    const ALL = 8;
179    const ALL_WRITES_SUCCESSFUL = 9;
180    const APDU_SEGMENT_TIMEOUT = 10;
181    const APDU_TIMEOUT = 11;
182    const APPLICATION_SOFTWARE_VERSION = 12;
183    const ARCHIVE = 13;
184    const BIAS = 14;
185    const CHANGE_OF_STATE_COUNT = 15;
186    const CHANGE_OF_STATE_TIME = 16;
187    const NOTIFICATION_CLASS = 17;
188    // 18: deleted
189    const CONTROLLED_VARIABLE_REFERENCE = 19;
190    const CONTROLLED_VARIABLE_UNITS = 20;
191    const CONTROLLED_VARIABLE_VALUE = 21;
192    const COV_INCREMENT = 22;
193    const DATE_LIST = 23;
194    const DAYLIGHT_SAVINGS_STATUS = 24;
195    const DEADBAND = 25;
196    const DERIVATIVE_CONSTANT = 26;
197    const DERIVATIVE_CONSTANT_UNITS = 27;
198    const DESCRIPTION = 28;
199    const DESCRIPTION_OF_HALT = 29;
200    const DEVICE_ADDRESS_BINDING = 30;
201    const DEVICE_TYPE = 31;
202    const EFFECTIVE_PERIOD = 32;
203    const ELAPSED_ACTIVE_TIME = 33;
204    const ERROR_LIMIT = 34;
205    const EVENT_ENABLE = 35;
206    const EVENT_STATE = 36;
207    const EVENT_TYPE = 37;
208    const EXCEPTION_SCHEDULE = 38;
209    const FAULT_VALUES = 39;
210    const FEEDBACK_VALUE = 40;
211    const FILE_ACCESS_METHOD = 41;
212    const FILE_SIZE = 42;
213    const FILE_TYPE = 43;
214    const FIRMWARE_REVISION = 44;
215    const HIGH_LIMIT = 45;
216    const INACTIVE_TEXT = 46;
217    const IN_PROCESS = 47;
218    const INSTANCE_OF = 48;
219    const INTEGRAL_CONSTANT = 49;
220    const INTEGRAL_CONSTANT_UNITS = 50;
221
222    // 51-100
223    const ISSUE_CONFIRMED_NOTIFICATIONS = 51;
224    const LIMIT_ENABLE = 52;
225    const LIST_OF_GROUP_MEMBERS = 53;
226    const LIST_OF_OBJECT_PROPERTY_REFERENCES = 54;
227    // 55: deleted
228    const LOCAL_DATE = 56;
229    const LOCAL_TIME = 57;
230    const LOCATION = 58;
231    const LOW_LIMIT = 59;
232    const MANIPULATED_VARIABLE_REFERENCE = 60;
233    const MAXIMUM_OUTPUT = 61;
234    const MAX_APDU_LENGTH_ACCEPTED = 62;
235    const MAX_INFO_FRAMES = 63;
236    const MAX_MASTER = 64;
237    const MAX_PRES_VALUE = 65;
238    const MINIMUM_OFF_TIME = 66;
239    const MINIMUM_ON_TIME = 67;
240    const MINIMUM_OUTPUT = 68;
241    const MIN_PRES_VALUE = 69;
242    const MODEL_NAME = 70;
243    const MODIFICATION_DATE = 71;
244    const NOTIFY_TYPE = 72;
245    const NUMBER_OF_APDU_RETRIES = 73;
246    const NUMBER_OF_STATES = 74;
247    const OBJECT_IDENTIFIER = 75;
248    const OBJECT_LIST = 76;
249    const OBJECT_NAME = 77;
250    const OBJECT_PROPERTY_REFERENCE = 78;
251    const OBJECT_TYPE = 79;
252    const OPTIONAL = 80;
253    const OUT_OF_SERVICE = 81;
254    const OUTPUT_UNITS = 82;
255    const EVENT_PARAMETERS = 83;
256    const POLARITY = 84;
257    const PRESENT_VALUE = 85;
258    const PRIORITY = 86;
259    const PRIORITY_ARRAY = 87;
260    const PRIORITY_FOR_WRITING = 88;
261    const PROCESS_IDENTIFIER = 89;
262    const PROGRAM_CHANGE = 90;
263    const PROGRAM_LOCATION = 91;
264    const PROGRAM_STATE = 92;
265    const PROPORTIONAL_CONSTANT = 93;
266    const PROPORTIONAL_CONSTANT_UNITS = 94;
267    // 95: deleted
268    const PROTOCOL_OBJECT_TYPES_SUPPORTED = 96;
269    const PROTOCOL_SERVICES_SUPPORTED = 97;
270    const PROTOCOL_VERSION = 98;
271    const READ_ONLY = 99;
272    const REASON_FOR_HALT = 100;
273
274    // 101-200
275    // 101: deleted
276    const RECIPIENT_LIST = 102;
277    const RELIABILITY = 103;
278    const RELINQUISH_DEFAULT = 104;
279    const REQUIRED = 105;
280    const RESOLUTION = 106;
281    const SEGMENTATION_SUPPORTED = 107;
282    const SETPOINT = 108;
283    const SETPOINT_REFERENCE = 109;
284    const STATE_TEXT = 110;
285    const STATUS_FLAGS = 111;
286    const SYSTEM_STATUS = 112;
287    const TIME_DELAY = 113;
288    const TIME_OF_ACTIVE_TIME_RESET = 114;
289    const TIME_OF_STATE_COUNT_RESET = 115;
290    const TIME_SYNCHRONIZATION_RECIPIENTS = 116;
291    const UNITS = 117;
292    const UPDATE_INTERVAL = 118;
293    const UTC_OFFSET = 119;
294    const VENDOR_IDENTIFIER = 120;
295    const VENDOR_NAME = 121;
296    const VT_CLASSES_SUPPORTED = 122;
297    const WEEKLY_SCHEDULE = 123;
298    const ATTEMPTED_SAMPLES = 124;
299    const AVERAGE_VALUE = 125;
300    const BUFFER_SIZE = 126;
301    const CLIENT_COV_INCREMENT = 127;
302    const COV_RESUBSCRIPTION_INTERVAL = 128;
303    // 129: deleted
304    const EVENT_TIME_STAMPS = 130;
305    const LOG_BUFFER = 131;
306    const LOG_DEVICE_OBJECT_PROPERTY = 132;
307    const LOG_ENABLE = 133;
308    const LOG_INTERVAL = 134;
309    const MAXIMUM_VALUE = 135;
310    const MINIMUM_VALUE = 136;
311    const NOTIFICATION_THRESHOLD = 137;
312    // 138: deleted
313    const PROTOCOL_REVISION = 139;
314    const RECORDS_SINCE_NOTIFICATION = 140;
315    const RECORD_COUNT = 141;
316    const START_TIME = 142;
317    const STOP_TIME = 143;
318    const STOP_WHEN_FULL = 144;
319    const TOTAL_RECORD_COUNT = 145;
320    const VALID_SAMPLES = 146;
321    const WINDOW_INTERVAL = 147;
322    const WINDOW_SAMPLES = 148;
323    const MAXIMUM_VALUE_TIMESTAMP = 149;
324    const MINIMUM_VALUE_TIMESTAMP = 150;
325    const VARIANCE_VALUE = 151;
326    const ACTIVE_COV_SUBSCRIPTIONS = 152;
327    const BACKUP_FAILURE_TIMEOUT = 153;
328    const CONFIGURATION_FILES = 154;
329    const DATABASE_REVISION = 155;
330    const DIRECT_READING = 156;
331    const LAST_RESTORE_TIME = 157;
332    const MAINTENANCE_REQUIRED = 158;
333    const MEMBER_OF = 159;
334    const MODE = 160;
335    const OPERATION_EXPECTED = 161;
336    const SETTING = 162;
337    const SILENCED = 163;
338    const TRACKING_VALUE = 164;
339    const ZONE_MEMBERS = 165;
340    const LIFE_SAFETY_ALARM_VALUES = 166;
341    const MAX_SEGMENTS_ACCEPTED = 167;
342    const PROFILE_NAME = 168;
343    const AUTO_SLAVE_DISCOVERY = 169;
344    const MANUAL_SLAVE_ADDRESS_BINDING = 170;
345    const SLAVE_ADDRESS_BINDING = 171;
346    const SLAVE_PROXY_ENABLE = 172;
347    const LAST_NOTIFY_RECORD = 173;
348    const SCHEDULE_DEFAULT = 174;
349    const ACCEPTED_MODES = 175;
350    const ADJUST_VALUE = 176;
351    const COUNT = 177;
352    const COUNT_BEFORE_CHANGE = 178;
353    const COUNT_CHANGE_TIME = 179;
354    const COV_PERIOD = 180;
355    const INPUT_REFERENCE = 181;
356    const LIMIT_MONITORING_INTERVAL = 182;
357    const LOGGING_OBJECT = 183;
358    const LOGGING_RECORD = 184;
359    const PRESCALE = 185;
360    const PULSE_RATE = 186;
361    const SCALE = 187;
362    const SCALE_FACTOR = 188;
363    const UPDATE_TIME = 189;
364    const VALUE_BEFORE_CHANGE = 190;
365    const VALUE_SET = 191;
366    const VALUE_CHANGE_TIME = 192;
367    const ALIGN_INTERVALS = 193;
368    // 194: unassigned
369    const INTERVAL_OFFSET = 195;
370    const LAST_RESTART_REASON = 196;
371    const LOGGING_TYPE = 197;
372    // 198-201: unassigned
373
374    // 202-235
375    const RESTART_NOTIFICATION_RECIPIENTS = 202;
376    const TIME_OF_DEVICE_RESTART = 203;
377    const TIME_SYNCHRONIZATION_INTERVAL = 204;
378    const TRIGGER = 205;
379    const UTC_TIME_SYNCHRONIZATION_RECIPIENTS = 206;
380    const NODE_SUBTYPE = 207;
381    const NODE_TYPE = 208;
382    const STRUCTURED_OBJECT_LIST = 209;
383    const SUBORDINATE_ANNOTATIONS = 210;
384    const SUBORDINATE_LIST = 211;
385    const ACTUAL_SHED_LEVEL = 212;
386    const DUTY_WINDOW = 213;
387    const EXPECTED_SHED_LEVEL = 214;
388    const FULL_DUTY_BASELINE = 215;
389    // 216-217: unassigned
390    const REQUESTED_SHED_LEVEL = 218;
391    const SHED_DURATION = 219;
392    const SHED_LEVEL_DESCRIPTIONS = 220;
393    const SHED_LEVELS = 221;
394    const STATE_DESCRIPTION = 222;
395    // 223-225: unassigned
396    const DOOR_ALARM_STATE = 226;
397    const DOOR_EXTENDED_PULSE_TIME = 227;
398    const DOOR_MEMBERS = 228;
399    const DOOR_OPEN_TOO_LONG_TIME = 229;
400    const DOOR_PULSE_TIME = 230;
401    const DOOR_STATUS = 231;
402    const DOOR_UNLOCK_DELAY_TIME = 232;
403    const LOCK_STATUS = 233;
404    const MASKED_ALARM_VALUES = 234;
405    const SECURED_STATUS = 235;
406
407    // 244-323 (access control)
408    const ABSENTEE_LIMIT = 244;
409    const ACCESS_ALARM_EVENTS = 245;
410    const ACCESS_DOORS = 246;
411    const ACCESS_EVENT = 247;
412    const ACCESS_EVENT_AUTHENTICATION_FACTOR = 248;
413    const ACCESS_EVENT_CREDENTIAL = 249;
414    const ACCESS_EVENT_TIME = 250;
415    const ACCESS_TRANSACTION_EVENTS = 251;
416    const ACCOMPANIMENT = 252;
417    const ACCOMPANIMENT_TIME = 253;
418    const ACTIVATION_TIME = 254;
419    const ACTIVE_AUTHENTICATION_POLICY = 255;
420    const ASSIGNED_ACCESS_RIGHTS = 256;
421    const AUTHENTICATION_FACTORS = 257;
422    const AUTHENTICATION_POLICY_LIST = 258;
423    const AUTHENTICATION_POLICY_NAMES = 259;
424    const AUTHENTICATION_STATUS = 260;
425    const AUTHORIZATION_MODE = 261;
426    const BELONGS_TO = 262;
427    const CREDENTIAL_DISABLE = 263;
428    const CREDENTIAL_STATUS = 264;
429    const CREDENTIALS = 265;
430    const CREDENTIALS_IN_ZONE = 266;
431    const DAYS_REMAINING = 267;
432    const ENTRY_POINTS = 268;
433    const EXIT_POINTS = 269;
434    const EXPIRATION_TIME = 270;
435    const EXTENDED_TIME_ENABLE = 271;
436    const FAILED_ATTEMPT_EVENTS = 272;
437    const FAILED_ATTEMPTS = 273;
438    const FAILED_ATTEMPTS_TIME = 274;
439    const LAST_ACCESS_EVENT = 275;
440    const LAST_ACCESS_POINT = 276;
441    const LAST_CREDENTIAL_ADDED = 277;
442    const LAST_CREDENTIAL_ADDED_TIME = 278;
443    const LAST_CREDENTIAL_REMOVED = 279;
444    const LAST_CREDENTIAL_REMOVED_TIME = 280;
445    const LAST_USE_TIME = 281;
446    const LOCKOUT = 282;
447    const LOCKOUT_RELINQUISH_TIME = 283;
448    // 284: deleted
449    const MAX_FAILED_ATTEMPTS = 285;
450    const MEMBERS = 286;
451    const MUSTER_POINT = 287;
452    const NEGATIVE_ACCESS_RULES = 288;
453    const NUMBER_OF_AUTHENTICATION_POLICIES = 289;
454    const OCCUPANCY_COUNT = 290;
455    const OCCUPANCY_COUNT_ADJUST = 291;
456    const OCCUPANCY_COUNT_ENABLE = 292;
457    // 293: deleted
458    const OCCUPANCY_LOWER_LIMIT = 294;
459    const OCCUPANCY_LOWER_LIMIT_ENFORCED = 295;
460    const OCCUPANCY_STATE = 296;
461    const OCCUPANCY_UPPER_LIMIT = 297;
462    const OCCUPANCY_UPPER_LIMIT_ENFORCED = 298;
463    // 299: deleted
464    const PASSBACK_MODE = 300;
465    const PASSBACK_TIMEOUT = 301;
466    const POSITIVE_ACCESS_RULES = 302;
467    const REASON_FOR_DISABLE = 303;
468    const SUPPORTED_FORMATS = 304;
469    const SUPPORTED_FORMAT_CLASSES = 305;
470    const THREAT_AUTHORITY = 306;
471    const THREAT_LEVEL = 307;
472    const TRACE_FLAG = 308;
473    const TRANSACTION_NOTIFICATION_CLASS = 309;
474    const USER_EXTERNAL_IDENTIFIER = 310;
475    const USER_INFORMATION_REFERENCE = 311;
476    // 312-316: unassigned
477    const USER_NAME = 317;
478    const USER_TYPE = 318;
479    const USES_REMAINING = 319;
480    const ZONE_FROM = 320;
481    const ZONE_TO = 321;
482    const ACCESS_EVENT_TAG = 322;
483    const GLOBAL_IDENTIFIER = 323;
484
485    // 326-398
486    const VERIFICATION_TIME = 326;
487    /// Deprecated: removed with Clause 24 in 135-2020.
488    const BASE_DEVICE_SECURITY_POLICY = 327;
489    /// Deprecated: removed with Clause 24 in 135-2020.
490    const DISTRIBUTION_KEY_REVISION = 328;
491    /// Deprecated: removed with Clause 24 in 135-2020.
492    const DO_NOT_HIDE = 329;
493    /// Deprecated: removed with Clause 24 in 135-2020.
494    const KEY_SETS = 330;
495    /// Deprecated: removed with Clause 24 in 135-2020.
496    const LAST_KEY_SERVER = 331;
497    /// Deprecated: removed with Clause 24 in 135-2020.
498    const NETWORK_ACCESS_SECURITY_POLICIES = 332;
499    /// Deprecated: removed with Clause 24 in 135-2020.
500    const PACKET_REORDER_TIME = 333;
501    /// Deprecated: removed with Clause 24 in 135-2020.
502    const SECURITY_PDU_TIMEOUT = 334;
503    /// Deprecated: removed with Clause 24 in 135-2020.
504    const SECURITY_TIME_WINDOW = 335;
505    /// Deprecated: removed with Clause 24 in 135-2020.
506    const SUPPORTED_SECURITY_ALGORITHMS = 336;
507    /// Deprecated: removed with Clause 24 in 135-2020.
508    const UPDATE_KEY_SET_TIMEOUT = 337;
509    const BACKUP_AND_RESTORE_STATE = 338;
510    const BACKUP_PREPARATION_TIME = 339;
511    const RESTORE_COMPLETION_TIME = 340;
512    const RESTORE_PREPARATION_TIME = 341;
513    const BIT_MASK = 342;
514    const BIT_TEXT = 343;
515    const IS_UTC = 344;
516    const GROUP_MEMBERS = 345;
517    const GROUP_MEMBER_NAMES = 346;
518    const MEMBER_STATUS_FLAGS = 347;
519    const REQUESTED_UPDATE_INTERVAL = 348;
520    const COVU_PERIOD = 349;
521    const COVU_RECIPIENTS = 350;
522    const EVENT_MESSAGE_TEXTS = 351;
523    const EVENT_MESSAGE_TEXTS_CONFIG = 352;
524    const EVENT_DETECTION_ENABLE = 353;
525    const EVENT_ALGORITHM_INHIBIT = 354;
526    const EVENT_ALGORITHM_INHIBIT_REF = 355;
527    const TIME_DELAY_NORMAL = 356;
528    const RELIABILITY_EVALUATION_INHIBIT = 357;
529    const FAULT_PARAMETERS = 358;
530    const FAULT_TYPE = 359;
531    const LOCAL_FORWARDING_ONLY = 360;
532    const PROCESS_IDENTIFIER_FILTER = 361;
533    const SUBSCRIBED_RECIPIENTS = 362;
534    const PORT_FILTER = 363;
535    const AUTHORIZATION_EXEMPTIONS = 364;
536    const ALLOW_GROUP_DELAY_INHIBIT = 365;
537    const CHANNEL_NUMBER = 366;
538    const CONTROL_GROUPS = 367;
539    const EXECUTION_DELAY = 368;
540    const LAST_PRIORITY = 369;
541    const WRITE_STATUS = 370;
542    const PROPERTY_LIST = 371;
543    const SERIAL_NUMBER = 372;
544    const BLINK_WARN_ENABLE = 373;
545    const DEFAULT_FADE_TIME = 374;
546    const DEFAULT_RAMP_RATE = 375;
547    const DEFAULT_STEP_INCREMENT = 376;
548    const EGRESS_TIME = 377;
549    const IN_PROGRESS = 378;
550    const INSTANTANEOUS_POWER = 379;
551    const LIGHTING_COMMAND = 380;
552    const LIGHTING_COMMAND_DEFAULT_PRIORITY = 381;
553    const MAX_ACTUAL_VALUE = 382;
554    const MIN_ACTUAL_VALUE = 383;
555    const POWER = 384;
556    const TRANSITION = 385;
557    const EGRESS_ACTIVE = 386;
558    const INTERFACE_VALUE = 387;
559    const FAULT_HIGH_LIMIT = 388;
560    const FAULT_LOW_LIMIT = 389;
561    const LOW_DIFF_LIMIT = 390;
562    const STRIKE_COUNT = 391;
563    const TIME_OF_STRIKE_COUNT_RESET = 392;
564    const DEFAULT_TIMEOUT = 393;
565    const INITIAL_TIMEOUT = 394;
566    const LAST_STATE_CHANGE = 395;
567    const STATE_CHANGE_VALUES = 396;
568    const TIMER_RUNNING = 397;
569    const TIMER_STATE = 398;
570
571    // 399-429 (NetworkPort, Clause 12.56)
572    const APDU_LENGTH = 399;
573    const IP_ADDRESS = 400;
574    const IP_DEFAULT_GATEWAY = 401;
575    const IP_DHCP_ENABLE = 402;
576    const IP_DHCP_LEASE_TIME = 403;
577    const IP_DHCP_LEASE_TIME_REMAINING = 404;
578    const IP_DHCP_SERVER = 405;
579    const IP_DNS_SERVER = 406;
580    const BACNET_IP_GLOBAL_ADDRESS = 407;
581    const BACNET_IP_MODE = 408;
582    const BACNET_IP_MULTICAST_ADDRESS = 409;
583    const BACNET_IP_NAT_TRAVERSAL = 410;
584    const IP_SUBNET_MASK = 411;
585    const BACNET_IP_UDP_PORT = 412;
586    const BBMD_ACCEPT_FD_REGISTRATIONS = 413;
587    const BBMD_BROADCAST_DISTRIBUTION_TABLE = 414;
588    const BBMD_FOREIGN_DEVICE_TABLE = 415;
589    const CHANGES_PENDING = 416;
590    const COMMAND_NP = 417;
591    const FD_BBMD_ADDRESS = 418;
592    const FD_SUBSCRIPTION_LIFETIME = 419;
593    const LINK_SPEED = 420;
594    const LINK_SPEEDS = 421;
595    const LINK_SPEED_AUTONEGOTIATE = 422;
596    const MAC_ADDRESS = 423;
597    const NETWORK_INTERFACE_NAME = 424;
598    const NETWORK_NUMBER = 425;
599    const NETWORK_NUMBER_QUALITY = 426;
600    const NETWORK_TYPE = 427;
601    const ROUTING_TABLE = 428;
602    const VIRTUAL_MAC_ADDRESS_TABLE = 429;
603
604    // 430-446 (commandable + IPv6)
605    const COMMAND_TIME_ARRAY = 430;
606    const CURRENT_COMMAND_PRIORITY = 431;
607    const LAST_COMMAND_TIME = 432;
608    const VALUE_SOURCE = 433;
609    const VALUE_SOURCE_ARRAY = 434;
610    const BACNET_IPV6_MODE = 435;
611    const IPV6_ADDRESS = 436;
612    const IPV6_PREFIX_LENGTH = 437;
613    const BACNET_IPV6_UDP_PORT = 438;
614    const IPV6_DEFAULT_GATEWAY = 439;
615    const BACNET_IPV6_MULTICAST_ADDRESS = 440;
616    const IPV6_DNS_SERVER = 441;
617    const IPV6_AUTO_ADDRESSING_ENABLE = 442;
618    const IPV6_DHCP_LEASE_TIME = 443;
619    const IPV6_DHCP_LEASE_TIME_REMAINING = 444;
620    const IPV6_DHCP_SERVER = 445;
621    const IPV6_ZONE_INDEX = 446;
622
623    // 447-480 (lift/escalator, Clause 12.58-12.60)
624    const ASSIGNED_LANDING_CALLS = 447;
625    const CAR_ASSIGNED_DIRECTION = 448;
626    const CAR_DOOR_COMMAND = 449;
627    const CAR_DOOR_STATUS = 450;
628    const CAR_DOOR_TEXT = 451;
629    const CAR_DOOR_ZONE = 452;
630    const CAR_DRIVE_STATUS = 453;
631    const CAR_LOAD = 454;
632    const CAR_LOAD_UNITS = 455;
633    const CAR_MODE = 456;
634    const CAR_MOVING_DIRECTION = 457;
635    const CAR_POSITION = 458;
636    const ELEVATOR_GROUP = 459;
637    const ENERGY_METER = 460;
638    const ENERGY_METER_REF = 461;
639    const ESCALATOR_MODE = 462;
640    const FAULT_SIGNALS = 463;
641    const FLOOR_TEXT = 464;
642    const GROUP_ID = 465;
643    // 466: unassigned
644    const GROUP_MODE = 467;
645    const HIGHER_DECK = 468;
646    const INSTALLATION_ID = 469;
647    const LANDING_CALLS = 470;
648    const LANDING_CALL_CONTROL = 471;
649    const LANDING_DOOR_STATUS = 472;
650    const LOWER_DECK = 473;
651    const MACHINE_ROOM_ID = 474;
652    const MAKING_CAR_CALL = 475;
653    const NEXT_STOPPING_FLOOR = 476;
654    const OPERATION_DIRECTION = 477;
655    const PASSENGER_ALARM = 478;
656    const POWER_MODE = 479;
657    const REGISTERED_CAR_CALL = 480;
658
659    // 481-507 (misc + staging + audit)
660    const ACTIVE_COV_MULTIPLE_SUBSCRIPTIONS = 481;
661    const PROTOCOL_LEVEL = 482;
662    const REFERENCE_PORT = 483;
663    const DEPLOYED_PROFILE_LOCATION = 484;
664    const PROFILE_LOCATION = 485;
665    const TAGS = 486;
666    const SUBORDINATE_NODE_TYPES = 487;
667    const SUBORDINATE_TAGS = 488;
668    const SUBORDINATE_RELATIONSHIPS = 489;
669    const DEFAULT_SUBORDINATE_RELATIONSHIP = 490;
670    const REPRESENTS = 491;
671    const DEFAULT_PRESENT_VALUE = 492;
672    const PRESENT_STAGE = 493;
673    const STAGES = 494;
674    const STAGE_NAMES = 495;
675    const TARGET_REFERENCES = 496;
676    const AUDIT_SOURCE_REPORTER = 497;
677    const AUDIT_LEVEL = 498;
678    const AUDIT_NOTIFICATION_RECIPIENT = 499;
679    const AUDIT_PRIORITY_FILTER = 500;
680    const AUDITABLE_OPERATIONS = 501;
681    const DELETE_ON_FORWARD = 502;
682    const MAXIMUM_SEND_DELAY = 503;
683    const MONITORED_OBJECTS = 504;
684    const SEND_NOW = 505;
685    const FLOOR_NUMBER = 506;
686    const DEVICE_UUID = 507;
687    /// New in 135-2020 Addendum bj (Color objects).
688    const COLOR_COMMAND = 508;
689    /// New in 135-2020 Addendum bj (Color Temperature objects).
690    const DEFAULT_COLOR_TEMPERATURE = 509;
691    /// New in 135-2020 Addendum bj (Color objects).
692    const DEFAULT_COLOR = 510;
693}
694
695// ===========================================================================
696// Protocol enums (PDU types, services, error classes/codes)
697// ===========================================================================
698
699bacnet_enum! {
700    /// APDU PDU type identifiers (Clause 20.1).
701    pub struct PduType(u8);
702
703    const CONFIRMED_REQUEST = 0;
704    const UNCONFIRMED_REQUEST = 1;
705    const SIMPLE_ACK = 2;
706    const COMPLEX_ACK = 3;
707    const SEGMENT_ACK = 4;
708    const ERROR = 5;
709    const REJECT = 6;
710    const ABORT = 7;
711}
712
713bacnet_enum! {
714    /// Confirmed service request types (Clause 21).
715    pub struct ConfirmedServiceChoice(u8);
716
717    const ACKNOWLEDGE_ALARM = 0;
718    const CONFIRMED_COV_NOTIFICATION = 1;
719    const CONFIRMED_EVENT_NOTIFICATION = 2;
720    const GET_ALARM_SUMMARY = 3;
721    const GET_ENROLLMENT_SUMMARY = 4;
722    const SUBSCRIBE_COV = 5;
723    const ATOMIC_READ_FILE = 6;
724    const ATOMIC_WRITE_FILE = 7;
725    const ADD_LIST_ELEMENT = 8;
726    const REMOVE_LIST_ELEMENT = 9;
727    const CREATE_OBJECT = 10;
728    const DELETE_OBJECT = 11;
729    const READ_PROPERTY = 12;
730    // 13: reserved
731    const READ_PROPERTY_MULTIPLE = 14;
732    const WRITE_PROPERTY = 15;
733    const WRITE_PROPERTY_MULTIPLE = 16;
734    const DEVICE_COMMUNICATION_CONTROL = 17;
735    const CONFIRMED_PRIVATE_TRANSFER = 18;
736    const CONFIRMED_TEXT_MESSAGE = 19;
737    const REINITIALIZE_DEVICE = 20;
738    const VT_OPEN = 21;
739    const VT_CLOSE = 22;
740    const VT_DATA = 23;
741    // 24-25: reserved
742    const READ_RANGE = 26;
743    const LIFE_SAFETY_OPERATION = 27;
744    const SUBSCRIBE_COV_PROPERTY = 28;
745    const GET_EVENT_INFORMATION = 29;
746    const SUBSCRIBE_COV_PROPERTY_MULTIPLE = 30;
747    const CONFIRMED_COV_NOTIFICATION_MULTIPLE = 31;
748    const CONFIRMED_AUDIT_NOTIFICATION = 32;
749    const AUDIT_LOG_QUERY = 33;
750}
751
752bacnet_enum! {
753    /// Unconfirmed service request types (Clause 21).
754    pub struct UnconfirmedServiceChoice(u8);
755
756    const I_AM = 0;
757    const I_HAVE = 1;
758    const UNCONFIRMED_COV_NOTIFICATION = 2;
759    const UNCONFIRMED_EVENT_NOTIFICATION = 3;
760    const UNCONFIRMED_PRIVATE_TRANSFER = 4;
761    const UNCONFIRMED_TEXT_MESSAGE = 5;
762    const TIME_SYNCHRONIZATION = 6;
763    const WHO_HAS = 7;
764    const WHO_IS = 8;
765    const UTC_TIME_SYNCHRONIZATION = 9;
766    const WRITE_GROUP = 10;
767    const UNCONFIRMED_COV_NOTIFICATION_MULTIPLE = 11;
768    const UNCONFIRMED_AUDIT_NOTIFICATION = 12;
769    const WHO_AM_I = 13;
770    const YOU_ARE = 14;
771}
772
773bacnet_enum! {
774    /// BACnet error classes (Clause 18.1.1).
775    pub struct ErrorClass(u16);
776
777    const DEVICE = 0;
778    const OBJECT = 1;
779    const PROPERTY = 2;
780    const RESOURCES = 3;
781    const SECURITY = 4;
782    const SERVICES = 5;
783    const VT = 6;
784    const COMMUNICATION = 7;
785}
786
787bacnet_enum! {
788    /// BACnet error codes (Clause 18).
789    pub struct ErrorCode(u16);
790
791    const OTHER = 0;
792    const AUTHENTICATION_FAILED = 1;
793    const CONFIGURATION_IN_PROGRESS = 2;
794    const DEVICE_BUSY = 3;
795    const DYNAMIC_CREATION_NOT_SUPPORTED = 4;
796    const FILE_ACCESS_DENIED = 5;
797    const INCOMPATIBLE_SECURITY_LEVELS = 6;
798    const INCONSISTENT_PARAMETERS = 7;
799    const INCONSISTENT_SELECTION_CRITERION = 8;
800    const INVALID_DATA_TYPE = 9;
801    const INVALID_FILE_ACCESS_METHOD = 10;
802    const INVALID_FILE_START_POSITION = 11;
803    const INVALID_OPERATOR_NAME = 12;
804    const INVALID_PARAMETER_DATA_TYPE = 13;
805    const INVALID_TIME_STAMP = 14;
806    const KEY_GENERATION_ERROR = 15;
807    const MISSING_REQUIRED_PARAMETER = 16;
808    const NO_OBJECTS_OF_SPECIFIED_TYPE = 17;
809    const NO_SPACE_FOR_OBJECT = 18;
810    const NO_SPACE_TO_ADD_LIST_ELEMENT = 19;
811    const NO_SPACE_TO_WRITE_PROPERTY = 20;
812    const NO_VT_SESSIONS_AVAILABLE = 21;
813    const PROPERTY_IS_NOT_A_LIST = 22;
814    const OBJECT_DELETION_NOT_PERMITTED = 23;
815    const OBJECT_IDENTIFIER_ALREADY_EXISTS = 24;
816    const OPERATIONAL_PROBLEM = 25;
817    const PASSWORD_FAILURE = 26;
818    const READ_ACCESS_DENIED = 27;
819    const SECURITY_NOT_SUPPORTED = 28;
820    const SERVICE_REQUEST_DENIED = 29;
821    const TIMEOUT = 30;
822    const UNKNOWN_OBJECT = 31;
823    const UNKNOWN_PROPERTY = 32;
824    // 33: removed
825    const UNKNOWN_VT_CLASS = 34;
826    const UNKNOWN_VT_SESSION = 35;
827    const UNSUPPORTED_OBJECT_TYPE = 36;
828    const VALUE_OUT_OF_RANGE = 37;
829    const VT_SESSION_ALREADY_CLOSED = 38;
830    const VT_SESSION_TERMINATION_FAILURE = 39;
831    const WRITE_ACCESS_DENIED = 40;
832    const CHARACTER_SET_NOT_SUPPORTED = 41;
833    const INVALID_ARRAY_INDEX = 42;
834    const COV_SUBSCRIPTION_FAILED = 43;
835    const NOT_COV_PROPERTY = 44;
836    const OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED = 45;
837    const INVALID_CONFIGURATION_DATA = 46;
838    const DATATYPE_NOT_SUPPORTED = 47;
839    const DUPLICATE_NAME = 48;
840    const DUPLICATE_OBJECT_ID = 49;
841    const PROPERTY_IS_NOT_AN_ARRAY = 50;
842    const ABORT_BUFFER_OVERFLOW = 51;
843    const ABORT_INVALID_APDU_IN_THIS_STATE = 52;
844    const ABORT_PREEMPTED_BY_HIGHER_PRIORITY_TASK = 53;
845    const ABORT_SEGMENTATION_NOT_SUPPORTED = 54;
846    const ABORT_PROPRIETARY = 55;
847    const ABORT_OTHER = 56;
848    const INVALID_TAG = 57;
849    const NETWORK_DOWN = 58;
850    const REJECT_BUFFER_OVERFLOW = 59;
851    const REJECT_INCONSISTENT_PARAMETERS = 60;
852    const REJECT_INVALID_PARAMETER_DATA_TYPE = 61;
853    const REJECT_INVALID_TAG = 62;
854    const REJECT_MISSING_REQUIRED_PARAMETER = 63;
855    const REJECT_PARAMETER_OUT_OF_RANGE = 64;
856    const REJECT_TOO_MANY_ARGUMENTS = 65;
857    const REJECT_UNDEFINED_ENUMERATION = 66;
858    const REJECT_UNRECOGNIZED_SERVICE = 67;
859    const REJECT_PROPRIETARY = 68;
860    const REJECT_OTHER = 69;
861    const UNKNOWN_DEVICE = 70;
862    const UNKNOWN_ROUTE = 71;
863    const VALUE_NOT_INITIALIZED = 72;
864    const INVALID_EVENT_STATE = 73;
865    const NO_ALARM_CONFIGURED = 74;
866    const LOG_BUFFER_FULL = 75;
867    const LOGGED_VALUE_PURGED = 76;
868    const NO_PROPERTY_SPECIFIED = 77;
869    const NOT_CONFIGURED_FOR_TRIGGERED_LOGGING = 78;
870    const UNKNOWN_SUBSCRIPTION = 79;
871    const PARAMETER_OUT_OF_RANGE = 80;
872    const LIST_ELEMENT_NOT_FOUND = 81;
873    const BUSY = 82;
874    const COMMUNICATION_DISABLED = 83;
875    const SUCCESS = 84;
876    const ACCESS_DENIED = 85;
877    const BAD_DESTINATION_ADDRESS = 86;
878    const BAD_DESTINATION_DEVICE_ID = 87;
879    const BAD_SIGNATURE = 88;
880    const BAD_SOURCE_ADDRESS = 89;
881    const BAD_TIMESTAMP = 90;
882    const CANNOT_USE_KEY = 91;
883    const CANNOT_VERIFY_MESSAGE_ID = 92;
884    const CORRECT_KEY_REVISION = 93;
885    const DESTINATION_DEVICE_ID_REQUIRED = 94;
886    const DUPLICATE_MESSAGE = 95;
887    const ENCRYPTION_NOT_CONFIGURED = 96;
888    const ENCRYPTION_REQUIRED = 97;
889    const INCORRECT_KEY = 98;
890    const INVALID_KEY_DATA = 99;
891    const KEY_UPDATE_IN_PROGRESS = 100;
892    const MALFORMED_MESSAGE = 101;
893    const NOT_KEY_SERVER = 102;
894    const SECURITY_NOT_CONFIGURED = 103;
895    const SOURCE_SECURITY_REQUIRED = 104;
896    const TOO_MANY_KEYS = 105;
897    const UNKNOWN_AUTHENTICATION_TYPE = 106;
898    const UNKNOWN_KEY = 107;
899    const UNKNOWN_KEY_REVISION = 108;
900    const UNKNOWN_SOURCE_MESSAGE = 109;
901    const NOT_ROUTER_TO_DNET = 110;
902    const ROUTER_BUSY = 111;
903    const UNKNOWN_NETWORK_MESSAGE = 112;
904    const MESSAGE_TOO_LONG = 113;
905    const SECURITY_ERROR = 114;
906    const ADDRESSING_ERROR = 115;
907    const WRITE_BDT_FAILED = 116;
908    const READ_BDT_FAILED = 117;
909    const REGISTER_FOREIGN_DEVICE_FAILED = 118;
910    const READ_FDT_FAILED = 119;
911    const DELETE_FDT_ENTRY_FAILED = 120;
912    const DISTRIBUTE_BROADCAST_FAILED = 121;
913    const UNKNOWN_FILE_SIZE = 122;
914    const ABORT_APDU_TOO_LONG = 123;
915    const ABORT_APPLICATION_EXCEEDED_REPLY_TIME = 124;
916    const ABORT_OUT_OF_RESOURCES = 125;
917    const ABORT_TSM_TIMEOUT = 126;
918    const ABORT_WINDOW_SIZE_OUT_OF_RANGE = 127;
919    const FILE_FULL = 128;
920    const INCONSISTENT_CONFIGURATION = 129;
921    const INCONSISTENT_OBJECT_TYPE = 130;
922    const INTERNAL_ERROR = 131;
923    const NOT_CONFIGURED = 132;
924    const OUT_OF_MEMORY = 133;
925    const VALUE_TOO_LONG = 134;
926    const ABORT_INSUFFICIENT_SECURITY = 135;
927    const ABORT_SECURITY_ERROR = 136;
928    const DUPLICATE_ENTRY = 137;
929    const INVALID_VALUE_IN_THIS_STATE = 138;
930}
931
932bacnet_enum! {
933    /// BACnet abort reasons (Clause 20.1.9).
934    pub struct AbortReason(u8);
935
936    const OTHER = 0;
937    const BUFFER_OVERFLOW = 1;
938    const INVALID_APDU_IN_THIS_STATE = 2;
939    const PREEMPTED_BY_HIGHER_PRIORITY_TASK = 3;
940    const SEGMENTATION_NOT_SUPPORTED = 4;
941    const SECURITY_ERROR = 5;
942    const INSUFFICIENT_SECURITY = 6;
943    const WINDOW_SIZE_OUT_OF_RANGE = 7;
944    const APPLICATION_EXCEEDED_REPLY_TIME = 8;
945    const OUT_OF_RESOURCES = 9;
946    const TSM_TIMEOUT = 10;
947    const APDU_TOO_LONG = 11;
948}
949
950bacnet_enum! {
951    /// BACnet reject reasons (Clause 20.1.8).
952    pub struct RejectReason(u8);
953
954    const OTHER = 0;
955    const BUFFER_OVERFLOW = 1;
956    const INCONSISTENT_PARAMETERS = 2;
957    const INVALID_PARAMETER_DATA_TYPE = 3;
958    const INVALID_TAG = 4;
959    const MISSING_REQUIRED_PARAMETER = 5;
960    const PARAMETER_OUT_OF_RANGE = 6;
961    const TOO_MANY_ARGUMENTS = 7;
962    const UNDEFINED_ENUMERATION = 8;
963    const UNRECOGNIZED_SERVICE = 9;
964}
965
966bacnet_enum! {
967    /// Segmentation support options (Clause 20.1.2.4).
968    pub struct Segmentation(u8);
969
970    const BOTH = 0;
971    const TRANSMIT = 1;
972    const RECEIVE = 2;
973    const NONE = 3;
974}
975
976// ===========================================================================
977// Network layer enums (Clause 6)
978// ===========================================================================
979
980bacnet_enum! {
981    /// NPDU network priority levels (Clause 6.2.2).
982    pub struct NetworkPriority(u8);
983
984    const NORMAL = 0;
985    const URGENT = 1;
986    const CRITICAL_EQUIPMENT = 2;
987    const LIFE_SAFETY = 3;
988}
989
990bacnet_enum! {
991    /// Network layer message types (Clause 6.2.4).
992    pub struct NetworkMessageType(u8);
993
994    const WHO_IS_ROUTER_TO_NETWORK = 0x00;
995    const I_AM_ROUTER_TO_NETWORK = 0x01;
996    const I_COULD_BE_ROUTER_TO_NETWORK = 0x02;
997    const REJECT_MESSAGE_TO_NETWORK = 0x03;
998    const ROUTER_BUSY_TO_NETWORK = 0x04;
999    const ROUTER_AVAILABLE_TO_NETWORK = 0x05;
1000    const INITIALIZE_ROUTING_TABLE = 0x06;
1001    const INITIALIZE_ROUTING_TABLE_ACK = 0x07;
1002    const ESTABLISH_CONNECTION_TO_NETWORK = 0x08;
1003    const DISCONNECT_CONNECTION_TO_NETWORK = 0x09;
1004    const CHALLENGE_REQUEST = 0x0A;
1005    const SECURITY_PAYLOAD = 0x0B;
1006    const SECURITY_RESPONSE = 0x0C;
1007    const REQUEST_KEY_UPDATE = 0x0D;
1008    const UPDATE_KEY_SET = 0x0E;
1009    const UPDATE_DISTRIBUTION_KEY = 0x0F;
1010    const REQUEST_MASTER_KEY = 0x10;
1011    const SET_MASTER_KEY = 0x11;
1012    const WHAT_IS_NETWORK_NUMBER = 0x12;
1013    const NETWORK_NUMBER_IS = 0x13;
1014}
1015
1016bacnet_enum! {
1017    /// Reject-Message-To-Network reason codes (Clause 6.4.4).
1018    pub struct RejectMessageReason(u8);
1019
1020    const OTHER = 0;
1021    const NOT_DIRECTLY_CONNECTED = 1;
1022    const ROUTER_BUSY = 2;
1023    const UNKNOWN_MESSAGE_TYPE = 3;
1024    const MESSAGE_TOO_LONG = 4;
1025    /// Removed per 135-2020
1026    const REMOVED_5 = 5;
1027    const ADDRESSING_ERROR = 6;
1028}
1029
1030// ===========================================================================
1031// BVLC enums (Annex J / Annex U)
1032// ===========================================================================
1033
1034bacnet_enum! {
1035    /// BACnet/IPv4 BVLC function codes (Annex J).
1036    pub struct BvlcFunction(u8);
1037
1038    const BVLC_RESULT = 0x00;
1039    const WRITE_BROADCAST_DISTRIBUTION_TABLE = 0x01;
1040    const READ_BROADCAST_DISTRIBUTION_TABLE = 0x02;
1041    const READ_BROADCAST_DISTRIBUTION_TABLE_ACK = 0x03;
1042    const FORWARDED_NPDU = 0x04;
1043    const REGISTER_FOREIGN_DEVICE = 0x05;
1044    const READ_FOREIGN_DEVICE_TABLE = 0x06;
1045    const READ_FOREIGN_DEVICE_TABLE_ACK = 0x07;
1046    const DELETE_FOREIGN_DEVICE_TABLE_ENTRY = 0x08;
1047    const DISTRIBUTE_BROADCAST_TO_NETWORK = 0x09;
1048    const ORIGINAL_UNICAST_NPDU = 0x0A;
1049    const ORIGINAL_BROADCAST_NPDU = 0x0B;
1050    const SECURE_BVLL = 0x0C;
1051}
1052
1053bacnet_enum! {
1054    /// BACnet/IPv4 BVLC-Result codes (Annex J.2).
1055    pub struct BvlcResultCode(u16);
1056
1057    const SUCCESSFUL_COMPLETION = 0x0000;
1058    const WRITE_BROADCAST_DISTRIBUTION_TABLE_NAK = 0x0010;
1059    const READ_BROADCAST_DISTRIBUTION_TABLE_NAK = 0x0020;
1060    const REGISTER_FOREIGN_DEVICE_NAK = 0x0030;
1061    const READ_FOREIGN_DEVICE_TABLE_NAK = 0x0040;
1062    const DELETE_FOREIGN_DEVICE_TABLE_ENTRY_NAK = 0x0050;
1063    const DISTRIBUTE_BROADCAST_TO_NETWORK_NAK = 0x0060;
1064}
1065
1066bacnet_enum! {
1067    /// BACnet/IPv6 BVLC function codes (Annex U, Table U-1).
1068    pub struct Bvlc6Function(u8);
1069
1070    const BVLC_RESULT = 0x00;
1071    const ORIGINAL_UNICAST_NPDU = 0x01;
1072    const ORIGINAL_BROADCAST_NPDU = 0x02;
1073    const ADDRESS_RESOLUTION = 0x03;
1074    const FORWARDED_ADDRESS_RESOLUTION = 0x04;
1075    const ADDRESS_RESOLUTION_ACK = 0x05;
1076    const VIRTUAL_ADDRESS_RESOLUTION = 0x06;
1077    const VIRTUAL_ADDRESS_RESOLUTION_ACK = 0x07;
1078    const FORWARDED_NPDU = 0x08;
1079    const REGISTER_FOREIGN_DEVICE = 0x09;
1080    const DELETE_FOREIGN_DEVICE_TABLE_ENTRY = 0x0A;
1081    const DISTRIBUTE_BROADCAST_TO_NETWORK = 0x0C;
1082}
1083
1084bacnet_enum! {
1085    /// BACnet/IPv6 BVLC-Result codes (Annex U.2.1.1).
1086    pub struct Bvlc6ResultCode(u16);
1087
1088    const SUCCESSFUL_COMPLETION = 0x0000;
1089    const ADDRESS_RESOLUTION_NAK = 0x0030;
1090    const VIRTUAL_ADDRESS_RESOLUTION_NAK = 0x0060;
1091    const REGISTER_FOREIGN_DEVICE_NAK = 0x0090;
1092    const DELETE_FOREIGN_DEVICE_TABLE_ENTRY_NAK = 0x00A0;
1093    const DISTRIBUTE_BROADCAST_TO_NETWORK_NAK = 0x00C0;
1094}
1095
1096// ===========================================================================
1097// Object-level enums (Clause 12, 21)
1098// ===========================================================================
1099
1100bacnet_enum! {
1101    /// BACnet event state (Clause 12).
1102    pub struct EventState(u32);
1103
1104    const NORMAL = 0;
1105    const FAULT = 1;
1106    const OFFNORMAL = 2;
1107    const HIGH_LIMIT = 3;
1108    const LOW_LIMIT = 4;
1109    const LIFE_SAFETY_ALARM = 5;
1110}
1111
1112bacnet_enum! {
1113    /// BACnet binary present value (Clause 21).
1114    pub struct BinaryPV(u32);
1115
1116    const INACTIVE = 0;
1117    const ACTIVE = 1;
1118}
1119
1120bacnet_enum! {
1121    /// BACnet polarity (Clause 12).
1122    pub struct Polarity(u32);
1123
1124    const NORMAL = 0;
1125    const REVERSE = 1;
1126}
1127
1128bacnet_enum! {
1129    /// BACnet reliability (Clause 12).
1130    pub struct Reliability(u32);
1131
1132    const NO_FAULT_DETECTED = 0;
1133    const NO_SENSOR = 1;
1134    const OVER_RANGE = 2;
1135    const UNDER_RANGE = 3;
1136    const OPEN_LOOP = 4;
1137    const SHORTED_LOOP = 5;
1138    const NO_OUTPUT = 6;
1139    const UNRELIABLE_OTHER = 7;
1140    const PROCESS_ERROR = 8;
1141    const MULTI_STATE_FAULT = 9;
1142    const CONFIGURATION_ERROR = 10;
1143    // 11: removed from standard
1144    const COMMUNICATION_FAILURE = 12;
1145    const MEMBER_FAULT = 13;
1146    const MONITORED_OBJECT_FAULT = 14;
1147    const TRIPPED = 15;
1148    const LAMP_FAILURE = 16;
1149    const ACTIVATION_FAILURE = 17;
1150    const RENEW_DHCP_FAILURE = 18;
1151    const RENEW_FD_REGISTRATION_FAILURE = 19;
1152    const RESTART_AUTO_NEGOTIATION_FAILURE = 20;
1153    const RESTART_FAILURE = 21;
1154    const PROPRIETARY_COMMAND_FAILURE = 22;
1155    const FAULTS_LISTED = 23;
1156    const REFERENCED_OBJECT_FAULT = 24;
1157}
1158
1159bacnet_enum! {
1160    /// BACnet device status (Clause 12.11.9).
1161    pub struct DeviceStatus(u32);
1162
1163    const OPERATIONAL = 0;
1164    const OPERATIONAL_READ_ONLY = 1;
1165    const DOWNLOAD_REQUIRED = 2;
1166    const DOWNLOAD_IN_PROGRESS = 3;
1167    const NON_OPERATIONAL = 4;
1168    const BACKUP_IN_PROGRESS = 5;
1169}
1170
1171bacnet_enum! {
1172    /// BACnet enable/disable (Clause 16.4).
1173    pub struct EnableDisable(u32);
1174
1175    const ENABLE = 0;
1176    /// Deprecated in revision 20; use DISABLE_INITIATION instead.
1177    const DISABLE = 1;
1178    const DISABLE_INITIATION = 2;
1179}
1180
1181bacnet_enum! {
1182    /// BACnet reinitialized state of device (Clause 16.5).
1183    pub struct ReinitializedState(u32);
1184
1185    const COLDSTART = 0;
1186    const WARMSTART = 1;
1187    const START_BACKUP = 2;
1188    const END_BACKUP = 3;
1189    const START_RESTORE = 4;
1190    const END_RESTORE = 5;
1191    const ABORT_RESTORE = 6;
1192    const ACTIVATE_CHANGES = 7;
1193}
1194
1195bacnet_enum! {
1196    /// BACnet file access method (Clause 12.12).
1197    pub struct FileAccessMethod(u32);
1198
1199    const STREAM_ACCESS = 0;
1200    const RECORD_ACCESS = 1;
1201}
1202
1203bacnet_enum! {
1204    /// BACnet program state (Clause 12.22).
1205    pub struct ProgramState(u32);
1206
1207    const IDLE = 0;
1208    const LOADING = 1;
1209    const RUNNING = 2;
1210    const WAITING = 3;
1211    const HALTED = 4;
1212    const UNLOADING = 5;
1213}
1214
1215bacnet_enum! {
1216    /// BACnet program request (Clause 12.22).
1217    pub struct ProgramChange(u32);
1218
1219    const READY = 0;
1220    const LOAD = 1;
1221    const RUN = 2;
1222    const HALT = 3;
1223    const RESTART = 4;
1224    const UNLOAD = 5;
1225}
1226
1227bacnet_enum! {
1228    /// BACnet action (Clause 12.17).
1229    pub struct Action(u32);
1230
1231    const DIRECT = 0;
1232    const REVERSE = 1;
1233}
1234
1235bacnet_enum! {
1236    /// BACnet event type (Clause 12.12.6).
1237    pub struct EventType(u32);
1238
1239    const CHANGE_OF_BITSTRING = 0;
1240    const CHANGE_OF_STATE = 1;
1241    const CHANGE_OF_VALUE = 2;
1242    const COMMAND_FAILURE = 3;
1243    const FLOATING_LIMIT = 4;
1244    const OUT_OF_RANGE = 5;
1245    // 6-7: reserved
1246    const CHANGE_OF_LIFE_SAFETY = 8;
1247    const EXTENDED = 9;
1248    const BUFFER_READY = 10;
1249    const UNSIGNED_RANGE = 11;
1250    // 12: reserved
1251    const ACCESS_EVENT = 13;
1252    const DOUBLE_OUT_OF_RANGE = 14;
1253    const SIGNED_OUT_OF_RANGE = 15;
1254    const UNSIGNED_OUT_OF_RANGE = 16;
1255    const CHANGE_OF_CHARACTERSTRING = 17;
1256    const CHANGE_OF_STATUS_FLAGS = 18;
1257    const CHANGE_OF_RELIABILITY = 19;
1258    const NONE = 20;
1259    const CHANGE_OF_DISCRETE_VALUE = 21;
1260    const CHANGE_OF_TIMER = 22;
1261}
1262
1263bacnet_enum! {
1264    /// BACnet notify type (Clause 12.21).
1265    pub struct NotifyType(u32);
1266
1267    const ALARM = 0;
1268    const EVENT = 1;
1269    const ACK_NOTIFICATION = 2;
1270}
1271
1272bacnet_enum! {
1273    /// BACnet backup and restore state (Clause 19.1).
1274    pub struct BackupAndRestoreState(u32);
1275
1276    const IDLE = 0;
1277    const PREPARING_FOR_BACKUP = 1;
1278    const PREPARING_FOR_RESTORE = 2;
1279    const PERFORMING_A_BACKUP = 3;
1280    const PERFORMING_A_RESTORE = 4;
1281}
1282
1283bacnet_enum! {
1284    /// BACnet logging type (Clause 12.25.14).
1285    pub struct LoggingType(u32);
1286
1287    const POLLED = 0;
1288    const COV = 1;
1289    const TRIGGERED = 2;
1290}
1291
1292// ===========================================================================
1293// Network port enums (Clause 12.56)
1294// ===========================================================================
1295
1296bacnet_enum! {
1297    /// BACnet data link/network type (Clause 12.56.44).
1298    pub struct NetworkType(u32);
1299
1300    const ETHERNET = 0;
1301    const ARCNET = 1;
1302    const MSTP = 2;
1303    const PTP = 3;
1304    const LONTALK = 4;
1305    const IPV4 = 5;
1306    const ZIGBEE = 6;
1307    const VIRTUAL = 7;
1308    /// Removed in protocol revision 16.
1309    const NON_BACNET = 8;
1310    const IPV6 = 9;
1311    const SERIAL = 10;
1312}
1313
1314bacnet_enum! {
1315    /// IP addressing mode for a NetworkPort (Clause 12.56).
1316    pub struct IPMode(u32);
1317
1318    const NORMAL = 0;
1319    const FOREIGN = 1;
1320    const BBMD = 2;
1321}
1322
1323bacnet_enum! {
1324    /// Commands for a NetworkPort object (Clause 12.56.40).
1325    pub struct NetworkPortCommand(u32);
1326
1327    const IDLE = 0;
1328    const DISCARD_CHANGES = 1;
1329    const RENEW_FD_REGISTRATION = 2;
1330    const RESTART_SLAVE_DISCOVERY = 3;
1331    const RENEW_DHCP = 4;
1332    const RESTART_AUTONEG = 5;
1333    const DISCONNECT = 6;
1334    const RESTART_PORT = 7;
1335}
1336
1337bacnet_enum! {
1338    /// Quality of a NetworkPort's network number (Clause 12.56.42).
1339    pub struct NetworkNumberQuality(u32);
1340
1341    const UNKNOWN = 0;
1342    const LEARNED = 1;
1343    const LEARNED_CONFIGURED = 2;
1344    const CONFIGURED = 3;
1345}
1346
1347bacnet_enum! {
1348    /// Network reachability status (Clause 6.6.1).
1349    pub struct NetworkReachability(u32);
1350
1351    const REACHABLE = 0;
1352    const BUSY = 1;
1353    const UNREACHABLE = 2;
1354}
1355
1356bacnet_enum! {
1357    /// Protocol level of a NetworkPort (Clause 12.56).
1358    pub struct ProtocolLevel(u32);
1359
1360    const PHYSICAL = 0;
1361    const PROTOCOL = 1;
1362    const BACNET_APPLICATION = 2;
1363    const NON_BACNET_APPLICATION = 3;
1364}
1365
1366bacnet_enum! {
1367    /// Status of the last Channel write operation (Clause 12.53).
1368    pub struct WriteStatus(u32);
1369
1370    const IDLE = 0;
1371    const IN_PROGRESS = 1;
1372    const SUCCESSFUL = 2;
1373    const FAILED = 3;
1374}
1375
1376// ===========================================================================
1377// Life safety enums (Clause 12.15, 12.16)
1378// ===========================================================================
1379
1380bacnet_enum! {
1381    /// Life safety point/zone sensor state (Clause 12.15/12.16).
1382    pub struct LifeSafetyState(u32);
1383
1384    const QUIET = 0;
1385    const PRE_ALARM = 1;
1386    const ALARM = 2;
1387    const FAULT = 3;
1388    const FAULT_PRE_ALARM = 4;
1389    const FAULT_ALARM = 5;
1390    const NOT_READY = 6;
1391    const ACTIVE = 7;
1392    const TAMPER = 8;
1393    const TEST_ALARM = 9;
1394    const TEST_ACTIVE = 10;
1395    const TEST_FAULT = 11;
1396    const TEST_FAULT_ALARM = 12;
1397    const HOLDUP = 13;
1398    const DURESS = 14;
1399    const TAMPER_ALARM = 15;
1400    const ABNORMAL = 16;
1401    const EMERGENCY_POWER = 17;
1402    const DELAYED = 18;
1403    const BLOCKED = 19;
1404    const LOCAL_ALARM = 20;
1405    const GENERAL_ALARM = 21;
1406    const SUPERVISORY = 22;
1407    const TEST_SUPERVISORY = 23;
1408}
1409
1410bacnet_enum! {
1411    /// Life safety operating mode (Clause 12.15.12).
1412    pub struct LifeSafetyMode(u32);
1413
1414    const OFF = 0;
1415    const ON = 1;
1416    const TEST = 2;
1417    const MANNED = 3;
1418    const UNMANNED = 4;
1419    const ARMED = 5;
1420    const DISARMED = 6;
1421    const PRE_ARMED = 7;
1422    const SLOW = 8;
1423    const FAST = 9;
1424    const DISCONNECTED = 10;
1425    const ENABLED = 11;
1426    const DISABLED = 12;
1427    const AUTOMATIC_RELEASE_DISABLED = 13;
1428    const DEFAULT = 14;
1429    const ACTIVATED_OEO_ALARM = 15;
1430    const ACTIVATED_OEO_EVACUATE = 16;
1431    const ACTIVATED_OEO_PHASE1_RECALL = 17;
1432    const ACTIVATED_OEO_UNAVAILABLE = 18;
1433    const DEACTIVATED = 19;
1434}
1435
1436bacnet_enum! {
1437    /// Life safety commanded operation (Clause 12.15.13, Table 12-54).
1438    pub struct LifeSafetyOperation(u32);
1439
1440    const NONE = 0;
1441    const SILENCE = 1;
1442    const SILENCE_AUDIBLE = 2;
1443    const SILENCE_VISUAL = 3;
1444    const RESET = 4;
1445    const RESET_ALARM = 5;
1446    const RESET_FAULT = 6;
1447    const UNSILENCE = 7;
1448    const UNSILENCE_AUDIBLE = 8;
1449    const UNSILENCE_VISUAL = 9;
1450}
1451
1452bacnet_enum! {
1453    /// Silenced state for a life safety point/zone (Clause 12.15.14).
1454    pub struct SilencedState(u32);
1455
1456    const UNSILENCED = 0;
1457    const AUDIBLE_SILENCED = 1;
1458    const VISIBLE_SILENCED = 2;
1459    const ALL_SILENCED = 3;
1460}
1461
1462// ===========================================================================
1463// Timer enums (Clause 12.31)
1464// ===========================================================================
1465
1466bacnet_enum! {
1467    /// BACnet timer state (Clause 12.31, new in 135-2020).
1468    pub struct TimerState(u32);
1469
1470    const IDLE = 0;
1471    const RUNNING = 1;
1472    const EXPIRED = 2;
1473}
1474
1475bacnet_enum! {
1476    /// BACnet timer state transition (Clause 12.31, new in 135-2020).
1477    pub struct TimerTransition(u32);
1478
1479    const NONE = 0;
1480    const IDLE_TO_RUNNING = 1;
1481    const RUNNING_TO_IDLE = 2;
1482    const RUNNING_TO_RUNNING = 3;
1483    const RUNNING_TO_EXPIRED = 4;
1484    const FORCED_TO_EXPIRED = 5;
1485    const EXPIRED_TO_IDLE = 6;
1486    const EXPIRED_TO_RUNNING = 7;
1487}
1488
1489// ===========================================================================
1490// Door / access control enums (Clause 12.26, 12.33)
1491// ===========================================================================
1492
1493bacnet_enum! {
1494    /// BACnet door alarm state (Clause 12.26).
1495    pub struct DoorAlarmState(u32);
1496
1497    const NORMAL = 0;
1498    const ALARM = 1;
1499    const DOOR_OPEN_TOO_LONG = 2;
1500    const FORCED_OPEN = 3;
1501    const TAMPER = 4;
1502    const DOOR_FAULT = 5;
1503    const LOCK_FAULT = 6;
1504    const FREE_ACCESS = 7;
1505    const EGRESS_OPEN = 8;
1506}
1507
1508bacnet_enum! {
1509    /// BACnet door status (Clause 12.26).
1510    pub struct DoorStatus(u32);
1511
1512    const CLOSED = 0;
1513    const OPENED = 1;
1514    const UNKNOWN = 2;
1515}
1516
1517bacnet_enum! {
1518    /// BACnet lock status (Clause 12.26).
1519    pub struct LockStatus(u32);
1520
1521    const LOCKED = 0;
1522    const UNLOCKED = 1;
1523    const LOCK_FAULT = 2;
1524    const UNUSED = 3;
1525    const UNKNOWN = 4;
1526}
1527
1528bacnet_enum! {
1529    /// BACnet secured status for Access Door (Clause 12.26).
1530    pub struct DoorSecuredStatus(u32);
1531
1532    const SECURED = 0;
1533    const UNSECURED = 1;
1534    const UNKNOWN = 2;
1535}
1536
1537bacnet_enum! {
1538    /// BACnet access event (Clause 12.33).
1539    pub struct AccessEvent(u32);
1540
1541    const NONE = 0;
1542    const GRANTED = 1;
1543    const MUSTER = 2;
1544    const PASSBACK_DETECTED = 3;
1545    const DURESS = 4;
1546    const TRACE = 5;
1547    const LOCKOUT_MAX_ATTEMPTS = 6;
1548    const LOCKOUT_OTHER = 7;
1549    const LOCKOUT_RELINQUISHED = 8;
1550    const LOCKED_BY_HIGHER_PRIORITY = 9;
1551    const OUT_OF_SERVICE = 10;
1552    const OUT_OF_SERVICE_RELINQUISHED = 11;
1553    const ACCOMPANIMENT_BY = 12;
1554    const AUTHENTICATION_FACTOR_READ = 13;
1555    const AUTHORIZATION_DELAYED = 14;
1556    const VERIFICATION_REQUIRED = 15;
1557    const NO_ENTRY_AFTER_GRANTED = 16;
1558    // Denied events (128+)
1559    const DENIED_DENY_ALL = 128;
1560    const DENIED_UNKNOWN_CREDENTIAL = 129;
1561    const DENIED_AUTHENTICATION_UNAVAILABLE = 130;
1562    const DENIED_AUTHENTICATION_FACTOR_TIMEOUT = 131;
1563    const DENIED_INCORRECT_AUTHENTICATION_FACTOR = 132;
1564    const DENIED_ZONE_NO_ACCESS_RIGHTS = 133;
1565    const DENIED_POINT_NO_ACCESS_RIGHTS = 134;
1566    const DENIED_NO_ACCESS_RIGHTS = 135;
1567    const DENIED_OUT_OF_TIME_RANGE = 136;
1568    const DENIED_THREAT_LEVEL = 137;
1569    const DENIED_PASSBACK = 138;
1570    const DENIED_UNEXPECTED_LOCATION_USAGE = 139;
1571    const DENIED_MAX_ATTEMPTS = 140;
1572    const DENIED_LOWER_OCCUPANCY_LIMIT = 141;
1573    const DENIED_UPPER_OCCUPANCY_LIMIT = 142;
1574    const DENIED_AUTHENTICATION_FACTOR_LOST = 143;
1575    const DENIED_AUTHENTICATION_FACTOR_STOLEN = 144;
1576    const DENIED_AUTHENTICATION_FACTOR_DAMAGED = 145;
1577    const DENIED_AUTHENTICATION_FACTOR_DESTROYED = 146;
1578    const DENIED_AUTHENTICATION_FACTOR_DISABLED = 147;
1579    const DENIED_AUTHENTICATION_FACTOR_ERROR = 148;
1580    const DENIED_CREDENTIAL_UNASSIGNED = 149;
1581    const DENIED_CREDENTIAL_NOT_PROVISIONED = 150;
1582    const DENIED_CREDENTIAL_NOT_YET_ACTIVE = 151;
1583    const DENIED_CREDENTIAL_EXPIRED = 152;
1584    const DENIED_CREDENTIAL_MANUAL_DISABLE = 153;
1585    const DENIED_CREDENTIAL_LOCKOUT = 154;
1586    const DENIED_CREDENTIAL_MAX_DAYS = 155;
1587    const DENIED_CREDENTIAL_MAX_USES = 156;
1588    const DENIED_CREDENTIAL_INACTIVITY = 157;
1589    const DENIED_CREDENTIAL_DISABLED = 158;
1590    const DENIED_NO_ACCOMPANIMENT = 159;
1591    const DENIED_INCORRECT_ACCOMPANIMENT = 160;
1592    const DENIED_LOCKOUT = 161;
1593    const DENIED_VERIFICATION_FAILED = 162;
1594    const DENIED_VERIFICATION_TIMEOUT = 163;
1595    const DENIED_OTHER = 164;
1596}
1597
1598bacnet_enum! {
1599    /// BACnet access credential disable (Clause 21).
1600    pub struct AccessCredentialDisable(u32);
1601
1602    const NONE = 0;
1603    const DISABLE = 1;
1604    const DISABLE_MANUAL = 2;
1605    const DISABLE_LOCKOUT = 3;
1606}
1607
1608bacnet_enum! {
1609    /// BACnet access credential disable reason (Clause 21).
1610    pub struct AccessCredentialDisableReason(u32);
1611
1612    const DISABLED = 0;
1613    const DISABLED_NEEDS_PROVISIONING = 1;
1614    const DISABLED_UNASSIGNED = 2;
1615    const DISABLED_NOT_YET_ACTIVE = 3;
1616    const DISABLED_EXPIRED = 4;
1617    const DISABLED_LOCKOUT = 5;
1618    const DISABLED_MAX_DAYS = 6;
1619    const DISABLED_MAX_USES = 7;
1620    const DISABLED_INACTIVITY = 8;
1621    const DISABLED_MANUAL = 9;
1622}
1623
1624bacnet_enum! {
1625    /// BACnet access user type (Clause 12.35).
1626    pub struct AccessUserType(u32);
1627
1628    const ASSET = 0;
1629    const GROUP = 1;
1630    const PERSON = 2;
1631}
1632
1633bacnet_enum! {
1634    /// BACnet authorization mode (Clause 12.31).
1635    pub struct AuthorizationMode(u32);
1636
1637    const AUTHORIZE = 0;
1638    const GRANT_ACTIVE = 1;
1639    const DENY_ALL = 2;
1640    const VERIFICATION_REQUIRED = 3;
1641    const AUTHORIZATION_DELAYED = 4;
1642    const NONE = 5;
1643}
1644
1645bacnet_enum! {
1646    /// BACnet access passback mode (Clause 12.32).
1647    pub struct AccessPassbackMode(u32);
1648
1649    const PASSBACK_OFF = 0;
1650    const HARD_PASSBACK = 1;
1651    const SOFT_PASSBACK = 2;
1652}
1653
1654// ===========================================================================
1655// Lighting enums (Clause 12.54)
1656// ===========================================================================
1657
1658bacnet_enum! {
1659    /// BACnet lighting operation (Clause 12.54).
1660    pub struct LightingOperation(u32);
1661
1662    const NONE = 0;
1663    const FADE_TO = 1;
1664    const RAMP_TO = 2;
1665    const STEP_UP = 3;
1666    const STEP_DOWN = 4;
1667    const STEP_ON = 5;
1668    const STEP_OFF = 6;
1669    const WARN = 7;
1670    const WARN_OFF = 8;
1671    const WARN_RELINQUISH = 9;
1672    const STOP = 10;
1673}
1674
1675bacnet_enum! {
1676    /// BACnet lighting in-progress state (Clause 12.54).
1677    pub struct LightingInProgress(u32);
1678
1679    const IDLE = 0;
1680    const FADE_ACTIVE = 1;
1681    const RAMP_ACTIVE = 2;
1682    const NOT_CONTROLLED = 3;
1683    const OTHER = 4;
1684}
1685
1686// ===========================================================================
1687// Lift / escalator enums (Clause 12.58-12.60)
1688// ===========================================================================
1689
1690bacnet_enum! {
1691    /// BACnet escalator operating mode (Clause 12.60).
1692    pub struct EscalatorMode(u32);
1693
1694    const UNKNOWN = 0;
1695    const STOP = 1;
1696    const UP = 2;
1697    const DOWN = 3;
1698    const INSPECTION = 4;
1699    const OUT_OF_SERVICE = 5;
1700}
1701
1702bacnet_enum! {
1703    /// BACnet escalator fault signals (Clause 12.60).
1704    pub struct EscalatorFault(u32);
1705
1706    const CONTROLLER_FAULT = 0;
1707    const DRIVE_AND_MOTOR_FAULT = 1;
1708    const MECHANICAL_COMPONENT_FAULT = 2;
1709    const OVERSPEED_FAULT = 3;
1710    const POWER_SUPPLY_FAULT = 4;
1711    const SAFETY_DEVICE_FAULT = 5;
1712    const CONTROLLER_SUPPLY_FAULT = 6;
1713    const DRIVE_TEMPERATURE_EXCEEDED = 7;
1714    const COMB_PLATE_FAULT = 8;
1715}
1716
1717bacnet_enum! {
1718    /// BACnet lift car travel direction (Clause 12.59).
1719    pub struct LiftCarDirection(u32);
1720
1721    const UNKNOWN = 0;
1722    const NONE = 1;
1723    const STOPPED = 2;
1724    const UP = 3;
1725    const DOWN = 4;
1726    const UP_AND_DOWN = 5;
1727}
1728
1729bacnet_enum! {
1730    /// BACnet lift group operating mode (Clause 12.58).
1731    pub struct LiftGroupMode(u32);
1732
1733    const UNKNOWN = 0;
1734    const NORMAL = 1;
1735    const DOWN_PEAK = 2;
1736    const TWO_WAY = 3;
1737    const FOUR_WAY = 4;
1738    const EMERGENCY_POWER = 5;
1739    const UP_PEAK = 6;
1740}
1741
1742bacnet_enum! {
1743    /// BACnet lift car door status (Clause 12.59).
1744    pub struct LiftCarDoorStatus(u32);
1745
1746    const UNKNOWN = 0;
1747    const NONE = 1;
1748    const CLOSING = 2;
1749    const CLOSED = 3;
1750    const OPENING = 4;
1751    const OPENED = 5;
1752    const SAFETY_LOCKED = 6;
1753    const LIMITED_OPENED = 7;
1754}
1755
1756bacnet_enum! {
1757    /// BACnet lift car door command (Clause 21).
1758    pub struct LiftCarDoorCommand(u32);
1759
1760    const NONE = 0;
1761    const OPEN = 1;
1762    const CLOSE = 2;
1763}
1764
1765bacnet_enum! {
1766    /// BACnet lift car drive status (Clause 21).
1767    pub struct LiftCarDriveStatus(u32);
1768
1769    const UNKNOWN = 0;
1770    const STATIONARY = 1;
1771    const BRAKING = 2;
1772    const ACCELERATE = 3;
1773    const DECELERATE = 4;
1774    const RATED_SPEED = 5;
1775    const SINGLE_FLOOR_JUMP = 6;
1776    const TWO_FLOOR_JUMP = 7;
1777    const THREE_FLOOR_JUMP = 8;
1778    const MULTI_FLOOR_JUMP = 9;
1779}
1780
1781bacnet_enum! {
1782    /// BACnet lift car operating mode (Clause 21).
1783    pub struct LiftCarMode(u32);
1784
1785    const UNKNOWN = 0;
1786    const NORMAL = 1;
1787    const VIP = 2;
1788    const HOMING = 3;
1789    const PARKING = 4;
1790    const ATTENDANT_CONTROL = 5;
1791    const FIREFIGHTER_CONTROL = 6;
1792    const EMERGENCY_POWER = 7;
1793    const INSPECTION = 8;
1794    const CABINET_RECALL = 9;
1795    const EARTHQUAKE_OPERATION = 10;
1796    const FIRE_OPERATION = 11;
1797    const OUT_OF_SERVICE = 12;
1798    const OCCUPANT_EVACUATION = 13;
1799}
1800
1801bacnet_enum! {
1802    /// BACnet lift fault signals (Clause 21).
1803    pub struct LiftFault(u32);
1804
1805    const CONTROLLER_FAULT = 0;
1806    const DRIVE_AND_MOTOR_FAULT = 1;
1807    const GOVERNOR_AND_SAFETY_GEAR_FAULT = 2;
1808    const LIFT_SHAFT_DEVICE_FAULT = 3;
1809    const POWER_SUPPLY_FAULT = 4;
1810    const SAFETY_INTERLOCK_FAULT = 5;
1811    const DOOR_CLOSING_FAULT = 6;
1812    const DOOR_OPENING_FAULT = 7;
1813    const CAR_STOPPED_OUTSIDE_LANDING_ZONE = 8;
1814    const CALL_BUTTON_STUCK = 9;
1815    const START_FAILURE = 10;
1816    const CONTROLLER_SUPPLY_FAULT = 11;
1817    const SELF_TEST_FAILURE = 12;
1818    const RUNTIME_LIMIT_EXCEEDED = 13;
1819    const POSITION_LOST = 14;
1820    const DRIVE_TEMPERATURE_EXCEEDED = 15;
1821    const LOAD_MEASUREMENT_FAULT = 16;
1822}
1823
1824// ===========================================================================
1825// Miscellaneous enums
1826// ===========================================================================
1827
1828bacnet_enum! {
1829    /// BACnet load control shed state (Clause 12.28).
1830    pub struct ShedState(u32);
1831
1832    const SHED_INACTIVE = 0;
1833    const SHED_REQUEST_PENDING = 1;
1834    const SHED_COMPLIANT = 2;
1835    const SHED_NON_COMPLIANT = 3;
1836}
1837
1838bacnet_enum! {
1839    /// BACnet node type for Structured View (Clause 12.29).
1840    pub struct NodeType(u32);
1841
1842    const UNKNOWN = 0;
1843    const SYSTEM = 1;
1844    const NETWORK = 2;
1845    const DEVICE = 3;
1846    const ORGANIZATIONAL = 4;
1847    const AREA = 5;
1848    const EQUIPMENT = 6;
1849    const POINT = 7;
1850    const COLLECTION = 8;
1851    const PROPERTY = 9;
1852    const FUNCTIONAL = 10;
1853    const OTHER = 11;
1854    const SUBSYSTEM = 12;
1855    const BUILDING = 13;
1856    const FLOOR = 14;
1857    const SECTION = 15;
1858    const MODULE = 16;
1859    const TREE = 17;
1860    const MEMBER = 18;
1861    const PROTOCOL = 19;
1862    const ROOM = 20;
1863    const ZONE = 21;
1864}
1865
1866bacnet_enum! {
1867    /// BACnet acknowledgment filter for GetEnrollmentSummary (Clause 13.7.1).
1868    pub struct AcknowledgmentFilter(u32);
1869
1870    const ALL = 0;
1871    const ACKED = 1;
1872    const NOT_ACKED = 2;
1873}
1874
1875bacnet_enum! {
1876    /// Event transition bit positions (Clause 12.11).
1877    pub struct EventTransitionBits(u8);
1878
1879    const TO_OFFNORMAL = 0;
1880    const TO_FAULT = 1;
1881    const TO_NORMAL = 2;
1882}
1883
1884bacnet_enum! {
1885    /// BACnet message priority for TextMessage services (Clause 16.5).
1886    pub struct MessagePriority(u32);
1887
1888    const NORMAL = 0;
1889    const URGENT = 1;
1890}
1891
1892bacnet_enum! {
1893    /// BACnet virtual terminal class (Clause 17.1).
1894    pub struct VTClass(u32);
1895
1896    const DEFAULT_TERMINAL = 0;
1897    const ANSI_X3_64 = 1;
1898    const DEC_VT52 = 2;
1899    const DEC_VT100 = 3;
1900    const DEC_VT220 = 4;
1901    const HP_700_94 = 5;
1902    const IBM_3130 = 6;
1903}
1904
1905// ===========================================================================
1906// Staging / Audit enums (new in 135-2020)
1907// ===========================================================================
1908
1909bacnet_enum! {
1910    /// BACnet staging state (Clause 12.62, new in 135-2020).
1911    pub struct StagingState(u32);
1912
1913    const NOT_STAGED = 0;
1914    const STAGING = 1;
1915    const STAGED = 2;
1916    const COMMITTING = 3;
1917    const COMMITTED = 4;
1918    const ABANDONING = 5;
1919    const ABANDONED = 6;
1920}
1921
1922bacnet_enum! {
1923    /// BACnet audit level (Clause 19.6, new in 135-2020).
1924    pub struct AuditLevel(u32);
1925
1926    const NONE = 0;
1927    const AUDIT_ALL = 1;
1928    const AUDIT_CONFIG = 2;
1929    const DEFAULT = 3;
1930}
1931
1932bacnet_enum! {
1933    /// BACnet audit operation (Clause 19.6, new in 135-2020).
1934    pub struct AuditOperation(u32);
1935
1936    const READ = 0;
1937    const WRITE = 1;
1938    const CREATE = 2;
1939    const DELETE = 3;
1940    const LIFE_SAFETY = 4;
1941    const ACKNOWLEDGE_ALARM = 5;
1942    const DEVICE_DISABLE_COMM = 6;
1943    const DEVICE_ENABLE_COMM = 7;
1944    const DEVICE_RESET = 8;
1945    const DEVICE_BACKUP = 9;
1946    const DEVICE_RESTORE = 10;
1947    const SUBSCRIPTION = 11;
1948    const NOTIFICATION = 12;
1949    const AUDITING_FAILURE = 13;
1950    const NETWORK_CHANGES = 14;
1951    const GENERAL = 15;
1952}
1953
1954bacnet_enum! {
1955    /// BACnet success filter for audit log queries (Clause 13.19, new in 135-2020).
1956    pub struct BACnetSuccessFilter(u32);
1957
1958    const ALL = 0;
1959    const SUCCESSES_ONLY = 1;
1960    const FAILURES_ONLY = 2;
1961}
1962
1963// ===========================================================================
1964// EngineeringUnits (Clause 21) — large enum, grouped by category
1965// ===========================================================================
1966
1967bacnet_enum! {
1968    /// BACnet engineering units (Clause 21).
1969    ///
1970    /// Values 0-255 and 47808-49999 are reserved for ASHRAE;
1971    /// 256-47807 and 50000-65535 may be used by vendors (Clause 23).
1972    pub struct EngineeringUnits(u32);
1973
1974    // Acceleration
1975    const METERS_PER_SECOND_PER_SECOND = 166;
1976    // Area
1977    const SQUARE_METERS = 0;
1978    const SQUARE_CENTIMETERS = 116;
1979    const SQUARE_FEET = 1;
1980    const SQUARE_INCHES = 115;
1981    // Currency
1982    const CURRENCY1 = 105;
1983    const CURRENCY2 = 106;
1984    const CURRENCY3 = 107;
1985    const CURRENCY4 = 108;
1986    const CURRENCY5 = 109;
1987    const CURRENCY6 = 110;
1988    const CURRENCY7 = 111;
1989    const CURRENCY8 = 112;
1990    const CURRENCY9 = 113;
1991    const CURRENCY10 = 114;
1992    // Electrical
1993    const MILLIAMPERES = 2;
1994    const AMPERES = 3;
1995    const AMPERES_PER_METER = 167;
1996    const AMPERES_PER_SQUARE_METER = 168;
1997    const AMPERE_SQUARE_METERS = 169;
1998    const DECIBELS = 199;
1999    const DECIBELS_MILLIVOLT = 200;
2000    const DECIBELS_VOLT = 201;
2001    const FARADS = 170;
2002    const HENRYS = 171;
2003    const OHMS = 4;
2004    const OHM_METER_SQUARED_PER_METER = 237;
2005    const OHM_METERS = 172;
2006    const MILLIOHMS = 145;
2007    const KILOHMS = 122;
2008    const MEGOHMS = 123;
2009    const MICROSIEMENS = 190;
2010    const MILLISIEMENS = 202;
2011    const SIEMENS = 173;
2012    const SIEMENS_PER_METER = 174;
2013    const TESLAS = 175;
2014    const VOLTS = 5;
2015    const MILLIVOLTS = 124;
2016    const KILOVOLTS = 6;
2017    const MEGAVOLTS = 7;
2018    const VOLT_AMPERES = 8;
2019    const KILOVOLT_AMPERES = 9;
2020    const MEGAVOLT_AMPERES = 10;
2021    const VOLT_AMPERES_REACTIVE = 11;
2022    const KILOVOLT_AMPERES_REACTIVE = 12;
2023    const MEGAVOLT_AMPERES_REACTIVE = 13;
2024    const VOLTS_PER_DEGREE_KELVIN = 176;
2025    const VOLTS_PER_METER = 177;
2026    const DEGREES_PHASE = 14;
2027    const POWER_FACTOR = 15;
2028    const WEBERS = 178;
2029    // Energy
2030    const AMPERE_SECONDS = 238;
2031    const VOLT_AMPERE_HOURS = 239;
2032    const KILOVOLT_AMPERE_HOURS = 240;
2033    const MEGAVOLT_AMPERE_HOURS = 241;
2034    const VOLT_AMPERE_HOURS_REACTIVE = 242;
2035    const KILOVOLT_AMPERE_HOURS_REACTIVE = 243;
2036    const MEGAVOLT_AMPERE_HOURS_REACTIVE = 244;
2037    const VOLT_SQUARE_HOURS = 245;
2038    const AMPERE_SQUARE_HOURS = 246;
2039    const JOULES = 16;
2040    const KILOJOULES = 17;
2041    const KILOJOULES_PER_KILOGRAM = 125;
2042    const MEGAJOULES = 126;
2043    const WATT_HOURS = 18;
2044    const KILOWATT_HOURS = 19;
2045    const MEGAWATT_HOURS = 146;
2046    const WATT_HOURS_REACTIVE = 203;
2047    const KILOWATT_HOURS_REACTIVE = 204;
2048    const MEGAWATT_HOURS_REACTIVE = 205;
2049    const BTUS = 20;
2050    const KILO_BTUS = 147;
2051    const MEGA_BTUS = 148;
2052    const THERMS = 21;
2053    const TON_HOURS = 22;
2054    // Enthalpy
2055    const JOULES_PER_KILOGRAM_DRY_AIR = 23;
2056    const KILOJOULES_PER_KILOGRAM_DRY_AIR = 149;
2057    const MEGAJOULES_PER_KILOGRAM_DRY_AIR = 150;
2058    const BTUS_PER_POUND_DRY_AIR = 24;
2059    const BTUS_PER_POUND = 117;
2060    // Entropy
2061    const JOULES_PER_DEGREE_KELVIN = 127;
2062    const KILOJOULES_PER_DEGREE_KELVIN = 151;
2063    const MEGAJOULES_PER_DEGREE_KELVIN = 152;
2064    const JOULES_PER_KILOGRAM_DEGREE_KELVIN = 128;
2065    // Force
2066    const NEWTON = 153;
2067    // Frequency
2068    const CYCLES_PER_HOUR = 25;
2069    const CYCLES_PER_MINUTE = 26;
2070    const HERTZ = 27;
2071    const KILOHERTZ = 129;
2072    const MEGAHERTZ = 130;
2073    const PER_HOUR = 131;
2074    // Humidity
2075    const GRAMS_OF_WATER_PER_KILOGRAM_DRY_AIR = 28;
2076    const PERCENT_RELATIVE_HUMIDITY = 29;
2077    // Length
2078    const MICROMETERS = 194;
2079    const MILLIMETERS = 30;
2080    const CENTIMETERS = 118;
2081    const KILOMETERS = 193;
2082    const METERS = 31;
2083    const INCHES = 32;
2084    const FEET = 33;
2085    // Light
2086    const CANDELAS = 179;
2087    const CANDELAS_PER_SQUARE_METER = 180;
2088    const WATTS_PER_SQUARE_FOOT = 34;
2089    const WATTS_PER_SQUARE_METER = 35;
2090    const LUMENS = 36;
2091    const LUXES = 37;
2092    const FOOT_CANDLES = 38;
2093    // Mass
2094    const MILLIGRAMS = 196;
2095    const GRAMS = 195;
2096    const KILOGRAMS = 39;
2097    const POUNDS_MASS = 40;
2098    const TONS = 41;
2099    // Mass flow
2100    const GRAMS_PER_SECOND = 154;
2101    const GRAMS_PER_MINUTE = 155;
2102    const KILOGRAMS_PER_SECOND = 42;
2103    const KILOGRAMS_PER_MINUTE = 43;
2104    const KILOGRAMS_PER_HOUR = 44;
2105    const POUNDS_MASS_PER_SECOND = 119;
2106    const POUNDS_MASS_PER_MINUTE = 45;
2107    const POUNDS_MASS_PER_HOUR = 46;
2108    const TONS_PER_HOUR = 156;
2109    // Power
2110    const MILLIWATTS = 132;
2111    const WATTS = 47;
2112    const KILOWATTS = 48;
2113    const MEGAWATTS = 49;
2114    const BTUS_PER_HOUR = 50;
2115    const KILO_BTUS_PER_HOUR = 157;
2116    const JOULE_PER_HOURS = 247;
2117    const HORSEPOWER = 51;
2118    const TONS_REFRIGERATION = 52;
2119    // Pressure
2120    const PASCALS = 53;
2121    const HECTOPASCALS = 133;
2122    const KILOPASCALS = 54;
2123    const MILLIBARS = 134;
2124    const BARS = 55;
2125    const POUNDS_FORCE_PER_SQUARE_INCH = 56;
2126    const MILLIMETERS_OF_WATER = 206;
2127    const CENTIMETERS_OF_WATER = 57;
2128    const INCHES_OF_WATER = 58;
2129    const MILLIMETERS_OF_MERCURY = 59;
2130    const CENTIMETERS_OF_MERCURY = 60;
2131    const INCHES_OF_MERCURY = 61;
2132    // Temperature
2133    const DEGREES_CELSIUS = 62;
2134    const DEGREES_KELVIN = 63;
2135    const DEGREES_KELVIN_PER_HOUR = 181;
2136    const DEGREES_KELVIN_PER_MINUTE = 182;
2137    const DEGREES_FAHRENHEIT = 64;
2138    const DEGREE_DAYS_CELSIUS = 65;
2139    const DEGREE_DAYS_FAHRENHEIT = 66;
2140    const DELTA_DEGREES_FAHRENHEIT = 120;
2141    const DELTA_DEGREES_KELVIN = 121;
2142    // Time
2143    const YEARS = 67;
2144    const MONTHS = 68;
2145    const WEEKS = 69;
2146    const DAYS = 70;
2147    const HOURS = 71;
2148    const MINUTES = 72;
2149    const SECONDS = 73;
2150    const HUNDREDTHS_SECONDS = 158;
2151    const MILLISECONDS = 159;
2152    // Torque
2153    const NEWTON_METERS = 160;
2154    // Velocity
2155    const MILLIMETERS_PER_SECOND = 161;
2156    const MILLIMETERS_PER_MINUTE = 162;
2157    const METERS_PER_SECOND = 74;
2158    const METERS_PER_MINUTE = 163;
2159    const METERS_PER_HOUR = 164;
2160    const KILOMETERS_PER_HOUR = 75;
2161    const FEET_PER_SECOND = 76;
2162    const FEET_PER_MINUTE = 77;
2163    const MILES_PER_HOUR = 78;
2164    // Volume
2165    const CUBIC_FEET = 79;
2166    const CUBIC_METERS = 80;
2167    const IMPERIAL_GALLONS = 81;
2168    const MILLILITERS = 197;
2169    const LITERS = 82;
2170    const US_GALLONS = 83;
2171    // Volumetric flow
2172    const CUBIC_FEET_PER_SECOND = 142;
2173    const CUBIC_FEET_PER_MINUTE = 84;
2174    const MILLION_STANDARD_CUBIC_FEET_PER_MINUTE = 254;
2175    const CUBIC_FEET_PER_HOUR = 191;
2176    const CUBIC_FEET_PER_DAY = 248;
2177    const STANDARD_CUBIC_FEET_PER_DAY = 47808;
2178    const MILLION_STANDARD_CUBIC_FEET_PER_DAY = 47809;
2179    const THOUSAND_CUBIC_FEET_PER_DAY = 47810;
2180    const THOUSAND_STANDARD_CUBIC_FEET_PER_DAY = 47811;
2181    const POUNDS_MASS_PER_DAY = 47812;
2182    const CUBIC_METERS_PER_SECOND = 85;
2183    const CUBIC_METERS_PER_MINUTE = 165;
2184    const CUBIC_METERS_PER_HOUR = 135;
2185    const CUBIC_METERS_PER_DAY = 249;
2186    const IMPERIAL_GALLONS_PER_MINUTE = 86;
2187    const MILLILITERS_PER_SECOND = 198;
2188    const LITERS_PER_SECOND = 87;
2189    const LITERS_PER_MINUTE = 88;
2190    const LITERS_PER_HOUR = 136;
2191    const US_GALLONS_PER_MINUTE = 89;
2192    const US_GALLONS_PER_HOUR = 192;
2193    // Other
2194    const DEGREES_ANGULAR = 90;
2195    const DEGREES_CELSIUS_PER_HOUR = 91;
2196    const DEGREES_CELSIUS_PER_MINUTE = 92;
2197    const DEGREES_FAHRENHEIT_PER_HOUR = 93;
2198    const DEGREES_FAHRENHEIT_PER_MINUTE = 94;
2199    const JOULE_SECONDS = 183;
2200    const KILOGRAMS_PER_CUBIC_METER = 186;
2201    const KILOWATT_HOURS_PER_SQUARE_METER = 137;
2202    const KILOWATT_HOURS_PER_SQUARE_FOOT = 138;
2203    const WATT_HOURS_PER_CUBIC_METER = 250;
2204    const JOULES_PER_CUBIC_METER = 251;
2205    const MEGAJOULES_PER_SQUARE_METER = 139;
2206    const MEGAJOULES_PER_SQUARE_FOOT = 140;
2207    const MOLE_PERCENT = 252;
2208    const NO_UNITS = 95;
2209    const NEWTON_SECONDS = 187;
2210    const NEWTONS_PER_METER = 188;
2211    const PARTS_PER_MILLION = 96;
2212    const PARTS_PER_BILLION = 97;
2213    const PASCAL_SECONDS = 253;
2214    const PERCENT = 98;
2215    const PERCENT_OBSCURATION_PER_FOOT = 143;
2216    const PERCENT_OBSCURATION_PER_METER = 144;
2217    const PERCENT_PER_SECOND = 99;
2218    const PER_MINUTE = 100;
2219    const PER_SECOND = 101;
2220    const PSI_PER_DEGREE_FAHRENHEIT = 102;
2221    const RADIANS = 103;
2222    const RADIANS_PER_SECOND = 184;
2223    const REVOLUTIONS_PER_MINUTE = 104;
2224    const SQUARE_METERS_PER_NEWTON = 185;
2225    const WATTS_PER_METER_PER_DEGREE_KELVIN = 189;
2226    const WATTS_PER_SQUARE_METER_DEGREE_KELVIN = 141;
2227    const PER_MILLE = 207;
2228    const GRAMS_PER_GRAM = 208;
2229    const KILOGRAMS_PER_KILOGRAM = 209;
2230    const GRAMS_PER_KILOGRAM = 210;
2231    const MILLIGRAMS_PER_GRAM = 211;
2232    const MILLIGRAMS_PER_KILOGRAM = 212;
2233    const GRAMS_PER_MILLILITER = 213;
2234    const GRAMS_PER_LITER = 214;
2235    const MILLIGRAMS_PER_LITER = 215;
2236    const MICROGRAMS_PER_LITER = 216;
2237    const GRAMS_PER_CUBIC_METER = 217;
2238    const MILLIGRAMS_PER_CUBIC_METER = 218;
2239    const MICROGRAMS_PER_CUBIC_METER = 219;
2240    const NANOGRAMS_PER_CUBIC_METER = 220;
2241    const GRAMS_PER_CUBIC_CENTIMETER = 221;
2242    const BECQUERELS = 222;
2243    const KILOBECQUERELS = 223;
2244    const MEGABECQUERELS = 224;
2245    const GRAY = 225;
2246    const MILLIGRAY = 226;
2247    const MICROGRAY = 227;
2248    const SIEVERTS = 228;
2249    const MILLISIEVERTS = 229;
2250    const MICROSIEVERTS = 230;
2251    const MICROSIEVERTS_PER_HOUR = 231;
2252    const MILLIREMS = 47814;
2253    const MILLIREMS_PER_HOUR = 47815;
2254    const DECIBELS_A = 232;
2255    const NEPHELOMETRIC_TURBIDITY_UNIT = 233;
2256    const PH = 234;
2257    const GRAMS_PER_SQUARE_METER = 235;
2258    const MINUTES_PER_DEGREE_KELVIN = 236;
2259    const DEGREES_LOVIBOND = 47816;
2260    const ALCOHOL_BY_VOLUME = 47817;
2261    const INTERNATIONAL_BITTERING_UNITS = 47818;
2262    const EUROPEAN_BITTERNESS_UNITS = 47819;
2263    const DEGREES_PLATO = 47820;
2264    const SPECIFIC_GRAVITY = 47821;
2265    const EUROPEAN_BREWING_CONVENTION = 47822;
2266}
2267
2268// ===========================================================================
2269// Tests
2270// ===========================================================================
2271
2272#[cfg(test)]
2273mod tests {
2274    use super::*;
2275
2276    #[test]
2277    fn object_type_round_trip() {
2278        assert_eq!(ObjectType::DEVICE.to_raw(), 8);
2279        assert_eq!(ObjectType::from_raw(8), ObjectType::DEVICE);
2280    }
2281
2282    #[test]
2283    fn object_type_vendor_proprietary() {
2284        let vendor = ObjectType::from_raw(128);
2285        assert_eq!(vendor.to_raw(), 128);
2286        assert_eq!(format!("{}", vendor), "128");
2287        assert_eq!(format!("{:?}", vendor), "ObjectType(128)");
2288    }
2289
2290    #[test]
2291    fn object_type_display_known() {
2292        assert_eq!(format!("{}", ObjectType::ANALOG_INPUT), "ANALOG_INPUT");
2293        assert_eq!(format!("{:?}", ObjectType::DEVICE), "ObjectType::DEVICE");
2294    }
2295
2296    #[test]
2297    fn property_identifier_round_trip() {
2298        assert_eq!(PropertyIdentifier::PRESENT_VALUE.to_raw(), 85);
2299        assert_eq!(
2300            PropertyIdentifier::from_raw(85),
2301            PropertyIdentifier::PRESENT_VALUE
2302        );
2303    }
2304
2305    #[test]
2306    fn property_identifier_vendor() {
2307        let vendor = PropertyIdentifier::from_raw(512);
2308        assert_eq!(vendor.to_raw(), 512);
2309    }
2310
2311    #[test]
2312    fn pdu_type_values() {
2313        assert_eq!(PduType::CONFIRMED_REQUEST.to_raw(), 0);
2314        assert_eq!(PduType::ABORT.to_raw(), 7);
2315    }
2316
2317    #[test]
2318    fn confirmed_service_choice_values() {
2319        assert_eq!(ConfirmedServiceChoice::READ_PROPERTY.to_raw(), 12);
2320        assert_eq!(ConfirmedServiceChoice::WRITE_PROPERTY.to_raw(), 15);
2321    }
2322
2323    #[test]
2324    fn unconfirmed_service_choice_values() {
2325        assert_eq!(UnconfirmedServiceChoice::WHO_IS.to_raw(), 8);
2326        assert_eq!(UnconfirmedServiceChoice::I_AM.to_raw(), 0);
2327    }
2328
2329    #[test]
2330    fn bvlc_function_values() {
2331        assert_eq!(BvlcFunction::ORIGINAL_UNICAST_NPDU.to_raw(), 0x0A);
2332        assert_eq!(BvlcFunction::ORIGINAL_BROADCAST_NPDU.to_raw(), 0x0B);
2333    }
2334
2335    #[test]
2336    fn engineering_units_round_trip() {
2337        assert_eq!(EngineeringUnits::DEGREES_CELSIUS.to_raw(), 62);
2338        assert_eq!(
2339            EngineeringUnits::from_raw(62),
2340            EngineeringUnits::DEGREES_CELSIUS
2341        );
2342    }
2343
2344    #[test]
2345    fn engineering_units_ashrae_extended() {
2346        assert_eq!(
2347            EngineeringUnits::STANDARD_CUBIC_FEET_PER_DAY.to_raw(),
2348            47808
2349        );
2350    }
2351
2352    #[test]
2353    fn segmentation_values() {
2354        assert_eq!(Segmentation::BOTH.to_raw(), 0);
2355        assert_eq!(Segmentation::NONE.to_raw(), 3);
2356    }
2357
2358    #[test]
2359    fn network_message_type_values() {
2360        assert_eq!(NetworkMessageType::WHO_IS_ROUTER_TO_NETWORK.to_raw(), 0x00);
2361        assert_eq!(NetworkMessageType::NETWORK_NUMBER_IS.to_raw(), 0x13);
2362    }
2363
2364    #[test]
2365    fn event_state_values() {
2366        assert_eq!(EventState::NORMAL.to_raw(), 0);
2367        assert_eq!(EventState::LIFE_SAFETY_ALARM.to_raw(), 5);
2368    }
2369
2370    #[test]
2371    fn reliability_gap_at_11() {
2372        // Value 11 is intentionally missing from the standard
2373        assert_eq!(Reliability::CONFIGURATION_ERROR.to_raw(), 10);
2374        assert_eq!(Reliability::COMMUNICATION_FAILURE.to_raw(), 12);
2375    }
2376}