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

WIP: Async client #91

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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-impl,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 --features "lara-r6"

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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"rust-analyzer.cargo.features": [
"lara-r6",
"embassy-embedded-hal"
],
"rust-analyzer.cargo.target": "thumbv7em-none-eabihf",
"rust-analyzer.diagnostics.disabled": [
Expand Down
164 changes: 154 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,157 @@
[workspace]
resolver = "2"
members = [
"ublox-cellular",
# "examples/common_lib",
# "examples/linux",
# "examples/linux_mqtt",
# "examples/linux_jobs",
[package]
name = "ublox-cellular-rs"
version = "0.4.0"
authors = ["Mathias Koch <[email protected]>"]
description = "Driver crate for u-blox cellular devices, implementation follows 'UBX-13002752 - R65'"
readme = "../README.md"
keywords = ["arm", "cortex-m", "ublox", "cellular", "embedded-hal-driver"]
categories = ["embedded", "no-std"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/BlackbirdHQ/ublox-cellular-rs"
edition = "2021"

[lib]
name = "ublox_cellular"
doctest = false

[dependencies]
atat = { version = "0.23", features = ["derive", "bytes"] }
heapless = { version = "^0.8", features = ["serde"] }
serde = { version = "^1", default-features = false, features = ["derive"] }
#ublox-sockets = { version = "0.5", optional = true }
ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", branch = "feature/async-borrowed-sockets", optional = true }
embassy-time = "0.3"
embassy-sync = "0.6"

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

futures-util = { version = "0.3.29", default-features = false }

embassy-futures = { version = "0.1" }

embedded-hal = "1.0.0"
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" }

embassy-net-ppp = { version = "0.1", optional = true }
embassy-net = { version = "0.4", features = [
"proto-ipv4",
"medium-ip",
], optional = true }
embassy-embedded-hal = { version = "0.1", optional = true }

embedded-io-async = "0.6"

[features]
default = ["socket-udp", "socket-tcp", "ppp"]


### Cellular feature list from ubxlib:
use-upsd-context-activation = []
# mno-profile = []
# cscon = []
# root-of-trust = []
# async-sock-close = []
# data-counters = []
# security-tls-iana-numbering = []
# security-tls-server-name-indication = []
# security-tls-psk-as-hex = []
# mqtt = []
# mqtt-sara-r4-old-syntax = []
# mqtt-set-local-port = []
# mqtt-session-retain = []
# mqtt-binary-publish = []
# mqtt-will = []
# mqtt-keep-alive = []
# mqtt-security = []
ucged5 = []
context-mapping-required = []
# security-tls-cipher-list = []
# auto-bauding = []
# at-profiles = []
# security-ztp = []
# file-system-tag = []
# dtr-power-saving = []
# 3gpp-power-saving = []
# 3gpp-power-saving-paging-window-set = []
# deep-sleep-urc = []
# edrx = []
# mqttsn = []
# mqttsn-security = []
# cts-control = []
# sock-set-local-port = []
# fota = []
# uart-power-saving = []
# snr-reported = []
authentication-mode-automatic = []
# lwm2m = []
ucged = []
# http = []
ppp = ["dep:embassy-net-ppp", "dep:embassy-net"]


automatic-apn = []
internal-network-stack = ["dep:ublox-sockets"]

socket-tcp = ["ublox-sockets?/socket-tcp", "embassy-net?/tcp"]
socket-udp = ["ublox-sockets?/socket-udp", "embassy-net?/udp"]

defmt = [
"dep:defmt",
"atat/defmt",
"heapless/defmt-03",
"embassy-time/defmt",
"embassy-sync/defmt",
"embassy-at-cmux/defmt",
"embassy-futures/defmt",
"ublox-sockets?/defmt",
"embassy-net-ppp?/defmt",
"embassy-net?/defmt",
]
log = ["dep:log", "ublox-sockets?/log", "atat/log"]

# The supported list of cellular modules.
#
# Note: if you add a new module type here, you also need to add it in
# `modules.rs`
any-module = []
lara-r6 = ["ucged"]
lena-r8 = []
sara-r410m = ["ucged", "ucged5"]
sara-r412m = ["ucged", "ucged5"]
sara-r422 = ["context-mapping-required", "ucged"]
sara-r5 = ["context-mapping-required", "ucged", "authentication-mode-automatic"]
sara-u201 = [
"use-upsd-context-activation",
"context-mapping-required",
"ucged",
"authentication-mode-automatic",
]
toby-r2 = []

[workspace]
members = []
default-members = ["."]
exclude = ["examples"]

[patch.crates-io]
atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "c5caaf7" }
# ublox-sockets = { path = "../ublox-sockets" }
#ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", branch = "feature/async-borrowed-sockets" }
#ublox-sockets = { path = "../ublox-sockets" }

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" }
#embassy-futures = { path = "../embassy/embassy-futures" }
atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "a466836" }
# atat = { path = "../atat/atat" }

# [patch."https://github.com/MathiasKoch/embassy"]
# embassy-at-cmux = { path = "../embassy/embassy-at-cmux" }
6 changes: 0 additions & 6 deletions examples/README.md

This file was deleted.

26 changes: 0 additions & 26 deletions examples/common_lib/Cargo.toml

This file was deleted.

Loading