Knox Tizen Wearable SDK
Admin policy group

Admin policy group provides set of functions that enable using MDM functionality. This includes client's registration, handle of service, notifications, callbacks, basic data types etc. More...

Data Structures

struct  mem_header_t
 Place at the front of any structure or block of memory that is intended to be disowned by the allocator, to be discarded by a subsequent owner. More...
 
struct  mdm_data_t
 This structure is used to store GList. More...
 
struct  mdm_privacy_permission_entry_t
 This structure represents entry information about single runtime permission specification. More...
 

Typedefs

typedef struct policy_receiver_s policy_receiver_t
 Policy receiver handle type. More...
 
typedef policy_receiver_tpolicy_receiver_handle
 
typedef void(* on_policy_receiver_callback) (int status, void *p_user_data)
 Policy receiver callback to be called in case of policy change. More...
 
typedef void(* mdm_client_callback_function) (int oper, void *cb_data, void *user_data)
 Policy callback function pointer. More...
 
typedef void(* mdm_client_callback_function_ext) (void *cb_data, void *user_data)
 Policy callback function pointer. More...
 
typedef void(* mdm_client_callback_function_free) (void *data)
 Policy callback user data memory free function. More...
 

Enumerations

Functions

mdm_result_t mdm_get_service (void)
 API to connect to MDM server daemon, and get caller information. More...
 
int mdm_get_service_ext (const char *pkg_name)
 API to connect to the MDM server daemon and get caller information. More...
 
mdm_result_t mdm_release_service (void)
 API to close the connection and release the resources. More...
 
mdm_status_t mdm_is_client_registered (const char *pkg_name)
 API to check if an MDM client is registered in MDM Server. More...
 
int mdm_register_client (const char *pkg_name)
 API to register an MDM client. More...
 
int mdm_deregister_client (const char *pkg_name)
 API to close current session with MDM server. More...
 
policy_receiver_handle mdm_register_policy_receiver (mdm_policy_noti_t noti, void *user_data, on_policy_receiver_callback callback)
 API to register a callback function that is called when a policy is changed during runtime. More...
 
mdm_result_t mdm_deregister_policy_receiver (policy_receiver_t *handle)
 API to deregister the policy change callback function. More...
 
void mdm_free_data (mdm_data_t *data)
 API to free an mdm_data_t structure. More...
 
int mdm_register_client_callback (mdm_policy_cb_t policy, mdm_client_callback_function cb, mdm_client_callback_function_free free_cb, void *userData)
 API to register a callback function for the given policy. More...
 
mdm_result_t mdm_get_last_error (void)
 API to get the error code of the last MDM function called in current thread. More...
 

Detailed Description

Admin policy group provides set of functions that enable using MDM functionality. This includes client's registration, handle of service, notifications, callbacks, basic data types etc.

Admin policy group.

Required Header

#include <mdm.h>

Typedef Documentation

typedef void(* mdm_client_callback_function) (int oper, void *cb_data, void *user_data)

Policy callback function pointer.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_client_callback

Definition at line 81 of file mdm_client_type.h.

typedef void(* mdm_client_callback_function_ext) (void *cb_data, void *user_data)

Policy callback function pointer.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_client_callback

Definition at line 89 of file mdm_client_type.h.

typedef void(* mdm_client_callback_function_free) (void *data)

Policy callback user data memory free function.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_client_callback

Definition at line 97 of file mdm_client_type.h.

typedef void(* on_policy_receiver_callback) (int status, void *p_user_data)

Policy receiver callback to be called in case of policy change.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_policy_receiver

Definition at line 218 of file mdm.h.

Remarks
policy_receiver_handle has been changed from int to struct pointer
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
policy_receiver_t

Definition at line 210 of file mdm.h.

typedef struct policy_receiver_s policy_receiver_t

Policy receiver handle type.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_policy_receiver

Definition at line 201 of file mdm.h.

Enumeration Type Documentation

Enumerate policy callback.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_client_callback
Enumerator
MDM_ADMINISTRATION_CB 

Administration policy callback

MDM_PWD_CB 

Password policy callback

MDM_SECURITY_CB 

Security policy callback

MDM_WIFI_CONTROL_CB 

Wi-Fi policy callback

MDM_BT_CONTROL_CB 

Bluetooth policy callback

MDM_EAS_CB 

EAS policy callback

MDM_APP_MANAGEMENT_CB 

Application management policy callback

MDM_ROAMING_CB 

Roaming policy callback

MDM_MISC_CB 

MISC policy callback

MDM_DEVICE_INVENTORY_CB 

Device Inventory policy callback

MDM_APN_CB 

APN policy callback

MDM_BROWSER_CB 

Web browser policy callback

MDM_DATE_TIME_CB 

Date/time policy callback

MDM_REMOTE_CB 

Remote policy callback

MDM_VPN_CB 

VPN policy callback

MDM_FIREWALL_CB 

Firewall policy callback

MDM_RES_CB 

Restriction policy callback

MDM_PHONE_RES_CB 

Phone Restriction policy callback

MDM_ENTERPRISE_CB 

Enterprise policy callback

MDM_EMAIL_CB 

Email policy callback

MDM_LICENSE_CB 

License policy callback

MDM_KIOSK_CB 

Kiosk policy callback

MDM_CONTAINER_CB 

Container policy callback

Definition at line 48 of file mdm_client_type.h.

Enumerate policy change notification type.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
See also
mdm_register_policy_receiver
Enumerator
MDM_POLICY_ON_PASSWORD 

Password status, refer to #mdm_password_status_t

See also
mdm_enforce_password_change #mdm_set_password_status
MDM_POLICY_ON_WIFI 

Wi-Fi status, refer to mdm_wifi_status_t

See also
mdm_add_wifi_ssids_to_whitelist mdm_remove_wifi_ssids_from_whitelist mdm_clear_wifi_ssids_whitelist mdm_add_wifi_ssids_to_blacklist mdm_remove_wifi_ssids_from_blacklist mdm_clear_wifi_ssids_blacklist mdm_activate_wifi_ssid_restriction mdm_set_allow_wifi
MDM_POLICY_ON_WIFI_STATE 

Wi-Fi state, refer to wifi_noti_t

See also
mdm_set_wifi_state_change_allowed #knox_mdm_set_allow_wifi_change
MDM_POLICY_ON_WIFI_CHANGE 

Change of Wi-Fi state, refer to wifi_noti_t

See also
mdm_set_wifi_state_change_allowed #knox_mdm_set_allow_wifi_change mdm_set_allow_user_policy_changes mdm_set_password_hidden mdm_allow_wifi_ap_setting_user_modification
MDM_POLICY_ON_WIFI_PREFERRED_AP_LIST_CHANGE 

List of preferred access points has changed.

See also
knox_mdm_preferred_ssid_add knox_mdm_preferred_ssid_delete knox_mdm_preferred_ssids_clear
MDM_POLICY_ON_WIFI_ENFORCE_PREFERRED_AP_MODE_CHANGE 

Mode of enforce preferred access points has changed.

See also
knox_mdm_preferred_ssid_enforce
MDM_POLICY_ON_WIFI_PROTECTED_AP_LIST_CHANGE 

List of protected access points has changed.

See also
knox_mdm_protected_ssid_add knox_mdm_protected_ssid_delete knox_mdm_protected_ssids_clear
MDM_POLICY_ON_WIFI_TETHERING 

Wi-Fi tethering restriction has changed.

See also
mdm_allow_wifi_ap_setting_user_modification #mdm_set_allow_wifi_tethering
MDM_POLICY_ON_WIFI_AUTOCONNECT_CHANGE 

Wi-Fi auto-connect restriction has changed.

See also
mdm_set_automatic_connection_to_wifi
MDM_POLICY_ON_BT 

Bluetooth status, refer to mdm_bt_policy_changed_t

See also
mdm_set_allow_bluetooth_mode #mdm_set_bluetooth_desktop_connectivity_state mdm_add_bluetooth_uuids_to_whitelist mdm_remove_bluetooth_uuids_from_whitelist mdm_clear_bluetooth_uuids_from_whitelist mdm_add_bluetooth_uuids_to_blacklist mdm_remove_bluetooth_uuids_from_blacklist mdm_clear_bluetooth_uuids_from_blacklist mdm_activate_bluetooth_uuid_restriction mdm_add_bluetooth_devices_to_whitelist mdm_remove_bluetooth_devices_from_whitelist mdm_clear_bluetooth_devices_from_whitelist mdm_add_bluetooth_devices_to_blacklist mdm_remove_bluetooth_devices_from_blacklist mdm_clear_bluetooth_devices_from_blacklist mdm_activate_bluetooth_device_restriction mdm_set_bluetooth_pairing_state mdm_set_allow_bluetooth_outgoing_call mdm_set_bluetooth_discoverable_state #mdm_set_bluetooth_limited_discoverable_state mdm_set_bluetooth_data_transfer_state mdm_set_bluetooth_profile_state
MDM_POLICY_ON_BT_CHANGE 

Prevent to change Bluetooth restriction.

See also
#knox_mdm_set_allow_bluetooth_change
MDM_POLICY_ON_BT_TETHERING 

Bluetooth tethering restriction has changed.

See also
mdm_set_allow_bluetooth_tethering
MDM_POLICY_ON_CAMERA 

Camera restriction has changed.

See also
#mdm_set_allow_camera
MDM_POLICY_ON_ROAMING_SYNC 

Roaming sync restriction has changed.

See also
#mdm_msim_set_allow_roaming_sync
MDM_POLICY_ON_ROAMING_PUSH 

Roaming push restriction has changed.

See also
#mdm_msim_set_allow_roaming_push
MDM_POLICY_ON_DATA_ROAMING_CHANGE 

Prevent to change roaming data restriction.

See also
#knox_mdm_set_allow_roaming_data_change
MDM_POLICY_ON_LOCATION 

Location restriction has changed.

See also
mdm_set_allow_location
MDM_POLICY_ON_GPS_CHANGE 

Prevent to change gps.

See also
#knox_mdm_set_allow_gps_change
MDM_POLICY_ON_FACTORY_RESET 

Factory reset restriction has changed.

See also
mdm_set_allow_factory_reset
MDM_POLICY_ON_MIC 

Microphone restriction has changed.

See also
mdm_set_allow_microphone
MDM_POLICY_ON_CALL 

Not supported.

MDM_POLICY_ON_CONTAINER 

Not supported.

MDM_POLICY_ON_KIOSK 

Not supported.

MDM_POLICY_ON_LICENSE 

Not supported.

MDM_POLICY_ON_MOBILE_AP 

Not supported.

MDM_POLICY_ON_KIES 

Kies restriction has changed.

See also
#mdm_set_allow_desktop_sync
MDM_POLICY_ON_BROWSER 

Browser restriction has changed.

See also
#mdm_set_allow_browser #mdm_set_allow_autofill #mdm_set_allow_cookies #mdm_set_allow_JavaScript #mdm_set_allow_popups #mdm_set_allow_force_fraud_warning
MDM_POLICY_ON_MTP 

MTP restriction has changed.

See also
#mdm_set_allow_usb_media_player_availability
MDM_POLICY_ON_NFC 

NFC restriction has changed.

See also
mdm_set_allow_nfc
MDM_POLICY_ON_CLIPBOARD 

Clipboard restriction has changed.

See also
mdm_set_allow_clipboard
MDM_POLICY_ON_SETTINGS 

Settings restriction has changed.

See also
mdm_set_allow_settings_changes
MDM_POLICY_ON_LOC_SETTING 

Not supported.

MDM_POLICY_ON_BG_SYNC 

Background Sync restriction has changed.

See also
#mdm_set_allow_background_data
MDM_POLICY_ON_MESSAGE 

Message restriction has changed.

See also
mdm_set_allow_text_messaging #mdm_msim_set_allow_text_messaging
MDM_POLICY_ON_NETWORK 

Cellular data restriction has changed.

See also
mdm_set_allow_cellular_data
MDM_POLICY_ON_EMAIL 

POP/IMAP restriction has changed.

See also
#mdm_set_allow_popimap_email
MDM_POLICY_ON_SIM_PIN_LOCK 

Not supported.

MDM_POLICY_ON_DEVICE_LOCK 

Screen has been locked or password has been changed.

See also
mdm_reset_password mdm_lock_now
MDM_POLICY_ON_SMS_LIMIT 

Not supported.

MDM_POLICY_ON_DATA_LIMIT 

Data limit related action has happened.

See also
mdm_enable_data_call_limit #mdm_msim_enable_data_call_limit mdm_set_limit_of_data_calls #mdm_msim_set_limit_of_data_calls mdm_reset_data_call_limit_count #mdm_msim_reset_data_call_limit_count
MDM_POLICY_ON_AIRPLANE 

Airplane mode restriction has changed

See also
knox_mdm_set_allow_airplane_mode
MDM_POLICY_ON_AIRPLANE_CHANGE 

Prevent to change airplane mode.

See also
#knox_mdm_set_allow_airplane_mode_change
MDM_POLICY_ON_POWER_SAVING_MODE 

Power saving mode restriction has changed.

See also
knox_mdm_set_allow_power_saving_mode
MDM_POLICY_ON_POWER_SAVING_MODE_CHANGE 

Prevent to change power saving mode.

See also
#knox_mdm_set_allow_power_saving_mode_change
MDM_POLICY_ON_USB_TETHERING 

USB tethering restriction has changed.

See also
#mdm_set_allow_usb_tethering
MDM_POLICY_ON_USB_KIES 

Samsung Kies restriction has changed.

See also
#mdm_set_allow_usb_kies_availability
MDM_POLICY_ON_USB_DEBUG 

USB debug restriction has changed.

See also
mdm_set_allow_usb_debugging
MDM_POLICY_ON_USB_DEBUGGING_CHANGE 

Prevent to change USB debugging state.

See also
#knox_mdm_set_allow_usb_debugging_change
MDM_POLICY_ON_WATCHFACE 

Watch face change restriction has changed.

See also
#knox_mdm_set_allow_watchface_change
MDM_POLICY_ON_APP_NOTI_CHANGED 

Application notifications list has changed.

See also
knox_mdm_add_notification_black_list knox_mdm_add_notification_white_list knox_mdm_clear_notification_black_list knox_mdm_clear_notification_white_list knox_mdm_delete_notification_black_list knox_mdm_delete_notification_white_list
MDM_POLICY_ON_MOBILE_DATA_CHANGE 

Prevent to change mobile data settings.

See also
#knox_mdm_set_allow_mobile_data_change
MDM_POLICY_NOTI_MAX 

Only preserved for backward compatibility with Tizen 3.0. Usage is highly discouraged.

MDM_POLICY_ON_LOCKSCREEN_TYPE_CHANGE 

Lock screen type restriction has changed.

See also
knox_mdm_set_allow_lockscreen_type_change
MDM_POLICY_ON_WIDGETS_RESTRICTION_DATA_CHANGE 

Home screen widget board addition/removal restriction has changed.

See also
#knox_mdm_add_widget_id_to_widget_board_removal_restriction_whitelist #knox_mdm_remove_widget_id_from_widget_board_removal_restriction_whitelist #knox_mdm_clear_all_widget_ids_on_widget_board_removal_restriction_whitelist #knox_mdm_add_widget_id_to_widget_board_removal_restriction_blacklist #knox_mdm_remove_widget_id_from_widget_board_removal_restriction_blacklist #knox_mdm_clear_all_widget_ids_on_widget_board_removal_restriction_blacklist #knox_mdm_add_widget_id_to_widget_board_addition_restriction_whitelist #knox_mdm_remove_widget_id_from_widget_board_addition_restriction_whitelist #knox_mdm_clear_all_widget_ids_on_widget_board_addition_restriction_whitelist #knox_mdm_add_widget_id_to_widget_board_addition_restriction_blacklist #knox_mdm_remove_widget_id_from_widget_board_addition_restriction_blacklist #knox_mdm_clear_all_widget_ids_on_widget_board_addition_restriction_blacklist

Definition at line 51 of file mdm.h.

Runtime permission policy value stored in the following states.

Since (Knox_wearable):
2.3.0
Since (Tizen):
4.0.0.0
Note
Runtime privilege with MDM_PRIVACY_PERMISSION_STATE_ALLOW state is always granted for a given package. Corresponing pop up will not be displayed to the user, who attempts to use application indicated by package name. Runtime privilege with MDM_PRIVACY_PERMISSION_STATE_DENY state is never granted for a given package. Corresponing pop up will not be displayed to the user, who attempts to use application indicated by package name. Runtime privilege with MDM_PRIVACY_PERMISSION_STATE_ANY is equivalent of specifying ".*" regular expression. In case of returned value it represents unknown state.
See also
knox_mdm_platform_get_privacy_permission_data
Enumerator
MDM_PRIVACY_PERMISSION_STATE_ALLOW 

Privilege will be always granted

MDM_PRIVACY_PERMISSION_STATE_DENY 

Privilege will be alwayd denied

MDM_PRIVACY_PERMISSION_STATE_ANY 

Unknown value, or unspecified value

Definition at line 200 of file mdm_client_type.h.

MDM API result.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Enumerator
MDM_RESULT_SERVICE_NOT_ENABLED 

MDM API result service is not enabled.

MDM_RESULT_ACCESS_DENIED 

MDM API result permission denied.

MDM_RESULT_INVALID_PARAM 

MDM API result invalid parameter.

MDM_RESULT_NOT_SUPPORTED 

MDM API result not supported.

MDM_RESULT_FAIL 

MDM API result fail.

MDM_RESULT_SUCCESS 

MDM API result success.

MDM_NOT_AN_OWNER 

Admin is not an owner.

Definition at line 104 of file mdm_client_type.h.

MDM Policy allowed/restricted status.

Since (Knox_wearable):
2.2.0
Since (Tizen):
3.0.0.1

Definition at line 148 of file mdm_client_type.h.

MDM Policy enabled/disabled status.

Since (Knox_wearable):
2.2.0
Since (Tizen):
3.0.0.1

Definition at line 137 of file mdm_client_type.h.

MDM Policy status.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Enumerator
MDM_STATUS_ERROR 

MDM Policy status error.

MDM_ALLOWED 

MDM Policy status allowed.

MDM_RESTRICTED 

MDM Policy status restricted.

MDM_ENABLED 

MDM Policy status enabled.

MDM_DISABLED 

MDM Policy status disabled.

MDM_FALSE 

MDM Policy status false.

MDM_TRUE 

MDM Policy status true.

Definition at line 119 of file mdm_client_type.h.

MDM Policy true/false status.

Since (Knox_wearable):
2.2.0
Since (Tizen):
3.0.0.1

Definition at line 159 of file mdm_client_type.h.

Function Documentation

int mdm_deregister_client ( const char *  pkg_name)

API to close current session with MDM server.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Purpose:
A deregistered client cannot get service from the MDM server daemon.
Usage:
The admin can deregister an MDM client from the MDM server after checking its policy. The deregistration is done at the server side.
int ret = mdm_register_client("com.3rdparty.mdm_client");
if (ret == MDM_RESULT_SUCCESS)
{
ret = mdm_get_service();
if (ret == MDM_RESULT_SUCCESS)
{
// Calling MDM APIs.
}
}
else
{
// Failed to register client.
}
mdm_deregister_client("com.3rdparty.mdm_client");
Parameters
[in]pkg_nameThe package name of the client to deregister.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success. Otherwise, returns another of the return values.
Return values
MDM_RESULT_SUCCESSSuccessful.
MDM_RESULT_FAILGeneral failure.
MDM_RESULT_SERVICE_NOT_ENABLEDService not enabled.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_NOT_SUPPORTEDNot supported.
See also
mdm_is_client_registered, mdm_register_client
mdm_result_t mdm_deregister_policy_receiver ( policy_receiver_t handle)

API to deregister the policy change callback function.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The admin can deregister the callback function after checking for policy changes.
Remarks
Do not deregister policy receiver from inside the policy handler callback on_policy_receiver_callback.
static void _receiver_callback(int result, void * p_user_data)
{
}
policy_receiver_handle handle = NULL;
handle = mdm_register_policy_receiver(MDM_POLICY_ON_CAMERA, NULL, _receiver_callback);
if (handle != NULL)
{
}
Parameters
[in]handleThe handle returned by mdm_register_policy_receiver.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
See also
mdm_register_policy_receiver
void mdm_free_data ( mdm_data_t data)

API to free an mdm_data_t structure.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
This function clears the data of the mdm_data_t and frees the memory that it used.
mdm_data_t *lp_data = mdm_get_application_version("com.samsung.ebook");
if (lp_data && lp_data->data)
{
char *name = (char *)lp_data->data;
printf("com.samsung.ebook application's display name : %s\n", name);
// Free resources.
mdm_free_data(lp_data);
}
Parameters
[in]dataA pointer to the data to be freed.
mdm_result_t mdm_get_last_error ( void  )

API to get the error code of the last MDM function called in current thread.

Since (Knox_wearable):
1.1.0
Since (Tizen):
2.4.0.4

This function is useful to know the exact reason of failure of functions returning mdm_status_t.

Returns
mdm_result_t : MDM_RESULT_SUCCESS on success if previous MDM API call was successful. Otherwise, returns any of the return values.
Return values
MDM_RESULT_SUCCESSSuccessful.
MDM_RESULT_FAILGeneral failure.
MDM_RESULT_SERVICE_NOT_ENABLEDService not enabled.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_NOT_SUPPORTEDNot supported.
mdm_result_t mdm_get_service ( void  )

API to connect to MDM server daemon, and get caller information.

This API also verifies whether the caller is authorized to get MDM client information to communicate with the MDM server daemon.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The admin must call this function before calling other MDM APIs, unless otherwise stated in the documentation of that particular API. The admin can call other MDM APIs after receiving an MDM_RESULT_SUCCESS response from the MDM server daemon. It is mandatory to call mdm_release_service() even if the mdm_get_service() returns a value other than MDM_RESULT_SUCCESS.

This function creates new connection to the MDM server in the context of calling thread. So it must to call mdm_release_service() from the same thread that called mdm_get_service().

if (ret == MDM_RESULT_SUCCESS)
{
// Calling MDM APIs.
}
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
See also
mdm_release_service
mdm_get_service_ext
int mdm_get_service_ext ( const char *  pkg_name)

API to connect to the MDM server daemon and get caller information.

Attention
Deprecated Since Knox_wearable 2.3.0. Use mdm_get_service instead.

Purpose: to verify whether the caller is authorized to get MDM client information to communicate with the device policy manager daemon. This function must be called before calling any other MDM APIs, unless otherwise stated in documentation of that particular API. After receiving a successful response from the device policy manager daemon the caller can call the other MDM APIs.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Remarks
This API is available in test mode only.
mdm_result_t ret = mdm_get_service_ext("com.samsung.mdm_test_tool");
if (ret == MDM_RESULT_SUCCESS)
{
// Calling MDM APIs.
}
Parameters
[in]pkg_nameThe package name of the caller application.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success. Otherwise, returns any of the other return values.
Return values
MDM_RESULT_SUCCESSSuccessful.
MDM_RESULT_FAILGeneral failure.
MDM_RESULT_SERVICE_NOT_ENABLEDService not enabled.
MDM_RESULT_ACCESS_DENIEDCaller is not authorized to access MDM client information.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_NOT_SUPPORTEDNot supported.
Permission:
This API is restricted to registered clients only.
See also
mdm_release_service
mdm_get_service
mdm_status_t mdm_is_client_registered ( const char *  pkg_name)

API to check if an MDM client is registered in MDM Server.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Without successful registration client cannot set any policies.

It might happened, that registered client isn't registered anymore. This can be caused, for example, due to file system failure that can happen on power failure. In such case, admin client has to reapply all policies that it requires.

Note
This call doesn't require calling mdm_get_service().
mdm_status_t status = mdm_is_client_registered("com.3rdparty.mdm_client");
if (status != MDM_TRUE)
{
mdm_result_t ret = mdm_register_client("com.3rdparty.mdm_client");
if (ret == MDM_RESULT_SUCCESS)
{
ret = mdm_get_service();
if (ret == MDM_RESULT_SUCCESS)
{
// Calling MDM APIs.
}
}
}
Parameters
[in]pkg_nameThe package name of the MDM client.
Returns
mdm_status_t : Whether client is registered
Return values
MDM_TRUEClient is registered
MDM_FALSEClient is not registred
MDM_STATUS_ERRORError
See also
mdm_register_client, mdm_deregister_client
int mdm_register_client ( const char *  pkg_name)

API to register an MDM client.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Only a registered client can get service from the MDM server daemon.
int ret = mdm_register_client("com.3rdparty.mdm_client");
if (ret == MDM_RESULT_SUCCESS)
{
ret = mdm_get_service();
if (ret == MDM_RESULT_SUCCESS)
{
// Calling MDM APIs.
}
}
Parameters
[in]pkg_nameThe package name of the MDM client.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success. Otherwise, returns any of the other return values.
Return values
MDM_RESULT_SUCCESSSuccessful.
MDM_RESULT_FAILGeneral failure.
MDM_RESULT_SERVICE_NOT_ENABLEDService not enabled.
MDM_RESULT_ACCESS_DENIEDNot authorized to access.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_NOT_SUPPORTEDNot supported.
See also
mdm_is_client_registered, mdm_deregister_client
int mdm_register_client_callback ( mdm_policy_cb_t  policy,
mdm_client_callback_function  cb,
mdm_client_callback_function_free  free_cb,
void *  userData 
)

API to register a callback function for the given policy.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The function registers the callback function cb for the given policy. You can deregister a callback for a policy by calling this function and passing NULL as the cb value.
void cb_function(int oper, void *cb_data, void *user_data)
{
}
void cb_free_function(void *data)
{
}
{
// Connect to MDM server
// Register callback
mdm_register_client_callback(MDM_LICENSE_CB, cb_function, cb_free_function, NULL);
}
Parameters
[in]policyThe policy callback ID to set the callback for. One of mdm_policy_cb_t.
[in]cbA pointer to the callback function for policy. Set this to NULL to deregister a callback.
[in]free_cbA pointer to a callback free function. The function frees the user data passed to the callback function.
[in]userDataThe user data to pass to the callback function.
policy_receiver_handle mdm_register_policy_receiver ( mdm_policy_noti_t  noti,
void *  user_data,
on_policy_receiver_callback  callback 
)

API to register a callback function that is called when a policy is changed during runtime.

Registers callback which is going to be invoked on policy change.

Note
The callback is called in dedicated worker thread in client's library. If you are about to call any MDM function in callback do not forget to recall mdm_get_service() and mdm_release_service(). Also, updating UI in your EFL application remember to do it asynchronously in the main loop, e.g. using ecore_main_loop_thread_safe_call_async()

The function doesn't require one to call mdm_get_service().

Remarks
Registering the same callback function with the same user_data will result in returning the same handle as previously.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
An admin can use the callback function in case there are policy changes.
// Callback to be registered
static void _receiver_callback(int result, // new policy value set by device policy manager
void *p_user_data) // user's data passed as 2nd arg to mdm_register_policy_receiver
{
if (result == MDM_ALLOWED) {
// transform UI for camera usage
} else {
// transform UI for without-camera usage
}
}
if (handle == NULL) {
// Error registering callback.
} else {
// Callback has been registered successfully.
}
Parameters
[in]notiPolicy change notification type. This is an mdm_policy_noti_t value.
[in]user_dataCaller's user data.
[in]callbackA pointer to the callback function to call when the policy is changed.
Returns
policy_receiver_handle : The policy receiver handle on success, NULL on error. Error can be examined with mdm_get_last_error().
See also
mdm_deregister_policy_receiver
mdm_result_t mdm_release_service ( void  )

API to close the connection and release the resources.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The admin should call this function to clean up the MDM framework, regardless of whether the call to mdm_get_service() was successful.
if (ret == MDM_RESULT_SUCCESS)
{
// Calling MDM APIs.
}
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success. Otherwise, returns any of the other return values.
Return values
MDM_RESULT_SUCCESSSuccessful.
MDM_RESULT_FAILGeneral failure.
See also
mdm_get_service
mdm_get_service_ext