Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-DS9
Merge upstrean libdivecomputer updates from Jef Driesen: - a different way to work around the windows 'instance' craziness - minor updates to the Shearwater parser * git://github.com/libdivecomputer/libdivecomputer: Add support for parsing info events Add support for the Shearwater Peregrine Fix a conflict with the Windows header files Add a missing parameter for the USB HID filter
This commit is contained in:
commit
f33814c13c
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@ -344,6 +344,7 @@ static const dc_descriptor_t g_descriptors[] = {
|
||||
{"Shearwater", "Perdix AI", DC_FAMILY_SHEARWATER_PETREL, 6, DC_TRANSPORT_BLE, dc_filter_shearwater},
|
||||
{"Shearwater", "Nerd 2", DC_FAMILY_SHEARWATER_PETREL, 7, DC_TRANSPORT_BLE, dc_filter_shearwater},
|
||||
{"Shearwater", "Teric", DC_FAMILY_SHEARWATER_PETREL, 8, DC_TRANSPORT_BLE, dc_filter_shearwater},
|
||||
{"Shearwater", "Peregrine", DC_FAMILY_SHEARWATER_PETREL, 9, DC_TRANSPORT_BLE, dc_filter_shearwater},
|
||||
/* Dive Rite NiTek Q */
|
||||
{"Dive Rite", "NiTek Q", DC_FAMILY_DIVERITE_NITEKQ, 0, DC_TRANSPORT_SERIAL, NULL},
|
||||
/* Citizen Hyper Aqualand */
|
||||
@ -593,6 +594,7 @@ static int dc_filter_shearwater (dc_transport_t transport, const void *userdata,
|
||||
"NERD 2",
|
||||
"Perdix",
|
||||
"Teric",
|
||||
"Peregrine",
|
||||
};
|
||||
|
||||
if (transport == DC_TRANSPORT_BLUETOOTH || transport == DC_TRANSPORT_BLE) {
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ extern "C" {
|
||||
#define PERDIXAI 6
|
||||
#define NERD2 7
|
||||
#define TERIC 8
|
||||
#define PEREGRINE 9
|
||||
|
||||
#define NSTEPS 10000
|
||||
#define STEP(i,n) ((NSTEPS * (i) + (n) / 2) / (n))
|
||||
|
||||
@ -244,6 +244,9 @@ shearwater_petrel_device_foreach (dc_device_t *abstract, dc_dive_callback_t call
|
||||
case 0x1F0A:
|
||||
model = TERIC;
|
||||
break;
|
||||
case 0x1512:
|
||||
model = PEREGRINE;
|
||||
break;
|
||||
default:
|
||||
// return a model of 0 which is unknown
|
||||
WARNING (abstract->context, "Unknown hardware type %04x. Assuming Petrel.", hardware);
|
||||
|
||||
@ -55,6 +55,8 @@
|
||||
#define LOG_RECORD_INFO_EVENT 0x30
|
||||
#define LOG_RECORD_FINAL 0xFF
|
||||
|
||||
#define INFO_EVENT_TAG_LOG 38
|
||||
|
||||
#define SZ_BLOCK 0x80
|
||||
#define SZ_SAMPLE_PREDATOR 0x10
|
||||
#define SZ_SAMPLE_PETREL 0x20
|
||||
@ -961,6 +963,26 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal
|
||||
sample.temperature = temperature / 10.0;
|
||||
if (callback) callback (DC_SAMPLE_TEMPERATURE, sample, userdata);
|
||||
}
|
||||
} else if (type == LOG_RECORD_INFO_EVENT) {
|
||||
unsigned int event = data[offset + 1];
|
||||
unsigned int timestamp = array_uint32_be (data + offset + 4);
|
||||
unsigned int w1 = array_uint32_be (data + offset + 8);
|
||||
unsigned int w2 = array_uint32_be (data + offset + 12);
|
||||
|
||||
if (event == INFO_EVENT_TAG_LOG) {
|
||||
// Compass heading
|
||||
if (w1 != 0xFFFFFFFF) {
|
||||
sample.bearing = w1;
|
||||
if (callback) callback (DC_SAMPLE_BEARING, sample, userdata);
|
||||
}
|
||||
|
||||
// Tag
|
||||
sample.event.type = SAMPLE_EVENT_BOOKMARK;
|
||||
sample.event.time = 0;
|
||||
sample.event.flags = 0;
|
||||
sample.event.value = w2;
|
||||
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
|
||||
}
|
||||
}
|
||||
|
||||
offset += parser->samplesize;
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#define DC_SOCKET_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#include <windows.h>
|
||||
#else
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#endif
|
||||
#include <libusb.h>
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@ -43,6 +44,7 @@
|
||||
|
||||
#if defined(USE_LIBUSB)
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#endif
|
||||
#include <libusb.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user