pub struct Engine<T: TransportPort + 'static> { /* private fields */ }Expand description
The read operations over one client, shared by every caller.
Calls to one device queue at its gate, one request outstanding at a time, and every request takes a slot under the global rate cap, so many callers can share an engine without overrunning a device.
Implementations§
Source§impl<T: TransportPort + 'static> Engine<T>
impl<T: TransportPort + 'static> Engine<T>
Sourcepub fn bip(&self) -> Option<&BipTransport>
pub fn bip(&self) -> Option<&BipTransport>
The client’s B/IP transport, when it has one: the BBMD reads need it.
Sourcepub fn registration_bbmd(&self) -> Option<SocketAddrV4>
pub fn registration_bbmd(&self) -> Option<SocketAddrV4>
The BBMD the client last tried to register with as a foreign device, if any. Reads the transport’s registration state and sends nothing.
Sourcepub async fn read_bdt(&self, bbmd: SocketAddrV4) -> Probe
pub async fn read_bdt(&self, bbmd: SocketAddrV4) -> Probe
Read bbmd’s BDT, after a slot under the local network’s rate and
the global one. On a client without B/IP it sends nothing.
Source§impl<T: TransportPort + 'static> Engine<T>
impl<T: TransportPort + 'static> Engine<T>
Sourcepub async fn who_is(
&self,
scope: WhoIsScope<'_>,
range: Option<DeviceInstanceRange>,
) -> Result<(), Error>
pub async fn who_is( &self, scope: WhoIsScope<'_>, range: Option<DeviceInstanceRange>, ) -> Result<(), Error>
Send one Who-Is to scope, for the devices in range (all for
None), under the rate cap. The answers land in the discovery table
(devices) as they arrive.
Sourcepub async fn discover_routers(
&self,
network: Option<u16>,
wait: Duration,
deadline: Option<Instant>,
) -> Result<Vec<DiscoveredRouter>, Error>
pub async fn discover_routers( &self, network: Option<u16>, wait: Duration, deadline: Option<Instant>, ) -> Result<Vec<DiscoveredRouter>, Error>
Broadcast one Who-Is-Router-To-Network on this network, for
network or every network (None), under the rate cap, then
collect the I-Am-Router-To-Network answers heard for wait, or
until deadline if that comes first (counted after the wait for
the rate slot): one entry per router, with the networks it reaches.
No answer is an empty list.
Sourcepub async fn station_mac(&self, address: &str) -> Result<Vec<u8>, Error>
pub async fn station_mac(&self, address: &str) -> Result<Vec<u8>, Error>
The link MAC of a station address in the target grammar, checked without sending anything: a device instance or routed target is no station address.
Sourcepub async fn devices(&self) -> Vec<DiscoveredDevice>
pub async fn devices(&self) -> Vec<DiscoveredDevice>
Every device in the client’s discovery table.
Sourcepub async fn device(&self, instance: u32) -> Option<DiscoveredDevice>
pub async fn device(&self, instance: u32) -> Option<DiscoveredDevice>
One device from the discovery table.
Sourcepub fn device_events(&self) -> Receiver<DeviceEvent>
pub fn device_events(&self) -> Receiver<DeviceEvent>
A receiver of the discovery table’s changes: devices found,
refreshed and lost. Lossy under load, like every client channel; the
table (devices) stays the truth.
Sourcepub fn address_style(&self) -> AddressStyle
pub fn address_style(&self) -> AddressStyle
How this client’s link writes addresses.
Source§impl<T: TransportPort + 'static> Engine<T>
impl<T: TransportPort + 'static> Engine<T>
Sourcepub async fn log_columns(
&self,
device: u32,
log: ObjectIdentifier,
) -> (LogColumns, Naming)
pub async fn log_columns( &self, device: u32, log: ObjectIdentifier, ) -> (LogColumns, Naming)
What each column of log on device samples, from its
Log_DeviceObjectProperty: one ReadProperty, charged like any other
read, for a Trend Log or Trend Log Multiple, and none for another
log. Naming is best effort: a refused, failed or empty read names no
column, and the values print as the log gives them. The Naming
says whether the read timed out.
Sourcepub async fn log_state_texts(
&self,
device: u32,
columns: &mut LogColumns,
out_of_time: impl Fn() -> bool,
) -> Naming
pub async fn log_state_texts( &self, device: u32, columns: &mut LogColumns, out_of_time: impl Fn() -> bool, ) -> Naming
Name the states columns sample with their objects’ state texts,
read from device: one charged request an object (ReadPropertyMultiple,
or ReadProperty each once the device has refused it), each object
once, only objects on device, at most
MAX_STATE_TEXT_OBJECTS.
Best effort: a refused read leaves its columns named as before, and
a device that stops answering, or out_of_time turning true, ends
the reading before the next object. The Naming says whether the
read that ended it timed out.
Source§impl<T: TransportPort + 'static> Engine<T>
impl<T: TransportPort + 'static> Engine<T>
Sourcepub fn new(client: Arc<BACnetClient<T>>, limits: Arc<RequestLimits>) -> Self
pub fn new(client: Arc<BACnetClient<T>>, limits: Arc<RequestLimits>) -> Self
An engine over client, under limits (shared with any other
worker on the same client).
Sourcepub fn limits(&self) -> &RequestLimits
pub fn limits(&self) -> &RequestLimits
The limits every request waits for.
Sourcepub fn client(&self) -> &Arc<BACnetClient<T>> ⓘ
pub fn client(&self) -> &Arc<BACnetClient<T>> ⓘ
The client, for the watch hub’s subscriptions and the write desk.
Sourcepub fn refused_rpm(&self, device: u32) -> bool
pub fn refused_rpm(&self, device: u32) -> bool
True once device has refused ReadPropertyMultiple.
Sourcepub async fn read(
&self,
device: u32,
object: ObjectIdentifier,
wanted: Wanted<'_>,
) -> Result<PropertyRead, Error>
pub async fn read( &self, device: u32, object: ObjectIdentifier, wanted: Wanted<'_>, ) -> Result<PropertyRead, Error>
The properties wanted of object on device: one
ReadPropertyMultiple, or ReadProperty each once the device has
refused RPM. A property the device can’t give is an error row,
not a failed read.
Sourcepub async fn read_property(
&self,
device: u32,
object: ObjectIdentifier,
property: PropertyIdentifier,
index: Option<u32>,
) -> Result<Vec<u8>, Error>
pub async fn read_property( &self, device: u32, object: ObjectIdentifier, property: PropertyIdentifier, index: Option<u32>, ) -> Result<Vec<u8>, Error>
One property of object on device, or one element of it
(index 0 is an array’s length), as its raw application-tagged
value.
Sourcepub async fn list_objects(&self, device: u32) -> Result<ListRead, Error>
pub async fn list_objects(&self, device: u32) -> Result<ListRead, Error>
device’s Object_List: whole, or element by element when the
device can’t send it in one answer (at most MAX_OBJECTS).
Sourcepub async fn describe_device(&self, device: u32) -> Result<DeviceSummary, Error>
pub async fn describe_device(&self, device: u32) -> Result<DeviceSummary, Error>
device’s DEVICE_PROPERTIES.
Sourcepub async fn read_trend(
&self,
device: u32,
log: ObjectIdentifier,
cursor: LogCursor,
page_size: u16,
) -> Result<LogPage, Error>
pub async fn read_trend( &self, device: u32, log: ObjectIdentifier, cursor: LogCursor, page_size: u16, ) -> Result<LogPage, Error>
One page of at most page_size records of log (a Trend Log,
Trend Log Multiple, Event Log or Audit Log) on device, from
cursor; the page says where to read next.
A page can take more than one request (the log’s record counts, then the ReadRange). It holds the device’s gate throughout, so they still go one at a time, and each takes a rate slot of its own.
Sourcepub async fn alarms(
&self,
device: u32,
after: Option<ObjectIdentifier>,
) -> Result<GetEventInformationAck, Error>
pub async fn alarms( &self, device: u32, after: Option<ObjectIdentifier>, ) -> Result<GetEventInformationAck, Error>
One GetEventInformation answer from device: the objects with an
event state other than normal or with transitions not yet
acknowledged. after continues from the last object of the
previous answer while that answer said more events remain.
Sourcepub async fn alarm_summary(
&self,
device: u32,
) -> Result<GetAlarmSummaryAck, Error>
pub async fn alarm_summary( &self, device: u32, ) -> Result<GetAlarmSummaryAck, Error>
device’s GetAlarmSummary answer: the objects whose alarms it
reports this way.
Sourcepub async fn enrollment_summary(
&self,
device: u32,
request: &GetEnrollmentSummaryRequest,
) -> Result<GetEnrollmentSummaryAck, Error>
pub async fn enrollment_summary( &self, device: u32, request: &GetEnrollmentSummaryRequest, ) -> Result<GetEnrollmentSummaryAck, Error>
device’s GetEnrollmentSummary answer for request’s filters.