Move profile connected devices logic to hal 57/231457/2
authorWootak Jung <wootak.jung@samsung.com>
Wed, 22 Apr 2020 05:09:55 +0000 (14:09 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 22 Apr 2020 05:20:56 +0000 (14:20 +0900)
Change-Id: I518eb49613eb5494b99629eeed1fdbe42716561d
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
13 files changed:
bt-oal/bluez_hal/inc/bt-hal-msg.h
bt-oal/bluez_hal/src/bt-hal-adapter-dbus-handler.c
bt-oal/bluez_hal/src/bt-hal-adapter-dbus-handler.h
bt-oal/bluez_hal/src/bt-hal-bluetooth.c
bt-oal/hardware/bluetooth.h
bt-oal/include/oal-adapter-mgr.h
bt-oal/include/oal-event.h
bt-oal/oal-adapter-mgr.c
bt-service-adaptation/services/adapter/bt-service-core-adapter.c
bt-service-adaptation/services/bt-request-handler.c
bt-service-adaptation/services/bt-service-dpm.c
bt-service-adaptation/services/bt-service-event-receiver.c
bt-service-adaptation/services/include/bt-service-core-adapter.h

index 03e6f6b..1e73678 100644 (file)
@@ -108,6 +108,11 @@ struct hal_ev_adapter_props_changed {
        struct  hal_property props[0];
 } __attribute__((packed));
 
+#define HAL_EV_ADAPTER_PROFILE_CONNECTED_DEVICES    0x02
+struct hal_ev_adapter_profile_connected_devices {
+       uint8_t count;
+       uint8_t bdaddr_list[10][6];
+} __attribute__((packed));
 
 #define HAL_DISCOVERY_STATE_STOPPED     0x00
 #define HAL_DISCOVERY_STATE_STARTED     0x01
index 7ce1f77..c0448be 100644 (file)
@@ -601,6 +601,123 @@ int _bt_hal_dbus_get_energy_info(uint32_t *tx_time, uint32_t *rx_time,
        return BT_STATUS_SUCCESS;
 }
 
+int _bt_hal_dbus_get_profile_connected_devices(const char *profile_uuid)
+{
+       GDBusConnection *conn;
+       GDBusProxy *manager_proxy;
+       GVariant *result = NULL;
+       GVariant *result1 = NULL;
+       GVariantIter *iter = NULL;
+       GError *error = NULL;
+       char *object_path = NULL;
+       GVariantIter *interface_iter;
+       char *interface_str = NULL;
+       GDBusProxy *device_proxy = NULL;
+       gboolean is_connected = FALSE;
+       struct hal_ev_adapter_profile_connected_devices ev;
+
+       DBG("Get Profile Connected Devices. UUID: %s", profile_uuid);
+       memset(&ev, 0, sizeof(ev));
+
+       conn = __bt_hal_get_system_gconn();
+       if (conn == NULL)
+               return BT_STATUS_FAIL;
+
+       manager_proxy = _bt_hal_get_manager_proxy();
+       if (manager_proxy == NULL)
+               return  BT_STATUS_FAIL;
+
+       result = g_dbus_proxy_call_sync(manager_proxy, "GetManagedObjects",
+                       NULL,
+                       G_DBUS_CALL_FLAGS_NONE,
+                       -1,
+                       NULL,
+                       &error);
+
+       if (!result) {
+               if (error != NULL) {
+                       ERR("GetManagedObjects failed (Error: %s)", error->message);
+                       g_clear_error(&error);
+                       error = NULL;
+               } else
+                       ERR("GetManagedObjects failed");
+               return BT_STATUS_FAIL;
+       }
+
+       /* signature of GetManagedObjects:  a{oa{sa{sv}}} */
+       g_variant_get(result, "(a{oa{sa{sv}}})", &iter);
+
+       /* Parse the signature:  oa{sa{sv}}} */
+       while (g_variant_iter_loop(iter, "{&oa{sa{sv}}}", &object_path, &interface_iter)) {
+               if (object_path == NULL)
+                       continue;
+
+               while (g_variant_iter_loop(interface_iter, "{sa{sv}}",
+                                       &interface_str, NULL)) {
+                       if (g_strcmp0(interface_str, "org.bluez.Device1") == 0) {
+                               DBG("Found a device: %s", object_path);
+                               g_free(interface_str);
+
+                               device_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+                                               NULL, BT_HAL_BLUEZ_NAME,
+                                               object_path, BT_HAL_DEVICE_INTERFACE,  NULL, NULL);
+
+                               if (device_proxy == NULL) {
+                                       DBG("Device don't have this service");
+                                       break;
+                               }
+
+                               result1 = g_dbus_proxy_call_sync(device_proxy, "IsConnectedProfile",
+                                               g_variant_new("(s)", profile_uuid),
+                                               G_DBUS_CALL_FLAGS_NONE,
+                                               -1,
+                                               NULL,
+                                               &error);
+
+                               if (result1 == NULL) {
+                                       if (error) {
+                                               ERR("Error occured in Proxy call [%s]", error->message);
+                                               g_error_free(error);
+                                               error = NULL;
+                                       }
+                                       g_object_unref(device_proxy);
+                                       break;
+                               }
+                               g_variant_get(result1, "(b)", &is_connected);
+
+                               if (is_connected == TRUE) {
+                                       char address[BT_HAL_ADDRESS_STRING_SIZE];
+                                       _bt_hal_convert_device_path_to_address(object_path, address);
+                                       DBG("Address: %s", address);
+                                       if (ev.count >= 10) {
+                                               INFO("Too many address");
+                                               break;
+                                       }
+                                       _bt_hal_convert_addr_string_to_type(ev.bdaddr_list[ev.count], address);
+                                       ev.count++;
+                               }
+
+                               g_variant_unref(result1);
+                               g_object_unref(device_proxy);
+                               break;
+                       }
+               }
+       }
+
+       if (!event_cb)
+               event_cb = _bt_hal_get_stack_message_handler();
+       if (event_cb) {
+               DBG("Sending HAL_EV_ADAPTER_PROFILE_CONNECTED_DEVICES event");
+               event_cb(HAL_EV_ADAPTER_PROFILE_CONNECTED_DEVICES, (void *)&ev, sizeof(ev));
+       }
+
+       g_variant_unref(result);
+       g_variant_iter_free(iter);
+
+       DBG("-");
+       return BT_STATUS_SUCCESS;
+}
+
 static gboolean __bt_adapter_all_properties_cb(gpointer user_data)
 {
        GVariant *result = user_data;
index c665922..f866662 100644 (file)
@@ -71,6 +71,8 @@ int _bt_hal_dbus_get_adapter_class(unsigned int *adapter_class);
 int _bt_hal_dbus_get_energy_info(uint32_t *tx_time, uint32_t *rx_time,
                                        uint32_t *idle_time, uint32_t *energy_used);
 
+int _bt_hal_dbus_get_profile_connected_devices(const char *profile_uuid);
+
 int _bt_hal_enable_core(void);
 
 #ifdef __cplusplus
index 3b53efd..38bf999 100644 (file)
@@ -152,6 +152,11 @@ static int get_adapter_energy_info(uint32_t *tx_time, uint32_t *rx_time,
 {
        return _bt_hal_dbus_get_energy_info(tx_time, rx_time, idle_time, energy_used);
 }
+
+static int get_profile_connected_devices(const char *profile_uuid)
+{
+       return _bt_hal_dbus_get_profile_connected_devices(profile_uuid);
+}
 #endif
 
 static int get_adapter_properties(void)
@@ -458,6 +463,7 @@ static const bt_interface_t bluetooth_if = {
 #ifdef TIZEN_BT_HAL
        .get_adapter_powered_status = get_adapter_powered_status,
        .get_adapter_energy_info = get_adapter_energy_info,
+       .get_profile_connected_devices = get_profile_connected_devices,
 #endif
        .get_adapter_properties = get_adapter_properties,
        .get_adapter_property = get_adapter_property,
@@ -697,6 +703,17 @@ static void __bt_hal_handle_adapter_property_changed(void *buf, uint16_t len)
                bt_hal_cbacks->adapter_properties_cb(ev->status, ev->num_props, props);
 }
 
+static void __bt_hal_handle_profile_connected_devices(void *buf, uint16_t len)
+{
+       struct hal_ev_adapter_profile_connected_devices *ev = (struct hal_ev_adapter_profile_connected_devices *)buf;
+
+       if (!bt_hal_cbacks->adapter_profile_connected_devices_cb)
+               return;
+
+       if (bt_hal_cbacks->adapter_profile_connected_devices_cb)
+               bt_hal_cbacks->adapter_profile_connected_devices_cb(ev->count, ev->bdaddr_list);
+}
+
 static void __bt_hal_handle_adapter_discovery_state_changed(void *buf, uint16_t len)
 {
        struct hal_ev_discovery_state_changed *ev = (struct hal_ev_discovery_state_changed *)buf;
@@ -1032,6 +1049,10 @@ static void __bt_hal_handle_stack_messages(int message, void *buf, uint16_t len)
                DBG("Event: HAL_EV_ADAPTER_PROPS_CHANGED");
                __bt_hal_handle_adapter_property_changed(buf, len);
                break;
+       case HAL_EV_ADAPTER_PROFILE_CONNECTED_DEVICES:
+               DBG("Event: HAL_EV_ADAPTER_PROFILE_CONNECTED_DEVICES");
+               __bt_hal_handle_profile_connected_devices(buf, len);
+               break;
        case HAL_EV_DISCOVERY_STATE_CHANGED:
                DBG("Event: HAL_EV_DISCOVERY_STATE_CHANGED");
                __bt_hal_handle_adapter_discovery_state_changed(buf, len);
index 6a233bc..c6a886b 100644 (file)
@@ -528,6 +528,9 @@ typedef void (*adapter_properties_callback)(bt_status_t status,
                int num_properties,
                bt_property_t *properties);
 
+typedef void (*adapter_profile_connected_devices_callback)(uint8_t count,
+               uint8_t bdaddr_list[][6]);
+
 /** GET/SET Remote Device Properties callback */
 /** TODO: For remote device properties, do not see a need to get/set
  * multiple properties - num_properties shall be 1
@@ -646,6 +649,7 @@ typedef struct {
        size_t size;
        adapter_state_changed_callback adapter_state_changed_cb;
        adapter_properties_callback adapter_properties_cb;
+       adapter_profile_connected_devices_callback adapter_profile_connected_devices_cb;
        remote_device_properties_callback remote_device_properties_cb;
        device_found_callback device_found_cb;
        discovery_state_changed_callback discovery_state_changed_cb;
@@ -759,6 +763,9 @@ typedef struct {
        /** Get Bluetooth Adapter Energy Information */
        int (*get_adapter_energy_info)(uint32_t *tx_time, uint32_t *rx_time,
                                                uint32_t *idle_time, uint32_t *energy_used);
+
+       /** Get Profile Connected Devices */
+       int (*get_profile_connected_devices)(const char *profile_uuid);
 #endif
 
        /** Get all Bluetooth Adapter properties at init */
index df42987..6271230 100644 (file)
@@ -344,6 +344,18 @@ oal_status_t adapter_get_service_uuids(void);
  */
 oal_status_t adapter_get_bonded_devices(void);
 
+/**
+ * @brief Get list of profile connected devices
+ *
+ * @remarks A list of bt_address_t is provided in the event data.
+ *
+ * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
+ * @retval #OAL_STATUS_SUCCESS  Successful
+ *
+ * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
+ */
+oal_status_t adapter_get_profile_connected_devices(const char *profile_uuid);
+
 /*
  * @brief Set connectability of adapter
  *
index 5d18a79..b2e8062 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
        EVENT(OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY)      /* event_dev_found_t */\
        EVENT(OAL_EVENT_ADAPTER_INQUIRY_RESULT_BLE)             /* event_ble_dev_found_t */\
        EVENT(OAL_EVENT_ADAPTER_INQUIRY_FINISHED)       \
+       EVENT(OAL_EVENT_ADAPTER_PROFILE_CONNECTED_DEVICES)      \
        EVENT(OAL_EVENT_CONTROLLER_ERROR_RECEIVED)              /* */\
        EVENT(OAL_EVENT_DEVICE_PROPERTIES)                                      /* remote_device_t */\
        EVENT(OAL_EVENT_DEVICE_NAME)                                            /* remote_device_t */\
@@ -225,6 +226,11 @@ typedef struct {
 } event_adapter_services_t;
 
 typedef struct {
+       uint8_t count;
+       bt_address_t addr_list[10];
+} event_adapter_profile_connected_devices;
+
+typedef struct {
        /* TODO Add more features */
        uint8_t  max_adv_instance;
        uint8_t rpa_offloading;
index 52812bc..0120f29 100644 (file)
@@ -59,6 +59,7 @@ static void cb_adapter_discovery_state_changed(bt_discovery_state_t state);
 static void cb_adapter_device_found(int num_properties, bt_property_t *properties);
 static void cb_adapter_properties(bt_status_t status,
                int num_properties, bt_property_t *properties);
+static void cb_adapter_profile_connected_devices(uint8_t count, uint8_t bdaddr_list[][6]);
 extern void cb_device_properties(bt_status_t status, bt_bdaddr_t *bd_addr,
                int num_properties, bt_property_t *properties);
 extern void cb_device_bond_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
@@ -87,6 +88,7 @@ static bt_callbacks_t callbacks = {
        .size = sizeof(callbacks),
        .adapter_state_changed_cb = cb_adapter_state_change,
        .adapter_properties_cb = cb_adapter_properties,
+       .adapter_profile_connected_devices_cb = cb_adapter_profile_connected_devices,
        .remote_device_properties_cb = cb_device_properties,
        .device_found_cb = cb_adapter_device_found,
        .discovery_state_changed_cb = cb_adapter_discovery_state_changed,
@@ -666,6 +668,23 @@ oal_status_t adapter_get_bonded_devices(void)
        return OAL_STATUS_SUCCESS;
 }
 
+oal_status_t adapter_get_profile_connected_devices(const char *profile_uuid)
+{
+       int ret;
+
+       CHECK_OAL_INITIALIZED();
+
+       API_TRACE();
+
+       ret = blued_api->get_profile_connected_devices(profile_uuid);
+       if (ret != BT_STATUS_SUCCESS) {
+               BT_ERR("get_profile_connected_devices failed: [%s]", status2string(ret));
+               return convert_to_oal_status(ret);
+       }
+
+       return OAL_STATUS_SUCCESS;
+}
+
 static oal_status_t set_scan_mode(bt_scan_mode_t mode)
 {
        bt_property_t prop;
@@ -1073,6 +1092,19 @@ static void cb_adapter_properties(bt_status_t status,
        }
 }
 
+static void cb_adapter_profile_connected_devices(uint8_t count, uint8_t addr_list[][6])
+{
+       event_adapter_profile_connected_devices *event_data;
+       int i;
+
+       event_data = g_malloc0(sizeof(event_adapter_profile_connected_devices));
+       event_data->count = count;
+       for (i = 0; i < count; i++) {
+               memcpy(event_data->addr_list[i].addr, addr_list[i], BT_ADDRESS_BYTES_NUM);
+       }
+       send_event(OAL_EVENT_ADAPTER_PROFILE_CONNECTED_DEVICES, event_data, sizeof(event_adapter_profile_connected_devices));
+}
+
 static void cb_adapter_discovery_state_changed(bt_discovery_state_t state)
 {
        oal_event_t event;
index bf3edac..a1b9e88 100644 (file)
@@ -909,112 +909,20 @@ int _bt_adapter_get_bonded_devices(void)
        return result;
 }
 
-int _bt_get_profile_connected_devices(char *profile_uuid, GArray **addr_list)
+int _bt_get_profile_connected_devices(const char *profile_uuid)
 {
-       BT_DBG("+");
-       GDBusConnection *conn;
-       GDBusProxy *manager_proxy;
-       GVariant *result = NULL;
-       GVariant *result1 = NULL;
-       GVariantIter *iter = NULL;
-       GError *error = NULL;
-       char *object_path = NULL;
-       GVariantIter *interface_iter;
-       char *interface_str = NULL;
-       GDBusProxy *device_proxy = NULL;
-       gboolean is_connected = FALSE;
-
-       conn = _bt_gdbus_get_system_gconn();
-       retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
-
-       manager_proxy = _bt_get_manager_proxy();
-       retv_if(manager_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
-
-       result = g_dbus_proxy_call_sync(manager_proxy, "GetManagedObjects",
-                       NULL,
-                       G_DBUS_CALL_FLAGS_NONE,
-                       -1,
-                       NULL,
-                       NULL);
-
-       if (!result) {
-               if (error != NULL) {
-                       BT_ERR("Failed to GetManagedObjects (Error: %s)", error->message);
-                       g_clear_error(&error);
-                       error = NULL;
-               } else
-                       BT_ERR("Failed to Failed to GetManagedObjects");
-               return BLUETOOTH_ERROR_INTERNAL;
-       }
-
-       /* signature of GetManagedObjects:  a{oa{sa{sv}}} */
-       g_variant_get(result, "(a{oa{sa{sv}}})", &iter);
-
-       /* Parse the signature:  oa{sa{sv}}} */
-       while (g_variant_iter_loop(iter, "{&oa{sa{sv}}}", &object_path, &interface_iter)) {
-               if (object_path == NULL)
-                       continue;
-
-               while (g_variant_iter_loop(interface_iter, "{sa{sv}}",
-                                       &interface_str, NULL)) {
-                       if (g_strcmp0(interface_str, "org.bluez.Device1") == 0) {
-                               BT_DBG("Found a device: %s", object_path);
-                               g_free(interface_str);
-
-                               device_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
-                                               NULL, BT_BLUEZ_NAME,
-                                               object_path, BT_DEVICE_INTERFACE,  NULL, NULL);
-
-                               if (device_proxy == NULL) {
-                                       BT_DBG("Device don't have this service");
-                                       break;
-                               }
-
-                               result1 = g_dbus_proxy_call_sync(device_proxy, "IsConnectedProfile",
-                                               g_variant_new("(s)", profile_uuid),
-                                               G_DBUS_CALL_FLAGS_NONE,
-                                               -1,
-                                               NULL,
-                                               &error);
-
-                               if (result1 == NULL) {
-                                       BT_ERR("Error occured in Proxy call");
-                                       if (error) {
-                                               BT_ERR("Error occured in Proxy call [%s]\n", error->message);
-                                               g_error_free(error);
-                                               error = NULL;
-                                       }
-                                       g_object_unref(device_proxy);
-                                       break;
-                               }
-                               g_variant_get(result1, "(b)", &is_connected);
-
-                               if (is_connected == TRUE) {
-                                       char address[BT_ADDRESS_STRING_SIZE];
-                                       bluetooth_device_address_t *addr = NULL;
-
-                                       _bt_convert_device_path_to_address(object_path, address);
-
-                                       addr = g_malloc0(sizeof(bluetooth_device_address_t));
-                                       _bt_convert_addr_string_to_type(addr->addr, address);
-
-                                       g_array_append_vals(*addr_list, addr,
-                                                       sizeof(bluetooth_device_address_t));
-                               }
-
-                               g_variant_unref(result1);
-                               g_object_unref(device_proxy);
-
-                               break;
-                       }
-               }
-       }
+       int result = BLUETOOTH_ERROR_NONE;
 
-       g_variant_unref(result);
-       g_variant_iter_free(iter);
+       BT_DBG("+");
+       result = adapter_get_profile_connected_devices(profile_uuid);
+       if (result != OAL_STATUS_SUCCESS) {
+               BT_ERR("adapter_get_profile_connected_devices failed: %d", result);
+               result = BLUETOOTH_ERROR_INTERNAL;
+       } else
+               result = BLUETOOTH_ERROR_NONE;
 
        BT_DBG("-");
-       return BLUETOOTH_ERROR_NONE;
+       return result;
 }
 
 static gboolean __bt_disconnect_all(void)
@@ -1315,6 +1223,11 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
 #endif
                break;
        }
+       case OAL_EVENT_ADAPTER_PROFILE_CONNECTED_DEVICES:
+               BT_DBG("OAL_EVENT_ADAPTER_PROFILE_CONNECTED_DEVICES");
+               __bt_adapter_handle_pending_requests(BT_GET_PROFILE_CONNECTED_DEVICES,
+                               event_data, sizeof(event_adapter_profile_connected_devices));
+               break;
        default:
                BT_ERR("Unhandled event..");
                break;
@@ -1503,6 +1416,16 @@ static void __bt_adapter_handle_pending_requests(int service_function, void *use
                        g_array_append_vals(out_param, &used, sizeof(gboolean));
                        break;
                }
+               case BT_GET_PROFILE_CONNECTED_DEVICES: {
+                       event_adapter_profile_connected_devices *event_data = user_data;
+                       bluetooth_device_address_t addr;
+                       int i;
+                       for (i = 0; i < event_data->count; i++) {
+                               memcpy(&addr, &event_data->addr_list[i], sizeof(bluetooth_device_address_t));
+                               g_array_append_vals(out_param, &addr, sizeof(bluetooth_device_address_t));
+                       }
+                       break;
+               }
                default:
                        BT_ERR("Unknown service function[%d]", service_function);
                }
index 2d7b1dd..fac0fa1 100644 (file)
@@ -205,6 +205,7 @@ static gboolean __bt_is_sync_function(int service_function)
                        || service_function == BT_GET_LOCAL_VERSION
                        || service_function == BT_GET_BONDED_DEVICES
                        || service_function == BT_GET_BONDED_DEVICE
+                       || service_function == BT_GET_PROFILE_CONNECTED_DEVICES
                        || service_function == BT_GET_IS_ALIAS_SET
                        || service_function == BT_GET_CONNECTED_LINK_TYPE
                        || service_function == BT_IS_SERVICE_USED
@@ -722,7 +723,14 @@ int __bt_bluez_request(int function_name,
        case BT_GET_PROFILE_CONNECTED_DEVICES: {
                char *uuid;
                uuid = (char *)g_variant_get_data(in_param1);
-               result = _bt_get_profile_connected_devices(uuid, out_param1);
+               result = _bt_get_profile_connected_devices(uuid);
+
+               /* Save invocation */
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       sender = (char *)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, NULL);
+               }
                break;
        }
        case BT_SET_ALIAS: {
index c30f28e..a0c354d 100644 (file)
@@ -272,8 +272,8 @@ int _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
 {
        char *l_uuid;
        int allow_bt = DPM_BT_ERROR;
-       GArray *addr_list = NULL;
-       int i = 0;
+       //GArray *addr_list = NULL;
+       //int i = 0;
 
        BT_INFO("_bt_dpm_add_bluetooth_uuids_to_blacklist");
 
@@ -287,6 +287,7 @@ int _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
 
        policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list  = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
 
+#if 0 /* Use device functions if this logic required in later */
        /* Disconnect if connected blacklist uuid is existing */
        addr_list = g_array_new(FALSE, FALSE, sizeof(gchar));
        _bt_get_profile_connected_devices((char *)uuid, &addr_list);
@@ -299,6 +300,7 @@ int _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
                // TODO: need to implement disconnect logic
        }
        g_array_free(addr_list, TRUE);
+#endif
 
        return BLUETOOTH_ERROR_NONE;
 }
@@ -559,6 +561,8 @@ int _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t valu
 
        dpm_profile_state[profile].value = value;
 
+
+#if 0 /* Use other functions if this logic required in later */
        /* In case of restriction, disconnect if connected profile is existing */
        if (value == DPM_RESTRICTED) {
                char *uuid = NULL;
@@ -613,6 +617,7 @@ int _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t valu
                }
                g_array_free(addr_list, TRUE);
        }
+#endif
 
        return BLUETOOTH_ERROR_NONE;
 }
index d9bf04d..17383fa 100644 (file)
@@ -203,6 +203,7 @@ static gboolean __bt_handle_oal_events(gpointer data)
        case OAL_EVENT_ADAPTER_INQUIRY_STARTED:
        case OAL_EVENT_ADAPTER_INQUIRY_FINISHED:
        case OAL_EVENT_CONTROLLER_ERROR_RECEIVED:
+       case OAL_EVENT_ADAPTER_PROFILE_CONNECTED_DEVICES:
                if (adapter_cb)
                        adapter_cb(event_type, event_data);
                break;
index f3852ee..77beddf 100644 (file)
@@ -95,7 +95,7 @@ int _bt_set_connectable(gboolean connectable);
 
 int _bt_adapter_get_bonded_devices(void);
 
-int _bt_get_profile_connected_devices(char *profile_uuid, GArray **addr_list);
+int _bt_get_profile_connected_devices(const char *profile_uuid);
 
 int _bt_init_profiles();