Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"])

# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
m4_version_prereq([2.70], [], [AC_PROG_CC_C99])
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AC_CHECK_PROGS([MANDOC], [mandoc])

Expand Down
1 change: 0 additions & 1 deletion contrib/android/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ LOCAL_SRC_FILES := \
src/halcyon_symbios.c \
src/halcyon_symbios_parser.c \
src/hdlc.c \
src/hw_frog.c \
src/hw_ostc3.c \
src/hw_ostc.c \
src/hw_ostc_parser.c \
Expand Down
3 changes: 0 additions & 3 deletions contrib/msvc/libdivecomputer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@
<ClCompile Include="..\..\src\halcyon_symbios.c" />
<ClCompile Include="..\..\src\halcyon_symbios_parser.c" />
<ClCompile Include="..\..\src\hdlc.c" />
<ClCompile Include="..\..\src\hw_frog.c" />
<ClCompile Include="..\..\src\hw_ostc.c" />
<ClCompile Include="..\..\src\hw_ostc3.c" />
<ClCompile Include="..\..\src\hw_ostc_parser.c" />
Expand Down Expand Up @@ -305,7 +304,6 @@
<ClInclude Include="..\..\include\libdivecomputer\descriptor.h" />
<ClInclude Include="..\..\include\libdivecomputer\device.h" />
<ClInclude Include="..\..\include\libdivecomputer\divesystem_idive.h" />
<ClInclude Include="..\..\include\libdivecomputer\hw_frog.h" />
<ClInclude Include="..\..\include\libdivecomputer\hw_ostc.h" />
<ClInclude Include="..\..\include\libdivecomputer\hw_ostc3.h" />
<ClInclude Include="..\..\include\libdivecomputer\ioctl.h" />
Expand Down Expand Up @@ -348,7 +346,6 @@
<ClInclude Include="..\..\src\garmin.h" />
<ClInclude Include="..\..\src\halcyon_symbios.h" />
<ClInclude Include="..\..\src\hdlc.h" />
<ClInclude Include="..\..\src\hw_frog.h" />
<ClInclude Include="..\..\src\hw_ostc.h" />
<ClInclude Include="..\..\src\hw_ostc3.h" />
<ClInclude Include="..\..\src\ihex.h" />
Expand Down
15 changes: 13 additions & 2 deletions examples/output_xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ sample_cb (dc_sample_type_t type, const dc_sample_value_t *value, void *userdata
case DC_SAMPLE_GASMIX:
fprintf (sampledata->ostream, " <gasmix>%u</gasmix>\n", value->gasmix);
break;
case DC_SAMPLE_LOCATION:
fprintf (sampledata->ostream,
" <location>\n"
" <latitude>%.6f</latitude>\n"
" <longitude>%.6f</longitude>\n"
" <altitude>%.3f</altitude>\n"
" </location>\n",
value->location.latitude,
value->location.longitude,
value->location.altitude);
break;
default:
break;
}
Expand Down Expand Up @@ -503,9 +514,9 @@ dctool_xml_output_write (dctool_output_t *abstract, dc_parser_t *parser, const u
if (status != DC_STATUS_UNSUPPORTED) {
fprintf (output->ostream,
"<location>\n"
" <latitude>%.6f<latitude>\n"
" <latitude>%.6f</latitude>\n"
" <longitude>%.6f</longitude>\n"
" <altitude>%.2f<altitude>\n"
" <altitude>%.2f</altitude>\n"
"</location>\n",
location.latitude,
location.longitude,
Expand Down
1 change: 0 additions & 1 deletion include/libdivecomputer/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ libdivecomputer_HEADERS = \
oceanic_veo250.h \
oceanic_vtpro.h \
hw_ostc.h \
hw_frog.h \
hw_ostc3.h \
atomics_cobalt.h \
divesystem_idive.h
48 changes: 0 additions & 48 deletions include/libdivecomputer/hw_frog.h

This file was deleted.

3 changes: 3 additions & 0 deletions include/libdivecomputer/hw_ostc3.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ extern "C" {
#define HW_OSTC3_DISPLAY_SIZE 16
#define HW_OSTC3_CUSTOMTEXT_SIZE 60

#define HW_FROG_DISPLAY_SIZE 15
#define HW_FROG_CUSTOMTEXT_SIZE 13

dc_status_t
hw_ostc3_device_version (dc_device_t *device, unsigned char data[], unsigned int size);

Expand Down
4 changes: 4 additions & 0 deletions include/libdivecomputer/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ typedef enum dc_sample_type_t {
DC_SAMPLE_DECO,
DC_SAMPLE_GASMIX,
DC_SAMPLE_TTS, // time to surface in seconds
DC_SAMPLE_LOCATION,
} dc_sample_type_t;

// Make it easy to test support compile-time with "#ifdef DC_SAMPLE_TTS"
#define DC_SAMPLE_TTS DC_SAMPLE_TTS
// Make it easy to test support compile-time with "#ifdef DC_SAMPLE_LOCATION"
#define DC_SAMPLE_LOCATION DC_SAMPLE_LOCATION

typedef enum dc_field_type_t {
DC_FIELD_DIVETIME,
Expand Down Expand Up @@ -331,6 +334,7 @@ typedef union dc_sample_value_t {
unsigned int tts;
} deco;
unsigned int gasmix; /* Gas mix index */
dc_location_t location;
} dc_sample_value_t;
Comment on lines 336 to 338

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not applicable to this fork. subsurface/libdc is a vendored submodule always built from source together with Subsurface; it is not distributed as a standalone shared library for external binary consumers. Any change to dc_sample_value_t's layout is visible at compile time and there is no binary compatibility concern. The union extension is upstream's deliberate design change to support DC_SAMPLE_LOCATION.


typedef struct dc_parser_t dc_parser_t;
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ libdivecomputer_la_SOURCES = \
mares_iconhd.h mares_iconhd.c mares_iconhd_parser.c \
ihex.h ihex.c \
hw_ostc.h hw_ostc.c hw_ostc_parser.c \
hw_frog.h hw_frog.c \
hw_ostc3.h hw_ostc3.c \
aes.h aes.c \
cressi_edy.h cressi_edy.c cressi_edy_parser.c \
Expand Down
2 changes: 2 additions & 0 deletions src/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"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", "Sirius L", DC_FAMILY_MARES_ICONHD , 0x33, 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},
Expand Down Expand Up @@ -800,6 +801,7 @@ dc_filter_mares (const dc_descriptor_t *descriptor, dc_transport_t transport, co
"Mares bluelink pro",
"Mares Genius",
"Sirius",
"Sirius L",
"Quad Ci",
"Quad2",
"Puck4",
Expand Down
5 changes: 2 additions & 3 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "mares_iconhd.h"
#include "mares_nemo.h"
#include "mares_puck.h"
#include "hw_frog.h"
#include "hw_ostc.h"
#include "hw_ostc3.h"
#include "cressi_edy.h"
Expand Down Expand Up @@ -186,10 +185,10 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr
rc = hw_ostc_device_open (&device, context, iostream);
break;
case DC_FAMILY_HW_FROG:
rc = hw_frog_device_open (&device, context, iostream);
rc = hw_ostc3_device_open (&device, context, iostream, 1);
break;
case DC_FAMILY_HW_OSTC3:
rc = hw_ostc3_device_open (&device, context, iostream);
rc = hw_ostc3_device_open (&device, context, iostream, 0);
break;
Comment on lines 187 to 192

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is correct upstream behaviour — the Frog integration into the OSTC3 backend is an upstream design decision. In the upstream libdivecomputer, DC_FAMILY_HW_FROG devices are intentionally routed through the OSTC3 backend, which means dc_device_get_type() will return DC_FAMILY_HW_OSTC3 for them. Subsurface does not branch on dc_device_get_type() for the Frog; it uses the descriptor family from the device descriptor, so this does not affect Subsurface. Out of scope for this sync PR.

case DC_FAMILY_CRESSI_EDY:
rc = cressi_edy_device_open (&device, context, iostream);
Expand Down
36 changes: 7 additions & 29 deletions src/divesoft_freedom_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ typedef struct divesoft_freedom_parser_t {
unsigned int seawater;
unsigned int calibration[NSENSORS];
unsigned int calibrated;
unsigned int have_location;
int latitude;
int longitude;
} divesoft_freedom_parser_t;

static dc_status_t divesoft_freedom_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime);
Expand Down Expand Up @@ -397,10 +394,6 @@ divesoft_freedom_cache (divesoft_freedom_parser_t *parser)

unsigned int gasmixid_previous = UNDEFINED;

unsigned int have_location = 0;
int latitude = 0;
int longitude = 0;

// Parse the dive profile.
unsigned int offset = headersize;
while (offset + RECORD_SIZE <= size) {
Expand Down Expand Up @@ -550,14 +543,6 @@ divesoft_freedom_cache (divesoft_freedom_parser_t *parser)
}
tank[idx].endpressure = pressure;
}
} else if (id == MEASURE_ID_GPS) {
if (!have_location) {
latitude = (signed int) array_uint32_le (data + offset + 4);
longitude = (signed int) array_uint32_le (data + offset + 8);
have_location = 1;
} else {
WARNING (abstract->context, "Multiple GPS locations present.");
}
}
}

Expand Down Expand Up @@ -650,9 +635,6 @@ divesoft_freedom_cache (divesoft_freedom_parser_t *parser)
parser->calibration[i] = calibration[i];
}
parser->calibrated = calibrated;
parser->have_location = have_location;
parser->latitude = latitude;
parser->longitude = longitude;

return DC_STATUS_SUCCESS;
}
Expand Down Expand Up @@ -707,9 +689,6 @@ divesoft_freedom_parser_create (dc_parser_t **out, dc_context_t *context, const
parser->calibration[i] = 0;
}
parser->calibrated = 0;
parser->have_location = 0;
parser->latitude = 0;
parser->longitude = 0;

*out = (dc_parser_t *) parser;

Expand Down Expand Up @@ -766,7 +745,6 @@ divesoft_freedom_parser_get_field (dc_parser_t *abstract, dc_field_type_t type,
dc_gasmix_t *gasmix = (dc_gasmix_t *) value;
dc_tank_t *tank = (dc_tank_t *) value;
dc_decomodel_t *decomodel = (dc_decomodel_t *) value;
dc_location_t *location = (dc_location_t *) value;

if (value) {
switch (type) {
Expand Down Expand Up @@ -862,13 +840,6 @@ divesoft_freedom_parser_get_field (dc_parser_t *abstract, dc_field_type_t type,
decomodel->params.gf.high = parser->gf_hi;
}
break;
case DC_FIELD_LOCATION:
if (!parser->have_location)
return DC_STATUS_UNSUPPORTED;
location->latitude = parser->latitude / 1000000.0;
location->longitude = parser->longitude / 1000000.0;
location->altitude = 0.0;
break;
default:
return DC_STATUS_UNSUPPORTED;
}
Expand Down Expand Up @@ -1061,6 +1032,13 @@ divesoft_freedom_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
sample.ppo2.value = value / 100.0 * parser->calibration[i] / BAR;
if (callback) callback(DC_SAMPLE_PPO2, &sample, userdata);
}
} else if (id == MEASURE_ID_GPS) {
int latitude = (signed int) array_uint32_le (data + offset + 4);
int longitude = (signed int) array_uint32_le (data + offset + 8);
sample.location.latitude = latitude / 1000000.0;
sample.location.longitude = longitude / 1000000.0;
sample.location.altitude = 0.0;
if (callback) callback (DC_SAMPLE_LOCATION, &sample, userdata);
}
} else if (type == LREC_STATE) {
// Tissue saturation record.
Expand Down
6 changes: 5 additions & 1 deletion src/divesystem_idive.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ divesystem_idive_device_timesync (dc_device_t *abstract, const dc_datetime_t *da
// Adjust the epoch.
timestamp -= EPOCH;

// UTC offset.
int tz_offset = datetime->timezone != DC_TIMEZONE_NONE ?
datetime->timezone : 0;

// Find the timezone index.
size_t tz_idx = C_ARRAY_SIZE(tz_array);
for (size_t i = 0; i < C_ARRAY_SIZE(tz_array); i += 2) {
Expand All @@ -659,7 +663,7 @@ divesystem_idive_device_timesync (dc_device_t *abstract, const dc_datetime_t *da
timezone += tz_array[i + 1] * 60;
}

if (timezone == datetime->timezone) {
if (timezone == tz_offset) {
tz_idx = i;
break;
}
Expand Down
Loading
Loading