From d041700a9534379cea5e3310679dc2f9266ecc8e Mon Sep 17 00:00:00 2001 From: Latisha Date: Mon, 12 Oct 2026 11:26:59 +0800 Subject: [PATCH] suunto_nautic: public paged fetch for any resource suunto_nautic_device_fetch_paged runs the GET -> paged 0x0D -> release sequence the /Summary download uses, for any path, so a multi-page resource such as /Logbook/byId//Descriptors (about 97 pages) reaches the MAX_PAGES cap instead of stopping at the first frame. Co-Authored-By: Claude Opus 5.5 (1M context) --- include/libdivecomputer/suunto_nautic.h | 8 ++++++++ src/suunto_nautic.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/include/libdivecomputer/suunto_nautic.h b/include/libdivecomputer/suunto_nautic.h index 005b704..06426b7 100644 --- a/include/libdivecomputer/suunto_nautic.h +++ b/include/libdivecomputer/suunto_nautic.h @@ -85,6 +85,14 @@ suunto_nautic_device_list (dc_device_t *device, dc_buffer_t *ids); unsigned int suunto_nautic_extract_entry_ids (const unsigned char data[], size_t size, unsigned int *ids, unsigned int max_ids); +/* + * Paged 0x0D fetch of any resource (GET -> every page -> release), up to + * MAX_PAGES. For multi-page /Logbook/byId//... resources such as + * Descriptors; `response` receives the data bytes with page headers stripped. + */ +dc_status_t +suunto_nautic_device_fetch_paged (dc_device_t *device, const char *path, dc_buffer_t *response); + /* * Download a dive's /Summary (metadata: gradient factors, gas mix, ...). * Uses the paginated 0x0D fetch; `summary` receives the raw, uncompressed diff --git a/src/suunto_nautic.c b/src/suunto_nautic.c index 531d183..c9a9472 100644 --- a/src/suunto_nautic.c +++ b/src/suunto_nautic.c @@ -1096,6 +1096,15 @@ suunto_nautic_device_fetch_raw (dc_device_t *abstract, const char *path, dc_buff return suunto_nautic_short_fetch_frame (abstract, path, response, 1); } +dc_status_t +suunto_nautic_device_fetch_paged (dc_device_t *abstract, const char *path, dc_buffer_t *response) +{ + if (abstract == NULL || abstract->vtable->type != DC_FAMILY_SUUNTO_NAUTIC || path == NULL || response == NULL) + return DC_STATUS_INVALIDARGS; + + return suunto_nautic_device_paginated_fetch (abstract, path, response); +} + dc_status_t suunto_nautic_device_download_summary (dc_device_t *abstract, const char *logbook_id, dc_buffer_t *summary) {