Skip to content

Commit

Permalink
Change modelId to borrowed
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasKoch committed May 27, 2024
1 parent 049e462 commit 584bc40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/asynch/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use crate::command::control::types::FlowControl;
use crate::command::control::SetEcho;

use crate::command::dns::ResolveNameIp;
use crate::command::general::responses::FirmwareVersion;
use crate::command::general::GetCIMI;
use crate::command::general::GetFirmwareVersion;
use crate::command::general::IdentificationInformation;
use crate::command::mobile_control::responses::ModuleFunctionality;
use crate::command::mobile_control::types::PowerMode;
Expand Down Expand Up @@ -436,7 +438,10 @@ where
.map_err(|_| Error::PoweredDown)?;

let model_id = self.at_client.send(&GetModelId).await?;
self.ch.set_module(Module::from_model_id(model_id));
self.ch.set_module(Module::from_model_id(&model_id));

let FirmwareVersion { version } = self.at_client.send(&GetFirmwareVersion).await?;
info!("Found module to be: {=[u8]:a}, {=[u8]:a}", model_id.model.as_slice(), version.as_slice());

// Echo off
self.at_client.send(&SetEcho { enabled: Echo::Off }).await?;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub(crate) enum Module {
}

impl Module {
pub fn from_model_id(model_id: ModelId) -> Self {
pub fn from_model_id(model_id: &ModelId) -> Self {
match model_id.model.as_slice() {
b"LARA-R6001D" => Self::LaraR6(lara_r6::LaraR6),
id => {
Expand Down

0 comments on commit 584bc40

Please sign in to comment.