diff options
Diffstat (limited to 'src/notification_proxy.c')
| -rw-r--r-- | src/notification_proxy.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/notification_proxy.c b/src/notification_proxy.c index 1ccda6b..909ede4 100644 --- a/src/notification_proxy.c +++ b/src/notification_proxy.c | |||
| @@ -86,18 +86,6 @@ static np_error_t np_error(property_list_service_error_t err) | |||
| 86 | return NP_E_UNKNOWN_ERROR; | 86 | return NP_E_UNKNOWN_ERROR; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /** | ||
| 90 | * Connects to the notification_proxy on the specified device. | ||
| 91 | * | ||
| 92 | * @param device The device to connect to. | ||
| 93 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 94 | * @param client Pointer that will be set to a newly allocated np_client_t | ||
| 95 | * upon successful return. | ||
| 96 | * | ||
| 97 | * @return NP_E_SUCCESS on success, NP_E_INVALID_ARG when device is NULL, | ||
| 98 | * or NP_E_CONN_FAILED when the connection to the device could not be | ||
| 99 | * established. | ||
| 100 | */ | ||
| 101 | np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client) | 89 | np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client) |
| 102 | { | 90 | { |
| 103 | property_list_service_client_t plistclient = NULL; | 91 | property_list_service_client_t plistclient = NULL; |
| @@ -116,19 +104,6 @@ np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t servic | |||
| 116 | return NP_E_SUCCESS; | 104 | return NP_E_SUCCESS; |
| 117 | } | 105 | } |
| 118 | 106 | ||
| 119 | /** | ||
| 120 | * Starts a new notification proxy service on the specified device and connects to it. | ||
| 121 | * | ||
| 122 | * @param device The device to connect to. | ||
| 123 | * @param client Pointer that will point to a newly allocated | ||
| 124 | * np_client_t upon successful return. Must be freed using | ||
| 125 | * np_client_free() after use. | ||
| 126 | * @param label The label to use for communication. Usually the program name. | ||
| 127 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 128 | * | ||
| 129 | * @return NP_E_SUCCESS on success, or an NP_E_* error | ||
| 130 | * code otherwise. | ||
| 131 | */ | ||
| 132 | np_error_t np_client_start_service(idevice_t device, np_client_t* client, const char* label) | 107 | np_error_t np_client_start_service(idevice_t device, np_client_t* client, const char* label) |
| 133 | { | 108 | { |
| 134 | np_error_t err = NP_E_UNKNOWN_ERROR; | 109 | np_error_t err = NP_E_UNKNOWN_ERROR; |
| @@ -136,14 +111,6 @@ np_error_t np_client_start_service(idevice_t device, np_client_t* client, const | |||
| 136 | return err; | 111 | return err; |
| 137 | } | 112 | } |
| 138 | 113 | ||
| 139 | /** | ||
| 140 | * Disconnects a notification_proxy client from the device and frees up the | ||
| 141 | * notification_proxy client data. | ||
| 142 | * | ||
| 143 | * @param client The notification_proxy client to disconnect and free. | ||
| 144 | * | ||
| 145 | * @return NP_E_SUCCESS on success, or NP_E_INVALID_ARG when client is NULL. | ||
| 146 | */ | ||
| 147 | np_error_t np_client_free(np_client_t client) | 114 | np_error_t np_client_free(np_client_t client) |
| 148 | { | 115 | { |
| 149 | if (!client) | 116 | if (!client) |
| @@ -161,14 +128,6 @@ np_error_t np_client_free(np_client_t client) | |||
| 161 | return NP_E_SUCCESS; | 128 | return NP_E_SUCCESS; |
| 162 | } | 129 | } |
| 163 | 130 | ||
| 164 | /** | ||
| 165 | * Sends a notification to the device's notification_proxy. | ||
| 166 | * | ||
| 167 | * @param client The client to send to | ||
| 168 | * @param notification The notification message to send | ||
| 169 | * | ||
| 170 | * @return NP_E_SUCCESS on success, or an error returned by np_plist_send | ||
| 171 | */ | ||
| 172 | np_error_t np_post_notification(np_client_t client, const char *notification) | 131 | np_error_t np_post_notification(np_client_t client, const char *notification) |
| 173 | { | 132 | { |
| 174 | if (!client || !notification) { | 133 | if (!client || !notification) { |
| @@ -220,15 +179,6 @@ np_error_t np_post_notification(np_client_t client, const char *notification) | |||
| 220 | return res; | 179 | return res; |
| 221 | } | 180 | } |
| 222 | 181 | ||
| 223 | /** | ||
| 224 | * Tells the device to send a notification on the specified event. | ||
| 225 | * | ||
| 226 | * @param client The client to send to | ||
| 227 | * @param notification The notifications that should be observed. | ||
| 228 | * | ||
| 229 | * @return NP_E_SUCCESS on success, NP_E_INVALID_ARG when client or | ||
| 230 | * notification are NULL, or an error returned by np_plist_send. | ||
| 231 | */ | ||
| 232 | np_error_t np_observe_notification( np_client_t client, const char *notification ) | 182 | np_error_t np_observe_notification( np_client_t client, const char *notification ) |
| 233 | { | 183 | { |
| 234 | if (!client || !notification) { | 184 | if (!client || !notification) { |
| @@ -250,17 +200,6 @@ np_error_t np_observe_notification( np_client_t client, const char *notification | |||
| 250 | return res; | 200 | return res; |
| 251 | } | 201 | } |
| 252 | 202 | ||
| 253 | /** | ||
| 254 | * Tells the device to send a notification on specified events. | ||
| 255 | * | ||
| 256 | * @param client The client to send to | ||
| 257 | * @param notification_spec Specification of the notifications that should be | ||
| 258 | * observed. This is expected to be an array of const char* that MUST have a | ||
| 259 | * terminating NULL entry. | ||
| 260 | * | ||
| 261 | * @return NP_E_SUCCESS on success, NP_E_INVALID_ARG when client is null, | ||
| 262 | * or an error returned by np_observe_notification. | ||
| 263 | */ | ||
| 264 | np_error_t np_observe_notifications(np_client_t client, const char **notification_spec) | 203 | np_error_t np_observe_notifications(np_client_t client, const char **notification_spec) |
| 265 | { | 204 | { |
| 266 | int i = 0; | 205 | int i = 0; |
| @@ -390,28 +329,6 @@ void* np_notifier( void* arg ) | |||
| 390 | return NULL; | 329 | return NULL; |
| 391 | } | 330 | } |
| 392 | 331 | ||
| 393 | /** | ||
| 394 | * This function allows an application to define a callback function that will | ||
| 395 | * be called when a notification has been received. | ||
| 396 | * It will start a thread that polls for notifications and calls the callback | ||
| 397 | * function if a notification has been received. | ||
| 398 | * In case of an error condition when polling for notifications - e.g. device | ||
| 399 | * disconnect - the thread will call the callback function with an empty | ||
| 400 | * notification "" and terminate itself. | ||
| 401 | * | ||
| 402 | * @param client the NP client | ||
| 403 | * @param notify_cb pointer to a callback function or NULL to de-register a | ||
| 404 | * previously set callback function. | ||
| 405 | * @param user_data Pointer that will be passed to the callback function as | ||
| 406 | * user data. If notify_cb is NULL, this parameter is ignored. | ||
| 407 | * | ||
| 408 | * @note Only one callback function can be registered at the same time; | ||
| 409 | * any previously set callback function will be removed automatically. | ||
| 410 | * | ||
| 411 | * @return NP_E_SUCCESS when the callback was successfully registered, | ||
| 412 | * NP_E_INVALID_ARG when client is NULL, or NP_E_UNKNOWN_ERROR when | ||
| 413 | * the callback thread could no be created. | ||
| 414 | */ | ||
| 415 | np_error_t np_set_notify_callback( np_client_t client, np_notify_cb_t notify_cb, void *user_data ) | 332 | np_error_t np_set_notify_callback( np_client_t client, np_notify_cb_t notify_cb, void *user_data ) |
| 416 | { | 333 | { |
| 417 | if (!client) | 334 | if (!client) |
