/* check VCONFKEY_BT_STATUS */
if (vconf_get_int(VCONFKEY_BT_DPM_STATUS, &value) != 0) {
BT_ERR("fail to get vconf key!");
- return BLUETOOTH_DPM_RESULT_FAIL;
+ return BLUETOOTH_ERROR_INTERNAL;
}
if (value != VCONFKEY_BT_DPM_STATUS_RESTRICTED)
- return BLUETOOTH_DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
else
- return BLUETOOTH_DPM_RESULT_ACCESS_DENIED;
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
}
#endif
int _bt_check_dpm(int service, void *param)
{
bt_dpm_status_e status = BT_DPM_ALLOWED;
-
+ int ret = BLUETOOTH_ERROR_NONE;
BT_CHECK_ENABLED_ANY(return);
switch (service) {
return status;
}
- if (status == BT_DPM_RESTRICTED)
+ if (status == BT_DPM_RESTRICTED) {
BT_INFO("Service [%d], DPM permission denied", service);
- else if (status == BT_DPM_NO_SERVICE)
+ ret = BLUETOOTH_ERROR_PERMISSION_DEINED;
+ } else if (status == BT_DPM_NO_SERVICE) {
BT_DBG("DPM no service [%d]", status);
+ ret = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
+ }
- return status;
+ return ret;
}
BT_EXPORT_API int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value)
{
- int result = BLUETOOTH_DPM_RESULT_SUCCESS;
+ int result = BLUETOOTH_ERROR_NONE;
#ifdef TIZEN_FEATURE_BT_DPM
int bt_status;
#endif
if (bt_status == VCONFKEY_BT_STATUS_ON) {
if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, value) != 0) {
BT_ERR("Set VCONFKEY_BT_DPM_STATUS failed\n");
- result = BLUETOOTH_DPM_RESULT_FAIL;
+ result = BLUETOOTH_ERROR_INTERNAL;
} else {
BT_ERR("Set VCONFKEY_BT_DPM_STATUS success\n");
- result = BLUETOOTH_DPM_RESULT_SUCCESS;
+ result = BLUETOOTH_ERROR_NONE;
}
BT_INIT_PARAMS();
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS &&
+ if (result == BLUETOOTH_ERROR_NONE &&
value == BLUETOOTH_DPM_BT_RESTRICTED) {
result = bluetooth_disable_adapter();
}
value <= BLUETOOTH_DPM_BT_RESTRICTED) {
if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, value) != 0) {
BT_ERR("Set VCONFKEY_BT_DPM_STATUS failed\n");
- result = BLUETOOTH_DPM_RESULT_FAIL;
+ result = BLUETOOTH_ERROR_INTERNAL;
} else
- result = BLUETOOTH_DPM_RESULT_SUCCESS;
+ result = BLUETOOTH_ERROR_NONE;
} else
- result = BLUETOOTH_DPM_RESULT_INVALID_PARAM;
+ result = BLUETOOTH_ERROR_INVALID_PARAM;
}
#else
BT_INIT_PARAMS();
#ifdef TIZEN_FEATURE_BT_DPM
*value = bluetooth_dpm_is_mode_allowed();
- return BLUETOOTH_DPM_RESULT_SUCCESS;
+ result = BLUETOOTH_ERROR_NONE;
#else
BT_CHECK_ENABLED_ANY(return);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_BT_MODE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICE_RESTRITION,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUID_RESTRITION,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICES_BLACKLIST,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
devices = &g_array_index(out_param, bt_dpm_device_list_t, 0);
BT_DBG("device_list->count : %d", devices->count);
if (devices->count == 0) {
BT_ERR("device_list->count is zero !");
- return BLUETOOTH_DPM_RESULT_FAIL;
+ result = BLUETOOTH_ERROR_NOT_FOUND;
}
device_list->count = devices->count;
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICES_WHITELIST,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
devices = &g_array_index(out_param, bt_dpm_device_list_t, 0);
BT_DBG("device_list->count : %d", devices->count);
if (devices->count == 0) {
BT_ERR("device_list->count is zero !");
- return BLUETOOTH_DPM_RESULT_FAIL;
+ result = BLUETOOTH_ERROR_NOT_FOUND;
}
device_list->count = devices->count;
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUIDS_BLACKLIST,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
uuids = &g_array_index(out_param, bt_dpm_uuids_list_t, 0);
BT_DBG("uuids->count : %d", uuids->count);
if (uuids->count == 0) {
BT_ERR("uuids->count is zero !");
- return BLUETOOTH_DPM_RESULT_FAIL;
+ result = BLUETOOTH_ERROR_NOT_FOUND;
}
uuid_list->count = uuids->count;
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUIDS_WHITELIST,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
uuids = &g_array_index(out_param, bt_dpm_uuids_list_t, 0);
BT_DBG("uuids->count : %d", uuids->count);
if (uuids->count == 0) {
BT_ERR("uuids->count is zero !");
- return BLUETOOTH_DPM_RESULT_FAIL;
+ result = BLUETOOTH_ERROR_NOT_FOUND;
}
uuid_list->count = uuids->count;
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_OUTGOING_CALL,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_BT_MODE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_PROFILE_STATE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DESKROP_CONNECTIVITY_STATE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DISCOVERABLE_STATE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_LIMITED_DISCOVERABLE_STATE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DATA_TRANSFER_STATE,
in_param1, in_param2, in_param3, in_param4, &out_param);
- if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+ if (result == BLUETOOTH_ERROR_NONE) {
if (out_param->len > 0) {
*value = g_array_index(out_param,
int, 0);
break;
}
case BT_DPM_GET_ALLOW_BT_MODE: {
- dpm_bt_allow_t value = DPM_BT_ERROR;
+ int value = DPM_BT_ERROR;
- value = _bt_dpm_get_allow_bluetooth_mode();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_allow_bluetooth_mode(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_DEVICE_RESTRITION: {
- dpm_status_t value = DPM_BT_ERROR;
+ dpm_status_t value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DEVICE_RESTRITION: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_is_bluetooth_device_restriction_active();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_is_bluetooth_device_restriction_active(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_UUID_RESTRITION: {
- dpm_status_t value = DPM_BT_ERROR;
+ dpm_status_t value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_UUID_RESTRITION: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_is_bluetooth_uuid_restriction_active();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_is_bluetooth_uuid_restriction_active(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_ADD_DEVICES_BLACKLIST: {
break;
}
case BT_DPM_SET_ALLOW_OUTGOING_CALL: {
- dpm_status_t value = DPM_BT_ERROR;
+ dpm_status_t value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_ALLOW_OUTGOING_CALL: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_get_allow_bluetooth_outgoing_call();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_allow_bluetooth_outgoing_call(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_PAIRING_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ dpm_status_t value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_PAIRING_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_get_bluetooth_pairing_state();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_bluetooth_pairing_state(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_PROFILE_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
- dpm_profile_t profile = DPM_PROFILE_NONE;
+ int value = DPM_STATUS_ERROR;
+ int profile = DPM_PROFILE_NONE;
__bt_service_get_parameters(in_param1, &profile,
sizeof(int));
break;
}
case BT_DPM_GET_PROFILE_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
- dpm_profile_t profile = DPM_PROFILE_NONE;
+ int value = DPM_STATUS_ERROR;
+ int profile = DPM_PROFILE_NONE;
- __bt_service_get_parameters(in_param2, &profile,
+ __bt_service_get_parameters(in_param1, &profile,
sizeof(int));
- value = _bt_dpm_get_bluetooth_profile_state(profile);
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_bluetooth_profile_state(profile, &value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_DESKROP_CONNECTIVITY_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DESKROP_CONNECTIVITY_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_get_bluetooth_desktop_connectivity_state();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_bluetooth_desktop_connectivity_state(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_DISCOVERABLE_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DISCOVERABLE_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_get_bluetooth_discoverable_state();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_bluetooth_discoverable_state(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_LIMITED_DISCOVERABLE_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_LIMITED_DISCOVERABLE_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_get_bluetooth_limited_discoverable_state();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_bluetooth_limited_discoverable_state(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_DPM_SET_DATA_TRANSFER_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DATA_TRANSFER_STATE: {
- dpm_status_t value = DPM_BT_ERROR;
+ int value = DPM_STATUS_ERROR;
- value = _bt_dpm_get_allow_bluetooth_data_transfer_state();
- result = DPM_RESULT_SUCCESS;
+ result = _bt_dpm_get_allow_bluetooth_data_transfer_state(&value);
g_array_append_vals(*out_param1, &value, sizeof(int));
-
break;
}
case BT_PXP_MONITOR_SET_PROPERTY: {
return ret;
}
-dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
+int _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 DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_bt_allow_t _bt_dpm_get_allow_bluetooth_mode(void)
+int _bt_dpm_get_allow_bluetooth_mode(int *value)
{
BT_INFO("_bt_dpm_get_allow_bluetooth_mode");
- return policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
+ *value = policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
+
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value)
+int _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value)
{
+ int allow_bt = DPM_BT_ERROR;
BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_is_bluetooth_device_restriction_active(void)
+int _bt_dpm_is_bluetooth_device_restriction_active(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_is_bluetooth_device_restriction_active");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _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;
- return policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value;
+ return BLUETOOTH_ERROR_NONE;
}
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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(void)
+dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_is_bluetooth_uuid_restriction_active");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
- return policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
+ *value = policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
+
+ return BLUETOOTH_ERROR_NONE;
}
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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
BT_CHECK_PARAMETER(bd_addr, return);
dev_addr = g_strdup(device_address);
if (!dev_addr)
- return DPM_RESULT_FAIL;
+ return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list, dev_addr);
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
{
- dpm_result_t ret = DPM_RESULT_FAIL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
+ int allow_bt = DPM_BT_ERROR;
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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return ret;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
if (list) {
- ret = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
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 = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
device_list.count = 0;
g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
}
return ret;
}
-dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
BT_CHECK_PARAMETER(bd_addr, return);
dev_addr = g_strdup(device_address);
if (!dev_addr)
- return DPM_RESULT_FAIL;
+ return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list, dev_addr);
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
{
- dpm_result_t ret = DPM_RESULT_FAIL;
+ dpm_result_t ret = BLUETOOTH_ERROR_INTERNAL;
+ int allow_bt = DPM_BT_ERROR;
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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return ret;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
if (list) {
- ret = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
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 = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
device_list.count = 0;
g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
}
return ret;
}
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
l_uuid = g_strdup(uuid);
if (!l_uuid)
- return DPM_RESULT_FAIL;
+ return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
{
- dpm_result_t ret = DPM_RESULT_FAIL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
+ int allow_bt = DPM_BT_ERROR;
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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return ret;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
if (list) {
- ret = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
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 = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
uuids_list.count = 0;
g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
}
return ret;
}
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
l_uuid = g_strdup(uuid);
if (!l_uuid)
- return DPM_RESULT_FAIL;
+ return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list, l_uuid);
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
{
- dpm_result_t ret = DPM_RESULT_FAIL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
+ int allow_bt = DPM_BT_ERROR;
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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return ret;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
if (list) {
- ret = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
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 = DPM_RESULT_SUCCESS;
+ ret = BLUETOOTH_ERROR_NONE;
uuids_list.count = 0;
g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
}
}
-dpm_result_t _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_allow_bluetooth_outgoing_call(void)
+int _bt_dpm_get_allow_bluetooth_outgoing_call(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_allow_bluetooth_outgoing_call");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+ *value = policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value;
- return policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
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 DPM_RESULT_SUCCESS;
+
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
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 DPM_RESULT_SUCCESS;
+
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
char *l_uuid = l->data;
}
g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list);
policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = NULL;
- return DPM_RESULT_SUCCESS;
+
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
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 DPM_RESULT_SUCCESS;
+
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_set_bluetooth_pairing_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_bluetooth_pairing_state(void)
+int _bt_dpm_get_bluetooth_pairing_state(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_bluetooth_pairing_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _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;
- return policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value)
+int _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 (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ 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;
dpm_profile_state[profile].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile)
+int _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile, int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_bluetooth_profile_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ 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;
+
+ *value = dpm_profile_state[profile].value;
- return dpm_profile_state[profile].value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_bluetooth_desktop_connectivity_state(void)
+int _bt_dpm_get_bluetooth_desktop_connectivity_state(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_bluetooth_desktop_connectivity_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _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;
- return policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_set_bluetooth_discoverable_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
if (value == DPM_RESTRICTED) {
/* Since Discoverable mode is restricted, stop the ongoing discoverable mode */
policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value = value;
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_bluetooth_discoverable_state(void)
+int _bt_dpm_get_bluetooth_discoverable_state(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_bluetooth_discoverable_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _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_DISCOVERABLE_STATE].value;
- return policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
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 DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_bluetooth_limited_discoverable_state(void)
+int _bt_dpm_get_bluetooth_limited_discoverable_state(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_bluetooth_limited_discoverable_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
- return policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value;
+ *value = policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value;
+
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
- return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
+ policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(void)
+int _bt_dpm_get_allow_bluetooth_data_transfer_state(int *value)
{
+ int allow_bt = DPM_BT_ERROR;
+
BT_INFO("_bt_dpm_get_allow_bluetooth_data_transfer_state");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESTRICTED;
+ _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_DATA_TRANSFER_STATE].value;
- return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *device_address)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
_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 DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *device_address)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
_bt_convert_addr_type_to_string(bd_addr,
(unsigned char *)device_address->addr);
}
}
- return DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
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 DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
+int _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");
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
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 DPM_RESULT_SUCCESS;
+ return BLUETOOTH_ERROR_NONE;
}
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_list(void)
+int _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;
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
err = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
if (!err)
return err;
}
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_list(void)
+int _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;
- if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
- return DPM_RESULT_ACCESS_DENIED;
+ _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+ if (allow_bt == DPM_BT_RESTRICTED)
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
err = _bt_dpm_clear_bluetooth_devices_from_blacklist();
if (!err)