Skip to main content

Module constructed

Module constructed 

Source
Expand description

Full ASN.1 framing codecs for constructed Clause-21 types whose property values are CHOICE/SEQUENCE productions — context-tagged framing per ASHRAE 135-2020 Clause 20.2.1.5/20.2.1.6.

These codecs encode to and decode from raw application-layer bytes, the same bytes carried by bacnet_types::primitives::PropertyValue::ApplicationData. Objects serve framed properties (e.g. Event_Parameters, Fault_Parameters, Recipient_List) by encoding with these functions; the flat application-tagged model in crate::primitives::encode_property_value cannot express their wire form.

Tag-form rules applied here:

  • A CHOICE alternative over a SEQUENCE is an opening/closing context tag pair around the SEQUENCE’s members.
  • A CHOICE alternative over a primitive base type is a context-specific primitive tag holding the raw contents (e.g. none [0] NULL).
  • A context-tagged inner CHOICE is always explicitly tagged: an opening/closing pair around the alternative’s own encoding.
  • Inner members declared [n] T over primitive T are context-tagged primitives; inner SEQUENCE OF / embedded SEQUENCE members are constructed opening/closing pairs holding application-tagged elements.

Re-exports§

pub use access_credential::decode_assigned_access_rights;
pub use access_credential::decode_authentication_factor;
pub use access_credential::decode_authentication_factor_format;
pub use access_credential::decode_credential_authentication_factor;
pub use access_credential::encode_assigned_access_rights;
pub use access_credential::encode_authentication_factor;
pub use access_credential::encode_authentication_factor_format;
pub use access_credential::encode_credential_authentication_factor;
pub use access_rule::decode_access_rule;
pub use access_rule::encode_access_rule;
pub use assigned_landing_calls::decode_assigned_landing_calls;
pub use assigned_landing_calls::encode_assigned_landing_calls;
pub use authentication_policy::decode_authentication_policy;
pub use authentication_policy::encode_authentication_policy;
pub use calendar::decode_calendar_entry;
pub use calendar::decode_calendar_entry_list;
pub use calendar::decode_date_range;
pub use calendar::encode_calendar_entry;
pub use calendar::encode_calendar_entry_list;
pub use calendar::encode_date_range;
pub use cov_subscription::decode_cov_multiple_subscription;
pub use cov_subscription::decode_cov_subscription;
pub use cov_subscription::encode_cov_multiple_subscription;
pub use cov_subscription::encode_cov_multiple_subscription_list;
pub use cov_subscription::encode_cov_subscription;
pub use cov_subscription::encode_cov_subscription_list;
pub use event_notification_subscription::decode_event_notification_subscription;
pub use event_notification_subscription::encode_event_notification_subscription;
pub use event_notification_subscription::encode_event_notification_subscription_list;
pub use event_parameter::decode_event_parameter;
pub use event_parameter::encode_event_parameter;
pub use fault_parameter::decode_fault_parameters;
pub use fault_parameter::encode_fault_parameters;
pub use landing_call_status::decode_landing_call_status;
pub use landing_call_status::decode_landing_call_status_list;
pub use landing_call_status::encode_landing_call_status;
pub use landing_call_status::encode_landing_call_status_list;
pub use landing_door_status::decode_landing_door_status;
pub use landing_door_status::encode_landing_door_status;
pub use lift_car_call_list::decode_lift_car_call_list;
pub use lift_car_call_list::encode_lift_car_call_list;
pub use network_port::decode_bdt_entry;
pub use network_port::decode_bdt_entry_list;
pub use network_port::decode_fdt_entry;
pub use network_port::decode_fdt_entry_list;
pub use network_port::decode_host_address;
pub use network_port::decode_host_n_port;
pub use network_port::encode_bdt_entry;
pub use network_port::encode_bdt_entry_list;
pub use network_port::encode_fdt_entry;
pub use network_port::encode_fdt_entry_list;
pub use network_port::encode_host_address;
pub use network_port::encode_host_n_port;
pub use object_property_reference::decode_object_property_reference;
pub use object_property_reference::decode_object_property_reference_at;
pub use object_property_reference::decode_setpoint_reference;
pub use object_property_reference::decode_setpoint_reference_at;
pub use object_property_reference::encode_object_property_reference;
pub use object_property_reference::encode_setpoint_reference;
pub use port_permission::decode_port_permission;
pub use port_permission::encode_port_permission;
pub use recipient::check_decoded_mac_len;
pub use recipient::check_encoded_mac_len;
pub use recipient::decode_destination;
pub use recipient::decode_destination_list;
pub use recipient::decode_recipient;
pub use recipient::encode_destination;
pub use recipient::encode_destination_list;
pub use recipient::encode_recipient;
pub use schedule::decode_daily_schedule;
pub use schedule::decode_exception_schedule;
pub use schedule::decode_special_event;
pub use schedule::decode_special_event_period;
pub use schedule::decode_time_value;
pub use schedule::decode_weekly_schedule;
pub use schedule::encode_daily_schedule;
pub use schedule::encode_exception_schedule;
pub use schedule::encode_special_event;
pub use schedule::encode_special_event_period;
pub use schedule::encode_time_value;
pub use schedule::encode_weekly_schedule;
pub use staging::decode_device_object_reference;
pub use staging::decode_stage_limit_value;
pub use staging::encode_device_object_reference;
pub use staging::encode_stage_limit_value;

Modules§

access_credential
Clause 21 codecs for the elements of two Access Credential arrays (Clause 12.35): Assigned_Access_Rights (BACnetAssignedAccessRights) and Authentication_Factors (BACnetCredentialAuthenticationFactor, which embeds a BACnetAuthenticationFactor). The Credential Data Input serves the bare factor as its Present_Value and an array of BACnetAuthenticationFactorFormat as Supported_Formats (Clause 12.36).
access_rule
Clause 21 codec for BACnetAccessRule, the element of an Access Rights object’s Positive_Access_Rules and Negative_Access_Rules arrays (Clause 12.34.9.1).
assigned_landing_calls
Clause 21 codec for BACnetAssignedLandingCalls, the value of each element of the Lift object’s Assigned_Landing_Calls array (Clause 12.59).
authentication_policy
Clause 21 codec for BACnetAuthenticationPolicy, the element of an Access Point’s Authentication_Policy_List array (Clause 12.31.12).
calendar
Clause 21 codecs for BACnetCalendarEntry and BACnetDateRange.
cov_subscription
Encode and decode the constructed values carried by Device Active_COV_Subscriptions and Active_COV_Multiple_Subscriptions.
event_notification_subscription
Encode and decode a Notification Forwarder’s Subscribed_Recipients elements (Clause 12.51.9, Clause 21 BACnetEventNotificationSubscription).
event_parameter
BACnetEventParameter full ASN.1 framing.
fault_parameter
BACnetFaultParameter full ASN.1 framing.
landing_call_status
Clause 21 codec for BACnetLandingCallStatus, the value of the Elevator Group object’s Landing_Call_Control and of each Landing_Calls element (Clause 12.58).
landing_door_status
Clause 21 codec for BACnetLandingDoorStatus, the value of each element of the Lift object’s Landing_Door_Status array (Clause 12.59).
lift_car_call_list
Clause 21 codec for BACnetLiftCarCallList, the value of each element of the Lift object’s Registered_Car_Call array (Clause 12.59).
network_port
Clause 21 codecs for the Network Port object’s host and broadcast-table values: BACnetHostAddress, BACnetHostNPort, BACnetBDTEntry and BACnetFDTEntry (Clause 12.56).
object_property_reference
BACnetObjectPropertyReference and its BACnetSetpointReference wrapper (ASHRAE 135-2020 Clause 21) — wire codecs for the object-reference properties of the Loop (Clause 12.17) and Pulse Converter (Clause 12.23) objects.
port_permission
Encode and decode a Notification Forwarder’s Port_Filter elements (Clause 12.51.11, Clause 21 BACnetPortPermission).
recipient
Recipient_List full ASN.1 framing (ASHRAE 135-2020 Clauses 12.21, 21).
schedule
Clause 21 codecs for the Schedule object’s constructed properties (Clause 12.24): Weekly_Schedule and Exception_Schedule.
staging
Clause 21 codecs used by the Staging object.
tagged
Decode helpers for tagged fields, shared by the constructed codecs, the formal Error bodies in apdu/ and the service parameters bacnet-services decodes.

Structs§

PropertyValueDecodeError
A failed property value decode, with what was read before the failure.

Enums§

ConstructedChannelValue
A constructed alternative of a BACnetChannelValue: which context tag frames it.
PropertyValueBoundary
A tag that may follow an encoded property value in the enclosing production, used to find where the value ends.
PropertyValueDecodeFailure
Why a property value failed to decode.
PropertyValueDecodeStage
The member a property value decode was reading when it failed.

Functions§

channel_value_end
Return the offset just past the single BACnetChannelValue starting at offset.
constructed_channel_value
Which constructed alternative data is, when it is exactly one well-formed constructed BACnetChannelValue; None for a primitive, anything malformed, or octets left over.
decode_action_command
Decode one bare BACnetActionCommand at offset; returns it and the offset past its write-successful flag.
decode_action_list
Decode one BACnetActionList at offset; returns it and the offset past its closing [0] tag, so an Action array is walked by calling this at each element’s start.
decode_audit_log_record
Decode a complete bare BACnetAuditLogRecord field sequence.
decode_audit_log_record_at
Decode one bare BACnetAuditLogRecord starting at offset, returning it and the offset just past it, so the records of a ReadRange item list decode one after another.
decode_audit_log_record_result_at
Decode one adjacent result sequence starting at offset.
decode_audit_notification_at
Decode one bare BACnetAuditNotification starting at offset.
decode_bacnet_property_value
Decode a property value at offset in data; returns it and the offset just past it.
decode_bacnet_property_value_in_list
Decode one property value of a list that ends with the closing tag closing_tag; returns it and the offset just past it.
decode_bacnet_property_value_in_list_detailed
decode_bacnet_property_value_in_list, reporting the stage, the reject reason and the reference read so far when the value is malformed.
decode_color_command
Decode one unframed BACnetColorCommand SEQUENCE at offset.
decode_color_command_value
Decode a BACnetColorCommand that fills data, as a WriteProperty of Color_Command carries it.
decode_device_object_property_reference
Decode one bare BACnetDeviceObjectPropertyReference at offset; returns it and the offset past its last member. A BACnetLIST of these references concatenates its elements with no frame, so walking the list calls this at each element’s start.
decode_event_log_record
Decode one Event Log record starting at offset, returning it and the offset just past it.
decode_event_notification
Decode request parameters from data; errors on missing, malformed or truncated fields.
decode_event_notification_tolerant
decode_event_notification, except that a message text whose characters don’t decode is dropped, so the request reads with message_text: None.
decode_lighting_command
Decode one unframed BACnetLightingCommand SEQUENCE at offset.
decode_lighting_command_value
Decode a BACnetLightingCommand that fills data, as a WriteProperty of Lighting_Command carries it.
decode_log_multiple_record
Decode one Trend Log Multiple record starting at offset, returning it and the offset just past it.
decode_log_record
Decode one Trend Log record starting at offset, returning it and the offset just past it.
decode_name_value
Decode one BACnetNameValue at offset, returning it and the next offset.
decode_notification_parameters
Decode one notification-parameter choice, with an optional enclosing [12] close.
decode_prescale
Decode one BACnetPrescale SEQUENCE at offset; returns it and the offset past its [1] member. A member left out (the data ends, or [1] comes first) is DecodingKind::Missing, another tag where a member is due DecodingKind::InvalidTag, an Unsigned of no octets DecodingKind::InvalidEncoding, and a value past unsigned32, the width the object keeps, DecodingKind::OutOfRange.
decode_property_access_result
Decode one bare BACnetPropertyAccessResult at offset; returns it and the offset past its closing [4] or [5] tag, so an array is walked by calling this at each element’s start.
decode_property_reference
Decode one BACnetPropertyReference at offset; returns it and the offset just past it. The array index is read only when the next tag is a primitive context tag [1], so a reference may end the input or be followed by anything else.
decode_property_state
Decode one BACnetPropertyStates CHOICE element at offset.
decode_read_access_specification
Decode one ReadAccessSpecification at offset; returns it and the offset just past its closing [1] tag, so a sequence of them is walked by calling this at each element’s start. Errors are as for decode_property_reference.
decode_scale
Decode one BACnetScale CHOICE at offset.
decode_shed_level
Decode one BACnetShedLevel CHOICE at offset.
decode_value_source
Decode one ValueSource CHOICE at offset, returning its value and next offset.
decode_xy_color
Decode one BACnetxyColor at offset: two application-tagged REALs.
encode_action_command
Encode one bare BACnetActionCommand, appending to buf.
encode_action_list
Encode one BACnetActionList, its [0] frame included, appending to buf. Fails, leaving buf as it was, when a command fails to encode.
encode_audit_log_record
Encode one bare BACnetAuditLogRecord field sequence.
encode_audit_log_record_result
Encode one adjacent BACnetAuditLogRecordResult sequence.
encode_audit_notification
Encode one bare BACnetAuditNotification field sequence.
encode_bacnet_property_value
Append the encoding of one property value to buf.
encode_color_command
Encode one unframed BACnetColorCommand SEQUENCE: the operation, then each field that is present.
encode_device_object_property_reference
Encode one bare BACnetDeviceObjectPropertyReference, the counterpart of decode_device_object_property_reference: its members with no enclosing frame, so a BACnetLIST of these references is their encodings back to back.
encode_event_log_record
Encode one Event Log record.
encode_event_notification
Append the encoded request parameters to buf; buf is unchanged if validation fails.
encode_lighting_command
Encode one unframed BACnetLightingCommand SEQUENCE: the operation, then each field that is present.
encode_log_multiple_record
Encode one Trend Log Multiple record.
encode_log_record
Encode one Trend Log record.
encode_name_value
Encode one BACnetNameValue, appending to buf.
encode_notification_parameters
Encode notification parameters into the buffer.
encode_prescale
Encode one BACnetPrescale SEQUENCE, appending to buf.
encode_property_access_result
Encode one bare BACnetPropertyAccessResult, appending to buf.
encode_property_reference
Encode one BACnetPropertyReference, appending to buf.
encode_property_state
Encode a BACnetPropertyStates using the Standard 135-2020 Clause 21 tags.
encode_read_access_specification
Encode one ReadAccessSpecification, appending to buf. An empty reference list encodes as the bare [1] pair; the ReadPropertyMultiple request encoder is what refuses one.
encode_scale
Encode one BACnetScale CHOICE, appending to buf.
encode_shed_level
Encode one BACnetShedLevel CHOICE, appending to buf.
encode_value_source
Encode one ValueSource CHOICE, appending to buf.
encode_xy_color
Encode one BACnetxyColor: x, then y, each an application-tagged REAL.
extract_property_value
Extract the encoded value of property that starts at offset, just inside the opening tag closing_tag, returning the value bytes and the offset past the matching closing tag.
validate_tlv_sequence
Validate a BACnet TLV sequence without normalizing its encoded values.