dc_device_set_events —
set events logged during device interaction
library “libdivecomputer”
#include
  <libdivecomputer/device.h>
typedef void
  
  (*dc_event_callback_t)(dc_device_t
    *device, dc_event_type_t event,
    const void *data, void
    *userdata);
dc_status_t
  
  dc_device_set_events(dc_device_t
    *device, unsigned int events,
    dc_event_callback_t callback, void
    *userdata);
Register a series of event callbacks on a device opened with
  dc_device_open(3). Event
  callbacks are informative messages during device processing passed to the
  callback function with an optional argument
  userdata.
The events value is a bit-field of events,
    one of which is passed to the callback as
    event. The data field will be
    cast to an event-specific type:
  - DC_EVENT_WAITING
- Indicate that the device is waiting for user input, such as activating the
      data transfer mode on the device. No data is
    set.
- DC_EVENT_PROGRESS
- Progress metre of the parse. The data variable is
      set to a dc_event_progress_t, with the
      current and maximum progress
      values from which one can compute a percentage.
- DC_EVENT_DEVINFO
- Sets the data value to a
      dc_event_devinfo_t, which can be used to acquire the
      model, firmware, and
      serial numbers of the underlying device.
- DC_EVENT_CLOCK
- Report the system (local machine) and device time in epoch seconds. Fills
      in data as a dc_event_clock_t,
      with devtime being the device and
      systime being the system time. See
      time(3).
- DC_EVENT_VENDOR
- A vendor-specific event filling data as a
      dc_event_vendor_t.
ReturnsDC_STATUS_SUCCESS on success or one of several
  error values on error.