1DC_DEVICE_SET_EVENTS(3)  BSD Library Functions Manual  DC_DEVICE_SET_EVENTS(3)
2

NAME

4     dc_device_set_events — set events logged during device interaction
5

LIBRARY

7     library “libdivecomputer”
8

SYNOPSIS

10     #include <libdivecomputer/device.h>
11
12     typedef void
13     (*dc_event_callback_t)(dc_device_t *device, dc_event_type_t event,
14         const void *data, void *userdata);
15
16     dc_status_t
17     dc_device_set_events(dc_device_t *device, unsigned int events,
18         dc_event_callback_t callback, void *userdata);
19

DESCRIPTION

21     Register a series of event callbacks on a device opened with
22     dc_device_open(3).  Event callbacks are informative messages during
23     device processing passed to the callback function with an optional argu‐
24     ment userdata.
25
26     The events value is a bit-field of events, one of which is passed to the
27     callback as event.  The data field will be cast to an event-specific
28     type:
29
30     DC_EVENT_WAITING
31             Indicate that the device is waiting for user input, such as acti‐
32             vating the data transfer mode on the device.  No data is set.
33
34     DC_EVENT_PROGRESS
35             Progress metre of the parse.  The data variable is set to a
36             dc_event_progress_t, with the current and maximum progress values
37             from which one can compute a percentage.
38
39     DC_EVENT_DEVINFO
40             Sets the data value to a dc_event_devinfo_t, which can be used to
41             acquire the model, firmware, and serial numbers of the underlying
42             device.
43
44     DC_EVENT_CLOCK
45             Report the system (local machine) and device time in epoch sec‐
46             onds.  Fills in data as a dc_event_clock_t, with devtime being
47             the device and systime being the system time.  See time(3).
48
49     DC_EVENT_VENDOR
50             A vendor-specific event filling data as a dc_event_vendor_t.
51

RETURN VALUES

53     Returns DC_STATUS_SUCCESS on success or one of several error values on
54     error.
55

SEE ALSO

57     dc_device_open(3)
58

AUTHORS

60     The library “libdivecomputer” library was written by Jef Driesen,
61     jef@libdivecomputer.org.  These manpages were written by
62     Kristaps Dzonsons, kristaps@bsd.lv.
63
64BSD                             January 5, 2017                            BSD
Impressum