diff options
Diffstat (limited to 'include/libiphone/notification_proxy.h')
| -rw-r--r-- | include/libiphone/notification_proxy.h | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 9412b4f..66b7a80 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | /** | ||
| 2 | * @file libiphone/notification_proxy.h | ||
| 3 | * @brief Implementation to talk to the notification proxy on a device | ||
| 4 | * \internal | ||
| 5 | * | ||
| 6 | * Copyright (c) 2009 Nikias Bassen All Rights Reserved. | ||
| 7 | * | ||
| 8 | * This library is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU Lesser General Public | ||
| 10 | * License as published by the Free Software Foundation; either | ||
| 11 | * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This library is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * Lesser General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU Lesser General Public | ||
| 19 | * License along with this library; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | */ | ||
| 22 | |||
| 1 | #ifndef NOTIFICATION_PROXY_H | 23 | #ifndef NOTIFICATION_PROXY_H |
| 2 | #define NOTIFICATION_PROXY_H | 24 | #define NOTIFICATION_PROXY_H |
| 3 | 25 | ||
| @@ -7,16 +29,21 @@ extern "C" { | |||
| 7 | 29 | ||
| 8 | #include <libiphone/libiphone.h> | 30 | #include <libiphone/libiphone.h> |
| 9 | 31 | ||
| 10 | struct np_client_int; | 32 | /* Error Codes */ |
| 11 | typedef struct np_client_int *np_client_t; | 33 | #define NP_E_SUCCESS 0 |
| 34 | #define NP_E_INVALID_ARG -1 | ||
| 35 | #define NP_E_PLIST_ERROR -2 | ||
| 36 | |||
| 37 | #define NP_E_UNKNOWN_ERROR -256 | ||
| 38 | |||
| 39 | typedef int16_t np_error_t; | ||
| 12 | 40 | ||
| 13 | // NotificationProxy related | 41 | /* Notification IDs for use with post_notification (client --> device) */ |
| 14 | // notifications for use with post_notification (client --> device) | ||
| 15 | #define NP_SYNC_WILL_START "com.apple.itunes-mobdev.syncWillStart" | 42 | #define NP_SYNC_WILL_START "com.apple.itunes-mobdev.syncWillStart" |
| 16 | #define NP_SYNC_DID_START "com.apple.itunes-mobdev.syncDidStart" | 43 | #define NP_SYNC_DID_START "com.apple.itunes-mobdev.syncDidStart" |
| 17 | #define NP_SYNC_DID_FINISH "com.apple.itunes-mobdev.syncDidFinish" | 44 | #define NP_SYNC_DID_FINISH "com.apple.itunes-mobdev.syncDidFinish" |
| 18 | 45 | ||
| 19 | // notifications for use with observe_notification (device --> client) | 46 | /* Notification IDs for use with observe_notification (device --> client) */ |
| 20 | #define NP_SYNC_CANCEL_REQUEST "com.apple.itunes-client.syncCancelRequest" | 47 | #define NP_SYNC_CANCEL_REQUEST "com.apple.itunes-client.syncCancelRequest" |
| 21 | #define NP_SYNC_SUSPEND_REQUEST "com.apple.itunes-client.syncSuspendRequest" | 48 | #define NP_SYNC_SUSPEND_REQUEST "com.apple.itunes-client.syncSuspendRequest" |
| 22 | #define NP_SYNC_RESUME_REQUEST "com.apple.itunes-client.syncResumeRequest" | 49 | #define NP_SYNC_RESUME_REQUEST "com.apple.itunes-client.syncResumeRequest" |
| @@ -26,18 +53,20 @@ typedef struct np_client_int *np_client_t; | |||
| 26 | #define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" | 53 | #define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" |
| 27 | #define NP_APP_INSTALLED "com.apple.mobile.application_installed" | 54 | #define NP_APP_INSTALLED "com.apple.mobile.application_installed" |
| 28 | #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" | 55 | #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" |
| 56 | #define NP_ITDBPREP_DID_END "com.apple.itdbprep.notification.didEnd" | ||
| 29 | 57 | ||
| 30 | iphone_error_t np_new_client ( iphone_device_t device, int dst_port, np_client_t *client ); | 58 | struct np_client_int; |
| 31 | iphone_error_t np_free_client ( np_client_t client ); | 59 | typedef struct np_client_int *np_client_t; |
| 32 | |||
| 33 | iphone_error_t np_post_notification ( np_client_t client, const char *notification ); | ||
| 34 | |||
| 35 | iphone_error_t np_observe_notification ( np_client_t client, const char *notification ); | ||
| 36 | iphone_error_t np_observe_notifications ( np_client_t client, const char **notification_spec ); | ||
| 37 | 60 | ||
| 38 | typedef void (*np_notify_cb_t) ( const char *notification ); | 61 | typedef void (*np_notify_cb_t) (const char *notification); |
| 39 | 62 | ||
| 40 | iphone_error_t np_set_notify_callback ( np_client_t client, np_notify_cb_t notify_cb ); | 63 | /* Interface */ |
| 64 | np_error_t np_client_new(iphone_device_t device, int dst_port, np_client_t *client); | ||
| 65 | np_error_t np_client_free(np_client_t client); | ||
| 66 | np_error_t np_post_notification(np_client_t client, const char *notification); | ||
| 67 | np_error_t np_observe_notification(np_client_t client, const char *notification); | ||
| 68 | np_error_t np_observe_notifications(np_client_t client, const char **notification_spec); | ||
| 69 | np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb); | ||
| 41 | 70 | ||
| 42 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
| 43 | } | 72 | } |
