diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libimobiledevice/libimobiledevice.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h index c3b87cd..6851145 100644 --- a/include/libimobiledevice/libimobiledevice.h +++ b/include/libimobiledevice/libimobiledevice.h | |||
@@ -94,6 +94,9 @@ typedef struct { | |||
94 | /** Callback to notifiy if a device was added or removed. */ | 94 | /** Callback to notifiy if a device was added or removed. */ |
95 | typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data); | 95 | typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data); |
96 | 96 | ||
97 | /** Event subscription context type */ | ||
98 | typedef struct idevice_subscription_context* idevice_subscription_context_t; | ||
99 | |||
97 | /* functions */ | 100 | /* functions */ |
98 | 101 | ||
99 | /** | 102 | /** |
@@ -104,9 +107,36 @@ typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_dat | |||
104 | void idevice_set_debug_level(int level); | 107 | void idevice_set_debug_level(int level); |
105 | 108 | ||
106 | /** | 109 | /** |
107 | * Register a callback function that will be called when device add/remove | 110 | * Subscribe a callback function that will be called when device add/remove |
108 | * events occur. | 111 | * events occur. |
109 | * | 112 | * |
113 | * @param context A pointer to a idevice_subscription_context_t that will be | ||
114 | * set upon creation of the subscription. The returned context must be | ||
115 | * passed to idevice_events_unsubscribe() to unsubscribe the callback. | ||
116 | * @param callback Callback function to call. | ||
117 | * @param user_data Application-specific data passed as parameter | ||
118 | * to the registered callback function. | ||
119 | * | ||
120 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occurred. | ||
121 | */ | ||
122 | idevice_error_t idevice_events_subscribe(idevice_subscription_context_t *context, idevice_event_cb_t callback, void *user_data); | ||
123 | |||
124 | /** | ||
125 | * Unsubscribe the event callback function that has been registered with | ||
126 | * idevice_events_subscribe(). | ||
127 | * | ||
128 | * @param context A valid context as returned from idevice_events_subscribe(). | ||
129 | * | ||
130 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occurred. | ||
131 | */ | ||
132 | idevice_error_t idevice_events_unsubscribe(idevice_subscription_context_t context); | ||
133 | |||
134 | /** | ||
135 | * (DEPRECATED) Register a callback function that will be called when device add/remove | ||
136 | * events occur. | ||
137 | * | ||
138 | * @deprecated Use idevice_events_subscribe() instead. | ||
139 | * | ||
110 | * @param callback Callback function to call. | 140 | * @param callback Callback function to call. |
111 | * @param user_data Application-specific data passed as parameter | 141 | * @param user_data Application-specific data passed as parameter |
112 | * to the registered callback function. | 142 | * to the registered callback function. |
@@ -116,9 +146,11 @@ void idevice_set_debug_level(int level); | |||
116 | idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data); | 146 | idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data); |
117 | 147 | ||
118 | /** | 148 | /** |
119 | * Release the event callback function that has been registered with | 149 | * (DEPRECATED) Release the event callback function that has been registered with |
120 | * idevice_event_subscribe(). | 150 | * idevice_event_subscribe(). |
121 | * | 151 | * |
152 | * @deprecated Use idevice_events_unsubscribe() instead. | ||
153 | * | ||
122 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occurred. | 154 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occurred. |
123 | */ | 155 | */ |
124 | idevice_error_t idevice_event_unsubscribe(void); | 156 | idevice_error_t idevice_event_unsubscribe(void); |