pub struct Znp { /* private fields */ }Expand description
A ZNP client. Clones share one connection.
Implementations§
Source§impl Znp
impl Znp
Sourcepub async fn start<T>(
io: T,
config: ClientConfig,
) -> Result<(Znp, UnboundedReceiver<ZnpEvent>), ZnpError>where
T: AsyncRead + AsyncWrite + Send + 'static,
pub async fn start<T>(
io: T,
config: ClientConfig,
) -> Result<(Znp, UnboundedReceiver<ZnpEvent>), ZnpError>where
T: AsyncRead + AsyncWrite + Send + 'static,
Connect over io: skip the bootloader, ping, and read the version,
requiring Z-Stack 3. Indications arrive on the receiver; it is
unbounded so a slow consumer never stalls responses.
Sourcepub async fn open<T>(
io: T,
config: ClientConfig,
) -> Result<(Znp, UnboundedReceiver<ZnpEvent>), ZnpError>where
T: AsyncRead + AsyncWrite + Send + 'static,
pub async fn open<T>(
io: T,
config: ClientConfig,
) -> Result<(Znp, UnboundedReceiver<ZnpEvent>), ZnpError>where
T: AsyncRead + AsyncWrite + Send + 'static,
Connect over io and read the version without requiring a
supported product: what a probe needs.
Sourcepub async fn request(&self, request: Request) -> Result<Vec<u8>, ZnpError>
pub async fn request(&self, request: Request) -> Result<Vec<u8>, ZnpError>
Send a synchronous request and return its response data.
Sourcepub async fn request_ok(&self, request: Request) -> Result<Vec<u8>, ZnpError>
pub async fn request_ok(&self, request: Request) -> Result<Vec<u8>, ZnpError>
A request whose response starts with a status byte; require success.
Sourcepub async fn nv_read(&self, id: u16) -> Result<Option<Vec<u8>>, ZnpError>
pub async fn nv_read(&self, id: u16) -> Result<Option<Vec<u8>>, ZnpError>
Read a whole OSAL NV item. None when it does not exist.
Sourcepub async fn nv_write(&self, id: u16, value: &[u8]) -> Result<(), ZnpError>
pub async fn nv_write(&self, id: u16, value: &[u8]) -> Result<(), ZnpError>
Write an OSAL NV item, creating it at this length if needed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Znp
impl !UnwindSafe for Znp
impl Freeze for Znp
impl Send for Znp
impl Sync for Znp
impl Unpin for Znp
impl UnsafeUnpin for Znp
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