Skip to content

Commit fe9b47f

Browse files
committed
Document the device descriptor functions
1 parent ed87113 commit fe9b47f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

include/libdivecomputer/descriptor.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,93 @@
2929
extern "C" {
3030
#endif /* __cplusplus */
3131

32+
/**
33+
* Opaque object representing a supported dive computer.
34+
*/
3235
typedef struct dc_descriptor_t dc_descriptor_t;
3336

37+
/**
38+
* Create an iterator to enumerate the supported dive computers.
39+
*
40+
* @param[out] iterator A location to store the iterator.
41+
* @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
42+
* on failure.
43+
*/
3444
dc_status_t
3545
dc_descriptor_iterator (dc_iterator_t **iterator);
3646

47+
/**
48+
* Free the device descriptor.
49+
*
50+
* @param[in] descriptor A valid device descriptor.
51+
*/
3752
void
3853
dc_descriptor_free (dc_descriptor_t *descriptor);
3954

55+
/**
56+
* Get the vendor name of the dive computer.
57+
*
58+
* @param[in] descriptor A valid device descriptor.
59+
* @returns The vendor name of the dive computer on success, or NULL on failure.
60+
*/
4061
const char *
4162
dc_descriptor_get_vendor (dc_descriptor_t *descriptor);
4263

64+
/**
65+
* Get the product name of the dive computer.
66+
*
67+
* @param[in] descriptor A valid device descriptor.
68+
* @returns The product name of the dive computer on success, or NULL on
69+
* failure.
70+
*/
4371
const char *
4472
dc_descriptor_get_product (dc_descriptor_t *descriptor);
4573

74+
/**
75+
* Get the family type of the dive computer.
76+
*
77+
* @param[in] descriptor A valid device descriptor.
78+
* @returns The family type of the dive computer on success, or DC_FAMILY_NULL
79+
* on failure.
80+
*/
4681
dc_family_t
4782
dc_descriptor_get_type (dc_descriptor_t *descriptor);
4883

84+
/**
85+
* Get the model number of the dive computer.
86+
*
87+
* @param[in] descriptor A valid device descriptor.
88+
* @returns The model number of the dive computer on success, or zero on
89+
* failure.
90+
*/
4991
unsigned int
5092
dc_descriptor_get_model (dc_descriptor_t *descriptor);
5193

94+
/**
95+
* Get all transports supported by the dive computer.
96+
*
97+
* @param[in] descriptor A valid device descriptor.
98+
* @returns A bitmask with all the transports supported by the dive computer on
99+
* success, or DC_TRANSPORT_NONE on failure.
100+
*/
52101
unsigned int
53102
dc_descriptor_get_transports (dc_descriptor_t *descriptor);
54103

104+
/**
105+
* Check if a low-level I/O device matches a supported dive computer.
106+
*
107+
* @param[in] descriptor A valid device descriptor.
108+
* @param[in] transport The transport type of the I/O device.
109+
* @param[in] userdata A pointer to a transport specific data structure:
110+
* - DC_TRANSPORT_SERIAL: Name of the device node (string)
111+
* - DC_TRANSPORT_USB: USB VID/PID (#dc_usb_desc_t)
112+
* - DC_TRANSPORT_USBHID: USB VID/PID (#dc_usbhid_desc_t)
113+
* - DC_TRANSPORT_IRDA: IrDA device name (string)
114+
* - DC_TRANSPORT_BLUETOOTH: Bluetooth device name (string)
115+
* - DC_TRANSPORT_BLE: Bluetooth device name (string)
116+
* @returns Non-zero if the device matches a supported dive computer, or zero if
117+
* there is no match.
118+
*/
55119
int
56120
dc_descriptor_filter (dc_descriptor_t *descriptor, dc_transport_t transport, const void *userdata);
57121

0 commit comments

Comments
 (0)