|
46 | 46 | #define LOG_RECORD_OPENING_5 0x15 |
47 | 47 | #define LOG_RECORD_OPENING_6 0x16 |
48 | 48 | #define LOG_RECORD_OPENING_7 0x17 |
| 49 | +#define LOG_RECORD_OPENING_8 0x18 |
| 50 | +#define LOG_RECORD_OPENING_9 0x19 |
49 | 51 | #define LOG_RECORD_CLOSING_0 0x20 |
50 | 52 | #define LOG_RECORD_CLOSING_1 0x21 |
51 | 53 | #define LOG_RECORD_CLOSING_2 0x22 |
|
54 | 56 | #define LOG_RECORD_CLOSING_5 0x25 |
55 | 57 | #define LOG_RECORD_CLOSING_6 0x26 |
56 | 58 | #define LOG_RECORD_CLOSING_7 0x27 |
| 59 | +#define LOG_RECORD_CLOSING_8 0x28 |
| 60 | +#define LOG_RECORD_CLOSING_9 0x29 |
57 | 61 | #define LOG_RECORD_INFO_EVENT 0x30 |
58 | 62 | #define LOG_RECORD_DIVE_SAMPLE_EXT 0xE1 |
59 | 63 | #define LOG_RECORD_FINAL 0xFF |
|
96 | 100 | #define NGASMIXES 20 |
97 | 101 | #define NFIXED 10 |
98 | 102 | #define NTANKS 6 |
99 | | -#define NRECORDS 8 |
| 103 | +#define NRECORDS 10 |
100 | 104 |
|
101 | 105 | #define PREDATOR 2 |
102 | 106 | #define PETREL 3 |
@@ -531,7 +535,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser) |
531 | 535 | } else if (type == LOG_RECORD_FREEDIVE_SAMPLE) { |
532 | 536 | // Freedive record |
533 | 537 | divemode = M_FREEDIVE; |
534 | | - } else if (type >= LOG_RECORD_OPENING_0 && type <= LOG_RECORD_OPENING_7) { |
| 538 | + } else if (type >= LOG_RECORD_OPENING_0 && type <= LOG_RECORD_OPENING_9) { |
535 | 539 | // Opening record |
536 | 540 | parser->opening[type - LOG_RECORD_OPENING_0] = offset; |
537 | 541 |
|
@@ -621,7 +625,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser) |
621 | 625 | memcpy (tank[3].name, data + offset + 12, sizeof (tank[3].name)); |
622 | 626 | } |
623 | 627 | } |
624 | | - } else if (type >= LOG_RECORD_CLOSING_0 && type <= LOG_RECORD_CLOSING_7) { |
| 628 | + } else if (type >= LOG_RECORD_CLOSING_0 && type <= LOG_RECORD_CLOSING_9) { |
625 | 629 | // Closing record |
626 | 630 | parser->closing[type - LOG_RECORD_CLOSING_0] = offset; |
627 | 631 | } else if (type == LOG_RECORD_FINAL) { |
@@ -752,11 +756,13 @@ shearwater_predator_parser_get_field (dc_parser_t *abstract, dc_field_type_t typ |
752 | 756 |
|
753 | 757 | unsigned int decomodel_idx = parser->pnf ? parser->opening[2] + 18 : 67; |
754 | 758 | unsigned int gf_idx = parser->pnf ? parser->opening[0] + 4 : 4; |
| 759 | + int latitude = 0, longitude = 0; |
755 | 760 |
|
756 | 761 | dc_gasmix_t *gasmix = (dc_gasmix_t *) value; |
757 | 762 | dc_tank_t *tank = (dc_tank_t *) value; |
758 | 763 | dc_salinity_t *water = (dc_salinity_t *) value; |
759 | 764 | dc_decomodel_t *decomodel = (dc_decomodel_t *) value; |
| 765 | + dc_location_t *location = (dc_location_t *) value; |
760 | 766 |
|
761 | 767 | if (value) { |
762 | 768 | switch (type) { |
@@ -865,6 +871,17 @@ shearwater_predator_parser_get_field (dc_parser_t *abstract, dc_field_type_t typ |
865 | 871 | return DC_STATUS_DATAFORMAT; |
866 | 872 | } |
867 | 873 | break; |
| 874 | + case DC_FIELD_LOCATION: |
| 875 | + if (parser->opening[9] == UNDEFINED || parser->logversion < 17) |
| 876 | + return DC_STATUS_UNSUPPORTED; |
| 877 | + latitude = (signed int) array_uint32_be (data + parser->opening[9] + 21); |
| 878 | + longitude = (signed int) array_uint32_be (data + parser->opening[9] + 25); |
| 879 | + if (latitude == 0 && longitude == 0) |
| 880 | + return DC_STATUS_UNSUPPORTED; |
| 881 | + location->latitude = latitude / 100000.0; |
| 882 | + location->longitude = longitude / 100000.0; |
| 883 | + location->altitude = 0.0; |
| 884 | + break; |
868 | 885 | default: |
869 | 886 | return DC_STATUS_UNSUPPORTED; |
870 | 887 | } |
|
0 commit comments