Skip to content

Commit

Permalink
handle error case in ublox and return i8
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethKnudsen97 committed Jan 22, 2025
1 parent f4387a0 commit 422da54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/asynch/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,18 @@ impl<'a, const INGRESS_BUF_SIZE: usize, const URC_CAPACITY: usize>
}
}

pub async fn get_signal_strength(&self) -> Result<i16, Error> {
pub async fn get_signal_strength(&self) -> Result<i8, Error> {
match (&self.at_client)
.send_retry(&GetWifiStatus {
status_id: StatusId::Rssi,
})
.await?
.status_id
{
WifiStatus::Rssi(s) => Ok(s),
WifiStatus::Rssi(-32768) => Err(Error::NotConnected),
WifiStatus::Rssi(s) => s
.try_into()
.map_err(|_| Error::AT(atat::Error::InvalidResponse)),
_ => Err(Error::AT(atat::Error::InvalidResponse)),
}
}
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum Error {
Timeout,
ShadowStoreBug,
AlreadyConnected,
NotConnected,
_Unknown,
}

Expand Down

0 comments on commit 422da54

Please sign in to comment.