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

PSD profile and PDP context #99

Merged
merged 7 commits into from
Feb 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use core::convert::Infallible;
use embedded_hal::digital::{ErrorType, InputPin, OutputPin, PinState};
use heapless::String;

pub struct NoPin;

Expand Down Expand Up @@ -75,6 +76,12 @@ pub trait CellularConfig {
const HEX_MODE: bool = true;
const OPERATOR_FORMAT: OperatorFormat = OperatorFormat::Long;

const APN: APNInfo = APNInfo {
apn: Apn::Automatic,
user_name: None,
password: None,
};

fn reset_pin(&mut self) -> Option<&mut Self::ResetPin>;
fn power_pin(&mut self) -> Option<&mut Self::PowerPin>;
fn vint_pin(&mut self) -> Option<&mut Self::VintPin>;
Expand All @@ -86,3 +93,33 @@ pub enum OperatorFormat {
Short = 1,
Numeric = 2,
}

#[derive(Debug, Clone)]
pub enum Apn {
Given(String<100>),
Automatic,
tarfu marked this conversation as resolved.
Show resolved Hide resolved
}

impl Default for Apn {
fn default() -> Self {
Self::Automatic
}
}

#[derive(Debug, Clone, Default)]
pub struct APNInfo {
pub apn: Apn,
pub user_name: Option<String<64>>,
pub password: Option<String<64>>,
}

impl APNInfo {
#[must_use]
pub fn new(apn: &str) -> Self {
Self {
apn: Apn::Given(String::try_from(apn).unwrap()),
user_name: None,
password: None,
}
}
}
Loading