From 50f2bec3f5a4028afba9303da7575231bebb09bb Mon Sep 17 00:00:00 2001 From: Taejin Woo Date: Fri, 12 Aug 2016 11:18:43 +0900 Subject: [PATCH] Fix the IPSP APIs' name and move those in the internal.h Change-Id: Ifd7d4d3cf13a8d300df6843dbc57efbd0047b492 Signed-off-by: Taejin Woo --- include/bluetooth_private.h | 64 ---------------------- include/mobile/bluetooth_internal.h | 43 +++++++++++++++ include/mobile/bluetooth_type_internal.h | 20 ++++++- include/tv/bluetooth_internal.h | 43 +++++++++++++++ include/tv/bluetooth_type_internal.h | 14 ++++- include/wearable/bluetooth_internal.h | 43 +++++++++++++++ include/wearable/bluetooth_type_internal.h | 14 +++++ src/bluetooth-common.c | 6 +- src/bluetooth-ipsp.c | 23 ++++---- test/bt_unit_test.c | 40 +++++++------- 10 files changed, 210 insertions(+), 100 deletions(-) diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index c10e23f..b0686b1 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -534,70 +534,6 @@ const GSList *_bt_gatt_get_server_list(void); int _bt_gatt_client_update_all(bt_gatt_client_h client); -/** - * @internal - * @brief IPSP Init state changed callback - */ -typedef void (*bt_le_ipsp_init_state_changed_cb) - (int result, bool ipsp_initialized, void *user_data); - -/** - * @internal - * @brief Initialize Bluetooth LE IPSP service and set the callback - */ -int bt_le_ipsp_initialize(bt_le_ipsp_init_state_changed_cb callback, void *user_data); - -/** - * @internal - * @brief De-Initialize Bluetooth LE IPSP service and unset the callback - */ -int bt_le_ipsp_deinitialize(void); - -/** - * @internal - * @brief Connect to a IPSP service over LE to remote device. - */ -int bt_le_ipsp_connect(const char *address); - -/** - * @internal - * @brief Disconnect to a IPSP service over LE to remote device. - */ -int bt_le_ipsp_disconnect(const char *address); - -/** -* @internal -* @brief Check whether IPSP service is initialized -*/ -int bt_le_ipsp_is_initialized(void); - -/** - * @internal - * @brief IPSP Connection state changed callback - */ -typedef void (*bt_le_ipsp_connection_state_changed_cb) - (int result, bool connected, const char *remote_address, const char *iface_name, void *user_data); -/** - * @internal - * @brief Set IPSP connection state event change callback. - */ -int bt_le_ipsp_set_connection_state_changed_cb(bt_le_ipsp_connection_state_changed_cb callback, - void *user_data); - -/** - * @internal - * @brief Unset IPSP connection state event change callback. - */ -int bt_le_ipsp_unset_connection_state_changed_cb(void); - -/** - * @internal - * @brief IPSP Connection Interface Info callback - */ -typedef void (*bt_le_ipsp_interface_info_cb) - (int result, const char *remote_address, const char *if_name, - void *user_data); - /** * @ingroup CAPI_NETWORK_BLUETOOTH_LE_MODULE * @brief Reads the maximum data length of LE packets supported by the controller. diff --git a/include/mobile/bluetooth_internal.h b/include/mobile/bluetooth_internal.h index 2fd346b..66e7d31 100644 --- a/include/mobile/bluetooth_internal.h +++ b/include/mobile/bluetooth_internal.h @@ -3017,6 +3017,49 @@ int bt_dpm_set_data_transfer_state(bt_dpm_status_e value); */ int bt_dpm_get_data_transfer_state(bt_dpm_status_e *value); +/** + * @internal + * @brief Initialize Bluetooth IPSP service and set the callback + */ +int bt_ipsp_initialize(bt_ipsp_init_state_changed_cb callback, void *user_data); + +/** + * @internal + * @brief De-Initialize Bluetooth IPSP service and unset the callback + */ +int bt_ipsp_deinitialize(void); + +/** + * @internal + * @brief Connect to a IPSP service over LE to remote device. + */ +int bt_ipsp_connect(const char *address); + +/** + * @internal + * @brief Disconnect to a IPSP service over LE to remote device. + */ +int bt_ipsp_disconnect(const char *address); + +/** +* @internal +* @brief Check whether IPSP service is initialized +*/ +int bt_ipsp_is_initialized(void); + +/** + * @internal + * @brief Set IPSP connection state event change callback. + */ +int bt_ipsp_set_connection_state_changed_cb(bt_ipsp_connection_state_changed_cb callback, + void *user_data); + +/** + * @internal + * @brief Unset IPSP connection state event change callback. + */ +int bt_ipsp_unset_connection_state_changed_cb(void); + /** * @} */ diff --git a/include/mobile/bluetooth_type_internal.h b/include/mobile/bluetooth_type_internal.h index 0b1547f..1a09f63 100644 --- a/include/mobile/bluetooth_type_internal.h +++ b/include/mobile/bluetooth_type_internal.h @@ -361,7 +361,25 @@ typedef void (*bt_hid_device_connection_state_changed_cb) (int result, * @see bt_hid_device_set_data_received_cb() */ typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data); -/* HID device related type */ + +/** + * @internal + * @ingroup + * @brief IPSP Init state changed callback + * @since_tizen 3.0 + */ +typedef void (*bt_ipsp_init_state_changed_cb) + (int result, bool ipsp_initialized, void *user_data); + +/** + * @internal + * @ingroup + * @since_tizen 3.0 + + * @brief IPSP Connection state changed callback + */ +typedef void (*bt_ipsp_connection_state_changed_cb) + (int result, bool connected, const char *remote_address, const char *iface_name, void *user_data); /** diff --git a/include/tv/bluetooth_internal.h b/include/tv/bluetooth_internal.h index ce3ba68..24243e0 100644 --- a/include/tv/bluetooth_internal.h +++ b/include/tv/bluetooth_internal.h @@ -3018,6 +3018,49 @@ int bt_dpm_set_data_transfer_state(bt_dpm_status_e value); */ int bt_dpm_get_data_transfer_state(bt_dpm_status_e *value); +/** + * @internal + * @brief Initialize Bluetooth IPSP service and set the callback + */ +int bt_ipsp_initialize(bt_ipsp_init_state_changed_cb callback, void *user_data); + +/** + * @internal + * @brief De-Initialize Bluetooth IPSP service and unset the callback + */ +int bt_ipsp_deinitialize(void); + +/** + * @internal + * @brief Connect to a IPSP service over LE to remote device. + */ +int bt_ipsp_connect(const char *address); + +/** + * @internal + * @brief Disconnect to a IPSP service over LE to remote device. + */ +int bt_ipsp_disconnect(const char *address); + +/** +* @internal +* @brief Check whether IPSP service is initialized +*/ +int bt_ipsp_is_initialized(void); + +/** + * @internal + * @brief Set IPSP connection state event change callback. + */ +int bt_ipsp_set_connection_state_changed_cb(bt_ipsp_connection_state_changed_cb callback, + void *user_data); + +/** + * @internal + * @brief Unset IPSP connection state event change callback. + */ +int bt_ipsp_unset_connection_state_changed_cb(void); + /** * @} */ diff --git a/include/tv/bluetooth_type_internal.h b/include/tv/bluetooth_type_internal.h index 8dfda7f..f9386eb 100644 --- a/include/tv/bluetooth_type_internal.h +++ b/include/tv/bluetooth_type_internal.h @@ -361,8 +361,20 @@ typedef void (*bt_hid_device_connection_state_changed_cb) (int result, * @see bt_hid_device_set_data_received_cb() */ typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data); -/* HID device related type */ +/** + * @internal + * @brief IPSP Init state changed callback + */ +typedef void (*bt_ipsp_init_state_changed_cb) + (int result, bool ipsp_initialized, void *user_data); + +/** + * @internal + * @brief IPSP Connection state changed callback + */ +typedef void (*bt_ipsp_connection_state_changed_cb) + (int result, bool connected, const char *remote_address, const char *iface_name, void *user_data); /** * @} diff --git a/include/wearable/bluetooth_internal.h b/include/wearable/bluetooth_internal.h index 72d23a3..a3f90dc 100644 --- a/include/wearable/bluetooth_internal.h +++ b/include/wearable/bluetooth_internal.h @@ -3165,6 +3165,49 @@ int bt_dpm_set_data_transfer_state(bt_dpm_status_e value); */ int bt_dpm_get_data_transfer_state(bt_dpm_status_e *value); +/** + * @internal + * @brief Initialize Bluetooth IPSP service and set the callback + */ +int bt_ipsp_initialize(bt_ipsp_init_state_changed_cb callback, void *user_data); + +/** + * @internal + * @brief De-Initialize Bluetooth IPSP service and unset the callback + */ +int bt_ipsp_deinitialize(void); + +/** + * @internal + * @brief Connect to a IPSP service over LE to remote device. + */ +int bt_ipsp_connect(const char *address); + +/** + * @internal + * @brief Disconnect to a IPSP service over LE to remote device. + */ +int bt_ipsp_disconnect(const char *address); + +/** +* @internal +* @brief Check whether IPSP service is initialized +*/ +int bt_ipsp_is_initialized(void); + +/** + * @internal + * @brief Set IPSP connection state event change callback. + */ +int bt_ipsp_set_connection_state_changed_cb(bt_ipsp_connection_state_changed_cb callback, + void *user_data); + +/** + * @internal + * @brief Unset IPSP connection state event change callback. + */ +int bt_ipsp_unset_connection_state_changed_cb(void); + /** * @} */ diff --git a/include/wearable/bluetooth_type_internal.h b/include/wearable/bluetooth_type_internal.h index a596b0b..ac4fe1a 100644 --- a/include/wearable/bluetooth_type_internal.h +++ b/include/wearable/bluetooth_type_internal.h @@ -379,6 +379,20 @@ typedef struct { char **uuids; } bt_dpm_uuids_list_s; +/** + * @internal + * @brief IPSP Init state changed callback + */ +typedef void (*bt_ipsp_init_state_changed_cb) + (int result, bool ipsp_initialized, void *user_data); + +/** + * @internal + * @brief IPSP Connection state changed callback + */ +typedef void (*bt_ipsp_connection_state_changed_cb) + (int result, bool connected, const char *remote_address, const char *iface_name, void *user_data); + /** * @} */ diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 591cf58..6aee504 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -1825,7 +1825,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us BT_INFO("BLUETOOTH_EVENT_IPSP_CONNECTED"); 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_ipsp_connection_state_changed_cb)bt_event_slot_container[event_index].callback) (_bt_get_error_code(param->result), TRUE, device_addr, bt_ipsp_iface_info->if_name, bt_event_slot_container[event_index].user_data); break; @@ -1833,7 +1833,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us BT_INFO("BLUETOOTH_EVENT_IPSP_DISCONNECTED"); 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_ipsp_connection_state_changed_cb)bt_event_slot_container[event_index].callback) (_bt_get_error_code(param->result), FALSE, device_addr, bt_ipsp_iface_info->if_name, bt_event_slot_container[event_index].user_data); break; @@ -2104,7 +2104,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us #endif case BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED: { BT_DBG("BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED"); /* LCOV_EXCL_LINE */ - ((bt_le_ipsp_init_state_changed_cb)bt_event_slot_container[event_index].callback) /* LCOV_EXCL_LINE */ + ((bt_ipsp_init_state_changed_cb)bt_event_slot_container[event_index].callback) /* LCOV_EXCL_LINE */ (_bt_get_error_code(param->result), *(bool *)(param->param_data), /* LCOV_EXCL_LINE */ bt_event_slot_container[event_index].user_data); break; diff --git a/src/bluetooth-ipsp.c b/src/bluetooth-ipsp.c index a2a1b7a..d7225a5 100644 --- a/src/bluetooth-ipsp.c +++ b/src/bluetooth-ipsp.c @@ -23,6 +23,7 @@ #include #include "bluetooth.h" +#include "bluetooth_internal.h" #include "bluetooth_private.h" static bool is_ipsp_initialized = false; @@ -53,7 +54,7 @@ int __bt_check_ipsp_init_status(void) return BT_ERROR_NONE; } -int bt_le_ipsp_is_initialized(void) +int bt_ipsp_is_initialized(void) { BT_CHECK_IPSP_SUPPORT(); BT_CHECK_INIT_STATUS(); @@ -61,7 +62,7 @@ int bt_le_ipsp_is_initialized(void) return BT_ERROR_NONE; } -int bt_le_ipsp_initialize(bt_le_ipsp_init_state_changed_cb callback, +int bt_ipsp_initialize(bt_ipsp_init_state_changed_cb callback, void *user_data) { int error; @@ -73,7 +74,7 @@ int bt_le_ipsp_initialize(bt_le_ipsp_init_state_changed_cb callback, BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(callback); - error = bluetooth_le_ipsp_init(); + error = bluetooth_ipsp_init(); error = _bt_get_error_code(error); if (BT_ERROR_NONE != error) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); @@ -86,7 +87,7 @@ int bt_le_ipsp_initialize(bt_le_ipsp_init_state_changed_cb callback, return BT_ERROR_NONE; } -int bt_le_ipsp_deinitialize(void) +int bt_ipsp_deinitialize(void) { int error; @@ -94,7 +95,7 @@ int bt_le_ipsp_deinitialize(void) BT_CHECK_INIT_STATUS(); BT_CHECK_IPSP_INIT_STATUS(); - error = bluetooth_le_ipsp_deinit(); + error = bluetooth_ipsp_deinit(); error = _bt_get_error_code(error); if (BT_ERROR_NONE != error) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); @@ -105,7 +106,7 @@ int bt_le_ipsp_deinitialize(void) return BT_ERROR_NONE; } -int bt_le_ipsp_connect(const char *address) +int bt_ipsp_connect(const char *address) { int ret; bluetooth_device_address_t bd_addr = { {0,} }; @@ -116,7 +117,7 @@ int bt_le_ipsp_connect(const char *address) _bt_convert_address_to_hex(&bd_addr, address); - ret = _bt_get_error_code(bluetooth_le_ipsp_connect((ipsp_device_address_t *)&bd_addr)); + ret = _bt_get_error_code(bluetooth_ipsp_connect((ipsp_device_address_t *)&bd_addr)); if (ret != BT_ERROR_NONE) BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); @@ -124,7 +125,7 @@ int bt_le_ipsp_connect(const char *address) return ret; } -int bt_le_ipsp_disconnect(const char *address) +int bt_ipsp_disconnect(const char *address) { int ret; bluetooth_device_address_t bd_addr = { {0,} }; @@ -135,7 +136,7 @@ int bt_le_ipsp_disconnect(const char *address) _bt_convert_address_to_hex(&bd_addr, address); - ret = _bt_get_error_code(bluetooth_le_ipsp_disconnect((ipsp_device_address_t *)&bd_addr)); + ret = _bt_get_error_code(bluetooth_ipsp_disconnect((ipsp_device_address_t *)&bd_addr)); if (ret != BT_ERROR_NONE) BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); @@ -143,7 +144,7 @@ int bt_le_ipsp_disconnect(const char *address) return ret; } -int bt_le_ipsp_set_connection_state_changed_cb(bt_le_ipsp_connection_state_changed_cb callback, void *user_data) +int bt_ipsp_set_connection_state_changed_cb(bt_ipsp_connection_state_changed_cb callback, void *user_data) { BT_CHECK_IPSP_SUPPORT(); BT_CHECK_INIT_STATUS(); @@ -153,7 +154,7 @@ int bt_le_ipsp_set_connection_state_changed_cb(bt_le_ipsp_connection_state_chang return BT_ERROR_NONE; } -int bt_le_ipsp_unset_connection_state_changed_cb(void) +int bt_ipsp_unset_connection_state_changed_cb(void) { BT_CHECK_IPSP_SUPPORT(); BT_CHECK_INIT_STATUS(); diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index 1dd8852..9e3ebb9 100644 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -790,19 +790,19 @@ tc_table_t tc_ipsp[] = { /* IPSP functions */ {"BACK" , BT_UNIT_TEST_FUNCTION_BACK}, - {"bt_le_ipsp_register[Server role]" + {"bt_ipsp_register[Server role]" , BT_UNIT_TEST_FUNCTION_IPSP_REGISTER}, - {"bt_le_ipsp_unregister[Server role]" + {"bt_ipsp_unregister[Server role]" , BT_UNIT_TEST_FUNCTION_IPSP_UNREGISTER}, - {"bt_le_ipsp_initialize[Server role]" + {"bt_ipsp_initialize[Server role]" , BT_UNIT_TEST_FUNCTION_IPSP_INITIALIZE}, - {"bt_le_ipsp_deinitialize[Server role]" + {"bt_ipsp_deinitialize[Server role]" , BT_UNIT_TEST_FUNCTION_IPSP_DEINITIALIZE}, - {"bt_le_ipsp_connect[Client role]" + {"bt_ipsp_connect[Client role]" , BT_UNIT_TEST_FUNCTION_IPSP_CONNECT}, - {"bt_le_ipsp_disconnect[Client role]" + {"bt_ipsp_disconnect[Client role]" , BT_UNIT_TEST_FUNCTION_IPSP_DISCONNECT}, - {"bt_le_ipsp_start_advertising[Server role]" + {"bt_ipsp_start_advertising[Server role]" , BT_UNIT_TEST_FUNCTION_IPSP_START_ADVERTISING}, {"bt_ipsp_set_connection_state_changed_cb[Client/Server role]" , BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_STATE_CHANGED_CB}, @@ -2656,7 +2656,7 @@ void __bt_hid_device_connection_state_changed_cb(int result, TC_PRT("Connected %d", connected); } -void __bt_le_ipsp_init_state_changed_cb(int result, +void __bt_ipsp_init_state_changed_cb(int result, bool ipsp_initialized, void *user_data) { TC_PRT("result: %s", __bt_get_error_message(result)); @@ -2668,7 +2668,7 @@ void __bt_le_ipsp_init_state_changed_cb(int result, } } -void __bt_le_ipsp_connection_state_changed_cb(int result, +void __bt_ipsp_connection_state_changed_cb(int result, bool connected, const char *remote_address, const char *iface_name, void *user_data) { TC_PRT("__bt_le_ipsp_connection_state_changed_cb: called"); @@ -7552,8 +7552,8 @@ int test_input_callback(void *data) case BT_UNIT_TEST_FUNCTION_IPSP_INITIALIZE: /* Initialize IPSP server */ if (server != NULL && ipsp_h.svc != NULL) { - ret = bt_le_ipsp_initialize( - &__bt_le_ipsp_init_state_changed_cb, + ret = bt_ipsp_initialize( + &__bt_ipsp_init_state_changed_cb, NULL); TC_PRT("bt_le_ipsp_initialize : returns %s\n", __bt_get_error_message(ret)); } else { @@ -7562,20 +7562,20 @@ int test_input_callback(void *data) break; case BT_UNIT_TEST_FUNCTION_IPSP_DEINITIALIZE: /* De-Initialize IPSP server */ - ret = bt_le_ipsp_deinitialize(); + ret = bt_ipsp_deinitialize(); TC_PRT("bt_le_ipsp_deinitialize : returns %s\n", __bt_get_error_message(ret)); break; case BT_UNIT_TEST_FUNCTION_IPSP_CONNECT: - ret = bt_le_ipsp_connect(remote_addr); + ret = bt_ipsp_connect(remote_addr); + TC_PRT("returns %s", __bt_get_error_message(ret)); break; case BT_UNIT_TEST_FUNCTION_IPSP_DISCONNECT: - TC_PRT("PKPK : case BT_UNIT_TEST_FUNCTION_IPSP_DISCONNECT called"); - - ret = bt_le_ipsp_disconnect(remote_addr); + ret = bt_ipsp_disconnect(remote_addr); + TC_PRT("returns %s", __bt_get_error_message(ret)); break; case BT_UNIT_TEST_FUNCTION_IPSP_START_ADVERTISING: { const char *ipsp_svc_uuid_16 = "1820"; - ret = bt_le_ipsp_is_initialized(); + ret = bt_ipsp_is_initialized(); if (ret != BT_ERROR_NONE) { TC_PRT("bt_le_ipsp_add_advertising_data: returns %s\n", __bt_get_error_message(ret)); break; @@ -7626,13 +7626,13 @@ int test_input_callback(void *data) break; } case BT_UNIT_TEST_FUNCTION_IPSP_SET_CONNECTION_STATE_CHANGED_CB: - ret = bt_le_ipsp_set_connection_state_changed_cb( - __bt_le_ipsp_connection_state_changed_cb, NULL); + ret = bt_ipsp_set_connection_state_changed_cb( + __bt_ipsp_connection_state_changed_cb, NULL); TC_PRT("returns %s\n", __bt_get_error_message(ret)); break; case BT_UNIT_TEST_FUNCTION_IPSP_UNSET_CONNECTION_STATE_CHANGED_CB: - ret = bt_le_ipsp_unset_connection_state_changed_cb(); + ret = bt_ipsp_unset_connection_state_changed_cb(); TC_PRT("returns %s\n", __bt_get_error_message(ret)); break; -- 2.34.1