pub struct BACnetClient<T: TransportPort> { /* private fields */ }Expand description
BACnet client with low-level and high-level request APIs.
Implementations§
Source§impl BACnetClient<BipTransport>
impl BACnetClient<BipTransport>
Sourcepub fn bip_builder() -> BipClientBuilder
pub fn bip_builder() -> BipClientBuilder
Create a BIP-specific builder with interface/port/broadcast fields.
Sourcepub fn builder() -> BipClientBuilder
pub fn builder() -> BipClientBuilder
Create a BIP-specific builder (alias for backward compatibility).
Sourcepub async fn read_bdt(&self, target: &[u8]) -> Result<Vec<BdtEntry>, Error>
pub async fn read_bdt(&self, target: &[u8]) -> Result<Vec<BdtEntry>, Error>
Read the Broadcast Distribution Table from a BBMD.
Sourcepub async fn write_bdt(
&self,
target: &[u8],
entries: &[BdtEntry],
) -> Result<BvlcResultCode, Error>
pub async fn write_bdt( &self, target: &[u8], entries: &[BdtEntry], ) -> Result<BvlcResultCode, Error>
Write the Broadcast Distribution Table to a BBMD.
Sourcepub async fn read_fdt(&self, target: &[u8]) -> Result<Vec<FdtEntryWire>, Error>
pub async fn read_fdt(&self, target: &[u8]) -> Result<Vec<FdtEntryWire>, Error>
Read the Foreign Device Table from a BBMD.
Sourcepub async fn delete_fdt_entry(
&self,
target: &[u8],
ip: [u8; 4],
port: u16,
) -> Result<BvlcResultCode, Error>
pub async fn delete_fdt_entry( &self, target: &[u8], ip: [u8; 4], port: u16, ) -> Result<BvlcResultCode, Error>
Delete a Foreign Device Table entry on a BBMD.
Sourcepub async fn register_foreign_device_bvlc(
&self,
target: &[u8],
ttl: u16,
) -> Result<BvlcResultCode, Error>
pub async fn register_foreign_device_bvlc( &self, target: &[u8], ttl: u16, ) -> Result<BvlcResultCode, Error>
Register as a foreign device with a BBMD and return the result code.
Source§impl BACnetClient<Bip6Transport>
impl BACnetClient<Bip6Transport>
Sourcepub fn bip6_builder() -> Bip6ClientBuilder
pub fn bip6_builder() -> Bip6ClientBuilder
Create a BIP6-specific builder for BACnet/IPv6 transport.
Source§impl<T: TransportPort + 'static> BACnetClient<T>
impl<T: TransportPort + 'static> BACnetClient<T>
Sourcepub fn generic_builder() -> ClientBuilder<T>
pub fn generic_builder() -> ClientBuilder<T>
Create a generic builder that accepts a pre-built transport.
Sourcepub async fn start(config: ClientConfig, transport: T) -> Result<Self, Error>
pub async fn start(config: ClientConfig, transport: T) -> Result<Self, Error>
Start the client: bind transport, start network layer, spawn dispatch.
Sourcepub async fn confirmed_request(
&self,
destination_mac: &[u8],
service_choice: ConfirmedServiceChoice,
service_data: &[u8],
) -> Result<Bytes, Error>
pub async fn confirmed_request( &self, destination_mac: &[u8], service_choice: ConfirmedServiceChoice, service_data: &[u8], ) -> Result<Bytes, Error>
Send a confirmed request and wait for the response.
Returns the service response data (empty Vec for SimpleAck).
Returns an error on timeout, protocol error, reject, or abort.
Automatically uses segmented transfer when the payload exceeds the remote device’s max APDU length.
Sourcepub async fn unconfirmed_request(
&self,
destination_mac: &[u8],
service_choice: UnconfirmedServiceChoice,
service_data: &[u8],
) -> Result<(), Error>
pub async fn unconfirmed_request( &self, destination_mac: &[u8], service_choice: UnconfirmedServiceChoice, service_data: &[u8], ) -> Result<(), Error>
Send an unconfirmed request (fire-and-forget) to a specific destination.
Sourcepub async fn broadcast_unconfirmed(
&self,
service_choice: UnconfirmedServiceChoice,
service_data: &[u8],
) -> Result<(), Error>
pub async fn broadcast_unconfirmed( &self, service_choice: UnconfirmedServiceChoice, service_data: &[u8], ) -> Result<(), Error>
Broadcast an unconfirmed request on the local network.
Sourcepub async fn broadcast_global_unconfirmed(
&self,
service_choice: UnconfirmedServiceChoice,
service_data: &[u8],
) -> Result<(), Error>
pub async fn broadcast_global_unconfirmed( &self, service_choice: UnconfirmedServiceChoice, service_data: &[u8], ) -> Result<(), Error>
Broadcast an unconfirmed request globally (DNET=0xFFFF).
Unlike broadcast_unconfirmed() which only reaches the local subnet,
this sends a global broadcast that routers will forward to all networks.
Sourcepub async fn read_property(
&self,
destination_mac: &[u8],
object_identifier: ObjectIdentifier,
property_identifier: PropertyIdentifier,
property_array_index: Option<u32>,
) -> Result<ReadPropertyACK, Error>
pub async fn read_property( &self, destination_mac: &[u8], object_identifier: ObjectIdentifier, property_identifier: PropertyIdentifier, property_array_index: Option<u32>, ) -> Result<ReadPropertyACK, Error>
Read a property from a remote device.
Sourcepub async fn write_property(
&self,
destination_mac: &[u8],
object_identifier: ObjectIdentifier,
property_identifier: PropertyIdentifier,
property_array_index: Option<u32>,
property_value: Vec<u8>,
priority: Option<u8>,
) -> Result<(), Error>
pub async fn write_property( &self, destination_mac: &[u8], object_identifier: ObjectIdentifier, property_identifier: PropertyIdentifier, property_array_index: Option<u32>, property_value: Vec<u8>, priority: Option<u8>, ) -> Result<(), Error>
Write a property on a remote device.
Sourcepub async fn read_property_multiple(
&self,
destination_mac: &[u8],
specs: Vec<ReadAccessSpecification>,
) -> Result<ReadPropertyMultipleACK, Error>
pub async fn read_property_multiple( &self, destination_mac: &[u8], specs: Vec<ReadAccessSpecification>, ) -> Result<ReadPropertyMultipleACK, Error>
Read multiple properties from one or more objects on a remote device.
Sourcepub async fn write_property_multiple(
&self,
destination_mac: &[u8],
specs: Vec<WriteAccessSpecification>,
) -> Result<(), Error>
pub async fn write_property_multiple( &self, destination_mac: &[u8], specs: Vec<WriteAccessSpecification>, ) -> Result<(), Error>
Write multiple properties on one or more objects on a remote device.
Sourcepub async fn who_is(
&self,
low_limit: Option<u32>,
high_limit: Option<u32>,
) -> Result<(), Error>
pub async fn who_is( &self, low_limit: Option<u32>, high_limit: Option<u32>, ) -> Result<(), Error>
Send a WhoIs broadcast to discover devices.
Sourcepub async fn who_is_directed(
&self,
destination_mac: &[u8],
low_limit: Option<u32>,
high_limit: Option<u32>,
) -> Result<(), Error>
pub async fn who_is_directed( &self, destination_mac: &[u8], low_limit: Option<u32>, high_limit: Option<u32>, ) -> Result<(), Error>
Send a directed (unicast) WhoIs to a specific device.
Sourcepub async fn who_is_network(
&self,
dest_network: u16,
low_limit: Option<u32>,
high_limit: Option<u32>,
) -> Result<(), Error>
pub async fn who_is_network( &self, dest_network: u16, low_limit: Option<u32>, high_limit: Option<u32>, ) -> Result<(), Error>
Send a WhoIs broadcast to a specific remote network.
Unlike who_is() which broadcasts globally (DNET=0xFFFF), this
targets a single network number so only devices on that network respond.
Sourcepub async fn who_has(
&self,
object: WhoHasObject,
low_limit: Option<u32>,
high_limit: Option<u32>,
) -> Result<(), Error>
pub async fn who_has( &self, object: WhoHasObject, low_limit: Option<u32>, high_limit: Option<u32>, ) -> Result<(), Error>
Send a WhoHas broadcast to find an object by identifier or name.
Sourcepub async fn subscribe_cov(
&self,
destination_mac: &[u8],
subscriber_process_identifier: u32,
monitored_object_identifier: ObjectIdentifier,
confirmed: bool,
lifetime: Option<u32>,
) -> Result<(), Error>
pub async fn subscribe_cov( &self, destination_mac: &[u8], subscriber_process_identifier: u32, monitored_object_identifier: ObjectIdentifier, confirmed: bool, lifetime: Option<u32>, ) -> Result<(), Error>
Subscribe to COV notifications for an object on a remote device.
Sourcepub async fn unsubscribe_cov(
&self,
destination_mac: &[u8],
subscriber_process_identifier: u32,
monitored_object_identifier: ObjectIdentifier,
) -> Result<(), Error>
pub async fn unsubscribe_cov( &self, destination_mac: &[u8], subscriber_process_identifier: u32, monitored_object_identifier: ObjectIdentifier, ) -> Result<(), Error>
Cancel a COV subscription on a remote device.
Sourcepub async fn delete_object(
&self,
destination_mac: &[u8],
object_identifier: ObjectIdentifier,
) -> Result<(), Error>
pub async fn delete_object( &self, destination_mac: &[u8], object_identifier: ObjectIdentifier, ) -> Result<(), Error>
Delete an object on a remote device.
Sourcepub async fn create_object(
&self,
destination_mac: &[u8],
object_specifier: ObjectSpecifier,
initial_values: Vec<BACnetPropertyValue>,
) -> Result<Bytes, Error>
pub async fn create_object( &self, destination_mac: &[u8], object_specifier: ObjectSpecifier, initial_values: Vec<BACnetPropertyValue>, ) -> Result<Bytes, Error>
Create an object on a remote device.
Sourcepub async fn device_communication_control(
&self,
destination_mac: &[u8],
enable_disable: EnableDisable,
time_duration: Option<u16>,
password: Option<String>,
) -> Result<(), Error>
pub async fn device_communication_control( &self, destination_mac: &[u8], enable_disable: EnableDisable, time_duration: Option<u16>, password: Option<String>, ) -> Result<(), Error>
Send DeviceCommunicationControl to a remote device.
Sourcepub async fn reinitialize_device(
&self,
destination_mac: &[u8],
reinitialized_state: ReinitializedState,
password: Option<String>,
) -> Result<(), Error>
pub async fn reinitialize_device( &self, destination_mac: &[u8], reinitialized_state: ReinitializedState, password: Option<String>, ) -> Result<(), Error>
Send ReinitializeDevice to a remote device.
Sourcepub async fn get_event_information(
&self,
destination_mac: &[u8],
last_received_object_identifier: Option<ObjectIdentifier>,
) -> Result<Bytes, Error>
pub async fn get_event_information( &self, destination_mac: &[u8], last_received_object_identifier: Option<ObjectIdentifier>, ) -> Result<Bytes, Error>
Get event information from a remote device.
Sourcepub async fn acknowledge_alarm(
&self,
destination_mac: &[u8],
acknowledging_process_identifier: u32,
event_object_identifier: ObjectIdentifier,
event_state_acknowledged: u32,
acknowledgment_source: &str,
) -> Result<(), Error>
pub async fn acknowledge_alarm( &self, destination_mac: &[u8], acknowledging_process_identifier: u32, event_object_identifier: ObjectIdentifier, event_state_acknowledged: u32, acknowledgment_source: &str, ) -> Result<(), Error>
Acknowledge an alarm on a remote device.
Sourcepub async fn read_range(
&self,
destination_mac: &[u8],
object_identifier: ObjectIdentifier,
property_identifier: PropertyIdentifier,
property_array_index: Option<u32>,
range: Option<RangeSpec>,
) -> Result<ReadRangeAck, Error>
pub async fn read_range( &self, destination_mac: &[u8], object_identifier: ObjectIdentifier, property_identifier: PropertyIdentifier, property_array_index: Option<u32>, range: Option<RangeSpec>, ) -> Result<ReadRangeAck, Error>
Read a range of items from a list or log-buffer property.
Sourcepub async fn atomic_read_file(
&self,
destination_mac: &[u8],
file_identifier: ObjectIdentifier,
access: FileAccessMethod,
) -> Result<Bytes, Error>
pub async fn atomic_read_file( &self, destination_mac: &[u8], file_identifier: ObjectIdentifier, access: FileAccessMethod, ) -> Result<Bytes, Error>
Read file data from a remote device (stream or record access).
Sourcepub async fn atomic_write_file(
&self,
destination_mac: &[u8],
file_identifier: ObjectIdentifier,
access: FileWriteAccessMethod,
) -> Result<Bytes, Error>
pub async fn atomic_write_file( &self, destination_mac: &[u8], file_identifier: ObjectIdentifier, access: FileWriteAccessMethod, ) -> Result<Bytes, Error>
Write file data to a remote device (stream or record access).
Sourcepub async fn add_list_element(
&self,
destination_mac: &[u8],
object_identifier: ObjectIdentifier,
property_identifier: PropertyIdentifier,
property_array_index: Option<u32>,
list_of_elements: Vec<u8>,
) -> Result<(), Error>
pub async fn add_list_element( &self, destination_mac: &[u8], object_identifier: ObjectIdentifier, property_identifier: PropertyIdentifier, property_array_index: Option<u32>, list_of_elements: Vec<u8>, ) -> Result<(), Error>
Add elements to a list property on a remote device.
Sourcepub async fn remove_list_element(
&self,
destination_mac: &[u8],
object_identifier: ObjectIdentifier,
property_identifier: PropertyIdentifier,
property_array_index: Option<u32>,
list_of_elements: Vec<u8>,
) -> Result<(), Error>
pub async fn remove_list_element( &self, destination_mac: &[u8], object_identifier: ObjectIdentifier, property_identifier: PropertyIdentifier, property_array_index: Option<u32>, list_of_elements: Vec<u8>, ) -> Result<(), Error>
Remove elements from a list property on a remote device.
Sourcepub async fn time_synchronization(
&self,
destination_mac: &[u8],
date: Date,
time: Time,
) -> Result<(), Error>
pub async fn time_synchronization( &self, destination_mac: &[u8], date: Date, time: Time, ) -> Result<(), Error>
Send a TimeSynchronization request to a device (Clause 16.10.5).
This is an unconfirmed service — no response is expected.
Sourcepub async fn utc_time_synchronization(
&self,
destination_mac: &[u8],
date: Date,
time: Time,
) -> Result<(), Error>
pub async fn utc_time_synchronization( &self, destination_mac: &[u8], date: Date, time: Time, ) -> Result<(), Error>
Send a UTCTimeSynchronization request to a device (Clause 16.10.6).
This is an unconfirmed service — no response is expected.
Sourcepub fn cov_notifications(&self) -> Receiver<COVNotificationRequest>
pub fn cov_notifications(&self) -> Receiver<COVNotificationRequest>
Get a receiver for incoming COV notifications.
Can be called multiple times — each call returns a new independent receiver that gets all notifications from that point forward.
Sourcepub async fn discovered_devices(&self) -> Vec<DiscoveredDevice>
pub async fn discovered_devices(&self) -> Vec<DiscoveredDevice>
Get a snapshot of all discovered devices (from IAm responses).
Sourcepub async fn get_device(&self, instance: u32) -> Option<DiscoveredDevice>
pub async fn get_device(&self, instance: u32) -> Option<DiscoveredDevice>
Look up a discovered device by instance number.
Sourcepub async fn clear_devices(&self)
pub async fn clear_devices(&self)
Clear the discovered devices table.