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" diff --git a/include/libdivecomputer/Makefile.am b/include/libdivecomputer/Makefile.am index ad06441..6ba4bd7 100644 --- a/include/libdivecomputer/Makefile.am +++ b/include/libdivecomputer/Makefile.am @@ -11,50 +11,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 7a4cfe3..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 serial, 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 1011f06..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 serial, unsigned int model); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* HW_OSTC3_H */ +#endif /* DC_HW_OSTC3_H */ diff --git a/include/libdivecomputer/oceanic_atom2.h b/include/libdivecomputer/oceanic_atom2.h index 194c84b..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, unsigned int serial); - #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 1fb1824..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, unsigned int serial); - #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 3de0160..76b9531 100644 --- a/src/atomics_cobalt_parser.c +++ b/src/atomics_cobalt_parser.c @@ -27,9 +27,9 @@ #define snprintf _snprintf #endif -#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..5c1dd29 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" @@ -71,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) { @@ -434,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/include/libdivecomputer/cressi_leonardo.h b/src/cressi_leonardo.h similarity index 77% rename from include/libdivecomputer/cressi_leonardo.h rename to src/cressi_leonardo.h index 23e4554..c17b41b 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" { @@ -34,13 +34,7 @@ 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); - -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 54ffbb4..6032376 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" @@ -57,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; @@ -79,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/descriptor.c b/src/descriptor.c index 8893443..b59ea45 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -113,6 +113,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}, diff --git a/src/device.c b/src/device.c index f94adf2..2f3e1af 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" @@ -105,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); @@ -129,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); @@ -147,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); @@ -183,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/diverite_nitekq.c b/src/diverite_nitekq.c index 1565779..205115a 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" @@ -73,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) @@ -353,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/include/libdivecomputer/diverite_nitekq.h b/src/diverite_nitekq.h similarity index 84% rename from include/libdivecomputer/diverite_nitekq.h rename to src/diverite_nitekq.h index d7dd5e8..c8987e2 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" { @@ -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/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..d8c02e8 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" @@ -97,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/include/libdivecomputer/divesystem_idive.h b/src/divesystem_idive.h similarity index 77% rename from include/libdivecomputer/divesystem_idive.h rename to src/divesystem_idive.h index 4a9d817..20ed729 100644 --- a/include/libdivecomputer/divesystem_idive.h +++ b/src/divesystem_idive.h @@ -22,25 +22,19 @@ #ifndef DIVESYSTEM_IDIVE_H #define DIVESYSTEM_IDIVE_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus 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 262d192..968765c 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" @@ -83,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/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..3f46603 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" @@ -84,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) @@ -633,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/include/libdivecomputer/hw.h b/src/hw_ostc.h similarity index 60% rename from include/libdivecomputer/hw.h rename to src/hw_ostc.h index 2ac6e29..9425a9b 100644 --- a/include/libdivecomputer/hw.h +++ b/src/hw_ostc.h @@ -19,11 +19,25 @@ * 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_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int serial, 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 60% rename from include/libdivecomputer/diverite.h rename to src/hw_ostc3.h index 9bf6bf6..b768ee1 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 serial, 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 55ce9d6..3235e19 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -27,10 +27,10 @@ #define snprintf _snprintf #endif -#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" @@ -115,6 +115,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; @@ -253,8 +254,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) { @@ -274,6 +277,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]; @@ -299,6 +306,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]; } @@ -332,6 +340,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; @@ -369,6 +378,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; @@ -743,6 +753,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; diff --git a/src/libdivecomputer.symbols b/src/libdivecomputer.symbols index a3e752f..ef89623 100644 --- a/src/libdivecomputer.symbols +++ b/src/libdivecomputer.symbols @@ -43,40 +43,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 @@ -89,79 +59,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 @@ -171,16 +99,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..9ac56ba 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) @@ -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/include/libdivecomputer/mares_darwin.h b/src/mares_darwin.h similarity index 84% rename from include/libdivecomputer/mares_darwin.h rename to src/mares_darwin.h index 9d4da9a..e7767ec 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" { @@ -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_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..9a2179c 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" @@ -210,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/include/libdivecomputer/mares_iconhd.h b/src/mares_iconhd.h similarity index 89% rename from include/libdivecomputer/mares_iconhd.h rename to src/mares_iconhd.h index ce0c8c6..b762843 100644 --- a/include/libdivecomputer/mares_iconhd.h +++ b/src/mares_iconhd.h @@ -22,16 +22,16 @@ #ifndef MARES_ICONHD_H #define MARES_ICONHD_H -#include "context.h" -#include "device.h" -#include "parser.h" +#include +#include +#include #ifdef __cplusplus 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/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..2ec3588 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" @@ -283,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; @@ -301,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: @@ -333,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/include/libdivecomputer/mares_nemo.h b/src/mares_nemo.h similarity index 84% rename from include/libdivecomputer/mares_nemo.h rename to src/mares_nemo.h index 4ced926..e25489b 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" { @@ -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_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..fc8e00d 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" @@ -267,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/include/libdivecomputer/mares_puck.h b/src/mares_puck.h similarity index 83% rename from include/libdivecomputer/mares_puck.h rename to src/mares_puck.h index 6706474..01447d1 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" { @@ -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/oceanic_atom2.c b/src/oceanic_atom2.c index 34cc592..cccfc4e 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" @@ -556,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 new file mode 100644 index 0000000..1558e41 --- /dev/null +++ b/src/oceanic_atom2.h @@ -0,0 +1,44 @@ +/* + * 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, unsigned int model); + +dc_status_t +oceanic_atom2_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int model, unsigned int serial); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* OCEANIC_ATOM2_H */ diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 79060ab..4a27978 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -23,9 +23,9 @@ #include #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/reefnet.h b/src/oceanic_veo250.h similarity index 59% rename from include/libdivecomputer/reefnet.h rename to src/oceanic_veo250.h index ad3fb36..aefd20e 100644 --- a/include/libdivecomputer/reefnet.h +++ b/src/oceanic_veo250.h @@ -19,11 +19,26 @@ * MA 02110-1301 USA */ -#ifndef REEFNET_H -#define REEFNET_H +#ifndef OCEANIC_VEO250_H +#define OCEANIC_VEO250_H -#include "reefnet_sensus.h" -#include "reefnet_sensuspro.h" -#include "reefnet_sensusultra.h" +#include +#include +#include -#endif /* REEFNET_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..2e86f5f 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" @@ -385,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 new file mode 100644 index 0000000..9689818 --- /dev/null +++ b/src/oceanic_vtpro.h @@ -0,0 +1,44 @@ +/* + * 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, unsigned int model); + +dc_status_t +oceanic_vtpro_parser_create (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..9c85854 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" @@ -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 592ff06..57ed568 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" @@ -90,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); @@ -123,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); @@ -141,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); diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index 09c5266..94d7a7e 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" @@ -61,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) @@ -369,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 new file mode 100644 index 0000000..2ca6d43 --- /dev/null +++ b/src/reefnet_sensus.h @@ -0,0 +1,43 @@ +/* + * 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_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..bf88801 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" @@ -60,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) @@ -362,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 new file mode 100644 index 0000000..000959a --- /dev/null +++ b/src/reefnet_sensuspro.h @@ -0,0 +1,43 @@ +/* + * 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_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..f28dbb2 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" @@ -750,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 new file mode 100644 index 0000000..84fcaea --- /dev/null +++ b/src/reefnet_sensusultra.h @@ -0,0 +1,43 @@ +/* + * 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_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 18a4bce..4d70755 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 7975b8f..0e7a0d3 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" @@ -62,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) @@ -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); @@ -339,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/include/libdivecomputer/shearwater_predator.h b/src/shearwater_predator.h similarity index 84% rename from include/libdivecomputer/shearwater_predator.h rename to src/shearwater_predator.h index 28163e2..5485477 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" { @@ -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, unsigned int serial); diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index 8d5b71d..1e42d87 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -27,10 +27,10 @@ #define snprintf _snprintf #endif -#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/suunto.h b/src/suunto_d9.h similarity index 59% rename from include/libdivecomputer/suunto.h rename to src/suunto_d9.h index 3ff7c88..9a255cd 100644 --- a/include/libdivecomputer/suunto.h +++ b/src/suunto_d9.h @@ -19,14 +19,25 @@ * MA 02110-1301 USA */ -#ifndef SUUNTO_H -#define SUUNTO_H +#ifndef SUUNTO_D9_H +#define SUUNTO_D9_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 +#include -#endif /* SUUNTO_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, unsigned int serial); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* SUUNTO_D9_H */ diff --git a/src/suunto_d9_parser.c b/src/suunto_d9_parser.c index 88e4aac..deb3ec1 100644 --- a/src/suunto_d9_parser.c +++ b/src/suunto_d9_parser.c @@ -23,8 +23,7 @@ #include // memcmp, strdup #include // snprintf -#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..ce9ce83 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" @@ -217,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; @@ -239,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); @@ -292,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/include/libdivecomputer/oceanic.h b/src/suunto_eon.h similarity index 60% rename from include/libdivecomputer/oceanic.h rename to src/suunto_eon.h index f889120..2adce91 100644 --- a/include/libdivecomputer/oceanic.h +++ b/src/suunto_eon.h @@ -19,11 +19,25 @@ * MA 02110-1301 USA */ -#ifndef OCEANIC_H -#define OCEANIC_H +#ifndef SUUNTO_EON_H +#define SUUNTO_EON_H -#include "oceanic_atom2.h" -#include "oceanic_veo250.h" -#include "oceanic_vtpro.h" +#include +#include +#include +#include -#endif /* OCEANIC_H */ +#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_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 fe88c6f..7f454d0 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" @@ -549,7 +548,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/include/libdivecomputer/suunto_eonsteel.h b/src/suunto_eonsteel.h similarity index 76% rename from include/libdivecomputer/suunto_eonsteel.h rename to src/suunto_eonsteel.h index 68e2986..98763c9 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); + +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 5989060..fefaad2 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -32,8 +32,7 @@ #define vsnprintf _vsnprintf #endif -#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..c708114 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" @@ -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/include/libdivecomputer/suunto_solution.h b/src/suunto_solution.h similarity index 84% rename from include/libdivecomputer/suunto_solution.h rename to src/suunto_solution.h index 619eb88..e322583 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" { @@ -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_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..ce44e05 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" @@ -443,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) { @@ -554,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/include/libdivecomputer/suunto_vyper.h b/src/suunto_vyper.h similarity index 79% rename from include/libdivecomputer/suunto_vyper.h rename to src/suunto_vyper.h index a730b95..95f1a4a 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" { @@ -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/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/mares.h b/src/suunto_vyper2.h similarity index 66% rename from include/libdivecomputer/mares.h rename to src/suunto_vyper2.h index c7af850..b6486d9 100644 --- a/include/libdivecomputer/mares.h +++ b/src/suunto_vyper2.h @@ -19,12 +19,21 @@ * MA 02110-1301 USA */ -#ifndef MARES_H -#define MARES_H +#ifndef SUUNTO_VYPER2_H +#define SUUNTO_VYPER2_H -#include "mares_nemo.h" -#include "mares_puck.h" -#include "mares_darwin.h" -#include "mares_iconhd.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ -#endif /* MARES_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..d70369a 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" @@ -66,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) @@ -283,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/include/libdivecomputer/uwatec_aladin.h b/src/uwatec_aladin.h similarity index 84% rename from include/libdivecomputer/uwatec_aladin.h rename to src/uwatec_aladin.h index 73226a9..41484f6 100644 --- a/include/libdivecomputer/uwatec_aladin.h +++ b/src/uwatec_aladin.h @@ -26,15 +26,12 @@ 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); -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 92e3044..b23c6b2 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" @@ -62,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) @@ -501,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/include/libdivecomputer/uwatec_memomouse.h b/src/uwatec_memomouse.h similarity index 84% rename from include/libdivecomputer/uwatec_memomouse.h rename to src/uwatec_memomouse.h index 7eb5dc0..8d37dc6 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" { @@ -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_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..077ec31 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" @@ -60,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) @@ -463,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/include/libdivecomputer/uwatec_meridian.h b/src/uwatec_meridian.h similarity index 83% rename from include/libdivecomputer/uwatec_meridian.h rename to src/uwatec_meridian.h index 723a9de..9c6918c 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" { @@ -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 3c55f07..2b94a3b 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" @@ -56,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) @@ -403,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/include/libdivecomputer/uwatec_smart.h b/src/uwatec_smart.h similarity index 84% rename from include/libdivecomputer/uwatec_smart.h rename to src/uwatec_smart.h index 9f753eb..5304c73 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" { @@ -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); 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" {