Add a missed prototype of internal API. 76/133376/1
authorDeokhyun Kim <dukan.kim@samsung.com>
Mon, 12 Jun 2017 04:03:37 +0000 (13:03 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Mon, 12 Jun 2017 04:03:37 +0000 (13:03 +0900)
 - bt_adapter_foreach_profile_connected_devices()

Change-Id: I72b87d78030b6134ddb35f7f83aae2f9f06be09b
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
include/mobile/bluetooth_internal.h
include/mobile/bluetooth_type_internal.h
include/wearable/bluetooth_internal.h
include/wearable/bluetooth_type_internal.h
test/bt_unit_test.c
test/bt_unit_test.h

index aeed803e951e0f8ae29c549cb0cbb8e43a3f0527..bd3af982cbe902abc5d6e9bd4da2810b8195f6e9 100644 (file)
@@ -1078,6 +1078,34 @@ int bt_adapter_le_scan_filter_unregister_all(void);
  */
 int bt_adapter_le_set_advertising_filter_policy(bt_advertiser_h advertiser, bt_adapter_le_advertising_filter_policy_e filter_policy);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Retrieves the address of the devices connected with the specific profile.
+ * @since_tizen 2.3.1
+ *
+ * @param[in] profile_uuid The UUID of profile service uuid of the connected device
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data passed from the foreach function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  There is no connected device
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @post This function invokes bt_adapter_profile_connected_devices_cb().
+ *
+ * @see bt_adapter_profile_connected_devices_cb()
+ */
+int bt_adapter_foreach_profile_connected_devices(const char *profile_uuid,
+       bt_adapter_profile_connected_devices_cb callback, void *user_data);
+
 /**
  * @internal
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
index 96dd8d23c9212375a75d709e7f1cdd8429dd9047..4edee6be8b86ea0879f5ea9ea2776a191ef43d15 100644 (file)
@@ -30,6 +30,23 @@ extern "C"
  * @file bluetooth_type_internal.h
  */
 
+#define BT_PROFILE_SERVICE_UUID_SPP            "1101"
+#define BT_PROFILE_SERVICE_UUID_HSP_HS         "1108"
+#define BT_PROFILE_SERVICE_UUID_HSP_AG         "1112"
+#define BT_PROFILE_SERVICE_UUID_OPP            "1105"
+#define BT_PROFILE_SERVICE_UUID_HFP_HF         "111e"
+#define BT_PROFILE_SERVICE_UUID_HFP_AG         "111f"
+#define BT_PROFILE_SERVICE_UUID_A2DP_SOURCE    "110a"
+#define BT_PROFILE_SERVICE_UUID_A2DP_SINK      "110b"
+#define BT_PROFILE_SERVICE_UUID_AVRCP_TARGET   "110c"
+#define BT_PROFILE_SERVICE_UUID_AVRCP_CONTROL  "110f"
+#define BT_PROFILE_SERVICE_UUID_PAN_PANU       "1115"
+#define BT_PROFILE_SERVICE_UUID_PAN_NAP                "1116"
+#define BT_PROFILE_SERVICE_UUID_PAN_GN         "1117"
+#define BT_PROFILE_SERVICE_UUID_HDP_SOURCE     "1401"
+#define BT_PROFILE_SERVICE_UUID_HDP_SINK       "1402"
+#define BT_PROFILE_SERVICE_UUID_HID            "1124"
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
  * @brief  Enumerations of the Bluetooth adapter le state.
index 61980d2cf0c87d73af05b39f675c886f1f0adc80..6d85f328f90586a4c3967fe3b927f3ffa00cc40f 100644 (file)
@@ -1048,6 +1048,34 @@ int bt_adapter_le_scan_filter_unregister_all(void);
  */
 int bt_adapter_le_set_advertising_filter_policy(bt_advertiser_h advertiser, bt_adapter_le_advertising_filter_policy_e filter_policy);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Retrieves the address of the devices connected with the specific profile.
+ * @since_tizen 2.3.1
+ *
+ * @param[in] profile_uuid The UUID of profile service uuid of the connected device
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data passed from the foreach function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  There is no connected device
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @post This function invokes bt_adapter_profile_connected_devices_cb().
+ *
+ * @see bt_adapter_profile_connected_devices_cb()
+ */
+int bt_adapter_foreach_profile_connected_devices(const char *profile_uuid,
+       bt_adapter_profile_connected_devices_cb callback, void *user_data);
+
 /**
  * @internal
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
index b831fba8f95737dd5004a5fdabd91210f66a9994..e8a77dffaec445e13ac04d3b1ea932af8651056c 100644 (file)
@@ -29,6 +29,23 @@ extern "C"
  * @file bluetooth_type_internal.h
  */
 
+#define BT_PROFILE_SERVICE_UUID_SPP            "1101"
+#define BT_PROFILE_SERVICE_UUID_HSP_HS         "1108"
+#define BT_PROFILE_SERVICE_UUID_HSP_AG         "1112"
+#define BT_PROFILE_SERVICE_UUID_OPP            "1105"
+#define BT_PROFILE_SERVICE_UUID_HFP_HF         "111e"
+#define BT_PROFILE_SERVICE_UUID_HFP_AG         "111f"
+#define BT_PROFILE_SERVICE_UUID_A2DP_SOURCE    "110a"
+#define BT_PROFILE_SERVICE_UUID_A2DP_SINK      "110b"
+#define BT_PROFILE_SERVICE_UUID_AVRCP_TARGET   "110c"
+#define BT_PROFILE_SERVICE_UUID_AVRCP_CONTROL  "110f"
+#define BT_PROFILE_SERVICE_UUID_PAN_PANU       "1115"
+#define BT_PROFILE_SERVICE_UUID_PAN_NAP                "1116"
+#define BT_PROFILE_SERVICE_UUID_PAN_GN         "1117"
+#define BT_PROFILE_SERVICE_UUID_HDP_SOURCE     "1401"
+#define BT_PROFILE_SERVICE_UUID_HDP_SINK       "1402"
+#define BT_PROFILE_SERVICE_UUID_HID            "1124"
+
 /* This variable will be added into bt_service_class_t in tizen 4.0 */
 #define BT_SC_MAP_SERVICE_MASK 0x00800000 /**< MAP service class */
 
index 48c3641ac754fde156ab4ba657ec6b8b1a3efbd2..1d52a78dbd2e7b9c5a75239f53908facb0f44a99 100644 (file)
@@ -218,6 +218,8 @@ tc_table_t tc_adapter[] = {
                , BT_UNIT_TEST_FUNCTION_ADAPTER_IS_DISCOVERING},
        {"bt_adapter_foreach_bonded_device"
                , BT_UNIT_TEST_FUNCTION_ADAPTER_FOREACH_BONDED_DEVICE},
+       {"bt_adapter_foreach_profile_connected_devices"
+               , BT_UNIT_TEST_FUNCTION_ADAPTER_FOREACH_PROFILE_CONNECTED_DEVICES},
        {"bt_adapter_get_bonded_device_info"
                , BT_UNIT_TEST_FUNCTION_ADAPTER_GET_BONDED_DEVICE_INFO},
        {"bt_adapter_is_service_used"
@@ -1540,6 +1542,14 @@ static bool __bt_adapter_bonded_device_cb(bt_device_info_s *device_info,
        return true;
 }
 
+static bool __bt_adapter_profile_connected_devices_cb(
+       const char *remote_address, void *user_data)
+{
+       TC_PRT("remote_address: %s", remote_address);
+
+       return true;
+}
+
 static void __bt_adapter_device_discovery_state_changed_cb(
        int result, bt_adapter_device_discovery_state_e discovery_state,
        bt_adapter_device_discovery_info_s *discovery_info,
@@ -4798,6 +4808,21 @@ int test_input_callback(void *data)
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                }
+               case BT_UNIT_TEST_FUNCTION_ADAPTER_FOREACH_PROFILE_CONNECTED_DEVICES: {
+                       ret = bt_adapter_foreach_profile_connected_devices(BT_PROFILE_SERVICE_UUID_SPP,
+                               __bt_adapter_profile_connected_devices_cb, NULL);
+                       TC_PRT("SPP connected devices returns %s\n", __bt_get_error_message(ret));
+                       ret = bt_adapter_foreach_profile_connected_devices(BT_PROFILE_SERVICE_UUID_HFP_HF,
+                               __bt_adapter_profile_connected_devices_cb, NULL);
+                       TC_PRT("HFP HF connected devices returns %s\n", __bt_get_error_message(ret));
+                       ret = bt_adapter_foreach_profile_connected_devices(BT_PROFILE_SERVICE_UUID_A2DP_SOURCE,
+                               __bt_adapter_profile_connected_devices_cb, NULL);
+                       TC_PRT("A2DP Source connected devices returns %s\n", __bt_get_error_message(ret));
+                       ret = bt_adapter_foreach_profile_connected_devices(BT_PROFILE_SERVICE_UUID_AVRCP_CONTROL,
+                               __bt_adapter_profile_connected_devices_cb, NULL);
+                       TC_PRT("AVRCP Control connected devices returns %s\n", __bt_get_error_message(ret));
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_ADAPTER_GET_BONDED_DEVICE_INFO: {
                        bt_device_info_s *device_info = NULL;
 
index f7548802b57b1c7d523b397ce1189d89b6e0a47f..5fe851193c3756cf8f48f878722e7f58854e2042 100644 (file)
@@ -71,6 +71,7 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_ADAPTER_STOP_DEVICE_DISCOVERY,
        BT_UNIT_TEST_FUNCTION_ADAPTER_IS_DISCOVERING,
        BT_UNIT_TEST_FUNCTION_ADAPTER_FOREACH_BONDED_DEVICE,
+       BT_UNIT_TEST_FUNCTION_ADAPTER_FOREACH_PROFILE_CONNECTED_DEVICES,
        BT_UNIT_TEST_FUNCTION_ADAPTER_GET_BONDED_DEVICE_INFO,
        BT_UNIT_TEST_FUNCTION_ADAPTER_IS_SERVICE_USED,
        BT_UNIT_TEST_FUNCTION_ADAPTER_GET_VISIBILITY,