Skip to content

Commit

Permalink
Transition to core::net
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasKoch committed Oct 29, 2024
1 parent 737de2e commit afdfff1
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 48 deletions.
88 changes: 62 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,92 @@
name: CI

on:
push:
branches:
- master
pull_request:

name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- uses: dsherret/rust-toolchain-file@v1

- name: Build (library)
run: cargo build --all --target thumbv7em-none-eabihf --features lara-r6

# - name: Build (examples)
# run: |
# for EXAMPLE in $(ls examples);
# do
# (cd examples/$EXAMPLE && cargo build)
# done

test:
name: Build & Test
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: dsherret/rust-toolchain-file@v1
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --features "defmt,lara-r6" --target thumbv7em-none-eabihf

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --features "log,lara-r6"
env:
DEFMT_LOG: off
run: cargo test --features "lara-r6"

- name: Install Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- name: Test (Miri)
run: cargo miri test --lib

rustfmt:
name: rustfmt
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3

uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- name: Rustfmt
run: cargo fmt -- --check

- name: Run rustfmt (library)
run: cargo fmt --all -- --check --verbose

- name: Run rustfmt (examples)
run: |
for EXAMPLE in $(ls examples);
do
(cd examples/$EXAMPLE && cargo fmt --all -- --check --verbose)
done
clippy:
name: clippy
name: Clippy
runs-on: ubuntu-latest
env:
CLIPPY_PARAMS: -W clippy::all -W clippy::pedantic -W clippy::nursery -W clippy::cargo
steps:
- name: Checkout source code
uses: actions/checkout@v3

uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features "lara-r6" -- ${{ env.CLIPPY_PARAMS }}

- name: Run clippy (library)
run: cargo clippy --features "lara-r6" -- ${{ env.CLIPPY_PARAMS }}

# - name: Run clippy (examples)
# run: |
# for EXAMPLE in $(ls examples);
# do
# (cd examples/$EXAMPLE && cargo clippy -- ${{ env.CLIPPY_PARAMS }})
# done
16 changes: 6 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", branch =
embassy-time = "0.3"
embassy-sync = "0.6"

no-std-net = { version = "^0.6", features = ["serde"] }

log = { version = "^0.4", default-features = false, optional = true }
defmt = { version = "^0.3", optional = true }

Expand All @@ -33,8 +31,7 @@ futures-util = { version = "0.3.29", default-features = false }
embassy-futures = { version = "0.1" }

embedded-hal = "1.0.0"
embedded-nal = "0.8"
embedded-nal-async = { version = "0.7" }
embedded-nal-async = { version = "0.8" }

embassy-at-cmux = { git = "https://github.com/MathiasKoch/embassy", rev = "c83b7a052" }
# embassy-at-cmux = { path = "../embassy/embassy-at-cmux" }
Expand Down Expand Up @@ -142,14 +139,13 @@ exclude = ["examples"]

[patch.crates-io]
#ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", branch = "feature/async-borrowed-sockets" }
no-std-net = { git = "https://github.com/rushmorem/no-std-net", branch = "issue-15" }
#ublox-sockets = { path = "../ublox-sockets" }

embassy-time = { git = "https://github.com/MathiasKoch/embassy", rev = "84dba2941" }
embassy-sync = { git = "https://github.com/MathiasKoch/embassy", rev = "84dba2941" }
embassy-futures = { git = "https://github.com/MathiasKoch/embassy", rev = "84dba2941" }
embassy-net-ppp = { git = "https://github.com/MathiasKoch/embassy", rev = "84dba2941" }
embassy-net = { git = "https://github.com/MathiasKoch/embassy", rev = "84dba2941" }
embassy-time = { git = "https://github.com/MathiasKoch/embassy", rev = "49e44344e" }
embassy-sync = { git = "https://github.com/MathiasKoch/embassy", rev = "49e44344e" }
embassy-futures = { git = "https://github.com/MathiasKoch/embassy", rev = "49e44344e" }
embassy-net-ppp = { git = "https://github.com/MathiasKoch/embassy", rev = "49e44344e" }
embassy-net = { git = "https://github.com/MathiasKoch/embassy", rev = "49e44344e" }

#embassy-time = { path = "../embassy/embassy-time" }
#embassy-sync = { path = "../embassy/embassy-sync" }
Expand Down
8 changes: 2 additions & 6 deletions src/asynch/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,15 +564,11 @@ where
};
let mut dns_servers = heapless::Vec::new();
for s in ipv4.dns_servers.iter().flatten() {
let _ =
dns_servers.push(embassy_net::Ipv4Address::from_bytes(&s.0));
let _ = dns_servers.push(*s);
}
let config =
embassy_net::ConfigV4::Static(embassy_net::StaticConfigV4 {
address: embassy_net::Ipv4Cidr::new(
embassy_net::Ipv4Address::from_bytes(&addr.0),
0,
),
address: embassy_net::Ipv4Cidr::new(addr, 0),
gateway: None,
dns_servers,
});
Expand Down
2 changes: 1 addition & 1 deletion src/asynch/ublox_stack/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use core::{cell::RefCell, future::poll_fn, task::Poll};

use atat::asynch::AtatClient;
use core::net::IpAddr;
use embedded_nal_async::AddrType;
use no_std_net::IpAddr;

use crate::asynch::ublox_stack::DnsState;

Expand Down
2 changes: 1 addition & 1 deletion src/asynch/ublox_stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ use super::AtHandle;

use atat::asynch::AtatClient;
use atomic_polyfill::{AtomicBool, AtomicU8, Ordering};
use core::net::IpAddr;
use embassy_futures::select::{select4, Either4};
use embassy_sync::waitqueue::WakerRegistration;
use embassy_time::{Duration, Ticker};
use embedded_nal_async::SocketAddr;
use futures::pin_mut;
use no_std_net::IpAddr;
use ublox_sockets::{
AnySocket, ChannelId, PeerHandle, Socket, SocketHandle, SocketSet, SocketStorage,
};
Expand Down
2 changes: 1 addition & 1 deletion src/command/ip_transport_layer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub mod types;
pub mod urc;

use atat::atat_derive::AtatCmd;
use embedded_nal::IpAddr;
use core::net::IpAddr;
use responses::{
CreateSocketResponse, SocketControlResponse, SocketData, SocketErrorResponse,
UDPSendToDataResponse, UDPSocketData, WriteSocketDataResponse,
Expand Down
2 changes: 1 addition & 1 deletion src/command/ip_transport_layer/responses.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Responses for Internet protocol transport layer Commands
use super::types::SocketControlParam;
use atat::atat_derive::AtatResp;
use embedded_nal::IpAddr;
use core::net::IpAddr;
use heapless::String;
use ublox_sockets::SocketHandle;

Expand Down
2 changes: 1 addition & 1 deletion src/command/psn/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use atat::atat_derive::{AtatEnum, AtatLen};
use embedded_nal::IpAddr;
use core::net::IpAddr;
use heapless::String;
use serde::{Deserialize, Serialize};

Expand Down
2 changes: 1 addition & 1 deletion src/command/psn/urc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::types::{
};
use crate::{command::network_service::types::RatAct, command::psn::types::ProfileId};
use atat::atat_derive::AtatResp;
use embedded_nal::IpAddr;
use core::net::IpAddr;
use heapless::String;

/// +UUPSDA
Expand Down

0 comments on commit afdfff1

Please sign in to comment.