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

location: add cellular support with extended location example #729

Merged
merged 10 commits into from
Jan 22, 2025

Conversation

mniestroj
Copy link
Collaborator

Introduce support for Golioth cellular location service.

Move examples/zephyr/location/wifi/ to examples/zephyr/location/ and extend it to support
cellular as well. Most of the code is shared between the two, so it will lower maintenance needed as
compared to having two separate examples. Additionally this gives the benefit to test (right now
only with native_sim) getting location with information from those two technologies combined.

Supersedes: #717

Copy link

github-actions bot commented Jan 16, 2025

Visit the preview URL for this PR (updated for commit 3b33bd3):

https://golioth-firmware-sdk-doxygen-dev--pr729-location-cellu-joqlbjvz.web.app

(expires Tue, 28 Jan 2025 19:03:35 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a9993e61697a3983f3479e468bcb0b616f9a0578

@mniestroj mniestroj force-pushed the location-cellular-combined branch 3 times, most recently from c394b4a to 0463d0f Compare January 16, 2025 07:48
Copy link
Contributor

@sam-golioth sam-golioth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @mniestroj! The logic for coming WiFi and cellular is really clean.

src/location.h Outdated Show resolved Hide resolved
include/golioth/location/cellular.h Outdated Show resolved Hide resolved
include/golioth/location/cellular.h Outdated Show resolved Hide resolved
src/location_cellular.c Outdated Show resolved Hide resolved
examples/zephyr/location/Kconfig Outdated Show resolved Hide resolved
examples/zephyr/location/src/cellular.h Outdated Show resolved Hide resolved
examples/zephyr/location/src/cellular_playback.c Outdated Show resolved Hide resolved
examples/zephyr/location/src/cellular_playback_input.c Outdated Show resolved Hide resolved
examples/zephyr/location/src/cellular_nrf91.c Outdated Show resolved Hide resolved
GOLIOTH_LOCATION_FLAG_* are not part of public API, so move them to private
header instead.

This file will contain more flags related implementation in the future, so
it will make public header cleaner and easier to understand.

Signed-off-by: Marcin Niestroj <[email protected]>
golioth_location_*_append() is designed in a way that it cannot be called
interchangably for example with "cell" and "wifi" data. Instead one needs
to be finished before the other can be started.

Track which technologies (e.g. "cell" or "wifi") have been started and
finished. Do not allow to restart whatever has been finished.

Signed-off-by: Marcin Niestroj <[email protected]>
Both WiFi and cellular examples will have lots of shared code. Additionally
technology-specific code will be rather minimal, so there is little reason
to keep examples separate.

Another benefit to have a combined version is the future use case of having
both technologies (wifi and cellular) supported on single platform.

Signed-off-by: Marcin Niestroj <[email protected]>
Introduce support for Golioth cellular location service.

Signed-off-by: Marcin Niestroj <[email protected]>
Move generic location API calls from WiFi specific functions to main()
function. This will allow to encode technology specific information
independently from each other, while there will be just one request to
Golioth backend.

Signed-off-by: Marcin Niestroj <[email protected]>
It is not a good idea to constantly request WiFi scans. Instead, introduce
5s interval between those.

Signed-off-by: Marcin Niestroj <[email protected]>
Allow to run example with disabled WiFi support.

Signed-off-by: Marcin Niestroj <[email protected]>
Just enable WiFi location automatically whenever platform supports WiFi as
wireless technology.

Enable WiFi when GOLIOTH_WIFI_PLAYBACK is selected.

Signed-off-by: Marcin Niestroj <[email protected]>
Extend sample with cellular network cell towers collected over the city
trip. This is a playback with configurable speed (1x by default) to quickly
see results over time during testing (e.g. on a Grafana map plugin).

Signed-off-by: Marcin Niestroj <[email protected]>
Add nRF91 specific cellular tower information fetching and use when
requesting location data.

Use current cell only for now, as that is the only information provided
with the tested modem and SIM card. Leave logs for neighbour cells enabled,
so that extending this sample in the future is easy.

Signed-off-by: Marcin Niestroj <[email protected]>
@mniestroj mniestroj force-pushed the location-cellular-combined branch from 0463d0f to 3b33bd3 Compare January 21, 2025 19:02
Copy link

Code Coverage

Code Coverage

Package Line Rate Branch Rate Health
include.golioth 75% 50%
port.linux 62% 34%
port.utils 58% 46%
port.zephyr 58% 25%
src 67% 30%
Summary 67% (2718 / 4086) 30% (1124 / 3712)

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 57 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/location_cellular.c 0.00% 34 Missing ⚠️
src/location.c 0.00% 20 Missing ⚠️
src/location_wifi.c 0.00% 3 Missing ⚠️
Files with missing lines Coverage Δ
src/location_wifi.c 0.00% <0.00%> (ø)
src/location.c 0.00% <0.00%> (ø)
src/location_cellular.c 0.00% <0.00%> (ø)

... and 4 files with indirect coverage changes

@mniestroj mniestroj merged commit 3ecc60f into main Jan 22, 2025
139 of 141 checks passed
@mniestroj mniestroj deleted the location-cellular-combined branch January 22, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants