diff options
Diffstat (limited to 'include/libiphone/notification_proxy.h')
-rw-r--r-- | include/libiphone/notification_proxy.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 14d1b39..520ccd1 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h @@ -27,16 +27,21 @@ extern "C" { #include <libiphone/libiphone.h> -struct np_client_int; -typedef struct np_client_int *np_client_t; +/* Error Codes */ +#define NP_E_SUCCESS 0 +#define NP_E_INVALID_ARG -1 +#define NP_E_PLIST_ERROR -2 + +#define NP_E_UNKNOWN_ERROR -256 + +typedef int16_t np_error_t; -// NotificationProxy related -// notifications for use with post_notification (client --> device) +/* Notification IDs for use with post_notification (client --> device) */ #define NP_SYNC_WILL_START "com.apple.itunes-mobdev.syncWillStart" #define NP_SYNC_DID_START "com.apple.itunes-mobdev.syncDidStart" #define NP_SYNC_DID_FINISH "com.apple.itunes-mobdev.syncDidFinish" -// notifications for use with observe_notification (device --> client) +/* Notification IDs for use with observe_notification (device --> client) */ #define NP_SYNC_CANCEL_REQUEST "com.apple.itunes-client.syncCancelRequest" #define NP_SYNC_SUSPEND_REQUEST "com.apple.itunes-client.syncSuspendRequest" #define NP_SYNC_RESUME_REQUEST "com.apple.itunes-client.syncResumeRequest" @@ -48,17 +53,18 @@ typedef struct np_client_int *np_client_t; #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" #define NP_ITDBPREP_DID_END "com.apple.itdbprep.notification.didEnd" -iphone_error_t np_new_client ( iphone_device_t device, int dst_port, np_client_t *client ); -iphone_error_t np_free_client ( np_client_t client ); - -iphone_error_t np_post_notification ( np_client_t client, const char *notification ); - -iphone_error_t np_observe_notification ( np_client_t client, const char *notification ); -iphone_error_t np_observe_notifications ( np_client_t client, const char **notification_spec ); +struct np_client_int; +typedef struct np_client_int *np_client_t; -typedef void (*np_notify_cb_t) ( const char *notification ); +typedef void (*np_notify_cb_t) (const char *notification); -iphone_error_t np_set_notify_callback ( np_client_t client, np_notify_cb_t notify_cb ); +/* Interface */ +np_error_t np_client_new(iphone_device_t device, int dst_port, np_client_t *client); +np_error_t np_client_free(np_client_t client); +np_error_t np_post_notification(np_client_t client, const char *notification); +np_error_t np_observe_notification(np_client_t client, const char *notification); +np_error_t np_observe_notifications(np_client_t client, const char **notification_spec); +np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb); #ifdef __cplusplus } |