From 4368b94ff053ebc55dd79910573ee774d9e4dfad Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 23 Feb 2009 13:03:20 +0000 Subject: [PATCH] Added basic support for the fingerprint feature. --- src/device-private.h | 2 ++ src/device.c | 13 +++++++++++++ src/device.h | 2 ++ src/libdivecomputer.symbols | 1 + src/mares_nemo.c | 1 + src/oceanic_atom2.c | 1 + src/oceanic_veo250.c | 1 + src/oceanic_vtpro.c | 1 + src/reefnet_sensus.c | 1 + src/reefnet_sensuspro.c | 1 + src/reefnet_sensusultra.c | 1 + src/suunto_d9.c | 1 + src/suunto_eon.c | 1 + src/suunto_solution.c | 1 + src/suunto_vyper.c | 1 + src/suunto_vyper2.c | 1 + src/uwatec_aladin.c | 1 + src/uwatec_memomouse.c | 1 + src/uwatec_smart.c | 1 + 19 files changed, 33 insertions(+) diff --git a/src/device-private.h b/src/device-private.h index 51076a9..771bfad 100644 --- a/src/device-private.h +++ b/src/device-private.h @@ -48,6 +48,8 @@ struct device_t { struct device_backend_t { device_type_t type; + device_status_t (*set_fingerprint) (device_t *device, const unsigned char data[], unsigned int size); + device_status_t (*handshake) (device_t *device, unsigned char data[], unsigned int size); device_status_t (*version) (device_t *device, unsigned char data[], unsigned int size); diff --git a/src/device.c b/src/device.c index 80dbde9..a6b4820 100644 --- a/src/device.c +++ b/src/device.c @@ -60,6 +60,19 @@ device_set_events (device_t *device, unsigned int events, device_event_callback_ } +device_status_t +device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size) +{ + if (device == NULL) + return DEVICE_STATUS_UNSUPPORTED; + + if (device->backend->set_fingerprint == NULL) + return DEVICE_STATUS_UNSUPPORTED; + + return device->backend->set_fingerprint (device, data, size); +} + + device_status_t device_handshake (device_t *device, unsigned char data[], unsigned int size) { diff --git a/src/device.h b/src/device.h index 72566a3..2e07721 100644 --- a/src/device.h +++ b/src/device.h @@ -83,6 +83,8 @@ device_type_t device_get_type (device_t *device); device_status_t device_set_events (device_t *device, unsigned int events, device_event_callback_t callback, void *userdata); +device_status_t device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size); + device_status_t device_handshake (device_t *device, unsigned char data[], unsigned int size); device_status_t device_version (device_t *device, unsigned char data[], unsigned int size); diff --git a/src/libdivecomputer.symbols b/src/libdivecomputer.symbols index 4682a02..0437129 100644 --- a/src/libdivecomputer.symbols +++ b/src/libdivecomputer.symbols @@ -24,6 +24,7 @@ device_get_type device_handshake device_read device_set_events +device_set_fingerprint device_version device_write diff --git a/src/mares_nemo.c b/src/mares_nemo.c index 99dad93..a97c868 100644 --- a/src/mares_nemo.c +++ b/src/mares_nemo.c @@ -58,6 +58,7 @@ static device_status_t mares_nemo_device_close (device_t *abstract); static const device_backend_t mares_nemo_device_backend = { DEVICE_TYPE_MARES_NEMO, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 1109d8f..2013b00 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -80,6 +80,7 @@ static device_status_t oceanic_atom2_device_close (device_t *abstract); static const device_backend_t oceanic_atom2_device_backend = { DEVICE_TYPE_OCEANIC_ATOM2, + NULL, /* set_fingerprint */ NULL, /* handshake */ oceanic_atom2_device_version, /* version */ oceanic_atom2_device_read, /* read */ diff --git a/src/oceanic_veo250.c b/src/oceanic_veo250.c index 7ab09e5..37f3e4b 100644 --- a/src/oceanic_veo250.c +++ b/src/oceanic_veo250.c @@ -79,6 +79,7 @@ static device_status_t oceanic_veo250_device_close (device_t *abstract); static const device_backend_t oceanic_veo250_device_backend = { DEVICE_TYPE_OCEANIC_VEO250, + NULL, /* set_fingerprint */ NULL, /* handshake */ oceanic_veo250_device_version, /* version */ oceanic_veo250_device_read, /* read */ diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index 1b4c783..d164faa 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -60,6 +60,7 @@ static device_status_t oceanic_vtpro_device_close (device_t *abstract); static const device_backend_t oceanic_vtpro_device_backend = { DEVICE_TYPE_OCEANIC_VTPRO, + NULL, /* set_fingerprint */ NULL, /* handshake */ oceanic_vtpro_device_version, /* version */ oceanic_vtpro_device_read, /* read */ diff --git a/src/reefnet_sensus.c b/src/reefnet_sensus.c index b2c4143..a086e01 100644 --- a/src/reefnet_sensus.c +++ b/src/reefnet_sensus.c @@ -56,6 +56,7 @@ static device_status_t reefnet_sensus_device_close (device_t *abstract); static const device_backend_t reefnet_sensus_device_backend = { DEVICE_TYPE_REEFNET_SENSUS, + NULL, /* set_fingerprint */ reefnet_sensus_device_handshake, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index 3255471..803c8d6 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -54,6 +54,7 @@ static device_status_t reefnet_sensuspro_device_close (device_t *abstract); static const device_backend_t reefnet_sensuspro_device_backend = { DEVICE_TYPE_REEFNET_SENSUSPRO, + NULL, /* set_fingerprint */ reefnet_sensuspro_device_handshake, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index 3c0dcd3..add1bb5 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -59,6 +59,7 @@ static device_status_t reefnet_sensusultra_device_close (device_t *abstract); static const device_backend_t reefnet_sensusultra_device_backend = { DEVICE_TYPE_REEFNET_SENSUSULTRA, + NULL, /* set_fingerprint */ reefnet_sensusultra_device_handshake, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/suunto_d9.c b/src/suunto_d9.c index 0f71887..40dfd50 100644 --- a/src/suunto_d9.c +++ b/src/suunto_d9.c @@ -63,6 +63,7 @@ static device_status_t suunto_d9_device_close (device_t *abstract); static const device_backend_t suunto_d9_device_backend = { DEVICE_TYPE_SUUNTO_D9, + NULL, /* set_fingerprint */ NULL, /* handshake */ suunto_d9_device_version, /* version */ suunto_d9_device_read, /* read */ diff --git a/src/suunto_eon.c b/src/suunto_eon.c index c32db5a..18e2ab1 100644 --- a/src/suunto_eon.c +++ b/src/suunto_eon.c @@ -53,6 +53,7 @@ static device_status_t suunto_eon_device_close (device_t *abstract); static const device_backend_t suunto_eon_device_backend = { DEVICE_TYPE_SUUNTO_EON, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/suunto_solution.c b/src/suunto_solution.c index 8ae1205..d3e3fce 100644 --- a/src/suunto_solution.c +++ b/src/suunto_solution.c @@ -54,6 +54,7 @@ static device_status_t suunto_solution_device_close (device_t *abstract); static const device_backend_t suunto_solution_device_backend = { DEVICE_TYPE_SUUNTO_SOLUTION, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index d6c5ae9..5462ef8 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -60,6 +60,7 @@ static device_status_t suunto_vyper_device_close (device_t *abstract); static const device_backend_t suunto_vyper_device_backend = { DEVICE_TYPE_SUUNTO_VYPER, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ suunto_vyper_device_read, /* read */ diff --git a/src/suunto_vyper2.c b/src/suunto_vyper2.c index 9fe5995..f033f2d 100644 --- a/src/suunto_vyper2.c +++ b/src/suunto_vyper2.c @@ -63,6 +63,7 @@ static device_status_t suunto_vyper2_device_close (device_t *abstract); static const device_backend_t suunto_vyper2_device_backend = { DEVICE_TYPE_SUUNTO_VYPER2, + NULL, /* set_fingerprint */ NULL, /* handshake */ suunto_vyper2_device_version, /* version */ suunto_vyper2_device_read, /* read */ diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index cddf78e..298a22b 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -58,6 +58,7 @@ static device_status_t uwatec_aladin_device_close (device_t *abstract); static const device_backend_t uwatec_aladin_device_backend = { DEVICE_TYPE_UWATEC_ALADIN, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/uwatec_memomouse.c b/src/uwatec_memomouse.c index 498af6d..d0b47d4 100644 --- a/src/uwatec_memomouse.c +++ b/src/uwatec_memomouse.c @@ -57,6 +57,7 @@ static device_status_t uwatec_memomouse_device_close (device_t *abstract); static const device_backend_t uwatec_memomouse_device_backend = { DEVICE_TYPE_UWATEC_MEMOMOUSE, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ NULL, /* read */ diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index a3b90f0..15638f7 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -54,6 +54,7 @@ static device_status_t uwatec_smart_device_close (device_t *abstract); static const device_backend_t uwatec_smart_device_backend = { DEVICE_TYPE_UWATEC_SMART, + NULL, /* set_fingerprint */ NULL, /* handshake */ NULL, /* version */ NULL, /* read */