diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 1679b4b..c8ac34c 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -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 */ }; diff --git a/src/suunto_d9.c b/src/suunto_d9.c index 965b2a6..3f039a2 100644 --- a/src/suunto_d9.c +++ b/src/suunto_d9.c @@ -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 */ }; diff --git a/src/suunto_vyper.c b/src/suunto_vyper.c index a761c96..0a9606e 100644 --- a/src/suunto_vyper.c +++ b/src/suunto_vyper.c @@ -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 */ }; diff --git a/src/suunto_vyper2.c b/src/suunto_vyper2.c index 19f8da7..6950790 100644 --- a/src/suunto_vyper2.c +++ b/src/suunto_vyper2.c @@ -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 */ };