Use the common fingerprint function directly.

This commit is contained in:
Jef Driesen 2010-02-26 14:40:16 +00:00
parent 6f622030eb
commit 293b45b77c
4 changed files with 6 additions and 30 deletions

View File

@ -44,8 +44,10 @@ mares_common_device_init (mares_common_device_t *device, const device_backend_t
device_status_t
mares_common_device_set_fingerprint (mares_common_device_t *device, const unsigned char data[], unsigned int size)
mares_common_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size)
{
mares_common_device_t *device = (mares_common_device_t *) abstract;
assert (device != NULL);
if (size && size != sizeof (device->fingerprint))

View File

@ -44,7 +44,7 @@ void
mares_common_device_init (mares_common_device_t *device, const device_backend_t *backend);
device_status_t
mares_common_device_set_fingerprint (mares_common_device_t *device, const unsigned char data[], unsigned int size);
mares_common_device_set_fingerprint (device_t *device, const unsigned char data[], unsigned int size);
device_status_t
mares_common_extract_dives (mares_common_device_t *device, const mares_common_layout_t *layout, const unsigned char data[], dive_callback_t callback, void *userdata);

View File

@ -49,14 +49,13 @@ typedef struct mares_nemo_device_t {
struct serial *port;
} mares_nemo_device_t;
static device_status_t mares_nemo_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
static device_status_t mares_nemo_device_dump (device_t *abstract, dc_buffer_t *buffer);
static device_status_t mares_nemo_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata);
static device_status_t mares_nemo_device_close (device_t *abstract);
static const device_backend_t mares_nemo_device_backend = {
DEVICE_TYPE_MARES_NEMO,
mares_nemo_device_set_fingerprint, /* set_fingerprint */
mares_common_device_set_fingerprint, /* set_fingerprint */
NULL, /* version */
NULL, /* read */
NULL, /* write */
@ -162,18 +161,6 @@ mares_nemo_device_close (device_t *abstract)
}
static device_status_t
mares_nemo_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size)
{
mares_common_device_t *device = (mares_common_device_t*) abstract;
if (! device_is_mares_nemo (abstract))
return DEVICE_STATUS_TYPE_MISMATCH;
return mares_common_device_set_fingerprint (device, data, size);
}
static device_status_t
mares_nemo_device_dump (device_t *abstract, dc_buffer_t *buffer)
{

View File

@ -43,7 +43,6 @@ typedef struct mares_puck_device_t {
struct serial *port;
} mares_puck_device_t;
static device_status_t mares_puck_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
static device_status_t mares_puck_device_read (device_t *abstract, unsigned int address, unsigned char data[], unsigned int size);
static device_status_t mares_puck_device_dump (device_t *abstract, dc_buffer_t *buffer);
static device_status_t mares_puck_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata);
@ -51,7 +50,7 @@ static device_status_t mares_puck_device_close (device_t *abstract);
static const device_backend_t mares_puck_device_backend = {
DEVICE_TYPE_MARES_PUCK,
mares_puck_device_set_fingerprint, /* set_fingerprint */
mares_common_device_set_fingerprint, /* set_fingerprint */
NULL, /* version */
mares_puck_device_read, /* read */
NULL, /* write */
@ -286,18 +285,6 @@ mares_puck_transfer (mares_puck_device_t *device, const unsigned char command[],
}
static device_status_t
mares_puck_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size)
{
mares_common_device_t *device = (mares_common_device_t*) abstract;
if (! device_is_mares_puck (abstract))
return DEVICE_STATUS_TYPE_MISMATCH;
return mares_common_device_set_fingerprint (device, data, size);
}
static device_status_t
mares_puck_device_read (device_t *abstract, unsigned int address, unsigned char data[], unsigned int size)
{