Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: get signal strength #82

Merged
merged 8 commits into from
Sep 20, 2023
13 changes: 11 additions & 2 deletions ublox-cellular/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ doctest = false

[dependencies]
# atat = { version = "0.18", features = ["derive", "bytes"] }
atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "c5caaf7", features = ["derive", "defmt", "bytes"] }
atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "c5caaf7", features = [
"derive",
"defmt",
"bytes",
] }
embedded-hal = "=1.0.0-rc.1"
embedded-nal = "0.6"
hash32 = "^0.2.1"
Expand All @@ -41,7 +45,12 @@ default = ["socket-udp", "socket-tcp"]
async = ["atat/async"]

# Use `defmt-impl to enable defmt based logging
defmt-impl = ["defmt", "ublox-sockets/defmt", "atat/defmt", "heapless/defmt-impl"]
defmt-impl = [
"defmt",
"ublox-sockets/defmt",
"atat/defmt",
"heapless/defmt-impl",
]
# Use `log-impl` to enable log based logging
log-impl = ["log", "ublox-sockets/log", "atat/log"]

Expand Down
8 changes: 6 additions & 2 deletions ublox-cellular/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
SetGpioConfiguration,
},
network_service::{
responses::OperatorSelection, types::OperatorSelectionMode, GetOperatorSelection,
SetOperatorSelection,
responses::{OperatorSelection, SignalQuality},
types::OperatorSelectionMode,
GetOperatorSelection, GetSignalQuality, SetOperatorSelection,
},
psn::{types::PSEventReportingMode, SetPacketSwitchedEventReporting},
},
Expand Down Expand Up @@ -63,7 +64,7 @@
pub struct Device<'buf, 'sub, AtCl, AtUrcCh, Config, const N: usize, const L: usize> {
pub(crate) config: Config,
pub(crate) network: Network<'sub, AtCl>,
urc_channel: &'buf AtUrcCh,

Check warning on line 67 in ublox-cellular/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

field `urc_channel` is never read

warning: field `urc_channel` is never read --> ublox-cellular/src/client.rs:67:5 | 64 | pub struct Device<'buf, 'sub, AtCl, AtUrcCh, Config, const N: usize, const L: usize> { | ------ field in this struct ... 67 | urc_channel: &'buf AtUrcCh, | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default

pub(crate) state: State,
pub(crate) power_state: PowerState,
Expand Down Expand Up @@ -160,6 +161,9 @@
self.sockets.take()
}

pub fn signal_strength(&mut self) -> Result<SignalQuality, Error> {
self.send_at(&GetSignalQuality)
}
/// Run modem state machine
///
/// Turns on modem if needed and processes URCs.
Expand Down Expand Up @@ -223,7 +227,7 @@
false,
)?;

#[cfg(any(feature = "lara-r6"))]

Check warning on line 230 in ublox-cellular/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded sub `cfg` when there is only one condition

warning: unneeded sub `cfg` when there is only one condition --> ublox-cellular/src/client.rs:230:15 | 230 | #[cfg(any(feature = "lara-r6"))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `feature = "lara-r6"` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_minimal_cfg = note: `#[warn(clippy::non_minimal_cfg)]` on by default
self.network.send_internal(
&SetGpioConfiguration {
gpio_id: 42,
Expand Down Expand Up @@ -408,7 +412,7 @@
self.select_sim_card()?;

// Disable Message Waiting URCs (UMWI)
#[cfg(any(feature = "toby-r2"))]

Check warning on line 415 in ublox-cellular/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded sub `cfg` when there is only one condition

warning: unneeded sub `cfg` when there is only one condition --> ublox-cellular/src/client.rs:415:15 | 415 | #[cfg(any(feature = "toby-r2"))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `feature = "toby-r2"` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_minimal_cfg
self.network.send_internal(
&crate::command::sms::SetMessageWaitingIndication {
mode: crate::command::sms::types::MessageWaitingMode::Disabled,
Expand Down
Loading