seeed_lora_e5_at_commands/general/
mod.rs1pub mod commands;
2pub mod responses;
3pub mod types;
4
5#[cfg(feature = "async")]
6pub mod asynch {
7 use crate::client::asynch::SeeedLoraE5Client;
8 use crate::general::commands::{FactoryReset, FirmwareVersion, Reset, VerifyComIsWorking};
9 use crate::general::responses::VerResponse;
10 use atat::asynch::AtatClient;
11 use atat::Error;
12 #[cfg(feature = "debug")]
13 use defmt::error;
14 use embedded_io_async::Write;
15
16 impl<'a, W: Write, const INGRESS_BUF_SIZE: usize> SeeedLoraE5Client<'a, W, INGRESS_BUF_SIZE> {
17 pub async fn verify_com_is_working(&mut self) -> Result<bool, Error> {
18 let command = VerifyComIsWorking {};
19 let response = self.client.send(&command).await?;
20 Ok(response.is_ok())
21 }
22
23 pub async fn at_echo_on(&mut self) -> Result<bool, Error> {
24 Ok(true)
26 }
27
28 pub async fn at_echo_set(&mut self, _on: bool) -> Result<bool, Error> {
29 Ok(true)
31 }
32
33 pub async fn version(&mut self) -> Result<VerResponse, Error> {
34 let command = FirmwareVersion {};
35 let response = self.client.send(&command).await?;
36 Ok(response)
37 }
38
39 pub async fn reset(&mut self) -> Result<(), Error> {
40 let command = Reset {};
41 let resp = self.client.send(&command).await;
42 if let Err(e) = resp {
43 #[cfg(feature = "debug")]
44 error!("Error resetting Seeed LoRa-E5: {:?}", e);
45 return Err(e);
46 }
47 Ok(())
48 }
49
50 pub async fn factory_reset(&mut self) -> Result<(), Error> {
51 let command = FactoryReset {};
52 let resp = self.client.send(&command).await;
53 if let Err(e) = resp {
54 #[cfg(feature = "debug")]
55 error!("Error factory resetting Seeed LoRa-E5: {:?}", e);
56 return Err(e);
57 }
58 Ok(())
59 }
60 }
61}