Fix the decoding of the Suunto serial numbers.
The serial numbers were not decoded at all. The raw bytes where simply converted into an arbitrary 32 bit integer. Now the serial number matches the real serial number as shown by the device.
This commit is contained in:
parent
9854097092
commit
dbb6b1aa21
@ -268,7 +268,11 @@ suunto_common2_device_foreach (dc_device_t *abstract, dc_dive_callback_t callbac
|
||||
dc_event_devinfo_t devinfo;
|
||||
devinfo.model = device->version[0];
|
||||
devinfo.firmware = array_uint24_be (device->version + 1);
|
||||
devinfo.serial = array_uint32_be (serial);
|
||||
devinfo.serial = 0;
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
devinfo.serial *= 100;
|
||||
devinfo.serial += serial[i];
|
||||
}
|
||||
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
// Read the header bytes.
|
||||
|
||||
@ -227,7 +227,11 @@ suunto_eon_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, v
|
||||
dc_event_devinfo_t devinfo;
|
||||
devinfo.model = 0;
|
||||
devinfo.firmware = 0;
|
||||
devinfo.serial = array_uint24_be (data + 244);
|
||||
devinfo.serial = 0;
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
devinfo.serial *= 100;
|
||||
devinfo.serial += bcd2dec (data[244 + i]);
|
||||
}
|
||||
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
rc = suunto_eon_extract_dives (abstract,
|
||||
|
||||
@ -279,7 +279,11 @@ suunto_solution_device_foreach (dc_device_t *abstract, dc_dive_callback_t callba
|
||||
dc_event_devinfo_t devinfo;
|
||||
devinfo.model = 0;
|
||||
devinfo.firmware = 0;
|
||||
devinfo.serial = array_uint24_be (data + 0x1D);
|
||||
devinfo.serial = 0;
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
devinfo.serial *= 100;
|
||||
devinfo.serial += bcd2dec (data[0x1D + i]);
|
||||
}
|
||||
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
rc = suunto_solution_extract_dives (abstract,
|
||||
|
||||
@ -527,7 +527,11 @@ suunto_vyper_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback,
|
||||
dc_event_devinfo_t devinfo;
|
||||
devinfo.model = header[hoffset + 0];
|
||||
devinfo.firmware = header[hoffset + 1];
|
||||
devinfo.serial = array_uint32_be (header + hoffset + 2);
|
||||
devinfo.serial = 0;
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
devinfo.serial *= 100;
|
||||
devinfo.serial += header[hoffset + 2 + i];
|
||||
}
|
||||
device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
|
||||
|
||||
// Allocate a memory buffer.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user