Skip to content

suunto_nautic: Jef's Oct 22 review round - #17

Open
latishab wants to merge 6 commits into
mainfrom
fix/nautic-oct22-review
Open

latishab wants to merge 6 commits into
mainfrom
fix/nautic-oct22-review

Conversation

@latishab

Copy link
Copy Markdown
Contributor

Ports this round of the libdivecomputer#73 review (Jef's Oct 22 comments) to the fork, on top of #15:

  • c363613: a dive whose /Summary can't be fetched fails instead of coming without it (the PR already had this, the fork didn't)
  • 1965fbc: a stream that stops before its end marker or a dive that doesn't match its listed size fails instead of returning possibly truncated data; release and unsubscribe errors are returned; one GET helper; NULL checks; preallocated buffer
  • 3fef142: the dive list is kept as its raw records, newest first by reverse order instead of a sort
  • 121e79d: no more releasing a "stale" 00 slot (also removed from the extension API's subscribe)
  • 069cf94: any chunk offset other than the data received so far is an error; one code path for the Entries pages; 14-byte minimum for an empty page; layout comments

Extension API changes that come with it:

  • suunto_nautic_device_download no longer returns DC_STATUS_DATAFORMAT with a partial dive on a size mismatch; it fails with the driver's error and an empty buffer, like any other failure
  • suunto_nautic_device_subscribe resolves its path with its own GET helper, so an unknown path still returns DC_STATUS_UNSUPPORTED
  • suunto_nautic_device_list / _download read the new record buffer

Not tested on hardware yet; goes out as DC Tester build 23 first.

🤖 Generated with Claude Code

The summary was best effort, so the same dive could download with or
without it depending on a transfer error. Fail the download instead, so a
dive always includes its summary. The size check then always compares
against the full listed size.
A stream that stops before its end marker, and a dive whose size still
doesn't match the listing after the retry, now fail instead of
returning possibly truncated data. A stream that stops early is retried
like one with a missing chunk. Release and unsubscribe errors, including
a non-200 reply status, are returned to the caller. A packet for another
request is skipped with a generic warning. Merge the GET into
suunto_nautic_get_handle, check the path for NULL, allow a NULL actual
length, and preallocate the compressed buffer to the listed size.
Append the fixed size records of each /Logbook/Entries page to a byte
buffer, and process them in reverse order, since the watch lists them
oldest first. This replaces the id and size arrays and the sort.
The driver releases every handle it binds, and always uses the handle
the GET returns, so a GET that answers with the 10 slot needs no
special treatment. The slot can also be bound by another app on the
same link, which must not be released. Reword the reason for the
sequence number start, which came from the same theory.
A stream chunk at any offset other than the data received so far is an
error: apart from the end marker, which is sent twice, the watch never
repeats a chunk. Request the first /Logbook/Entries page through the
same code path, with an empty parameter list. Require the 14-byte
header of an empty page, and explain the checks that stop a paged read
from repeating the same request. Name what is known of the reply,
notification and logbook entry layouts.
…is gone

suunto_nautic_device_download looks up the listed size first. When that
listing times out or the link is gone, return the error instead of
going on to download without the size check, which only adds the
stream retries before failing the same way.
latishab added a commit to deepsealabs/libdc-swift that referenced this pull request Oct 23, 2026
A dive whose stream never reaches its end marker now times out instead
of coming back short, which Auto download treated as a lost link and
reconnected for indefinitely, never reaching the newer dives. Once the
dive's retries are used up it is reported as failed and the next
session moves on.

Point libdivecomputer at deepsealabs/libdivecomputer#17's 5b97bee (a
by-id download returns its listing's transport error). New tests pin
the foreign-notification filter (#15), an empty logbook's 14-byte page,
an unknown path's DC_STATUS_UNSUPPORTED, and the retry counts of the
stream checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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