libiphone/notification_proxy.h File Reference

Implementation to talk to the notification proxy on a device. More...


Defines

#define NP_E_SUCCESS   0
#define NP_E_INVALID_ARG   -1
#define NP_E_PLIST_ERROR   -2
#define NP_E_UNKNOWN_ERROR   -256
#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"
#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"
#define NP_PHONE_NUMBER_CHANGED   "com.apple.mobile.lockdown.phone_number_changed"
#define NP_DEVICE_NAME_CHANGED   "com.apple.mobile.lockdown.device_name_changed"
#define NP_ATTEMPTACTIVATION   "com.apple.springboard.attemptactivation"
#define NP_DS_DOMAIN_CHANGED   "com.apple.mobile.data_sync.domain_changed"
#define NP_APP_INSTALLED   "com.apple.mobile.application_installed"
#define NP_APP_UNINSTALLED   "com.apple.mobile.application_uninstalled"
#define NP_ITDBPREP_DID_END   "com.apple.itdbprep.notification.didEnd"

Typedefs

typedef int16_t np_error_t
typedef struct np_client_int * np_client_t
typedef void(* np_notify_cb_t )(const char *notification)

Functions

np_error_t np_client_new (iphone_device_t device, int dst_port, np_client_t *client)
 Makes a connection to the NP service on the phone.
np_error_t np_client_free (np_client_t client)
 Disconnects an NP client from the phone.
np_error_t np_post_notification (np_client_t client, const char *notification)
 Sends a notification to the device's Notification Proxy.
np_error_t np_observe_notification (np_client_t client, const char *notification)
 Notifies the iphone to send a notification on the specified event.
np_error_t np_observe_notifications (np_client_t client, const char **notification_spec)
 Notifies the iphone to send a notification on specified events.
np_error_t np_set_notify_callback (np_client_t client, np_notify_cb_t notify_cb)
 This function allows an application to define a callback function that will be called when a notification has been received.


Detailed Description

Implementation to talk to the notification proxy on a device.


Function Documentation

np_error_t np_client_free ( np_client_t  client  ) 

Disconnects an NP client from the phone.

Parameters:
client The client to disconnect.

np_error_t np_client_new ( iphone_device_t  device,
int  dst_port,
np_client_t *  client 
)

Makes a connection to the NP service on the phone.

Parameters:
phone The iPhone to connect on.
s_port The source port.
d_port The destination port.
Returns:
A handle to the newly-connected client or NULL upon error.

np_error_t np_observe_notification ( np_client_t  client,
const char *  notification 
)

Notifies the iphone to send a notification on the specified event.

Parameters:
client The client to send to
notification The notifications that should be observed.

np_error_t np_observe_notifications ( np_client_t  client,
const char **  notification_spec 
)

Notifies the iphone to send a notification on specified events.

observation messages seen so far: com.apple.itunes-client.syncCancelRequest com.apple.itunes-client.syncSuspendRequest com.apple.itunes-client.syncResumeRequest com.apple.mobile.lockdown.phone_number_changed com.apple.mobile.lockdown.device_name_changed com.apple.springboard.attemptactivation com.apple.mobile.data_sync.domain_changed com.apple.mobile.application_installed com.apple.mobile.application_uninstalled

Parameters:
client The client to send to
notification_spec Specification of the notifications that should be observed. This is expected to be an array of const char* that MUST have a terminating NULL entry. However this parameter can be NULL; in this case, the default set of notifications will be used.

np_error_t np_post_notification ( np_client_t  client,
const char *  notification 
)

Sends a notification to the device's Notification Proxy.

notification messages seen so far: com.apple.itunes-mobdev.syncWillStart com.apple.itunes-mobdev.syncDidStart

Parameters:
client The client to send to
notification The notification message to send

np_error_t np_set_notify_callback ( np_client_t  client,
np_notify_cb_t  notify_cb 
)

This function allows an application to define a callback function that will be called when a notification has been received.

It will start a thread that polls for notifications and calls the callback function if a notification has been received.

Parameters:
client the NP client
notify_cb pointer to a callback function or NULL to de-register a previously set callback function
Returns:
NP_E_SUCCESS when the callback was successfully registered, or an error value when an error occured.


Generated on Mon Jul 27 08:42:31 2009 for libiphone by  doxygen 1.5.6