Skip to content

docs(ble): publish BLE File Transfer Service protocol + services overview - #273

Merged
rryles merged 4 commits into
mainfrom
docs/ble-interface-reference
Aug 8, 2026
Merged

docs(ble): publish BLE File Transfer Service protocol + services overview#273
rryles merged 4 commits into
mainfrom
docs/ble-interface-reference

Conversation

@rryles

@rryles rryles commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What

The first public documentation of the UNA Watch BLE interface — two client-facing references for companion-app and third-party integrators:

  • Docs/BLE-File-Transfer-Service.md — the FTS wire protocol. Documents the Adafruit 0xFEBB base (classic v4) and UNA's backward-compatible v5 fast-transfer extensions: read/write windowing, credit-based writes with go-back-N recovery, the DIGEST integrity query, and safe resume. Every command has a byte-offset wire table.
  • Docs/BLE-Services-Overview.md — the standard GATT service map (Device Information, Current Time, Battery, File Transfer, Nordic UART).

Why

External clients have been implementing against this interface black-box (e.g. #272), re-deriving details like the per-notification size ceiling. These docs are the wire contracts they need — wire contract only, no firmware internals.

Notes

Summary by CodeRabbit

  • Documentation
    • Added a complete BLE File Transfer Service protocol specification, including commands, security, file operations, notifications, and advanced transfer capabilities.
    • Added an overview of the watch’s BLE services, connection requirements, standard characteristics, firmware discovery, battery notifications, and related references.

…view

First public documentation of the watch's BLE interface, for companion-app
and third-party integrators:

- BLE-File-Transfer-Service.md: the FTS wire protocol -- Adafruit 0xFEBB base
  (classic v4) plus UNA's backward-compatible v5 fast-transfer extensions
  (read/write windowing, credit-based writes with go-back-N recovery, the
  DIGEST integrity query, safe resume). Byte-offset wire table per command.
- BLE-Services-Overview.md: the standard GATT service map (Device Information,
  Current Time, Battery, File Transfer, Nordic UART).

Wire contract only, no firmware internals. The "notification sizing" section
documents the MTU-3 per-notification ceiling that clients were re-deriving.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rryles, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e6d0d727-c916-4a3c-876e-df61965249ca

📥 Commits

Reviewing files that changed from the base of the PR and between e1fbd17 and 86da1b6.

📒 Files selected for processing (3)
  • Docs/BLE-File-Transfer-Service.md
  • Docs/BLE-Services-Overview.md
  • Docs/index.rst
📝 Walkthrough

Walkthrough

Added documentation for UNA Watch BLE services and the BLE File Transfer Service. The documentation covers security, service mappings, version-4 operations, version-5 transfer extensions, CRC-32 digests, resumable writes, and compatibility behavior.

Changes

BLE protocol documentation

Layer / File(s) Summary
BLE services and FTS contract
Docs/BLE-Services-Overview.md, Docs/BLE-File-Transfer-Service.md
Documents BLE services, characteristics, encrypted connections, protocol conventions, version negotiation, status codes, and notification sizing.
Version-4 file operations
Docs/BLE-File-Transfer-Service.md
Documents version-4 file reads, writes, deletes, directory operations, moves, pacing, acknowledgements, and response formats.
Version-5 transfer extensions
Docs/BLE-File-Transfer-Service.md
Documents read and write windowing, recovery behavior, CRC-32 digests, resumable writes, compatibility, and protocol attribution.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes publishing the BLE File Transfer Service protocol and BLE services overview documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/ble-interface-reference

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🤖 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 `@Docs/BLE-File-Transfer-Service.md`:
- Around line 131-132: Update Docs/BLE-File-Transfer-Service.md lines 131-132
and 218-221 so both classic and windowed READ calculations derive nextOffset
from initialOffset plus contiguousBytesReceived; do not use total received bytes
for windowed reads where chunks may arrive out of order.
- Around line 85-87: Add the text language identifier to the fenced code block
containing the notification-size arithmetic, changing its opening fence to use
text while preserving the example content.
- Around line 160-175: Update Docs/BLE-File-Transfer-Service.md at lines 160-175
to define WRITE_PACING.freeSpace as the explicit available client credit limit,
and describe progress using WRITE_PACING.offset and its ACK flow rather than
remaining file bytes or a high-water mark. Also revise lines 238-246 to remove
hole-sensitive high-water-mark semantics unless this section explicitly marks
them as an intentional protocol change; keep the documented behavior consistent
with the Adafruit v4 protocol so progress and resume calculations use credit and
ACK offsets.
- Around line 186-188: The v4 summaries in Docs/BLE-File-Transfer-Service.md
require two wire-format corrections: at lines 186-188, update the LISTDIR
summary to describe the path as a UTF-8 directory path without requiring a
trailing slash; at lines 202-203, include the one-byte separator/padding byte
between oldPath and newPath in the MOVE request format.
- Around line 28-30: Update the Version and Raw Transfer characteristic UUIDs in
the BLE File Transfer Service table from ADAF0001/ADAF0002 to ADAF0100/ADAF0200
respectively, preserving the remaining UUID segments and properties.

In `@Docs/BLE-Services-Overview.md`:
- Around line 11-14: Rename the “Standard services” heading to “Service map” and
reorganize the entries into distinct Bluetooth SIG standard and vendor-specific
service sections. Classify 0xFEBB as an Adafruit vendor service and Nordic NUS
as Nordic-specific, and use the service-specific footer reference for entries
that do not follow published SIG specifications.
- Around line 51-54: Update the Nordic UART section and its related table entry
to use the complete characteristic UUIDs, mapping
6E400002-B5A3-F393-E0A9-E50E24DCCA9E as write/RX and
6E400003-B5A3-F393-E0A9-E50E24DCCA9E as notify/TX.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cf2417ce-0cae-41ad-9661-f6cdcfe336b6

📥 Commits

Reviewing files that changed from the base of the PR and between 0d861ae and e1fbd17.

📒 Files selected for processing (2)
  • Docs/BLE-File-Transfer-Service.md
  • Docs/BLE-Services-Overview.md

Comment thread Docs/BLE-File-Transfer-Service.md
Comment thread Docs/BLE-File-Transfer-Service.md Outdated
Comment thread Docs/BLE-File-Transfer-Service.md Outdated
Comment thread Docs/BLE-File-Transfer-Service.md
Comment thread Docs/BLE-File-Transfer-Service.md Outdated
Comment thread Docs/BLE-Services-Overview.md Outdated
Comment thread Docs/BLE-Services-Overview.md Outdated
rryles added 2 commits August 8, 2026 15:33
…ible anchors

Add a '📡 BLE Interface' toctree section to Docs/index.rst listing the two
new pages (unregistered pages build as orphans and never appear in the site
nav). Replace GitHub-style {#anchor} heading IDs and their internal links —
this MyST config enables neither attrs_block nor heading auto-anchors, so
they would render literally / dangle — with plain in-page references.
…pping, code-fence lang

- MOVE request: document the 1-byte separator between oldPath and newPath
  (firmware validates sizeof(req)+oldLen+1+newLen); note both paths absolute.
- LISTDIR: path is an absolute directory (starts with /), not 'ending in /'.
- Nordic UART: give the actual characteristic directions — 6E400002 = Notify
  (watch->client), 6E400003 = Write (client->watch); flag that this is swapped
  vs Nordic's usual convention.
- Note the FTS characteristic UUIDs are UNA-specific (ADAF0001/0002) and differ
  from Adafruit upstream (ADAF0100/0200) so they aren't 'corrected' later.
- Mark the high-water-mark freeSpace as an intentional v5 refinement.
- Tag the notification-size code fence as text; rename services heading.

(Rejected the review's UUID and NUS-direction 'fixes' — both contradicted the
deployed firmware; verified against kernel source.)
@rryles

rryles commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — triaged all 7 against the firmware source (the docs must match the deployed device, which deviates from the Adafruit/Nordic norms in two places).

Applied:

  • MOVE — documented the 1-byte separator between oldPath and newPath (firmware validates sizeof(req) + oldPathLength + 1 + newPathLength); noted both paths are absolute.
  • LISTDIR — corrected: the path must be absolute (start with /), not "end with /".
  • Nordic UART — filled in the actual characteristic directions (see below).
  • Code fence — tagged the notification-size block text.
  • Services heading — renamed to "Services" (kept the source column; the vendor split was intentionally dropped earlier).
  • freeSpace — clarified it's an intentional v5 refinement.

Not applied (verified against firmware — the suggestions contradict the device):

  • Characteristic UUIDs — the watch really uses ADAF0001 / ADAF0002, not Adafruit's ADAF0100 / ADAF0200. Our implementation deviates from upstream here; a client using the upstream values would not find the characteristics. Kept the real values and added a note so they aren't "corrected" later.
  • Nordic UART direction — our firmware is swapped relative to Nordic's convention: 6E400002 = Notify (watch→client), 6E400003 = Write (client→watch). Documented the real mapping and flagged the swap.

Both rejections are behavioural deviations confirmed in the firmware, not doc errors.

For windowed reads (reassemble-by-offset), the next READ_PACING.chunkOffset
must be the first byte not yet received (initialOffset + contiguous bytes),
so a dropped notification is re-requested rather than skipped.
@rryles
rryles merged commit 2feb7a9 into main Aug 8, 2026
32 checks passed
@rryles
rryles deleted the docs/ble-interface-reference branch August 8, 2026 15:04
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.

1 participant