diff --git a/src/mares_nemo.c b/src/mares_nemo.c index 7dc9659..8751442 100644 --- a/src/mares_nemo.c +++ b/src/mares_nemo.c @@ -29,6 +29,7 @@ #include "serial.h" #include "utils.h" #include "checksum.h" +#include "array.h" #define EXITCODE(rc) \ ( \ @@ -274,6 +275,14 @@ mares_nemo_device_foreach (device_t *abstract, dive_callback_t callback, void *u return rc; } + // Emit a device info event. + unsigned char *data = dc_buffer_get_data (buffer); + device_devinfo_t devinfo; + devinfo.model = 0; + devinfo.firmware = 0; + devinfo.serial = array_uint16_be (data + 8); + device_event_emit (abstract, DEVICE_EVENT_DEVINFO, &devinfo); + rc = mares_nemo_extract_dives (abstract, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), callback, userdata); diff --git a/src/mares_puck.c b/src/mares_puck.c index 5b1efb5..c4b1f71 100644 --- a/src/mares_puck.c +++ b/src/mares_puck.c @@ -29,6 +29,7 @@ #include "serial.h" #include "utils.h" #include "checksum.h" +#include "array.h" #define EXITCODE(rc) \ ( \ @@ -372,6 +373,14 @@ mares_puck_device_foreach (device_t *abstract, dive_callback_t callback, void *u return rc; } + // Emit a device info event. + unsigned char *data = dc_buffer_get_data (buffer); + device_devinfo_t devinfo; + devinfo.model = 0; + devinfo.firmware = 0; + devinfo.serial = array_uint16_be (data + 8); + device_event_emit (abstract, DEVICE_EVENT_DEVINFO, &devinfo); + rc = mares_puck_extract_dives (abstract, dc_buffer_get_data (buffer), dc_buffer_get_size (buffer), callback, userdata);