Merge branch 'master' into Subsurface-branch
This commit is contained in:
commit
8bb373e514
@ -444,7 +444,7 @@ cressi_edy_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v
|
|||||||
last < layout->rb_logbook_begin || last >= layout->rb_logbook_end) {
|
last < layout->rb_logbook_begin || last >= layout->rb_logbook_end) {
|
||||||
if (last == 0xFF)
|
if (last == 0xFF)
|
||||||
return DC_STATUS_SUCCESS;
|
return DC_STATUS_SUCCESS;
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%02x 0x%02x).", first, last);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ cressi_edy_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v
|
|||||||
// Get the profile pointer.
|
// Get the profile pointer.
|
||||||
unsigned int eop = array_uint_le (logbook + layout->config + 2, layout->rb_logbook_size) * SZ_PAGE + layout->rb_profile_begin;
|
unsigned int eop = array_uint_le (logbook + layout->config + 2, layout->rb_logbook_size) * SZ_PAGE + layout->rb_profile_begin;
|
||||||
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x).", eop);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ cressi_edy_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v
|
|||||||
// Get the pointer to the profile data.
|
// Get the pointer to the profile data.
|
||||||
unsigned int current = array_uint_le (logbook + idx * layout->rb_logbook_size, layout->rb_logbook_size) * SZ_PAGE + layout->rb_profile_begin;
|
unsigned int current = array_uint_le (logbook + idx * layout->rb_logbook_size, layout->rb_logbook_size) * SZ_PAGE + layout->rb_profile_begin;
|
||||||
if (current < layout->rb_profile_begin || current >= layout->rb_profile_end) {
|
if (current < layout->rb_profile_begin || current >= layout->rb_profile_end) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x).", current);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +532,7 @@ cressi_edy_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v
|
|||||||
// Get the pointer to the profile data.
|
// Get the pointer to the profile data.
|
||||||
unsigned int current = array_uint_le (logbook + idx * layout->rb_logbook_size, layout->rb_logbook_size) * SZ_PAGE + layout->rb_profile_begin;
|
unsigned int current = array_uint_le (logbook + idx * layout->rb_logbook_size, layout->rb_logbook_size) * SZ_PAGE + layout->rb_profile_begin;
|
||||||
if (current < layout->rb_profile_begin || current >= layout->rb_profile_end) {
|
if (current < layout->rb_profile_begin || current >= layout->rb_profile_end) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x).", current);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,7 +343,7 @@ cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[]
|
|||||||
if (header < RB_PROFILE_BEGIN || header + 2 > RB_PROFILE_END ||
|
if (header < RB_PROFILE_BEGIN || header + 2 > RB_PROFILE_END ||
|
||||||
footer < RB_PROFILE_BEGIN || footer + 2 > RB_PROFILE_END)
|
footer < RB_PROFILE_BEGIN || footer + 2 > RB_PROFILE_END)
|
||||||
{
|
{
|
||||||
ERROR (context, "Invalid ringbuffer pointer detected.");
|
ERROR (context, "Invalid ringbuffer pointer detected (0x%04x 0x%04x).", header, footer);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[]
|
|||||||
unsigned int header2 = array_uint16_le (data + footer);
|
unsigned int header2 = array_uint16_le (data + footer);
|
||||||
unsigned int footer2 = array_uint16_le (data + header);
|
unsigned int footer2 = array_uint16_le (data + header);
|
||||||
if (header2 != header || footer2 != footer) {
|
if (header2 != header || footer2 != footer) {
|
||||||
ERROR (context, "Invalid ringbuffer pointer detected.");
|
ERROR (context, "Invalid ringbuffer pointer detected (0x%04x 0x%04x).", header2, footer2);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -381,7 +381,7 @@ diverite_nitekq_extract_dives (dc_device_t *abstract, const unsigned char data[]
|
|||||||
// Get the end of profile pointer.
|
// Get the end of profile pointer.
|
||||||
unsigned int eop = array_uint16_be(data + EOP);
|
unsigned int eop = array_uint16_be(data + EOP);
|
||||||
if (eop < RB_PROFILE_BEGIN || eop >= RB_PROFILE_END) {
|
if (eop < RB_PROFILE_BEGIN || eop >= RB_PROFILE_END) {
|
||||||
ERROR (context, "Invalid ringbuffer pointer detected.");
|
ERROR (context, "Invalid ringbuffer pointer detected (0x%04x).", eop);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ diverite_nitekq_extract_dives (dc_device_t *abstract, const unsigned char data[]
|
|||||||
// Get the address of the profile data.
|
// Get the address of the profile data.
|
||||||
unsigned int address = array_uint16_be(data + ADDRESS + i * 2);
|
unsigned int address = array_uint16_be(data + ADDRESS + i * 2);
|
||||||
if (address < RB_PROFILE_BEGIN || address >= RB_PROFILE_END) {
|
if (address < RB_PROFILE_BEGIN || address >= RB_PROFILE_END) {
|
||||||
ERROR (context, "Invalid ringbuffer pointer detected.");
|
ERROR (context, "Invalid ringbuffer pointer detected (0x%04x).", address);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -409,7 +409,7 @@ hw_frog_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void
|
|||||||
end < RB_PROFILE_BEGIN ||
|
end < RB_PROFILE_BEGIN ||
|
||||||
end >= RB_PROFILE_END)
|
end >= RB_PROFILE_END)
|
||||||
{
|
{
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%06x 0x%06x).", begin, end);
|
||||||
free (header);
|
free (header);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,11 +275,15 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser)
|
|||||||
gasmix[i].helium = data[19 + 2 * i + 1];
|
gasmix[i].helium = data[19 + 2 * i + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (initial < 1 || initial > ngasmixes) {
|
if (initial != 0xFF) {
|
||||||
ERROR(abstract->context, "Invalid initial gas mix.");
|
if (initial < 1 || initial > ngasmixes) {
|
||||||
return DC_STATUS_DATAFORMAT;
|
ERROR(abstract->context, "Invalid initial gas mix.");
|
||||||
|
return DC_STATUS_DATAFORMAT;
|
||||||
|
}
|
||||||
|
initial--; /* Convert to a zero based index. */
|
||||||
|
} else {
|
||||||
|
WARNING(abstract->context, "No initial gas mix available.");
|
||||||
}
|
}
|
||||||
initial--; /* Convert to a zero based index. */
|
|
||||||
|
|
||||||
// Cache the data for later use.
|
// Cache the data for later use.
|
||||||
parser->version = version;
|
parser->version = version;
|
||||||
@ -703,7 +707,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
|
|||||||
if (callback) callback (DC_SAMPLE_TIME, sample, userdata);
|
if (callback) callback (DC_SAMPLE_TIME, sample, userdata);
|
||||||
|
|
||||||
// Initial gas mix.
|
// Initial gas mix.
|
||||||
if (time == samplerate) {
|
if (time == samplerate && parser->initial != 0xFF) {
|
||||||
unsigned int idx = parser->initial;
|
unsigned int idx = parser->initial;
|
||||||
unsigned int o2 = parser->gasmix[idx].oxygen;
|
unsigned int o2 = parser->gasmix[idx].oxygen;
|
||||||
unsigned int he = parser->gasmix[idx].helium;
|
unsigned int he = parser->gasmix[idx].helium;
|
||||||
|
|||||||
@ -224,7 +224,7 @@ mares_common_extract_dives (dc_context_t *context, const mares_common_layout_t *
|
|||||||
// Get the end of the profile ring buffer.
|
// Get the end of the profile ring buffer.
|
||||||
unsigned int eop = array_uint16_le (data + 0x6B);
|
unsigned int eop = array_uint16_le (data + 0x6B);
|
||||||
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
||||||
ERROR (context, "Ringbuffer pointer out of range.");
|
ERROR (context, "Ringbuffer pointer out of range (0x%04x).", eop);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ mares_common_extract_dives (dc_context_t *context, const mares_common_layout_t *
|
|||||||
// something is wrong and an error is returned.
|
// something is wrong and an error is returned.
|
||||||
unsigned int length = array_uint16_le (buffer + offset);
|
unsigned int length = array_uint16_le (buffer + offset);
|
||||||
if (length != nbytes) {
|
if (length != nbytes) {
|
||||||
ERROR (context, "Calculated and stored size are not equal.");
|
ERROR (context, "Calculated and stored size are not equal (%u %u).", length, nbytes);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ mares_common_extract_dives (dc_context_t *context, const mares_common_layout_t *
|
|||||||
// equals the number of freedives in the profile data. If
|
// equals the number of freedives in the profile data. If
|
||||||
// both values are different, the profile data is incomplete.
|
// both values are different, the profile data is incomplete.
|
||||||
if (count != nsamples) {
|
if (count != nsamples) {
|
||||||
ERROR (context, "Unexpected number of freedive sessions.");
|
ERROR (context, "Unexpected number of freedive sessions (%u %u).", count, nsamples);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,14 +267,14 @@ mares_darwin_extract_dives (dc_device_t *abstract, const unsigned char data[], u
|
|||||||
// Get the profile pointer.
|
// Get the profile pointer.
|
||||||
unsigned int eop = array_uint16_be (data + 0x8A);
|
unsigned int eop = array_uint16_be (data + 0x8A);
|
||||||
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x).", eop);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the logbook index.
|
// Get the logbook index.
|
||||||
unsigned int last = data[0x8C];
|
unsigned int last = data[0x8C];
|
||||||
if (last >= layout->rb_logbook_count) {
|
if (last >= layout->rb_logbook_count) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%02x).", last);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -478,7 +478,7 @@ mares_iconhd_extract_dives (dc_device_t *abstract, const unsigned char data[], u
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
if (eop < layout->rb_profile_begin || eop >= layout->rb_profile_end) {
|
||||||
ERROR (context, "Ringbuffer pointer out of range.");
|
ERROR (context, "Ringbuffer pointer out of range (0x%08x).", eop);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -222,9 +222,9 @@ static const oceanic_common_layout_t oceanic_atom1_layout = {
|
|||||||
0x0000, /* cf_devinfo */
|
0x0000, /* cf_devinfo */
|
||||||
0x0040, /* cf_pointers */
|
0x0040, /* cf_pointers */
|
||||||
0x0240, /* rb_logbook_begin */
|
0x0240, /* rb_logbook_begin */
|
||||||
0x0A40, /* rb_logbook_end */
|
0x0440, /* rb_logbook_end */
|
||||||
8, /* rb_logbook_entry_size */
|
8, /* rb_logbook_entry_size */
|
||||||
0x0A40, /* rb_profile_begin */
|
0x0440, /* rb_profile_begin */
|
||||||
0x8000, /* rb_profile_end */
|
0x8000, /* rb_profile_end */
|
||||||
0, /* pt_mode_global */
|
0, /* pt_mode_global */
|
||||||
0 /* pt_mode_logbook */
|
0 /* pt_mode_logbook */
|
||||||
|
|||||||
@ -261,7 +261,7 @@ oceanic_common_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
|||||||
rb_logbook_last < layout->rb_logbook_begin ||
|
rb_logbook_last < layout->rb_logbook_begin ||
|
||||||
rb_logbook_last >= layout->rb_logbook_end)
|
rb_logbook_last >= layout->rb_logbook_end)
|
||||||
{
|
{
|
||||||
ERROR (abstract->context, "Invalid logbook pointer detected.");
|
ERROR (abstract->context, "Invalid logbook pointer detected (0x%04x 0x%04x).", rb_logbook_first, rb_logbook_last);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ oceanic_common_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
|||||||
rb_entry_last < layout->rb_profile_begin ||
|
rb_entry_last < layout->rb_profile_begin ||
|
||||||
rb_entry_last >= layout->rb_profile_end)
|
rb_entry_last >= layout->rb_profile_end)
|
||||||
{
|
{
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%06x 0x%06x).", rb_entry_first, rb_entry_last);
|
||||||
status = DC_STATUS_DATAFORMAT;
|
status = DC_STATUS_DATAFORMAT;
|
||||||
begin = current + layout->rb_logbook_entry_size;
|
begin = current + layout->rb_logbook_entry_size;
|
||||||
abort = 1;
|
abort = 1;
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
#define ESC_END 0xDC
|
#define ESC_END 0xDC
|
||||||
#define ESC_ESC 0xDD
|
#define ESC_ESC 0xDD
|
||||||
|
|
||||||
#define EXITCODE(n) ((n) < 0 ? (n) : 0)
|
#define EXITCODE(n) ((n) < 0 ? DC_STATUS_IO : DC_STATUS_TIMEOUT)
|
||||||
|
|
||||||
dc_status_t
|
dc_status_t
|
||||||
shearwater_common_open (shearwater_common_device_t *device, dc_context_t *context, const char *name)
|
shearwater_common_open (shearwater_common_device_t *device, dc_context_t *context, const char *name)
|
||||||
@ -173,7 +173,7 @@ shearwater_common_decompress_xor (unsigned char *data, unsigned int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static dc_status_t
|
||||||
shearwater_common_slip_write (shearwater_common_device_t *device, const unsigned char data[], unsigned int size)
|
shearwater_common_slip_write (shearwater_common_device_t *device, const unsigned char data[], unsigned int size)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -238,12 +238,12 @@ shearwater_common_slip_write (shearwater_common_device_t *device, const unsigned
|
|||||||
return EXITCODE(n);
|
return EXITCODE(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return DC_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static dc_status_t
|
||||||
shearwater_common_slip_read (shearwater_common_device_t *device, unsigned char data[], unsigned int size)
|
shearwater_common_slip_read (shearwater_common_device_t *device, unsigned char data[], unsigned int size, unsigned int *actual)
|
||||||
{
|
{
|
||||||
unsigned int received = 0;
|
unsigned int received = 0;
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ shearwater_common_slip_read (shearwater_common_device_t *device, unsigned char d
|
|||||||
// packets generated by the duplicate END characters which
|
// packets generated by the duplicate END characters which
|
||||||
// are sent to try to detect line noise.
|
// are sent to try to detect line noise.
|
||||||
if (received)
|
if (received)
|
||||||
return received;
|
goto done;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
case ESC:
|
case ESC:
|
||||||
@ -299,16 +299,25 @@ shearwater_common_slip_read (shearwater_common_device_t *device, unsigned char d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return received;
|
done:
|
||||||
|
|
||||||
|
if (received > size)
|
||||||
|
return DC_STATUS_PROTOCOL;
|
||||||
|
|
||||||
|
if (actual)
|
||||||
|
*actual = received;
|
||||||
|
|
||||||
|
return DC_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dc_status_t
|
dc_status_t
|
||||||
shearwater_common_transfer (shearwater_common_device_t *device, const unsigned char input[], unsigned int isize, unsigned char output[], unsigned int osize, unsigned int *actual)
|
shearwater_common_transfer (shearwater_common_device_t *device, const unsigned char input[], unsigned int isize, unsigned char output[], unsigned int osize, unsigned int *actual)
|
||||||
{
|
{
|
||||||
|
dc_status_t status = DC_STATUS_SUCCESS;
|
||||||
dc_device_t *abstract = (dc_device_t *) device;
|
dc_device_t *abstract = (dc_device_t *) device;
|
||||||
unsigned char packet[SZ_PACKET + 4];
|
unsigned char packet[SZ_PACKET + 4];
|
||||||
int n = 0;
|
unsigned int n = 0;
|
||||||
|
|
||||||
if (isize > SZ_PACKET || osize > SZ_PACKET)
|
if (isize > SZ_PACKET || osize > SZ_PACKET)
|
||||||
return DC_STATUS_INVALIDARGS;
|
return DC_STATUS_INVALIDARGS;
|
||||||
@ -324,13 +333,10 @@ shearwater_common_transfer (shearwater_common_device_t *device, const unsigned c
|
|||||||
memcpy (packet + 4, input, isize);
|
memcpy (packet + 4, input, isize);
|
||||||
|
|
||||||
// Send the request packet.
|
// Send the request packet.
|
||||||
n = shearwater_common_slip_write (device, packet, isize + 4);
|
status = shearwater_common_slip_write (device, packet, isize + 4);
|
||||||
if (n != isize + 4) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
ERROR (abstract->context, "Failed to send the request packet.");
|
ERROR (abstract->context, "Failed to send the request packet.");
|
||||||
if (n < 0)
|
return status;
|
||||||
return DC_STATUS_IO;
|
|
||||||
else
|
|
||||||
return DC_STATUS_TIMEOUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return early if no response packet is requested.
|
// Return early if no response packet is requested.
|
||||||
@ -341,15 +347,10 @@ shearwater_common_transfer (shearwater_common_device_t *device, const unsigned c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Receive the response packet.
|
// Receive the response packet.
|
||||||
n = shearwater_common_slip_read (device, packet, sizeof (packet));
|
status = shearwater_common_slip_read (device, packet, sizeof (packet), &n);
|
||||||
if (n <= 0 || n > sizeof (packet)) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
ERROR (abstract->context, "Failed to receive the response packet.");
|
ERROR (abstract->context, "Failed to receive the response packet.");
|
||||||
if (n < 0)
|
return status;
|
||||||
return DC_STATUS_IO;
|
|
||||||
else if (n > sizeof (packet))
|
|
||||||
return DC_STATUS_PROTOCOL;
|
|
||||||
else
|
|
||||||
return DC_STATUS_TIMEOUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the packet header.
|
// Validate the packet header.
|
||||||
|
|||||||
@ -293,7 +293,7 @@ suunto_common2_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
|||||||
begin < layout->rb_profile_begin ||
|
begin < layout->rb_profile_begin ||
|
||||||
begin >= layout->rb_profile_end)
|
begin >= layout->rb_profile_end)
|
||||||
{
|
{
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x 0x%04x 0x%04x %u).", begin, last, end, count);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ suunto_common2_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
|||||||
unsigned int size = RB_PROFILE_DISTANCE (layout, current, previous, 1);
|
unsigned int size = RB_PROFILE_DISTANCE (layout, current, previous, 1);
|
||||||
|
|
||||||
if (size < 4 || size > remaining) {
|
if (size < 4 || size > remaining) {
|
||||||
ERROR (abstract->context, "Unexpected profile size.");
|
ERROR (abstract->context, "Unexpected profile size (%u %u).", size, remaining);
|
||||||
free (data);
|
free (data);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
@ -400,12 +400,12 @@ suunto_common2_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
|||||||
next < layout->rb_profile_begin ||
|
next < layout->rb_profile_begin ||
|
||||||
next >= layout->rb_profile_end)
|
next >= layout->rb_profile_end)
|
||||||
{
|
{
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x 0x%04x).", prev, next);
|
||||||
free (data);
|
free (data);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
if (next != previous && next != current) {
|
if (next != previous && next != current) {
|
||||||
ERROR (abstract->context, "Profiles are not continuous.");
|
ERROR (abstract->context, "Profiles are not continuous (0x%04x 0x%04x 0x%04x).", current, next, previous);
|
||||||
free (data);
|
free (data);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
@ -422,7 +422,7 @@ suunto_common2_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
|||||||
return DC_STATUS_SUCCESS;
|
return DC_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERROR (abstract->context, "Skipping incomplete dive.");
|
ERROR (abstract->context, "Skipping incomplete dive (0x%04x 0x%04x 0x%04x).", current, next, previous);
|
||||||
status = DC_STATUS_DATAFORMAT;
|
status = DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -721,7 +721,7 @@ uwatec_smart_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsi
|
|||||||
*((unsigned int *) value) = array_uint16_le (data + table->divetime) * 60;
|
*((unsigned int *) value) = array_uint16_le (data + table->divetime) * 60;
|
||||||
break;
|
break;
|
||||||
case DC_FIELD_MAXDEPTH:
|
case DC_FIELD_MAXDEPTH:
|
||||||
*((double *) value) = array_uint16_le (data + table->maxdepth) / 100.0 * salinity;
|
*((double *) value) = array_uint16_le (data + table->maxdepth) / 100.0 / salinity;
|
||||||
break;
|
break;
|
||||||
case DC_FIELD_GASMIX_COUNT:
|
case DC_FIELD_GASMIX_COUNT:
|
||||||
*((unsigned int *) value) = parser->ngasmixes;
|
*((unsigned int *) value) = parser->ngasmixes;
|
||||||
@ -1164,7 +1164,7 @@ uwatec_smart_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (have_depth) {
|
if (have_depth) {
|
||||||
sample.depth = (depth - depth_calibration) * salinity;
|
sample.depth = (depth - depth_calibration) / salinity;
|
||||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -302,7 +302,7 @@ zeagle_n2ition3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba
|
|||||||
last < RB_LOGBOOK_BEGIN || last >= RB_LOGBOOK_END) {
|
last < RB_LOGBOOK_BEGIN || last >= RB_LOGBOOK_END) {
|
||||||
if (last == 0xFF)
|
if (last == 0xFF)
|
||||||
return DC_STATUS_SUCCESS;
|
return DC_STATUS_SUCCESS;
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%02x 0x%02x).", first, last);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ zeagle_n2ition3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba
|
|||||||
// Get the profile pointer.
|
// Get the profile pointer.
|
||||||
unsigned int eop = array_uint16_le (config + 0x7E);
|
unsigned int eop = array_uint16_le (config + 0x7E);
|
||||||
if (eop < RB_PROFILE_BEGIN || eop >= RB_PROFILE_END) {
|
if (eop < RB_PROFILE_BEGIN || eop >= RB_PROFILE_END) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x).", eop);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ zeagle_n2ition3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba
|
|||||||
// Get the pointer to the profile data.
|
// Get the pointer to the profile data.
|
||||||
unsigned int current = array_uint16_le (config + 2 * idx);
|
unsigned int current = array_uint16_le (config + 2 * idx);
|
||||||
if (current < RB_PROFILE_BEGIN || current >= RB_PROFILE_END) {
|
if (current < RB_PROFILE_BEGIN || current >= RB_PROFILE_END) {
|
||||||
ERROR (abstract->context, "Invalid ringbuffer pointer detected.");
|
ERROR (abstract->context, "Invalid ringbuffer pointer detected (0x%04x).", current);
|
||||||
return DC_STATUS_DATAFORMAT;
|
return DC_STATUS_DATAFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user