#include "bt-internal-types.h"
#include "bt-service-common.h"
+#include "bt-service-adapter.h"
#include "bt-service-dpm.h"
static dpm_policy_t policy_table[DPM_POLICY_END] = {
- [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] = {{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_DISCOVERABLE_STATE] = {{DPM_STATUS_ERROR}},
- [DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE] = {{DPM_STATUS_ERROR}},
- [DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE] = {{DPM_STATUS_ERROR}},
+ [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] = { {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_DISCOVERABLE_STATE] = { {DPM_STATUS_ERROR} },
+ [DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE] = { {DPM_STATUS_ERROR} },
+ [DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE] = { {DPM_STATUS_ERROR} },
};
if (list) {
ret = DPM_RESULT_SUCCESS;
for (; list; list = list->next, i++) {
- memset(device_list.addresses[i].addr, 0, BT_ADDRESS_STRING_SIZE);
+ 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);
if (list) {
ret = DPM_RESULT_SUCCESS;
for (; list; list = list->next, i++) {
- memset(device_list.addresses[i].addr, 0, BT_ADDRESS_STRING_SIZE);
+ memset(device_list.addresses[i].addr, 0, BLUETOOTH_ADDRESS_LENGTH);
_bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
}
dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
{
dpm_result_t ret = DPM_RESULT_FAIL;
- bt_dpm_uuids_list_t uuids_list = {0, {{0}, }};
+ bt_dpm_uuids_list_t uuids_list = {0, { {0}, } };
GSList *list = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list;
int i = 0;
dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
{
dpm_result_t ret = DPM_RESULT_FAIL;
- bt_dpm_uuids_list_t uuids_list = {0, {{0}, }};
+ bt_dpm_uuids_list_t uuids_list = {0, { {0}, } };
GSList *list = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list;
int i = 0;
if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
return ret;
-
+
if (list) {
ret = DPM_RESULT_SUCCESS;
uuids_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list);
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 */
+ _bt_set_discoverable_mode(BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0);
+ }
+
policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value = value;
return DPM_RESULT_SUCCESS;
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 */
+ _bt_set_discoverable_mode(BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0);
+ }
+
policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value = value;
return DPM_RESULT_SUCCESS;
return DPM_RESULT_ACCESS_DENIED;
err = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
- if (!err){
+ if (!err)
err = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
- }
return err;
}
return DPM_RESULT_ACCESS_DENIED;
err = _bt_dpm_clear_bluetooth_devices_from_blacklist();
- if (!err){
+ if (!err)
err = _bt_dpm_clear_bluetooth_devices_from_blacklist();
- }
return err;
}