Seperate GATT unregister instance function
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-dpm.c
index 63c4891..eedba13 100644 (file)
 #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} },
 };
 
 
@@ -194,7 +194,7 @@ dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
        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);
@@ -244,7 +244,7 @@ dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
        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);
 
                }
@@ -276,7 +276,7 @@ dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
 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;
 
@@ -322,7 +322,7 @@ dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
 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;
 
@@ -330,7 +330,7 @@ dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
 
        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);
@@ -683,9 +683,8 @@ dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_list(void)
                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;
 }
@@ -699,9 +698,8 @@ dpm_result_t _bt_dpm_clear_bluetooth_devices_from_list(void)
                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;
 }