IPSP : Tie connected info and Interface Info 57/83357/4 accepted/tizen/common/20160812.140936 accepted/tizen/ivi/20160812.065432 accepted/tizen/mobile/20160812.065415 accepted/tizen/tv/20160812.065427 accepted/tizen/wearable/20160812.065421 submit/tizen/20160812.010225
authorTaejin Woo <tt.woo@samsung.com>
Wed, 10 Aug 2016 08:25:04 +0000 (17:25 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Thu, 11 Aug 2016 07:38:38 +0000 (16:38 +0900)
When connected between two device, they already know Interface info

Change-Id: Ie3ad742af386e7067a8187ad2644761ad852b59a
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
include/bluetooth_private.h
src/bluetooth-common.c
src/bluetooth-ipsp.c
test/bt_unit_test.c
test/bt_unit_test.h

index f9abb99c637b72c2108b2056461f92c3355a2ed8..c10e23f80453f2866ec8a306688899ecdc8c7502 100644 (file)
@@ -115,7 +115,6 @@ typedef enum {
 #endif
        BT_EVENT_IPSP_INIT_STATE_CHANGED, /**< IPSP Init status changed callback */
        BT_EVENT_IPSP_CONNECTION_STATUS, /**< IPSP connection status callback */
-       BT_EVENT_IPSP_INTERFACE_INFO, /**< IPSP connection BT Interface's Info Callback */
        BT_EVENT_LE_DATA_LENGTH_CHANGED, /** LE data length changed callback */
        BT_EVENT_ADVERTISING_STATE_CHANGED, /**< Advertising state changed callback */
        BT_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed callback */
@@ -577,7 +576,7 @@ int bt_le_ipsp_is_initialized(void);
  * @brief IPSP Connection state changed callback
  */
 typedef void (*bt_le_ipsp_connection_state_changed_cb)
-               (int result, bool connected, const char *remote_address, void *user_data);
+               (int result, bool connected, const char *remote_address, const char *iface_name, void *user_data);
 /**
  * @internal
  * @brief Set IPSP connection state event change callback.
@@ -599,13 +598,6 @@ typedef void (*bt_le_ipsp_interface_info_cb)
                (int result, const char *remote_address, const char *if_name,
                void *user_data);
 
-/**
- * @internal
- * @brief Set IPSP connection state event change callback.
- */
-int bt_le_ipsp_add_interface_info_cb(bt_le_ipsp_interface_info_cb callback,
-                                               void *user_data);
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_LE_MODULE
  * @brief Reads the maximum data length of LE packets supported by the controller.
index b1bc964e7f4e6463c1ca44e7487297c866355bba..591cf5898ad92a8fdac397434d1df3a2b33fbdc9 100644 (file)
@@ -764,7 +764,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
        media_metadata_attributes_t *metadata = NULL;
        bluetooth_authentication_request_info_t *auth_information = NULL;
        bt_le_data_length_params_t  *data_length_info = NULL;
-       bt_ipsp_interface_info_t *ipsp_iface_info = NULL;
+       bt_ipsp_connection_info_t *bt_ipsp_iface_info = NULL;
 
        event_index = __bt_get_cb_index(event);
 
@@ -1823,26 +1823,18 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                break;
        case BLUETOOTH_EVENT_IPSP_CONNECTED:
                BT_INFO("BLUETOOTH_EVENT_IPSP_CONNECTED");
-               bd_addr = (bluetooth_device_address_t *)(param->param_data);
-               _bt_convert_address_to_string(&device_addr, bd_addr);
+               bt_ipsp_iface_info = (bt_ipsp_connection_info_t *)(param->param_data);
+               _bt_convert_address_to_string(&device_addr, &bt_ipsp_iface_info->btaddr);
                ((bt_le_ipsp_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
-               (_bt_get_error_code(param->result), TRUE, device_addr,
+               (_bt_get_error_code(param->result), TRUE, device_addr, bt_ipsp_iface_info->if_name,
                 bt_event_slot_container[event_index].user_data);
                break;
        case BLUETOOTH_EVENT_IPSP_DISCONNECTED:
                BT_INFO("BLUETOOTH_EVENT_IPSP_DISCONNECTED");
-               bd_addr = (bluetooth_device_address_t *)(param->param_data);
-               _bt_convert_address_to_string(&device_addr, bd_addr);
+               bt_ipsp_iface_info = (bt_ipsp_connection_info_t *)(param->param_data);
+               _bt_convert_address_to_string(&device_addr, &bt_ipsp_iface_info->btaddr);
                ((bt_le_ipsp_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
-               (_bt_get_error_code(param->result), FALSE, device_addr,
-                bt_event_slot_container[event_index].user_data);
-               break;
-       case BLUETOOTH_EVENT_IPSP_INTERFACE_INFO:
-               BT_INFO("BLUETOOTH_EVENT_IPSP_INTERFACE_INFO");
-               ipsp_iface_info = (bt_ipsp_interface_info_t *)(param->param_data);
-               _bt_convert_address_to_string(&device_addr, &ipsp_iface_info->btaddr);
-               ((bt_le_ipsp_interface_info_cb)bt_event_slot_container[event_index].callback)
-               (_bt_get_error_code(param->result), device_addr, ipsp_iface_info->if_name,
+               (_bt_get_error_code(param->result), FALSE, device_addr, bt_ipsp_iface_info->if_name,
                 bt_event_slot_container[event_index].user_data);
                break;
        case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED:
@@ -2592,8 +2584,6 @@ static int __bt_get_cb_index(int event)
        case BLUETOOTH_EVENT_IPSP_CONNECTED:
        case BLUETOOTH_EVENT_IPSP_DISCONNECTED:
                return BT_EVENT_IPSP_CONNECTION_STATUS; /* LCOV_EXCL_LINE */
-       case BLUETOOTH_EVENT_IPSP_INTERFACE_INFO:
-               return BT_EVENT_IPSP_INTERFACE_INFO;
        case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED:
                return BT_EVENT_LE_DATA_LENGTH_CHANGED; /* LCOV_EXCL_LINE */
 #ifdef TIZEN_WEARABLE
index 2ed0ff15465c287386fa095cb531ad3f0f07fe9d..a2a1b7a9cceb60a3adb4461d2f1e04d45c85a6c5 100644 (file)
@@ -162,13 +162,4 @@ int bt_le_ipsp_unset_connection_state_changed_cb(void)
        return BT_ERROR_NONE;
 }
 
-int bt_le_ipsp_add_interface_info_cb(bt_le_ipsp_interface_info_cb callback, void *user_data)
-{
-       BT_CHECK_IPSP_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(callback);
-       _bt_set_cb(BT_EVENT_IPSP_INTERFACE_INFO, callback, user_data);
-
-       return BT_ERROR_NONE;
-}
 /* LCOV_EXCL_STOP */
index 8b726beef1b850083569060754206d7b974d958d..1dd885214176da383cb7fce9addf8d030cbed220 100644 (file)
@@ -808,8 +808,6 @@ tc_table_t tc_ipsp[] = {
                                , BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_STATE_CHANGED_CB},
        {"bt_ipsp_unset_connection_state_changed_cb[Client/Server role]"
                                , BT_UNIT_TEST_FUNCTION_IPSP_UNSET_CONNECTION_STATE_CHANGED_CB},
-       {"bt_ipsp_set_connection_bt_iface_info_cb[Client/Server role]"
-                               , BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_BT_IFACE_INFO_CB},
        {"bt_ipsp_create_ipsp_app_server_socket[Server App role]"
                                , BT_UNIT_TEST_FUNCTION_IPSP_CREATE_APP_SERVER_SOCKET},
        {"bt_ipsp_connect_with_ipsp_app_server_socket[Client App role]"
@@ -2671,21 +2669,16 @@ void __bt_le_ipsp_init_state_changed_cb(int result,
 }
 
 void __bt_le_ipsp_connection_state_changed_cb(int result,
-       bool connected, const char *remote_address, void *user_data)
+       bool connected, const char *remote_address, const char *iface_name, void *user_data)
 {
        TC_PRT("__bt_le_ipsp_connection_state_changed_cb: called");
        TC_PRT("result: %s", __bt_get_error_message(result));
        TC_PRT("Connected: %d", connected);
-}
-
-void __bt_le_ipsp_interface_info_cb(int result,
-               const char *remote_address, const char *iface_name,
-               void *user_data)
-{
-       TC_PRT("__bt_le_ipsp_interface_info_cb: called");
-       TC_PRT("result: %s", __bt_get_error_message(result));
        TC_PRT("Remote BT address : %s", remote_address);
-       TC_PRT("Local BT Interface : %s is UP", iface_name);
+       if(connected)
+               TC_PRT("Local BT Interface : %s is Up", iface_name);
+       else
+               TC_PRT("Local BT Interface : %s is Down", iface_name);
        memcpy(ipsp_iface_name, iface_name, strlen(iface_name));
 }
 
@@ -7643,12 +7636,6 @@ int test_input_callback(void *data)
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
 
-               case BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_BT_IFACE_INFO_CB:
-                       ret = bt_le_ipsp_add_interface_info_cb(
-                                       __bt_le_ipsp_interface_info_cb, NULL);
-                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       break;
-
                case BT_UNIT_TEST_FUNCTION_IPSP_CREATE_APP_SERVER_SOCKET: {
                        int serverSocket = 0;
                        struct ifaddrs *ifap, *ifa;
index c1506ec67af721906d9851f3dfaff9da093428df..abb1a5c3f61dbb5f563037f0c54cf7584d96629f 100644 (file)
@@ -335,7 +335,6 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_IPSP_START_ADVERTISING,
        BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_STATE_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_IPSP_UNSET_CONNECTION_STATE_CHANGED_CB,
-       BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_BT_IFACE_INFO_CB,
        BT_UNIT_TEST_FUNCTION_IPSP_CREATE_APP_SERVER_SOCKET,
        BT_UNIT_TEST_FUNCTION_IPSP_CONNECT_WITH_APP_SERVER_SOCKET,
        BT_UNIT_TEST_FUNCTION_IPSP_SEND_IPV6_APP_DATA,