From 63f146253b13e8033383f162dc3f3cbc87d22f04 Mon Sep 17 00:00:00 2001 From: Taejin Woo Date: Mon, 1 Jun 2015 12:04:11 +0900 Subject: [PATCH] Add the extension header Change-Id: I899ae4ad62c42c44d0f640224a1eac82b927c798 Signed-off-by: Taejin Woo --- include/bluetooth.h | 1 + include/bluetooth_extention.h | 163 ++++++++++++++++++++++ include/bluetooth_internal.h | 130 +---------------- include/bluetooth_type.h | 76 +++++++--- include/bluetooth_type_extention.h | 55 ++++++++ include/bluetooth_type_internal.h | 254 ++++++++++++++++++++++++++++++++++ packaging/capi-network-bluetooth.spec | 3 + src/bluetooth-audio.c | 1 + src/bluetooth-common.c | 1 + test/bt_unit_test.c | 1 + 10 files changed, 539 insertions(+), 146 deletions(-) create mode 100644 include/bluetooth_extention.h create mode 100644 include/bluetooth_type_extention.h create mode 100644 include/bluetooth_type_internal.h diff --git a/include/bluetooth.h b/include/bluetooth.h index 574e189..853934f 100755 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -25,6 +25,7 @@ #include "bluetooth_type.h" #include "bluetooth_internal.h" +#include "bluetooth_extention.h" #ifdef __cplusplus extern "C" diff --git a/include/bluetooth_extention.h b/include/bluetooth_extention.h new file mode 100644 index 0000000..d0eb0bc --- /dev/null +++ b/include/bluetooth_extention.h @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __TIZEN_NETWORK_BLUETOOTH_EXTENSION_H__ +#define __TIZEN_NETWORK_BLUETOOTH_EXTENSION_H__ + +#include "bluetooth_type.h" +#include "bluetooth_type_extention.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/** + * @file bluetooth_extension.h + */ + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Opens a SCO(Synchronous Connection Oriented link) to connected remote device, asynchronously. + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_ENABLED Not enabled + * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected + * @retval #BT_ERROR_ALREADY_DONE Operation is already done + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio device must be connected with bt_audio_connect(). + * @post bt_ag_sco_state_changed_cb() will be invoked. + * @see bt_ag_close_sco() + * @see bt_ag_sco_state_changed_cb() + * @see bt_audio_connect() + */ +int bt_ag_open_sco(void); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Closes an opened SCO(Synchronous Connection Oriented link), asynchronously. + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_ENABLED Not enabled + * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The SCO must be opened with bt_ag_open_sco(). + * @post bt_ag_sco_state_changed_cb() will be invoked. + * @see bt_ag_open_sco() + * @see bt_ag_sco_state_changed_cb() + */ +int bt_ag_close_sco(void); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Checks whether an opened SCO(Synchronous Connection Oriented link) exists or not. + * @since_tizen 2.3 + * @param[out] opened The SCO status: (@c true = opened, @c false = not opened) + * @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_NOT_ENABLED Not enabled + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio service must be initialized with bt_audio_initialize(). + * @see bt_ag_open_sco() + * @see bt_ag_close_sco() + */ +int bt_ag_is_sco_opened(bool *opened); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Registers a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed. + * @since_tizen 2.3 + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback 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_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio service must be initialized with bt_audio_initialize(). + * @see bt_audio_initialize() + * @see bt_ag_sco_state_changed_cb() + * @see bt_ag_unset_sco_state_changed_cb() + */ +int bt_ag_set_sco_state_changed_cb(bt_ag_sco_state_changed_cb callback, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Unregisters a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed. + * @since_tizen 2.3 + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio service must be initialized with bt_audio_initialize(). + * @see bt_audio_initialize() + * @see bt_ag_sco_state_changed_cb() + * @see bt_ag_set_sco_state_changed_cb() + */ +int bt_ag_unset_sco_state_changed_cb(void); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Notifies the state of voice recognition. + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/bluetooth.admin + * @param[in] state The state of voice recognition: (@c true = enabled, @c false = disabled) + * @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_NOT_ENABLED Not enabled + * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * @retval #BT_ERROR_PERMISSION_DENIED Permission denied + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio device must be connected with bt_audio_connect(). + * @see bt_audio_connect() + */ +int bt_ag_notify_voice_recognition_state(bool state); + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __TIZEN_NETWORK_BLUETOOTH_EXTENSION_H__ + diff --git a/include/bluetooth_internal.h b/include/bluetooth_internal.h index e5a3842..583ead2 100644 --- a/include/bluetooth_internal.h +++ b/include/bluetooth_internal.h @@ -19,6 +19,7 @@ #include #include "bluetooth_type.h" +#include "bluetooth_type_internal.h" #ifdef __cplusplus extern "C" @@ -744,111 +745,6 @@ int bt_opp_server_initialize(const char *destination, bt_opp_server_push_request /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Opens a SCO(Synchronous Connection Oriented link) to connected remote device, asynchronously. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/bluetooth.admin - * @return 0 on success, otherwise a negative error value. - * @retval #BT_ERROR_NONE Successful - * @retval #BT_ERROR_NOT_INITIALIZED Not initialized - * @retval #BT_ERROR_NOT_ENABLED Not enabled - * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED Remote device is not bonded - * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected - * @retval #BT_ERROR_ALREADY_DONE Operation is already done - * @retval #BT_ERROR_OPERATION_FAILED Operation failed - * @retval #BT_ERROR_PERMISSION_DENIED Permission denied - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The Bluetooth audio device must be connected with bt_audio_connect(). - * @post bt_ag_sco_state_changed_cb() will be invoked. - * @see bt_ag_close_sco() - * @see bt_ag_sco_state_changed_cb() - * @see bt_audio_connect() - */ -int bt_ag_open_sco(void); - -/** - * @internal - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Closes an opened SCO(Synchronous Connection Oriented link), asynchronously. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/bluetooth.admin - * @return 0 on success, otherwise a negative error value. - * @retval #BT_ERROR_NONE Successful - * @retval #BT_ERROR_NOT_INITIALIZED Not initialized - * @retval #BT_ERROR_NOT_ENABLED Not enabled - * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED Remote device is not bonded - * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected - * @retval #BT_ERROR_PERMISSION_DENIED Permission denied - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The SCO must be opened with bt_ag_open_sco(). - * @post bt_ag_sco_state_changed_cb() will be invoked. - * @see bt_ag_open_sco() - * @see bt_ag_sco_state_changed_cb() - */ -int bt_ag_close_sco(void); - -/** - * @internal - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Checks whether an opened SCO(Synchronous Connection Oriented link) exists or not. - * @since_tizen 2.3 - * @param[out] opened The SCO status: (@c true = opened, @c false = not opened) - * @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_NOT_ENABLED Not enabled - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The Bluetooth audio service must be initialized with bt_audio_initialize(). - * @see bt_ag_open_sco() - * @see bt_ag_close_sco() - */ -int bt_ag_is_sco_opened(bool *opened); - -/** - * @internal - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Registers a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed. - * @since_tizen 2.3 - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback 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_NOT_SUPPORTED Not supported - * - * @pre The Bluetooth audio service must be initialized with bt_audio_initialize(). - * @see bt_audio_initialize() - * @see bt_ag_sco_state_changed_cb() - * @see bt_ag_unset_sco_state_changed_cb() - */ -int bt_ag_set_sco_state_changed_cb(bt_ag_sco_state_changed_cb callback, void *user_data); - -/** - * @internal - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Unregisters a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed. - * @since_tizen 2.3 - * @return 0 on success, otherwise a negative error value. - * @retval #BT_ERROR_NONE Successful - * @retval #BT_ERROR_NOT_INITIALIZED Not initialized - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The Bluetooth audio service must be initialized with bt_audio_initialize(). - * @see bt_audio_initialize() - * @see bt_ag_sco_state_changed_cb() - * @see bt_ag_set_sco_state_changed_cb() - */ -int bt_ag_unset_sco_state_changed_cb(void); - -/** - * @internal - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE * @brief Notifies the call event to the remote bluetooth device. * @since_tizen 2.3 * @privlevel platform @@ -901,30 +797,6 @@ int bt_ag_notify_call_list(bt_call_list_h list); /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Notifies the state of voice recognition. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/bluetooth.admin - * @param[in] state The state of voice recognition: (@c true = enabled, @c false = disabled) - * @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_NOT_ENABLED Not enabled - * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED Remote device is not bonded - * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected - * @retval #BT_ERROR_OPERATION_FAILED Operation failed - * @retval #BT_ERROR_PERMISSION_DENIED Permission denied - * @retval #BT_ERROR_NOT_SUPPORTED Not supported - * - * @pre The Bluetooth audio device must be connected with bt_audio_connect(). - * @see bt_audio_connect() - */ -int bt_ag_notify_voice_recognition_state(bool state); - -/** - * @internal - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE * @brief Registers a callback function that will be invoked when a call handling event happened from Hands-Free. * @since_tizen 2.3 * @param[in] callback The callback function to register diff --git a/include/bluetooth_type.h b/include/bluetooth_type.h index 8935102..76eb1b0 100755 --- a/include/bluetooth_type.h +++ b/include/bluetooth_type.h @@ -131,6 +131,17 @@ typedef enum { BT_ADAPTER_LE_ADVERTISING_STARTED, /**< Bluetooth advertising is started */ } bt_adapter_le_advertising_state_e; +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief Enumerations of the Bluetooth advertising mode. + * @since_tizen 2.3.1 + */ +typedef enum +{ + BT_ADAPTER_LE_ADVERTISING_MODE_BALANCED, /**< Balanced advertising mode */ + BT_ADAPTER_LE_ADVERTISING_MODE_LOW_LATENCY, /**< Low latency advertising mode */ + BT_ADAPTER_LE_ADVERTISING_MODE_LOW_ENERGY /**< Low energy advertising mode */ +} bt_adapter_le_advertising_mode_e; /** * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE @@ -614,6 +625,20 @@ typedef void* bt_advertiser_h; typedef void* bt_gatt_attribute_h; /** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief The handle of a service, characteristic or descriptor + * @since_tizen 2.3.1 + */ +typedef void* bt_gatt_h; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief The handle of a GATT client which is associated with a remote device + * @since_tizen 2.3.1 + */ +typedef void* bt_gatt_client_h; + +/** * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE * @brief The handle of calls state * @since_tizen 2.3 @@ -681,6 +706,25 @@ typedef struct /** * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief Structure of le scan result information. + * @since_tizen 2.3.1 + * + * @see bt_adapter_le_start_scan() + */ +typedef struct +{ + char *remote_address; /**< The address of remote device */ + bt_device_address_type_e address_type; /**< The address type of remote device */ + int rssi; /**< The strength indicator of received signal */ + int adv_data_len; /**< advertising indication data length */ + char *adv_data; /**< advertising indication data */ + int scan_data_len; /**< scan response data length */ + char *scan_data; /**< scan response data */ +} bt_adapter_le_device_scan_result_info_s; + +/** + * @deprecated Deprecated since 2.3.1 + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE * @brief Structure of advertising parameters * @since_tizen 2.3 * @@ -950,6 +994,21 @@ typedef void (*bt_adapter_le_device_discovery_state_changed_cb) /** * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief Called when the LE advertisement has been found. + * @since_tizen 2.3.1 + * + * @param[in] result The result of the LE scan + * @param[in] info The information of the found LE advertisement. + * @param[in] user_data The user data passed from the start function + * + * @see bt_adapter_le_start_scan() + * + */ +typedef void (*bt_adapter_le_scan_result_cb)(int result, + bt_adapter_le_device_scan_result_info_s *info, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE * @brief Called when the state of advertiser changes. * @since_tizen 2.3 * @@ -1256,23 +1315,6 @@ typedef void (*bt_audio_connection_state_changed_cb) (int result, bool connected /** * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE - * @brief Called when the SCO(Synchronous Connection Oriented link) state is changed. - * @since_tizen 2.3 - * - * @details This callback is called when the SCO state is changed. - * When you call bt_ag_open_sco() or bt_ag_close_sco(), this callback is also called with error result even though these functions failed. - * @param[in] result The result of changing the connection state - * @param[in] opened The state to be changed: (@c true = opened, @c false = not opened) - * @param[in] user_data The user data passed from the callback registration function - * @see bt_ag_set_sco_state_changed_cb() - * @see bt_ag_unset_sco_state_changed_cb() - * @see bt_ag_open_sco() - * @see bt_ag_close_sco() - */ -typedef void (*bt_ag_sco_state_changed_cb) (int result, bool opened, void *user_data); - -/** - * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE * @brief Called when a call handling event happened from Hands-Free. * @since_tizen 2.3 * diff --git a/include/bluetooth_type_extention.h b/include/bluetooth_type_extention.h new file mode 100644 index 0000000..4018e6c --- /dev/null +++ b/include/bluetooth_type_extention.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __TIZEN_NETWORK_BLUETOOTH_TYPE_EXTENSION_H__ +#define __TIZEN_NETWORK_BLUETOOTH_TYPE_EXTENSION_H__ + + #ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/** + * @file bluetooth_type_extension.h + */ + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE + * @brief Called when the SCO(Synchronous Connection Oriented link) state is changed. + * @since_tizen 2.3 + * + * @details This callback is called when the SCO state is changed. + * When you call bt_ag_open_sco() or bt_ag_close_sco(), this callback is also called with error result even though these functions failed. + * @param[in] result The result of changing the connection state + * @param[in] opened The state to be changed: (@c true = opened, @c false = not opened) + * @param[in] user_data The user data passed from the callback registration function + * @see bt_ag_set_sco_state_changed_cb() + * @see bt_ag_unset_sco_state_changed_cb() + * @see bt_ag_open_sco() + * @see bt_ag_close_sco() + */ +typedef void (*bt_ag_sco_state_changed_cb) (int result, bool opened, void *user_data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __TIZEN_NETWORK_BLUETOOTH_TYPE_EXTENSION_H__ diff --git a/include/bluetooth_type_internal.h b/include/bluetooth_type_internal.h new file mode 100644 index 0000000..c1be7e8 --- /dev/null +++ b/include/bluetooth_type_internal.h @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __TIZEN_NETWORK_BLUETOOTH_TYPE_INTERNAL_H__ +#define __TIZEN_NETWORK_BLUETOOTH_TYPE_INTERNAL_H__ + + #ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/** + * @file bluetooth_type_internal.h + */ + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief Enumerations of the Bluetooth adapter le scan type. + * @since_tizen 2.3 + */ +typedef enum +{ + BT_ADAPTER_LE_PASSIVE_SCAN = 0x00, + BT_ADAPTER_LE_ACTIVE_SCAN +} bt_adapter_le_scan_type_e; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief Enumerations of the Bluetooth le scan mode. + * @since_tizen 2.3 + */ +typedef enum +{ + BT_ADAPTER_LE_SCAN_MODE_BALANCED, + BT_ADAPTER_LE_SCAN_MODE_LOW_LATENCY, + BT_ADAPTER_LE_SCAN_MODE_LOW_ENERGY +} bt_adapter_le_scan_mode_e; + +/** + * @internal + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE + * @brief Called when the manufacturer dat changes. + * @since_tizen 2.3 + * + * @param[in] data The manufacurer data of the Bluetooth device to be changed + * @param[in] len The length of @a data + * @param[in] user_data The user data passed from the callback registration function + * @pre This function will be invoked when the manufacturer data of Bluetooth adapter changes + * if callback is registered using bt_adapter_set_manufacturer_data_changed_cb(). + * @see bt_adapter_set_manufacturer_data() + * @see bt_adapter_set_manufacturer_data_changed_cb() + * @see bt_adapter_unset_manufacturer_data_changed_cb() + */ +typedef void (*bt_adapter_manufacturer_data_changed_cb) (char *data, + int len, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Enumerations of the attribute's permission + * @since_tizen 2.4 + */ +typedef enum { + BT_GATT_PERMISSION_READ = 0x01, + BT_GATT_PERMISSION_WRITE = 0x02, + BT_GATT_PERMISSION_ENCRYPTION = 0x04, + BT_GATT_PERMISSION_AUTHENTICATION = 0x08, + BT_GATT_PERMISSION_AUTHORIZATION = 0x10, + BT_GATT_PERMISSION_NONE = 0x20, +} bt_gatt_permission_e; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief The handle to control Bluetooth LE scan filter + * @since_tizen 2.4 + */ +typedef void* bt_scan_filter_h; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @brief The handle of a GATT server + * @since_tizen 2.4 + */ +typedef void* bt_gatt_server_h; + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when a value of a characteristic or descriptor's GATT handle has been changed + * @since_tizen 2.4 + * + * @remarks After this function is returned, a changed vlaue is automatically + * applied to @a gatt_handle. Before that, @a gatt_handle has an old value. + * + * @param[in] remote_address The address of the remote device which requests a change + * @param[in] server The GATT server handle + * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value + * @param[in] offset The requested offset from where the @a gatt_handle value will be updated + * @param[in] value The new value + * @param[in] len The length of @a value + * @param[in] user_data The user data passed from the registration function + * + * @see bt_gatt_server_set_value_changed_cb() + */ +typedef void (*bt_gatt_server_value_changed_cb) (char *remote_address, + bt_gatt_server_h server, bt_gatt_h gatt_handle, + int offset, char *value, int len, + void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when the remote device requests to read a value on a GATT server + * @since_tizen 2.4 + * + * @param[in] remote_address The address of the requesting remote device + * @param[in] server The GATT server handle + * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read + * @param[in] request_id The identification of this request. It will be used to send a reponse. + * @param[in] offset The requested offset from where the GATT handle's value is read + * @param[in] user_data The user data passed from the registration function + * + * @see bt_gatt_server_set_read_value_requested_cb() + * @see bt_gatt_server_send_response() + */ +typedef void (*bt_gatt_server_read_value_requested_cb) (char *remote_address, + int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle, + int offset, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when the sending notification / indication is done + * @since_tizen 2.4 + * + * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n + * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n + * For the last remote device, @a completed will be set as true. + * + * @param[in] result The result of a sending operation + * @param[in] remote_address The address of the remote device + * @param[in] server The GATT server handle + * @param[in] characteristic The characteristic's GATT handle + * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false. + * @param[in] user_data The user data passed from the requesting function + * + * @see bt_gatt_server_notify() + */ +typedef void (*bt_gatt_server_notification_sent_cb) (int result, + char *remote_address, bt_gatt_server_h server, + bt_gatt_h characteristic, bool completed, void *user_data); + +/** + * @internal + * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE + * @brief Enumerations for the player control command + * @since_tizen 2.3 + */ + typedef enum { + BT_AVRCP_CONTROL_PLAY = 0x01, /**< Play */ + BT_AVRCP_CONTROL_PAUSE, /**< Pause */ + BT_AVRCP_CONTROL_STOP, /**< Stop */ + BT_AVRCP_CONTROL_NEXT, /**< Next Track*/ + BT_AVRCP_CONTROL_PREVIOUS, /**< Previous track */ + BT_AVRCP_CONTROL_FAST_FORWARD, /**< Fast Forward */ + BT_AVRCP_CONTROL_REWIND /**< Rewind */ +} bt_avrcp_player_command_e; + + /** + * @internal + * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE + * @brief Structure of Track metadata information. + * @since_tizen 2.3 + * + * @see #bt_class_s + */ +typedef struct { + const char *title; + const char *artist; + const char *album; + const char *genre; + unsigned int total_tracks; + unsigned int number; + unsigned int duration; +} bt_avrcp_metadata_attributes_info_s; + +/** + * @internal + * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE + * @brief Called when the connection state is changed. + * @since_tizen 2.3 + * @param[in] connected The state to be changed. @a true means connected state, Otherwise, @a false. + * @param[in] remote_address The remote address + * @param[in] user_data The user data passed from the callback registration function + * @see bt_avrcp_control_initialize() + * @see bt_avrcp_control_deinitialize() + */ +typedef void (*bt_avrcp_control_connection_state_changed_cb) (bool connected, const char *remote_address, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE + * @brief Called when the Song position mode is changed by the remote target device. + * @since_tizen 2.3 + * + * @param[in] position The song position + * @param[in] user_data The user data passed from the callback registration function + * @see bt_avrcp_set_song_position_changed_cb() + * @see bt_avrcp_unset_song_position_changed_cb() + */ +typedef void (*bt_avrcp_song_position_changed_cb) (unsigned int position, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE + * @brief Called when the Song metadata information is changed by the remote target device. + * @since_tizen 2.3 + * + * @param[in] position The song metadata information + * @param[in] user_data The user data passed from the callback registration function + * @see bt_avrcp_set_track_info_changed_cb() + * @see bt_avrcp_unset_track_info_changed_cb() + */ +typedef void (*bt_avrcp_track_info_changed_cb) (bt_avrcp_metadata_attributes_info_s *track, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE + * @brief Called when the Song Play status mode is changed by the remote target device. + * @since_tizen 2.3 + * + * @param[in] play_state The song play status + * @param[in] user_data The user data passed from the callback registration function + * @see bt_avrcp_set_play_status_changed_cb() + * @see bt_avrcp_unset_play_status_changed_cb() + */ +typedef void (*bt_avrcp_play_status_changed_cb) (bt_avrcp_player_state_e play_state, void *user_data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __TIZEN_NETWORK_BLUETOOTH_TYPE_INTERNAL_H__ diff --git a/packaging/capi-network-bluetooth.spec b/packaging/capi-network-bluetooth.spec index 6ba5273..2e4ee81 100755 --- a/packaging/capi-network-bluetooth.spec +++ b/packaging/capi-network-bluetooth.spec @@ -114,6 +114,9 @@ make %{?jobs:-j%jobs} %{_includedir}/network/bluetooth.h %{_includedir}/network/bluetooth_internal.h %{_includedir}/network/bluetooth_type.h +%{_includedir}/network/bluetooth_type_internal.h +%{_includedir}/network/bluetooth_extention.h +%{_includedir}/network/bluetooth_type_extention.h %{_libdir}/pkgconfig/capi-network-bluetooth.pc %{_libdir}/libcapi-network-bluetooth.so #%{_datadir}/license/capi-network-bluetooth-devel diff --git a/src/bluetooth-audio.c b/src/bluetooth-audio.c index 2491ea9..eaabadf 100755 --- a/src/bluetooth-audio.c +++ b/src/bluetooth-audio.c @@ -19,6 +19,7 @@ #include #include #include "bluetooth.h" +#include "bluetooth_extention.h" #include "bluetooth_internal.h" #include "bluetooth_private.h" #include "bluetooth-audio-api.h" diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index e9ab591..1a6db3b 100755 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -24,6 +24,7 @@ #include #include "bluetooth.h" +#include "bluetooth_extention.h" #include "bluetooth_private.h" #include "bluetooth-media-control.h" #include "bluetooth-telephony-api.h" diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index c439555..c56d3df 100755 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -35,6 +35,7 @@ #include "bluetooth.h" #include "bluetooth_internal.h" +#include "bluetooth_extention.h" #include "bluetooth-telephony-api.h" #include "bt_unit_test.h" -- 2.7.4