Implement the device_dump() function on top of device_read().
This commit is contained in:
parent
16b14e55ef
commit
5ae3b98d5d
@ -390,6 +390,22 @@ oceanic_atom2_read_ringbuffer (device_t *abstract, unsigned int address, unsigne
|
||||
return DEVICE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static device_status_t
|
||||
oceanic_atom2_device_dump (device_t *abstract, unsigned char data[], unsigned int size)
|
||||
{
|
||||
if (! device_is_oceanic_atom2 (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size < OCEANIC_ATOM2_MEMORY_SIZE)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
int rc = oceanic_atom2_device_read (abstract, 0x00, data, OCEANIC_ATOM2_MEMORY_SIZE);
|
||||
if (rc != DEVICE_STATUS_SUCCESS)
|
||||
return rc;
|
||||
|
||||
return OCEANIC_ATOM2_MEMORY_SIZE;
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
oceanic_atom2_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata)
|
||||
@ -481,7 +497,7 @@ static const device_backend_t oceanic_atom2_device_backend = {
|
||||
oceanic_atom2_device_version, /* version */
|
||||
oceanic_atom2_device_read, /* read */
|
||||
NULL, /* write */
|
||||
NULL, /* dump */
|
||||
oceanic_atom2_device_dump, /* dump */
|
||||
oceanic_atom2_device_foreach, /* foreach */
|
||||
oceanic_atom2_device_close /* close */
|
||||
};
|
||||
|
||||
@ -365,6 +365,23 @@ suunto_d9_device_write (device_t *abstract, unsigned int address, const unsigned
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
suunto_d9_device_dump (device_t *abstract, unsigned char data[], unsigned int size)
|
||||
{
|
||||
if (! device_is_suunto_d9 (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size < SUUNTO_D9_MEMORY_SIZE)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
int rc = suunto_d9_device_read (abstract, 0x00, data, SUUNTO_D9_MEMORY_SIZE);
|
||||
if (rc != DEVICE_STATUS_SUCCESS)
|
||||
return rc;
|
||||
|
||||
return SUUNTO_D9_MEMORY_SIZE;
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
suunto_d9_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata)
|
||||
{
|
||||
@ -494,7 +511,7 @@ static const device_backend_t suunto_d9_device_backend = {
|
||||
suunto_d9_device_version, /* version */
|
||||
suunto_d9_device_read, /* read */
|
||||
suunto_d9_device_write, /* write */
|
||||
NULL, /* dump */
|
||||
suunto_d9_device_dump, /* dump */
|
||||
suunto_d9_device_foreach, /* foreach */
|
||||
suunto_d9_device_close /* close */
|
||||
};
|
||||
|
||||
@ -534,6 +534,23 @@ suunto_vyper_device_read_dive (device_t *abstract, unsigned char data[], unsigne
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
suunto_vyper_device_dump (device_t *abstract, unsigned char data[], unsigned int size)
|
||||
{
|
||||
if (! device_is_suunto_vyper (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size < SUUNTO_VYPER_MEMORY_SIZE)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
int rc = suunto_vyper_device_read (abstract, 0x00, data, SUUNTO_VYPER_MEMORY_SIZE);
|
||||
if (rc != DEVICE_STATUS_SUCCESS)
|
||||
return rc;
|
||||
|
||||
return SUUNTO_VYPER_MEMORY_SIZE;
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
suunto_vyper_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata)
|
||||
{
|
||||
@ -593,7 +610,7 @@ static const device_backend_t suunto_vyper_device_backend = {
|
||||
NULL, /* version */
|
||||
suunto_vyper_device_read, /* read */
|
||||
suunto_vyper_device_write, /* write */
|
||||
NULL, /* dump */
|
||||
suunto_vyper_device_dump, /* dump */
|
||||
suunto_vyper_device_foreach, /* foreach */
|
||||
suunto_vyper_device_close /* close */
|
||||
};
|
||||
|
||||
@ -352,6 +352,23 @@ suunto_vyper2_device_write (device_t *abstract, unsigned int address, const unsi
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
suunto_vyper2_device_dump (device_t *abstract, unsigned char data[], unsigned int size)
|
||||
{
|
||||
if (! device_is_suunto_vyper2 (abstract))
|
||||
return DEVICE_STATUS_TYPE_MISMATCH;
|
||||
|
||||
if (size < SUUNTO_VYPER2_MEMORY_SIZE)
|
||||
return DEVICE_STATUS_ERROR;
|
||||
|
||||
int rc = suunto_vyper2_device_read (abstract, 0x00, data, SUUNTO_VYPER2_MEMORY_SIZE);
|
||||
if (rc != DEVICE_STATUS_SUCCESS)
|
||||
return rc;
|
||||
|
||||
return SUUNTO_VYPER2_MEMORY_SIZE;
|
||||
}
|
||||
|
||||
|
||||
static device_status_t
|
||||
suunto_vyper2_device_foreach (device_t *abstract, dive_callback_t callback, void *userdata)
|
||||
{
|
||||
@ -481,7 +498,7 @@ static const device_backend_t suunto_vyper2_device_backend = {
|
||||
suunto_vyper2_device_version, /* version */
|
||||
suunto_vyper2_device_read, /* read */
|
||||
suunto_vyper2_device_write, /* write */
|
||||
NULL, /* dump */
|
||||
suunto_vyper2_device_dump, /* dump */
|
||||
suunto_vyper2_device_foreach, /* foreach */
|
||||
suunto_vyper2_device_close /* close */
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user