Added basic support for the fingerprint feature.
This commit is contained in:
parent
1c736835eb
commit
4368b94ff0
@ -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);
|
||||
|
||||
13
src/device.c
13
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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -24,6 +24,7 @@ device_get_type
|
||||
device_handshake
|
||||
device_read
|
||||
device_set_events
|
||||
device_set_fingerprint
|
||||
device_version
|
||||
device_write
|
||||
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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 */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user