|
91 | 91 | #define CMD_OBJ_ODD 0xFE
|
92 | 92 |
|
93 | 93 | #define OBJ_DEVICE 0x2000
|
| 94 | +#define OBJ_DEVICE_MODEL 0x02 |
94 | 95 | #define OBJ_DEVICE_SERIAL 0x04
|
95 | 96 | #define OBJ_LOGBOOK 0x2008
|
96 | 97 | #define OBJ_LOGBOOK_COUNT 0x01
|
@@ -1033,6 +1034,26 @@ mares_iconhd_device_foreach_object (dc_device_t *abstract, dc_dive_callback_t ca
|
1033 | 1034 | return DC_STATUS_NOMEMORY;
|
1034 | 1035 | }
|
1035 | 1036 |
|
| 1037 | + // Read the model number. |
| 1038 | + rc = mares_iconhd_read_object (device, NULL, buffer, OBJ_DEVICE, OBJ_DEVICE_MODEL); |
| 1039 | + if (rc != DC_STATUS_SUCCESS) { |
| 1040 | + ERROR (abstract->context, "Failed to read the model number."); |
| 1041 | + dc_buffer_free (buffer); |
| 1042 | + return rc; |
| 1043 | + } |
| 1044 | + |
| 1045 | + if (dc_buffer_get_size (buffer) < 4) { |
| 1046 | + ERROR (abstract->context, "Unexpected number of bytes received (" DC_PRINTF_SIZE ").", |
| 1047 | + dc_buffer_get_size (buffer)); |
| 1048 | + dc_buffer_free (buffer); |
| 1049 | + return DC_STATUS_PROTOCOL; |
| 1050 | + } |
| 1051 | + |
| 1052 | + unsigned int DC_ATTR_UNUSED model = array_uint32_le (dc_buffer_get_data (buffer)); |
| 1053 | + |
| 1054 | + // Erase the buffer. |
| 1055 | + dc_buffer_clear (buffer); |
| 1056 | + |
1036 | 1057 | // Read the serial number.
|
1037 | 1058 | rc = mares_iconhd_read_object (device, NULL, buffer, OBJ_DEVICE, OBJ_DEVICE_SERIAL);
|
1038 | 1059 | if (rc != DC_STATUS_SUCCESS) {
|
|
0 commit comments