summaryrefslogtreecommitdiffstats
path: root/libusbmuxd/usbmuxd.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-08-20 01:19:09 +0200
committerGravatar Hector Martin2009-08-21 03:08:18 +0200
commitc46062aca98f2f077b3bab5c5f72ff2cb57b9dc2 (patch)
tree0934caaa277436a42c515c9ccc86acb004620c7a /libusbmuxd/usbmuxd.h
parent886d4014509d64023ecf99b57d0fd39818e85bd4 (diff)
downloadusbmuxd-c46062aca98f2f077b3bab5c5f72ff2cb57b9dc2.tar.gz
usbmuxd-c46062aca98f2f077b3bab5c5f72ff2cb57b9dc2.tar.bz2
Updated usbmuxd protocol definition and public header.
[Hector] Merged by putting utils.c into a common dir, avoiding log.c dependency for libusbmuxd, adding CMake magic to tie things up.
Diffstat (limited to 'libusbmuxd/usbmuxd.h')
-rw-r--r--libusbmuxd/usbmuxd.h61
1 files changed, 47 insertions, 14 deletions
diff --git a/libusbmuxd/usbmuxd.h b/libusbmuxd/usbmuxd.h
index ba45ec3..f12ae39 100644
--- a/libusbmuxd/usbmuxd.h
+++ b/libusbmuxd/usbmuxd.h
@@ -2,10 +2,7 @@
2#define __USBMUXD_H 2#define __USBMUXD_H
3 3
4/** 4/**
5 * Array entry returned by 'usbmuxd_scan()' scanning. 5 * Device information structure holding data to identify the device.
6 *
7 * If more than one device is available, 'product_id' and
8 * 'serial_number' and be analysed to help make a selection.
9 * The relevant 'handle' should be passed to 'usbmuxd_connect()', to 6 * The relevant 'handle' should be passed to 'usbmuxd_connect()', to
10 * start a proxy connection. The value 'handle' should be considered 7 * start a proxy connection. The value 'handle' should be considered
11 * opaque and no presumption made about the meaning of its value. 8 * opaque and no presumption made about the meaning of its value.
@@ -13,22 +10,58 @@
13typedef struct { 10typedef struct {
14 int handle; 11 int handle;
15 int product_id; 12 int product_id;
16 char serial_number[41]; 13 char uuid[41];
17} usbmuxd_scan_result; 14} usbmuxd_device_info_t;
15
16/**
17 * event types for event callback function
18 */
19enum usbmuxd_device_event {
20 UE_DEVICE_ADD = 1,
21 UE_DEVICE_REMOVE
22};
23
24/**
25 * Event structure that will be passed to the callback function.
26 * 'event' will contains the type of the event, and 'device' will contains
27 * information about the device.
28 */
29typedef struct {
30 int event;
31 usbmuxd_device_info_t device;
32} usbmuxd_event_t;
33
34/**
35 * Callback function prototype.
36 */
37typedef void (*usbmuxd_event_cb_t) (const usbmuxd_event_t *event);
38
39/**
40 * Subscribe a callback function so that applications get to know about
41 * device add/remove events.
42 *
43 * @param callback A callback function that is executed when an event occurs.
44 *
45 * @return 0 on success or negative on error.
46 */
47int usbmuxd_subscribe(usbmuxd_event_cb_t callback);
48
49/**
50 * Unsubscribe callback.
51 *
52 * @return only 0 for now.
53 */
54int usbmuxd_unsubscribe();
18 55
19/** 56/**
20 * Contacts usbmuxd and performs a scan for connected devices. 57 * Contacts usbmuxd and retrieves a list of connected devices.
21 * 58 *
22 * @param available_devices pointer to array of usbmuxd_scan_result. 59 * @param available_devices pointer to an array of usbmuxd_device_info_t
23 * Array of available devices. The required 'handle' 60 * that will hold records of the connected devices.
24 * should be passed to 'usbmuxd_connect()'. The returned array
25 * is zero-terminated for convenience; the final (unused)
26 * entry containing handle == 0. The returned array pointer
27 * should be freed by passing to 'free()' after use.
28 * 61 *
29 * @return number of available devices, zero on no devices, or negative on error 62 * @return number of available devices, zero on no devices, or negative on error
30 */ 63 */
31int usbmuxd_scan(usbmuxd_scan_result **available_devices); 64int usbmuxd_scan(usbmuxd_device_info_t **available_devices);
32 65
33/** 66/**
34 * Request proxy connect to 67 * Request proxy connect to