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
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
- See also:
- dpm_manager_create()
-
dpm_manager_destroy()
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
Enumeration of device policy API errors.
- Since :
- 3.0
- Enumerator:
DPM_ERROR_NONE |
The operation was successful
|
DPM_ERROR_INVALID_PARAMETER |
Invalid parameter
|
DPM_ERROR_CONNECTION_REFUSED |
Connection refused
|
DPM_ERROR_TIMED_OUT |
Time out
|
DPM_ERROR_PERMISSION_DENIED |
Access privilege is not sufficient
|
DPM_ERROR_NOT_PERMITTED |
Operation not permitted
|
DPM_ERROR_FILE_EXISTS |
File exists
|
DPM_ERROR_OUT_OF_MEMORY |
Out of memory
|
DPM_ERROR_NO_DATA |
No Data
|
Function Documentation
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:
-
- Precondition:
- The handle must be created by dpm_manager_create().
- See also:
- dpm_manager_create()
-
dpm_remove_policy_changed_cb()
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:
-
- Precondition:
- The handle must be created by dpm_manager_create().
- See also:
- dpm_manager_create()
-
dpm_manager_destroy()
-
dpm_remove_signal_cb()
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
- Exceptions:
-
- See also:
- dpm_manager_destroy()
-
get_last_result()
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:
-
- Precondition:
- The handle must be created by dpm_manager_create().
- See also:
- dpm_manager_create()
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:
-
- Precondition:
- The handle must be created by dpm_manager_create().
-
The callback identifier must be created by dpm_manager_add_policy_changed_cb().
- See also:
- dpm_manager_create()
-
dpm_add_policy_changed_cb()