Knox Tizen Wearable SDK
APN policy group

APN policy group provides policies for APN control. More...

Data Structures

struct  mdm_apn_settings_t
 Apn settings. More...
 

Enumerations

Functions

mdm_result_t mdm_create_apn_settings (mdm_apn_auth_type_t authType, char *p_apn, char *p_proxy, char *p_user, char *p_password, char *p_type)
 API to create an APN setting. More...
 
mdm_result_t mdm_delete_apn (int n_id)
 API to delete an APN setting. More...
 
mdm_data_tmdm_get_apn_list (void)
 API to get all of the APN settings from the device. More...
 
mdm_data_tmdm_get_apn_settings (int n_id)
 API to get the settings for a particular APN. More...
 
mdm_data_tmdm_get_preferred_apn_settings (void)
 API to get the user's preferred APN settings. More...
 
mdm_result_t mdm_set_preferred_apn (int n_id)
 API to set the preferred APN. More...
 
mdm_result_t mdm_update_apn_settings (int n_id, mdm_apn_auth_type_t authType, char *p_apn, char *p_proxy, char *p_user, char *p_password, char *p_type)
 API to update an APN setting. More...
 

Detailed Description

APN policy group provides policies for APN control.

APN policy group.

Required Header

#include <mdm.h>

Overview

This group provides APIs to create, update and remove APN settings on the device.

Enumeration Type Documentation

APN auth type.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
See also
mdm_create_apn_settings, mdm_update_apn_settings
Enumerator
MDM_NET_PDP_AUTH_NONE 

No authentication

MDM_NET_PDP_AUTH_PAP 

PAP authentication

MDM_NET_PDP_AUTH_CHAP 

CHAP authentication

Definition at line 38 of file apn.h.

Function Documentation

mdm_result_t mdm_create_apn_settings ( mdm_apn_auth_type_t  authType,
char *  p_apn,
char *  p_proxy,
char *  p_user,
char *  p_password,
char *  p_type 
)

API to create an APN setting.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_add_profile instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
An Access Point Name (APN) is the name of a gateway that allows a user to access the Internet using the mobile phone network.

An admin can use this function to create an APN on the device without user interaction; filling it with the configuration parameters required to access a carrier's data network.

(char *)"test.sktelecom.com",
(char *)"10.103.230.150:9093:0",
(char *)"guest",
(char *)"1234",
(char *)"internet");
if (ret == MDM_RESULT_SUCCESS) {
// setting success
} else {
// setting fail
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.apn
Parameters
[in]authTypeThe APN authentication type. One of mdm_apn_auth_type_t.
[in]p_apnThe APN (for example, "test.sktelecom.com").
[in]p_proxyProxy to use for web traffic (for example, "10.103.230.150:9093:0").
[in]p_userUsername, if applicable (for example, "guest").
[in]p_passwordPassword, if applicable (for example, "1234").
[in]p_typeThe type(s) of data connection that should use this set of APN settings. Two types are currently supported: "internet" and "MMS".
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_NOT_SUPPORTEDNot supported.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
Usage of this API is restricted to registered clients only.
See also
mdm_delete_apn, mdm_update_apn_settings
mdm_result_t mdm_delete_apn ( int  n_id)

API to delete an APN setting.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_remove_profile instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
An admin can use this API to delete an APN from the device without user interaction using the APN ID. The APN ID can be obtained calling any of the APIs provided to get a list of APNs.
int apn_id = -1;
if (_data) {
GList *apn_data_list = (GList *)_data->data;
if (apn_data_list) {
apn_data_list = g_list_first(apn_data_list);
while (apn_data_list) {
mdm_apn_settings_t *apn_settings = (mdm_apn_settings_t *)apn_data_list->data;
if (apn_settings) {
// Example removal of the APN configuration with the name "testAPN"
if (g_strcmp0(apn_settings->p_name, "testAPN") == 0)
{
apn_id = apn_settings->id;
break;
}
}
apn_data_list = g_list_next(apn_data_list);
}
}
mdm_free_data(_data);
// Delete the APN using the ID retrieved previously
ret = mdm_delete_apn(apn_id);
if (ret == MDM_RESULT_SUCCESS) {
// APN deletion succeeded
} else {
// APN deletion failed
}
} else {
// Failed to get APN list
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.apn
Parameters
[in]n_idThe APN settings ID.
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_NOT_SUPPORTEDNot supported.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
Usage of this API is restricted to registered clients only.
See also
mdm_create_apn_settings
mdm_get_apn_list
mdm_get_preferred_apn_settings
mdm_data_t* mdm_get_apn_list ( void  )

API to get all of the APN settings from the device.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_get_profile_iterator instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can call this API to get the list of APNs that are provisioned on the device.
if (lp_data) {
// Successfully got APN list
GList *lp_list = (GList *)lp_data->data;
if (lp_list) {
lp_list = g_list_first(lp_list);
while (lp_list) {
mdm_apn_settings_t *pl_apn_settings_t = (mdm_apn_settings_t *) lp_list->data;
if (pl_apn_settings_t) {
printf("[%d.%s]. type:%s,
auth:%d,
apn:%s,
mmsProxy:%s:%s,
mmsc:%s,
mcc:%s,
mnc:%s,
name:%s,
pwd:%s,
proxy:%s:%d,
server:%s,
user:%s",
pl_apn_settings_t->id,
pl_apn_settings_t->p_type,
pl_apn_settings_t->p_profileName,
pl_apn_settings_t->authType,
pl_apn_settings_t->p_apn,
pl_apn_settings_t->p_mmsProxy,
pl_apn_settings_t->p_mmsPort,
pl_apn_settings_t->p_mmsc,
pl_apn_settings_t->p_mcc,
pl_apn_settings_t->p_mnc,
pl_apn_settings_t->p_name,
pl_apn_settings_t->p_password,
pl_apn_settings_t->p_proxy,
pl_apn_settings_t->port,
pl_apn_settings_t->p_server,
pl_apn_settings_t->p_user);
}
lp_list = g_list_next(lp_list);
}
}
mdm_free_data(lp_data);
} else {
// Failed to get APN list
}
Returns
A pointer to the APN settings data on success, NULL otherwise.
See also
mdm_get_apn_settings
mdm_data_t* mdm_get_apn_settings ( int  n_id)

API to get the settings for a particular APN.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_get_profile_iterator instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The admin can call this API to get the APN settings configured on the device.
if (lp_data) {
// Successfully got APN settings
mdm_apn_settings_t *pl_apn_settings_t = (mdm_apn_settings_t *)lp_data->data;
if (pl_apn_settings_t) {
printf("[%s : %s].
auth:%d,
apn:%s,
mmsProxy:%s:%s,
mmsc:%s,
mcc:%s,
mnc:%s,
name:%s,
pwd:%s,
proxy:%s:%d,
server:%s,
user:%s",
pl_apn_settings_t->p_type,
pl_apn_settings_t->p_profileName,
pl_apn_settings_t->authType,
pl_apn_settings_t->p_apn,
pl_apn_settings_t->p_mmsProxy,
pl_apn_settings_t->p_mmsPort,
pl_apn_settings_t->p_mmsc,
pl_apn_settings_t->p_mcc,
pl_apn_settings_t->p_mnc,
pl_apn_settings_t->p_name,
pl_apn_settings_t->p_password,
pl_apn_settings_t->p_proxy,
pl_apn_settings_t->port,
pl_apn_settings_t->p_server,
pl_apn_settings_t->p_user);
}
mdm_free_data(lp_data);
} else {
// Failed to get APN settings
}
Parameters
[in]n_idThe ID of the APN settings to retrieve.
Returns
A pointer to the APN settings data on success, NULL otherwise.
See also
mdm_get_apn_list
mdm_data_t* mdm_get_preferred_apn_settings ( void  )

API to get the user's preferred APN settings.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_get_default_cellular_service_profile instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can use this API to get the user's preferred (active) APN from the device.
if (lp_data) {
GList *lp_list = (GList *)lp_data->data;
if(lp_list) {
lp_list = g_list_first(lp_list);
while (lp_list) {
mdm_apn_settings_t *pl_apn_settings_t = (mdm_apn_settings_t *)lp_list->data;
if (pl_apn_settings_t) {
printf("[%s : %s].
auth:%d,
apn:%s,
mmsProxy:%s:%s,
mmsc:%s,
mcc:%s,
mnc:%s,
name:%s,
pwd:%s,
proxy:%s:%d,
server:%s,
user:%s",
pl_apn_settings_t->p_type,
pl_apn_settings_t->p_profileName,
pl_apn_settings_t->authType,
pl_apn_settings_t->p_apn,
pl_apn_settings_t->p_mmsProxy,
pl_apn_settings_t->p_mmsPort,
pl_apn_settings_t->p_mmsc,
pl_apn_settings_t->p_mcc,
pl_apn_settings_t->p_mnc,
pl_apn_settings_t->p_name,
pl_apn_settings_t->p_password,
pl_apn_settings_t->p_proxy,
pl_apn_settings_t->port,
pl_apn_settings_t->p_server,
pl_apn_settings_t->p_user);
}
lp_list = g_list_next(lp_list);
}
}
}
Returns
A pointer to the preferred APN data on success, NULL on error.
See also
mdm_set_preferred_apn
mdm_result_t mdm_set_preferred_apn ( int  n_id)

API to set the preferred APN.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_set_default_cellular_service_profile instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The device attempts to use the preferred APN whenever a connection to an APN is requested. If it's not possible to connect to the preferred APN with the given ID, then another APN is chosen from the available list by the system.

To use this API first you need to get an ID for a specific APN. You can obtain the ID from any of the APNs in the lists retrieved by mdm_get_preferred_apn_settings ans mdm_get_apn_list.

int apn_id = -1;
if (lp_data) {
GList *lp_list = (GList *)lp_data->data;
if (lp_list) {
lp_list = g_list_first(lp_list);
while (lp_list) {
mdm_apn_settings_t *pl_apn_settings_t = (mdm_apn_settings_t *) lp_list->data;
if (pl_apn_settings_t) {
// Example of getting an APN with the name "testAPN"
if (g_strcmp0(pl_apn_settings_t->p_name, "testAPN")
{
apn_id = pl_apn_settings_t->id;
break;
}
}
lp_list = g_list_next(lp_list);
}
}
mdm_free_data(lp_data);
// Set the preferred APN using the ID retrieved previously
ret = mdm_set_preferred_apn(apn_id);
if (ret == MDM_RESULT_SUCCESS) {
// Set preferred APN succeed
} else {
// Set preferred APN failed
}
} else {
// Failed to get APN list
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.apn
Parameters
[in]n_idThe ID of the APN settings to set as the preferred APN.
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_NOT_SUPPORTEDNot supported.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
Usage of this API is restricted to registered clients only.
See also
mdm_get_preferred_apn_settings
mdm_get_apn_list
mdm_result_t mdm_update_apn_settings ( int  n_id,
mdm_apn_auth_type_t  authType,
char *  p_apn,
char *  p_proxy,
char *  p_user,
char *  p_password,
char *  p_type 
)

API to update an APN setting.

Attention
Deprecated Since Knox_wearable 2.3.0. Use connection_update_profile instead.
Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
The admin can set the values of the APN and update the values for the APN entry on the device without any user interaction.
(char *)"test.sktelecom.com",
(char *)"10.103.230.150:9093:0",
(char *)"guest",
(char *)"1234",
(char *)"internet");
if (ret == MDM_RESULT_SUCCESS) {
// setting success
} else {
// setting fail
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.apn
Parameters
[in]n_idThe ID of the APN to update.
[in]authTypeThe APN authentication type. One of mdm_apn_auth_type_t.
[in]p_apnThe APN (for example, "test.sktelecom.com").
[in]p_proxyProxy to use for web traffic (for example, "10.103.230.150:9093:0").
[in]p_userUsername, if applicable (for example, "guest").
[in]p_passwordPassword, if applicable (for example, "1234").
[in]p_typeThe type(s) of data connection that should use this set of APN settings. Two types are currently supported: "internet" and "MMS".
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_NOT_SUPPORTEDNot supported.
MDM_RESULT_INVALID_PARAMInvalid parameter.
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
Usage of this API is restricted to registered clients only.
See also
mdm_create_apn_settings, mdm_delete_apn