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