|
29 | 29 | extern "C" { |
30 | 30 | #endif /* __cplusplus */ |
31 | 31 |
|
| 32 | +/** |
| 33 | + * Opaque object representing a supported dive computer. |
| 34 | + */ |
32 | 35 | typedef struct dc_descriptor_t dc_descriptor_t; |
33 | 36 |
|
| 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 | + */ |
34 | 44 | dc_status_t |
35 | 45 | dc_descriptor_iterator (dc_iterator_t **iterator); |
36 | 46 |
|
| 47 | +/** |
| 48 | + * Free the device descriptor. |
| 49 | + * |
| 50 | + * @param[in] descriptor A valid device descriptor. |
| 51 | + */ |
37 | 52 | void |
38 | 53 | dc_descriptor_free (dc_descriptor_t *descriptor); |
39 | 54 |
|
| 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 | + */ |
40 | 61 | const char * |
41 | 62 | dc_descriptor_get_vendor (dc_descriptor_t *descriptor); |
42 | 63 |
|
| 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 | + */ |
43 | 71 | const char * |
44 | 72 | dc_descriptor_get_product (dc_descriptor_t *descriptor); |
45 | 73 |
|
| 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 | + */ |
46 | 81 | dc_family_t |
47 | 82 | dc_descriptor_get_type (dc_descriptor_t *descriptor); |
48 | 83 |
|
| 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 | + */ |
49 | 91 | unsigned int |
50 | 92 | dc_descriptor_get_model (dc_descriptor_t *descriptor); |
51 | 93 |
|
| 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 | + */ |
52 | 101 | unsigned int |
53 | 102 | dc_descriptor_get_transports (dc_descriptor_t *descriptor); |
54 | 103 |
|
| 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 | + */ |
55 | 119 | int |
56 | 120 | dc_descriptor_filter (dc_descriptor_t *descriptor, dc_transport_t transport, const void *userdata); |
57 | 121 |
|
|
0 commit comments