The Device object is the single, mandatory root object that represents an entire
BACnet device on the network. Every BACnet device contains exactly one Device
object whose object_identifier is also used as the device's unique address within
the BACnet internetwork.
The object advertises protocol conformance (protocol_services_supported,
protocol_object_types_supported, segmentation_support, etc.), vendor and model
information, firmware version, and many operational parameters (max_apdu_length,
apdu_timeout, database_revision, last_restart_reason, backup/restore status,
active COV subscriptions, time synchronisation settings, object list, etc.).
Several properties need special server-side handling.
Object Description (ASHRAE 135)
The Device object type defines a standardized object whose properties represent the externally visible characteristics of a BACnet Device. There shall be exactly one Device object in each BACnet Device. A Device object is referenced by its Object_Identifier property, which is not only unique to the BACnet Device that maintains this object but is also unique throughout the BACnet internetwork.
Behaviour and Operation
The Device object is the single source of truth for everything a remote BACnet client needs to know about this device and is the only object that must exist in every BACnet device. It is the target of Who-Is/I-Am, the source of the object list(s), protocol capability flags, and many operational parameters.
Most properties are maintained by a combination of:
- static configuration (vendor name, model, protocol revision, etc.)
- dynamic state maintained by the stack (
database_revision,last_restart_reason, active COV subscriptions, etc.) - time-keeping and OS services (local time,
utc_offset, daylight savings status) - the application / device server (
object_list,structured_object_list, backup/restore state, many configuration properties).
Several properties have side effects or must be kept in sync with lower layers (APDU timeouts, MS/TP token parameters, time synchronisation settings, etc.). Many of its properties are writable and changes must be acted upon by the device server.
Developer Implementation Notes (geared to device server / application authors)
The generated code handles storage + basic mechanics (validation, implicit_relationships,
readonly annotations as hints to your server, etc.). You must drive "special" live
properties and side effects yourself via update_property/3 (never direct mutation).
Read notes below + generated tables for details.
Special / live properties and expected developer behaviour
The Device has many "global live" properties that must be kept in sync with the running stack, OS, config, etc. (more than any other object).
local_time,local_date: Dev must: Ensure your read path call the annotation functions, which return current wall time (respect utc_offset, DST).utc_offset,daylight_savings_status: Writes toutc_offset/daylight_savings_statusmust be pushed to OS or time sync layer.database_revision: Bumped on object db changes. Dev must: Every time you add/remove object, change an object's name, change an object's identifier, or a restore is performed, increment this. The creation and deletion of temporary configuration files during a restore, does not change this property.active_cov_subscriptions: Live subscription state. Dev must: Your COV subscription manager (on SubscribeCOV success/expire, resub etc.) must add/remove entries here viaupdate_property/3.apdu_timeout,number_of_apdu_retries, MS/TP properties (max_info_frames, etc.), time sync properties, backup/restore state machine properties,object_list, etc.: Many are readonly or have side effects. Dev must: On writes (where allowed), propagate to the APDU layer, MS/TP driver, time sync engine, flash/backup routines.last_restart_reason,time_of_device_restart,restart_notification_*: Dev must: Set by reinitialize/powerup code. Can emit notifications.Vendor/model, protocol version/revision, max APDU etc.: Mostly static, set at startup from your build/config.
time_synchronization_intervaletc. + recipients: For periodic time sync. Dev must: Your time sync task uses these.
See the "You are the 'god object'" section and specific bullets below (backup/restore, object_list, special write propagation, COV subs, restart, on_read for time, etc).
The Device object is special: it is both a normal BACnet object and the container for a huge amount of device-wide state and configuration that the rest of the stack (APDU timers, BVLL, MS/TP token passing, time, backup/restore, COV subscription database, etc.) needs.
You are the "god object" for the device: Almost every interesting piece of
global state eventually appears as a property on the Device object (or is
reachable from its object_list / structured_object_list). Your device server
must keep these properties in sync with the lower layers:
apdu_timeout,number_of_apdu_retries- changes must be propagated to theBACnet.Stack.ClientandBACnet.Stack.Segmentatorand partially toBACnet.Stack.SegmentsStore.max_info_frames,max_master(for MS/TP) - changes must be propagated to theBACnet.Stack.Transport.MstpTransport. Properties must not be present if no MS/TP transport is used.auto_slave_discovery,slave_proxy_enable,manual_slave_address_binding,slave_address_binding- used for a slave proxy (must be implemented by the user.- All the time-related properties (
utc_offset,daylight_savings_status) - Writes toutc_offsetor DST status usually have to be pushed into the OS or into the time-sync state machine. active_cov_subscriptions- this is a live list that the COV manager appends to / removes from when SubscribeCOV / SubscribeCOVProperty operations succeed or subscriptions expire.database_revision- you must bump it every time the set of objects or their configuration changes.- Backup/restore properties (see Clause 19.1) - the whole state machine (backup_state, backup_preparation_time, restore_preparation_time, backup_and_restore_state, last_restore_time, …) must be driven by your backup/restore service implementation.
object_listandstructured_object_list- Must be kept up to date with all "live" objects in the device.
Special write propagation: When a client writes certain Device properties your write handler must not only store the new value in the object but also push the value into the running system.
last_restart_reason, time_of_device_restart, restart_notification: These
are written by the reinitialize / power-up code. A cold boot or a
ReinitializeDevice "warmstart" / "coldstart" must update them and emits an
unconfirmed COV notification on the Device object, if the property list
restart_notification_recipients is not empty. See Clause 19.3.
COV subscriptions on the Device object itself: Because so many global things (database_revision, active_cov_subscriptions, time, etc.) live here, clients often subscribe to COVs on the Device object to be told when "something interesting about the whole device changed".
Remote Device objects: When you discover another device you can create a
"shadow" Device object (done by BACnet.Stack.ClientHelper.read_object/4)
that reflects what you last read from it.
The object_list / structured_object_list are special: When a new object
is created or deleted, you must make sure that any cached view is invalidated
and that database_revision is bumped.
ReinitializeDevice service: This service is the official way to ask a device to reboot. Your handler for it will typically:
- Validate the password, if one is configured on the Device object.
- Set the appropriate
last_restart_reason. - Persist any "about to restart" state.
- Actually restart the Erlang VM / the device itself / etc.
The long list under "Special Considerations for Device Server Implementors" in this moduledoc (and the corresponding tables in the generated part) is deliberately there to remind you of all the places where a write to the Device object has to do something outside the object store.
See also the various service modules (TimeSynchronization, DeviceCommunicationControl, ReinitializeDevice, Backup/Restore support, …) - they all ultimately read or write properties that live on the Device object.
Special Considerations for Device Server Implementors
Several Device properties require special handling by the BACnet device server (or the application using this library) on write:
active_cov_subscriptionsapdu_timeout(propagation on write)auto_slave_discoverydaylight_savings_status(auto update on DST and propagation toutc_offset)device_address_bindingmanual_slave_address_bindingmax_info_frames(marked readonly; recommended default1for MS/TP)max_master(marked readonly; recommended default127for MS/TP)number_of_apdu_retries(propagation on write)object_listslave_address_bindingslave_proxy_enablestructured_object_listutc_offset(when handling UTC time synchronisation)- All Backup/Restore related properties (Clause 19.1)
- All (UTC) Time Synchronisation related properties
Propagation of certain values (e.g. MS/TP parameters to the transport layer) is the responsibility of the device server or application code.
Examples
Creating a basic local Device object:
iex> {:ok, dev} = BACnet.Protocol.ObjectTypes.Device.create(123, "My BACnet Device", %{
...> vendor_name: "Example Inc.",
...> vendor_identifier: 999,
...> model_name: "Demo Controller",
...> segmentation_supported: :no_segmentation
...> }); dev.object_name
"My BACnet Device"Enabling restart support (the option makes additional properties required/available):
iex> {:ok, dev} = BACnet.Protocol.ObjectTypes.Device.create(1, "Dev1", %{
...> vendor_identifier: 999,
...> restart_notification_recipients: [],
...> segmentation_supported: :no_segmentation
...> }, supports_restart: true)
iex> is_list(dev.restart_notification_recipients)
trueSee Also
BACnet.Protocol.Services.ReinitializeDeviceBACnet.Protocol.Services.TimeSynchronizationBACnet.Protocol.Services.UtcTimeSynchronizationBACnet.Stack.ClientBACnet.Stack.SegmentatorBACnet.Stack.SegmentsStoreBACnet.Stack.Transport.MstpTransport
The following part has been automatically generated.
Click to expand
This module defines a BACnet object of the type `device`. The following properties are defined: | Property | Revision | Required | Readonly | Protected | Intrinsic | |----------|----------|----------|----------|-----------|-----------| | active_cov_subscriptions | | | X | | | | align_intervals | | | | | | | apdu_segment_timeout | | | X | | | | apdu_timeout | | X | X | | | | application_software_version | | X | X | | | | auto_slave_discovery | | | | | | | backup_and_restore_state | | | X | | | | backup_failure_timeout | | | X | | | | backup_preparation_time | | | X | | | | configuration_files | | | X | | | | database_revision | | X | X | | | | daylight_savings_status | | | X | | | | description | | | | | | | device_address_binding | | X | | | | | firmware_revision | | X | X | | | | interval_offset | | | | | | | last_restart_reason | | | X | | | | last_restore_time | | | X | | | | local_date | | | X | | | | local_time | | | X | | | | location | | | | | | | manual_slave_address_binding | | | | | | | max_apdu_length_accepted | | X | X | | | | max_info_frames | | | X | | | | max_master | | | X | | | | max_segments_accepted | | | X | | | | model_name | | X | X | | | | number_of_apdu_retries | | X | X | | | | object_instance | | X | X | | | | object_list | | X | X | | | | object_name | | X | X | | | | profile_location | 19 | | | | | | profile_name | | | | | | | protocol_object_types_supported | | X | X | | | | protocol_revision | | X | X | | | | protocol_services_supported | | X | X | | | | protocol_version | | X | X | | | | restart_notification_recipients | | | | | | | restore_completion_time | | | X | | | | restore_preparation_time | | | X | | | | segmentation_supported | | X | X | | | | serial_number | | | X | | | | slave_address_binding | | | | | | | slave_proxy_enable | | | | | | | structured_object_list | | | X | | | | system_status | | X | X | | | | tags | 19 | | | | | | time_of_device_restart | | | X | | | | time_synchronization_interval | | | | | | | time_synchronization_recipients | | | | | | | utc_offset | | | X | | | | utc_time_synchronization_recipients | | | | | | | vendor_identifier | | X | X | | | | vendor_name | | X | X | | | The following properties have additional semantics: | Property | Has Default | Has Init | Implicit Relationships | Validators | Annotations | |----------|-------------|----------|------------------------|------------|-------------| | active_cov_subscriptions | X | | | | | | align_intervals | X | | interval_offset | | | | apdu_segment_timeout | | | | | `required_when: {:{}, [line: 344, column: 35], [:property, :segmentation_supported, :!=, :no_segmentation]}` | | apdu_timeout | X | | | | | | application_software_version | X | | | | | | auto_slave_discovery | | | slave_address_binding | | | | backup_and_restore_state | | | | | `required_when: {:opts, :supports_backup_restore}` | | backup_failure_timeout | | | backup_preparation_time | Type | `required_when: {:opts, :supports_backup_restore}` | | backup_preparation_time | | | restore_preparation_time | Type | `required_when: {:opts, :supports_backup_restore}` | | configuration_files | | | last_restore_time | | `required_when: {:opts, :supports_backup_restore}` | | database_revision | X | | | | | | device_address_binding | X | | | | | | firmware_revision | X | | | | | | interval_offset | X | | | | | | last_restart_reason | X | | time_of_device_restart | | | | last_restore_time | | | backup_failure_timeout | | `required_when: {:opts, :supports_backup_restore}` | | local_date | | X | | | `on_read_function: {:&, [line: 356, column: 38], [{:/, [line: 356, column: 56], [{:update_local_date, [line: 356, column: 39], nil}, 1]}]}` | | local_time | | X | | | `on_read_function: {:&, [line: 362, column: 38], [{:/, [line: 362, column: 56], [{:update_local_time, [line: 362, column: 39], nil}, 1]}]}` | | manual_slave_address_binding | X | | | | | | max_apdu_length_accepted | X | | | | | | max_info_frames | | | | Type | | | max_master | | | max_info_frames | Type | | | max_segments_accepted | | | | | `required_when: {:{}, [line: 349, column: 35], [:property, :segmentation_supported, :!=, :no_segmentation]}` | | model_name | X | | | | | | number_of_apdu_retries | X | | | | | | object_list | X | | | | | | profile_location | | | | Fun | `revision: 19` | | protocol_object_types_supported | X | | | | | | protocol_revision | X | | | | | | protocol_services_supported | X | | | | | | protocol_version | X | | | | | | restart_notification_recipients | X | | | | `required_when: {:&, [line: 405, column: 35], [{:and, [line: 405, column: 48], [{:is_map, [line: 405, column: 37], [{:&, [line: 405, column: 44], [1]}]}, {:==, [line: 405, column: 74], [{{:., [from_brackets: true, line: 405, column: 54], [Access, :get]}, [from_brackets: true, line: 405, column: 54], [{:&, [line: 405, column: 52], [2]}, :supports_restart]}, true]}]}]}` | | restore_completion_time | | | backup_and_restore_state | Type | `required_when: {:opts, :supports_backup_restore}` | | restore_preparation_time | | | restore_completion_time | Type | `required_when: {:opts, :supports_backup_restore}` | | slave_address_binding | X | | manual_slave_address_binding | | | | slave_proxy_enable | | | auto_slave_discovery | | | | structured_object_list | X | | | | | | system_status | X | | | | | | tags | | | | | `revision: 19` | | time_of_device_restart | X | | restart_notification_recipients | | | | time_synchronization_interval | X | | interval_offset | | | | time_synchronization_recipients | X | | interval_offset | | | | utc_offset | X | | | | | | utc_time_synchronization_recipients | X | | interval_offset | | | | vendor_identifier | | | | Type | | | vendor_name | X | | | | | The following table shows the default values and/or init functions: | Property | Default Value | Init Function | |----------|---------------|---------------| | active_cov_subscriptions | `[]` | | | apdu_timeout | `3000` | | | application_software_version | `"bacstack-ex v0.1.0-dev.1"` | | | database_revision | `1` | | | device_address_binding | `[]` | | | firmware_revision | `"bacstack-ex v0.1.0-dev.1"` | | | interval_offset | `0` | | | last_restart_reason | `:unknown` | | | local_date | | `Utility.Internal.init_fun_local_date/0` | | local_time | | `Utility.Internal.init_fun_local_time/0` | | manual_slave_address_binding | `[]` | | | max_apdu_length_accepted | `1476` | | | model_name | `"bacstack-ex"` | | | number_of_apdu_retries | `3` | | | object_list | `%BACnet.Protocol.BACnetArray{...}` | | | protocol_object_types_supported | `%BACnet.Protocol.Device.ObjectTypesSupported{...}` | | | protocol_revision | `0` | | | protocol_services_supported | `%BACnet.Protocol.Device.ServicesSupported{...}` | | | protocol_version | `1` | | | restart_notification_recipients | `[]` | | | slave_address_binding | `[]` | | | structured_object_list | `%BACnet.Protocol.BACnetArray{...}` | | | system_status | `:operational` | | | time_of_device_restart | `%BACnet.Protocol.BACnetTimestamp{...}` | | | time_synchronization_interval | `0` | | | time_synchronization_recipients | `[]` | | | utc_offset | `0` | | | utc_time_synchronization_recipients | `[]` | | | vendor_name | `""` | |Summary
Types
Common object options for creation - all are optional.
Options accepted when creating or configuring a Device object.
Available property names for this object.
The structure for property errors.
Represents a Device object. All keys should be treated as read-only,
all updates should go only through update_property/3.
Functions
Adds an optional property to an object. Remote objects can not be mutated using this operation.
Creates a new object struct with the defined properties. Optional properties are not
created when not given, only required, given and dependency properties are created.
Properties with a value of nil are ignored.
Auto generated function to get the names of all properties this object supports.
Auto generated function to get the annotations for the given property name.
Auto generated function to get the list of annotations for each property.
Auto generated function to get the names of properties used for COV reporting.
Auto generated function to get the names of intrinsic properties.
Get the BACnet object identifier.
Auto generated function to get the names of optional properties.
Get the list of properties the object has.
Auto generated function to get a map of property name to type.
Get a property's value from an object.
Auto generated function to get the names of protected properties.
Auto generated function to get the names of readonly properties.
Auto generated function to get the names of required properties.
Get the list of known vendor IDs to vendor names.
Checks if the given object has the given property.
Checks if the given property is writable.
Removes an optional property from an object. This function is idempotent. Remote objects can not be mutated using this operation.
Auto generated function to check whether the object type supports intrinsic reporting.
Updates a property of an object.
Types
@type common_object_opts() :: {:allow_numeric_constants, boolean()} | {:allow_unknown_properties, boolean()} | {:ignore_unknown_properties, boolean()} | {:revision, BACnet.Protocol.Constants.protocol_revision()} | {:skip_property_validation_remote_object, boolean() | :value}
Common object options for creation - all are optional.
allow_numeric_constants- Constants are atoms and thus unknown constants or vendor extensions are integers and thus are rejected. Enabling this option will allow integers (non_neg_integer()) for properties with aConstants.type()spec.allow_unknown_properties- Properties that are unknown to the object implementation are usually rejected. With this option, unknown properties (numeric identifiers usually means we dont know them) are accepted and put into a separate map. This does mean we can not validate or write them. Types of the values can be anything at this point. While you can read unknown properties with atom or integer as property identifier, you can only remove numeric unknown property identifiers from an object. Property identifiers of typeatomare only accepted, if it is a remote object (object implementation is only enforced if it is a local object). Numeric property identifiers are accepted regardless of remote object or not. For remote objects, this means you have to write "raw values" (usuallyEncodingstructs).ignore_unknown_properties- Properties that are unknown to the object implementation are usually rejected. With this option, unknown properties get ignored, as if they were not specified.revision- The BACnet protocol revision to check required properties against. Optional properties are regardless of revision available. SeeBACnet.Protocol.Constants.protocol_revision/0for the available revisions.skip_property_validation_remote_object- Skips property validation for remote objects. Sometimes it is possible that the value is invalid as per BACnet specification (i.e. value 0 for a multistate object), but you still want those to be represented. Valuetrueneither type nor value are validated. Value:valuemeans the type is still validated and only the value validator is not run (if present). The property'svalidator_funwill also be skipped.
@type object_opts() :: {:supports_backup_restore, boolean()} | {:supports_restart, boolean()} | common_object_opts()
Options accepted when creating or configuring a Device object.
In addition to the common options, Device supports:
supports_backup_restore- Enables the full set of backup/restore properties.supports_restart- Enables restart notification recipient properties.
@type property_name() ::
:active_cov_subscriptions
| :align_intervals
| :apdu_segment_timeout
| :apdu_timeout
| :application_software_version
| :auto_slave_discovery
| :backup_and_restore_state
| :backup_failure_timeout
| :backup_preparation_time
| :configuration_files
| :database_revision
| :daylight_savings_status
| :description
| :device_address_binding
| :firmware_revision
| :interval_offset
| :last_restart_reason
| :last_restore_time
| :local_date
| :local_time
| :location
| :manual_slave_address_binding
| :max_apdu_length_accepted
| :max_info_frames
| :max_master
| :max_segments_accepted
| :model_name
| :number_of_apdu_retries
| :object_instance
| :object_list
| :object_name
| :profile_location
| :profile_name
| :protocol_object_types_supported
| :protocol_revision
| :protocol_services_supported
| :protocol_version
| :restart_notification_recipients
| :restore_completion_time
| :restore_preparation_time
| :segmentation_supported
| :serial_number
| :slave_address_binding
| :slave_proxy_enable
| :structured_object_list
| :system_status
| :tags
| :time_of_device_restart
| :time_synchronization_interval
| :time_synchronization_recipients
| :utc_offset
| :utc_time_synchronization_recipients
| :vendor_identifier
| :vendor_name
Available property names for this object.
@type property_update_error() :: {:error, {error :: atom(), property :: BACnet.Protocol.Constants.property_identifier()}}
The structure for property errors.
@type t() :: %BACnet.Protocol.ObjectTypes.Device{ _metadata: internal_metadata(), _unknown_properties: %{ optional(atom() | non_neg_integer()) => term() | BACnet.Protocol.ApplicationTags.Encoding.t() | [BACnet.Protocol.ApplicationTags.Encoding.t()] }, active_cov_subscriptions: [BACnet.Protocol.CovSubscription.t()] | nil, align_intervals: boolean() | nil, apdu_segment_timeout: non_neg_integer() | nil, apdu_timeout: non_neg_integer(), application_software_version: String.t(), auto_slave_discovery: BACnet.Protocol.BACnetArray.t(boolean()) | nil, backup_and_restore_state: BACnet.Protocol.Constants.backup_state() | (reserved_or_vendor_extension :: non_neg_integer()) | nil, backup_failure_timeout: BACnet.Protocol.ApplicationTags.unsigned16() | nil, backup_preparation_time: BACnet.Protocol.ApplicationTags.unsigned16() | nil, configuration_files: BACnet.Protocol.BACnetArray.t(BACnet.Protocol.ObjectIdentifier.t()) | nil, database_revision: non_neg_integer(), daylight_savings_status: boolean() | nil, description: String.t() | nil, device_address_binding: [BACnet.Protocol.AddressBinding.t()], firmware_revision: String.t(), interval_offset: non_neg_integer() | nil, last_restart_reason: BACnet.Protocol.Constants.restart_reason() | (reserved_or_vendor_extension :: non_neg_integer()) | nil, last_restore_time: BACnet.Protocol.BACnetTimestamp.t() | nil, local_date: BACnet.Protocol.BACnetDate.t() | nil, local_time: BACnet.Protocol.BACnetTime.t() | nil, location: String.t() | nil, manual_slave_address_binding: [BACnet.Protocol.AddressBinding.t()] | nil, max_apdu_length_accepted: 50..1476, max_info_frames: pos_integer() | nil, max_master: 1..127 | nil, max_segments_accepted: non_neg_integer() | nil, model_name: String.t(), number_of_apdu_retries: non_neg_integer(), object_instance: non_neg_integer(), object_list: BACnet.Protocol.BACnetArray.t(BACnet.Protocol.ObjectIdentifier.t()), object_name: String.t(), profile_location: String.t() | nil, profile_name: String.t() | nil, protocol_object_types_supported: BACnet.Protocol.Device.ObjectTypesSupported.t(), protocol_revision: non_neg_integer(), protocol_services_supported: BACnet.Protocol.Device.ServicesSupported.t(), protocol_version: non_neg_integer(), restart_notification_recipients: [BACnet.Protocol.Recipient.t()] | nil, restore_completion_time: BACnet.Protocol.ApplicationTags.unsigned16() | nil, restore_preparation_time: BACnet.Protocol.ApplicationTags.unsigned16() | nil, segmentation_supported: BACnet.Protocol.Constants.segmentation() | (reserved_or_vendor_extension :: non_neg_integer()), serial_number: String.t() | nil, slave_address_binding: [BACnet.Protocol.AddressBinding.t()] | nil, slave_proxy_enable: BACnet.Protocol.BACnetArray.t(boolean()) | nil, structured_object_list: BACnet.Protocol.BACnetArray.t(BACnet.Protocol.ObjectIdentifier.t()) | nil, system_status: BACnet.Protocol.Constants.device_status() | (reserved_or_vendor_extension :: non_neg_integer()), tags: BACnet.Protocol.BACnetArray.t(BACnet.Protocol.NameValue.t()) | nil, time_of_device_restart: BACnet.Protocol.BACnetTimestamp.t() | nil, time_synchronization_interval: non_neg_integer() | nil, time_synchronization_recipients: [BACnet.Protocol.Recipient.t()] | nil, utc_offset: integer() | nil, utc_time_synchronization_recipients: [BACnet.Protocol.Recipient.t()] | nil, vendor_identifier: BACnet.Protocol.ApplicationTags.unsigned16(), vendor_name: String.t() }
Represents a Device object. All keys should be treated as read-only,
all updates should go only through update_property/3.
UTC Offset is positive for western hemisphere and negative for eastern hemisphere in minutes, i.e. UTC+2 is -120.
Many properties have implicit relationships (e.g. last_restart_reason implies
time_of_device_restart). Some properties that participate in such relationships
do not carry a default value and must be explicitly set when creating the object.
Functions
@spec add_property(t(), BACnet.Protocol.Constants.property_identifier(), term()) :: {:ok, t()} | property_update_error()
Adds an optional property to an object. Remote objects can not be mutated using this operation.
Please note that properties of services can not be dynamically added and instead
the object must be newly created using create/4.
@spec create( non_neg_integer(), String.t(), %{optional(property_name() | atom() | non_neg_integer()) => term()}, [object_opts() | internal_metadata()] ) :: {:ok, t()} | property_update_error()
Creates a new object struct with the defined properties. Optional properties are not
created when not given, only required, given and dependency properties are created.
Properties with a value of nil are ignored.
Only properties that are required for specific services (i.e. Intrinsic Reporting) are automatically created.
@spec get_all_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of all properties this object supports.
@spec get_annotation(property_name()) :: [term()]
Auto generated function to get the annotations for the given property name.
@spec get_annotations() :: [{name :: property_name(), values :: [term()]}]
Auto generated function to get the list of annotations for each property.
@spec get_cov_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of properties used for COV reporting.
@spec get_intrinsic_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of intrinsic properties.
@spec get_object_identifier(t()) :: BACnet.Protocol.ObjectIdentifier.t()
Get the BACnet object identifier.
@spec get_optional_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of optional properties.
@spec get_properties(t()) :: [BACnet.Protocol.Constants.property_identifier()]
Get the list of properties the object has.
@spec get_properties_type_map() :: map()
Auto generated function to get a map of property name to type.
@spec get_property( t(), BACnet.Protocol.Constants.property_identifier() | non_neg_integer() ) :: {:ok, term()} | property_update_error()
Get a property's value from an object.
@spec get_protected_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of protected properties.
Protected is an annotation and the object modules prevent writing to this property directly in code. The protected properties are either written on creation or updated automatically depending on other properties being written to. Some properties are only written once at creation and never updated.
@spec get_readonly_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of readonly properties.
Readonly is only an annotation that the property should be write protected
on the BACnet side, there is no actual write protection in the object.
This is a hint to the device server. If you need actual write protection, see protected.
@spec get_required_properties() :: [BACnet.Protocol.Constants.property_identifier()]
Auto generated function to get the names of required properties.
@spec get_vendor_ids() :: %{optional(non_neg_integer()) => String.t()}
Get the list of known vendor IDs to vendor names.
Implementation Detail
Internally the vendor IDs mapping is represented as an erlang array and will be converted to a map. If you use this map multiple times in a row, consider storing it in a variable as the conversion can be computational heavy.
@spec has_property?(t(), BACnet.Protocol.Constants.property_identifier()) :: boolean()
Checks if the given object has the given property.
See BACnet.Protocol.ObjectsUtility.has_property?/2 for implementation details.
@spec property_writable?(t(), BACnet.Protocol.Constants.property_identifier()) :: boolean()
Checks if the given property is writable.
Check BACnet.Protocol.ObjectsUtility.property_writable?/2 for a basic run-down.
@spec remove_property( t(), BACnet.Protocol.Constants.property_identifier() | non_neg_integer() ) :: {:ok, t()} | property_update_error()
Removes an optional property from an object. This function is idempotent. Remote objects can not be mutated using this operation.
Please note that properties of services can not be dynamically removed and instead
the object must be newly created using create/4. Required properties can not be removed.
@spec supports_intrinsic() :: boolean()
Auto generated function to check whether the object type supports intrinsic reporting.
@spec update_property(t(), BACnet.Protocol.Constants.property_identifier(), term()) :: {:ok, t()} | property_update_error()
Updates a property of an object.