np_client_free
np_client_new
np_client_start_service
np_client_t
np_error_t
np_notify_cb_t
np_observe_notification
np_observe_notifications
np_post_notification
NP_SERVICE_NAME
np_set_notify_callback

## np_set_notify_callback()

LIBIMOBILEDEVICE_API np_error_t np_set_notify_callback | ( | np_client_t | client,
|  | np_notify_cb_t | notify_cb,
|  | void * | user_data )

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

  client | the NP client
  notify_cb | pointer to a callback function or NULL to de-register a previously set callback function.
  user_data | Pointer 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.