libimobiledevice  1.3.0
API Documentation - Return to Homepage

◆ np_set_notify_callback()

np_error_t np_set_notify_callback ( np_client_t  client,
np_notify_cb_t  notify_cb,
void *  userdata 
)

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. In case of an error condition when polling for notifications - e.g. device disconnect - the thread will call the callback function with an empty notification "" and terminate itself.

Parameters
clientthe NP client
notify_cbpointer to a callback function or NULL to de-register a previously set callback function.
user_dataPointer that will be passed to the callback function as user data. If notify_cb is NULL, this parameter is ignored.
Note
Only one callback function can be registered at the same time; any previously set callback function will be removed automatically.
Returns
NP_E_SUCCESS when the callback was successfully registered, NP_E_INVALID_ARG when client is NULL, or NP_E_UNKNOWN_ERROR when the callback thread could no be created.