pub struct Client { /* private fields */ }Expand description
Struct used to keep track of a the devices and their properties.
Implementations§
Source§impl Client
impl Client
pub fn new(feedback: Option<UnboundedSender<Command>>) -> Self
pub async fn reset(&mut self, feedback: Option<UnboundedSender<Command>>)
Sourcepub async fn get_device<'a>(
&'a self,
name: &str,
) -> Result<ActiveDevice, Error<()>>
pub async fn get_device<'a>( &'a self, name: &str, ) -> Result<ActiveDevice, Error<()>>
Async method that will wait up to 1 second for the device named name to be defined
by the INDI server. The returned ActiveDevice (if present) will be associated with
the self client for communicating changes with the INDI server it came from.
§Arguments
name- Name of device on the remote INDI server you wish to get.
§Example
use tokio::net::TcpStream;
use twinkle_client::task::Task;
use std::ops::Deref;
use indi::client;
async {
let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
let connection = TcpStream::connect("localhost:7624").await.expect("Connecting to server");
let client = indi::client::Client::new(Some(tx));
let client_task: tokio::task::JoinHandle<()> = tokio::task::spawn(indi::client::start(client.get_devices().clone(), rx, connection));
let filter_wheel = client
.get_device("ASI EFW")
.await
.expect("Getting filter wheel");
};pub async fn device<'a, E>(&'a self, name: &str) -> Option<ActiveDevice>
Sourcepub fn get_devices(&self) -> &MemoryDeviceStore
pub fn get_devices(&self) -> &MemoryDeviceStore
Returns the a read-only lock on client’s MemoryDeviceStore.
pub fn shutdown(&mut self)
pub fn send(&self, cmd: Command) -> Result<(), SendError<Command>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more