Tizen Native API
4.0
|
The policy client provides functions required to access the device policy APIs.
Required Header
#include <dpm/device-policy-manager.h>
Overview
The Policy Manager module provides Device Policy Manager handle which keeps track of state between the device admin client and the device policy manager. The device admin clients must create the handle by using dpm_manager_create() before attempting to use almost any of the device policy APIs, and the handle should be freed by using dpm_manager_destroy() when interaction with the device policy manager is no longer required.
Functions | |
device_policy_manager_h | dpm_manager_create (void) |
Creates the device policy manager handle. | |
int | dpm_manager_destroy (device_policy_manager_h handle) |
Releases the device policy manager handle. | |
int | dpm_add_policy_changed_cb (device_policy_manager_h handle, const char *name, dpm_policy_changed_cb callback, void *user_data, int *id) |
Adds policy change callback to the device policy manager. | |
int | dpm_remove_policy_changed_cb (device_policy_manager_h handle, int id) |
Removes policy change callback from the device policy manager. | |
int | dpm_add_signal_cb (device_policy_manager_h handle, const char *signal, dpm_signal_cb callback, void *user_data, int *id) |
Adds signal callback. | |
int | dpm_remove_signal_cb (device_policy_manager_h handle, int id) |
Removes signal callback. | |
Typedefs | |
typedef void(* | dpm_policy_changed_cb )(const char *name, const char *state, void *user_data) |
Called when a policy is changed. | |
typedef void * | device_policy_manager_h |
The device policy manager handle. | |
typedef void(* | dpm_signal_cb )(const char *name, const char *object, void *user_data) |
Called when a zone raises a signal. |
Typedef Documentation
typedef void* device_policy_manager_h |
The device policy manager handle.
The device policy manager handle is an abstraction of the logical connection between the device policy manager and it's client. The device policy manager handle must be created by using dpm_manager_create() before attempting to use almost any of the device policy APIs, and it should be freed when interaction with the device policy manager is no longer required. To release the handle, use dpm_manager_destroy().
- Since :
- 3.0
typedef void(* dpm_policy_changed_cb)(const char *name, const char *state, void *user_data) |
Called when a policy is changed.
- Since :
- 3.0
- Parameters:
-
[in] name The name of the policy [in] state The current state of the policy [in] user_data The user data passed from dpm_manager_add_policy_changed_cb
- See also:
- dpm_manager_add_policy_changed_cb()
- dpm_manager_remove_policy_changed_cb()
typedef void(* dpm_signal_cb)(const char *name, const char *object, void *user_data) |
Called when a zone raises a signal.
- Since :
- 3.0
- Parameters:
-
[in] name The zone name [in] object The object name triggered the signal [in] user_data The user data passed from dpm_zone_add_signal_cb
- See also:
- dpm_zone_add_signal_cb()
- dpm_zone_remove_signal_cb()
Enumeration Type Documentation
enum dpm_error_type_e |
Enumeration of device policy API errors.
- Since :
- 3.0
- Enumerator:
Function Documentation
int dpm_add_policy_changed_cb | ( | device_policy_manager_h | handle, |
const char * | name, | ||
dpm_policy_changed_cb | callback, | ||
void * | user_data, | ||
int * | id | ||
) |
Adds policy change callback to the device policy manager.
This API can be used to subscribe policy change callback. The callback specified to this API is asynchronously called when policy is changed on runtime.
- Since :
- 3.0
- Parameters:
-
[in] handle Device policy manager handle [in] name Policy name to subscribe(see Policy List) [in] callback The callback when policy is changed [in] user_data User specified data passed to the callback [out] id Policy change callback identifier
- Returns:
- DPM_ERROR_NONE on success, otherwise a negative value
- Return values:
-
DPM_ERROR_NONE Successful DPM_ERROR_INVALID_PARAMETER Invalid parameter DPM_ERROR_TIMED_OUT Time out
- Remarks:
- See Policy List section for available policy name
- Precondition:
- The handle must be created by dpm_manager_create().
int dpm_add_signal_cb | ( | device_policy_manager_h | handle, |
const char * | signal, | ||
dpm_signal_cb | callback, | ||
void * | user_data, | ||
int * | id | ||
) |
Adds signal callback.
This API can be used to receive signals raised by the device policy manager. The callback specified to this function is automatically called when the device policy manager raises signal.
- Since :
- 3.0
- Parameters:
-
[in] handle Device policy manager handle [in] signal The signal name to receive(see Signal List) [in] callback The signal callback [in] user_data The user data passed to the callback function [out] id Signal identifier
- Returns:
- DPM_ERROR_NONE on success, otherwise a negative value
- Return values:
-
DPM_ERROR_NONE Successful DPM_ERROR_INVALID_PARAMETER Invalid parameter DPM_ERROR_TIMED_OUT Time out
- Remarks:
- See Signal List section for signals
- Precondition:
- The handle must be created by dpm_manager_create().
Creates the device policy manager handle.
This API creates device policy manager handle required to the device policy APIs. This API is also used to verify whether caller is authorized or not.
- Since :
- 3.0
- Returns:
- Device policy manager handle on success, otherwise NULL
- Remarks:
- The specific error code can be obtained by using the get_last_result() method. Error codes are described in exception section. The returned handle should be released using dpm_manager_destroy().
- Exceptions:
-
DPM_ERROR_NONE No error DPM_ERROR_CONNECTION_REFUSED Connection refused DPM_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- dpm_manager_destroy()
- get_last_result()
int dpm_manager_destroy | ( | device_policy_manager_h | handle | ) |
Releases the device policy manager handle.
This API must be called if interaction with the device policy manager is no longer required.
- Since :
- 3.0
- Parameters:
-
[in] handle Device policy manager handle
- Returns:
- DPM_ERROR_NONE on success, otherwise a negative value
- Return values:
-
DPM_ERROR_NONE Successful DPM_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- The handle must be created by dpm_manager_create().
- See also:
- dpm_manager_create()
int dpm_remove_policy_changed_cb | ( | device_policy_manager_h | handle, |
int | id | ||
) |
Removes policy change callback from the device policy manager.
This API should be called if policy change subscription is no longer required.
- Since :
- 3.0
- Parameters:
-
[in] handle Device policy manager handle [in] id Policy change callback identifier
- Returns:
- DPM_ERROR_NONE on success, otherwise a negative value
- Return values:
-
DPM_ERROR_NONE Successful DPM_ERROR_INVALID_PARAMETER Invalid parameter DPM_ERROR_TIMED_OUT Time out
- Precondition:
- The handle must be created by dpm_manager_create().
- The callback identifier must be created by dpm_manager_add_policy_changed_cb().
int dpm_remove_signal_cb | ( | device_policy_manager_h | handle, |
int | id | ||
) |
Removes signal callback.
This API removes signal callback.
- Since :
- 3.0
- Parameters:
-
[in] handle Device policy manager handle [in] id Signal identifier
- Returns:
- DPM_ERROR_NONE on success, otherwise a negative value
- Return values:
-
DPM_ERROR_NONE Successful DPM_ERROR_INVALID_PARAMETER Invalid parameter DPM_ERROR_TIMED_OUT Time out
- Precondition:
- The context must be created by dpm_manager_create().