Implement the new api for the HW devices

The Heinrichs-Weikamp devices already supported clock synchronization by
means of a device specific function. This is now replaced with the new
api.
This commit is contained in:
Jef Driesen 2017-08-01 13:28:03 +02:00
parent acb4a187fb
commit 22e0ab3d2b
7 changed files with 12 additions and 30 deletions

View File

@ -36,9 +36,6 @@ extern "C" {
dc_status_t
hw_frog_device_version (dc_device_t *device, unsigned char data[], unsigned int size);
dc_status_t
hw_frog_device_clock (dc_device_t *device, const dc_datetime_t *datetime);
dc_status_t
hw_frog_device_display (dc_device_t *device, const char *text);

View File

@ -43,9 +43,6 @@ typedef enum hw_ostc_format_t {
dc_status_t
hw_ostc_device_md2hash (dc_device_t *device, unsigned char data[], unsigned int size);
dc_status_t
hw_ostc_device_clock (dc_device_t *device, const dc_datetime_t *datetime);
dc_status_t
hw_ostc_device_eeprom_read (dc_device_t *device, unsigned int bank, unsigned char data[], unsigned int size);

View File

@ -39,9 +39,6 @@ hw_ostc3_device_version (dc_device_t *device, unsigned char data[], unsigned int
dc_status_t
hw_ostc3_device_hardware (dc_device_t *device, unsigned char data[], unsigned int size);
dc_status_t
hw_ostc3_device_clock (dc_device_t *device, const dc_datetime_t *datetime);
dc_status_t
hw_ostc3_device_display (dc_device_t *device, const char *text);

View File

@ -61,6 +61,7 @@ typedef struct hw_frog_device_t {
static dc_status_t hw_frog_device_set_fingerprint (dc_device_t *abstract, const unsigned char data[], unsigned int size);
static dc_status_t hw_frog_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void *userdata);
static dc_status_t hw_frog_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime);
static dc_status_t hw_frog_device_close (dc_device_t *abstract);
static const dc_device_vtable_t hw_frog_device_vtable = {
@ -71,7 +72,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_timesync, /* timesync */
hw_frog_device_close /* close */
};
@ -483,14 +484,11 @@ hw_frog_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void
}
dc_status_t
hw_frog_device_clock (dc_device_t *abstract, const dc_datetime_t *datetime)
static dc_status_t
hw_frog_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime)
{
hw_frog_device_t *device = (hw_frog_device_t *) abstract;
if (!ISINSTANCE (abstract))
return DC_STATUS_INVALIDARGS;
if (datetime == NULL) {
ERROR (abstract->context, "Invalid parameter specified.");
return DC_STATUS_INVALIDARGS;

View File

@ -70,6 +70,7 @@ typedef struct hw_ostc_firmware_t {
static dc_status_t hw_ostc_device_set_fingerprint (dc_device_t *abstract, const unsigned char data[], unsigned int size);
static dc_status_t hw_ostc_device_dump (dc_device_t *abstract, dc_buffer_t *buffer);
static dc_status_t hw_ostc_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void *userdata);
static dc_status_t hw_ostc_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime);
static dc_status_t hw_ostc_device_close (dc_device_t *abstract);
static const dc_device_vtable_t hw_ostc_device_vtable = {
@ -80,7 +81,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_timesync, /* timesync */
hw_ostc_device_close /* close */
};
@ -378,15 +379,12 @@ hw_ostc_device_md2hash (dc_device_t *abstract, unsigned char data[], unsigned in
}
dc_status_t
hw_ostc_device_clock (dc_device_t *abstract, const dc_datetime_t *datetime)
static dc_status_t
hw_ostc_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime)
{
dc_status_t status = DC_STATUS_SUCCESS;
hw_ostc_device_t *device = (hw_ostc_device_t *) abstract;
if (!ISINSTANCE (abstract))
return DC_STATUS_INVALIDARGS;
if (datetime == NULL) {
ERROR (abstract->context, "Invalid parameter specified.");
return DC_STATUS_INVALIDARGS;

View File

@ -129,6 +129,7 @@ static dc_status_t hw_ostc3_device_read (dc_device_t *abstract, unsigned int add
static dc_status_t hw_ostc3_device_write (dc_device_t *abstract, unsigned int address, const unsigned char data[], unsigned int size);
static dc_status_t hw_ostc3_device_dump (dc_device_t *abstract, dc_buffer_t *buffer);
static dc_status_t hw_ostc3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void *userdata);
static dc_status_t hw_ostc3_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime);
static dc_status_t hw_ostc3_device_close (dc_device_t *abstract);
static const dc_device_vtable_t hw_ostc3_device_vtable = {
@ -139,7 +140,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_timesync, /* timesync */
hw_ostc3_device_close /* close */
};
@ -802,14 +803,11 @@ hw_ostc3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, voi
}
dc_status_t
hw_ostc3_device_clock (dc_device_t *abstract, const dc_datetime_t *datetime)
static dc_status_t
hw_ostc3_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime)
{
hw_ostc3_device_t *device = (hw_ostc3_device_t *) abstract;
if (!ISINSTANCE (abstract))
return DC_STATUS_INVALIDARGS;
if (datetime == NULL) {
ERROR (abstract->context, "Invalid parameter specified.");
return DC_STATUS_INVALIDARGS;

View File

@ -80,19 +80,16 @@ suunto_eon_device_write_name
suunto_vyper2_device_version
suunto_vyper2_device_reset_maxdepth
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_device_fwupdate
hw_frog_device_version
hw_frog_device_clock
hw_frog_device_display
hw_frog_device_customtext
hw_ostc3_device_version
hw_ostc3_device_hardware
hw_ostc3_device_clock
hw_ostc3_device_display
hw_ostc3_device_customtext
hw_ostc3_device_config_read