Add support for synchronizing the device clock
Being able to synchronize the dive computer clock with the host system is a very useful feature. Add the infrastructure to support this feature through the public api.
This commit is contained in:
parent
db0e1691cc
commit
acb4a187fb
@ -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);
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
|
||||
13
src/device.c
13
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)
|
||||
{
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user