* limitations under the License.
*
*/
-#ifdef TIZEN_FEATURE_BT_DPM
+#ifdef TIZEN_DPM_ENABLE
#include <glib.h>
#include <gio/gio.h>
#include <dlog.h>
#include <string.h>
+#include <syspopup_caller.h>
#include <bundle_internal.h>
#include <vconf.h>
[DPM_POLICY_ALLOW_BLUETOOTH] = { {DPM_BT_ERROR} },
[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION] = { {DPM_STATUS_ERROR} },
[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION] = { {DPM_STATUS_ERROR} },
- [DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST] = { { } },
- [DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST] = { { } },
- [DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST] = { { } },
- [DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST] = { { } },
+ [DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST] = { {NULL} },
+ [DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST] = { {NULL} },
+ [DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST] = { {NULL} },
+ [DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST] = { {NULL} },
[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL] = { {DPM_STATUS_ERROR} },
[DPM_POLICY_BLUETOOTH_PAIRING_STATE] = { {DPM_STATUS_ERROR} },
[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE] = { {DPM_STATUS_ERROR} },
[DPM_POLICY_BLUETOOTH_SPP_PROFILE_STATE] = {DPM_STATUS_ERROR},
};
-int _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
+int _bt_launch_dpm_popup(char *mode)
+{
+ int ret = 0;
+ bundle *b;
+
+ b = bundle_create();
+ retv_if(b == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ bundle_add(b, "mode", mode);
+
+ ret = syspopup_launch(BT_DPM_SYSPOPUP, b);
+
+ if (ret < 0)
+ BT_ERR("Popup launch failed: %d\n", ret);
+
+ bundle_free(b);
+
+ return ret;
+}
+
+dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
{
BT_INFO("_bt_dpm_set_allow_bluetooth_mode");
#endif
policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_allow_bluetooth_mode(int *value)
+dpm_bt_allow_t _bt_dpm_get_allow_bluetooth_mode(void)
{
BT_INFO("_bt_dpm_get_allow_bluetooth_mode");
- *value = policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
-
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
}
-int _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value)
+dpm_result_t _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
-
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_is_bluetooth_device_restriction_active(int *value)
+dpm_status_t _bt_dpm_is_bluetooth_device_restriction_active(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_is_bluetooth_device_restriction_active");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
-
- *value = policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value;
}
dpm_result_t _bt_dpm_activate_bluetoooth_uuid_restriction(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
-
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(int *value)
+dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_is_bluetooth_uuid_restriction_active");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
-
- *value = policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
}
dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address_t *bd_addr)
{
char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
char *dev_addr = NULL;
- int allow_bt = DPM_BT_ERROR;
BT_INFO("_bt_dpm_add_bluetooth_devices_to_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
BT_CHECK_PARAMETER(bd_addr, return);
dev_addr = g_strdup(device_address);
if (!dev_addr)
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
-
+ return DPM_RESULT_FAIL;
policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list, dev_addr);
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
+dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
{
- int ret = BLUETOOTH_ERROR_INTERNAL;
- int allow_bt = DPM_BT_ERROR;
+ dpm_result_t ret = DPM_RESULT_FAIL;
bt_dpm_device_list_t device_list;
GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list;
int i = 0;
BT_INFO("_bt_dpm_get_bluetooth_devices_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return ret;
if (list) {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
for (; list; list = list->next, i++) {
memset(device_list.addresses[i].addr, 0, BLUETOOTH_ADDRESS_LENGTH);
_bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
device_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list);
g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
} else {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
device_list.count = 0;
g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
}
return ret;
}
-int _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr)
+dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr)
{
char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
char *dev_addr = NULL;
- int allow_bt = DPM_BT_ERROR;
BT_INFO("_bt_dpm_add_bluetooth_devices_to_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
BT_CHECK_PARAMETER(bd_addr, return);
dev_addr = g_strdup(device_address);
if (!dev_addr)
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+ return DPM_RESULT_FAIL;
policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list, dev_addr);
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
+dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
{
- dpm_result_t ret = BLUETOOTH_ERROR_INTERNAL;
- int allow_bt = DPM_BT_ERROR;
+ dpm_result_t ret = DPM_RESULT_FAIL;
bt_dpm_device_list_t device_list;
GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list;
int i = 0;
BT_INFO("_bt_dpm_get_bluetooth_devices_from_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return ret;
if (list) {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
for (; list; list = list->next, i++) {
memset(device_list.addresses[i].addr, 0, BLUETOOTH_ADDRESS_LENGTH);
_bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
device_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list);
g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
} else {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
device_list.count = 0;
g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
}
return ret;
}
-int _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
+dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
{
char *l_uuid;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_add_bluetooth_uuids_to_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
l_uuid = g_strdup(uuid);
if (!l_uuid)
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
-
+ return DPM_RESULT_FAIL;
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
+dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
{
- int ret = BLUETOOTH_ERROR_INTERNAL;
- int allow_bt = DPM_BT_ERROR;
+ dpm_result_t ret = DPM_RESULT_FAIL;
bt_dpm_uuids_list_t uuids_list = {0, { {0}, } };
GSList *list = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list;
int i = 0;
BT_INFO("_bt_dpm_get_bluetooth_uuids_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return ret;
if (list) {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
uuids_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list);
for (; list; list = list->next, i++) {
memset(uuids_list.uuids[i], 0, BLUETOOTH_UUID_STRING_MAX);
}
g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
} else {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
uuids_list.count = 0;
g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
}
return ret;
}
-int _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
+dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
{
char *l_uuid;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_add_bluetooth_uuids_to_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
l_uuid = g_strdup(uuid);
if (!l_uuid)
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
-
+ return DPM_RESULT_FAIL;
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list, l_uuid);
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
+dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
{
- int ret = BLUETOOTH_ERROR_INTERNAL;
- int allow_bt = DPM_BT_ERROR;
+ dpm_result_t ret = DPM_RESULT_FAIL;
bt_dpm_uuids_list_t uuids_list = {0, { {0}, } };
GSList *list = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list;
int i = 0;
BT_INFO("_bt_dpm_get_bluetooth_uuids_from_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return ret;
if (list) {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
uuids_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list);
for (; list; list = list->next, i++) {
memset(uuids_list.uuids[i], 0, BLUETOOTH_UUID_STRING_MAX);
}
g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
} else {
- ret = BLUETOOTH_ERROR_NONE;
+ ret = DPM_RESULT_SUCCESS;
uuids_list.count = 0;
g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
}
}
-int _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value)
+dpm_result_t _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
-
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_allow_bluetooth_outgoing_call(int *value)
+dpm_status_t _bt_dpm_get_allow_bluetooth_outgoing_call(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_allow_bluetooth_outgoing_call");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- *value = policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value;
-
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value;
}
-int _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
+dpm_result_t _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
{
GSList *l = NULL;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_clear_bluetooth_devices_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list; l; l = g_slist_next(l)) {
char *address = l->data;
}
g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list);
policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list = NULL;
-
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
+dpm_result_t _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
{
GSList *l = NULL;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_clear_bluetooth_devices_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list; l; l = g_slist_next(l)) {
char *address = l->data;
}
g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list);
policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list = NULL;
-
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
+dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
{
GSList *l = NULL;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_clear_bluetooth_devices_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
char *l_uuid = l->data;
- if (l_uuid) {
+ if (l_uuid)
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
g_free(l_uuid);
- }
}
g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list);
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = NULL;
-
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
+dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
{
GSList *l = NULL;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_clear_bluetooth_uuids_from_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list; l; l = g_slist_next(l)) {
char *l_uuid = l->data;
}
g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list);
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list = NULL;
-
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value)
+dpm_status_t _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_set_bluetooth_pairing_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_pairing_state(int *value)
+dpm_status_t _bt_dpm_get_bluetooth_pairing_state(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_bluetooth_pairing_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
-
- *value = policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value;
}
-int _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value)
+dpm_status_t _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_set_bluetooth_profile_state");
- if (profile >= DPM_PROFILE_NONE)
- return BLUETOOTH_ERROR_INTERNAL;
-
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
dpm_profile_state[profile].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile, int *value)
+dpm_status_t _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_bluetooth_profile_state");
- if (profile >= DPM_PROFILE_NONE)
- return BLUETOOTH_ERROR_INTERNAL;
-
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- *value = dpm_profile_state[profile].value;
-
- return BLUETOOTH_ERROR_NONE;
+ return dpm_profile_state[profile].value;
}
-int _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value)
+dpm_status_t _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_set_bluetooth_desktop_connectivity_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_desktop_connectivity_state(int *value)
+dpm_status_t _bt_dpm_get_bluetooth_desktop_connectivity_state(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_bluetooth_desktop_connectivity_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
-
- *value = policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value;
}
-int _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
+dpm_status_t _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_set_bluetooth_discoverable_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
if (value == DPM_RESTRICTED) {
/* Since Discoverable mode is restricted, stop the ongoing discoverable mode */
policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_discoverable_state(int *value)
+dpm_status_t _bt_dpm_get_bluetooth_discoverable_state(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_bluetooth_discoverable_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- *value = policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value;
-
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value;
}
-int _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value)
+dpm_status_t _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_set_bluetooth_limited_discoverable_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
if (value == DPM_RESTRICTED) {
/* Since Discoverable mode is restricted, stop the ongoing discoverable mode */
policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_get_bluetooth_limited_discoverable_state(int *value)
+dpm_status_t _bt_dpm_get_bluetooth_limited_discoverable_state(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_bluetooth_limited_discoverable_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
-
- *value = policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value;
}
-int _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value)
+dpm_status_t _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_set_bluetooth_data_transfer_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
}
-int _bt_dpm_get_allow_bluetooth_data_transfer_state(int *value)
+dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(void)
{
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_get_allow_bluetooth_data_transfer_state");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESTRICTED;
- *value = policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value;
-
- return BLUETOOTH_ERROR_NONE;
+ return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value;
}
-int _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *device_address)
+dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *device_address)
{
GSList *l = NULL;
char bd_addr[BT_ADDRESS_STRING_SIZE] = { 0 };
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_remove_bluetooth_devices_from_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
_bt_convert_addr_type_to_string(bd_addr,
(unsigned char *)device_address->addr);
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
+
for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list; l; l = g_slist_next(l)) {
char *l_device = l->data;
if (l_device && g_strcmp0(l_device, bd_addr)) {
g_free(l_device);
}
}
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *device_address)
+dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *device_address)
{
GSList *l = NULL;
char bd_addr[BT_ADDRESS_STRING_SIZE] = { 0 };
- int allow_bt = DPM_BT_ERROR;
BT_INFO("_bt_dpm_remove_bluetooth_devices_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
_bt_convert_addr_type_to_string(bd_addr,
(unsigned char *)device_address->addr);
}
}
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
+dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
{
GSList *l = NULL;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_remove_bluetooth_uuids_from_whitelist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
-
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list; l; l = g_slist_next(l)) {
char *l_uuid = l->data;
if (l_uuid && g_strcmp0(l_uuid, uuids)) {
g_free(l_uuid);
}
}
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
+dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
{
GSList *l = NULL;
- int allow_bt = DPM_BT_ERROR;
-
BT_INFO("_bt_dpm_remove_bluetooth_uuids_from_blacklist");
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
char *l_uuid = l->data;
g_free(l_uuid);
}
}
- return BLUETOOTH_ERROR_NONE;
+ return DPM_RESULT_SUCCESS;
}
-int _bt_dpm_clear_bluetooth_uuids_from_list(void)
+dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_list(void)
{
- int allow_bt = DPM_BT_ERROR;
- int err = BLUETOOTH_ERROR_INTERNAL;
-
BT_INFO("_bt_dpm_clear_bluetooth_uuids_from_list");
+ dpm_result_t err = DPM_RESULT_FAIL;
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
err = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
if (!err)
return err;
}
-int _bt_dpm_clear_bluetooth_devices_from_list(void)
+dpm_result_t _bt_dpm_clear_bluetooth_devices_from_list(void)
{
- int allow_bt = DPM_BT_ERROR;
- int err = BLUETOOTH_ERROR_INTERNAL;
-
BT_INFO("_bt_dpm_clear_bluetooth_devices_from_list");
+ dpm_result_t err = DPM_RESULT_FAIL;
- _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
- if (allow_bt == DPM_BT_RESTRICTED)
- return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
+ return DPM_RESULT_ACCESS_DENIED;
err = _bt_dpm_clear_bluetooth_devices_from_blacklist();
if (!err)
return err;
}
-#endif /* #ifdef TIZEN_FEATURE_BT_DPM */
+#endif /* #ifdef TIZEN_DPM_ENABLE */