From 9fb7a1f228f24ffc4e0b57bd14cb808ed7f5f8f2 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 11 Apr 2017 19:57:12 +0200 Subject: [PATCH 1/8] Add support for the Uwatec Aladin Tec 3G --- src/descriptor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/descriptor.c b/src/descriptor.c index f058e94..6dd4cf9 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -112,6 +112,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Subgear","XP-10", DC_FAMILY_UWATEC_SMART, 0x13}, {"Uwatec", "Smart Com", DC_FAMILY_UWATEC_SMART, 0x14}, {"Uwatec", "Aladin 2G", DC_FAMILY_UWATEC_SMART, 0x15}, + {"Uwatec", "Aladin Tec 3G", DC_FAMILY_UWATEC_SMART, 0x15}, {"Uwatec", "Aladin Sport", DC_FAMILY_UWATEC_SMART, 0x15}, {"Subgear","XP-3G", DC_FAMILY_UWATEC_SMART, 0x15}, {"Uwatec", "Smart Tec", DC_FAMILY_UWATEC_SMART, 0x18}, From 97a6023bb6c467cecd0e335ab2f31369a1748e66 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 11 Apr 2017 20:08:29 +0200 Subject: [PATCH 2/8] Fix the firmware version and serial number When downloading a Shearwater Petrel using the predator backend, the firmware version and serial number are different compared to those reported by the petrel backend. This is caused by a difference in the encoding of the data. In the predator data format, the firmware version appears to be BCD encoded, and the serial number is stored as a big endian integer. --- src/shearwater_predator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shearwater_predator.c b/src/shearwater_predator.c index 7975b8f..505dd85 100644 --- a/src/shearwater_predator.c +++ b/src/shearwater_predator.c @@ -156,8 +156,8 @@ shearwater_predator_device_foreach (dc_device_t *abstract, dc_dive_callback_t ca unsigned char *data = dc_buffer_get_data (buffer); dc_event_devinfo_t devinfo; devinfo.model = data[0x2000D]; - devinfo.firmware = data[0x2000A]; - devinfo.serial = array_uint32_le (data + 0x20002); + devinfo.firmware = bcd2dec (data[0x2000A]); + devinfo.serial = array_uint32_be (data + 0x20002); device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); rc = shearwater_predator_extract_dives (abstract, data, SZ_MEMORY, callback, userdata); From 8952ad0c291d0ab687e6c561a2a01a3b0a115971 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 25 Mar 2017 11:18:40 +0100 Subject: [PATCH 3/8] Remove unnecessary include statements --- examples/dctool_parse.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/examples/dctool_parse.c b/examples/dctool_parse.c index 9f55ca0..6ea8550 100644 --- a/examples/dctool_parse.c +++ b/examples/dctool_parse.c @@ -35,20 +35,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "dctool.h" #include "output.h" #include "common.h" From d1a06e784c80178da6d6b93c44177d44f421edba Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 25 Mar 2017 11:26:32 +0100 Subject: [PATCH 4/8] Remove deprecated functions from the public api The vendor_product_parser_create() and vendor_product_device_open() functions should be called indirectly, through the generic dc_device_open() and dc_parser_new() functions. And the vendor_product_extract_dives() functions are internal functions that should never have been part of the public api in the first place. --- include/libdivecomputer/Makefile.am | 36 +---- include/libdivecomputer/atomics_cobalt.h | 14 +- include/libdivecomputer/citizen.h | 27 ---- include/libdivecomputer/cochran.h | 27 ---- include/libdivecomputer/cressi.h | 28 ---- include/libdivecomputer/divesystem.h | 27 ---- include/libdivecomputer/hw_frog.h | 14 +- include/libdivecomputer/hw_ostc.h | 19 +-- include/libdivecomputer/hw_ostc3.h | 17 +-- include/libdivecomputer/mares.h | 30 ---- include/libdivecomputer/oceanic_atom2.h | 18 +-- include/libdivecomputer/oceanic_veo250.h | 15 +- include/libdivecomputer/oceanic_vtpro.h | 21 +-- include/libdivecomputer/reefnet_sensus.h | 17 +-- include/libdivecomputer/reefnet_sensuspro.h | 17 +-- include/libdivecomputer/reefnet_sensusultra.h | 17 +-- include/libdivecomputer/suunto_d9.h | 15 +- include/libdivecomputer/suunto_eon.h | 18 +-- include/libdivecomputer/suunto_vyper2.h | 11 +- include/libdivecomputer/uwatec.h | 30 ---- include/libdivecomputer/zeagle.h | 27 ---- msvc/libdivecomputer.vcproj | 136 +++++++++--------- src/Makefile.am | 67 +++++---- src/atomics_cobalt.c | 3 +- .../atomics.h => src/atomics_cobalt.h | 24 +++- src/atomics_cobalt_parser.c | 2 +- src/citizen_aqualand.c | 3 +- .../citizen_aqualand.h | 6 +- src/citizen_aqualand_parser.c | 2 +- src/cochran_commander.c | 3 +- .../cochran_commander.h | 6 +- src/cochran_commander_parser.c | 2 +- src/cressi_edy.c | 3 +- {include/libdivecomputer => src}/cressi_edy.h | 6 +- src/cressi_edy_parser.c | 3 +- src/cressi_leonardo.c | 3 +- .../libdivecomputer => src}/cressi_leonardo.h | 6 +- src/cressi_leonardo_parser.c | 3 +- src/device.c | 47 ++++-- src/diverite_nitekq.c | 3 +- .../libdivecomputer => src}/diverite_nitekq.h | 6 +- src/diverite_nitekq_parser.c | 2 +- src/divesystem_idive.c | 3 +- .../divesystem_idive.h | 6 +- src/divesystem_idive_parser.c | 3 +- src/hw_frog.c | 3 +- .../shearwater.h => src/hw_frog.h | 22 ++- src/hw_ostc.c | 3 +- include/libdivecomputer/hw.h => src/hw_ostc.h | 29 +++- src/hw_ostc3.c | 3 +- .../diverite.h => src/hw_ostc3.h | 24 +++- src/hw_ostc_parser.c | 4 +- src/libdivecomputer.symbols | 83 ----------- src/mares_darwin.c | 4 +- .../libdivecomputer => src}/mares_darwin.h | 6 +- src/mares_darwin_parser.c | 2 +- src/mares_iconhd.c | 3 +- .../libdivecomputer => src}/mares_iconhd.h | 6 +- src/mares_iconhd_parser.c | 2 +- src/mares_nemo.c | 5 +- {include/libdivecomputer => src}/mares_nemo.h | 6 +- src/mares_nemo_parser.c | 2 +- src/mares_puck.c | 5 +- {include/libdivecomputer => src}/mares_puck.h | 6 +- src/oceanic_atom2.c | 5 +- src/oceanic_atom2.h | 47 ++++++ src/oceanic_atom2_parser.c | 2 +- src/oceanic_veo250.c | 5 +- .../suunto.h => src/oceanic_veo250.h | 30 ++-- src/oceanic_veo250_parser.c | 2 +- src/oceanic_vtpro.c | 5 +- src/oceanic_vtpro.h | 50 +++++++ src/oceanic_vtpro_parser.c | 2 +- src/parser.c | 48 +++++-- src/reefnet_sensus.c | 3 +- src/reefnet_sensus.h | 46 ++++++ src/reefnet_sensus_parser.c | 2 +- src/reefnet_sensuspro.c | 3 +- src/reefnet_sensuspro.h | 46 ++++++ src/reefnet_sensuspro_parser.c | 2 +- src/reefnet_sensusultra.c | 3 +- src/reefnet_sensusultra.h | 46 ++++++ src/reefnet_sensusultra_parser.c | 2 +- src/shearwater_petrel.c | 4 +- .../shearwater_petrel.h | 6 +- src/shearwater_predator.c | 4 +- .../shearwater_predator.h | 6 +- src/shearwater_predator_parser.c | 4 +- src/suunto_d9.c | 5 +- .../reefnet.h => src/suunto_d9.h | 26 +++- src/suunto_d9_parser.c | 3 +- src/suunto_eon.c | 5 +- src/suunto_eon.h | 46 ++++++ src/suunto_eon_parser.c | 2 +- src/suunto_eonsteel.c | 3 +- .../libdivecomputer => src}/suunto_eonsteel.h | 13 +- src/suunto_eonsteel_parser.c | 3 +- src/suunto_solution.c | 2 +- .../libdivecomputer => src}/suunto_solution.h | 6 +- src/suunto_solution_parser.c | 2 +- src/suunto_vyper.c | 5 +- .../libdivecomputer => src}/suunto_vyper.h | 6 +- src/suunto_vyper2.c | 5 +- .../oceanic.h => src/suunto_vyper2.h | 22 ++- src/suunto_vyper_parser.c | 2 +- src/uwatec_aladin.c | 3 +- .../libdivecomputer => src}/uwatec_aladin.h | 4 +- src/uwatec_memomouse.c | 3 +- .../uwatec_memomouse.h | 6 +- src/uwatec_memomouse_parser.c | 2 +- src/uwatec_meridian.c | 3 +- .../libdivecomputer => src}/uwatec_meridian.h | 6 +- src/uwatec_smart.c | 3 +- .../libdivecomputer => src}/uwatec_smart.h | 6 +- src/uwatec_smart_parser.c | 2 +- src/zeagle_n2ition3.c | 3 +- .../libdivecomputer => src}/zeagle_n2ition3.h | 4 +- 117 files changed, 779 insertions(+), 806 deletions(-) delete mode 100644 include/libdivecomputer/citizen.h delete mode 100644 include/libdivecomputer/cochran.h delete mode 100644 include/libdivecomputer/cressi.h delete mode 100644 include/libdivecomputer/divesystem.h delete mode 100644 include/libdivecomputer/mares.h delete mode 100644 include/libdivecomputer/uwatec.h delete mode 100644 include/libdivecomputer/zeagle.h rename include/libdivecomputer/atomics.h => src/atomics_cobalt.h (61%) rename {include/libdivecomputer => src}/citizen_aqualand.h (91%) rename {include/libdivecomputer => src}/cochran_commander.h (91%) rename {include/libdivecomputer => src}/cressi_edy.h (91%) rename {include/libdivecomputer => src}/cressi_leonardo.h (93%) rename {include/libdivecomputer => src}/diverite_nitekq.h (92%) rename {include/libdivecomputer => src}/divesystem_idive.h (92%) rename include/libdivecomputer/shearwater.h => src/hw_frog.h (66%) rename include/libdivecomputer/hw.h => src/hw_ostc.h (55%) rename include/libdivecomputer/diverite.h => src/hw_ostc3.h (61%) rename {include/libdivecomputer => src}/mares_darwin.h (92%) rename {include/libdivecomputer => src}/mares_iconhd.h (91%) rename {include/libdivecomputer => src}/mares_nemo.h (92%) rename {include/libdivecomputer => src}/mares_puck.h (91%) create mode 100644 src/oceanic_atom2.h rename include/libdivecomputer/suunto.h => src/oceanic_veo250.h (59%) create mode 100644 src/oceanic_vtpro.h create mode 100644 src/reefnet_sensus.h create mode 100644 src/reefnet_sensuspro.h create mode 100644 src/reefnet_sensusultra.h rename {include/libdivecomputer => src}/shearwater_petrel.h (91%) rename {include/libdivecomputer => src}/shearwater_predator.h (92%) rename include/libdivecomputer/reefnet.h => src/suunto_d9.h (59%) create mode 100644 src/suunto_eon.h rename {include/libdivecomputer => src}/suunto_eonsteel.h (74%) rename {include/libdivecomputer => src}/suunto_solution.h (92%) rename {include/libdivecomputer => src}/suunto_vyper.h (92%) rename include/libdivecomputer/oceanic.h => src/suunto_vyper2.h (66%) rename {include/libdivecomputer => src}/uwatec_aladin.h (94%) rename {include/libdivecomputer => src}/uwatec_memomouse.h (92%) rename {include/libdivecomputer => src}/uwatec_meridian.h (92%) rename {include/libdivecomputer => src}/uwatec_smart.h (92%) rename {include/libdivecomputer => src}/zeagle_n2ition3.h (93%) diff --git a/include/libdivecomputer/Makefile.am b/include/libdivecomputer/Makefile.am index e11ca4e..82ba21f 100644 --- a/include/libdivecomputer/Makefile.am +++ b/include/libdivecomputer/Makefile.am @@ -10,50 +10,16 @@ libdivecomputer_HEADERS = \ parser.h \ datetime.h \ units.h \ - suunto.h \ - suunto_solution.h \ suunto_eon.h \ - suunto_eonsteel.h \ - suunto_vyper.h \ suunto_vyper2.h \ suunto_d9.h \ - reefnet.h \ reefnet_sensus.h \ reefnet_sensuspro.h \ reefnet_sensusultra.h \ - uwatec.h \ - uwatec_aladin.h \ - uwatec_memomouse.h \ - uwatec_smart.h \ - uwatec_meridian.h \ - oceanic.h \ oceanic_atom2.h \ oceanic_veo250.h \ oceanic_vtpro.h \ - mares.h \ - mares_nemo.h \ - mares_puck.h \ - mares_darwin.h \ - mares_iconhd.h \ - hw.h \ hw_ostc.h \ hw_frog.h \ hw_ostc3.h \ - cressi.h \ - cressi_edy.h \ - cressi_leonardo.h \ - zeagle.h \ - zeagle_n2ition3.h \ - atomics.h \ - atomics_cobalt.h \ - shearwater.h \ - shearwater_petrel.h \ - shearwater_predator.h \ - diverite.h \ - diverite_nitekq.h \ - citizen.h \ - citizen_aqualand.h \ - divesystem.h \ - divesystem_idive.h \ - cochran.h \ - cochran_commander.h + atomics_cobalt.h diff --git a/include/libdivecomputer/atomics_cobalt.h b/include/libdivecomputer/atomics_cobalt.h index b8a36ca..5afb1c1 100644 --- a/include/libdivecomputer/atomics_cobalt.h +++ b/include/libdivecomputer/atomics_cobalt.h @@ -19,10 +19,10 @@ * MA 02110-1301 USA */ -#ifndef ATOMICS_COBALT_H -#define ATOMICS_COBALT_H +#ifndef DC_ATOMICS_COBALT_H +#define DC_ATOMICS_COBALT_H -#include "context.h" +#include "common.h" #include "device.h" #include "parser.h" @@ -30,22 +30,16 @@ extern "C" { #endif /* __cplusplus */ -dc_status_t -atomics_cobalt_device_open (dc_device_t **device, dc_context_t *context); - dc_status_t atomics_cobalt_device_version (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t atomics_cobalt_device_set_simulation (dc_device_t *device, unsigned int simulation); -dc_status_t -atomics_cobalt_parser_create (dc_parser_t **parser, dc_context_t *context); - dc_status_t atomics_cobalt_parser_set_calibration (dc_parser_t *parser, double atmospheric, double hydrostatic); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* ATOMICS_COBALT_H */ +#endif /* DC_ATOMICS_COBALT_H */ diff --git a/include/libdivecomputer/citizen.h b/include/libdivecomputer/citizen.h deleted file mode 100644 index 01b7027..0000000 --- a/include/libdivecomputer/citizen.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2014 Jef Driesen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef CITIZEN_H -#define CITIZEN_H - -#include "citizen_aqualand.h" - -#endif /* CITIZEN_H */ diff --git a/include/libdivecomputer/cochran.h b/include/libdivecomputer/cochran.h deleted file mode 100644 index a2a0962..0000000 --- a/include/libdivecomputer/cochran.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2014 John Van Ostrand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef COCHRAN_H -#define COCHRAN_H - -#include "cochran_commander.h" - -#endif /* COCHRAN_H */ diff --git a/include/libdivecomputer/cressi.h b/include/libdivecomputer/cressi.h deleted file mode 100644 index 8bcb7ac..0000000 --- a/include/libdivecomputer/cressi.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2009 Jef Driesen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef CRESSI_H -#define CRESSI_H - -#include "cressi_edy.h" -#include "cressi_leonardo.h" - -#endif /* CRESSI_H */ diff --git a/include/libdivecomputer/divesystem.h b/include/libdivecomputer/divesystem.h deleted file mode 100644 index 080fa52..0000000 --- a/include/libdivecomputer/divesystem.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2014 Jef Driesen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef DIVESYSTEM_H -#define DIVESYSTEM_H - -#include "divesystem_idive.h" - -#endif /* DIVESYSTEM_H */ diff --git a/include/libdivecomputer/hw_frog.h b/include/libdivecomputer/hw_frog.h index a831ba4..67f624f 100644 --- a/include/libdivecomputer/hw_frog.h +++ b/include/libdivecomputer/hw_frog.h @@ -19,13 +19,12 @@ * MA 02110-1301 USA */ -#ifndef HW_FROG_H -#define HW_FROG_H +#ifndef DC_HW_FROG_H +#define DC_HW_FROG_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" -#include "buffer.h" +#include "datetime.h" #ifdef __cplusplus extern "C" { @@ -34,9 +33,6 @@ extern "C" { #define HW_FROG_DISPLAY_SIZE 15 #define HW_FROG_CUSTOMTEXT_SIZE 13 -dc_status_t -hw_frog_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t hw_frog_device_version (dc_device_t *device, unsigned char data[], unsigned int size); @@ -52,4 +48,4 @@ hw_frog_device_customtext (dc_device_t *device, const char *text); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* HW_FROG_H */ +#endif /* DC_HW_FROG_H */ diff --git a/include/libdivecomputer/hw_ostc.h b/include/libdivecomputer/hw_ostc.h index 2b293e2..b68e083 100644 --- a/include/libdivecomputer/hw_ostc.h +++ b/include/libdivecomputer/hw_ostc.h @@ -19,12 +19,12 @@ * MA 02110-1301 USA */ -#ifndef HW_OSTC_H -#define HW_OSTC_H +#ifndef DC_HW_OSTC_H +#define DC_HW_OSTC_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" +#include "datetime.h" #include "buffer.h" #ifdef __cplusplus @@ -40,9 +40,6 @@ typedef enum hw_ostc_format_t { HW_OSTC_FORMAT_RGB24 } hw_ostc_format_t; -dc_status_t -hw_ostc_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t hw_ostc_device_md2hash (dc_device_t *device, unsigned char data[], unsigned int size); @@ -61,16 +58,10 @@ hw_ostc_device_reset (dc_device_t *device); dc_status_t hw_ostc_device_screenshot (dc_device_t *device, dc_buffer_t *buffer, hw_ostc_format_t format); -dc_status_t -hw_ostc_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - -dc_status_t -hw_ostc_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int hwos); - dc_status_t hw_ostc_device_fwupdate (dc_device_t *abstract, const char *filename); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* HW_OSTC_H */ +#endif /* DC_HW_OSTC_H */ diff --git a/include/libdivecomputer/hw_ostc3.h b/include/libdivecomputer/hw_ostc3.h index 56244ed..bd0d2ed 100644 --- a/include/libdivecomputer/hw_ostc3.h +++ b/include/libdivecomputer/hw_ostc3.h @@ -19,13 +19,12 @@ * MA 02110-1301 USA */ -#ifndef HW_OSTC3_H -#define HW_OSTC3_H +#ifndef DC_HW_OSTC3_H +#define DC_HW_OSTC3_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" -#include "buffer.h" +#include "datetime.h" #ifdef __cplusplus extern "C" { @@ -34,9 +33,6 @@ extern "C" { #define HW_OSTC3_DISPLAY_SIZE 16 #define HW_OSTC3_CUSTOMTEXT_SIZE 60 -dc_status_t -hw_ostc3_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t hw_ostc3_device_version (dc_device_t *device, unsigned char data[], unsigned int size); @@ -64,10 +60,7 @@ hw_ostc3_device_config_reset (dc_device_t *abstract); dc_status_t hw_ostc3_device_fwupdate (dc_device_t *abstract, const char *filename); -dc_status_t -hw_ostc3_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* HW_OSTC3_H */ +#endif /* DC_HW_OSTC3_H */ diff --git a/include/libdivecomputer/mares.h b/include/libdivecomputer/mares.h deleted file mode 100644 index c7af850..0000000 --- a/include/libdivecomputer/mares.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef MARES_H -#define MARES_H - -#include "mares_nemo.h" -#include "mares_puck.h" -#include "mares_darwin.h" -#include "mares_iconhd.h" - -#endif /* MARES_H */ diff --git a/include/libdivecomputer/oceanic_atom2.h b/include/libdivecomputer/oceanic_atom2.h index 4cae707..68481d2 100644 --- a/include/libdivecomputer/oceanic_atom2.h +++ b/include/libdivecomputer/oceanic_atom2.h @@ -19,33 +19,23 @@ * MA 02110-1301 USA */ -#ifndef OCEANIC_ATOM2_H -#define OCEANIC_ATOM2_H +#ifndef DC_OCEANIC_ATOM2_H +#define DC_OCEANIC_ATOM2_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -dc_status_t -oceanic_atom2_device_open (dc_device_t **device, dc_context_t *context, const char *name); - -dc_status_t -oceanic_atom2_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); - dc_status_t oceanic_atom2_device_version (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t oceanic_atom2_device_keepalive (dc_device_t *device); -dc_status_t -oceanic_atom2_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* OCEANIC_ATOM2_H */ +#endif /* DC_OCEANIC_ATOM2_H */ diff --git a/include/libdivecomputer/oceanic_veo250.h b/include/libdivecomputer/oceanic_veo250.h index aaeee46..e7ade87 100644 --- a/include/libdivecomputer/oceanic_veo250.h +++ b/include/libdivecomputer/oceanic_veo250.h @@ -19,30 +19,23 @@ * MA 02110-1301 USA */ -#ifndef OCEANIC_VEO250_H -#define OCEANIC_VEO250_H +#ifndef DC_OCEANIC_VEO250_H +#define DC_OCEANIC_VEO250_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -dc_status_t -oceanic_veo250_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t oceanic_veo250_device_version (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t oceanic_veo250_device_keepalive (dc_device_t *device); -dc_status_t -oceanic_veo250_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* OCEANIC_VEO250_H */ +#endif /* DC_OCEANIC_VEO250_H */ diff --git a/include/libdivecomputer/oceanic_vtpro.h b/include/libdivecomputer/oceanic_vtpro.h index f6d2a64..6357763 100644 --- a/include/libdivecomputer/oceanic_vtpro.h +++ b/include/libdivecomputer/oceanic_vtpro.h @@ -19,36 +19,23 @@ * MA 02110-1301 USA */ -#ifndef OCEANIC_VTPRO_H -#define OCEANIC_VTPRO_H +#ifndef DC_OCEANIC_VTPRO_H +#define DC_OCEANIC_VTPRO_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -dc_status_t -oceanic_vtpro_device_open (dc_device_t **device, dc_context_t *context, const char *name); - -dc_status_t -oceanic_vtpro_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); - dc_status_t oceanic_vtpro_device_version (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t oceanic_vtpro_device_keepalive (dc_device_t *device); -dc_status_t -oceanic_vtpro_parser_create (dc_parser_t **parser, dc_context_t *context); - -dc_status_t -oceanic_vtpro_parser_create2 (dc_parser_t **parser, dc_context_t *context, unsigned int model); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* OCEANIC_VTPRO_H */ +#endif /* DC_OCEANIC_VTPRO_H */ diff --git a/include/libdivecomputer/reefnet_sensus.h b/include/libdivecomputer/reefnet_sensus.h index 96ff5ba..583d9af 100644 --- a/include/libdivecomputer/reefnet_sensus.h +++ b/include/libdivecomputer/reefnet_sensus.h @@ -19,10 +19,10 @@ * MA 02110-1301 USA */ -#ifndef REEFNET_SENSUS_H -#define REEFNET_SENSUS_H +#ifndef DC_REEFNET_SENSUS_H +#define DC_REEFNET_SENSUS_H -#include "context.h" +#include "common.h" #include "device.h" #include "parser.h" @@ -32,22 +32,13 @@ extern "C" { #define REEFNET_SENSUS_HANDSHAKE_SIZE 10 -dc_status_t -reefnet_sensus_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t reefnet_sensus_device_get_handshake (dc_device_t *device, unsigned char data[], unsigned int size); -dc_status_t -reefnet_sensus_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - -dc_status_t -reefnet_sensus_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); - dc_status_t reefnet_sensus_parser_set_calibration (dc_parser_t *parser, double atmospheric, double hydrostatic); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* REEFNET_SENSUS_H */ +#endif /* DC_REEFNET_SENSUS_H */ diff --git a/include/libdivecomputer/reefnet_sensuspro.h b/include/libdivecomputer/reefnet_sensuspro.h index e092fef..a92966f 100644 --- a/include/libdivecomputer/reefnet_sensuspro.h +++ b/include/libdivecomputer/reefnet_sensuspro.h @@ -19,10 +19,10 @@ * MA 02110-1301 USA */ -#ifndef REEFNET_SENSUSPRO_H -#define REEFNET_SENSUSPRO_H +#ifndef DC_REEFNET_SENSUSPRO_H +#define DC_REEFNET_SENSUSPRO_H -#include "context.h" +#include "common.h" #include "device.h" #include "parser.h" @@ -32,25 +32,16 @@ extern "C" { #define REEFNET_SENSUSPRO_HANDSHAKE_SIZE 10 -dc_status_t -reefnet_sensuspro_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t reefnet_sensuspro_device_get_handshake (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t reefnet_sensuspro_device_write_interval (dc_device_t *device, unsigned char interval); -dc_status_t -reefnet_sensuspro_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - -dc_status_t -reefnet_sensuspro_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); - dc_status_t reefnet_sensuspro_parser_set_calibration (dc_parser_t *parser, double atmospheric, double hydrostatic); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* REEFNET_SENSUSPRO_H */ +#endif /* DC_REEFNET_SENSUSPRO_H */ diff --git a/include/libdivecomputer/reefnet_sensusultra.h b/include/libdivecomputer/reefnet_sensusultra.h index 72d1ed6..c5a8944 100644 --- a/include/libdivecomputer/reefnet_sensusultra.h +++ b/include/libdivecomputer/reefnet_sensusultra.h @@ -19,10 +19,10 @@ * MA 02110-1301 USA */ -#ifndef REEFNET_SENSUSULTRA_H -#define REEFNET_SENSUSULTRA_H +#ifndef DC_REEFNET_SENSUSULTRA_H +#define DC_REEFNET_SENSUSULTRA_H -#include "context.h" +#include "common.h" #include "device.h" #include "parser.h" @@ -41,9 +41,6 @@ typedef enum reefnet_sensusultra_parameter_t { REEFNET_SENSUSULTRA_PARAMETER_AVERAGING } reefnet_sensusultra_parameter_t; -dc_status_t -reefnet_sensusultra_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t reefnet_sensusultra_device_get_handshake (dc_device_t *device, unsigned char data[], unsigned int size); @@ -59,16 +56,10 @@ reefnet_sensusultra_device_write_parameter (dc_device_t *device, reefnet_sensusu dc_status_t reefnet_sensusultra_device_sense (dc_device_t *device, unsigned char data[], unsigned int size); -dc_status_t -reefnet_sensusultra_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - -dc_status_t -reefnet_sensusultra_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); - dc_status_t reefnet_sensusultra_parser_set_calibration (dc_parser_t *parser, double atmospheric, double hydrostatic); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* REEFNET_SENSUSULTRA_H */ +#endif /* DC_REEFNET_SENSUSULTRA_H */ diff --git a/include/libdivecomputer/suunto_d9.h b/include/libdivecomputer/suunto_d9.h index d177c6c..dbea025 100644 --- a/include/libdivecomputer/suunto_d9.h +++ b/include/libdivecomputer/suunto_d9.h @@ -19,12 +19,11 @@ * MA 02110-1301 USA */ -#ifndef SUUNTO_D9_H -#define SUUNTO_D9_H +#ifndef DC_SUUNTO_D9_H +#define DC_SUUNTO_D9_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" #ifdef __cplusplus extern "C" { @@ -32,19 +31,13 @@ extern "C" { #define SUUNTO_D9_VERSION_SIZE 0x04 -dc_status_t -suunto_d9_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); - dc_status_t suunto_d9_device_version (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t suunto_d9_device_reset_maxdepth (dc_device_t *device); -dc_status_t -suunto_d9_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* SUUNTO_D9_H */ +#endif /* DC_SUUNTO_D9_H */ diff --git a/include/libdivecomputer/suunto_eon.h b/include/libdivecomputer/suunto_eon.h index 3ee1277..aeacdb3 100644 --- a/include/libdivecomputer/suunto_eon.h +++ b/include/libdivecomputer/suunto_eon.h @@ -19,12 +19,11 @@ * MA 02110-1301 USA */ -#ifndef SUUNTO_EON_H -#define SUUNTO_EON_H +#ifndef DC_SUUNTO_EON_H +#define DC_SUUNTO_EON_H -#include "context.h" +#include "common.h" #include "device.h" -#include "parser.h" #ifdef __cplusplus extern "C" { @@ -32,22 +31,13 @@ extern "C" { #define SUUNTO_EON_NAME_SIZE 20 -dc_status_t -suunto_eon_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t suunto_eon_device_write_name (dc_device_t *device, unsigned char data[], unsigned int size); dc_status_t suunto_eon_device_write_interval (dc_device_t *device, unsigned char interval); -dc_status_t -suunto_eon_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - -dc_status_t -suunto_eon_parser_create (dc_parser_t **parser, dc_context_t *context, int spyder); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* SUUNTO_EON_H */ +#endif /* DC_SUUNTO_EON_H */ diff --git a/include/libdivecomputer/suunto_vyper2.h b/include/libdivecomputer/suunto_vyper2.h index 8619b3d..7c67320 100644 --- a/include/libdivecomputer/suunto_vyper2.h +++ b/include/libdivecomputer/suunto_vyper2.h @@ -19,21 +19,18 @@ * MA 02110-1301 USA */ -#ifndef SUUNTO_VYPER2_H -#define SUUNTO_VYPER2_H +#ifndef DC_SUUNTO_VYPER2_H +#define DC_SUUNTO_VYPER2_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "context.h" +#include "common.h" #include "device.h" #define SUUNTO_VYPER2_VERSION_SIZE 0x04 -dc_status_t -suunto_vyper2_device_open (dc_device_t **device, dc_context_t *context, const char *name); - dc_status_t suunto_vyper2_device_version (dc_device_t *device, unsigned char data[], unsigned int size); @@ -43,4 +40,4 @@ suunto_vyper2_device_reset_maxdepth (dc_device_t *device); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* SUUNTO_VYPER2_H */ +#endif /* DC_SUUNTO_VYPER2_H */ diff --git a/include/libdivecomputer/uwatec.h b/include/libdivecomputer/uwatec.h deleted file mode 100644 index 4ab1eec..0000000 --- a/include/libdivecomputer/uwatec.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef UWATEC_H -#define UWATEC_H - -#include "uwatec_aladin.h" -#include "uwatec_memomouse.h" -#include "uwatec_smart.h" -#include "uwatec_meridian.h" - -#endif /* UWATEC_H */ diff --git a/include/libdivecomputer/zeagle.h b/include/libdivecomputer/zeagle.h deleted file mode 100644 index 5d42cfb..0000000 --- a/include/libdivecomputer/zeagle.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2010 Jef Driesen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef ZEAGLE_H -#define ZEAGLE_H - -#include "zeagle_n2ition3.h" - -#endif /* CRESSI_H */ diff --git a/msvc/libdivecomputer.vcproj b/msvc/libdivecomputer.vcproj index 1e03b33..260ecbf 100644 --- a/msvc/libdivecomputer.vcproj +++ b/msvc/libdivecomputer.vcproj @@ -517,7 +517,7 @@ > - - - - - - - - - - - - + + + + + + @@ -629,11 +617,11 @@ > + + + + @@ -689,13 +685,17 @@ > + + @@ -704,6 +704,14 @@ RelativePath="..\include\libdivecomputer\reefnet_sensusultra.h" > + + + + @@ -712,24 +720,16 @@ RelativePath="..\src\serial.h" > - - - - + + + + + + + + @@ -769,23 +785,19 @@ > - - - - diff --git a/src/Makefile.am b/src/Makefile.am index db5f742..b98e57e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,50 +24,49 @@ libdivecomputer_la_SOURCES = \ datetime.c \ suunto_common.h suunto_common.c \ suunto_common2.h suunto_common2.c \ - suunto_solution.c suunto_solution_parser.c \ - suunto_eon.c suunto_eon_parser.c \ - suunto_vyper.c suunto_vyper_parser.c \ - suunto_vyper2.c \ - suunto_d9.c suunto_d9_parser.c \ - suunto_eonsteel.c suunto_eonsteel_parser.c \ - reefnet_sensus.c reefnet_sensus_parser.c \ - reefnet_sensuspro.c reefnet_sensuspro_parser.c \ - reefnet_sensusultra.c reefnet_sensusultra_parser.c \ - uwatec_aladin.c \ - uwatec_memomouse.c uwatec_memomouse_parser.c \ - uwatec_smart.c uwatec_smart_parser.c \ - uwatec_meridian.c \ + suunto_solution.h suunto_solution.c suunto_solution_parser.c \ + suunto_eon.h suunto_eon.c suunto_eon_parser.c \ + suunto_vyper.h suunto_vyper.c suunto_vyper_parser.c \ + suunto_vyper2.h suunto_vyper2.c \ + suunto_d9.h suunto_d9.c suunto_d9_parser.c \ + suunto_eonsteel.h suunto_eonsteel.c suunto_eonsteel_parser.c \ + reefnet_sensus.h reefnet_sensus.c reefnet_sensus_parser.c \ + reefnet_sensuspro.h reefnet_sensuspro.c reefnet_sensuspro_parser.c \ + reefnet_sensusultra.h reefnet_sensusultra.c reefnet_sensusultra_parser.c \ + uwatec_aladin.h uwatec_aladin.c \ + uwatec_memomouse.h uwatec_memomouse.c uwatec_memomouse_parser.c \ + uwatec_smart.h uwatec_smart.c uwatec_smart_parser.c \ + uwatec_meridian.h uwatec_meridian.c \ oceanic_common.h oceanic_common.c \ - oceanic_atom2.c oceanic_atom2_parser.c \ - oceanic_veo250.c oceanic_veo250_parser.c \ - oceanic_vtpro.c oceanic_vtpro_parser.c \ + oceanic_atom2.h oceanic_atom2.c oceanic_atom2_parser.c \ + oceanic_veo250.h oceanic_veo250.c oceanic_veo250_parser.c \ + oceanic_vtpro.h oceanic_vtpro.c oceanic_vtpro_parser.c \ mares_common.h mares_common.c \ - mares_nemo.c mares_nemo_parser.c \ - mares_puck.c \ - mares_darwin.c mares_darwin_parser.c \ - mares_iconhd.c mares_iconhd_parser.c \ + mares_nemo.h mares_nemo.c mares_nemo_parser.c \ + mares_puck.h mares_puck.c \ + mares_darwin.h mares_darwin.c mares_darwin_parser.c \ + mares_iconhd.h mares_iconhd.c mares_iconhd_parser.c \ ihex.h ihex.c \ - hw_ostc.c hw_ostc_parser.c \ - hw_frog.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 \ - hw_ostc3.c \ - cressi_edy.c cressi_edy_parser.c \ - cressi_leonardo.c cressi_leonardo_parser.c \ - zeagle_n2ition3.c \ - atomics_cobalt.c atomics_cobalt_parser.c \ + cressi_edy.h cressi_edy.c cressi_edy_parser.c \ + cressi_leonardo.h cressi_leonardo.c cressi_leonardo_parser.c \ + zeagle_n2ition3.h zeagle_n2ition3.c \ + atomics_cobalt.h atomics_cobalt.c atomics_cobalt_parser.c \ shearwater_common.h shearwater_common.c \ - shearwater_predator.c shearwater_predator_parser.c \ - shearwater_petrel.c \ - diverite_nitekq.c diverite_nitekq_parser.c \ - citizen_aqualand.c citizen_aqualand_parser.c \ - divesystem_idive.c divesystem_idive_parser.c \ + shearwater_predator.h shearwater_predator.c shearwater_predator_parser.c \ + shearwater_petrel.h shearwater_petrel.c \ + diverite_nitekq.h diverite_nitekq.c diverite_nitekq_parser.c \ + citizen_aqualand.h citizen_aqualand.c citizen_aqualand_parser.c \ + divesystem_idive.h divesystem_idive.c divesystem_idive_parser.c \ ringbuffer.h ringbuffer.c \ rbstream.h rbstream.c \ checksum.h checksum.c \ array.h array.c \ buffer.c \ - cochran_commander.c \ - cochran_commander_parser.c + cochran_commander.h cochran_commander.c cochran_commander_parser.c if OS_WIN32 libdivecomputer_la_SOURCES += serial.h serial_win32.c diff --git a/src/atomics_cobalt.c b/src/atomics_cobalt.c index 6bc3de2..91a6da6 100644 --- a/src/atomics_cobalt.c +++ b/src/atomics_cobalt.c @@ -33,8 +33,7 @@ #include #endif -#include - +#include "atomics_cobalt.h" #include "context-private.h" #include "device-private.h" #include "checksum.h" diff --git a/include/libdivecomputer/atomics.h b/src/atomics_cobalt.h similarity index 61% rename from include/libdivecomputer/atomics.h rename to src/atomics_cobalt.h index eefb002..0308350 100644 --- a/include/libdivecomputer/atomics.h +++ b/src/atomics_cobalt.h @@ -19,9 +19,25 @@ * MA 02110-1301 USA */ -#ifndef ATOMICS_H -#define ATOMICS_H +#ifndef ATOMICS_COBALT_H +#define ATOMICS_COBALT_H -#include "atomics_cobalt.h" +#include +#include +#include +#include -#endif /* ATOMICS_H */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +atomics_cobalt_device_open (dc_device_t **device, dc_context_t *context); + +dc_status_t +atomics_cobalt_parser_create (dc_parser_t **parser, dc_context_t *context); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* ATOMICS_COBALT_H */ diff --git a/src/atomics_cobalt_parser.c b/src/atomics_cobalt_parser.c index aacfb77..e43243c 100644 --- a/src/atomics_cobalt_parser.c +++ b/src/atomics_cobalt_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "atomics_cobalt.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/citizen_aqualand.c b/src/citizen_aqualand.c index 68cfc8c..5e111da 100644 --- a/src/citizen_aqualand.c +++ b/src/citizen_aqualand.c @@ -22,8 +22,7 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "citizen_aqualand.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/citizen_aqualand.h b/src/citizen_aqualand.h similarity index 91% rename from include/libdivecomputer/citizen_aqualand.h rename to src/citizen_aqualand.h index 2b703a4..6391660 100644 --- a/include/libdivecomputer/citizen_aqualand.h +++ b/src/citizen_aqualand.h @@ -22,9 +22,9 @@ #ifndef CITIZEN_AQUALAND_H #define CITIZEN_AQUALAND_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/citizen_aqualand_parser.c b/src/citizen_aqualand_parser.c index 9f7d992..f89eacf 100644 --- a/src/citizen_aqualand_parser.c +++ b/src/citizen_aqualand_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "citizen_aqualand.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/cochran_commander.c b/src/cochran_commander.c index 735120b..99fe369 100644 --- a/src/cochran_commander.c +++ b/src/cochran_commander.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "cochran_commander.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/cochran_commander.h b/src/cochran_commander.h similarity index 91% rename from include/libdivecomputer/cochran_commander.h rename to src/cochran_commander.h index 0cbaf7e..e475b5f 100644 --- a/include/libdivecomputer/cochran_commander.h +++ b/src/cochran_commander.h @@ -22,9 +22,9 @@ #ifndef COCHRAN_COMMANDER_H #define COCHRAN_COMMANDER_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/cochran_commander_parser.c b/src/cochran_commander_parser.c index 1873a46..ab854ad 100644 --- a/src/cochran_commander_parser.c +++ b/src/cochran_commander_parser.c @@ -23,8 +23,8 @@ #include #include -#include +#include "cochran_commander.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/cressi_edy.c b/src/cressi_edy.c index 9270b92..226f32f 100644 --- a/src/cressi_edy.c +++ b/src/cressi_edy.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "cressi_edy.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/cressi_edy.h b/src/cressi_edy.h similarity index 91% rename from include/libdivecomputer/cressi_edy.h rename to src/cressi_edy.h index 852aa05..d89f02f 100644 --- a/include/libdivecomputer/cressi_edy.h +++ b/src/cressi_edy.h @@ -22,9 +22,9 @@ #ifndef CRESSI_EDY_H #define CRESSI_EDY_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/cressi_edy_parser.c b/src/cressi_edy_parser.c index 2856c3c..c9e1d91 100644 --- a/src/cressi_edy_parser.c +++ b/src/cressi_edy_parser.c @@ -21,8 +21,7 @@ #include -#include - +#include "cressi_edy.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index 5259fe5..ea3966d 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "cressi_leonardo.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/cressi_leonardo.h b/src/cressi_leonardo.h similarity index 93% rename from include/libdivecomputer/cressi_leonardo.h rename to src/cressi_leonardo.h index 23e4554..df246a1 100644 --- a/include/libdivecomputer/cressi_leonardo.h +++ b/src/cressi_leonardo.h @@ -22,9 +22,9 @@ #ifndef CRESSI_LEONARDO_H #define CRESSI_LEONARDO_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/cressi_leonardo_parser.c b/src/cressi_leonardo_parser.c index 54ffbb4..3e0d1e4 100644 --- a/src/cressi_leonardo_parser.c +++ b/src/cressi_leonardo_parser.c @@ -21,8 +21,7 @@ #include -#include - +#include "cressi_leonardo.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/device.c b/src/device.c index f94adf2..f32f8d2 100644 --- a/src/device.c +++ b/src/device.c @@ -23,20 +23,39 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "suunto_d9.h" +#include "suunto_eon.h" +#include "suunto_eonsteel.h" +#include "suunto_solution.h" +#include "suunto_vyper2.h" +#include "suunto_vyper.h" +#include "reefnet_sensus.h" +#include "reefnet_sensuspro.h" +#include "reefnet_sensusultra.h" +#include "uwatec_aladin.h" +#include "uwatec_memomouse.h" +#include "uwatec_meridian.h" +#include "uwatec_smart.h" +#include "oceanic_atom2.h" +#include "oceanic_veo250.h" +#include "oceanic_vtpro.h" +#include "mares_darwin.h" +#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" +#include "cressi_leonardo.h" +#include "zeagle_n2ition3.h" +#include "atomics_cobalt.h" +#include "shearwater_petrel.h" +#include "shearwater_predator.h" +#include "diverite_nitekq.h" +#include "citizen_aqualand.h" +#include "divesystem_idive.h" +#include "cochran_commander.h" #include "device-private.h" #include "context-private.h" diff --git a/src/diverite_nitekq.c b/src/diverite_nitekq.c index 1565779..8493153 100644 --- a/src/diverite_nitekq.c +++ b/src/diverite_nitekq.c @@ -23,8 +23,7 @@ #include #include -#include - +#include "diverite_nitekq.h" #include "context-private.h" #include "device-private.h" #include "checksum.h" diff --git a/include/libdivecomputer/diverite_nitekq.h b/src/diverite_nitekq.h similarity index 92% rename from include/libdivecomputer/diverite_nitekq.h rename to src/diverite_nitekq.h index d7dd5e8..fd1fa6b 100644 --- a/include/libdivecomputer/diverite_nitekq.h +++ b/src/diverite_nitekq.h @@ -22,9 +22,9 @@ #ifndef DIVERITE_NITEKQ_H #define DIVERITE_NITEKQ_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/diverite_nitekq_parser.c b/src/diverite_nitekq_parser.c index 6cbd4dc..6c7a05f 100644 --- a/src/diverite_nitekq_parser.c +++ b/src/diverite_nitekq_parser.c @@ -22,8 +22,8 @@ #include #include -#include +#include "diverite_nitekq.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/divesystem_idive.c b/src/divesystem_idive.c index 75a2dbe..759f657 100644 --- a/src/divesystem_idive.c +++ b/src/divesystem_idive.c @@ -22,8 +22,7 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "divesystem_idive.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/divesystem_idive.h b/src/divesystem_idive.h similarity index 92% rename from include/libdivecomputer/divesystem_idive.h rename to src/divesystem_idive.h index 4a9d817..015f44e 100644 --- a/include/libdivecomputer/divesystem_idive.h +++ b/src/divesystem_idive.h @@ -22,9 +22,9 @@ #ifndef DIVESYSTEM_IDIVE_H #define DIVESYSTEM_IDIVE_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/divesystem_idive_parser.c b/src/divesystem_idive_parser.c index 262d192..0b40945 100644 --- a/src/divesystem_idive_parser.c +++ b/src/divesystem_idive_parser.c @@ -21,8 +21,7 @@ #include -#include - +#include "divesystem_idive.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/hw_frog.c b/src/hw_frog.c index 0ba5342..d8b89ca 100644 --- a/src/hw_frog.c +++ b/src/hw_frog.c @@ -22,8 +22,7 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "hw_frog.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/shearwater.h b/src/hw_frog.h similarity index 66% rename from include/libdivecomputer/shearwater.h rename to src/hw_frog.h index df693e9..260e80d 100644 --- a/include/libdivecomputer/shearwater.h +++ b/src/hw_frog.h @@ -19,10 +19,22 @@ * MA 02110-1301 USA */ -#ifndef SHEARWATER_H -#define SHEARWATER_H +#ifndef HW_FROG_H +#define HW_FROG_H -#include "shearwater_predator.h" -#include "shearwater_petrel.h" +#include +#include +#include +#include -#endif /* SHEARWATER_H */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +hw_frog_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* HW_FROG_H */ diff --git a/src/hw_ostc.c b/src/hw_ostc.c index 1185e81..ce30415 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -22,8 +22,7 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "hw_ostc.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/hw.h b/src/hw_ostc.h similarity index 55% rename from include/libdivecomputer/hw.h rename to src/hw_ostc.h index 2ac6e29..b7f7aa8 100644 --- a/include/libdivecomputer/hw.h +++ b/src/hw_ostc.h @@ -19,11 +19,28 @@ * MA 02110-1301 USA */ -#ifndef HW_H -#define HW_H +#ifndef HW_OSTC_H +#define HW_OSTC_H -#include "hw_ostc.h" -#include "hw_frog.h" -#include "hw_ostc3.h" +#include +#include +#include +#include -#endif /* HW_H */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +hw_ostc_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +hw_ostc_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); + +dc_status_t +hw_ostc_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int hwos); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* HW_OSTC_H */ diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index e8df9b5..b8693cb 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -24,8 +24,7 @@ #include // malloc, free #include // FILE, fopen -#include - +#include "hw_ostc3.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/diverite.h b/src/hw_ostc3.h similarity index 61% rename from include/libdivecomputer/diverite.h rename to src/hw_ostc3.h index 9bf6bf6..eec35b7 100644 --- a/include/libdivecomputer/diverite.h +++ b/src/hw_ostc3.h @@ -19,9 +19,25 @@ * MA 02110-1301 USA */ -#ifndef DIVERITE_H -#define DIVERITE_H +#ifndef HW_OSTC3_H +#define HW_OSTC3_H -#include "diverite_nitekq.h" +#include +#include +#include +#include -#endif /* DIVERITE_H */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +hw_ostc3_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +hw_ostc3_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* HW_OSTC3_H */ diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 9ac9c52..b9f947b 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -21,10 +21,10 @@ #include -#include -#include #include "libdivecomputer/units.h" +#include "hw_ostc.h" +#include "hw_ostc3.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/libdivecomputer.symbols b/src/libdivecomputer.symbols index 5a2c18b..c3d372b 100644 --- a/src/libdivecomputer.symbols +++ b/src/libdivecomputer.symbols @@ -42,40 +42,10 @@ dc_parser_get_field dc_parser_samples_foreach dc_parser_destroy -reefnet_sensus_parser_create reefnet_sensus_parser_set_calibration -reefnet_sensuspro_parser_create reefnet_sensuspro_parser_set_calibration -reefnet_sensusultra_parser_create reefnet_sensusultra_parser_set_calibration -uwatec_memomouse_parser_create -uwatec_smart_parser_create -suunto_vyper_parser_create -suunto_solution_parser_create -suunto_eon_parser_create -suunto_d9_parser_create -suunto_eonsteel_parser_create -mares_nemo_parser_create -mares_darwin_parser_create -mares_iconhd_parser_create -oceanic_vtpro_parser_create -oceanic_vtpro_parser_create2 -oceanic_veo250_parser_create -oceanic_atom2_parser_create -hw_ostc_parser_create -hw_ostc3_parser_create -cressi_edy_parser_create -cressi_leonardo_parser_create -cressi_leonardo_parser_create2 -atomics_cobalt_parser_create atomics_cobalt_parser_set_calibration -shearwater_predator_parser_create -shearwater_petrel_parser_create -diverite_nitekq_parser_create -citizen_aqualand_parser_create -divesystem_idive_parser_create -divesystem_idive_parser_create2 -cochran_commander_parser_create dc_device_open dc_device_close @@ -88,79 +58,37 @@ dc_device_set_events dc_device_set_fingerprint dc_device_write -cressi_edy_device_open -cressi_leonardo_device_open -mares_nemo_device_open -mares_nemo_extract_dives -mares_puck_device_open -mares_puck_extract_dives -mares_darwin_device_open -mares_darwin_extract_dives -mares_iconhd_device_open -oceanic_atom2_device_open -oceanic_atom2_device_open2 oceanic_atom2_device_version oceanic_atom2_device_keepalive -oceanic_veo250_device_open oceanic_veo250_device_version oceanic_veo250_device_keepalive -oceanic_vtpro_device_open -oceanic_vtpro_device_open2 oceanic_vtpro_device_version oceanic_vtpro_device_keepalive -reefnet_sensus_device_open reefnet_sensus_device_get_handshake -reefnet_sensus_extract_dives -reefnet_sensuspro_device_open reefnet_sensuspro_device_get_handshake reefnet_sensuspro_device_write_interval -reefnet_sensuspro_extract_dives -reefnet_sensusultra_device_open reefnet_sensusultra_device_read_user reefnet_sensusultra_device_sense reefnet_sensusultra_device_get_handshake reefnet_sensusultra_device_write_parameter reefnet_sensusultra_device_write_user -reefnet_sensusultra_extract_dives -suunto_d9_device_open suunto_d9_device_version suunto_d9_device_reset_maxdepth -suunto_solution_device_open -suunto_solution_extract_dives -suunto_eon_device_open suunto_eon_device_write_interval suunto_eon_device_write_name -suunto_eon_extract_dives -suunto_vyper2_device_open suunto_vyper2_device_version suunto_vyper2_device_reset_maxdepth -suunto_vyper_device_open -suunto_vyper_device_read_dive -suunto_vyper_extract_dives -suunto_eonsteel_device_open -uwatec_aladin_device_open -uwatec_aladin_extract_dives -uwatec_memomouse_device_open -uwatec_memomouse_extract_dives -uwatec_smart_device_open -uwatec_smart_extract_dives -uwatec_meridian_device_open -uwatec_meridian_extract_dives -hw_ostc_device_open hw_ostc_device_md2hash hw_ostc_device_clock hw_ostc_device_eeprom_read hw_ostc_device_eeprom_write hw_ostc_device_reset hw_ostc_device_screenshot -hw_ostc_extract_dives hw_ostc_device_fwupdate -hw_frog_device_open hw_frog_device_version hw_frog_device_clock hw_frog_device_display hw_frog_device_customtext -hw_ostc3_device_open hw_ostc3_device_version hw_ostc3_device_hardware hw_ostc3_device_clock @@ -170,16 +98,5 @@ hw_ostc3_device_config_read hw_ostc3_device_config_write hw_ostc3_device_config_reset hw_ostc3_device_fwupdate -zeagle_n2ition3_device_open -atomics_cobalt_device_open atomics_cobalt_device_version atomics_cobalt_device_set_simulation -shearwater_predator_device_open -shearwater_predator_extract_dives -shearwater_petrel_device_open -diverite_nitekq_device_open -diverite_nitekq_extract_dives -citizen_aqualand_device_open -divesystem_idive_device_open -divesystem_idive_device_open2 -cochran_commander_device_open diff --git a/src/mares_darwin.c b/src/mares_darwin.c index 3f06a4a..3922c75 100644 --- a/src/mares_darwin.c +++ b/src/mares_darwin.c @@ -23,12 +23,12 @@ #include #include -#include #include +#include "mares_darwin.h" +#include "mares_common.h" #include "context-private.h" #include "device-private.h" -#include "mares_common.h" #include "array.h" #define ISINSTANCE(device) dc_device_isinstance((device), &mares_darwin_device_vtable) diff --git a/include/libdivecomputer/mares_darwin.h b/src/mares_darwin.h similarity index 92% rename from include/libdivecomputer/mares_darwin.h rename to src/mares_darwin.h index 9d4da9a..3df4578 100644 --- a/include/libdivecomputer/mares_darwin.h +++ b/src/mares_darwin.h @@ -22,9 +22,9 @@ #ifndef MARES_DARWIN_H #define MARES_DARWIN_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/mares_darwin_parser.c b/src/mares_darwin_parser.c index 73963e5..1201ec6 100644 --- a/src/mares_darwin_parser.c +++ b/src/mares_darwin_parser.c @@ -22,9 +22,9 @@ #include #include -#include #include +#include "mares_darwin.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 28e7717..c78acf7 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "mares_iconhd.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/mares_iconhd.h b/src/mares_iconhd.h similarity index 91% rename from include/libdivecomputer/mares_iconhd.h rename to src/mares_iconhd.h index ce0c8c6..bd4b193 100644 --- a/include/libdivecomputer/mares_iconhd.h +++ b/src/mares_iconhd.h @@ -22,9 +22,9 @@ #ifndef MARES_ICONHD_H #define MARES_ICONHD_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/mares_iconhd_parser.c b/src/mares_iconhd_parser.c index 8e356be..0c45a15 100644 --- a/src/mares_iconhd_parser.c +++ b/src/mares_iconhd_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "mares_iconhd.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/mares_nemo.c b/src/mares_nemo.c index 16824ae..dc6b480 100644 --- a/src/mares_nemo.c +++ b/src/mares_nemo.c @@ -22,11 +22,10 @@ #include // memcpy, memcmp #include // malloc, free -#include - +#include "mares_nemo.h" +#include "mares_common.h" #include "context-private.h" #include "device-private.h" -#include "mares_common.h" #include "serial.h" #include "checksum.h" #include "array.h" diff --git a/include/libdivecomputer/mares_nemo.h b/src/mares_nemo.h similarity index 92% rename from include/libdivecomputer/mares_nemo.h rename to src/mares_nemo.h index 4ced926..176070e 100644 --- a/include/libdivecomputer/mares_nemo.h +++ b/src/mares_nemo.h @@ -22,9 +22,9 @@ #ifndef MARES_NEMO_H #define MARES_NEMO_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/mares_nemo_parser.c b/src/mares_nemo_parser.c index 7b24ca4..9a6cbfd 100644 --- a/src/mares_nemo_parser.c +++ b/src/mares_nemo_parser.c @@ -22,9 +22,9 @@ #include #include -#include #include +#include "mares_nemo.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/mares_puck.c b/src/mares_puck.c index 853ad03..0a75666 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -23,11 +23,10 @@ #include // malloc, free #include // assert -#include - +#include "mares_puck.h" +#include "mares_common.h" #include "context-private.h" #include "device-private.h" -#include "mares_common.h" #include "serial.h" #include "checksum.h" #include "array.h" diff --git a/include/libdivecomputer/mares_puck.h b/src/mares_puck.h similarity index 91% rename from include/libdivecomputer/mares_puck.h rename to src/mares_puck.h index 6706474..eba37c0 100644 --- a/include/libdivecomputer/mares_puck.h +++ b/src/mares_puck.h @@ -22,9 +22,9 @@ #ifndef MARES_PUCK_H #define MARES_PUCK_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 34cc592..6c5fe67 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -22,11 +22,10 @@ #include // memcpy #include // malloc, free -#include - +#include "oceanic_atom2.h" +#include "oceanic_common.h" #include "context-private.h" #include "device-private.h" -#include "oceanic_common.h" #include "serial.h" #include "array.h" #include "ringbuffer.h" diff --git a/src/oceanic_atom2.h b/src/oceanic_atom2.h new file mode 100644 index 0000000..ee0f657 --- /dev/null +++ b/src/oceanic_atom2.h @@ -0,0 +1,47 @@ +/* + * libdivecomputer + * + * Copyright (C) 2008 Jef Driesen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef OCEANIC_ATOM2_H +#define OCEANIC_ATOM2_H + +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +oceanic_atom2_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +oceanic_atom2_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); + +dc_status_t +oceanic_atom2_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* OCEANIC_ATOM2_H */ diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 0b22615..bcc4cd5 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "oceanic_atom2.h" #include "oceanic_common.h" #include "context-private.h" #include "parser-private.h" diff --git a/src/oceanic_veo250.c b/src/oceanic_veo250.c index 033081d..d47c532 100644 --- a/src/oceanic_veo250.c +++ b/src/oceanic_veo250.c @@ -22,11 +22,10 @@ #include // memcpy #include // malloc, free -#include - +#include "oceanic_veo250.h" +#include "oceanic_common.h" #include "context-private.h" #include "device-private.h" -#include "oceanic_common.h" #include "serial.h" #include "ringbuffer.h" #include "checksum.h" diff --git a/include/libdivecomputer/suunto.h b/src/oceanic_veo250.h similarity index 59% rename from include/libdivecomputer/suunto.h rename to src/oceanic_veo250.h index 3ff7c88..aefd20e 100644 --- a/include/libdivecomputer/suunto.h +++ b/src/oceanic_veo250.h @@ -19,14 +19,26 @@ * MA 02110-1301 USA */ -#ifndef SUUNTO_H -#define SUUNTO_H +#ifndef OCEANIC_VEO250_H +#define OCEANIC_VEO250_H -#include "suunto_solution.h" -#include "suunto_eon.h" -#include "suunto_vyper.h" -#include "suunto_vyper2.h" -#include "suunto_d9.h" -#include "suunto_eonsteel.h" +#include +#include +#include -#endif /* SUUNTO_H */ +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +oceanic_veo250_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +oceanic_veo250_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* OCEANIC_VEO250_H */ diff --git a/src/oceanic_veo250_parser.c b/src/oceanic_veo250_parser.c index 7be86c4..ba69723 100644 --- a/src/oceanic_veo250_parser.c +++ b/src/oceanic_veo250_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "oceanic_veo250.h" #include "oceanic_common.h" #include "context-private.h" #include "parser-private.h" diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index 3128079..c16f600 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -23,11 +23,10 @@ #include // malloc, free #include -#include - +#include "oceanic_vtpro.h" +#include "oceanic_common.h" #include "context-private.h" #include "device-private.h" -#include "oceanic_common.h" #include "serial.h" #include "ringbuffer.h" #include "checksum.h" diff --git a/src/oceanic_vtpro.h b/src/oceanic_vtpro.h new file mode 100644 index 0000000..6beef68 --- /dev/null +++ b/src/oceanic_vtpro.h @@ -0,0 +1,50 @@ +/* + * libdivecomputer + * + * Copyright (C) 2008 Jef Driesen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef OCEANIC_VTPRO_H +#define OCEANIC_VTPRO_H + +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +oceanic_vtpro_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +oceanic_vtpro_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); + +dc_status_t +oceanic_vtpro_parser_create (dc_parser_t **parser, dc_context_t *context); + +dc_status_t +oceanic_vtpro_parser_create2 (dc_parser_t **parser, dc_context_t *context, unsigned int model); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* OCEANIC_VTPRO_H */ diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index 1f9d7aa..822f22e 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "oceanic_vtpro.h" #include "oceanic_common.h" #include "context-private.h" #include "parser-private.h" diff --git a/src/parser.c b/src/parser.c index 8b10e38..1b1e314 100644 --- a/src/parser.c +++ b/src/parser.c @@ -22,20 +22,40 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "suunto_d9.h" +#include "suunto_eon.h" +#include "suunto_eonsteel.h" +#include "suunto_solution.h" +#include "suunto_vyper2.h" +#include "suunto_vyper.h" +#include "reefnet_sensus.h" +#include "reefnet_sensuspro.h" +#include "reefnet_sensusultra.h" +#include "uwatec_aladin.h" +#include "uwatec_memomouse.h" +#include "uwatec_meridian.h" +#include "uwatec_smart.h" +#include "oceanic_atom2.h" +#include "oceanic_atom2.h" +#include "oceanic_veo250.h" +#include "oceanic_vtpro.h" +#include "mares_darwin.h" +#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" +#include "cressi_leonardo.h" +#include "zeagle_n2ition3.h" +#include "atomics_cobalt.h" +#include "shearwater_petrel.h" +#include "shearwater_predator.h" +#include "diverite_nitekq.h" +#include "citizen_aqualand.h" +#include "divesystem_idive.h" +#include "cochran_commander.h" #include "context-private.h" #include "parser-private.h" diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index 09c5266..b20047a 100644 --- a/src/reefnet_sensus.c +++ b/src/reefnet_sensus.c @@ -22,8 +22,7 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "reefnet_sensus.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/src/reefnet_sensus.h b/src/reefnet_sensus.h new file mode 100644 index 0000000..fda47d0 --- /dev/null +++ b/src/reefnet_sensus.h @@ -0,0 +1,46 @@ +/* + * libdivecomputer + * + * Copyright (C) 2008 Jef Driesen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef REEFNET_SENSUS_H +#define REEFNET_SENSUS_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +reefnet_sensus_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +reefnet_sensus_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); + +dc_status_t +reefnet_sensus_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* REEFNET_SENSUS_H */ diff --git a/src/reefnet_sensus_parser.c b/src/reefnet_sensus_parser.c index ba4b7de..50fd69e 100644 --- a/src/reefnet_sensus_parser.c +++ b/src/reefnet_sensus_parser.c @@ -21,9 +21,9 @@ #include // malloc, free -#include #include +#include "reefnet_sensus.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index b9c08db..c0802de 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -22,8 +22,7 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "reefnet_sensuspro.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/src/reefnet_sensuspro.h b/src/reefnet_sensuspro.h new file mode 100644 index 0000000..91d80b8 --- /dev/null +++ b/src/reefnet_sensuspro.h @@ -0,0 +1,46 @@ +/* + * libdivecomputer + * + * Copyright (C) 2008 Jef Driesen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef REEFNET_SENSUSPRO_H +#define REEFNET_SENSUSPRO_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +reefnet_sensuspro_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +reefnet_sensuspro_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); + +dc_status_t +reefnet_sensuspro_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* REEFNET_SENSUSPRO_H */ diff --git a/src/reefnet_sensuspro_parser.c b/src/reefnet_sensuspro_parser.c index 70decf8..fe62668 100644 --- a/src/reefnet_sensuspro_parser.c +++ b/src/reefnet_sensuspro_parser.c @@ -22,9 +22,9 @@ #include #include // memcmp -#include #include +#include "reefnet_sensuspro.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index ead2388..4fa8187 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "reefnet_sensusultra.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/src/reefnet_sensusultra.h b/src/reefnet_sensusultra.h new file mode 100644 index 0000000..a1d21be --- /dev/null +++ b/src/reefnet_sensusultra.h @@ -0,0 +1,46 @@ +/* + * libdivecomputer + * + * Copyright (C) 2008 Jef Driesen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef REEFNET_SENSUSULTRA_H +#define REEFNET_SENSUSULTRA_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +reefnet_sensusultra_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +reefnet_sensusultra_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); + +dc_status_t +reefnet_sensusultra_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* REEFNET_SENSUSULTRA_H */ diff --git a/src/reefnet_sensusultra_parser.c b/src/reefnet_sensusultra_parser.c index d44edfe..8aaacca 100644 --- a/src/reefnet_sensusultra_parser.c +++ b/src/reefnet_sensusultra_parser.c @@ -22,9 +22,9 @@ #include #include // memcmp -#include #include +#include "reefnet_sensusultra.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/shearwater_petrel.c b/src/shearwater_petrel.c index 13e1496..4966d14 100644 --- a/src/shearwater_petrel.c +++ b/src/shearwater_petrel.c @@ -22,10 +22,8 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "shearwater_petrel.h" #include "shearwater_common.h" - #include "context-private.h" #include "device-private.h" #include "array.h" diff --git a/include/libdivecomputer/shearwater_petrel.h b/src/shearwater_petrel.h similarity index 91% rename from include/libdivecomputer/shearwater_petrel.h rename to src/shearwater_petrel.h index 5092127..8b927d6 100644 --- a/include/libdivecomputer/shearwater_petrel.h +++ b/src/shearwater_petrel.h @@ -22,9 +22,9 @@ #ifndef SHEARWATER_PETREL_H #define SHEARWATER_PETREL_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/shearwater_predator.c b/src/shearwater_predator.c index 505dd85..efb5eb4 100644 --- a/src/shearwater_predator.c +++ b/src/shearwater_predator.c @@ -22,10 +22,8 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "shearwater_predator.h" #include "shearwater_common.h" - #include "context-private.h" #include "device-private.h" #include "array.h" diff --git a/include/libdivecomputer/shearwater_predator.h b/src/shearwater_predator.h similarity index 92% rename from include/libdivecomputer/shearwater_predator.h rename to src/shearwater_predator.h index 40c7ae2..4e3f5ae 100644 --- a/include/libdivecomputer/shearwater_predator.h +++ b/src/shearwater_predator.h @@ -22,9 +22,9 @@ #ifndef SHEARWATER_PREDATOR_H #define SHEARWATER_PREDATOR_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index c3a49c8..039926f 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -21,10 +21,10 @@ #include -#include -#include #include +#include "shearwater_predator.h" +#include "shearwater_petrel.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/suunto_d9.c b/src/suunto_d9.c index 00de2ee..2908792 100644 --- a/src/suunto_d9.c +++ b/src/suunto_d9.c @@ -23,10 +23,9 @@ #include // malloc, free #include // assert -#include - -#include "context-private.h" +#include "suunto_d9.h" #include "suunto_common2.h" +#include "context-private.h" #include "serial.h" #include "checksum.h" #include "array.h" diff --git a/include/libdivecomputer/reefnet.h b/src/suunto_d9.h similarity index 59% rename from include/libdivecomputer/reefnet.h rename to src/suunto_d9.h index ad3fb36..91fe8b2 100644 --- a/include/libdivecomputer/reefnet.h +++ b/src/suunto_d9.h @@ -19,11 +19,25 @@ * MA 02110-1301 USA */ -#ifndef REEFNET_H -#define REEFNET_H +#ifndef SUUNTO_D9_H +#define SUUNTO_D9_H -#include "reefnet_sensus.h" -#include "reefnet_sensuspro.h" -#include "reefnet_sensusultra.h" +#include +#include +#include +#include -#endif /* REEFNET_H */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +suunto_d9_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); + +dc_status_t +suunto_d9_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* SUUNTO_D9_H */ diff --git a/src/suunto_d9_parser.c b/src/suunto_d9_parser.c index 550d515..68e79f9 100644 --- a/src/suunto_d9_parser.c +++ b/src/suunto_d9_parser.c @@ -22,8 +22,7 @@ #include #include // memcmp -#include - +#include "suunto_d9.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/suunto_eon.c b/src/suunto_eon.c index f7cab8f..30b95bf 100644 --- a/src/suunto_eon.c +++ b/src/suunto_eon.c @@ -22,11 +22,10 @@ #include // memcmp, memcpy #include // malloc, free -#include - +#include "suunto_eon.h" +#include "suunto_common.h" #include "context-private.h" #include "device-private.h" -#include "suunto_common.h" #include "serial.h" #include "checksum.h" #include "array.h" diff --git a/src/suunto_eon.h b/src/suunto_eon.h new file mode 100644 index 0000000..19b32a2 --- /dev/null +++ b/src/suunto_eon.h @@ -0,0 +1,46 @@ +/* + * libdivecomputer + * + * Copyright (C) 2008 Jef Driesen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef SUUNTO_EON_H +#define SUUNTO_EON_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +dc_status_t +suunto_eon_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +dc_status_t +suunto_eon_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); + +dc_status_t +suunto_eon_parser_create (dc_parser_t **parser, dc_context_t *context, int spyder); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* SUUNTO_EON_H */ diff --git a/src/suunto_eon_parser.c b/src/suunto_eon_parser.c index 714df34..066c997 100644 --- a/src/suunto_eon_parser.c +++ b/src/suunto_eon_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "suunto_eon.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 213f27a..58197ac 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -23,8 +23,7 @@ #include #include -#include - +#include "suunto_eonsteel.h" #include "context-private.h" #include "device-private.h" #include "array.h" diff --git a/include/libdivecomputer/suunto_eonsteel.h b/src/suunto_eonsteel.h similarity index 74% rename from include/libdivecomputer/suunto_eonsteel.h rename to src/suunto_eonsteel.h index 68e2986..4d34478 100644 --- a/include/libdivecomputer/suunto_eonsteel.h +++ b/src/suunto_eonsteel.h @@ -22,16 +22,19 @@ #ifndef SUUNTO_EONSTEEL_H #define SUUNTO_EONSTEEL_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -dc_status_t suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); -dc_status_t suunto_eonsteel_parser_create(dc_parser_t **parser, dc_context_t *context, unsigned int model); +dc_status_t +suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); + +dc_status_t +suunto_eonsteel_parser_create(dc_parser_t **parser, dc_context_t *context, unsigned int model); #ifdef __cplusplus } diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 653ab5e..baa0319 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -24,8 +24,7 @@ #include #include -#include - +#include "suunto_eonsteel.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/suunto_solution.c b/src/suunto_solution.c index 9a8149e..d5ea802 100644 --- a/src/suunto_solution.c +++ b/src/suunto_solution.c @@ -21,9 +21,9 @@ #include // malloc, free -#include #include +#include "suunto_solution.h" #include "context-private.h" #include "device-private.h" #include "ringbuffer.h" diff --git a/include/libdivecomputer/suunto_solution.h b/src/suunto_solution.h similarity index 92% rename from include/libdivecomputer/suunto_solution.h rename to src/suunto_solution.h index 619eb88..386ecbc 100644 --- a/include/libdivecomputer/suunto_solution.h +++ b/src/suunto_solution.h @@ -22,9 +22,9 @@ #ifndef SUUNTO_SOLUTION_H #define SUUNTO_SOLUTION_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/suunto_solution_parser.c b/src/suunto_solution_parser.c index e8e6986..9b2ac9d 100644 --- a/src/suunto_solution_parser.c +++ b/src/suunto_solution_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "suunto_solution.h" #include "context-private.h" #include "parser-private.h" diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index 2d9f3a9..45ca47a 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -23,11 +23,10 @@ #include // malloc, free #include // assert -#include - +#include "suunto_vyper.h" +#include "suunto_common.h" #include "context-private.h" #include "device-private.h" -#include "suunto_common.h" #include "serial.h" #include "checksum.h" #include "array.h" diff --git a/include/libdivecomputer/suunto_vyper.h b/src/suunto_vyper.h similarity index 92% rename from include/libdivecomputer/suunto_vyper.h rename to src/suunto_vyper.h index a730b95..9de188a 100644 --- a/include/libdivecomputer/suunto_vyper.h +++ b/src/suunto_vyper.h @@ -22,9 +22,9 @@ #ifndef SUUNTO_VYPER_H #define SUUNTO_VYPER_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/suunto_vyper2.c b/src/suunto_vyper2.c index 7a0f26b..8ab521e 100644 --- a/src/suunto_vyper2.c +++ b/src/suunto_vyper2.c @@ -22,10 +22,9 @@ #include // memcmp, memcpy #include // malloc, free -#include - -#include "context-private.h" +#include "suunto_vyper2.h" #include "suunto_common2.h" +#include "context-private.h" #include "serial.h" #include "checksum.h" #include "array.h" diff --git a/include/libdivecomputer/oceanic.h b/src/suunto_vyper2.h similarity index 66% rename from include/libdivecomputer/oceanic.h rename to src/suunto_vyper2.h index f889120..b6486d9 100644 --- a/include/libdivecomputer/oceanic.h +++ b/src/suunto_vyper2.h @@ -19,11 +19,21 @@ * MA 02110-1301 USA */ -#ifndef OCEANIC_H -#define OCEANIC_H +#ifndef SUUNTO_VYPER2_H +#define SUUNTO_VYPER2_H -#include "oceanic_atom2.h" -#include "oceanic_veo250.h" -#include "oceanic_vtpro.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ -#endif /* OCEANIC_H */ +#include +#include +#include + +dc_status_t +suunto_vyper2_device_open (dc_device_t **device, dc_context_t *context, const char *name); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* SUUNTO_VYPER2_H */ diff --git a/src/suunto_vyper_parser.c b/src/suunto_vyper_parser.c index 3b46539..0ca8eaa 100644 --- a/src/suunto_vyper_parser.c +++ b/src/suunto_vyper_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "suunto_vyper.h" #include "context-private.h" #include "parser-private.h" diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index 91b87a9..e587d03 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -22,8 +22,7 @@ #include // malloc, free #include // memcpy -#include - +#include "uwatec_aladin.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/uwatec_aladin.h b/src/uwatec_aladin.h similarity index 94% rename from include/libdivecomputer/uwatec_aladin.h rename to src/uwatec_aladin.h index 73226a9..f8badf7 100644 --- a/include/libdivecomputer/uwatec_aladin.h +++ b/src/uwatec_aladin.h @@ -26,8 +26,8 @@ extern "C" { #endif /* __cplusplus */ -#include "context.h" -#include "device.h" +#include +#include dc_status_t uwatec_aladin_device_open (dc_device_t **device, dc_context_t *context, const char *name); diff --git a/src/uwatec_memomouse.c b/src/uwatec_memomouse.c index 92e3044..68b4dbf 100644 --- a/src/uwatec_memomouse.c +++ b/src/uwatec_memomouse.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "uwatec_memomouse.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/uwatec_memomouse.h b/src/uwatec_memomouse.h similarity index 92% rename from include/libdivecomputer/uwatec_memomouse.h rename to src/uwatec_memomouse.h index 7eb5dc0..9e64975 100644 --- a/include/libdivecomputer/uwatec_memomouse.h +++ b/src/uwatec_memomouse.h @@ -22,9 +22,9 @@ #ifndef UWATEC_MEMOMOUSE_H #define UWATEC_MEMOMOUSE_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/uwatec_memomouse_parser.c b/src/uwatec_memomouse_parser.c index e5c66f9..f36dc6c 100644 --- a/src/uwatec_memomouse_parser.c +++ b/src/uwatec_memomouse_parser.c @@ -21,9 +21,9 @@ #include -#include #include +#include "uwatec_memomouse.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/uwatec_meridian.c b/src/uwatec_meridian.c index 3e08f94..2e1287b 100644 --- a/src/uwatec_meridian.c +++ b/src/uwatec_meridian.c @@ -23,8 +23,7 @@ #include #include -#include - +#include "uwatec_meridian.h" #include "context-private.h" #include "device-private.h" #include "checksum.h" diff --git a/include/libdivecomputer/uwatec_meridian.h b/src/uwatec_meridian.h similarity index 92% rename from include/libdivecomputer/uwatec_meridian.h rename to src/uwatec_meridian.h index 723a9de..e99bcfa 100644 --- a/include/libdivecomputer/uwatec_meridian.h +++ b/src/uwatec_meridian.h @@ -22,9 +22,9 @@ #ifndef UWATEC_MERIDIAN_H #define UWATEC_MERIDIAN_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index 3c55f07..be92b74 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -22,8 +22,7 @@ #include // malloc, free #include // strncmp, strstr -#include - +#include "uwatec_smart.h" #include "context-private.h" #include "device-private.h" #include "irda.h" diff --git a/include/libdivecomputer/uwatec_smart.h b/src/uwatec_smart.h similarity index 92% rename from include/libdivecomputer/uwatec_smart.h rename to src/uwatec_smart.h index 9f753eb..56c3e1a 100644 --- a/include/libdivecomputer/uwatec_smart.h +++ b/src/uwatec_smart.h @@ -22,9 +22,9 @@ #ifndef UWATEC_SMART_H #define UWATEC_SMART_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/uwatec_smart_parser.c b/src/uwatec_smart_parser.c index 8c6ce24..b350f1e 100644 --- a/src/uwatec_smart_parser.c +++ b/src/uwatec_smart_parser.c @@ -22,9 +22,9 @@ #include #include // memcmp -#include #include +#include "uwatec_smart.h" #include "context-private.h" #include "parser-private.h" #include "array.h" diff --git a/src/zeagle_n2ition3.c b/src/zeagle_n2ition3.c index 860238f..fed6ae2 100644 --- a/src/zeagle_n2ition3.c +++ b/src/zeagle_n2ition3.c @@ -23,8 +23,7 @@ #include // malloc, free #include // assert -#include - +#include "zeagle_n2ition3.h" #include "context-private.h" #include "device-private.h" #include "serial.h" diff --git a/include/libdivecomputer/zeagle_n2ition3.h b/src/zeagle_n2ition3.h similarity index 93% rename from include/libdivecomputer/zeagle_n2ition3.h rename to src/zeagle_n2ition3.h index a9509cd..d10daa7 100644 --- a/include/libdivecomputer/zeagle_n2ition3.h +++ b/src/zeagle_n2ition3.h @@ -22,8 +22,8 @@ #ifndef ZEAGLE_N2ITION3_H #define ZEAGLE_N2ITION3_H -#include "context.h" -#include "device.h" +#include +#include #ifdef __cplusplus extern "C" { From c5f089b4a6502949160c1114a201a22b54623e71 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 13 Apr 2017 13:39:30 +0200 Subject: [PATCH 5/8] Remove unnecessary helper functions The second variant of the open or create functions were introduced to maintain backwards compatibility. But after being removed from the public api, these functions serve no purpose anymore, and can be removed completely. --- src/cressi_leonardo.h | 5 +---- src/cressi_leonardo_parser.c | 9 +-------- src/device.c | 6 +++--- src/divesystem_idive.c | 9 +-------- src/divesystem_idive.h | 10 ++-------- src/divesystem_idive_parser.c | 9 +-------- src/oceanic_atom2.c | 9 +-------- src/oceanic_atom2.h | 5 +---- src/oceanic_vtpro.c | 9 +-------- src/oceanic_vtpro.h | 10 ++-------- src/oceanic_vtpro_parser.c | 9 +-------- src/parser.c | 6 +++--- 12 files changed, 18 insertions(+), 78 deletions(-) diff --git a/src/cressi_leonardo.h b/src/cressi_leonardo.h index df246a1..043cd5f 100644 --- a/src/cressi_leonardo.h +++ b/src/cressi_leonardo.h @@ -37,10 +37,7 @@ dc_status_t cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t -cressi_leonardo_parser_create (dc_parser_t **parser, dc_context_t *context); - -dc_status_t -cressi_leonardo_parser_create2 (dc_parser_t **parser, dc_context_t *context, unsigned int model); +cressi_leonardo_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); #ifdef __cplusplus } diff --git a/src/cressi_leonardo_parser.c b/src/cressi_leonardo_parser.c index 3e0d1e4..6032376 100644 --- a/src/cressi_leonardo_parser.c +++ b/src/cressi_leonardo_parser.c @@ -56,7 +56,7 @@ static const dc_parser_vtable_t cressi_leonardo_parser_vtable = { dc_status_t -cressi_leonardo_parser_create2 (dc_parser_t **out, dc_context_t *context, unsigned int model) +cressi_leonardo_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model) { cressi_leonardo_parser_t *parser = NULL; @@ -78,13 +78,6 @@ cressi_leonardo_parser_create2 (dc_parser_t **out, dc_context_t *context, unsign } -dc_status_t -cressi_leonardo_parser_create (dc_parser_t **parser, dc_context_t *context) -{ - return cressi_leonardo_parser_create2 (parser, context, 0); -} - - static dc_status_t cressi_leonardo_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size) { diff --git a/src/device.c b/src/device.c index f32f8d2..2fbcc30 100644 --- a/src/device.c +++ b/src/device.c @@ -148,13 +148,13 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr rc = reefnet_sensusultra_device_open (&device, context, name); break; case DC_FAMILY_OCEANIC_VTPRO: - rc = oceanic_vtpro_device_open2 (&device, context, name, dc_descriptor_get_model (descriptor)); + rc = oceanic_vtpro_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_OCEANIC_VEO250: rc = oceanic_veo250_device_open (&device, context, name); break; case DC_FAMILY_OCEANIC_ATOM2: - rc = oceanic_atom2_device_open2 (&device, context, name, dc_descriptor_get_model (descriptor)); + rc = oceanic_atom2_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_MARES_NEMO: rc = mares_nemo_device_open (&device, context, name); @@ -202,7 +202,7 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr rc = citizen_aqualand_device_open (&device, context, name); break; case DC_FAMILY_DIVESYSTEM_IDIVE: - rc = divesystem_idive_device_open2 (&device, context, name, dc_descriptor_get_model (descriptor)); + rc = divesystem_idive_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_COCHRAN_COMMANDER: rc = cochran_commander_device_open (&device, context, name); diff --git a/src/divesystem_idive.c b/src/divesystem_idive.c index 759f657..d8c02e8 100644 --- a/src/divesystem_idive.c +++ b/src/divesystem_idive.c @@ -96,14 +96,7 @@ static const divesystem_idive_commands_t ix3m = { }; dc_status_t -divesystem_idive_device_open (dc_device_t **out, dc_context_t *context, const char *name) -{ - return divesystem_idive_device_open2 (out, context, name, 0); -} - - -dc_status_t -divesystem_idive_device_open2 (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) +divesystem_idive_device_open (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) { dc_status_t status = DC_STATUS_SUCCESS; divesystem_idive_device_t *device = NULL; diff --git a/src/divesystem_idive.h b/src/divesystem_idive.h index 015f44e..20ed729 100644 --- a/src/divesystem_idive.h +++ b/src/divesystem_idive.h @@ -31,16 +31,10 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -divesystem_idive_device_open (dc_device_t **device, dc_context_t *context, const char *name); +divesystem_idive_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); dc_status_t -divesystem_idive_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); - -dc_status_t -divesystem_idive_parser_create (dc_parser_t **parser, dc_context_t *context); - -dc_status_t -divesystem_idive_parser_create2 (dc_parser_t **parser, dc_context_t *context, unsigned int model); +divesystem_idive_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); #ifdef __cplusplus } diff --git a/src/divesystem_idive_parser.c b/src/divesystem_idive_parser.c index 0b40945..968765c 100644 --- a/src/divesystem_idive_parser.c +++ b/src/divesystem_idive_parser.c @@ -82,14 +82,7 @@ static const dc_parser_vtable_t divesystem_idive_parser_vtable = { dc_status_t -divesystem_idive_parser_create (dc_parser_t **out, dc_context_t *context) -{ - return divesystem_idive_parser_create2 (out, context, 0); -} - - -dc_status_t -divesystem_idive_parser_create2 (dc_parser_t **out, dc_context_t *context, unsigned int model) +divesystem_idive_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model) { divesystem_idive_parser_t *parser = NULL; diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 6c5fe67..cccfc4e 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -555,14 +555,7 @@ oceanic_atom2_quit (oceanic_atom2_device_t *device) dc_status_t -oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, const char *name) -{ - return oceanic_atom2_device_open2 (out, context, name, 0); -} - - -dc_status_t -oceanic_atom2_device_open2 (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) +oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) { dc_status_t status = DC_STATUS_SUCCESS; oceanic_atom2_device_t *device = NULL; diff --git a/src/oceanic_atom2.h b/src/oceanic_atom2.h index ee0f657..cee2306 100644 --- a/src/oceanic_atom2.h +++ b/src/oceanic_atom2.h @@ -33,10 +33,7 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -oceanic_atom2_device_open (dc_device_t **device, dc_context_t *context, const char *name); - -dc_status_t -oceanic_atom2_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); +oceanic_atom2_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); dc_status_t oceanic_atom2_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index c16f600..2e86f5f 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -384,14 +384,7 @@ oceanic_vtpro_device_logbook (dc_device_t *abstract, dc_event_progress_t *progre } dc_status_t -oceanic_vtpro_device_open (dc_device_t **out, dc_context_t *context, const char *name) -{ - return oceanic_vtpro_device_open2 (out, context, name, 0); -} - - -dc_status_t -oceanic_vtpro_device_open2 (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) +oceanic_vtpro_device_open (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) { dc_status_t status = DC_STATUS_SUCCESS; oceanic_vtpro_device_t *device = NULL; diff --git a/src/oceanic_vtpro.h b/src/oceanic_vtpro.h index 6beef68..9689818 100644 --- a/src/oceanic_vtpro.h +++ b/src/oceanic_vtpro.h @@ -33,16 +33,10 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -oceanic_vtpro_device_open (dc_device_t **device, dc_context_t *context, const char *name); +oceanic_vtpro_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); dc_status_t -oceanic_vtpro_device_open2 (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); - -dc_status_t -oceanic_vtpro_parser_create (dc_parser_t **parser, dc_context_t *context); - -dc_status_t -oceanic_vtpro_parser_create2 (dc_parser_t **parser, dc_context_t *context, unsigned int model); +oceanic_vtpro_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); #ifdef __cplusplus } diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index 822f22e..9c85854 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -61,14 +61,7 @@ static const dc_parser_vtable_t oceanic_vtpro_parser_vtable = { dc_status_t -oceanic_vtpro_parser_create (dc_parser_t **out, dc_context_t *context) -{ - return oceanic_vtpro_parser_create2 (out, context, 0); -} - - -dc_status_t -oceanic_vtpro_parser_create2 (dc_parser_t **out, dc_context_t *context, unsigned int model) +oceanic_vtpro_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model) { oceanic_vtpro_parser_t *parser = NULL; diff --git a/src/parser.c b/src/parser.c index 1b1e314..98d2c89 100644 --- a/src/parser.c +++ b/src/parser.c @@ -110,7 +110,7 @@ dc_parser_new_internal (dc_parser_t **out, dc_context_t *context, dc_family_t fa rc = reefnet_sensusultra_parser_create (&parser, context, devtime, systime); break; case DC_FAMILY_OCEANIC_VTPRO: - rc = oceanic_vtpro_parser_create2 (&parser, context, model); + rc = oceanic_vtpro_parser_create (&parser, context, model); break; case DC_FAMILY_OCEANIC_VEO250: rc = oceanic_veo250_parser_create (&parser, context, model); @@ -143,7 +143,7 @@ dc_parser_new_internal (dc_parser_t **out, dc_context_t *context, dc_family_t fa rc = cressi_edy_parser_create (&parser, context, model); break; case DC_FAMILY_CRESSI_LEONARDO: - rc = cressi_leonardo_parser_create2 (&parser, context, model); + rc = cressi_leonardo_parser_create (&parser, context, model); break; case DC_FAMILY_ATOMICS_COBALT: rc = atomics_cobalt_parser_create (&parser, context); @@ -161,7 +161,7 @@ dc_parser_new_internal (dc_parser_t **out, dc_context_t *context, dc_family_t fa rc = citizen_aqualand_parser_create (&parser, context); break; case DC_FAMILY_DIVESYSTEM_IDIVE: - rc = divesystem_idive_parser_create2 (&parser, context, model); + rc = divesystem_idive_parser_create (&parser, context, model); break; case DC_FAMILY_COCHRAN_COMMANDER: rc = cochran_commander_parser_create (&parser, context, model); From 468418193b5cfd17909244a2d36ca1a4cb217f66 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 19 Apr 2017 08:44:27 +0200 Subject: [PATCH 6/8] Cleanup the extract dives functions After being removed from the public api, these functions can be changed into local, static functions. And in a few cases, they are no longer necessary and can be removed completely. --- src/cressi_leonardo.c | 5 ++++- src/cressi_leonardo.h | 3 --- src/diverite_nitekq.c | 4 +++- src/diverite_nitekq.h | 3 --- src/hw_ostc.c | 4 +++- src/hw_ostc.h | 3 --- src/mares_darwin.c | 4 +++- src/mares_darwin.h | 3 --- src/mares_nemo.c | 32 +++++++------------------------- src/mares_nemo.h | 3 --- src/mares_puck.c | 38 -------------------------------------- src/mares_puck.h | 3 --- src/reefnet_sensus.c | 4 +++- src/reefnet_sensus.h | 3 --- src/reefnet_sensuspro.c | 4 +++- src/reefnet_sensuspro.h | 3 --- src/reefnet_sensusultra.c | 15 --------------- src/reefnet_sensusultra.h | 3 --- src/shearwater_predator.c | 4 +++- src/shearwater_predator.h | 3 --- src/suunto_eon.c | 20 +++----------------- src/suunto_eon.h | 3 --- src/suunto_solution.c | 4 +++- src/suunto_solution.h | 3 --- src/suunto_vyper.c | 29 ----------------------------- src/suunto_vyper.h | 6 ------ src/uwatec_aladin.c | 4 +++- src/uwatec_aladin.h | 3 --- src/uwatec_memomouse.c | 4 +++- src/uwatec_memomouse.h | 3 --- src/uwatec_meridian.c | 4 +++- src/uwatec_meridian.h | 3 --- src/uwatec_smart.c | 4 +++- src/uwatec_smart.h | 3 --- 34 files changed, 47 insertions(+), 190 deletions(-) diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index ea3966d..5c1dd29 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -70,6 +70,9 @@ static const dc_device_vtable_t cressi_leonardo_device_vtable = { cressi_leonardo_device_close /* close */ }; +static dc_status_t +cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); + static void cressi_leonardo_make_ascii (const unsigned char raw[], unsigned int rsize, unsigned char ascii[], unsigned int asize) { @@ -433,7 +436,7 @@ cressi_leonardo_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba return rc; } -dc_status_t +static dc_status_t cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { cressi_leonardo_device_t *device = (cressi_leonardo_device_t *) abstract; diff --git a/src/cressi_leonardo.h b/src/cressi_leonardo.h index 043cd5f..c17b41b 100644 --- a/src/cressi_leonardo.h +++ b/src/cressi_leonardo.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t cressi_leonardo_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t cressi_leonardo_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); diff --git a/src/diverite_nitekq.c b/src/diverite_nitekq.c index 8493153..205115a 100644 --- a/src/diverite_nitekq.c +++ b/src/diverite_nitekq.c @@ -72,6 +72,8 @@ static const dc_device_vtable_t diverite_nitekq_device_vtable = { diverite_nitekq_device_close /* close */ }; +static dc_status_t +diverite_nitekq_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); static dc_status_t diverite_nitekq_send (diverite_nitekq_device_t *device, unsigned char cmd) @@ -352,7 +354,7 @@ diverite_nitekq_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba } -dc_status_t +static dc_status_t diverite_nitekq_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { diverite_nitekq_device_t *device = (diverite_nitekq_device_t *) abstract; diff --git a/src/diverite_nitekq.h b/src/diverite_nitekq.h index fd1fa6b..c8987e2 100644 --- a/src/diverite_nitekq.h +++ b/src/diverite_nitekq.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t diverite_nitekq_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -diverite_nitekq_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t diverite_nitekq_parser_create (dc_parser_t **parser, dc_context_t *context); diff --git a/src/hw_ostc.c b/src/hw_ostc.c index ce30415..3f46603 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -83,6 +83,8 @@ static const dc_device_vtable_t hw_ostc_device_vtable = { hw_ostc_device_close /* close */ }; +static dc_status_t +hw_ostc_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); static dc_status_t hw_ostc_send (hw_ostc_device_t *device, unsigned char cmd, unsigned int echo) @@ -632,7 +634,7 @@ hw_ostc_device_screenshot (dc_device_t *abstract, dc_buffer_t *buffer, hw_ostc_f } -dc_status_t +static dc_status_t hw_ostc_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { hw_ostc_device_t *device = (hw_ostc_device_t *) abstract; diff --git a/src/hw_ostc.h b/src/hw_ostc.h index b7f7aa8..3f54a7b 100644 --- a/src/hw_ostc.h +++ b/src/hw_ostc.h @@ -34,9 +34,6 @@ extern "C" { dc_status_t hw_ostc_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -hw_ostc_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t hw_ostc_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int hwos); diff --git a/src/mares_darwin.c b/src/mares_darwin.c index 3922c75..9ac56ba 100644 --- a/src/mares_darwin.c +++ b/src/mares_darwin.c @@ -93,6 +93,8 @@ static const mares_darwin_layout_t mares_darwinair_layout = { 3 /* samplesize */ }; +static dc_status_t +mares_darwin_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t mares_darwin_device_open (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) @@ -262,7 +264,7 @@ mares_darwin_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, } -dc_status_t +static dc_status_t mares_darwin_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { mares_darwin_device_t *device = (mares_darwin_device_t *) abstract; diff --git a/src/mares_darwin.h b/src/mares_darwin.h index 3df4578..e7767ec 100644 --- a/src/mares_darwin.h +++ b/src/mares_darwin.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t mares_darwin_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); -dc_status_t -mares_darwin_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t mares_darwin_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); diff --git a/src/mares_nemo.c b/src/mares_nemo.c index dc6b480..2ec3588 100644 --- a/src/mares_nemo.c +++ b/src/mares_nemo.c @@ -282,6 +282,8 @@ mares_nemo_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) static dc_status_t mares_nemo_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void *userdata) { + mares_nemo_device_t *device = (mares_nemo_device_t *) abstract; + dc_buffer_t *buffer = dc_buffer_new (MEMORYSIZE); if (buffer == NULL) return DC_STATUS_NOMEMORY; @@ -300,28 +302,6 @@ mares_nemo_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v devinfo.serial = array_uint16_be (data + 8); device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); - rc = mares_nemo_extract_dives (abstract, data, MEMORYSIZE, callback, userdata); - - dc_buffer_free (buffer); - - return rc; -} - - -dc_status_t -mares_nemo_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) -{ - mares_nemo_device_t *device = (mares_nemo_device_t*) abstract; - - if (abstract && !ISINSTANCE (abstract)) - return DC_STATUS_INVALIDARGS; - - if (size < PACKETSIZE) - return DC_STATUS_DATAFORMAT; - - dc_context_t *context = (abstract ? abstract->context : NULL); - unsigned char *fingerprint = (device ? device->fingerprint : NULL); - const mares_common_layout_t *layout = NULL; switch (data[1]) { case NEMO: @@ -332,12 +312,14 @@ mares_nemo_extract_dives (dc_device_t *abstract, const unsigned char data[], uns layout = &mares_nemo_apneist_layout; break; default: // Unknown, try nemo + WARNING (abstract->context, "Unsupported model %02x detected!", data[1]); layout = &mares_nemo_layout; break; } - if (size < layout->memsize) - return DC_STATUS_DATAFORMAT; + rc = mares_common_extract_dives (abstract->context, layout, device->fingerprint, data, callback, userdata); - return mares_common_extract_dives (context, layout, fingerprint, data, callback, userdata); + dc_buffer_free (buffer); + + return rc; } diff --git a/src/mares_nemo.h b/src/mares_nemo.h index 176070e..e25489b 100644 --- a/src/mares_nemo.h +++ b/src/mares_nemo.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t mares_nemo_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -mares_nemo_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t mares_nemo_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); diff --git a/src/mares_puck.c b/src/mares_puck.c index 0a75666..fc8e00d 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -266,41 +266,3 @@ mares_puck_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v return rc; } - - -dc_status_t -mares_puck_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) -{ - mares_puck_device_t *device = (mares_puck_device_t*) abstract; - - if (abstract && !ISINSTANCE (abstract)) - return DC_STATUS_INVALIDARGS; - - if (size < PACKETSIZE) - return DC_STATUS_DATAFORMAT; - - dc_context_t *context = (abstract ? abstract->context : NULL); - unsigned char *fingerprint = (device ? device->fingerprint : NULL); - - const mares_common_layout_t *layout = NULL; - switch (data[1]) { - case NEMOWIDE: - layout = &mares_nemowide_layout; - break; - case NEMOAIR: - case PUCKAIR: - layout = &mares_nemoair_layout; - break; - case PUCK: - layout = &mares_puck_layout; - break; - default: // Unknown, try puck - layout = &mares_puck_layout; - break; - } - - if (size < layout->memsize) - return DC_STATUS_DATAFORMAT; - - return mares_common_extract_dives (context, layout, fingerprint, data, callback, userdata); -} diff --git a/src/mares_puck.h b/src/mares_puck.h index eba37c0..01447d1 100644 --- a/src/mares_puck.h +++ b/src/mares_puck.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t mares_puck_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -mares_puck_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index b20047a..94d7a7e 100644 --- a/src/reefnet_sensus.c +++ b/src/reefnet_sensus.c @@ -60,6 +60,8 @@ static const dc_device_vtable_t reefnet_sensus_device_vtable = { reefnet_sensus_device_close /* close */ }; +static dc_status_t +reefnet_sensus_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); static dc_status_t reefnet_sensus_cancel (reefnet_sensus_device_t *device) @@ -368,7 +370,7 @@ reefnet_sensus_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac } -dc_status_t +static dc_status_t reefnet_sensus_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { reefnet_sensus_device_t *device = (reefnet_sensus_device_t*) abstract; diff --git a/src/reefnet_sensus.h b/src/reefnet_sensus.h index fda47d0..2ca6d43 100644 --- a/src/reefnet_sensus.h +++ b/src/reefnet_sensus.h @@ -34,9 +34,6 @@ extern "C" { dc_status_t reefnet_sensus_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -reefnet_sensus_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t reefnet_sensus_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index c0802de..bf88801 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -59,6 +59,8 @@ static const dc_device_vtable_t reefnet_sensuspro_device_vtable = { reefnet_sensuspro_device_close /* close */ }; +static dc_status_t +reefnet_sensuspro_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t reefnet_sensuspro_device_open (dc_device_t **out, dc_context_t *context, const char *name) @@ -361,7 +363,7 @@ reefnet_sensuspro_device_write_interval (dc_device_t *abstract, unsigned char in } -dc_status_t +static dc_status_t reefnet_sensuspro_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { reefnet_sensuspro_device_t *device = (reefnet_sensuspro_device_t*) abstract; diff --git a/src/reefnet_sensuspro.h b/src/reefnet_sensuspro.h index 91d80b8..000959a 100644 --- a/src/reefnet_sensuspro.h +++ b/src/reefnet_sensuspro.h @@ -34,9 +34,6 @@ extern "C" { dc_status_t reefnet_sensuspro_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -reefnet_sensuspro_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t reefnet_sensuspro_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index 4fa8187..f28dbb2 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -749,18 +749,3 @@ reefnet_sensusultra_device_foreach (dc_device_t *abstract, dc_dive_callback_t ca return DC_STATUS_SUCCESS; } - - -dc_status_t -reefnet_sensusultra_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) -{ - reefnet_sensusultra_device_t *device = (reefnet_sensusultra_device_t *) abstract; - - if (abstract && !ISINSTANCE (abstract)) - return DC_STATUS_INVALIDARGS; - - unsigned int remaining = size; - unsigned int previous = size; - - return reefnet_sensusultra_parse (device, data, &remaining, &previous, NULL, callback, userdata); -} diff --git a/src/reefnet_sensusultra.h b/src/reefnet_sensusultra.h index a1d21be..84fcaea 100644 --- a/src/reefnet_sensusultra.h +++ b/src/reefnet_sensusultra.h @@ -34,9 +34,6 @@ extern "C" { dc_status_t reefnet_sensusultra_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -reefnet_sensusultra_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t reefnet_sensusultra_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); diff --git a/src/shearwater_predator.c b/src/shearwater_predator.c index efb5eb4..0e7a0d3 100644 --- a/src/shearwater_predator.c +++ b/src/shearwater_predator.c @@ -60,6 +60,8 @@ static const dc_device_vtable_t shearwater_predator_device_vtable = { shearwater_predator_device_close /* close */ }; +static dc_status_t +shearwater_predator_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t shearwater_predator_device_open (dc_device_t **out, dc_context_t *context, const char *name) @@ -337,7 +339,7 @@ shearwater_predator_extract_petrel (dc_device_t *abstract, const unsigned char d } -dc_status_t +static dc_status_t shearwater_predator_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { if (abstract && !ISINSTANCE (abstract)) diff --git a/src/shearwater_predator.h b/src/shearwater_predator.h index 4e3f5ae..f21d445 100644 --- a/src/shearwater_predator.h +++ b/src/shearwater_predator.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t shearwater_predator_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -shearwater_predator_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t shearwater_predator_parser_create (dc_parser_t **parser, dc_context_t *context); diff --git a/src/suunto_eon.c b/src/suunto_eon.c index 30b95bf..ce9ce83 100644 --- a/src/suunto_eon.c +++ b/src/suunto_eon.c @@ -216,6 +216,8 @@ suunto_eon_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) static dc_status_t suunto_eon_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void *userdata) { + suunto_common_device_t *device = (suunto_common_device_t *) abstract; + dc_buffer_t *buffer = dc_buffer_new (SZ_MEMORY); if (buffer == NULL) return DC_STATUS_NOMEMORY; @@ -238,8 +240,7 @@ suunto_eon_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v } device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); - rc = suunto_eon_extract_dives (abstract, - dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), callback, userdata); + rc = suunto_common_extract_dives (device, &suunto_eon_layout, data, callback, userdata); dc_buffer_free (buffer); @@ -291,18 +292,3 @@ suunto_eon_device_write_interval (dc_device_t *abstract, unsigned char interval) return DC_STATUS_SUCCESS; } - - -dc_status_t -suunto_eon_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) -{ - suunto_common_device_t *device = (suunto_common_device_t*) abstract; - - if (abstract && !ISINSTANCE (abstract)) - return DC_STATUS_INVALIDARGS; - - if (size < SZ_MEMORY) - return DC_STATUS_DATAFORMAT; - - return suunto_common_extract_dives (device, &suunto_eon_layout, data, callback, userdata); -} diff --git a/src/suunto_eon.h b/src/suunto_eon.h index 19b32a2..2adce91 100644 --- a/src/suunto_eon.h +++ b/src/suunto_eon.h @@ -34,9 +34,6 @@ extern "C" { dc_status_t suunto_eon_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -suunto_eon_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t suunto_eon_parser_create (dc_parser_t **parser, dc_context_t *context, int spyder); diff --git a/src/suunto_solution.c b/src/suunto_solution.c index d5ea802..c708114 100644 --- a/src/suunto_solution.c +++ b/src/suunto_solution.c @@ -57,6 +57,8 @@ static const dc_device_vtable_t suunto_solution_device_vtable = { suunto_solution_device_close /* close */ }; +static dc_status_t +suunto_solution_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t suunto_solution_device_open (dc_device_t **out, dc_context_t *context, const char *name) @@ -281,7 +283,7 @@ suunto_solution_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba } -dc_status_t +static dc_status_t suunto_solution_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { if (abstract && !ISINSTANCE (abstract)) diff --git a/src/suunto_solution.h b/src/suunto_solution.h index 386ecbc..e322583 100644 --- a/src/suunto_solution.h +++ b/src/suunto_solution.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t suunto_solution_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -suunto_solution_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t suunto_solution_parser_create (dc_parser_t **parser, dc_context_t *context); diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index 45ca47a..ce44e05 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -442,16 +442,6 @@ suunto_vyper_read_dive (dc_device_t *abstract, dc_buffer_t *buffer, int init, dc } -dc_status_t -suunto_vyper_device_read_dive (dc_device_t *abstract, dc_buffer_t *buffer, int init) -{ - if (!ISINSTANCE (abstract)) - return DC_STATUS_INVALIDARGS; - - return suunto_vyper_read_dive (abstract, buffer, init, NULL); -} - - static dc_status_t suunto_vyper_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) { @@ -553,22 +543,3 @@ suunto_vyper_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, return rc; } - - -dc_status_t -suunto_vyper_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) -{ - suunto_common_device_t *device = (suunto_common_device_t*) abstract; - - if (abstract && !ISINSTANCE (abstract)) - return DC_STATUS_INVALIDARGS; - - if (size < SZ_MEMORY) - return DC_STATUS_DATAFORMAT; - - const suunto_common_layout_t *layout = &suunto_vyper_layout; - if (data[HDR_DEVINFO_VYPER] == 20 || data[HDR_DEVINFO_VYPER] == 30 || data[HDR_DEVINFO_VYPER] == 60) - layout = &suunto_spyder_layout; - - return suunto_common_extract_dives (device, layout, data, callback, userdata); -} diff --git a/src/suunto_vyper.h b/src/suunto_vyper.h index 9de188a..95f1a4a 100644 --- a/src/suunto_vyper.h +++ b/src/suunto_vyper.h @@ -33,12 +33,6 @@ extern "C" { dc_status_t suunto_vyper_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -suunto_vyper_device_read_dive (dc_device_t *device, dc_buffer_t *buffer, int init); - -dc_status_t -suunto_vyper_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t suunto_vyper_parser_create (dc_parser_t **parser, dc_context_t *context); diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index e587d03..d70369a 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -65,6 +65,8 @@ static const dc_device_vtable_t uwatec_aladin_device_vtable = { uwatec_aladin_device_close /* close */ }; +static dc_status_t +uwatec_aladin_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t uwatec_aladin_device_open (dc_device_t **out, dc_context_t *context, const char *name) @@ -282,7 +284,7 @@ uwatec_aladin_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback } -dc_status_t +static dc_status_t uwatec_aladin_extract_dives (dc_device_t *abstract, const unsigned char* data, unsigned int size, dc_dive_callback_t callback, void *userdata) { uwatec_aladin_device_t *device = (uwatec_aladin_device_t*) abstract; diff --git a/src/uwatec_aladin.h b/src/uwatec_aladin.h index f8badf7..41484f6 100644 --- a/src/uwatec_aladin.h +++ b/src/uwatec_aladin.h @@ -32,9 +32,6 @@ extern "C" { dc_status_t uwatec_aladin_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -uwatec_aladin_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/uwatec_memomouse.c b/src/uwatec_memomouse.c index 68b4dbf..b23c6b2 100644 --- a/src/uwatec_memomouse.c +++ b/src/uwatec_memomouse.c @@ -61,6 +61,8 @@ static const dc_device_vtable_t uwatec_memomouse_device_vtable = { uwatec_memomouse_device_close /* close */ }; +static dc_status_t +uwatec_memomouse_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t uwatec_memomouse_device_open (dc_device_t **out, dc_context_t *context, const char *name) @@ -500,7 +502,7 @@ uwatec_memomouse_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb } -dc_status_t +static dc_status_t uwatec_memomouse_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { if (abstract && !ISINSTANCE (abstract)) diff --git a/src/uwatec_memomouse.h b/src/uwatec_memomouse.h index 9e64975..8d37dc6 100644 --- a/src/uwatec_memomouse.h +++ b/src/uwatec_memomouse.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t uwatec_memomouse_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -uwatec_memomouse_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t uwatec_memomouse_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int devtime, dc_ticks_t systime); diff --git a/src/uwatec_meridian.c b/src/uwatec_meridian.c index 2e1287b..077ec31 100644 --- a/src/uwatec_meridian.c +++ b/src/uwatec_meridian.c @@ -59,6 +59,8 @@ static const dc_device_vtable_t uwatec_meridian_device_vtable = { uwatec_meridian_device_close /* close */ }; +static dc_status_t +uwatec_meridian_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); static dc_status_t uwatec_meridian_transfer (uwatec_meridian_device_t *device, const unsigned char command[], unsigned int csize, unsigned char answer[], unsigned int asize) @@ -462,7 +464,7 @@ uwatec_meridian_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba } -dc_status_t +static dc_status_t uwatec_meridian_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { if (abstract && !ISINSTANCE (abstract)) diff --git a/src/uwatec_meridian.h b/src/uwatec_meridian.h index e99bcfa..9c6918c 100644 --- a/src/uwatec_meridian.h +++ b/src/uwatec_meridian.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t uwatec_meridian_device_open (dc_device_t **device, dc_context_t *context, const char *name); -dc_status_t -uwatec_meridian_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index be92b74..2b94a3b 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -55,6 +55,8 @@ static const dc_device_vtable_t uwatec_smart_device_vtable = { uwatec_smart_device_close /* close */ }; +static dc_status_t +uwatec_smart_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); static void uwatec_smart_discovery (unsigned int address, const char *name, unsigned int charset, unsigned int hints, void *userdata) @@ -402,7 +404,7 @@ uwatec_smart_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, } -dc_status_t +static dc_status_t uwatec_smart_extract_dives (dc_device_t *abstract, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata) { if (abstract && !ISINSTANCE (abstract)) diff --git a/src/uwatec_smart.h b/src/uwatec_smart.h index 56c3e1a..5304c73 100644 --- a/src/uwatec_smart.h +++ b/src/uwatec_smart.h @@ -33,9 +33,6 @@ extern "C" { dc_status_t uwatec_smart_device_open (dc_device_t **device, dc_context_t *context); -dc_status_t -uwatec_smart_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); - dc_status_t uwatec_smart_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model, unsigned int devtime, dc_ticks_t systime); From bdf69ce1ecf9f8c7d1d7a39274dc66af982422b9 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 21 Apr 2017 22:27:21 +0200 Subject: [PATCH 7/8] Remove unused parameters --- src/device.c | 4 ++-- src/mares_iconhd.c | 2 +- src/mares_iconhd.h | 2 +- src/suunto_eonsteel.c | 2 +- src/suunto_eonsteel.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/device.c b/src/device.c index 2fbcc30..2f3e1af 100644 --- a/src/device.c +++ b/src/device.c @@ -124,7 +124,7 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr rc = suunto_d9_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_SUUNTO_EONSTEEL: - rc = suunto_eonsteel_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); + rc = suunto_eonsteel_device_open (&device, context); break; case DC_FAMILY_UWATEC_ALADIN: rc = uwatec_aladin_device_open (&device, context, name); @@ -166,7 +166,7 @@ dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descr rc = mares_darwin_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_MARES_ICONHD: - rc = mares_iconhd_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); + rc = mares_iconhd_device_open (&device, context, name); break; case DC_FAMILY_HW_OSTC: rc = hw_ostc_device_open (&device, context, name); diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index c78acf7..9a2179c 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -209,7 +209,7 @@ mares_iconhd_transfer (mares_iconhd_device_t *device, dc_status_t -mares_iconhd_device_open (dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) +mares_iconhd_device_open (dc_device_t **out, dc_context_t *context, const char *name) { dc_status_t status = DC_STATUS_SUCCESS; mares_iconhd_device_t *device = NULL; diff --git a/src/mares_iconhd.h b/src/mares_iconhd.h index bd4b193..b762843 100644 --- a/src/mares_iconhd.h +++ b/src/mares_iconhd.h @@ -31,7 +31,7 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -mares_iconhd_device_open (dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); +mares_iconhd_device_open (dc_device_t **device, dc_context_t *context, const char *name); dc_status_t mares_iconhd_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model); diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 58197ac..615f5c7 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -547,7 +547,7 @@ static int initialize_eonsteel(suunto_eonsteel_device_t *eon) } dc_status_t -suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, const char *name, unsigned int model) +suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context) { dc_status_t status = DC_STATUS_SUCCESS; suunto_eonsteel_device_t *eon = NULL; diff --git a/src/suunto_eonsteel.h b/src/suunto_eonsteel.h index 4d34478..98763c9 100644 --- a/src/suunto_eonsteel.h +++ b/src/suunto_eonsteel.h @@ -31,7 +31,7 @@ extern "C" { #endif /* __cplusplus */ dc_status_t -suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context, const char *name, unsigned int model); +suunto_eonsteel_device_open(dc_device_t **device, dc_context_t *context); dc_status_t suunto_eonsteel_parser_create(dc_parser_t **parser, dc_context_t *context, unsigned int model); From 44f629f03a91a3b3a94e561e85c2d951861d6f69 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Sat, 29 Apr 2017 08:15:35 +0200 Subject: [PATCH 8/8] OSTC3: set initial setpoint in profile data In CCR fixed setpoint mode of the OSTC3, the initial setpoint at the start of the dive was not set. This fix adds the initial setpoint based on the data in the fixed setpoint table (ie, the first fixed setpoint is the initial one). Signed-off-by: Jan Mulder --- src/hw_ostc_parser.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index b9f947b..b23e6d3 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -97,6 +97,7 @@ typedef struct hw_ostc_parser_t { unsigned int ngasmixes; unsigned int nfixed; unsigned int initial; + unsigned int initial_setpoint; hw_ostc_gasmix_t gasmix[NGASMIXES]; } hw_ostc_parser_t; @@ -220,8 +221,10 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser) return DC_STATUS_DATAFORMAT; } - // Get all the gas mixes, and the index of the inital mix. + // Get all the gas mixes, the index of the inital mix, + // and the initial setpoint (used in the fixed setpoint mode). unsigned int initial = UNDEFINED; + unsigned int initial_setpoint = UNDEFINED; unsigned int ngasmixes = 0; hw_ostc_gasmix_t gasmix[NGASMIXES] = {{0}}; if (version == 0x22) { @@ -241,6 +244,10 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser) initial = i + 1; /* One based index! */ } } + // The first fixed setpoint is the initial setpoint in CCR mode. + if (data[82] == OSTC3_CC) { + initial_setpoint = data[60]; + } } else { ngasmixes = 5; initial = data[31]; @@ -266,6 +273,7 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser) parser->ngasmixes = ngasmixes; parser->nfixed = ngasmixes; parser->initial = initial; + parser->initial_setpoint = initial_setpoint; for (unsigned int i = 0; i < ngasmixes; ++i) { parser->gasmix[i] = gasmix[i]; } @@ -299,6 +307,7 @@ hw_ostc_parser_create_internal (dc_parser_t **out, dc_context_t *context, unsign parser->ngasmixes = 0; parser->nfixed = 0; parser->initial = 0; + parser->initial_setpoint = 0; for (unsigned int i = 0; i < NGASMIXES; ++i) { parser->gasmix[i].oxygen = 0; parser->gasmix[i].helium = 0; @@ -335,6 +344,7 @@ hw_ostc_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsig parser->ngasmixes = 0; parser->nfixed = 0; parser->initial = 0; + parser->initial_setpoint = 0; for (unsigned int i = 0; i < NGASMIXES; ++i) { parser->gasmix[i].oxygen = 0; parser->gasmix[i].helium = 0; @@ -640,6 +650,12 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata); } + // Initial setpoint (mbar). + if (time == samplerate && parser->initial_setpoint != UNDEFINED) { + sample.setpoint = parser->initial_setpoint / 100.0; + if (callback) callback (DC_SAMPLE_SETPOINT, sample, userdata); + } + // Depth (mbar). unsigned int depth = array_uint16_le (data + offset); sample.depth = (depth * BAR / 1000.0) / hydrostatic;