Skip to main content

Engine

Struct Engine 

Source
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>

Source

pub fn bip(&self) -> Option<&BipTransport>

The client’s B/IP transport, when it has one: the BBMD reads need it.

Source

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.

Source

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

pub async fn read_fdt(&self, bbmd: SocketAddrV4) -> Outcome<Vec<FdtRow>>

Read bbmd’s FDT, as read_bdt.

Source§

impl<T: TransportPort + 'static> Engine<T>

Source

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.

Source

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.

Source

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.

Source

pub async fn devices(&self) -> Vec<DiscoveredDevice>

Every device in the client’s discovery table.

Source

pub async fn device(&self, instance: u32) -> Option<DiscoveredDevice>

One device from the discovery table.

Source

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.

Source

pub fn address_style(&self) -> AddressStyle

How this client’s link writes addresses.

Source§

impl<T: TransportPort + 'static> Engine<T>

Source

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.

Source

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>

Source

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).

Source

pub fn limits(&self) -> &RequestLimits

The limits every request waits for.

Source

pub fn client(&self) -> &Arc<BACnetClient<T>> ⓘ

The client, for the watch hub’s subscriptions and the write desk.

Source

pub fn refused_rpm(&self, device: u32) -> bool

True once device has refused ReadPropertyMultiple.

Source

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.

Source

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.

Source

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).

Source

pub async fn describe_device(&self, device: u32) -> Result<DeviceSummary, Error>

device’s DEVICE_PROPERTIES.

Source

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.

Source

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.

Source

pub async fn alarm_summary( &self, device: u32, ) -> Result<GetAlarmSummaryAck, Error>

device’s GetAlarmSummary answer: the objects whose alarms it reports this way.

Source

pub async fn enrollment_summary( &self, device: u32, request: &GetEnrollmentSummaryRequest, ) -> Result<GetEnrollmentSummaryAck, Error>

device’s GetEnrollmentSummary answer for request’s filters.

Auto Trait Implementations§

§

impl<T> !Freeze for Engine<T>

§

impl<T> !RefUnwindSafe for Engine<T>

§

impl<T> !UnwindSafe for Engine<T>

§

impl<T> Send for Engine<T>
where Arc<BACnetClient<T>>: Send,

§

impl<T> Sync for Engine<T>
where Arc<BACnetClient<T>>: Sync,

§

impl<T> Unpin for Engine<T>
where Arc<BACnetClient<T>>: Unpin,

§

impl<T> UnsafeUnpin for Engine<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more