diff --git a/include/libdivecomputer/device.h b/include/libdivecomputer/device.h index 1990926..f6d415c 100644 --- a/include/libdivecomputer/device.h +++ b/include/libdivecomputer/device.h @@ -96,6 +96,9 @@ dc_device_dump (dc_device_t *device, dc_buffer_t *buffer); dc_status_t dc_device_foreach (dc_device_t *device, dc_dive_callback_t callback, void *userdata); +dc_status_t +dc_device_timesync (dc_device_t *device, const dc_datetime_t *datetime); + dc_status_t dc_device_close (dc_device_t *device); diff --git a/src/atomics_cobalt.c b/src/atomics_cobalt.c index 91a6da6..7c7dccb 100644 --- a/src/atomics_cobalt.c +++ b/src/atomics_cobalt.c @@ -75,6 +75,7 @@ static const dc_device_vtable_t atomics_cobalt_device_vtable = { NULL, /* write */ NULL, /* dump */ atomics_cobalt_device_foreach, /* foreach */ + NULL, /* timesync */ atomics_cobalt_device_close /* close */ }; diff --git a/src/citizen_aqualand.c b/src/citizen_aqualand.c index 5e111da..47ba87f 100644 --- a/src/citizen_aqualand.c +++ b/src/citizen_aqualand.c @@ -51,6 +51,7 @@ static const dc_device_vtable_t citizen_aqualand_device_vtable = { NULL, /* write */ citizen_aqualand_device_dump, /* dump */ citizen_aqualand_device_foreach, /* foreach */ + NULL, /* timesync */ citizen_aqualand_device_close /* close */ }; diff --git a/src/cochran_commander.c b/src/cochran_commander.c index 16707bf..b515909 100644 --- a/src/cochran_commander.c +++ b/src/cochran_commander.c @@ -114,6 +114,7 @@ static const dc_device_vtable_t cochran_commander_device_vtable = { NULL, /* write */ cochran_commander_device_dump, /* dump */ cochran_commander_device_foreach, /* foreach */ + NULL, /* timesync */ cochran_commander_device_close /* close */ }; diff --git a/src/cressi_edy.c b/src/cressi_edy.c index 226f32f..68e13fc 100644 --- a/src/cressi_edy.c +++ b/src/cressi_edy.c @@ -75,6 +75,7 @@ static const dc_device_vtable_t cressi_edy_device_vtable = { NULL, /* write */ cressi_edy_device_dump, /* dump */ cressi_edy_device_foreach, /* foreach */ + NULL, /* timesync */ cressi_edy_device_close /* close */ }; diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index c354b22..f21a223 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -67,6 +67,7 @@ static const dc_device_vtable_t cressi_leonardo_device_vtable = { NULL, /* write */ cressi_leonardo_device_dump, /* dump */ cressi_leonardo_device_foreach, /* foreach */ + NULL, /* timesync */ cressi_leonardo_device_close /* close */ }; diff --git a/src/device-private.h b/src/device-private.h index dcf0b96..7ca6610 100644 --- a/src/device-private.h +++ b/src/device-private.h @@ -71,6 +71,8 @@ struct dc_device_vtable_t { dc_status_t (*foreach) (dc_device_t *device, dc_dive_callback_t callback, void *userdata); + dc_status_t (*timesync) (dc_device_t *device, const dc_datetime_t *datetime); + dc_status_t (*close) (dc_device_t *device); }; diff --git a/src/device.c b/src/device.c index 9dcc528..6277c90 100644 --- a/src/device.c +++ b/src/device.c @@ -370,6 +370,19 @@ dc_device_foreach (dc_device_t *device, dc_dive_callback_t callback, void *userd } +dc_status_t +dc_device_timesync (dc_device_t *device, const dc_datetime_t *datetime) +{ + if (device == NULL) + return DC_STATUS_UNSUPPORTED; + + if (device->vtable->timesync == NULL) + return DC_STATUS_UNSUPPORTED; + + return device->vtable->timesync (device, datetime); +} + + dc_status_t dc_device_close (dc_device_t *device) { diff --git a/src/diverite_nitekq.c b/src/diverite_nitekq.c index 205115a..8c8c442 100644 --- a/src/diverite_nitekq.c +++ b/src/diverite_nitekq.c @@ -69,6 +69,7 @@ static const dc_device_vtable_t diverite_nitekq_device_vtable = { NULL, /* write */ diverite_nitekq_device_dump, /* dump */ diverite_nitekq_device_foreach, /* foreach */ + NULL, /* timesync */ diverite_nitekq_device_close /* close */ }; diff --git a/src/divesystem_idive.c b/src/divesystem_idive.c index d26e2b4..8a8f1ae 100644 --- a/src/divesystem_idive.c +++ b/src/divesystem_idive.c @@ -86,6 +86,7 @@ static const dc_device_vtable_t divesystem_idive_device_vtable = { NULL, /* write */ NULL, /* dump */ divesystem_idive_device_foreach, /* foreach */ + NULL, /* timesync */ divesystem_idive_device_close /* close */ }; diff --git a/src/hw_frog.c b/src/hw_frog.c index d8b89ca..31caa83 100644 --- a/src/hw_frog.c +++ b/src/hw_frog.c @@ -71,6 +71,7 @@ static const dc_device_vtable_t hw_frog_device_vtable = { NULL, /* write */ NULL, /* dump */ hw_frog_device_foreach, /* foreach */ + NULL, /* timesync */ hw_frog_device_close /* close */ }; diff --git a/src/hw_ostc.c b/src/hw_ostc.c index 3f46603..b866f68 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -80,6 +80,7 @@ static const dc_device_vtable_t hw_ostc_device_vtable = { NULL, /* write */ hw_ostc_device_dump, /* dump */ hw_ostc_device_foreach, /* foreach */ + NULL, /* timesync */ hw_ostc_device_close /* close */ }; diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index e7b7d9e..9081b1a 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -139,6 +139,7 @@ static const dc_device_vtable_t hw_ostc3_device_vtable = { hw_ostc3_device_write, /* write */ hw_ostc3_device_dump, /* dump */ hw_ostc3_device_foreach, /* foreach */ + NULL, /* timesync */ hw_ostc3_device_close /* close */ }; diff --git a/src/libdivecomputer.symbols b/src/libdivecomputer.symbols index c3d372b..237a9c1 100644 --- a/src/libdivecomputer.symbols +++ b/src/libdivecomputer.symbols @@ -56,6 +56,7 @@ dc_device_read dc_device_set_cancel dc_device_set_events dc_device_set_fingerprint +dc_device_timesync dc_device_write oceanic_atom2_device_version diff --git a/src/mares_darwin.c b/src/mares_darwin.c index 9ac56ba..4b1bc24 100644 --- a/src/mares_darwin.c +++ b/src/mares_darwin.c @@ -70,6 +70,7 @@ static const dc_device_vtable_t mares_darwin_device_vtable = { NULL, /* write */ mares_darwin_device_dump, /* dump */ mares_darwin_device_foreach, /* foreach */ + NULL, /* timesync */ mares_darwin_device_close /* close */ }; diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index 3a73968..e945e9f 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -87,6 +87,7 @@ static const dc_device_vtable_t mares_iconhd_device_vtable = { NULL, /* write */ mares_iconhd_device_dump, /* dump */ mares_iconhd_device_foreach, /* foreach */ + NULL, /* timesync */ mares_iconhd_device_close /* close */ }; diff --git a/src/mares_nemo.c b/src/mares_nemo.c index 2ec3588..c73c24b 100644 --- a/src/mares_nemo.c +++ b/src/mares_nemo.c @@ -62,6 +62,7 @@ static const dc_device_vtable_t mares_nemo_device_vtable = { NULL, /* write */ mares_nemo_device_dump, /* dump */ mares_nemo_device_foreach, /* foreach */ + NULL, /* timesync */ mares_nemo_device_close /* close */ }; diff --git a/src/mares_puck.c b/src/mares_puck.c index fc8e00d..b220f54 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -57,6 +57,7 @@ static const dc_device_vtable_t mares_puck_device_vtable = { NULL, /* write */ mares_puck_device_dump, /* dump */ mares_puck_device_foreach, /* foreach */ + NULL, /* timesync */ mares_puck_device_close /* close */ }; diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index d9e8d5a..bae6537 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -74,6 +74,7 @@ static const oceanic_common_device_vtable_t oceanic_atom2_device_vtable = { oceanic_atom2_device_write, /* write */ oceanic_common_device_dump, /* dump */ oceanic_common_device_foreach, /* foreach */ + NULL, /* timesync */ oceanic_atom2_device_close /* close */ }, oceanic_common_device_logbook, diff --git a/src/oceanic_veo250.c b/src/oceanic_veo250.c index d47c532..b6021dd 100644 --- a/src/oceanic_veo250.c +++ b/src/oceanic_veo250.c @@ -56,6 +56,7 @@ static const oceanic_common_device_vtable_t oceanic_veo250_device_vtable = { NULL, /* write */ oceanic_common_device_dump, /* dump */ oceanic_common_device_foreach, /* foreach */ + NULL, /* timesync */ oceanic_veo250_device_close /* close */ }, oceanic_common_device_logbook, diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index 2e86f5f..cc09892 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -68,6 +68,7 @@ static const oceanic_common_device_vtable_t oceanic_vtpro_device_vtable = { NULL, /* write */ oceanic_common_device_dump, /* dump */ oceanic_common_device_foreach, /* foreach */ + NULL, /* timesync */ oceanic_vtpro_device_close /* close */ }, oceanic_vtpro_device_logbook, diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index 94d7a7e..37c343a 100644 --- a/src/reefnet_sensus.c +++ b/src/reefnet_sensus.c @@ -57,6 +57,7 @@ static const dc_device_vtable_t reefnet_sensus_device_vtable = { NULL, /* write */ reefnet_sensus_device_dump, /* dump */ reefnet_sensus_device_foreach, /* foreach */ + NULL, /* timesync */ reefnet_sensus_device_close /* close */ }; diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index bf88801..4df3c07 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -56,6 +56,7 @@ static const dc_device_vtable_t reefnet_sensuspro_device_vtable = { NULL, /* write */ reefnet_sensuspro_device_dump, /* dump */ reefnet_sensuspro_device_foreach, /* foreach */ + NULL, /* timesync */ reefnet_sensuspro_device_close /* close */ }; diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index f28dbb2..fba7511 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -65,6 +65,7 @@ static const dc_device_vtable_t reefnet_sensusultra_device_vtable = { NULL, /* write */ reefnet_sensusultra_device_dump, /* dump */ reefnet_sensusultra_device_foreach, /* foreach */ + NULL, /* timesync */ reefnet_sensusultra_device_close /* close */ }; diff --git a/src/shearwater_petrel.c b/src/shearwater_petrel.c index 4966d14..71f507e 100644 --- a/src/shearwater_petrel.c +++ b/src/shearwater_petrel.c @@ -56,6 +56,7 @@ static const dc_device_vtable_t shearwater_petrel_device_vtable = { NULL, /* write */ NULL, /* dump */ shearwater_petrel_device_foreach, /* foreach */ + NULL, /* timesync */ shearwater_petrel_device_close /* close */ }; diff --git a/src/shearwater_predator.c b/src/shearwater_predator.c index 0e7a0d3..42a579b 100644 --- a/src/shearwater_predator.c +++ b/src/shearwater_predator.c @@ -57,6 +57,7 @@ static const dc_device_vtable_t shearwater_predator_device_vtable = { NULL, /* write */ shearwater_predator_device_dump, /* dump */ shearwater_predator_device_foreach, /* foreach */ + NULL, /* timesync */ shearwater_predator_device_close /* close */ }; diff --git a/src/suunto_d9.c b/src/suunto_d9.c index 2908792..56f8c40 100644 --- a/src/suunto_d9.c +++ b/src/suunto_d9.c @@ -58,6 +58,7 @@ static const suunto_common2_device_vtable_t suunto_d9_device_vtable = { suunto_common2_device_write, /* write */ suunto_common2_device_dump, /* dump */ suunto_common2_device_foreach, /* foreach */ + NULL, /* timesync */ suunto_d9_device_close /* close */ }, suunto_d9_device_packet diff --git a/src/suunto_eon.c b/src/suunto_eon.c index ce9ce83..2875654 100644 --- a/src/suunto_eon.c +++ b/src/suunto_eon.c @@ -51,6 +51,7 @@ static const dc_device_vtable_t suunto_eon_device_vtable = { NULL, /* write */ suunto_eon_device_dump, /* dump */ suunto_eon_device_foreach, /* foreach */ + NULL, /* timesync */ suunto_eon_device_close /* close */ }; diff --git a/src/suunto_eonsteel.c b/src/suunto_eonsteel.c index 615f5c7..2e6d4c4 100644 --- a/src/suunto_eonsteel.c +++ b/src/suunto_eonsteel.c @@ -81,6 +81,7 @@ static const dc_device_vtable_t suunto_eonsteel_device_vtable = { NULL, /* write */ NULL, /* dump */ suunto_eonsteel_device_foreach, /* foreach */ + NULL, /* timesync */ suunto_eonsteel_device_close /* close */ }; diff --git a/src/suunto_solution.c b/src/suunto_solution.c index c708114..cb2481d 100644 --- a/src/suunto_solution.c +++ b/src/suunto_solution.c @@ -54,6 +54,7 @@ static const dc_device_vtable_t suunto_solution_device_vtable = { NULL, /* write */ suunto_solution_device_dump, /* dump */ suunto_solution_device_foreach, /* foreach */ + NULL, /* timesync */ suunto_solution_device_close /* close */ }; diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index ce44e05..33657dc 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -63,6 +63,7 @@ static const dc_device_vtable_t suunto_vyper_device_vtable = { suunto_vyper_device_write, /* write */ suunto_vyper_device_dump, /* dump */ suunto_vyper_device_foreach, /* foreach */ + NULL, /* timesync */ suunto_vyper_device_close /* close */ }; diff --git a/src/suunto_vyper2.c b/src/suunto_vyper2.c index 8ab521e..618ee4a 100644 --- a/src/suunto_vyper2.c +++ b/src/suunto_vyper2.c @@ -50,6 +50,7 @@ static const suunto_common2_device_vtable_t suunto_vyper2_device_vtable = { suunto_common2_device_write, /* write */ suunto_common2_device_dump, /* dump */ suunto_common2_device_foreach, /* foreach */ + NULL, /* timesync */ suunto_vyper2_device_close /* close */ }, suunto_vyper2_device_packet diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index d70369a..25c9208 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -62,6 +62,7 @@ static const dc_device_vtable_t uwatec_aladin_device_vtable = { NULL, /* write */ uwatec_aladin_device_dump, /* dump */ uwatec_aladin_device_foreach, /* foreach */ + NULL, /* timesync */ uwatec_aladin_device_close /* close */ }; diff --git a/src/uwatec_g2.c b/src/uwatec_g2.c index fc32aff..6e35104 100644 --- a/src/uwatec_g2.c +++ b/src/uwatec_g2.c @@ -54,6 +54,7 @@ static const dc_device_vtable_t uwatec_g2_device_vtable = { NULL, /* write */ uwatec_g2_device_dump, /* dump */ uwatec_g2_device_foreach, /* foreach */ + NULL, /* timesync */ uwatec_g2_device_close /* close */ }; diff --git a/src/uwatec_memomouse.c b/src/uwatec_memomouse.c index b23c6b2..2f93067 100644 --- a/src/uwatec_memomouse.c +++ b/src/uwatec_memomouse.c @@ -58,6 +58,7 @@ static const dc_device_vtable_t uwatec_memomouse_device_vtable = { NULL, /* write */ uwatec_memomouse_device_dump, /* dump */ uwatec_memomouse_device_foreach, /* foreach */ + NULL, /* timesync */ uwatec_memomouse_device_close /* close */ }; diff --git a/src/uwatec_meridian.c b/src/uwatec_meridian.c index d59b855..c32f3bc 100644 --- a/src/uwatec_meridian.c +++ b/src/uwatec_meridian.c @@ -56,6 +56,7 @@ static const dc_device_vtable_t uwatec_meridian_device_vtable = { NULL, /* write */ uwatec_meridian_device_dump, /* dump */ uwatec_meridian_device_foreach, /* foreach */ + NULL, /* timesync */ uwatec_meridian_device_close /* close */ }; diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index 425e76e..4fd2e2d 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -52,6 +52,7 @@ static const dc_device_vtable_t uwatec_smart_device_vtable = { NULL, /* write */ uwatec_smart_device_dump, /* dump */ uwatec_smart_device_foreach, /* foreach */ + NULL, /* timesync */ uwatec_smart_device_close /* close */ }; diff --git a/src/zeagle_n2ition3.c b/src/zeagle_n2ition3.c index fed6ae2..3d2bb24 100644 --- a/src/zeagle_n2ition3.c +++ b/src/zeagle_n2ition3.c @@ -64,6 +64,7 @@ static const dc_device_vtable_t zeagle_n2ition3_device_vtable = { NULL, /* write */ zeagle_n2ition3_device_dump, /* dump */ zeagle_n2ition3_device_foreach, /* foreach */ + NULL, /* timesync */ zeagle_n2ition3_device_close /* close */ };