Add fingerprint support for the Reefnet Sensus Original, Pro and Ultra.
This commit is contained in:
parent
03212f5c6f
commit
11dc4715a4
@ -49,6 +49,7 @@ struct reefnet_sensus_device_t {
|
||||
unsigned int timestamp;
|
||||
};
|
||||
|
||||
static device_status_t reefnet_sensus_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
|
||||
static device_status_t reefnet_sensus_device_handshake (device_t *abstract, unsigned char *data, unsigned int size);
|
||||
static device_status_t reefnet_sensus_device_dump (device_t *abstract, unsigned char *data, unsigned int size, unsigned int *result);
|
||||
static device_status_t reefnet_sensus_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata);
|
||||
@ -56,7 +57,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_set_fingerprint, /* set_fingerprint */
|
||||
reefnet_sensus_device_handshake, /* handshake */
|
||||
NULL, /* version */
|
||||
NULL, /* read */
|
||||
@ -189,6 +190,26 @@ reefnet_sensus_device_set_timestamp (device_t *abstract, unsigned int timestamp)
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
reefnet_sensus_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size)
|
||||
{
|
||||
reefnet_sensus_device_t *device = (reefnet_sensus_device_t*) abstract;
|
||||
|
||||
if (! device_is_reefnet_sensus (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size && size != 4)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
if (size)
|
||||
device->timestamp = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
|
||||
else
|
||||
device->timestamp = 0;
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
reefnet_sensus_device_handshake (device_t *abstract, unsigned char *data, unsigned int size)
|
||||
{
|
||||
|
||||
@ -47,6 +47,7 @@ struct reefnet_sensuspro_device_t {
|
||||
unsigned int timestamp;
|
||||
};
|
||||
|
||||
static device_status_t reefnet_sensuspro_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
|
||||
static device_status_t reefnet_sensuspro_device_handshake (device_t *abstract, unsigned char *data, unsigned int size);
|
||||
static device_status_t reefnet_sensuspro_device_dump (device_t *abstract, unsigned char *data, unsigned int size, unsigned int *result);
|
||||
static device_status_t reefnet_sensuspro_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata);
|
||||
@ -54,7 +55,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_set_fingerprint, /* set_fingerprint */
|
||||
reefnet_sensuspro_device_handshake, /* handshake */
|
||||
NULL, /* version */
|
||||
NULL, /* read */
|
||||
@ -163,6 +164,26 @@ reefnet_sensuspro_device_set_timestamp (device_t *abstract, unsigned int timesta
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
reefnet_sensuspro_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size)
|
||||
{
|
||||
reefnet_sensuspro_device_t *device = (reefnet_sensuspro_device_t*) abstract;
|
||||
|
||||
if (! device_is_reefnet_sensuspro (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size && size != 4)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
if (size)
|
||||
device->timestamp = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
|
||||
else
|
||||
device->timestamp = 0;
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
reefnet_sensuspro_device_handshake (device_t *abstract, unsigned char *data, unsigned int size)
|
||||
{
|
||||
|
||||
@ -52,6 +52,7 @@ struct reefnet_sensusultra_device_t {
|
||||
unsigned int timestamp;
|
||||
};
|
||||
|
||||
static device_status_t reefnet_sensusultra_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size);
|
||||
static device_status_t reefnet_sensusultra_device_handshake (device_t *abstract, unsigned char *data, unsigned int size);
|
||||
static device_status_t reefnet_sensusultra_device_dump (device_t *abstract, unsigned char *data, unsigned int size, unsigned int *result);
|
||||
static device_status_t reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata);
|
||||
@ -59,7 +60,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_set_fingerprint, /* set_fingerprint */
|
||||
reefnet_sensusultra_device_handshake, /* handshake */
|
||||
NULL, /* version */
|
||||
NULL, /* read */
|
||||
@ -183,6 +184,26 @@ reefnet_sensusultra_device_set_timestamp (device_t *abstract, unsigned int times
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
reefnet_sensusultra_device_set_fingerprint (device_t *abstract, const unsigned char data[], unsigned int size)
|
||||
{
|
||||
reefnet_sensusultra_device_t *device = (reefnet_sensusultra_device_t*) abstract;
|
||||
|
||||
if (! device_is_reefnet_sensusultra (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size && size != 4)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
if (size)
|
||||
device->timestamp = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
|
||||
else
|
||||
device->timestamp = 0;
|
||||
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
reefnet_sensusultra_isempty (const unsigned char *data, unsigned int size)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user