Skip to content

Commit

Permalink
Always check if initialized in public API (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasKoch authored Feb 1, 2024
1 parent 290609c commit 93c489c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ublox-short-range/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ where
self.handle_urc()?;
}

if self.firmware_version()? < FirmwareVersion::new(8, 0, 0) {
let response = self.send_internal(&EdmAtCmdWrapper(SoftwareVersion), true)?;
if response.version < FirmwareVersion::new(8, 0, 0) {
self.config.network_up_bug = true;
} else {
if let Some(size) = self.config.tls_in_buffer_size {
Expand Down Expand Up @@ -343,19 +344,16 @@ where
}

pub fn firmware_version(&mut self) -> Result<FirmwareVersion, Error> {
let response = self.send_internal(&EdmAtCmdWrapper(SoftwareVersion), true)?;
let response = self.send_at(SoftwareVersion)?;
Ok(response.version)
}

pub fn signal_strength(&mut self) -> Result<i16, Error> {
if let WifiStatusResponse {
status_id: WifiStatus::RSSI(rssi),
} = self.send_internal(
&EdmAtCmdWrapper(GetWifiStatus {
status_id: StatusId::RSSI,
}),
false,
)? {
} = self.send_at(GetWifiStatus {
status_id: StatusId::RSSI,
})? {
Ok(rssi)
} else {
Err(Error::_Unknown)
Expand Down Expand Up @@ -876,7 +874,7 @@ where
A: atat::AtatCmd<LEN>,
{
if !self.initialized {
self.init()?;
return Err(Error::Uninitialized);
}
match self.serial_mode {
SerialMode::ExtendedData => self.send_internal(&EdmAtCmdWrapper(cmd), true),
Expand Down

0 comments on commit 93c489c

Please sign in to comment.