pub struct MicrogridClientHandle { /* private fields */ }Expand description
A handle to the microgrid client connection.
This handle can be cloned as many times as needed, and each clone will share the same underlying connection to the microgrid API.
Implementations§
Source§impl MicrogridClientHandle
impl MicrogridClientHandle
Sourcepub async fn try_new(url: impl Into<String>) -> Result<Self, Error>
pub async fn try_new(url: impl Into<String>) -> Result<Self, Error>
Creates a new MicrogridClientHandle that connects to the microgrid API
at the specified URL.
pub fn new_from_client(client: impl MicrogridApiClient) -> Self
Sourcepub async fn receive_electrical_component_telemetry_stream(
&self,
electrical_component_id: u64,
) -> Result<Receiver<ElectricalComponentTelemetry>, Error>
pub async fn receive_electrical_component_telemetry_stream( &self, electrical_component_id: u64, ) -> Result<Receiver<ElectricalComponentTelemetry>, Error>
Returns a telemetry stream from an electrical component with a given ID.
When a connection to the API service is lost, reconnecting is handled automatically, and the receiver will resume receiving data from the component once the connection is re-established.
Sourcepub async fn list_electrical_components(
&self,
electrical_component_ids: Vec<u64>,
electrical_component_categories: Vec<i32>,
) -> Result<Vec<ElectricalComponent>, Error>
pub async fn list_electrical_components( &self, electrical_component_ids: Vec<u64>, electrical_component_categories: Vec<i32>, ) -> Result<Vec<ElectricalComponent>, Error>
Lists the electrical components in the local microgrid.
If provided, the filters for component IDs and categories have an AND
relationship with one another, meaning that they are applied serially,
but the elements within a single filter list have an OR relationship with
each other.
For example, if ids = [1, 2, 3], and categories = [
ComponentCategory::COMPONENT_CATEGORY_INVERTER,
ComponentCategory::COMPONENT_CATEGORY_BATTERY
],
then the results will consist of elements that
have the IDs 1, OR 2, OR 3,
AND
are of the categories ComponentCategory::COMPONENT_CATEGORY_INVERTER OR
ComponentCategory::COMPONENT_CATEGORY_BATTERY.
If a filter list is empty, then that filter is not applied.
Sourcepub async fn list_electrical_component_connections(
&self,
source_electrical_component_ids: Vec<u64>,
destination_electrical_component_ids: Vec<u64>,
) -> Result<Vec<ElectricalComponentConnection>, Error>
pub async fn list_electrical_component_connections( &self, source_electrical_component_ids: Vec<u64>, destination_electrical_component_ids: Vec<u64>, ) -> Result<Vec<ElectricalComponentConnection>, Error>
Lists the connections between the electrical components in a microgrid,
denoted by (start, end).
The direction of a connection is always away from the grid endpoint, i.e. aligned with the direction of positive current according to the passive sign convention: https://en.wikipedia.org/wiki/Passive_sign_convention
If provided, the start and end filters have an AND relationship
between each other, meaning that they are applied serially, but an OR
relationship with other elements in the same list. For example, if
start = [1, 2, 3], and end = [4, 5, 6], then the result should
have all the connections where
- each
startcomponent ID is either1,2, OR3, AND - each
endcomponent ID is either4,5, OR6.
Trait Implementations§
Source§impl Clone for MicrogridClientHandle
impl Clone for MicrogridClientHandle
Source§fn clone(&self) -> MicrogridClientHandle
fn clone(&self) -> MicrogridClientHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MicrogridClientHandle
impl RefUnwindSafe for MicrogridClientHandle
impl Send for MicrogridClientHandle
impl Sync for MicrogridClientHandle
impl Unpin for MicrogridClientHandle
impl UnwindSafe for MicrogridClientHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request