Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
12039a8
Post release version bump to 0.10.0
jefdriesen Jun 30, 2025
1c7b28f
Ignore empty samples
jefdriesen Jul 2, 2025
04eff7b
Fix an error in the OSTC 4 firmware macro
jefdriesen Jul 1, 2025
c3f23a4
Log the firmware version
jefdriesen Jul 1, 2025
d3f4a18
Merge brange 'ostc4-fw'
jefdriesen Jul 28, 2025
adadc19
Add support for new OSTC 4/5 events
jefdriesen Jul 8, 2025
7279fdb
Ignore the dummy GNSS location
jefdriesen Jul 8, 2025
6860030
Merge branch 'ostc4-events'
jefdriesen Jul 28, 2025
f94d9a2
Cache the log version internally
jefdriesen Jul 9, 2025
ee67aea
Add full timezone support
jefdriesen Jul 9, 2025
f6c7fbb
Merge branch 'symbios-timezone'
jefdriesen Jul 28, 2025
4b52efd
Support response packets with a variable size
jefdriesen Jul 24, 2025
9ea564e
Increase the size of the device info buffer
jefdriesen Jul 24, 2025
eb7d4a3
Merge branch 'symbios'
jefdriesen Aug 12, 2025
afda77e
Fix the Github actions on linux
jefdriesen Aug 25, 2025
1e0123f
Fix the Github actions on mac
jefdriesen Aug 25, 2025
461138f
Add support for the Mares Puck Pro EZ
jefdriesen Aug 24, 2025
ea91f5b
Add support for the Mares Puck Pro Ultra
jefdriesen Sep 2, 2025
ef3bef7
Add support for the Mares Quad 2
jefdriesen Aug 24, 2025
e928371
Add an option to limit the number of dives to download
tim661811 Aug 21, 2025
8d19f22
Include the stddef.h header for the size_t type
jefdriesen Sep 4, 2025
f3178e0
Check the minimum length before use
jefdriesen Aug 7, 2025
6bfdbdf
Improve the record validation
jefdriesen Jul 16, 2025
9d34ee2
Make the record validation non-fatal during the download
jefdriesen Jul 13, 2025
c6cd31d
Optimize the download using the dive number as fingerprint
jefdriesen Jul 29, 2025
3279744
Merge branch 'seac'
jefdriesen Oct 2, 2025
6026d96
Handle an invalid access code response
jefdriesen Oct 5, 2025
91e279b
Add new Shearwater hardware models
jefdriesen Oct 29, 2025
b09c8d9
Add basic support for the avelo mode
jefdriesen Nov 18, 2025
bce4420
Update libdivecomputer to latest from upstream.
mikeller Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
sudo apt-get update
sudo apt-get install libbluetooth-dev libusb-1.0-0-dev
- run: autoreconf --install --force
- run: ./configure --prefix=/usr
- run: ./configure
- run: make
- run: make distcheck
- name: Package artifacts
run: |
make install DESTDIR=$PWD/artifacts
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr/local
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.compiler }}
Expand All @@ -56,13 +56,13 @@ jobs:
- name: Install dependencies
run: brew install autoconf automake libtool hidapi libusb
- run: autoreconf --install --force
- run: ./configure --prefix=/usr
- run: ./configure
- run: make
- run: make distcheck
- name: Package artifacts
run: |
make install DESTDIR=$PWD/artifacts
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr/local
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.compiler }}
Expand All @@ -82,7 +82,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools
run: |
sudo apt-get update
sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools
- name: Install libusb
env:
LIBUSB_VERSION: 1.0.26
Expand All @@ -91,7 +93,7 @@ jobs:
tar xzf v${LIBUSB_VERSION}.tar.gz
pushd libusb-${LIBUSB_VERSION}
autoreconf --install --force
./configure --host=${{ matrix.arch }}-w64-mingw32 --prefix=/usr
./configure --host=${{ matrix.arch }}-w64-mingw32
make
make install DESTDIR=$PWD/../artifacts
popd
Expand All @@ -103,14 +105,14 @@ jobs:
tar xzf hidapi-${HIDAPI_VERSION}.tar.gz
pushd hidapi-hidapi-${HIDAPI_VERSION}
autoreconf --install --force
./configure --host=${{ matrix.arch }}-w64-mingw32 --prefix=/usr LDFLAGS='-static-libgcc'
./configure --host=${{ matrix.arch }}-w64-mingw32 LDFLAGS='-static-libgcc'
make
make install DESTDIR=$PWD/../artifacts
popd
- run: autoreconf --install --force
- run: ./configure --host=${{ matrix.arch }}-w64-mingw32 --prefix=/usr
- run: ./configure --host=${{ matrix.arch }}-w64-mingw32
env:
PKG_CONFIG_LIBDIR: ${{ github.workspace }}/artifacts/usr/lib/pkgconfig
PKG_CONFIG_LIBDIR: ${{ github.workspace }}/artifacts/usr/local/lib/pkgconfig
PKG_CONFIG_SYSROOT_DIR: ${{ github.workspace }}/artifacts
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS: 1
PKG_CONFIG_ALLOW_SYSTEM_LIBS: 1
Expand All @@ -119,7 +121,7 @@ jobs:
- name: Package artifacts
run: |
make install DESTDIR=$PWD/artifacts
tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr
tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr/local
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.arch }}
Expand All @@ -140,18 +142,18 @@ jobs:
# CONFIGURATION: Release
#
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - uses: msys2/setup-msys2@v2
# with:
# install: autoconf automake libtool pkg-config make gcc
# - run: |
# autoreconf --install --force
# ./configure --prefix=/usr
# ./configure
# make -C src revision.h
# shell: msys2 {0}
# - uses: microsoft/setup-msbuild@v1
# - uses: microsoft/setup-msbuild@v2
# - run: msbuild -m -p:Platform=${{ matrix.platform }} -p:Configuration=${{ env.CONFIGURATION }} contrib/msvc/libdivecomputer.vcxproj
# - uses: actions/upload-artifact@v3
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ github.job }}-${{ matrix.platform }}
# path: contrib/msvc/${{ matrix.platform }}/${{ env.CONFIGURATION }}/bin
Expand All @@ -166,7 +168,7 @@ jobs:
- uses: actions/checkout@v4
- run: |
autoreconf --install --force
./configure --prefix=/usr
./configure
make -C src revision.h
- run: $ANDROID_NDK/ndk-build -C contrib/android NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk
- uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- name: Build distribution tarball
id: build
run: |
sudo apt-get update
sudo apt-get install libbluetooth-dev libusb-1.0-0-dev
autoreconf --install --force
./configure
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Versioning.
m4_define([dc_version_major],[0])
m4_define([dc_version_minor],[9])
m4_define([dc_version_minor],[10])
m4_define([dc_version_micro],[0])
m4_define([dc_version_suffix],[devel-Subsurface-NG])
m4_define([dc_version],dc_version_major.dc_version_minor.dc_version_micro[]m4_ifset([dc_version_suffix],-[dc_version_suffix]))
Expand Down
1 change: 1 addition & 0 deletions contrib/android/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ LOCAL_SRC_FILES := \
src/reefnet_sensusultra_parser.c \
src/ringbuffer.c \
src/seac_screen.c \
src/seac_screen_common.c \
src/seac_screen_parser.c \
src/serial_posix.c \
src/shearwater_common.c \
Expand Down
2 changes: 2 additions & 0 deletions contrib/msvc/libdivecomputer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<ClCompile Include="..\..\src\reefnet_sensus_parser.c" />
<ClCompile Include="..\..\src\ringbuffer.c" />
<ClCompile Include="..\..\src\seac_screen.c" />
<ClCompile Include="..\..\src\seac_screen_common.c" />
<ClCompile Include="..\..\src\seac_screen_parser.c" />
<ClCompile Include="..\..\src\serial_win32.c" />
<ClCompile Include="..\..\src\shearwater_common.c" />
Expand Down Expand Up @@ -370,6 +371,7 @@
<ClInclude Include="..\..\src\reefnet_sensusultra.h" />
<ClInclude Include="..\..\src\revision.h" />
<ClInclude Include="..\..\src\ringbuffer.h" />
<ClInclude Include="..\..\src\seac_screen_common.h" />
<ClInclude Include="..\..\src\seac_screen.h" />
<ClInclude Include="..\..\src\shearwater_common.h" />
<ClInclude Include="..\..\src\shearwater_petrel.h" />
Expand Down
20 changes: 17 additions & 3 deletions examples/dctool_download.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef struct dive_data_t {
dc_buffer_t **fingerprint;
unsigned int number;
dctool_output_t *output;
unsigned int limit;
} dive_data_t;

static int
Expand Down Expand Up @@ -96,6 +97,11 @@ dive_cb (const unsigned char *data, unsigned int size, const unsigned char *fing

cleanup:
dc_parser_destroy (parser);

if (divedata->limit > 0 && divedata->number >= divedata->limit) {
return 0;
}

return 1;
}

Expand Down Expand Up @@ -146,7 +152,7 @@ event_cb (dc_device_t *device, dc_event_type_t event, const void *data, void *us
}

static dc_status_t
download (dc_context_t *context, dc_descriptor_t *descriptor, dc_transport_t transport, const char *devname, const char *cachedir, dc_buffer_t *fingerprint, dctool_output_t *output)
download (dc_context_t *context, dc_descriptor_t *descriptor, dc_transport_t transport, const char *devname, const char *cachedir, dc_buffer_t *fingerprint, dctool_output_t *output, unsigned int limit)
{
dc_status_t rc = DC_STATUS_SUCCESS;
dc_iostream_t *iostream = NULL;
Expand Down Expand Up @@ -214,6 +220,7 @@ download (dc_context_t *context, dc_descriptor_t *descriptor, dc_transport_t tra
divedata.fingerprint = &ofingerprint;
divedata.number = 0;
divedata.output = output;
divedata.limit = limit;

// Download the dives.
message ("Downloading the dives.\n");
Expand Down Expand Up @@ -260,10 +267,11 @@ dctool_download_run (int argc, char *argv[], dc_context_t *context, dc_descripto
const char *filename = NULL;
const char *cachedir = NULL;
const char *format = "xml";
unsigned int limit = 0;

// Parse the command-line options.
int opt = 0;
const char *optstring = "ht:o:p:c:f:u:";
const char *optstring = "ht:o:p:c:f:u:l:";
#ifdef HAVE_GETOPT_LONG
struct option options[] = {
{"help", no_argument, 0, 'h'},
Expand All @@ -273,6 +281,7 @@ dctool_download_run (int argc, char *argv[], dc_context_t *context, dc_descripto
{"cache", required_argument, 0, 'c'},
{"format", required_argument, 0, 'f'},
{"units", required_argument, 0, 'u'},
{"limit", required_argument, 0, 'l'},
{0, 0, 0, 0 }
};
while ((opt = getopt_long (argc, argv, optstring, options, NULL)) != -1) {
Expand Down Expand Up @@ -304,6 +313,9 @@ dctool_download_run (int argc, char *argv[], dc_context_t *context, dc_descripto
if (strcmp (optarg, "imperial") == 0)
units = DCTOOL_UNITS_IMPERIAL;
break;
case 'l':
limit = strtoul (optarg, NULL, 0);
break;
default:
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -345,7 +357,7 @@ dctool_download_run (int argc, char *argv[], dc_context_t *context, dc_descripto
}

// Download the dives.
status = download (context, descriptor, transport, argv[0], cachedir, fingerprint, output);
status = download (context, descriptor, transport, argv[0], cachedir, fingerprint, output, limit);
if (status != DC_STATUS_SUCCESS) {
message ("ERROR: %s\n", dctool_errmsg (status));
exitcode = EXIT_FAILURE;
Expand Down Expand Up @@ -375,6 +387,7 @@ const dctool_command_t dctool_download = {
" -c, --cache <directory> Cache directory\n"
" -f, --format <format> Output format\n"
" -u, --units <units> Set units (metric or imperial)\n"
" -l, --limit <number> Maximum number of dives to download\n"
#else
" -h Show help message\n"
" -t <transport> Transport type\n"
Expand All @@ -383,6 +396,7 @@ const dctool_command_t dctool_download = {
" -c <directory> Cache directory\n"
" -f <format> Output format\n"
" -u <units> Set units (metric or imperial)\n"
" -l <limit> Maximum number of dives to download\n"
#endif
"\n"
"Supported output formats:\n"
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ libdivecomputer_la_SOURCES = \
liquivision_lynx.h liquivision_lynx.c liquivision_lynx_parser.c \
sporasub_sp2.h sporasub_sp2.c sporasub_sp2_parser.c \
deepsix_excursion.h deepsix_excursion.c deepsix_excursion_parser.c \
seac_screen_common.h seac_screen_common.c \
seac_screen.h seac_screen.c seac_screen_parser.c \
deepblu_cosmiq.h deepblu_cosmiq.c deepblu_cosmiq_parser.c \
oceans_s1_common.h oceans_s1_common.c \
Expand Down
9 changes: 9 additions & 0 deletions src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ array_uint16_le (const unsigned char data[])
((unsigned int) data[1] << 8);
}

float
array_float_le (const unsigned char data[])
{
float result = 0;
unsigned int value = array_uint32_le (data);
memcpy (&result, &value, sizeof(value));
return result;
}

void
array_uint64_be_set (unsigned char data[], const unsigned long long input)
{
Expand Down
3 changes: 3 additions & 0 deletions src/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ array_uint16_be (const unsigned char data[]);
unsigned short
array_uint16_le (const unsigned char data[]);

float
array_float_le (const unsigned char data[]);

void
array_uint64_be_set (unsigned char data[], const unsigned long long input);

Expand Down
6 changes: 6 additions & 0 deletions src/deepblu_cosmiq_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ deepblu_cosmiq_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback
unsigned int time = 0;
unsigned int offset = SZ_HEADER;
while (offset + SZ_SAMPLE <= size) {
// Ignore empty samples.
if (array_isequal (data + offset, SZ_SAMPLE, 0xFF)) {
offset += SZ_SAMPLE;
continue;
}

dc_sample_value_t sample = {0};
unsigned int temperature = array_uint16_le(data + offset + 0);
unsigned int depth = array_uint16_le(data + offset + 2);
Expand Down
4 changes: 4 additions & 0 deletions src/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,11 @@ static const dc_descriptor_t g_descriptors[] = {
{"Mares", "Puck Air 2", DC_FAMILY_MARES_ICONHD , 0x2D, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Sirius", DC_FAMILY_MARES_ICONHD , 0x2F, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Quad Ci", DC_FAMILY_MARES_ICONHD , 0x31, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Quad 2", DC_FAMILY_MARES_ICONHD , 0x32, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Puck 4", DC_FAMILY_MARES_ICONHD , 0x35, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Puck Lite", DC_FAMILY_MARES_ICONHD , 0x35, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Puck Pro EZ", DC_FAMILY_MARES_ICONHD , 0x35, DC_TRANSPORT_BLE, dc_filter_mares},
{"Mares", "Puck Pro Ultra", DC_FAMILY_MARES_ICONHD , 0x35, DC_TRANSPORT_BLE, dc_filter_mares},
/* Heinrichs Weikamp */
{"Heinrichs Weikamp", "OSTC", DC_FAMILY_HW_OSTC, 0, DC_TRANSPORT_SERIAL, NULL},
{"Heinrichs Weikamp", "OSTC Mk2", DC_FAMILY_HW_OSTC, 1, DC_TRANSPORT_SERIAL, NULL},
Expand Down Expand Up @@ -792,9 +794,11 @@ dc_filter_mares (const dc_descriptor_t *descriptor, dc_transport_t transport, co
"Mares Genius",
"Sirius",
"Quad Ci",
"Quad2",
"Puck4",
"Puck Lite",
"Puck",
"Puck Pro U",
};

if (transport == DC_TRANSPORT_BLE) {
Expand Down
37 changes: 25 additions & 12 deletions src/halcyon_symbios.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ halcyon_symbios_recv (halcyon_symbios_device_t *device, unsigned char cmd, unsig
}

static dc_status_t
halcyon_symbios_transfer (halcyon_symbios_device_t *device, unsigned char cmd, const unsigned char data[], unsigned int size, unsigned char answer[], unsigned int asize, unsigned int *errorcode)
halcyon_symbios_transfer (halcyon_symbios_device_t *device, unsigned char cmd, const unsigned char data[], unsigned int size, unsigned char answer[], unsigned int asize, unsigned int *actual, unsigned int *errorcode)
{
dc_status_t status = DC_STATUS_SUCCESS;
dc_device_t *abstract = (dc_device_t *) device;
Expand All @@ -231,11 +231,16 @@ halcyon_symbios_transfer (halcyon_symbios_device_t *device, unsigned char cmd, c
goto error_exit;
}

// Verify the length of the packet.
if (length != asize) {
ERROR (abstract->context, "Unexpected packet length (%u).", length);
status = DC_STATUS_PROTOCOL;
goto error_exit;
if (actual == NULL) {
// Verify the length of the packet.
if (length != asize) {
ERROR (abstract->context, "Unexpected packet length (%u).", length);
status = DC_STATUS_PROTOCOL;
goto error_exit;
}
} else {
// Return the actual length.
*actual = length;
}

error_exit:
Expand All @@ -257,7 +262,7 @@ halcyon_symbios_download (halcyon_symbios_device_t *device, dc_event_progress_t

// Request the data.
unsigned char response[4] = {0};
status = halcyon_symbios_transfer (device, request, data, size, response, sizeof(response), &errcode);
status = halcyon_symbios_transfer (device, request, data, size, response, sizeof(response), NULL, &errcode);
if (status != DC_STATUS_SUCCESS) {
ERROR (abstract->context, "Failed to request the data.");
goto error_exit;
Expand Down Expand Up @@ -438,19 +443,27 @@ halcyon_symbios_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba
device_event_emit (abstract, DC_EVENT_PROGRESS, &progress);

// Read the device status.
unsigned char info[20] = {0};
status = halcyon_symbios_transfer (device, CMD_GET_STATUS, NULL, 0, info, sizeof(info), NULL);
unsigned char info[36] = {0};
unsigned int info_size = 0;
status = halcyon_symbios_transfer (device, CMD_GET_STATUS, NULL, 0, info, sizeof(info), &info_size, NULL);
if (status != DC_STATUS_SUCCESS) {
ERROR (abstract->context, "Failed to read the device status.");
goto error_exit;
}

HEXDUMP (abstract->context, DC_LOGLEVEL_DEBUG, "Version", info, sizeof(info));
// Verify the length of the packet.
if (info_size < 20) {
ERROR (abstract->context, "Unexpected packet length (%u).", info_size);
status = DC_STATUS_PROTOCOL;
goto error_exit;
}

HEXDUMP (abstract->context, DC_LOGLEVEL_DEBUG, "Version", info, info_size);

// Emit a vendor event.
dc_event_vendor_t vendor;
vendor.data = info;
vendor.size = sizeof(info);
vendor.size = info_size;
device_event_emit (abstract, DC_EVENT_VENDOR, &vendor);

// Emit a device info event.
Expand Down Expand Up @@ -568,7 +581,7 @@ halcyon_symbios_device_timesync (dc_device_t *abstract, const dc_datetime_t *dat
datetime->minute,
datetime->second,
};
status = halcyon_symbios_transfer (device, CMD_SET_TIME, request, sizeof(request), NULL, 0, NULL);
status = halcyon_symbios_transfer (device, CMD_SET_TIME, request, sizeof(request), NULL, 0, NULL, NULL);
if (status != DC_STATUS_SUCCESS) {
ERROR (abstract->context, "Failed to set the time.");
goto error_exit;
Expand Down
Loading
Loading