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 @@
#define __USBMUXD_H
/**
- * Array entry returned by 'usbmuxd_scan()' scanning.
- *
- * If more than one device is available, 'product_id' and
- * 'serial_number' and be analysed to help make a selection.
+ * Device information structure holding data to identify the device.
* The relevant 'handle' should be passed to 'usbmuxd_connect()', to
* start a proxy connection. The value 'handle' should be considered
* opaque and no presumption made about the meaning of its value.
@@ -13,22 +10,58 @@
typedef struct {
int handle;
int product_id;
- char serial_number[41];
-} usbmuxd_scan_result;
+ char uuid[41];
+} usbmuxd_device_info_t;
+
+/**
+ * event types for event callback function
+ */
+enum usbmuxd_device_event {
+ UE_DEVICE_ADD = 1,
+ UE_DEVICE_REMOVE
+};
+
+/**
+ * Event structure that will be passed to the callback function.
+ * 'event' will contains the type of the event, and 'device' will contains
+ * information about the device.
+ */
+typedef struct {
+ int event;
+ usbmuxd_device_info_t device;
+} usbmuxd_event_t;
+
+/**
+ * Callback function prototype.
+ */
+typedef void (*usbmuxd_event_cb_t) (const usbmuxd_event_t *event);
+
+/**
+ * Subscribe a callback function so that applications get to know about
+ * device add/remove events.
+ *
+ * @param callback A callback function that is executed when an event occurs.
+ *
+ * @return 0 on success or negative on error.
+ */
+int usbmuxd_subscribe(usbmuxd_event_cb_t callback);
+
+/**
+ * Unsubscribe callback.
+ *
+ * @return only 0 for now.
+ */
+int usbmuxd_unsubscribe();
/**
- * Contacts usbmuxd and performs a scan for connected devices.
+ * Contacts usbmuxd and retrieves a list of connected devices.
*
- * @param available_devices pointer to array of usbmuxd_scan_result.
- * Array of available devices. The required 'handle'
- * should be passed to 'usbmuxd_connect()'. The returned array
- * is zero-terminated for convenience; the final (unused)
- * entry containing handle == 0. The returned array pointer
- * should be freed by passing to 'free()' after use.
+ * @param available_devices pointer to an array of usbmuxd_device_info_t
+ * that will hold records of the connected devices.
*
* @return number of available devices, zero on no devices, or negative on error
*/
-int usbmuxd_scan(usbmuxd_scan_result **available_devices);
+int usbmuxd_scan(usbmuxd_device_info_t **available_devices);
/**
* Request proxy connect to