From 8e05b915027e03c4427a3ae9e17421f23ab0cdbe Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 20 Feb 2009 12:24:47 +0000 Subject: [PATCH] Add a device info event for the Uwatec Aladin. --- src/uwatec_aladin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/uwatec_aladin.c b/src/uwatec_aladin.c index 29f081b..cddf78e 100644 --- a/src/uwatec_aladin.c +++ b/src/uwatec_aladin.c @@ -42,6 +42,7 @@ #define DISTANCE(a,b) ringbuffer_distance (a, b, 0, 0x600) +#define HEADER 4 typedef struct uwatec_aladin_device_t uwatec_aladin_device_t; @@ -257,12 +258,17 @@ uwatec_aladin_device_foreach (device_t *abstract, dive_callback_t callback, void if (rc != DEVICE_STATUS_SUCCESS) return rc; + // Emit a device info event. + device_devinfo_t devinfo; + devinfo.model = data[HEADER + 0x7bc]; + devinfo.firmware = 0; + devinfo.serial = (data[HEADER + 0x7ed] << 16) + (data[HEADER + 0x7ee] << 8) + data[HEADER + 0x7ef]; + device_event_emit (abstract, DEVICE_EVENT_DEVINFO, &devinfo); + return uwatec_aladin_extract_dives (data, sizeof (data), callback, userdata, device->timestamp); } -#define HEADER 4 - device_status_t uwatec_aladin_extract_dives (const unsigned char* data, unsigned int size, dive_callback_t callback, void *userdata, unsigned int timestamp) {