Skip to content

feat(tagxl): decode ts2 LTE and active GNSS settings on port 151 - #213

Merged
StefanSmile merged 1 commit into
mainfrom
feat/tagxl-port151-lte-gnss
Sep 29, 2026
Merged

StefanSmile merged 1 commit into
mainfrom
feat/tagxl-port151-lte-gnss

Conversation

@StefanSmile

@StefanSmile StefanSmile commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Loros (ts2-based cellular tracker) is decoded with the Tag XL decoder, but its port 151 replies to the new ts2 LTE and GPS settings decoded to all null, because port 151 didn't know those tags. This adds them to the shared Tag XL port 151 layout, which serves as the ts2 base.

Tag Fields
0xB1 lteApn
0xB2 lteApiKeyConfigured (bool only; the API key itself is never decoded)
0xB3 lteUploadTimeOfDay (min after 00:00 UTC), lteUploadChunkSize, lteConnectionTimeout (s), lteUploadBackoff (min), lteUploadRetryCount
0xD1 gpsScanDuration (s), gpsCooloffDuration (s), gpsHdopThreshold / gpsVdopThreshold / gpsPdopThreshold (DOP, sent ×10)
0xD2 gpsConstellation (0–7), gpsPowerMode (0 full, 1 low power)

Example: 4c1002d2020201d10a0078000a00000000001e → GPS+Galileo, low power, scan 120 s, cool-off 10 s, PDOP ≤ 3.0.

Notes

  • Other devices: port 151 payloads without these tags get the new fields as null (no omitempty, consistent with existing fields like rotationInvert).
  • Truncated TLVs only fill the fields that are fully present; they never panic.
  • Tag 0x46 is unchanged (still firmwareHash). ts2 reports major/minor/patch/hw there, so the Loros firmware version still comes through as a hash-like string. That's out of scope here and will be handled separately.
  • No changes to setter specs or configuration dialects.

Testing

  • New port151_lte_gnss_test.go: GPS reply, LTE reply (API key not in JSON), empty API key, truncated values, and null behaviour + 0x46 unchanged for a Tag XL report.
  • go test ./pkg/..., go vet ./pkg/..., gofmt and make check-json-tags pass.

Summary by CodeRabbit

  • New Features
    • Added LTE and GPS settings to the decoded device information, including connection, upload, and location configuration values.
    • API keys are reported as configured or not configured; the key itself is not exposed.
  • Bug Fixes
    • Incomplete LTE and GPS values are handled safely, and settings that aren’t reported remain empty.

Add the ts2 settings replies to the shared port 151 layout:
- 0xB1 LTE APN, 0xB2 LTE API key (only reported as configured, the key is never decoded)
- 0xB3 LTE connection: upload time of day, chunk size, timeout, back-off, retry count
- 0xD1 GPS config: scan duration, cool-off, HDOP/VDOP/PDOP thresholds
- 0xD2 GPS constellation and power mode

Devices that do not report these tags get the new fields as null.
Tag 0x46 is unchanged (firmware hash).
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: ed38f208-0a19-4573-bd39-b80193a24e4c

📥 Commits

Reviewing files that changed from the base of the PR and between 99fb266 and 24b2d6e.

📒 Files selected for processing (2)
  • pkg/decoder/tagxl/v1/port151.go
  • pkg/decoder/tagxl/v1/port151_lte_gnss_test.go

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

Port 151 decoding now includes LTE and GPS configuration fields. The decoder extracts values from TLV settings, reports whether an LTE API key is configured without exposing the key, and handles incomplete values. Tests cover decoded, absent, and truncated settings.

Changes

Port 151 LTE and GPS settings

Layer / File(s) Summary
Add LTE and GPS TLV decoding
pkg/decoder/tagxl/v1/port151.go
The payload adds LTE and GPS fields and TLV tags. The decoder extracts values by byte offset, converts DOP thresholds from tenths, and reports API-key presence without exposing the key.
Check decoded and incomplete settings
pkg/decoder/tagxl/v1/port151_lte_gnss_test.go
Tests check decoded LTE and GPS values, API-key redaction and empty-key reporting, truncated values, absent settings, and firmware fields.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Feature

Suggested reviewers: niko-kriznik-globtim

Merge Risk: ⚪ Minimal · up to 24b2d

This change adds decoding of LTE and GPS settings on port 151. Devices that do not report these tags get null fields. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. 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 summarizes the main change: decoding LTE and active GNSS settings from Tag XL port 151.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@codecov-commenter

Copy link
Copy Markdown

⚠️ 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/tagxl/v1/port151.go 92.02% <100.00%> (+1.17%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@niko-kriznik-globtim niko-kriznik-globtim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems okay as a quick fix, but we should probably rethink this a bit... I am interested in knowing if this will result in these additional fields being stored on existing Tag XL devices.

@StefanSmile
StefanSmile merged commit a9a361c into main Sep 29, 2026
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