diff options
| author | 2014-03-27 10:07:09 -0400 | |
|---|---|---|
| committer | 2014-03-27 21:40:43 -0400 | |
| commit | 2342dc5b4ef148b993fbe3816f3facdef8365546 (patch) | |
| tree | 69f812d91b2fc07db0fad5dcba6c80d2f8b6849e /include/libimobiledevice/notification_proxy.h | |
| parent | ee82e861a8c942b5013accd7589cf898d1f97167 (diff) | |
| download | libimobiledevice-2342dc5b4ef148b993fbe3816f3facdef8365546.tar.gz libimobiledevice-2342dc5b4ef148b993fbe3816f3facdef8365546.tar.bz2 | |
Moved Doxygen comments from source files to public headers.
Conflicts:
include/libimobiledevice/afc.h
Diffstat (limited to 'include/libimobiledevice/notification_proxy.h')
| -rw-r--r-- | include/libimobiledevice/notification_proxy.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/include/libimobiledevice/notification_proxy.h b/include/libimobiledevice/notification_proxy.h index 4f025ee..a66057b 100644 --- a/include/libimobiledevice/notification_proxy.h +++ b/include/libimobiledevice/notification_proxy.h | |||
| @@ -93,13 +93,103 @@ typedef np_client_private *np_client_t; /**< The client handle. */ | |||
| 93 | typedef void (*np_notify_cb_t) (const char *notification, void *user_data); | 93 | typedef void (*np_notify_cb_t) (const char *notification, void *user_data); |
| 94 | 94 | ||
| 95 | /* Interface */ | 95 | /* Interface */ |
| 96 | |||
| 97 | /** | ||
| 98 | * Connects to the notification_proxy on the specified device. | ||
| 99 | * | ||
| 100 | * @param device The device to connect to. | ||
| 101 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 102 | * @param client Pointer that will be set to a newly allocated np_client_t | ||
| 103 | * upon successful return. | ||
| 104 | * | ||
| 105 | * @return NP_E_SUCCESS on success, NP_E_INVALID_ARG when device is NULL, | ||
| 106 | * or NP_E_CONN_FAILED when the connection to the device could not be | ||
| 107 | * established. | ||
| 108 | */ | ||
| 96 | np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client); | 109 | np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client); |
| 110 | |||
| 111 | /** | ||
| 112 | * Starts a new notification proxy service on the specified device and connects to it. | ||
| 113 | * | ||
| 114 | * @param device The device to connect to. | ||
| 115 | * @param client Pointer that will point to a newly allocated | ||
| 116 | * np_client_t upon successful return. Must be freed using | ||
| 117 | * np_client_free() after use. | ||
| 118 | * @param label The label to use for communication. Usually the program name. | ||
| 119 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 120 | * | ||
| 121 | * @return NP_E_SUCCESS on success, or an NP_E_* error | ||
| 122 | * code otherwise. | ||
| 123 | */ | ||
| 97 | np_error_t np_client_start_service(idevice_t device, np_client_t* client, const char* label); | 124 | np_error_t np_client_start_service(idevice_t device, np_client_t* client, const char* label); |
| 125 | |||
| 126 | /** | ||
| 127 | * Disconnects a notification_proxy client from the device and frees up the | ||
| 128 | * notification_proxy client data. | ||
| 129 | * | ||
| 130 | * @param client The notification_proxy client to disconnect and free. | ||
| 131 | * | ||
| 132 | * @return NP_E_SUCCESS on success, or NP_E_INVALID_ARG when client is NULL. | ||
| 133 | */ | ||
| 98 | np_error_t np_client_free(np_client_t client); | 134 | np_error_t np_client_free(np_client_t client); |
| 99 | 135 | ||
| 136 | |||
| 137 | /** | ||
| 138 | * Sends a notification to the device's notification_proxy. | ||
| 139 | * | ||
| 140 | * @param client The client to send to | ||
| 141 | * @param notification The notification message to send | ||
| 142 | * | ||
| 143 | * @return NP_E_SUCCESS on success, or an error returned by np_plist_send | ||
| 144 | */ | ||
| 100 | np_error_t np_post_notification(np_client_t client, const char *notification); | 145 | np_error_t np_post_notification(np_client_t client, const char *notification); |
| 146 | |||
| 147 | /** | ||
| 148 | * Tells the device to send a notification on the specified event. | ||
| 149 | * | ||
| 150 | * @param client The client to send to | ||
| 151 | * @param notification The notifications that should be observed. | ||
| 152 | * | ||
| 153 | * @return NP_E_SUCCESS on success, NP_E_INVALID_ARG when client or | ||
| 154 | * notification are NULL, or an error returned by np_plist_send. | ||
| 155 | */ | ||
| 101 | np_error_t np_observe_notification(np_client_t client, const char *notification); | 156 | np_error_t np_observe_notification(np_client_t client, const char *notification); |
| 157 | |||
| 158 | /** | ||
| 159 | * Tells the device to send a notification on specified events. | ||
| 160 | * | ||
| 161 | * @param client The client to send to | ||
| 162 | * @param notification_spec Specification of the notifications that should be | ||
| 163 | * observed. This is expected to be an array of const char* that MUST have a | ||
| 164 | * terminating NULL entry. | ||
| 165 | * | ||
| 166 | * @return NP_E_SUCCESS on success, NP_E_INVALID_ARG when client is null, | ||
| 167 | * or an error returned by np_observe_notification. | ||
| 168 | */ | ||
| 102 | np_error_t np_observe_notifications(np_client_t client, const char **notification_spec); | 169 | np_error_t np_observe_notifications(np_client_t client, const char **notification_spec); |
| 170 | |||
| 171 | /** | ||
| 172 | * This function allows an application to define a callback function that will | ||
| 173 | * be called when a notification has been received. | ||
| 174 | * It will start a thread that polls for notifications and calls the callback | ||
| 175 | * function if a notification has been received. | ||
| 176 | * In case of an error condition when polling for notifications - e.g. device | ||
| 177 | * disconnect - the thread will call the callback function with an empty | ||
| 178 | * notification "" and terminate itself. | ||
| 179 | * | ||
| 180 | * @param client the NP client | ||
| 181 | * @param notify_cb pointer to a callback function or NULL to de-register a | ||
| 182 | * previously set callback function. | ||
| 183 | * @param user_data Pointer that will be passed to the callback function as | ||
| 184 | * user data. If notify_cb is NULL, this parameter is ignored. | ||
| 185 | * | ||
| 186 | * @note Only one callback function can be registered at the same time; | ||
| 187 | * any previously set callback function will be removed automatically. | ||
| 188 | * | ||
| 189 | * @return NP_E_SUCCESS when the callback was successfully registered, | ||
| 190 | * NP_E_INVALID_ARG when client is NULL, or NP_E_UNKNOWN_ERROR when | ||
| 191 | * the callback thread could no be created. | ||
| 192 | */ | ||
| 103 | np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb, void *userdata); | 193 | np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb, void *userdata); |
| 104 | 194 | ||
| 105 | #ifdef __cplusplus | 195 | #ifdef __cplusplus |
