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}
1430
1431bacnet_enum! {
1432    /// Life safety commanded operation (Clause 12.15.13).
1433    pub struct LifeSafetyOperation(u32);
1434
1435    const NONE = 0;
1436    const SILENCE = 1;
1437    const SILENCE_AUDIBLE = 2;
1438    const SILENCE_VISUAL = 3;
1439    const SILENCE_ALL = 4;
1440    const UNSILENCE = 5;
1441    const UNSILENCE_AUDIBLE = 6;
1442    const UNSILENCE_VISUAL = 7;
1443    const UNSILENCE_ALL = 8;
1444    const RESET = 9;
1445    const RESET_ALARM = 10;
1446    const RESET_FAULT = 11;
1447}
1448
1449bacnet_enum! {
1450    /// Silenced state for a life safety point/zone (Clause 12.15.14).
1451    pub struct SilencedState(u32);
1452
1453    const UNSILENCED = 0;
1454    const AUDIBLE_SILENCED = 1;
1455    const VISIBLE_SILENCED = 2;
1456    const ALL_SILENCED = 3;
1457}
1458
1459// ===========================================================================
1460// Timer enums (Clause 12.31)
1461// ===========================================================================
1462
1463bacnet_enum! {
1464    /// BACnet timer state (Clause 12.31, new in 135-2020).
1465    pub struct TimerState(u32);
1466
1467    const IDLE = 0;
1468    const RUNNING = 1;
1469    const EXPIRED = 2;
1470}
1471
1472bacnet_enum! {
1473    /// BACnet timer state transition (Clause 12.31, new in 135-2020).
1474    pub struct TimerTransition(u32);
1475
1476    const NONE = 0;
1477    const IDLE_TO_RUNNING = 1;
1478    const RUNNING_TO_IDLE = 2;
1479    const RUNNING_TO_RUNNING = 3;
1480    const RUNNING_TO_EXPIRED = 4;
1481    const FORCED_TO_EXPIRED = 5;
1482    const EXPIRED_TO_IDLE = 6;
1483    const EXPIRED_TO_RUNNING = 7;
1484}
1485
1486// ===========================================================================
1487// Door / access control enums (Clause 12.26, 12.33)
1488// ===========================================================================
1489
1490bacnet_enum! {
1491    /// BACnet door alarm state (Clause 12.26).
1492    pub struct DoorAlarmState(u32);
1493
1494    const NORMAL = 0;
1495    const ALARM = 1;
1496    const DOOR_OPEN_TOO_LONG = 2;
1497    const FORCED_OPEN = 3;
1498    const TAMPER = 4;
1499    const DOOR_FAULT = 5;
1500    const LOCK_FAULT = 6;
1501    const FREE_ACCESS = 7;
1502    const EGRESS_OPEN = 8;
1503}
1504
1505bacnet_enum! {
1506    /// BACnet door status (Clause 12.26).
1507    pub struct DoorStatus(u32);
1508
1509    const CLOSED = 0;
1510    const OPENED = 1;
1511    const UNKNOWN = 2;
1512}
1513
1514bacnet_enum! {
1515    /// BACnet lock status (Clause 12.26).
1516    pub struct LockStatus(u32);
1517
1518    const LOCKED = 0;
1519    const UNLOCKED = 1;
1520    const LOCK_FAULT = 2;
1521    const UNUSED = 3;
1522    const UNKNOWN = 4;
1523}
1524
1525bacnet_enum! {
1526    /// BACnet secured status for Access Door (Clause 12.26).
1527    pub struct DoorSecuredStatus(u32);
1528
1529    const SECURED = 0;
1530    const UNSECURED = 1;
1531    const UNKNOWN = 2;
1532}
1533
1534bacnet_enum! {
1535    /// BACnet access event (Clause 12.33).
1536    pub struct AccessEvent(u32);
1537
1538    const NONE = 0;
1539    const GRANTED = 1;
1540    const MUSTER = 2;
1541    const PASSBACK_DETECTED = 3;
1542    const DURESS = 4;
1543    const TRACE = 5;
1544    const LOCKOUT_MAX_ATTEMPTS = 6;
1545    const LOCKOUT_OTHER = 7;
1546    const LOCKOUT_RELINQUISHED = 8;
1547    const LOCKED_BY_HIGHER_PRIORITY = 9;
1548    const OUT_OF_SERVICE = 10;
1549    const OUT_OF_SERVICE_RELINQUISHED = 11;
1550    const ACCOMPANIMENT_BY = 12;
1551    const AUTHENTICATION_FACTOR_READ = 13;
1552    const AUTHORIZATION_DELAYED = 14;
1553    const VERIFICATION_REQUIRED = 15;
1554    const NO_ENTRY_AFTER_GRANTED = 16;
1555    // Denied events (128+)
1556    const DENIED_DENY_ALL = 128;
1557    const DENIED_UNKNOWN_CREDENTIAL = 129;
1558    const DENIED_AUTHENTICATION_UNAVAILABLE = 130;
1559    const DENIED_AUTHENTICATION_FACTOR_TIMEOUT = 131;
1560    const DENIED_INCORRECT_AUTHENTICATION_FACTOR = 132;
1561    const DENIED_ZONE_NO_ACCESS_RIGHTS = 133;
1562    const DENIED_POINT_NO_ACCESS_RIGHTS = 134;
1563    const DENIED_NO_ACCESS_RIGHTS = 135;
1564    const DENIED_OUT_OF_TIME_RANGE = 136;
1565    const DENIED_THREAT_LEVEL = 137;
1566    const DENIED_PASSBACK = 138;
1567    const DENIED_UNEXPECTED_LOCATION_USAGE = 139;
1568    const DENIED_MAX_ATTEMPTS = 140;
1569    const DENIED_LOWER_OCCUPANCY_LIMIT = 141;
1570    const DENIED_UPPER_OCCUPANCY_LIMIT = 142;
1571    const DENIED_AUTHENTICATION_FACTOR_LOST = 143;
1572    const DENIED_AUTHENTICATION_FACTOR_STOLEN = 144;
1573    const DENIED_AUTHENTICATION_FACTOR_DAMAGED = 145;
1574    const DENIED_AUTHENTICATION_FACTOR_DESTROYED = 146;
1575    const DENIED_AUTHENTICATION_FACTOR_DISABLED = 147;
1576    const DENIED_AUTHENTICATION_FACTOR_ERROR = 148;
1577    const DENIED_CREDENTIAL_UNASSIGNED = 149;
1578    const DENIED_CREDENTIAL_NOT_PROVISIONED = 150;
1579    const DENIED_CREDENTIAL_NOT_YET_ACTIVE = 151;
1580    const DENIED_CREDENTIAL_EXPIRED = 152;
1581    const DENIED_CREDENTIAL_MANUAL_DISABLE = 153;
1582    const DENIED_CREDENTIAL_LOCKOUT = 154;
1583    const DENIED_CREDENTIAL_MAX_DAYS = 155;
1584    const DENIED_CREDENTIAL_MAX_USES = 156;
1585    const DENIED_CREDENTIAL_INACTIVITY = 157;
1586    const DENIED_CREDENTIAL_DISABLED = 158;
1587    const DENIED_NO_ACCOMPANIMENT = 159;
1588    const DENIED_INCORRECT_ACCOMPANIMENT = 160;
1589    const DENIED_LOCKOUT = 161;
1590    const DENIED_VERIFICATION_FAILED = 162;
1591    const DENIED_VERIFICATION_TIMEOUT = 163;
1592    const DENIED_OTHER = 164;
1593}
1594
1595bacnet_enum! {
1596    /// BACnet access credential disable (Clause 21).
1597    pub struct AccessCredentialDisable(u32);
1598
1599    const NONE = 0;
1600    const DISABLE = 1;
1601    const DISABLE_MANUAL = 2;
1602    const DISABLE_LOCKOUT = 3;
1603}
1604
1605bacnet_enum! {
1606    /// BACnet access credential disable reason (Clause 21).
1607    pub struct AccessCredentialDisableReason(u32);
1608
1609    const DISABLED = 0;
1610    const DISABLED_NEEDS_PROVISIONING = 1;
1611    const DISABLED_UNASSIGNED = 2;
1612    const DISABLED_NOT_YET_ACTIVE = 3;
1613    const DISABLED_EXPIRED = 4;
1614    const DISABLED_LOCKOUT = 5;
1615    const DISABLED_MAX_DAYS = 6;
1616    const DISABLED_MAX_USES = 7;
1617    const DISABLED_INACTIVITY = 8;
1618    const DISABLED_MANUAL = 9;
1619}
1620
1621bacnet_enum! {
1622    /// BACnet access user type (Clause 12.35).
1623    pub struct AccessUserType(u32);
1624
1625    const ASSET = 0;
1626    const GROUP = 1;
1627    const PERSON = 2;
1628}
1629
1630bacnet_enum! {
1631    /// BACnet authorization mode (Clause 12.31).
1632    pub struct AuthorizationMode(u32);
1633
1634    const AUTHORIZE = 0;
1635    const GRANT_ACTIVE = 1;
1636    const DENY_ALL = 2;
1637    const VERIFICATION_REQUIRED = 3;
1638    const AUTHORIZATION_DELAYED = 4;
1639    const NONE = 5;
1640}
1641
1642bacnet_enum! {
1643    /// BACnet access passback mode (Clause 12.32).
1644    pub struct AccessPassbackMode(u32);
1645
1646    const PASSBACK_OFF = 0;
1647    const HARD_PASSBACK = 1;
1648    const SOFT_PASSBACK = 2;
1649}
1650
1651// ===========================================================================
1652// Lighting enums (Clause 12.54)
1653// ===========================================================================
1654
1655bacnet_enum! {
1656    /// BACnet lighting operation (Clause 12.54).
1657    pub struct LightingOperation(u32);
1658
1659    const NONE = 0;
1660    const FADE_TO = 1;
1661    const RAMP_TO = 2;
1662    const STEP_UP = 3;
1663    const STEP_DOWN = 4;
1664    const STEP_ON = 5;
1665    const STEP_OFF = 6;
1666    const WARN = 7;
1667    const WARN_OFF = 8;
1668    const WARN_RELINQUISH = 9;
1669    const STOP = 10;
1670}
1671
1672bacnet_enum! {
1673    /// BACnet lighting in-progress state (Clause 12.54).
1674    pub struct LightingInProgress(u32);
1675
1676    const IDLE = 0;
1677    const FADE_ACTIVE = 1;
1678    const RAMP_ACTIVE = 2;
1679    const NOT_CONTROLLED = 3;
1680    const OTHER = 4;
1681}
1682
1683// ===========================================================================
1684// Lift / escalator enums (Clause 12.58-12.60)
1685// ===========================================================================
1686
1687bacnet_enum! {
1688    /// BACnet escalator operating mode (Clause 12.60).
1689    pub struct EscalatorMode(u32);
1690
1691    const UNKNOWN = 0;
1692    const STOP = 1;
1693    const UP = 2;
1694    const DOWN = 3;
1695    const INSPECTION = 4;
1696    const OUT_OF_SERVICE = 5;
1697}
1698
1699bacnet_enum! {
1700    /// BACnet escalator fault signals (Clause 12.60).
1701    pub struct EscalatorFault(u32);
1702
1703    const CONTROLLER_FAULT = 0;
1704    const DRIVE_AND_MOTOR_FAULT = 1;
1705    const MECHANICAL_COMPONENT_FAULT = 2;
1706    const OVERSPEED_FAULT = 3;
1707    const POWER_SUPPLY_FAULT = 4;
1708    const SAFETY_DEVICE_FAULT = 5;
1709    const CONTROLLER_SUPPLY_FAULT = 6;
1710    const DRIVE_TEMPERATURE_EXCEEDED = 7;
1711    const COMB_PLATE_FAULT = 8;
1712}
1713
1714bacnet_enum! {
1715    /// BACnet lift car travel direction (Clause 12.59).
1716    pub struct LiftCarDirection(u32);
1717
1718    const UNKNOWN = 0;
1719    const NONE = 1;
1720    const STOPPED = 2;
1721    const UP = 3;
1722    const DOWN = 4;
1723    const UP_AND_DOWN = 5;
1724}
1725
1726bacnet_enum! {
1727    /// BACnet lift group operating mode (Clause 12.58).
1728    pub struct LiftGroupMode(u32);
1729
1730    const UNKNOWN = 0;
1731    const NORMAL = 1;
1732    const DOWN_PEAK = 2;
1733    const TWO_WAY = 3;
1734    const FOUR_WAY = 4;
1735    const EMERGENCY_POWER = 5;
1736    const UP_PEAK = 6;
1737}
1738
1739bacnet_enum! {
1740    /// BACnet lift car door status (Clause 12.59).
1741    pub struct LiftCarDoorStatus(u32);
1742
1743    const UNKNOWN = 0;
1744    const NONE = 1;
1745    const CLOSING = 2;
1746    const CLOSED = 3;
1747    const OPENING = 4;
1748    const OPENED = 5;
1749    const SAFETY_LOCKED = 6;
1750    const LIMITED_OPENED = 7;
1751}
1752
1753bacnet_enum! {
1754    /// BACnet lift car door command (Clause 21).
1755    pub struct LiftCarDoorCommand(u32);
1756
1757    const NONE = 0;
1758    const OPEN = 1;
1759    const CLOSE = 2;
1760}
1761
1762bacnet_enum! {
1763    /// BACnet lift car drive status (Clause 21).
1764    pub struct LiftCarDriveStatus(u32);
1765
1766    const UNKNOWN = 0;
1767    const STATIONARY = 1;
1768    const BRAKING = 2;
1769    const ACCELERATE = 3;
1770    const DECELERATE = 4;
1771    const RATED_SPEED = 5;
1772    const SINGLE_FLOOR_JUMP = 6;
1773    const TWO_FLOOR_JUMP = 7;
1774    const THREE_FLOOR_JUMP = 8;
1775    const MULTI_FLOOR_JUMP = 9;
1776}
1777
1778bacnet_enum! {
1779    /// BACnet lift car operating mode (Clause 21).
1780    pub struct LiftCarMode(u32);
1781
1782    const UNKNOWN = 0;
1783    const NORMAL = 1;
1784    const VIP = 2;
1785    const HOMING = 3;
1786    const PARKING = 4;
1787    const ATTENDANT_CONTROL = 5;
1788    const FIREFIGHTER_CONTROL = 6;
1789    const EMERGENCY_POWER = 7;
1790    const INSPECTION = 8;
1791    const CABINET_RECALL = 9;
1792    const EARTHQUAKE_OPERATION = 10;
1793    const FIRE_OPERATION = 11;
1794    const OUT_OF_SERVICE = 12;
1795    const OCCUPANT_EVACUATION = 13;
1796}
1797
1798bacnet_enum! {
1799    /// BACnet lift fault signals (Clause 21).
1800    pub struct LiftFault(u32);
1801
1802    const CONTROLLER_FAULT = 0;
1803    const DRIVE_AND_MOTOR_FAULT = 1;
1804    const GOVERNOR_AND_SAFETY_GEAR_FAULT = 2;
1805    const LIFT_SHAFT_DEVICE_FAULT = 3;
1806    const POWER_SUPPLY_FAULT = 4;
1807    const SAFETY_INTERLOCK_FAULT = 5;
1808    const DOOR_CLOSING_FAULT = 6;
1809    const DOOR_OPENING_FAULT = 7;
1810    const CAR_STOPPED_OUTSIDE_LANDING_ZONE = 8;
1811    const CALL_BUTTON_STUCK = 9;
1812    const START_FAILURE = 10;
1813    const CONTROLLER_SUPPLY_FAULT = 11;
1814    const SELF_TEST_FAILURE = 12;
1815    const RUNTIME_LIMIT_EXCEEDED = 13;
1816    const POSITION_LOST = 14;
1817    const DRIVE_TEMPERATURE_EXCEEDED = 15;
1818    const LOAD_MEASUREMENT_FAULT = 16;
1819}
1820
1821// ===========================================================================
1822// Miscellaneous enums
1823// ===========================================================================
1824
1825bacnet_enum! {
1826    /// BACnet load control shed state (Clause 12.28).
1827    pub struct ShedState(u32);
1828
1829    const SHED_INACTIVE = 0;
1830    const SHED_REQUEST_PENDING = 1;
1831    const SHED_COMPLIANT = 2;
1832    const SHED_NON_COMPLIANT = 3;
1833}
1834
1835bacnet_enum! {
1836    /// BACnet node type for Structured View (Clause 12.29).
1837    pub struct NodeType(u32);
1838
1839    const UNKNOWN = 0;
1840    const SYSTEM = 1;
1841    const NETWORK = 2;
1842    const DEVICE = 3;
1843    const ORGANIZATIONAL = 4;
1844    const AREA = 5;
1845    const EQUIPMENT = 6;
1846    const POINT = 7;
1847    const COLLECTION = 8;
1848    const PROPERTY = 9;
1849    const FUNCTIONAL = 10;
1850    const OTHER = 11;
1851    const SUBSYSTEM = 12;
1852    const BUILDING = 13;
1853    const FLOOR = 14;
1854    const SECTION = 15;
1855    const MODULE = 16;
1856    const TREE = 17;
1857    const MEMBER = 18;
1858    const PROTOCOL = 19;
1859    const ROOM = 20;
1860    const ZONE = 21;
1861}
1862
1863bacnet_enum! {
1864    /// BACnet acknowledgment filter for GetEnrollmentSummary (Clause 13.7.1).
1865    pub struct AcknowledgmentFilter(u32);
1866
1867    const ALL = 0;
1868    const ACKED = 1;
1869    const NOT_ACKED = 2;
1870}
1871
1872bacnet_enum! {
1873    /// Event transition bit positions (Clause 12.11).
1874    pub struct EventTransitionBits(u8);
1875
1876    const TO_OFFNORMAL = 0;
1877    const TO_FAULT = 1;
1878    const TO_NORMAL = 2;
1879}
1880
1881bacnet_enum! {
1882    /// BACnet message priority for TextMessage services (Clause 16.5).
1883    pub struct MessagePriority(u32);
1884
1885    const NORMAL = 0;
1886    const URGENT = 1;
1887}
1888
1889bacnet_enum! {
1890    /// BACnet virtual terminal class (Clause 17.1).
1891    pub struct VTClass(u32);
1892
1893    const DEFAULT_TERMINAL = 0;
1894    const ANSI_X3_64 = 1;
1895    const DEC_VT52 = 2;
1896    const DEC_VT100 = 3;
1897    const DEC_VT220 = 4;
1898    const HP_700_94 = 5;
1899    const IBM_3130 = 6;
1900}
1901
1902// ===========================================================================
1903// Staging / Audit enums (new in 135-2020)
1904// ===========================================================================
1905
1906bacnet_enum! {
1907    /// BACnet staging state (Clause 12.62, new in 135-2020).
1908    pub struct StagingState(u32);
1909
1910    const NOT_STAGED = 0;
1911    const STAGING = 1;
1912    const STAGED = 2;
1913    const COMMITTING = 3;
1914    const COMMITTED = 4;
1915    const ABANDONING = 5;
1916    const ABANDONED = 6;
1917}
1918
1919bacnet_enum! {
1920    /// BACnet audit level (Clause 19.6, new in 135-2020).
1921    pub struct AuditLevel(u32);
1922
1923    const NONE = 0;
1924    const AUDIT_ALL = 1;
1925    const AUDIT_CONFIG = 2;
1926    const DEFAULT = 3;
1927}
1928
1929bacnet_enum! {
1930    /// BACnet audit operation (Clause 19.6, new in 135-2020).
1931    pub struct AuditOperation(u32);
1932
1933    const READ = 0;
1934    const WRITE = 1;
1935    const CREATE = 2;
1936    const DELETE = 3;
1937    const LIFE_SAFETY = 4;
1938    const ACKNOWLEDGE_ALARM = 5;
1939    const DEVICE_DISABLE_COMM = 6;
1940    const DEVICE_ENABLE_COMM = 7;
1941    const DEVICE_RESET = 8;
1942    const DEVICE_BACKUP = 9;
1943    const DEVICE_RESTORE = 10;
1944    const SUBSCRIPTION = 11;
1945    const NOTIFICATION = 12;
1946    const AUDITING_FAILURE = 13;
1947    const NETWORK_CHANGES = 14;
1948    const GENERAL = 15;
1949}
1950
1951bacnet_enum! {
1952    /// BACnet success filter for audit log queries (Clause 13.19, new in 135-2020).
1953    pub struct BACnetSuccessFilter(u32);
1954
1955    const ALL = 0;
1956    const SUCCESSES_ONLY = 1;
1957    const FAILURES_ONLY = 2;
1958}
1959
1960// ===========================================================================
1961// EngineeringUnits (Clause 21) — large enum, grouped by category
1962// ===========================================================================
1963
1964bacnet_enum! {
1965    /// BACnet engineering units (Clause 21).
1966    ///
1967    /// Values 0-255 and 47808-49999 are reserved for ASHRAE;
1968    /// 256-47807 and 50000-65535 may be used by vendors (Clause 23).
1969    pub struct EngineeringUnits(u32);
1970
1971    // Acceleration
1972    const METERS_PER_SECOND_PER_SECOND = 166;
1973    // Area
1974    const SQUARE_METERS = 0;
1975    const SQUARE_CENTIMETERS = 116;
1976    const SQUARE_FEET = 1;
1977    const SQUARE_INCHES = 115;
1978    // Currency
1979    const CURRENCY1 = 105;
1980    const CURRENCY2 = 106;
1981    const CURRENCY3 = 107;
1982    const CURRENCY4 = 108;
1983    const CURRENCY5 = 109;
1984    const CURRENCY6 = 110;
1985    const CURRENCY7 = 111;
1986    const CURRENCY8 = 112;
1987    const CURRENCY9 = 113;
1988    const CURRENCY10 = 114;
1989    // Electrical
1990    const MILLIAMPERES = 2;
1991    const AMPERES = 3;
1992    const AMPERES_PER_METER = 167;
1993    const AMPERES_PER_SQUARE_METER = 168;
1994    const AMPERE_SQUARE_METERS = 169;
1995    const DECIBELS = 199;
1996    const DECIBELS_MILLIVOLT = 200;
1997    const DECIBELS_VOLT = 201;
1998    const FARADS = 170;
1999    const HENRYS = 171;
2000    const OHMS = 4;
2001    const OHM_METER_SQUARED_PER_METER = 237;
2002    const OHM_METERS = 172;
2003    const MILLIOHMS = 145;
2004    const KILOHMS = 122;
2005    const MEGOHMS = 123;
2006    const MICROSIEMENS = 190;
2007    const MILLISIEMENS = 202;
2008    const SIEMENS = 173;
2009    const SIEMENS_PER_METER = 174;
2010    const TESLAS = 175;
2011    const VOLTS = 5;
2012    const MILLIVOLTS = 124;
2013    const KILOVOLTS = 6;
2014    const MEGAVOLTS = 7;
2015    const VOLT_AMPERES = 8;
2016    const KILOVOLT_AMPERES = 9;
2017    const MEGAVOLT_AMPERES = 10;
2018    const VOLT_AMPERES_REACTIVE = 11;
2019    const KILOVOLT_AMPERES_REACTIVE = 12;
2020    const MEGAVOLT_AMPERES_REACTIVE = 13;
2021    const VOLTS_PER_DEGREE_KELVIN = 176;
2022    const VOLTS_PER_METER = 177;
2023    const DEGREES_PHASE = 14;
2024    const POWER_FACTOR = 15;
2025    const WEBERS = 178;
2026    // Energy
2027    const AMPERE_SECONDS = 238;
2028    const VOLT_AMPERE_HOURS = 239;
2029    const KILOVOLT_AMPERE_HOURS = 240;
2030    const MEGAVOLT_AMPERE_HOURS = 241;
2031    const VOLT_AMPERE_HOURS_REACTIVE = 242;
2032    const KILOVOLT_AMPERE_HOURS_REACTIVE = 243;
2033    const MEGAVOLT_AMPERE_HOURS_REACTIVE = 244;
2034    const VOLT_SQUARE_HOURS = 245;
2035    const AMPERE_SQUARE_HOURS = 246;
2036    const JOULES = 16;
2037    const KILOJOULES = 17;
2038    const KILOJOULES_PER_KILOGRAM = 125;
2039    const MEGAJOULES = 126;
2040    const WATT_HOURS = 18;
2041    const KILOWATT_HOURS = 19;
2042    const MEGAWATT_HOURS = 146;
2043    const WATT_HOURS_REACTIVE = 203;
2044    const KILOWATT_HOURS_REACTIVE = 204;
2045    const MEGAWATT_HOURS_REACTIVE = 205;
2046    const BTUS = 20;
2047    const KILO_BTUS = 147;
2048    const MEGA_BTUS = 148;
2049    const THERMS = 21;
2050    const TON_HOURS = 22;
2051    // Enthalpy
2052    const JOULES_PER_KILOGRAM_DRY_AIR = 23;
2053    const KILOJOULES_PER_KILOGRAM_DRY_AIR = 149;
2054    const MEGAJOULES_PER_KILOGRAM_DRY_AIR = 150;
2055    const BTUS_PER_POUND_DRY_AIR = 24;
2056    const BTUS_PER_POUND = 117;
2057    // Entropy
2058    const JOULES_PER_DEGREE_KELVIN = 127;
2059    const KILOJOULES_PER_DEGREE_KELVIN = 151;
2060    const MEGAJOULES_PER_DEGREE_KELVIN = 152;
2061    const JOULES_PER_KILOGRAM_DEGREE_KELVIN = 128;
2062    // Force
2063    const NEWTON = 153;
2064    // Frequency
2065    const CYCLES_PER_HOUR = 25;
2066    const CYCLES_PER_MINUTE = 26;
2067    const HERTZ = 27;
2068    const KILOHERTZ = 129;
2069    const MEGAHERTZ = 130;
2070    const PER_HOUR = 131;
2071    // Humidity
2072    const GRAMS_OF_WATER_PER_KILOGRAM_DRY_AIR = 28;
2073    const PERCENT_RELATIVE_HUMIDITY = 29;
2074    // Length
2075    const MICROMETERS = 194;
2076    const MILLIMETERS = 30;
2077    const CENTIMETERS = 118;
2078    const KILOMETERS = 193;
2079    const METERS = 31;
2080    const INCHES = 32;
2081    const FEET = 33;
2082    // Light
2083    const CANDELAS = 179;
2084    const CANDELAS_PER_SQUARE_METER = 180;
2085    const WATTS_PER_SQUARE_FOOT = 34;
2086    const WATTS_PER_SQUARE_METER = 35;
2087    const LUMENS = 36;
2088    const LUXES = 37;
2089    const FOOT_CANDLES = 38;
2090    // Mass
2091    const MILLIGRAMS = 196;
2092    const GRAMS = 195;
2093    const KILOGRAMS = 39;
2094    const POUNDS_MASS = 40;
2095    const TONS = 41;
2096    // Mass flow
2097    const GRAMS_PER_SECOND = 154;
2098    const GRAMS_PER_MINUTE = 155;
2099    const KILOGRAMS_PER_SECOND = 42;
2100    const KILOGRAMS_PER_MINUTE = 43;
2101    const KILOGRAMS_PER_HOUR = 44;
2102    const POUNDS_MASS_PER_SECOND = 119;
2103    const POUNDS_MASS_PER_MINUTE = 45;
2104    const POUNDS_MASS_PER_HOUR = 46;
2105    const TONS_PER_HOUR = 156;
2106    // Power
2107    const MILLIWATTS = 132;
2108    const WATTS = 47;
2109    const KILOWATTS = 48;
2110    const MEGAWATTS = 49;
2111    const BTUS_PER_HOUR = 50;
2112    const KILO_BTUS_PER_HOUR = 157;
2113    const JOULE_PER_HOURS = 247;
2114    const HORSEPOWER = 51;
2115    const TONS_REFRIGERATION = 52;
2116    // Pressure
2117    const PASCALS = 53;
2118    const HECTOPASCALS = 133;
2119    const KILOPASCALS = 54;
2120    const MILLIBARS = 134;
2121    const BARS = 55;
2122    const POUNDS_FORCE_PER_SQUARE_INCH = 56;
2123    const MILLIMETERS_OF_WATER = 206;
2124    const CENTIMETERS_OF_WATER = 57;
2125    const INCHES_OF_WATER = 58;
2126    const MILLIMETERS_OF_MERCURY = 59;
2127    const CENTIMETERS_OF_MERCURY = 60;
2128    const INCHES_OF_MERCURY = 61;
2129    // Temperature
2130    const DEGREES_CELSIUS = 62;
2131    const DEGREES_KELVIN = 63;
2132    const DEGREES_KELVIN_PER_HOUR = 181;
2133    const DEGREES_KELVIN_PER_MINUTE = 182;
2134    const DEGREES_FAHRENHEIT = 64;
2135    const DEGREE_DAYS_CELSIUS = 65;
2136    const DEGREE_DAYS_FAHRENHEIT = 66;
2137    const DELTA_DEGREES_FAHRENHEIT = 120;
2138    const DELTA_DEGREES_KELVIN = 121;
2139    // Time
2140    const YEARS = 67;
2141    const MONTHS = 68;
2142    const WEEKS = 69;
2143    const DAYS = 70;
2144    const HOURS = 71;
2145    const MINUTES = 72;
2146    const SECONDS = 73;
2147    const HUNDREDTHS_SECONDS = 158;
2148    const MILLISECONDS = 159;
2149    // Torque
2150    const NEWTON_METERS = 160;
2151    // Velocity
2152    const MILLIMETERS_PER_SECOND = 161;
2153    const MILLIMETERS_PER_MINUTE = 162;
2154    const METERS_PER_SECOND = 74;
2155    const METERS_PER_MINUTE = 163;
2156    const METERS_PER_HOUR = 164;
2157    const KILOMETERS_PER_HOUR = 75;
2158    const FEET_PER_SECOND = 76;
2159    const FEET_PER_MINUTE = 77;
2160    const MILES_PER_HOUR = 78;
2161    // Volume
2162    const CUBIC_FEET = 79;
2163    const CUBIC_METERS = 80;
2164    const IMPERIAL_GALLONS = 81;
2165    const MILLILITERS = 197;
2166    const LITERS = 82;
2167    const US_GALLONS = 83;
2168    // Volumetric flow
2169    const CUBIC_FEET_PER_SECOND = 142;
2170    const CUBIC_FEET_PER_MINUTE = 84;
2171    const MILLION_STANDARD_CUBIC_FEET_PER_MINUTE = 254;
2172    const CUBIC_FEET_PER_HOUR = 191;
2173    const CUBIC_FEET_PER_DAY = 248;
2174    const STANDARD_CUBIC_FEET_PER_DAY = 47808;
2175    const MILLION_STANDARD_CUBIC_FEET_PER_DAY = 47809;
2176    const THOUSAND_CUBIC_FEET_PER_DAY = 47810;
2177    const THOUSAND_STANDARD_CUBIC_FEET_PER_DAY = 47811;
2178    const POUNDS_MASS_PER_DAY = 47812;
2179    const CUBIC_METERS_PER_SECOND = 85;
2180    const CUBIC_METERS_PER_MINUTE = 165;
2181    const CUBIC_METERS_PER_HOUR = 135;
2182    const CUBIC_METERS_PER_DAY = 249;
2183    const IMPERIAL_GALLONS_PER_MINUTE = 86;
2184    const MILLILITERS_PER_SECOND = 198;
2185    const LITERS_PER_SECOND = 87;
2186    const LITERS_PER_MINUTE = 88;
2187    const LITERS_PER_HOUR = 136;
2188    const US_GALLONS_PER_MINUTE = 89;
2189    const US_GALLONS_PER_HOUR = 192;
2190    // Other
2191    const DEGREES_ANGULAR = 90;
2192    const DEGREES_CELSIUS_PER_HOUR = 91;
2193    const DEGREES_CELSIUS_PER_MINUTE = 92;
2194    const DEGREES_FAHRENHEIT_PER_HOUR = 93;
2195    const DEGREES_FAHRENHEIT_PER_MINUTE = 94;
2196    const JOULE_SECONDS = 183;
2197    const KILOGRAMS_PER_CUBIC_METER = 186;
2198    const KILOWATT_HOURS_PER_SQUARE_METER = 137;
2199    const KILOWATT_HOURS_PER_SQUARE_FOOT = 138;
2200    const WATT_HOURS_PER_CUBIC_METER = 250;
2201    const JOULES_PER_CUBIC_METER = 251;
2202    const MEGAJOULES_PER_SQUARE_METER = 139;
2203    const MEGAJOULES_PER_SQUARE_FOOT = 140;
2204    const MOLE_PERCENT = 252;
2205    const NO_UNITS = 95;
2206    const NEWTON_SECONDS = 187;
2207    const NEWTONS_PER_METER = 188;
2208    const PARTS_PER_MILLION = 96;
2209    const PARTS_PER_BILLION = 97;
2210    const PASCAL_SECONDS = 253;
2211    const PERCENT = 98;
2212    const PERCENT_OBSCURATION_PER_FOOT = 143;
2213    const PERCENT_OBSCURATION_PER_METER = 144;
2214    const PERCENT_PER_SECOND = 99;
2215    const PER_MINUTE = 100;
2216    const PER_SECOND = 101;
2217    const PSI_PER_DEGREE_FAHRENHEIT = 102;
2218    const RADIANS = 103;
2219    const RADIANS_PER_SECOND = 184;
2220    const REVOLUTIONS_PER_MINUTE = 104;
2221    const SQUARE_METERS_PER_NEWTON = 185;
2222    const WATTS_PER_METER_PER_DEGREE_KELVIN = 189;
2223    const WATTS_PER_SQUARE_METER_DEGREE_KELVIN = 141;
2224    const PER_MILLE = 207;
2225    const GRAMS_PER_GRAM = 208;
2226    const KILOGRAMS_PER_KILOGRAM = 209;
2227    const GRAMS_PER_KILOGRAM = 210;
2228    const MILLIGRAMS_PER_GRAM = 211;
2229    const MILLIGRAMS_PER_KILOGRAM = 212;
2230    const GRAMS_PER_MILLILITER = 213;
2231    const GRAMS_PER_LITER = 214;
2232    const MILLIGRAMS_PER_LITER = 215;
2233    const MICROGRAMS_PER_LITER = 216;
2234    const GRAMS_PER_CUBIC_METER = 217;
2235    const MILLIGRAMS_PER_CUBIC_METER = 218;
2236    const MICROGRAMS_PER_CUBIC_METER = 219;
2237    const NANOGRAMS_PER_CUBIC_METER = 220;
2238    const GRAMS_PER_CUBIC_CENTIMETER = 221;
2239    const BECQUERELS = 222;
2240    const KILOBECQUERELS = 223;
2241    const MEGABECQUERELS = 224;
2242    const GRAY = 225;
2243    const MILLIGRAY = 226;
2244    const MICROGRAY = 227;
2245    const SIEVERTS = 228;
2246    const MILLISIEVERTS = 229;
2247    const MICROSIEVERTS = 230;
2248    const MICROSIEVERTS_PER_HOUR = 231;
2249    const MILLIREMS = 47814;
2250    const MILLIREMS_PER_HOUR = 47815;
2251    const DECIBELS_A = 232;
2252    const NEPHELOMETRIC_TURBIDITY_UNIT = 233;
2253    const PH = 234;
2254    const GRAMS_PER_SQUARE_METER = 235;
2255    const MINUTES_PER_DEGREE_KELVIN = 236;
2256    const DEGREES_LOVIBOND = 47816;
2257    const ALCOHOL_BY_VOLUME = 47817;
2258    const INTERNATIONAL_BITTERING_UNITS = 47818;
2259    const EUROPEAN_BITTERNESS_UNITS = 47819;
2260    const DEGREES_PLATO = 47820;
2261    const SPECIFIC_GRAVITY = 47821;
2262    const EUROPEAN_BREWING_CONVENTION = 47822;
2263}
2264
2265// ===========================================================================
2266// Tests
2267// ===========================================================================
2268
2269#[cfg(test)]
2270mod tests {
2271    use super::*;
2272
2273    #[test]
2274    fn object_type_round_trip() {
2275        assert_eq!(ObjectType::DEVICE.to_raw(), 8);
2276        assert_eq!(ObjectType::from_raw(8), ObjectType::DEVICE);
2277    }
2278
2279    #[test]
2280    fn object_type_vendor_proprietary() {
2281        let vendor = ObjectType::from_raw(128);
2282        assert_eq!(vendor.to_raw(), 128);
2283        assert_eq!(format!("{}", vendor), "128");
2284        assert_eq!(format!("{:?}", vendor), "ObjectType(128)");
2285    }
2286
2287    #[test]
2288    fn object_type_display_known() {
2289        assert_eq!(format!("{}", ObjectType::ANALOG_INPUT), "ANALOG_INPUT");
2290        assert_eq!(format!("{:?}", ObjectType::DEVICE), "ObjectType::DEVICE");
2291    }
2292
2293    #[test]
2294    fn property_identifier_round_trip() {
2295        assert_eq!(PropertyIdentifier::PRESENT_VALUE.to_raw(), 85);
2296        assert_eq!(
2297            PropertyIdentifier::from_raw(85),
2298            PropertyIdentifier::PRESENT_VALUE
2299        );
2300    }
2301
2302    #[test]
2303    fn property_identifier_vendor() {
2304        let vendor = PropertyIdentifier::from_raw(512);
2305        assert_eq!(vendor.to_raw(), 512);
2306    }
2307
2308    #[test]
2309    fn pdu_type_values() {
2310        assert_eq!(PduType::CONFIRMED_REQUEST.to_raw(), 0);
2311        assert_eq!(PduType::ABORT.to_raw(), 7);
2312    }
2313
2314    #[test]
2315    fn confirmed_service_choice_values() {
2316        assert_eq!(ConfirmedServiceChoice::READ_PROPERTY.to_raw(), 12);
2317        assert_eq!(ConfirmedServiceChoice::WRITE_PROPERTY.to_raw(), 15);
2318    }
2319
2320    #[test]
2321    fn unconfirmed_service_choice_values() {
2322        assert_eq!(UnconfirmedServiceChoice::WHO_IS.to_raw(), 8);
2323        assert_eq!(UnconfirmedServiceChoice::I_AM.to_raw(), 0);
2324    }
2325
2326    #[test]
2327    fn bvlc_function_values() {
2328        assert_eq!(BvlcFunction::ORIGINAL_UNICAST_NPDU.to_raw(), 0x0A);
2329        assert_eq!(BvlcFunction::ORIGINAL_BROADCAST_NPDU.to_raw(), 0x0B);
2330    }
2331
2332    #[test]
2333    fn engineering_units_round_trip() {
2334        assert_eq!(EngineeringUnits::DEGREES_CELSIUS.to_raw(), 62);
2335        assert_eq!(
2336            EngineeringUnits::from_raw(62),
2337            EngineeringUnits::DEGREES_CELSIUS
2338        );
2339    }
2340
2341    #[test]
2342    fn engineering_units_ashrae_extended() {
2343        assert_eq!(
2344            EngineeringUnits::STANDARD_CUBIC_FEET_PER_DAY.to_raw(),
2345            47808
2346        );
2347    }
2348
2349    #[test]
2350    fn segmentation_values() {
2351        assert_eq!(Segmentation::BOTH.to_raw(), 0);
2352        assert_eq!(Segmentation::NONE.to_raw(), 3);
2353    }
2354
2355    #[test]
2356    fn network_message_type_values() {
2357        assert_eq!(NetworkMessageType::WHO_IS_ROUTER_TO_NETWORK.to_raw(), 0x00);
2358        assert_eq!(NetworkMessageType::NETWORK_NUMBER_IS.to_raw(), 0x13);
2359    }
2360
2361    #[test]
2362    fn event_state_values() {
2363        assert_eq!(EventState::NORMAL.to_raw(), 0);
2364        assert_eq!(EventState::LIFE_SAFETY_ALARM.to_raw(), 5);
2365    }
2366
2367    #[test]
2368    fn reliability_gap_at_11() {
2369        // Value 11 is intentionally missing from the standard
2370        assert_eq!(Reliability::CONFIGURATION_ERROR.to_raw(), 10);
2371        assert_eq!(Reliability::COMMUNICATION_FAILURE.to_raw(), 12);
2372    }
2373}