home | help
DC_DEVICE_SET_EVENTS(3)      Library Functions Manual	 DC_DEVICE_SET_EVENTS(3)

NAME
     dc_device_set_events -- set events logged during device interaction

LIBRARY
     libdivecomputer

SYNOPSIS
     #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);

DESCRIPTION
     Register  a  series  of  event  callbacks	on  a  device opened with dc_de-
     vice_open(3).  Event callbacks are informative messages during device  pro-
     cessing 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  acti-
	     vating 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.

RETURN VALUES
     Returns DC_STATUS_SUCCESS on success or one of several error values on  er-
     ror.

SEE ALSO
     dc_device_open(3)

AUTHORS
     The  libdivecomputer  library  was  written by Jef Driesen, jef@libdivecom-
     puter.org.  These manpages were written by
     Kristaps Dzonsons, kristaps@bsd.lv.

FreeBSD ports 15.quarterly	 January 5, 2017	 DC_DEVICE_SET_EVENTS(3)

home | help