|
48 | 48 | #define LOG_RECORD_OPENING_5 0x15 |
49 | 49 | #define LOG_RECORD_OPENING_6 0x16 |
50 | 50 | #define LOG_RECORD_OPENING_7 0x17 |
| 51 | +#define LOG_RECORD_OPENING_8 0x18 |
| 52 | +#define LOG_RECORD_OPENING_9 0x19 |
51 | 53 | #define LOG_RECORD_CLOSING_0 0x20 |
52 | 54 | #define LOG_RECORD_CLOSING_1 0x21 |
53 | 55 | #define LOG_RECORD_CLOSING_2 0x22 |
|
56 | 58 | #define LOG_RECORD_CLOSING_5 0x25 |
57 | 59 | #define LOG_RECORD_CLOSING_6 0x26 |
58 | 60 | #define LOG_RECORD_CLOSING_7 0x27 |
| 61 | +#define LOG_RECORD_CLOSING_8 0x28 |
| 62 | +#define LOG_RECORD_CLOSING_9 0x29 |
59 | 63 | #define LOG_RECORD_INFO_EVENT 0x30 |
60 | 64 | #define LOG_RECORD_DIVE_SAMPLE_EXT 0xE1 |
61 | 65 | #define LOG_RECORD_FINAL 0xFF |
|
103 | 107 | #define NGASMIXES 20 |
104 | 108 | #define NFIXED 10 |
105 | 109 | #define NTANKS 6 |
106 | | -#define NRECORDS 8 |
| 110 | +#define NRECORDS 10 |
107 | 111 | #define MAXSTRINGS 32 |
108 | 112 |
|
109 | 113 | #define PREDATOR 2 |
@@ -657,7 +661,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser) |
657 | 661 | } else if (type == LOG_RECORD_FREEDIVE_SAMPLE) { |
658 | 662 | // Freedive record |
659 | 663 | divemode = M_FREEDIVE; |
660 | | - } else if (type >= LOG_RECORD_OPENING_0 && type <= LOG_RECORD_OPENING_7) { |
| 664 | + } else if (type >= LOG_RECORD_OPENING_0 && type <= LOG_RECORD_OPENING_9) { |
661 | 665 | // Opening record |
662 | 666 | parser->opening[type - LOG_RECORD_OPENING_0] = offset; |
663 | 667 |
|
@@ -760,7 +764,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser) |
760 | 764 | memcpy (tank[3].name, data + offset + 12, sizeof (tank[3].name)); |
761 | 765 | } |
762 | 766 | } |
763 | | - } else if (type >= LOG_RECORD_CLOSING_0 && type <= LOG_RECORD_CLOSING_7) { |
| 767 | + } else if (type >= LOG_RECORD_CLOSING_0 && type <= LOG_RECORD_CLOSING_9) { |
764 | 768 | if (type == LOG_RECORD_CLOSING_6) { |
765 | 769 | if (logversion >= 11) { |
766 | 770 | if (stack_time_total_s > 0) { |
@@ -991,11 +995,13 @@ shearwater_predator_parser_get_field (dc_parser_t *abstract, dc_field_type_t typ |
991 | 995 |
|
992 | 996 | unsigned int decomodel_idx = parser->pnf ? parser->opening[2] + 18 : 67; |
993 | 997 | unsigned int gf_idx = parser->pnf ? parser->opening[0] + 4 : 4; |
| 998 | + int latitude = 0, longitude = 0; |
994 | 999 |
|
995 | 1000 | dc_gasmix_t *gasmix = (dc_gasmix_t *) value; |
996 | 1001 | dc_tank_t *tank = (dc_tank_t *) value; |
997 | 1002 | dc_salinity_t *water = (dc_salinity_t *) value; |
998 | 1003 | dc_decomodel_t *decomodel = (dc_decomodel_t *) value; |
| 1004 | + dc_location_t *location = (dc_location_t *) value; |
999 | 1005 | dc_field_string_t *string = (dc_field_string_t *) value; |
1000 | 1006 |
|
1001 | 1007 | if (value) { |
@@ -1091,6 +1097,17 @@ shearwater_predator_parser_get_field (dc_parser_t *abstract, dc_field_type_t typ |
1091 | 1097 | return DC_STATUS_DATAFORMAT; |
1092 | 1098 | } |
1093 | 1099 | break; |
| 1100 | + case DC_FIELD_LOCATION: |
| 1101 | + if (parser->opening[9] == UNDEFINED || parser->logversion < 17) |
| 1102 | + return DC_STATUS_UNSUPPORTED; |
| 1103 | + latitude = (signed int) array_uint32_be (data + parser->opening[9] + 21); |
| 1104 | + longitude = (signed int) array_uint32_be (data + parser->opening[9] + 25); |
| 1105 | + if (latitude == 0 && longitude == 0) |
| 1106 | + return DC_STATUS_UNSUPPORTED; |
| 1107 | + location->latitude = latitude / 100000.0; |
| 1108 | + location->longitude = longitude / 100000.0; |
| 1109 | + location->altitude = 0.0; |
| 1110 | + break; |
1094 | 1111 | case DC_FIELD_STRING: |
1095 | 1112 | return dc_field_get_string(&parser->cache, flags, string); |
1096 | 1113 | default: |
|
0 commit comments