Skip to content

Commit

Permalink
Remvoe CREG/CGREG/CEREG URCs for now, as they fail parsing and rely 1…
Browse files Browse the repository at this point in the history
…00% on polling network registration status instead, until parsing of the URCs are correctly distinguished from the corresponding response
  • Loading branch information
MathiasKoch committed May 4, 2023
1 parent f878494 commit 7ad4dcc
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 63 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
// with these changes RA will call `cargo check --bins` on save
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.extraArgs": [
"-bins",
"--bins",
"--target",
"x86_64-unknown-linux-gnu"
],
"rust-analyzer.cargo.features": [
"lara-r6",
],
"rust-analyzer.cargo.target": "thumbv7em-none-eabihf",
"rust-analyzer.diagnostics.disabled": [
"unresolved-import"
Expand Down
16 changes: 12 additions & 4 deletions ublox-cellular/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
command::{
general::{GetCCID, GetFirmwareVersion, GetModelId},
gpio::{
types::{GpioMode, GpioOutValue},
types::{GpioInPull, GpioMode, GpioOutValue},
SetGpioConfiguration,
},
network_service::{
Expand Down Expand Up @@ -280,6 +280,14 @@ where
false,
)?;

self.network.send_internal(
&SetGpioConfiguration {
gpio_id: 42,
gpio_mode: GpioMode::Input(GpioInPull::NoPull),
},
false,
)?;

self.network.send_internal(&GetModelId, false)?;

// self.network.send_internal(
Expand Down Expand Up @@ -554,23 +562,23 @@ where
// CREG URC
self.network.send_internal(
&SetNetworkRegistrationStatus {
n: NetworkRegistrationUrcConfig::UrcVerbose,
n: NetworkRegistrationUrcConfig::UrcDisabled,
},
true,
)?;

// CGREG URC
self.network.send_internal(
&SetGPRSNetworkRegistrationStatus {
n: GPRSNetworkRegistrationUrcConfig::UrcVerbose,
n: GPRSNetworkRegistrationUrcConfig::UrcDisabled,
},
true,
)?;

// CEREG URC
self.network.send_internal(
&SetEPSNetworkRegistrationStatus {
n: EPSNetworkRegistrationUrcConfig::UrcVerbose,
n: EPSNetworkRegistrationUrcConfig::UrcDisabled,
},
true,
)?;
Expand Down
12 changes: 6 additions & 6 deletions ublox-cellular/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ pub enum Urc {

#[at_urc("+UMWI")]
MessageWaitingIndication(sms::urc::MessageWaitingIndication),
#[at_urc("+CREG")]
NetworkRegistration(network_service::urc::NetworkRegistration),
#[at_urc("+CGREG")]
GPRSNetworkRegistration(psn::urc::GPRSNetworkRegistration),
#[at_urc("+CEREG")]
EPSNetworkRegistration(psn::urc::EPSNetworkRegistration),
// #[at_urc("+CREG")]
// NetworkRegistration(network_service::urc::NetworkRegistration),
// #[at_urc("+CGREG")]
// GPRSNetworkRegistration(psn::urc::GPRSNetworkRegistration),
// #[at_urc("+CEREG")]
// EPSNetworkRegistration(psn::urc::EPSNetworkRegistration),
#[at_urc("+UREG")]
ExtendedPSNetworkRegistration(psn::urc::ExtendedPSNetworkRegistration),

Expand Down
21 changes: 10 additions & 11 deletions ublox-cellular/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use crate::{
};
use atat::{atat_derive::AtatLen, blocking::AtatClient};
use fugit::{ExtU32, MinutesDurationU32, SecsDurationU32};
use fugit_timer::Timer;
use hash32_derive::Hash32;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -196,7 +195,7 @@ where

self.status.reg_check_time.replace(now);

// self.update_registration()?;
self.update_registration()?;

let now = self.status.timer.now();
let is_timeout = self
Expand Down Expand Up @@ -471,15 +470,15 @@ where
}) => {
info!("[URC] ExtendedPSNetworkRegistration {:?}", state);
}
Urc::GPRSNetworkRegistration(reg_params) => {
new_reg_params.replace(reg_params.into());
}
Urc::EPSNetworkRegistration(reg_params) => {
new_reg_params.replace(reg_params.into());
}
Urc::NetworkRegistration(reg_params) => {
new_reg_params.replace(reg_params.into());
}
// Urc::GPRSNetworkRegistration(reg_params) => {
// new_reg_params.replace(reg_params.into());
// }
// Urc::EPSNetworkRegistration(reg_params) => {
// new_reg_params.replace(reg_params.into());
// }
// Urc::NetworkRegistration(reg_params) => {
// new_reg_params.replace(reg_params.into());
// }
Urc::DataConnectionActivated(psn::urc::DataConnectionActivated {
result,
ip_addr: _,
Expand Down
82 changes: 41 additions & 41 deletions ublox-cellular/src/registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::command::{
network_service::{
responses::NetworkRegistrationStatus,
types::{NetworkRegistrationStat, RatAct},
urc::NetworkRegistration,
// urc::NetworkRegistration,
},
psn::{
responses::{EPSNetworkRegistrationStatus, GPRSNetworkRegistrationStatus},
types::{EPSNetworkRegistrationStat, GPRSNetworkRegistrationStat},
urc::{EPSNetworkRegistration, GPRSNetworkRegistration},
// urc::{EPSNetworkRegistration, GPRSNetworkRegistration},
},
};
use fugit::{ExtU32, TimerInstantU32};
Expand Down Expand Up @@ -308,19 +308,19 @@ where
}
}

impl From<NetworkRegistration> for RegistrationParams {
fn from(v: NetworkRegistration) -> Self {
Self {
act: RatAct::Gsm,
reg_type: RegType::Creg,
status: v.stat.into(),
cell_id: None,
lac: None,
// active_time: None,
// periodic_tau: None,
}
}
}
// impl From<NetworkRegistration> for RegistrationParams {
// fn from(v: NetworkRegistration) -> Self {
// Self {
// act: RatAct::Gsm,
// reg_type: RegType::Creg,
// status: v.stat.into(),
// cell_id: None,
// lac: None,
// // active_time: None,
// // periodic_tau: None,
// }
// }
// }

impl From<NetworkRegistrationStatus> for RegistrationParams {
fn from(v: NetworkRegistrationStatus) -> Self {
Expand All @@ -336,19 +336,19 @@ impl From<NetworkRegistrationStatus> for RegistrationParams {
}
}

impl From<GPRSNetworkRegistration> for RegistrationParams {
fn from(v: GPRSNetworkRegistration) -> Self {
Self {
act: v.act.unwrap_or(RatAct::Unknown),
reg_type: RegType::Cgreg,
status: v.stat.into(),
cell_id: v.ci,
lac: v.lac,
// active_time: None,
// periodic_tau: None,
}
}
}
// impl From<GPRSNetworkRegistration> for RegistrationParams {
// fn from(v: GPRSNetworkRegistration) -> Self {
// Self {
// act: v.act.unwrap_or(RatAct::Unknown),
// reg_type: RegType::Cgreg,
// status: v.stat.into(),
// cell_id: v.ci,
// lac: v.lac,
// // active_time: None,
// // periodic_tau: None,
// }
// }
// }

impl From<GPRSNetworkRegistrationStatus> for RegistrationParams {
fn from(v: GPRSNetworkRegistrationStatus) -> Self {
Expand All @@ -364,19 +364,19 @@ impl From<GPRSNetworkRegistrationStatus> for RegistrationParams {
}
}

impl From<EPSNetworkRegistration> for RegistrationParams {
fn from(v: EPSNetworkRegistration) -> Self {
Self {
reg_type: RegType::Cereg,
status: v.stat.into(),
cell_id: v.ci,
lac: v.tac,
act: v.act.unwrap_or(RatAct::Unknown),
// active_time: None,
// periodic_tau: None,
}
}
}
// impl From<EPSNetworkRegistration> for RegistrationParams {
// fn from(v: EPSNetworkRegistration) -> Self {
// Self {
// reg_type: RegType::Cereg,
// status: v.stat.into(),
// cell_id: v.ci,
// lac: v.tac,
// act: v.act.unwrap_or(RatAct::Unknown),
// // active_time: None,
// // periodic_tau: None,
// }
// }
// }

impl From<EPSNetworkRegistrationStatus> for RegistrationParams {
fn from(v: EPSNetworkRegistrationStatus) -> Self {
Expand Down

0 comments on commit 7ad4dcc

Please sign in to comment.