Skip to content

Add Smart Label port 10 active GNSS uplink decoder.#191

Merged
StefanSmile merged 2 commits into
mainfrom
feat/smartlabel-port10-active-gnss
May 29, 2026
Merged

Add Smart Label port 10 active GNSS uplink decoder.#191
StefanSmile merged 2 commits into
mainfrom
feat/smartlabel-port10-active-gnss

Conversation

@StefanSmile
Copy link
Copy Markdown
Contributor

@StefanSmile StefanSmile commented May 29, 2026

Decode lorawan_gps_ul_ts_t (20-byte fix with status, lat/lon, altitude, timestamp, battery, TTF, PDOP, and satellites) and register GNSS/timestamp/battery features. Includes Zurich sample regression test.

Summary by CodeRabbit

  • New Features

    • Added GNSS uplink decoding: extracts location (lat/lon), altitude, timestamp, battery voltage, and optional metrics (time-to-fix, PDOP, satellites) with validation and formatted JSON output.
  • Tests

    • Added and extended tests covering Port 10 GNSS scenarios, feature flags, error cases, and JSON marshaling.
  • Chores

    • Updated secrets baseline generated timestamp.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e61b5e31-a107-4232-a986-b9fad9c4b15d

📥 Commits

Reviewing files that changed from the base of the PR and between c3b8529 and 3c5e1c7.

📒 Files selected for processing (3)
  • pkg/decoder/smartlabel/v1/decoder.go
  • pkg/decoder/smartlabel/v1/decoder_test.go
  • pkg/decoder/smartlabel/v1/port10.go

📝 Walkthrough

Walkthrough

Adds SmartLabel v1 port 10 GNSS uplink support: new Port10Payload type and JSON marshaling, decoder config with byte-to-value transforms (latitude/longitude/altitude/timestamp/TTF/PDOP/battery), extended tests for port 10, and updated .secrets.baseline entries and timestamp.

Changes

Port 10 GNSS Decoder Implementation

Layer / File(s) Summary
Port10Payload type and marshaling
pkg/decoder/smartlabel/v1/port10.go
Defines Port10Payload struct with GNSS/telemetry fields (status, latitude, longitude, altitude, timestamp, battery, optional TTF, PDOP, satellites), adds custom MarshalJSON, compile-time feature interface assertions, and getter methods.
Decoder port 10 configuration and transforms
pkg/decoder/smartlabel/v1/decoder.go
Adds time import; registers case 10 in getConfig with field offsets/lengths and per-field transforms; replaces prior humidity transform with latitude, longitude, altitude, timestamp (Unix→UTC), gnssBattery, ttf (seconds→time.Duration), and pdop; sets GNSS/timestamp/battery feature flags.
Decoder test coverage for port 10
pkg/decoder/smartlabel/v1/decoder_test.go
Imports time; extends TestDecode, TestFeatures, and TestMarshal with port 10 cases (valid GNSS payloads, invalid-length error), and adds TestPort10Features to assert feature advertising and payload status.

Secrets Detection Baseline Update

Layer / File(s) Summary
Secrets baseline refresh
.secrets.baseline
Updates results["pkg/decoder/smartlabel/v1/decoder_test.go"] Hex High Entropy String hashed_secret/line_number entries and refreshes top-level generated_at timestamp.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a decoder for Smart Label port 10 active GNSS uplink, which aligns with the substantial implementation across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/smartlabel-port10-active-gnss

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/decoder/smartlabel/v1/port10.go`:
- Line 37: The Satellites field's validation is too strict and rejects valid
GNSS packets reporting 0–2 satellites; update the struct tag on Satellites (the
Satellites *uint8 field in port10.go) to either remove the validate tag entirely
or change it to allow 0 (e.g., validate:"gte=0,lte=27") so packets with 0–2
satellites are accepted while still capping at 27.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef5fefc3-e821-4e91-b1f2-b5d6957c7c99

📥 Commits

Reviewing files that changed from the base of the PR and between 73522cb and 2668aee.

📒 Files selected for processing (4)
  • .secrets.baseline
  • pkg/decoder/smartlabel/v1/decoder.go
  • pkg/decoder/smartlabel/v1/decoder_test.go
  • pkg/decoder/smartlabel/v1/port10.go

Comment thread pkg/decoder/smartlabel/v1/port10.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 29, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 29, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
pkg/decoder/smartlabel/v1/decoder.go 95.12% <100.00%> (+1.09%) ⬆️
pkg/decoder/smartlabel/v1/port10.go 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Decode lorawan_gps_ul_ts_t (20-byte fix with status, lat/lon, altitude,
timestamp, battery, TTF, PDOP, and satellites) and register GNSS/timestamp/battery
features. Includes Zurich sample regression test.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use centimeters on the wire (divide by 100 for meters) instead of the
Tag SL 1/10 meter convention. Zurich sample now decodes to ~418 m.

Co-authored-by: Cursor <cursoragent@cursor.com>
@StefanSmile StefanSmile requested a review from JanickFischer May 29, 2026 14:23
Copy link
Copy Markdown
Contributor

@JanickFischer JanickFischer left a comment

Choose a reason for hiding this comment

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

lgtm

@StefanSmile StefanSmile merged commit d39b14f into main May 29, 2026
7 of 8 checks passed
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.

3 participants