Trait atat::AtatClient[][src]

pub trait AtatClient {
    fn send<A: AtatCmd>(&mut self, cmd: &A) -> Result<A::Response, Error>;
fn peek_urc_with<URC: AtatUrc, F: FnOnce(URC::Response) -> bool>(
        &mut self,
        f: F
    );
fn check_response<A: AtatCmd>(
        &mut self,
        cmd: &A
    ) -> Result<A::Response, Error>;
fn get_mode(&self) -> Mode;
fn reset(&mut self); fn check_urc<URC: AtatUrc>(&mut self) -> Option<URC::Response> { ... } }

Required methods

fn send<A: AtatCmd>(&mut self, cmd: &A) -> Result<A::Response, Error>[src]

Send an AT command.

cmd must implement AtatCmd.

This function will block until a response is received, if in Timeout or Blocking mode. In Nonblocking mode, the send can be called until it no longer returns nb::Error::WouldBlock, or self.check_response(cmd) can be called, with the same result.

This function will also make sure that atleast self.config.cmd_cooldown has passed since the last response or URC has been received, to allow the slave AT device time to deliver URC's.

fn peek_urc_with<URC: AtatUrc, F: FnOnce(URC::Response) -> bool>(
    &mut self,
    f: F
)
[src]

fn check_response<A: AtatCmd>(&mut self, cmd: &A) -> Result<A::Response, Error>[src]

Check if there are any responses enqueued from the ingress manager.

The function will return nb::Error::WouldBlock until a response or an error is available, or a timeout occurs and config.mode is Timeout.

This function is usually only called through send.

fn get_mode(&self) -> Mode[src]

Get the configured mode of the client.

Options are:

  • NonBlocking
  • Blocking
  • Timeout

fn reset(&mut self)[src]

Reset the client, queues and ingress buffer, discarding any contents

Loading content...

Provided methods

fn check_urc<URC: AtatUrc>(&mut self) -> Option<URC::Response>[src]

Checks if there are any URC's (Unsolicited Response Code) in queue from the ingress manager.

Example:

use atat::atat_derive::{AtatResp, AtatUrc};

#[derive(Clone, AtatResp)]
pub struct MessageWaitingIndication {
    #[at_arg(position = 0)]
    pub status: u8,
    #[at_arg(position = 1)]
    pub code: u8,
}

#[derive(Clone, AtatUrc)]
pub enum Urc {
    #[at_urc("+UMWI")]
    MessageWaitingIndication(MessageWaitingIndication),
}

// match client.check_urc::<Urc>() {
//     Some(Urc::MessageWaitingIndication(MessageWaitingIndication { status, code })) => {
//         // Do something to act on `+UMWI` URC
//     }
// }
Loading content...

Implementors

impl<Tx, T, BufLen, UrcCapacity> AtatClient for Client<Tx, T, BufLen, UrcCapacity> where
    Tx: Write<u8>,
    T: CountDown,
    T::Time: From<u32>,
    BufLen: ArrayLength<u8>,
    UrcCapacity: ArrayLength<Vec<u8, BufLen>>, 
[src]

Loading content...