BLE Client support for Tizen 2.4
authorjihwanseo <jihwan.seo@samsung.com>
Mon, 18 Jan 2016 11:47:57 +0000 (17:17 +0530)
committerJon A. Cruz <jonc@osg.samsung.com>
Wed, 17 Feb 2016 05:56:56 +0000 (05:56 +0000)
Change-Id: I687d57eae2b89e414b39a45aaebf9a8b5333c3b4
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Signed-off-by: vimala.v <vimala.v@samsung.com>
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4055
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
24 files changed:
resource/csdk/connectivity/build/tizen/gbsbuild.sh
resource/csdk/connectivity/inc/caleinterface.h
resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth.h [deleted file]
resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth_private.h [deleted file]
resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth_type.h [deleted file]
resource/csdk/connectivity/lib/tizen/ble/inc/mobile/bluetooth_product.h [deleted file]
resource/csdk/connectivity/lib/tizen/ble/inc/mobile/bluetooth_type_product.h [deleted file]
resource/csdk/connectivity/src/bt_le_adapter/android/calenwmonitor.c
resource/csdk/connectivity/src/bt_le_adapter/arduino/cablenwmonitor.cpp
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
resource/csdk/connectivity/src/bt_le_adapter/linux/caleinterface.c
resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript
resource/csdk/connectivity/src/bt_le_adapter/tizen/cableclient.c [deleted file]
resource/csdk/connectivity/src/bt_le_adapter/tizen/cableclient.h [deleted file]
resource/csdk/connectivity/src/bt_le_adapter/tizen/cableserver.c [deleted file]
resource/csdk/connectivity/src/bt_le_adapter/tizen/cableutil.c [deleted file]
resource/csdk/connectivity/src/bt_le_adapter/tizen/cableutil.h [deleted file]
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c [new file with mode: 0644]
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.h [new file with mode: 0644]
resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor.c [moved from resource/csdk/connectivity/src/bt_le_adapter/tizen/cablenwmonitor.c with 60% similarity]
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c [new file with mode: 0644]
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.h [moved from resource/csdk/connectivity/src/bt_le_adapter/tizen/cableserver.h with 100% similarity]
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c [new file with mode: 0644]
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h [new file with mode: 0644]

index 9be48d4..5417614 100755 (executable)
@@ -50,8 +50,6 @@ cp -R $cur_dir/src/bt_edr_adapter/SConscript $sourcedir/tmp/con/src/bt_edr_adapt
 cp -R $cur_dir/common/SConscript $sourcedir/tmp/con/common/
 cp -R $cur_dir/lib/libcoap-4.1.1/SConscript $sourcedir/tmp/con/lib/libcoap-4.1.1/
 cp -R $cur_dir/samples/tizen/ $sourcedir/tmp/con/sample/
-mkdir -p $sourcedir/tmp/con/sample/lib/tizen/ble/libs
-cp -R $cur_dir/lib/tizen/ble/libs/* $sourcedir/tmp/con/sample/lib/tizen/ble/libs/
 mkdir -p $sourcedir/tmp/con/sample/external/inc
 cp -R $cur_dir/external/inc/* $sourcedir/tmp/con/sample/external/inc/
 mkdir -p $sourcedir/tmp/con/extlibs/
index e0be0dd..b1701a1 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "cacommon.h"
 #include "cathreadpool.h"
+#include "uarraylist.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -50,6 +51,27 @@ typedef enum
 } CALETransferType_t;
 
 /**
+ * Stores the information of the Data to be sent from the queues.
+ *
+ * This structure will be pushed to the sender/receiver queue for
+ * processing.
+ */
+typedef struct
+{
+    /// Remote endpoint contains the information of remote device.
+    CAEndpoint_t *remoteEndpoint;
+
+    /// Data to be transmitted over LE transport.
+    uint8_t *data;
+
+    /// Length of the data being transmitted.
+    uint32_t dataLen;
+
+    /// Sender information list
+    u_arraylist_t * senderInfo;
+} CALEData_t;
+
+/**
  * This will be used to notify device status changes to the LE adapter layer.
  * @param[in]  adapter_state State of the adapter.
  */
@@ -78,12 +100,13 @@ typedef CAResult_t (*CABLEDataReceivedCallback)(const char *remoteAddress,
  * Initialize the LE adapter layer. This will be invoked from the CA
  * layer.
  *
+ * @param[in] threadPool Thread pool handle
  * @return ::CA_STATUS_OK or Appropriate error code
  * @retval ::CA_STATUS_OK  Successful
  * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments
  * @retval ::CA_STATUS_FAILED Operation failed
  */
-CAResult_t CAInitializeLEAdapter();
+CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool);
 
 /**
  * Start the LE adapter layer.
diff --git a/resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth.h b/resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth.h
deleted file mode 100644 (file)
index a6574c7..0000000
+++ /dev/null
@@ -1,4474 +0,0 @@
-/*
- * 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_H__
-#define __TIZEN_NETWORK_BLUETOOTH_H__
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <tizen_error.h>
-
-#include "bluetooth_type.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/**
- * @file        bluetooth.h
- * @brief       API to control the Bluetooth adapter and devices and communications.
- * @ingroup     CAPI_NETWORK_BLUETOOTH_MODULE
- */
-
-
-/**
- * @addtogroup CAPI_NETWORK_BLUETOOTH_MODULE
- * @{
- */
-
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
- * @brief Initializes the Bluetooth API.
- * @since_tizen 2.3
- *
- * @remarks This function must be called before Bluetooth API starts. \n
- * You must free all resources of the Bluetooth service by calling bt_deinitialize() if Bluetooth service is no longer needed.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @see  bt_deinitialize()
- */
-int bt_initialize(void);
-
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
- * @brief Releases all resources of the Bluetooth API.
- * @since_tizen 2.3
- *
- * @remarks This function must be called if Bluetooth API is no longer needed.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @pre Bluetooth API must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- */
-int bt_deinitialize(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Enables the local Bluetooth adapter, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @details This function enables Bluetooth protocol stack and hardware.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_ALREADY_DONE  Already enabled
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre Bluetooth service must be initialized with bt_initialize().
- * @pre The state of local Bluetooth must be #BT_ADAPTER_DISABLED
- * @post This function invokes bt_adapter_state_changed_cb().
- *
- * @see bt_initialize()
- * @see bt_adapter_get_state()
- * @see bt_adapter_set_state_changed_cb()
- * @see bt_adapter_unset_state_changed_cb()
- * @see bt_adapter_state_changed_cb()
- *
- */
-int bt_adapter_enable(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Disables the local Bluetooth adapter, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @details This function disables Bluetooth protocol stack and hardware.
- *
- * @remarks You should disable Bluetooth adapter, which is helpful for saving power.
- *
- * @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_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
- * @post This function invokes bt_adapter_state_changed_cb().
- *
- * @see bt_adapter_get_state()
- * @see bt_adapter_state_changed_cb()
- * @see bt_adapter_set_state_changed_cb()
- * @see bt_adapter_unset_state_changed_cb ()
- *
- */
-int bt_adapter_disable(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Recover the local Bluetooth adapter, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @details This function does recovery logic, disables Bluetooth protocol stack and hardware, then enables after a few seconds.
- *
- * @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_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
- * @post This function invokes bt_adapter_state_changed_cb().
- *
- * @see bt_adapter_get_state()
- * @see bt_adapter_state_changed_cb()
- * @see bt_adapter_set_state_changed_cb()
- * @see bt_adapter_unset_state_changed_cb ()
- *
- */
-int bt_adapter_recover(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Reset the local Bluetooth adapter, synchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @details This function resets Bluetooth protocol and values.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_state_changed_cb() will be invoked if The state of local Bluetooth was #BT_ADAPTER_ENABLED.
- *
- * @see bt_initialize()
- * @see bt_adapter_get_state()
- * @see bt_adapter_set_state_changed_cb()
- * @see bt_adapter_unset_state_changed_cb()
- * @see bt_adapter_state_changed_cb()
- *
- */
-int bt_adapter_reset(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Gets the current state of local Bluetooth adapter.
- * @since_tizen 2.3
- *
- * @param[out] adapter_state The current adapter state
- *
- * @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
- *
- * @pre Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- */
-int bt_adapter_get_state(bt_adapter_state_e *adapter_state);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Gets the address of local Bluetooth adapter.
- * @since_tizen 2.3
- *
- * @remarks The @a local_address must be released with free() by you.
- *
- * @param[out] local_address The device address of local Bluetooth adapter
- *
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED Operation failed
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see bt_adapter_get_name()
- */
-int bt_adapter_get_address(char **local_address);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Gets the version of local Bluetooth adapter.
- * @since_tizen 2.3
- * @remarks The @a local_version must be released with free() by you.
- *
- * @param[out] local_version The version of local Bluetooth adapter
- *
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED Operation failed
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- */
-int bt_adapter_get_version(char **local_version);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Gets the information regarding local Bluetooth adapter.
- * @since_tizen 2.3
- * @remarks The @a all parameters must be released with free() by you.
- *
- * @param[out] chipset Chipset name of local Bluetooth adapter
- * @param[out] firmware Firmware info. of local Bluetooth adapter
- * @param[out] stack_version Bluetooth stack version
- * @param[out] profiles The profile list of local Bluetooth adapter
- *
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED Operation failed
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- */
-int bt_adapter_get_local_info(char **chipset, char **firmware, char **stack_version, char **profiles);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Gets the name of local Bluetooth adapter.
- * @since_tizen 2.3
- *
- * @details Use this function to get the friendly name associated with Bluetooth
- * device, retrieved by the remote Bluetooth devices.
- *
- * @remarks The @a local_name must be released with free() by you.
- *
- * @param[out] local_name  The local device name
- *
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_adapter_set_name()
- */
-int bt_adapter_get_name(char **local_name);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Sets the name of local Bluetooth adapter.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] local_name The name of the Bluetooth device. \n
- *                             The maximum length is 248 characters.
- *
- * @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_OPERATION_FAILED Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post bt_adapter_name_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
- *
- * @see bt_adapter_get_name()
- * @see bt_adapter_name_changed_cb()
- * @see bt_adapter_set_name_changed_cb()
- * @see bt_adapter_unset_name_changed_cb()
- */
-int bt_adapter_set_name(const char *local_name);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Gets the visibility mode of local Bluetooth adapter.
- * @since_tizen 2.3
- * @param[out] mode  The visibility mode of the Bluetooth device
- * @param[out] duration  The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds).
- * @a duration is valid only if @a mode is #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE. This value can be NULL.
- * @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_OPERATION_FAILED  Operation failed
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- */
-int bt_adapter_get_visibility(bt_adapter_visibility_mode_e *mode, int *duration);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Sets the visibility mode.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE will change to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE
- * after the given @a duration goes.
- *
- * @param[in] discoverable_mode The Bluetooth visibility mode to set
- * @param[in] duration The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds).
- * @a duration is used only for #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE mode.
- *
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post bt_adapter_visibility_mode_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
- *
- * @see bt_adapter_get_visibility()
- * @see bt_adapter_visibility_mode_changed_cb()
- * @see bt_adapter_set_visibility_mode_changed_cb()
- * @see bt_adapter_unset_visibility_mode_changed_cb()
- */
-int bt_adapter_set_visibility(bt_adapter_visibility_mode_e discoverable_mode, int duration);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Starts the device discovery, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @details If a device is discovered, bt_adapter_device_discovery_state_changed_cb() will be invoked
- * with #BT_ADAPTER_DEVICE_DISCOVERY_FOUND, and then bt_adapter_device_discovery_state_changed_cb()
- * will be called with #BT_ADAPTER_DEVICE_DISCOVERY_FINISHED in case of the completion or cancellation of the discovery.
- *
- * @remarks To connect to peer Bluetooth device, you need to know its Bluetooth address. \n
- * The device discovery can be stopped by bt_adapter_stop_device_discovery().
- *
- * @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_NOW_IN_PROGRESS  Operation is now in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post This function invokes bt_adapter_device_discovery_state_changed_cb().
- *
- * @see bt_adapter_is_discovering()
- * @see bt_adapter_stop_device_discovery()
- * @see bt_adapter_device_discovery_state_changed_cb()
- * @see bt_adapter_set_device_discovery_state_changed_cb()
- * @see bt_adapter_unset_device_discovery_state_changed_cb()
- */
-int bt_adapter_start_device_discovery(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Stops the device discovery, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remarks The device discovery process will take 10 ~ 20 seconds to get all the devices in vicinity.
- *
- * @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_NOT_IN_PROGRESS  Operation is not in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The device discovery must be in progress with bt_adapter_start_device_discovery().
- * @post This function invokes bt_adapter_device_discovery_state_changed_cb().
- *
- * @see bt_adapter_is_discovering()
- * @see bt_adapter_start_device_discovery()
- * @see bt_adapter_set_device_discovery_state_changed_cb()
- * @see bt_adapter_unset_device_discovery_state_changed_cb()
- * @see bt_adapter_device_discovery_state_changed_cb()
- */
-int bt_adapter_stop_device_discovery(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Checks for the device discovery is in progress or not.
- * @since_tizen 2.3
- *
- * @remarks If Bluetooth discovery is in progress, other operations are not allowed and
- * you have to either stop the discovery operation, or wait for it to be finished,
- * before performing other operations.
-
- * @param[out] is_discovering The discovering status: (@c true = in progress , @c  false = not in progress )
- *
- * @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_OPERATION_FAILED  Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_adapter_start_device_discovery()
- * @see bt_adapter_stop_device_discovery()
- */
-int bt_adapter_is_discovering(bool *is_discovering);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Get the service mask from the uuid list.
- * @since_tizen 2.3
- *
- * @param[in] uuids The UUID list of the device.
- * @param[in] no_of_service The number of the UUID list count.
- * @param[out] service_mask_list Service mask list converted from the given UUID list.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see bt_service_class_t
- */
-int bt_device_get_service_mask_from_uuid_list(char **uuids,
-                                     int no_of_service,
-                                     bt_service_class_t *service_mask_list);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Retrieves the device information of all bonded devices.
- * @since_tizen 2.3
- *
- * @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_OPERATION_FAILED  Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post This function invokes bt_adapter_bonded_device_cb().
- *
- * @see bt_adapter_bonded_device_cb()
- */
-int bt_adapter_foreach_bonded_device(bt_adapter_bonded_device_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Gets the device information of a bonded device.
- * @since_tizen 2.3
- * @remarks The @a device_info must be released with bt_adapter_free_device_info() by you .
- *
- * @param [in] remote_address The address of remote device
- * @param [out] device_info The bonded device information
- *
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post This function invokes bt_adapter_bonded_device_cb().
- *
- * @see bt_adapter_bonded_device_cb()
- */
-int bt_adapter_get_bonded_device_info(const char *remote_address, bt_device_info_s **device_info);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Frees device info.
- * @since_tizen 2.3
- *
- * @param [in] device_info The bonded device information
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see bt_adapter_get_bonded_device_info()
- */
-int bt_adapter_free_device_info(bt_device_info_s *device_info);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Checks whether the UUID of service is used or not
- * @since_tizen 2.3
- * @param[in] service_uuid The UUID of service
- * @param[out] used Indicates whether the service is used or not
- * @return true on success, otherwise false.
- * @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_OPERATION_FAILED  Operation failed
- */
-int bt_adapter_is_service_used(const char *service_uuid, bool *used);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked when the Bluetooth adapter state changes.
- * @since_tizen 2.3
- *
- * @param[in] callback The callback function to invoke
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_state_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_state_changed_cb()
- * @see bt_adapter_set_state_changed_cb()
- * @see bt_adapter_unset_state_changed_cb()
- */
-int bt_adapter_set_state_changed_cb(bt_adapter_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief      Unregisters the callback function.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- * @see bt_adapter_set_state_changed_cb()
- */
-int bt_adapter_unset_state_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked when the name of Bluetooth adapter changes.
- * @since_tizen 2.3
- *
- * @param[in] callback The callback function to invoke
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_adapter_name_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_name_changed_cb()
- * @see bt_adapter_unset_name_changed_cb()
- */
-int bt_adapter_set_name_changed_cb(bt_adapter_name_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief      Unregisters the callback function.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- * @see bt_adapter_set_name_changed_cb()
- */
-int bt_adapter_unset_name_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked when the visibility mode changes.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_visibility_mode_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_visibility_mode_changed_cb()
- * @see bt_adapter_unset_visibility_mode_changed_cb()
- */
-int bt_adapter_set_visibility_mode_changed_cb(bt_adapter_visibility_mode_changed_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Unregisters the callback function.
- * @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
- *
- * @pre  The Bluetooth service must be initialized with bt_initialize().
- *
- * @see  bt_initialize()
- * @see  bt_adapter_set_visibility_mode_changed_cb()
- */
-int bt_adapter_unset_visibility_mode_changed_cb(void);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked every second
- * @since_tizen 2.3
- * until the visibility mode is changed from #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE
- * to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
- * @details  When you set visibility mode as #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE,
- * @a callback will be called every second until visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
- * @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
- * @pre  The Bluetooth service must be initialized by bt_initialize().
- * @post  bt_adapter_visibility_duration_changed_cb() will be invoked.
- * @see  bt_initialize()
- * @see  bt_adapter_visibility_duration_changed_cb()
- * @see  bt_adapter_unset_visibility_duration_changed_cb()
- */
-int bt_adapter_set_visibility_duration_changed_cb(bt_adapter_visibility_duration_changed_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief       Unregisters the callback function.
- * @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
- * @pre  The Bluetooth service must be initialized with bt_initialize().
- * @see  bt_initialize()
- * @see  bt_adapter_set_visibility_duration_changed_cb()
- */
-int bt_adapter_unset_visibility_duration_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked when the device discovery state changes.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_device_discovery_state_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_device_discovery_state_changed_cb()
- * @see bt_adapter_set_device_discovery_state_changed_cb()
- * @see bt_adapter_unset_device_discovery_state_changed_cb()
- */
-int bt_adapter_set_device_discovery_state_changed_cb(bt_adapter_device_discovery_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief      Unregisters the callback function.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- * @see bt_adapter_set_device_discovery_state_changed_cb()
- */
-int bt_adapter_unset_device_discovery_state_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Get the Hash and Randmoizer value, synchronously.
- * @since_tizen 2.3
- *
- * @param[out] hash The hash value recieved from the controller
- * @param[out] randomizer The hash value recieved from the controller
- * @param[out] hash_len The length of the hash value
- * @param[out] randomizer_len The length of the randomizer value
- * @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_OPERATION_FAILED  Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- */
-int bt_adapter_get_local_oob_data(unsigned char **hash, unsigned char **randomizer,
-                                       int *hash_len, int *randomizer_len);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Sets the Hash and Randmoizer value, synchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] remote_address Remote device address
- * @param[in] hash The hash value recieved from the controller
- * @param[in] randomizer The hash value recieved from the controller
- * @param[in] hash_len The length of the hash value. Allowed value is 16
- * @param[in] randomizer_len The length of the randomizer value. Allowed value is 16
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- */
-int bt_adapter_set_remote_oob_data(const char *remote_address,
-                               unsigned char *hash, unsigned char *randomizer,
-                               int hash_len, int randomizer_len);
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Deletes the Hash and Randomizer value, synchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] remote_address Remote device address
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- */
-int bt_adapter_remove_remote_oob_data(const char *remote_address);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked when the connectable state changes.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_connectable_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_connectable_changed_cb()
- * @see bt_adapter_unset_connectable_changed_cb()
- */
-int bt_adapter_set_connectable_changed_cb(bt_adapter_connectable_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Unregisters the callback function.
- * @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
- *
- * @pre  The Bluetooth service must be initialized with bt_initialize().
- *
- * @see  bt_initialize()
- * @see  bt_adapter_set_connectable_changed_cb()
- */
-int bt_adapter_unset_connectable_changed_cb(void);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Gets the connectable state of local Bluetooth adapter.
- * @since_tizen 2.3
- *
- * @remarks When connectable state is false, no device can connect to this device and visibility mode cannot be changed.
- *
- * @param[out] connectable The connectable state of local Bluetooth adapter
- *
- * @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_OPERATION_FAILED  Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_adapter_set_connectable()
- */
-int bt_adapter_get_connectable(bool *connectable);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Sets the connectable state of local Bluetooth adapter.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks When connectable state is false, no device can connect to this device and visibility mode cannot be changed.
- *
- * @param[in] connectable The connectable state to set
- *
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post bt_adapter_connectable_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
- *
- * @see bt_adapter_get_connectable()
- * @see bt_adapter_connectable_changed_cb()
- * @see bt_adapter_set_connectable_changed_cb()
- * @see bt_adapter_unset_connectable_changed_cb()
- */
-int bt_adapter_set_connectable(bool connectable);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Enables the local Bluetooth le adapter, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @details This function enables Bluetooth protocol stack and hardware.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_ALREADY_DONE  Already enabled
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre Bluetooth service must be initialized with bt_initialize().
- * @post This function invokes bt_adapter_le_state_changed_cb().
- *
- * @see bt_initialize()
- * @see bt_adapter_le_get_state()
- * @see bt_adapter_le_set_state_changed_cb()
- * @see bt_adapter_le_unset_state_changed_cb()
- * @see bt_adapter_le_state_changed_cb()
- *
- */
-int bt_adapter_le_enable(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Disables the local Bluetooth le adapter, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @details This function disables Bluetooth le protocol stack and hardware.
- *
- * @remarks
- *
- * @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_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_LE_ENABLED
- * @post This function invokes bt_adapter_le_state_changed_cb().
- *
- * @see bt_adapter_le_get_state()
- * @see bt_adapter_le_state_changed_cb()
- * @see bt_adapter_le_set_state_changed_cb()
- * @see bt_adapter_le_unset_state_changed_cb ()
- *
- */
-int bt_adapter_le_disable(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Gets the current state of local Bluetooth adapter.
- * @since_tizen 2.3
- *
- * @param[out] adapter_le_state The current adapter le state
- *
- * @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
- *
- * @pre Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- */
-int bt_adapter_le_get_state(bt_adapter_le_state_e *adapter_le_state);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Starts the LE device discovery for a BT_ADAPTER_DEVICE_DISCOVERY_LE type.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @details If a LE device is discovered, bt_adapter_le_device_discovery_state_changed_cb()
-*  will be invoked with #BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND, and then bt_adapter_le_device_discovery_state_changed_cb()
- * will be called with #BT_ADAPTER_LE_DEVICE_DISCOVERY_FINISHED in case of the completion or cancellation of the discovery.
- *
- * @remarks To connect to peer Bluetooth device, you need to know its Bluetooth address. \n
- * The device discovery can be stopped by bt_adapter_le_stop_device_discovery().
- *
- * @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_NOW_IN_PROGRESS  Operation is now in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * or must be #BT_ADAPTER_LE_ENABLED.
- * @post This function invokes bt_adapter_le_device_discovery_state_changed_cb().
- *
- * @see bt_adapter_le_is_discovering()
- * @see bt_adapter_le_device_discovery_state_changed_cb()
- * @see bt_adapter_le_set_device_discovery_state_changed_cb()
- * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
- */
-int bt_adapter_le_start_device_discovery(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Stops the LE device discovery, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @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_NOT_IN_PROGRESS  Operation is not in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The device discovery must be in progress with bt_adapter_le_start_device_discovery().
- * @post This function invokes bt_adapter_le_device_discovery_state_changed_cb().
- *
- * @see bt_adapter_le_is_discovering()
- * @see bt_adapter_le_start_device_discovery()
- * @see bt_adapter_le_set_device_discovery_state_changed_cb()
- * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
- * @see bt_adapter_le_device_discovery_state_changed_cb()
- */
-int bt_adapter_le_stop_device_discovery(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Checks for the LE device discovery is in progress or not.
- * @since_tizen 2.3
- *
- * @remarks If Bluetooth LE discovery is in progress, other operations are not allowed and
- * you have to either stop the LE discovery operation, or wait for it to be finished,
- * before performing other operations.
-
- * @param[out] is_discovering The discovering status: (@c true = in progress , @c  false = not in progress )
- *
- * @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_OPERATION_FAILED  Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * or must be #BT_ADAPTER_LE_ENABLED.
- *
- * @see bt_adapter_le_start_device_discovery()
- * @see bt_adapter_le_stop_device_discovery()
- */
-int bt_adapter_le_is_discovering(bool *is_discovering);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Registers a callback function to be invoked when the LE device discovery state changes.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_le_device_discovery_state_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_le_device_discovery_state_changed_cb()
- * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
- */
-int bt_adapter_le_set_device_discovery_state_changed_cb(bt_adapter_le_device_discovery_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief      Unregisters the callback function.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- * @see bt_adapter_le_set_device_discovery_state_changed_cb()
- */
-int bt_adapter_le_unset_device_discovery_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Registers a callback function to be invoked when the Bluetooth adapter le state changes.
- * @since_tizen 2.3
- *
- * @param[in] callback The callback function to invoke
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_adapter_le_state_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_le_state_changed_cb()
- * @see bt_adapter_le_unset_state_changed_cb()
- */
-int bt_adapter_le_set_state_changed_cb(bt_adapter_le_state_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief      Unregisters the callback function.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- * @see bt_adapter_le_set_state_changed_cb()
- */
-int bt_adapter_le_unset_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief add address to whitelist for accepting scanning request.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks If the adress is in the whitelist then other LE devices are able to
- * search this device. Before calling this API, make sure that the adapter is
- * enabled. There is no callback event for this API.
-
- * @param[in] address The other device's address
- * @param[in] address_type The other device's address type
- *
- * @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  Adapter is not enabled
- * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_adapter_le_start_advertising()
- * @see bt_adapter_le_stop_advertising()
- */
-int bt_adapter_le_add_white_list(const char *address, bt_device_address_type_e address_type);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief remove address from the whitelist for not accepting scanning request.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks If the adress is in the whitelist then other LE devices are able to
- * search this device. Before calling this API, make sure that the adapter is
- * enabled. There is no callback event for this API.
- *
- * @param[in] address The other device's address
- * @param[in] address_type The other device's address type
- *
- * @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  Adapter is not enabled
- * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_adapter_le_start_advertising()
- * @see bt_adapter_le_stop_advertising()
- */
-int bt_adapter_le_remove_white_list(const char *address, bt_device_address_type_e address_type);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief clear address from the whitelist for not accepting scanning request.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks If the adress is in the whitelist then other LE devices are able to
- * search this device. Before calling this API, make sure that the adapter is
- * enabled. There is no callback event for this API.
- *
- * @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  Adapter is not enabled
- * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_adapter_le_start_advertising()
- * @see bt_adapter_le_stop_advertising()
- */
-int bt_adapter_le_clear_white_list(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Create advertiser to advertise device's existence or respond to LE scanning reqeust.
- * @since_tizen 2.3
- *
- * @param[out] advertiser The handle of advertiser
- *
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_destroy_advertiser()
- */
-int bt_adapter_le_create_advertiser(bt_advertiser_h *advertiser);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Destroy advertiser.
- * @since_tizen 2.3
- *
- * @param[out] advertiser The handle of advertiser
- *
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_create_advertiser()
- */
-int bt_adapter_le_destroy_advertiser(bt_advertiser_h advertiser);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Set the data to be advertised or responded to scan request from LE scanning device.
- *        The maximum advertised or responded data size is 31 bytes
- *        including data type and system wide data.
- * @since_tizen 2.3
- *
- * @param[in] advertiser The handle of advertiser
- * @param[in] pkt_type The packet type
- * @param[in] data_type The data type that is included in packet
- * @param[in] data The data to be advertised or be responded to scan request from LE scanning device
- * @param[in] data_size The size of data to be set.
- *
- * @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_QUOTA_EXCEEDED  Quota exceeded
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_remove_advertising_data()
- * @see bt_adapter_le_clear_advertising_data()
- */
-int bt_adapter_le_add_advertising_data(bt_advertiser_h advertiser,
-               bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_packet_data_type_e data_type,
-               void *data, unsigned int data_size);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Unset the data to be advertised or responded to scan request from LE scanning device.
- * @since_tizen 2.3
- *
- * @param[in] advertiser The handle of advertiser
- * @param[in] pkt_type The packet type
- * @param[in] data_type The data type to be removed from selected packet
- *
- * @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_OPERATION_FAILED  Operation failed
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_add_advertising_data()
- * @see bt_adapter_le_clear_advertising_data()
- */
-int bt_adapter_le_remove_advertising_data(bt_advertiser_h advertiser,
-               bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_packet_data_type_e data_type);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Clear all data to be advertised or responded to scan request from LE scanning device.
- * @since_tizen 2.3
- *
- * @param[in] advertiser The handle of advertiser
- * @param[in] pkt_type The packet type to be cleared
- *
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_add_advertising_data()
- * @see bt_adapter_le_remove_advertising_data()
- */
-int bt_adapter_le_clear_advertising_data(bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Start advertising with passed advertiser and advertising parameters.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @details Once Bluetooth advertising is started, nearby Bluetooth LE(Low Energy) supported
- * devices can know this device's existence. And one of them can make a connection reqeust,
- * if it is allowed.
- *
- * @param[in] advertiser The handle of advertiser
- * @param[in] adv_params The parameters of advertising \n
- * If NULL is passed, default values which are defined in driver / controller are used.
- * @param[in] cb The callback to report the result of this function
- * @param[in] user_data The user data to be passed when callback is called
- *
- * @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_NOW_IN_PROGRESS  Operation is now in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post This function invokes bt_adapter_le_advertising_state_changed_cb().
- *
- * @see bt_adapter_le_stop_advertising()
- * @see bt_adapter_le_advertising_state_changed_cb()
- */
-int bt_adapter_le_start_advertising(bt_advertiser_h advertiser, bt_adapter_le_advertising_params_s *adv_params,
-               bt_adapter_le_advertising_state_changed_cb cb, void *user_data);
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Stops the advertising.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] advertiser The handle of advertiser
- *
- * @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_IN_PROGRESS  Operation is not in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The advertising must be going on with bt_adapter_le_start_advertising().
- * @post This function invokes bt_adapter_le_advertising_state_changed_cb().
- *
- * @see bt_adapter_le_start_advertising()
- * @see bt_adapter_le_advertising_state_changed_cb()
- */
-int bt_adapter_le_stop_advertising(bt_advertiser_h advertiser);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Sets the Privacy feature state of local Bluetooth adapter.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] enable_privacy The privacy feature to set/unset.
- *
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The state of local Bluetooth must be #BT_ADAPTER_LE_ENABLED.
- *
- */
-int bt_adapter_le_enable_privacy(bool enable_privacy);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Creates a bond with a remote Bluetooth device, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks A bond can be destroyed by bt_device_destroy_bond().\n
- * The bonding request can be cancelled by bt_device_cancel_bonding().
- *
- * @param[in] remote_address The address of the remote Bluetooth device with which the bond should be created
- *
- * @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_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
- * @post This function invokes bt_device_bond_created_cb().
- *
- * @see bt_adapter_start_device_discovery()
- * @see bt_device_bond_created_cb()
- * @see bt_device_cancel_bonding()
- * @see bt_device_destroy_bond()
- * @see bt_device_set_bond_created_cb()
- * @see bt_device_unset_bond_created_cb()
- */
-int bt_device_create_bond(const char *remote_address);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Creates a bond with a remote Bluetooth device, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks A bond can be destroyed by bt_device_destroy_bond().\n
- * The bonding request can be cancelled by bt_device_cancel_bonding().
- *
- * @param[in] remote_address The address of the remote Bluetooth device with which the bond should be created
- * @param[in] conn_type The connection type(LE or BREDR) to create bond with remote device
- *
- * @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_RESOURCE_BUSY     Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
- * @post This function invokes bt_device_bond_created_cb().
- *
- * @see bt_adapter_start_device_discovery()
- * @see bt_device_create_bond()
- * @see bt_device_bond_created_cb()
- * @see bt_device_cancel_bonding()
- * @see bt_device_destroy_bond()
- * @see bt_device_set_bond_created_cb()
- * @see bt_device_unset_bond_created_cb()
- */
-int bt_device_create_bond_by_type(const char *remote_address,
-                                 bt_device_connection_link_type_e conn_type);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Cancels the bonding process.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks Use this function when the remote Bluetooth device is not responding to the
- * bond request or you wish to cancel the bonding request.
- *
- * @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_NOT_IN_PROGRESS  Operation not in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The creating a bond must be in progress by bt_device_create_bond().
- *
- * @see bt_device_create_bond()
- * @see bt_device_bond_created_cb()
- * @see bt_device_set_bond_created_cb()
- * @see bt_device_unset_bond_created_cb()
- */
-int bt_device_cancel_bonding(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Destroys the bond, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] remote_address The address of the remote Bluetooth device to remove bonding
- *
- * @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_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The bond with the remote device must be created with bt_device_create_bond().
- * @post This function invokes bt_device_bond_destroyed_cb().
- *
- * @see bt_device_create_bond()
- * @see bt_device_bond_destroyed_cb()
- * @see bt_device_set_bond_destroyed_cb()
- * @see bt_device_unset_bond_destroyed_cb()
- */
-int bt_device_destroy_bond(const char *remote_address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Sets an alias for the bonded device.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] remote_address The address of the remote Bluetooth device
- * @param[in] alias The alias of the remote Bluetooth device
- *
- * @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 not bonded
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The bond with the remote device must be created with bt_device_create_bond().
- *
- * @see bt_device_create_bond()
- */
-int bt_device_set_alias(const char *remote_address, const char *alias);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Sets the authorization of a bonded device, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks Once a device is authorized, you don't need to receive a confirmation.
- *
- * @param[in] remote_address The address of the remote Bluetooth device to authorize
- * @param[in] authorization_state The Bluetooth authorization state
- *
- * @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 not bonded
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The bond with the remote device must be created with bt_device_create_bond().
- * @post bt_device_authorization_changed_cb() will be invoked.
- *
- * @see bt_device_create_bond()
- * @see bt_device_authorization_changed_cb()
- * @see bt_device_set_authorization_changed_cb()
- * @see bt_device_unset_authorization_changed_cb()
- */
-int bt_device_set_authorization(const char *remote_address, bt_device_authorization_e authorization_state);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Starts the search for services supported by the specified device, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks If creating a bond succeeds, which means bt_device_bond_created_cb() is called with result #BT_ERROR_NONE,
- * then you don't need to run this function.\n
- * The service search takes a couple of seconds to complete normally. \n
- * The service search can be canceled by bt_device_cancel_service_search().
- *
- * @param[in] remote_address The address of the remote Bluetooth device whose services need to be checked
- *
- * @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 not bonded
- * @retval #BT_ERROR_SERVICE_SEARCH_FAILED  Service search failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
- * @pre The bond with the remote device must be created with bt_device_create_bond().
- * @post This function invokes bt_device_service_searched_cb().
- *
- * @see bt_adapter_start_device_discovery()
- * @see bt_device_create_bond()
- * @see bt_device_bond_created_cb()
- * @see bt_device_service_searched_cb()
- * @see bt_device_cancel_service_search()
- * @see bt_device_set_service_searched_cb()
- * @see bt_device_unset_service_searched_cb()
- */
-int bt_device_start_service_search(const char *remote_address);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Cancels service search process.
- * @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 not bonded
- * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation not in progress
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The service search must be in progress by bt_device_start_service_search().
- *
- * @see bt_device_start_service_search()
- * @see bt_device_service_searched_cb()
- * @see bt_device_set_service_searched_cb()
- * @see bt_device_unset_service_searched_cb()
- */
-int bt_device_cancel_service_search(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Gets the connected profiles.
- * @since_tizen 2.3
- * @param[in] remote_address The address of the remote device
- * @param[in] callback The callback function to invoke
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post bt_device_connected_profile() will be invoked.
- * @see bt_device_connected_profile()
- */
-int bt_device_foreach_connected_profiles(const char *remote_address, bt_device_connected_profile callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Gets the profile connected status.
- * @since_tizen 2.3
- * @param[in] remote_address The address of the remote device
- * @param[in] bt_profile wish to know bt_profile
- * @param[out] connected_status the connected status
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- */
-int bt_device_is_profile_connected(const char *remote_address, bt_profile_e bt_profile,
-                                       bool *connected_status);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Registers a callback function to be invoked when the bond creates.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_device_bond_created_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_device_bond_created_cb()
- * @see bt_device_unset_bond_created_cb()
- */
-int bt_device_set_bond_created_cb(bt_device_bond_created_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief      Unregisters the callback function.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_device_set_bond_created_cb()
- */
-int bt_device_unset_bond_created_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Registers a callback function to be invoked when the bond destroys.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_device_bond_destroyed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_device_bond_destroyed_cb()
- * @see bt_device_unset_bond_destroyed_cb()
- */
-int bt_device_set_bond_destroyed_cb(bt_device_bond_destroyed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief      Unregisters the callback function.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_device_set_bond_destroyed_cb()
- */
-int bt_device_unset_bond_destroyed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Registers a callback function to be invoked when the authorization of device changes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_device_authorization_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_device_authorization_changed_cb()
- * @see bt_device_set_authorization_changed_cb()
- * @see bt_device_unset_authorization_changed_cb()
- */
-int bt_device_set_authorization_changed_cb(bt_device_authorization_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief      Unregisters the callback function.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_device_set_authorization_changed_cb()
- */
-int bt_device_unset_authorization_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Registers a callback function to be invoked when the process of service search finishes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_device_service_searched_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_device_service_searched_cb()
- * @see bt_device_unset_service_searched_cb()
- */
-int bt_device_set_service_searched_cb(bt_device_service_searched_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief      Unregisters the callback function.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_device_set_service_searched_cb()
- */
-int bt_device_unset_service_searched_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Registers a callback function to be invoked when the connection 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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_device_connection_state_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_device_connection_state_changed_cb()
- * @see bt_device_unset_connection_state_changed_cb()
- */
-int bt_device_set_connection_state_changed_cb(bt_device_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief      Unregisters the callback function to be invoked when the connection 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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_device_set_connection_state_changed_cb()
- */
-int bt_device_unset_connection_state_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Registers a rfcomm server socket with a specific UUID.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks A socket can be destroyed by bt_socket_destroy_rfcomm().
- *
- * @param[in] service_uuid The UUID of service to provide
- * @param[out] socket_fd The file descriptor of socket to listen
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see bt_socket_listen_and_accept_rfcomm()
- * @see bt_socket_destroy_rfcomm()
- */
-int bt_socket_create_rfcomm(const char *service_uuid, int *socket_fd);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Removes the rfcomm server socket which was created using bt_socket_create_rfcomm().
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remarks If callback function bt_socket_connection_state_changed_cb() is set and the remote Bluetooth device is connected,
- * then bt_socket_connection_state_changed_cb() will be called when this function is finished successfully.
- *
- * @param[in] socket_fd The file descriptor of socket (which was created using bt_socket_create_rfcomm()) to destroy
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The socket must be created with bt_socket_create_rfcomm().
- * @post If callback function bt_socket_connection_state_changed_cb() is set and the remote Bluetooth device is connected,
- * then bt_socket_connection_state_changed_cb() will be called.
- * @see bt_socket_create_rfcomm()
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_set_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-int bt_socket_destroy_rfcomm(int socket_fd);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Starts listening on passed rfcomm socket and accepts connection requests.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @details Pop-up is shown automatically when a RFCOMM connection is requested.
- * bt_socket_connection_state_changed_cb() will be called with
- * #BT_SOCKET_CONNECTED if you click "yes" and connection is finished successfully.
- * @param[in] socket_fd The file descriptor of socket on which start to listen
- * @param[in] max_pending_connections The maximum number of pending connections
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The socket must be created with bt_socket_create_rfcomm().
- * @post If callback function bt_socket_connection_state_changed_cb() is set,
- * then bt_socket_connection_state_changed_cb() will be called when the remote Bluetooth device is connected.
- * @see bt_socket_create_rfcomm()
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_set_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-int bt_socket_listen_and_accept_rfcomm(int socket_fd, int max_pending_connections);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Starts listening on passed rfcomm socket.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @details bt_socket_connection_requested_cb() will be called when a RFCOMM connection is requested.
- *
- * @param[in] socket_fd  The file descriptor socket on which start to listen
- * @param[in] max_pending_connections  The number of pending connections
- *
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The socket must be created with bt_socket_create_rfcomm().
- * @post This function invokes bt_socket_connection_state_changed_cb().
- *
- * @see bt_socket_create_rfcomm()
- * @see bt_socket_set_connection_requested_cb()
- * @see bt_socket_unset_connection_requested_cb()
- * @see bt_socket_connection_requested_cb()
- */
-int bt_socket_listen(int socket_fd, int max_pending_connections);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Accepts a connection request.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] requested_socket_fd  The file descriptor of socket on which a connection is requested
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The connection is requested by bt_socket_connection_requested_cb().
- * @see bt_socket_create_rfcomm()
- * @see bt_socket_connection_requested_cb()
- * @see bt_socket_listen()
- * @see bt_socket_reject()
-*/
-int bt_socket_accept(int requested_socket_fd);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Rejects a connection request.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] socket_fd  The file descriptor of socket on which a connection is requested
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The connection is requested by bt_socket_connection_requested_cb().
- * @see bt_socket_create_rfcomm()
- * @see bt_socket_connection_requested_cb()
- * @see bt_socket_listen()
- * @see bt_socket_accept()
- */
-int bt_socket_reject(int socket_fd);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Connects to a specific RFCOMM based service on a remote Bluetooth device UUID, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks A connection can be disconnected by bt_socket_disconnect_rfcomm().
- *
- * @param[in] remote_address The address of the remote Bluetooth device
- * @param[in] service_uuid The UUID of service provided by the remote Bluetooth device
- *
- * @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 not bonded
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
- * @pre The bond with the remote device must be created with bt_device_create_bond().
- * @post This function invokes bt_socket_connection_state_changed_cb().
- *
- * @see bt_device_create_bond()
- * @see bt_adapter_start_device_discovery()
- * @see bt_device_start_service_search()
- * @see bt_socket_disconnect_rfcomm()
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_set_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-int bt_socket_connect_rfcomm(const char *remote_address, const char *service_uuid);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Disconnects the RFCOMM connection with the given file descriptor of conneted socket.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] socket_fd  The file descriptor of socket to close which was received using bt_socket_connection_state_changed_cb().
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The connection must be established.
- *
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_set_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-int bt_socket_disconnect_rfcomm(int socket_fd);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Sends data to the connected device.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- *
- * @param[in] socket_fd The file descriptor of connected socket which was received using bt_socket_connection_state_changed_cb()
- * @param[in] data The data to be sent
- * @param[in] length The length of data to be sent
- *
- * @return the number of bytes written (zero indicates nothing was written).
- * @retval On error, -1 is returned, and errno is set appropriately. See write 2 man page.
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @exception BT_ERROR_NOT_INITIALIZED  Not initialized
- * @exception BT_ERROR_PERMISSION_DENIED  Permission denied
- * @exception BT_ERROR_AGAIN  Resource temporarily unavailable
- *
- * @pre The connection must be established.
- *
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_set_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-int bt_socket_send_data(int socket_fd, const char *data, int length);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Register a callback function that will be invoked when you receive data.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_socket_data_received_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_socket_data_received_cb()
- * @see bt_socket_set_data_received_cb()
- * @see bt_socket_unset_data_received_cb()
- */
-int bt_socket_set_data_received_cb(bt_socket_data_received_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief      Unregisters the callback function.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_socket_data_received_cb()
- * @see bt_socket_set_data_received_cb()
- */
-int bt_socket_unset_data_received_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Register a callback function that will be invoked when a RFCOMM connection is requested.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post If you listen a socket by bt_socket_listen(), bt_socket_connection_requested_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_socket_unset_connection_requested_cb()
- */
-int bt_socket_set_connection_requested_cb(bt_socket_connection_requested_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Unregisters the callback function.
- * @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
- * @pre  The Bluetooth service must be initialized with bt_initialize().
- * @see  bt_initialize()
- * @see  bt_socket_set_connection_requested_cb()
- * @see  bt_socket_connection_requested_cb()
- */
-int bt_socket_unset_connection_requested_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Register a callback function that will be invoked when the connection state changes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_socket_connection_state_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-int bt_socket_set_connection_state_changed_cb(bt_socket_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief      Unregisters the callback function.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_socket_connection_state_changed_cb()
- * @see bt_socket_set_connection_state_changed_cb()
- */
-int bt_socket_unset_connection_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Initializes the Bluetooth OPP server requested by bt_opp_server_push_requested_cb().
- * @since_tizen 2.3
- * @details The popup appears when an OPP connection is requested from a remote device.
- * If you accept the request, then connection will be established and bt_opp_server_push_requested_cb() will be called.
- * At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
- * @remarks This function must be called to start Bluetooth OPP server. You must free all resources of the Bluetooth service
- * by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
- * @param[in] destination  The destination path
- * @param[in] push_requested_cb  The callback called when a push is requested
- * @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_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @see  bt_opp_server_push_requested_cb()
- * @see  bt_opp_server_deinitialize()
- * @see  bt_opp_server_accept()
- * @see  bt_opp_server_reject()
- */
-int bt_opp_server_initialize(const char *destination, bt_opp_server_push_requested_cb push_requested_cb, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Initializes the Bluetooth OPP server requested by bt_opp_server_connection_requested_cb().
- * @since_tizen 2.3
- * @details No popup appears when an OPP connection is requested from a remote device.
- * Instead, @a connection_requested_cb() will be called.
- * At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
- * @remarks This function must be called to start Bluetooth OPP server. \n
- * You must free all resources of the Bluetooth service by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
- * @param[in] destination  The destination path
- * @param[in] connection_requested_cb  The callback called when an OPP connection is requested
- * @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_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @see  bt_opp_server_connection_requested_cb()
- * @see  bt_opp_server_deinitialize()
- * @see  bt_opp_server_accept_connection()
- * @see  bt_opp_server_reject_connection()
- */
-int bt_opp_server_initialize_by_connection_request(const char *destination, bt_opp_server_connection_requested_cb connection_requested_cb, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Denitializes the Bluetooth OPP server.
- * @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_ENABLED  Not enabled
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @see  bt_opp_server_initialize()
- * @see  bt_opp_server_deinitialize()
- */
-int bt_opp_server_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Accepts the push request from the remote device.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remarks If you initialize OPP server by bt_opp_server_initialize_by_connection_request(), then name is ignored.
- * You can cancel the pushes by bt_opp_server_cancel_transfer() with transfer_id.
- * @param[in] progress_cb  The callback called when a file is being transfered
- * @param[in] finished_cb  The callback called when a transfer is finished
- * @param[in] name  The name to store. This can be NULL if you initialize OPP server by bt_opp_server_initialize_by_connection_request().
- * @param[in] user_data The user data to be passed to the callback function
- * @param[out]  transfer_id  The ID of transfer
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see  bt_opp_server_reject()
- */
-int bt_opp_server_accept(bt_opp_server_transfer_progress_cb progress_cb, bt_opp_server_transfer_finished_cb finished_cb, const char *name,
- void *user_data, int *transfer_id);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Rejects the push request from the remote device.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see  bt_opp_server_accept()
- */
-int bt_opp_server_reject(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Cancels the transfer.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] transfer_id  The ID of transfer
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see  bt_opp_server_accept_connection()
- * @see  bt_opp_server_accept()
- */
-int bt_opp_server_cancel_transfer(int transfer_id);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief Sets the destination path of file to be pushed.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] destination  The destination path of file to be pushed
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see  bt_opp_server_initialize()
- */
-int bt_opp_server_set_destination(const char *destination);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief Initializes the Bluetooth OPP client.
- * @since_tizen 2.3
- * @remarks This function must be called before Bluetooth OPP client starts. \n
- * You must free all resources of the Bluetooth service by calling bt_opp_client_deinitialize()
- * if Bluetooth OPP service is no longer needed.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @see  bt_opp_client_deinitialize()
- */
-int bt_opp_client_initialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief Denitializes the Bluetooth OPP client.
- * @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_OPERATION_FAILED  Operation failed
- * @see  bt_opp_client_initialize()
- */
-int bt_opp_client_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief Adds file to be pushed.
- * @since_tizen 2.3
- * @param[in] file  The path of file to be pushed
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see  bt_opp_client_clear_files()
- * @see  bt_opp_client_push_files()
- */
-int bt_opp_client_add_file(const char *file);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief Adds file to be pushed.
- * @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_ENABLED  Not enabled
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @see  bt_opp_client_add_file()
- * @see  bt_opp_client_push_files()
- */
-int bt_opp_client_clear_files(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief Pushes the file to the remote device, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @details At first, bt_opp_client_push_responded_cb() will be called when OPP server responds to the push request.
- * After connection is established, bt_opp_client_push_progress_cb() will be called repeatedly until a file is tranfered completely.
- * If you send several files, then bt_opp_client_push_progress_cb() with another file will be called repeatedly until the file is tranfered completely.
- * bt_opp_client_push_finished_cb() will be called when the push request is finished.
- * @param[in] remote_address The remote address
- * @param[in] responded_cb  The callback called when OPP server responds to the push request
- * @param[in] progress_cb  The callback called when each file is being transfered
- * @param[in] finished_cb  The callback called when the push request is finished
- * @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_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see bt_opp_client_initialize()
- * @see bt_opp_client_cancel_push
- */
-int bt_opp_client_push_files(const char *remote_address, bt_opp_client_push_responded_cb responded_cb,
- bt_opp_client_push_progress_cb progress_cb, bt_opp_client_push_finished_cb finished_cb, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief Cancels the push request in progress, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre bt_opp_client_push_files() must be called.
- * @post bt_opp_client_push_finished_cb() will be invoked with result #BT_ERROR_CANCELLED,
- * which is a parameter of bt_opp_client_push_files().
- * @see bt_opp_client_initialize()
- * @see bt_opp_client_push_files()
- */
-int bt_opp_client_cancel_push(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Initializes the Bluetooth HID(Human Interface Device) Host.
- * @since_tizen 2.3
- * @remarks This function must be called before Bluetooth HID Host starts. \n
- * You must free all resources of the Bluetooth service by calling bt_hid_host_deinitialize()
- * if Bluetooth HID Host service is no longer needed.
- * @param[in] connection_cb  The callback called when the connection state is changed
- * @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_OPERATION_FAILED  Operation failed
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see  bt_hid_host_deinitialize()
- */
-int bt_hid_host_initialize(bt_hid_host_connection_state_changed_cb connection_cb, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Deinitializes the Bluetooth HID(Human Interface Device) Host.
- * @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_OPERATION_FAILED  Operation failed
- * @pre The Bluetooth HID service must be initialized with bt_hid_host_initialize().
- * @see  bt_hid_host_initialize()
- */
-int bt_hid_host_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Connects the remote device with the HID(Human Interface Device) service, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] remote_address  The remote address
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The local device must be bonded with the remote device by bt_device_create_bond().
- * @pre The Bluetooth HID service must be initialized with bt_hid_host_initialize().
- * @post bt_hid_host_connection_state_changed_cb() will be invoked.
- * @see bt_hid_host_disconnect()
- * @see bt_hid_host_connection_state_changed_cb()
- */
-int bt_hid_host_connect(const char *remote_address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Disconnects the remote device with the HID(Human Interface Device) service, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] remote_address  The remote address
- * @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
- * @pre The remote device must be connected by bt_hid_host_connect().
- * @post bt_hid_host_connection_state_changed_cb() will be invoked.
- * @see bt_hid_host_connect()
- * @see bt_hid_host_connection_state_changed_cb()
- */
-int bt_hid_host_disconnect(const char *remote_address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief Initializes the Bluetooth profiles related with audio.
- * @since_tizen 2.3
- * @remarks This function must be called before Bluetooth profiles related with audio starts. \n
- * You must free all resources of the this service by calling bt_audio_deinitialize()
- * if Bluetooth profiles related with audio service is no longer needed.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_audio_deinitialize()
- */
-int bt_audio_initialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief Deinitializes the Bluetooth profiles related with audio.
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
- * @see bt_audio_initialize()
- */
-int bt_audio_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief Connects the remote device with the given audio profile, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @details If you input type as #BT_AUDIO_PROFILE_TYPE_ALL and connection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
- * when #BT_AUDIO_PROFILE_TYPE_HSP_HFP is connected and #BT_AUDIO_PROFILE_TYPE_A2DP is connected.
- * @param[in] remote_address  The remote address
- * @param[in] type  The type of audio profile
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
- * @pre The local device must be bonded with the remote device by bt_device_create_bond().
- * @post bt_audio_connection_state_changed_cb() will be invoked.
- * @see bt_audio_disconnect()
- * @see bt_audio_connection_state_changed_cb()
- */
-int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief Disconnects the remote device with the given audio profile, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @details If you input type as #BT_AUDIO_PROFILE_TYPE_ALL and disconnection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
- * when #BT_AUDIO_PROFILE_TYPE_HSP_HFP is disconnected and #BT_AUDIO_PROFILE_TYPE_A2DP is disconnected.
- * @param[in] remote_address  The remote address
- * @param[in] type  The type of audio profile
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- * @pre The remote device must be connected by bt_audio_connect().
- * @post bt_audio_connection_state_changed_cb() will be invoked.
- * @see bt_audio_connect()
- * @see bt_audio_connection_state_changed_cb()
- */
-int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief  Registers a callback function that will be invoked when the connection 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
- * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
- * @see bt_audio_initialize()
- * @see bt_audio_connection_state_changed_cb()
- * @see bt_panu_unset_connection_state_changed_cb()
- */
-int bt_audio_set_connection_state_changed_cb(bt_audio_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief  Unregisters a callback function that will be invoked when the connection 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
- * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
- * @see bt_audio_initialize()
- * @see bt_audio_connection_state_changed_cb()
- * @see bt_audio_set_connection_state_changed_cb()
- */
-int bt_audio_unset_connection_state_changed_cb(void);
-
-/**
- * @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
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @remarks Before notifying #BT_AG_CALL_EVENT_ANSWERED or #BT_AG_CALL_EVENT_DIALING, you should open SCO(Synchronous Connection Oriented link)
- * if Bluetooth Hands-Free need SCO connection.
- * @param[in] event  The call event
- * @param[in] call_id  The call ID
- * @param[in] phone_number  The phone number. You must set this value in case of #BT_AG_CALL_EVENT_DIALING and #BT_AG_CALL_EVENT_INCOMING.
- * In other cases, this value can be NULL.
- * @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_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_call_event(bt_ag_call_event_e event, unsigned int call_id, const char *phone_number);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief Notifies the call list to the remote bluetooth device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] list  The call list
- * @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_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
- * @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_call_handling_event_cb()
- * @see bt_ag_unset_call_handling_event_cb()
- */
-int bt_ag_set_call_handling_event_cb(bt_ag_call_handling_event_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Unregisters a callback function that will be invoked when a call handling event happened from Hands-Free.
- * @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_call_handling_event_cb()
- * @see bt_ag_set_call_handling_event_cb()
- */
-int bt_ag_unset_call_handling_event_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Registers a callback function that will be invoked when a multi call handling event happened from Hands-Free.
- * @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_multi_call_handling_event_cb()
- * @see bt_ag_unset_multi_call_handling_event_cb()
- */
-int bt_ag_set_multi_call_handling_event_cb(bt_ag_multi_call_handling_event_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Unregisters a callback function that will be invoked when a multi call handling event happened from Hands-Free.
- * @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_multi_call_handling_event_cb()
- * @see bt_ag_set_multi_call_handling_event_cb()
- */
-int bt_ag_unset_multi_call_handling_event_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Registers a callback function that will be invoked when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
- * @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_dtmf_transmitted_cb()
- * @see bt_ag_unset_dtmf_transmitted_cb()
- */
-int bt_ag_set_dtmf_transmitted_cb(bt_ag_dtmf_transmitted_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Unregisters a callback function that will be invoked when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
- * @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_dtmf_transmitted_cb()
- * @see bt_ag_set_dtmf_transmitted_cb()
- */
-int bt_ag_unset_dtmf_transmitted_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Notifies the speaker gain to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @details This function sends a signal to the remote device. This signal has the gain value.
- * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
- * When the speaker gain of remote device is changed to the requested gain, bt_audio_speaker_gain_changed_cb() will be called.
- * @param[in] gain The gain of speaker (0 ~ 15)
- * @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_OPERATION_FAILED  Operation failed
- * @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 remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
- * @see bt_ag_get_speaker_gain()
- * @see bt_ag_set_speaker_gain_changed_cb()
- * @see bt_ag_unset_speaker_gain_changed_cb()
- */
-int bt_ag_notify_speaker_gain(int gain);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Gets the current speaker gain of the remote device.
- * @since_tizen 2.3
- * @details This function gets the value of speaker gain of the remote device.
- * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
- * @param[out] gain The gain of speaker (0 ~ 15)
- * @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_NOT_SUPPORTED  Not supported
- * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
- * @see bt_ag_notify_speaker_gain()
- * @see bt_ag_set_speaker_gain_changed_cb()
- * @see bt_ag_unset_speaker_gain_changed_cb()
- */
-int bt_ag_get_speaker_gain(int *gain);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief Checks whether the remoted device enables NREC(Noise Reduction and Echo Canceling) or not.
- * @since_tizen 2.3
- * @param[out] enabled The NREC status: (@c true = enabled, @c  false = not enabled)
- * @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_NOT_SUPPORTED  Not supported
- * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
- * @see bt_audio_connect()
- */
-int bt_ag_is_nrec_enabled(bool *enabled);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Registers a callback function that will be invoked when the speaker gain of the remote device is changed.
- * @since_tizen 2.3
- * @details This function let you know the change of the speaker gain of the remote device.
- * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
- * @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_unset_speaker_gain_changed_cb()
- */
-int bt_ag_set_speaker_gain_changed_cb(bt_ag_speaker_gain_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 speaker gain of the remote device 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_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_set_speaker_gain_changed_cb()
- */
-int bt_ag_unset_speaker_gain_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Registers a callback function that will be invoked when the microphone gain of the remote device 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_unset_microphone_gain_changed_cb()
- */
-int bt_ag_set_microphone_gain_changed_cb(bt_ag_microphone_gain_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 microphone gain of the remote device 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_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_set_microphone_gain_changed_cb()
- */
-int bt_ag_unset_microphone_gain_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
- * @brief Creates a handle of call list.
- * @since_tizen 2.3
- * @param[out] list  The handle of call list
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see bt_call_list_destroy()
- */
-int bt_call_list_create(bt_call_list_h *list);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
- * @brief Destroys the handle of call list.
- * @since_tizen 2.3
- * @param[in] list  The handle of call list
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @see bt_call_list_create()
- */
-int bt_call_list_destroy(bt_call_list_h list);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
- * @brief Resets the handle of call list.
- * @since_tizen 2.3
- * @param[in] list  The handle of call list
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @see bt_call_list_create()
- */
-int bt_call_list_reset(bt_call_list_h list);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
- * @brief Adds a call to the handle of call list.
- * @since_tizen 2.3
- * @param[in] list  The handle of call list
- * @param[in] call_id  The call ID
- * @param[in] state  The state of audio gate call
- * @param[in] phone_number The phone number. You must set this value in case of #BT_AG_CALL_EVENT_DIALING and      #BT_AG_CALL_EVENT_INCOMING.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @see bt_call_list_create()
- */
-int bt_call_list_add(bt_call_list_h list, unsigned int call_id, bt_ag_call_state_e state, const char *phone_number);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief Initializes the Bluetooth AVRCP(Audio/Video Remote Control Profile) service.
- * @since_tizen 2.3
- * @remarks This function must be called before Bluetooth AVRCP service. \n
- * You must free all resources of the this service by calling bt_avrcp_target_deinitialize()
- * if Bluetooth AVRCP service is no longer needed.
- * @param[in] callback The callback function called when the connection state is changed
- * @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_OPERATION_FAILED  Operation failed
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_target_deinitialize()
- */
-int bt_avrcp_target_initialize(bt_avrcp_target_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief Deinitializes the Bluetooth AVRCP(Audio/Video Remote Control Profile) service.
- * @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
- * @pre The Bluetooth audio service must be initialized with bt_avrcp_target_initialize().
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_deinitialize(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the equalize state to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] state The state of equalizer
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_equalizer_state(bt_avrcp_equalizer_state_e state);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the repeat mode to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] mode The repeat mode
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the shuffle mode to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] mode The repeat mode
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_shuffle_mode(bt_avrcp_shuffle_mode_e mode);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the scan mode to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] mode The scan mode
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the player state to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] state The player state
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_player_state(bt_avrcp_player_state_e state);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the current position of song to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] position The current position in milliseconds
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_position(unsigned int position);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Notifies the track to the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] title The title of track
- * @param[in] artist The artist of track
- * @param[in] album The album of track
- * @param[in] genre The genre of track
- * @param[in] track_num The track number
- * @param[in] total_tracks The number of all tracks
- * @param[in] duration The duration of track in milliseconds
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_avrcp_target_connection_state_changed_cb()
- * @see bt_avrcp_target_initialize()
- */
-int bt_avrcp_target_notify_track(const char *title, const char *artist, const char *album, const char *genre, unsigned int track_num, unsigned int total_tracks, unsigned int duration);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Registers a callback function that will be invoked when the equalizer state is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_unset_equalizer_state_changed_cb()
- */
-int bt_avrcp_set_equalizer_state_changed_cb(bt_avrcp_equalizer_state_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Unregisters a callback function that will be invoked when the equalizer state is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_set_equalizer_state_changed_cb()
- */
-int bt_avrcp_unset_equalizer_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Registers a callback function that will be invoked when the repeat mode is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_unset_repeat_mode_changed_cb()
- */
-int bt_avrcp_set_repeat_mode_changed_cb(bt_avrcp_repeat_mode_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Unregisters a callback function that will be invoked when the repeat mode is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_set_repeat_mode_changed_cb()
- */
-int bt_avrcp_unset_repeat_mode_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Registers a callback function that will be invoked when the shuffle mode is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_unset_shuffle_mode_changed_cb()
- */
-int bt_avrcp_set_shuffle_mode_changed_cb(bt_avrcp_shuffle_mode_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Unregisters a callback function that will be invoked when the shuffle mode is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_set_shuffle_mode_changed_cb()
- */
-int bt_avrcp_unset_shuffle_mode_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Registers a callback function that will be invoked when the scan mode is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_unset_scan_mode_changed_cb()
- */
-int bt_avrcp_set_scan_mode_changed_cb(bt_avrcp_scan_mode_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Unregisters a callback function that will be invoked when the scan mode is changed by the remote control device.
- * @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
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @see bt_initialize()
- * @see bt_avrcp_set_scan_mode_changed_cb()
- */
-int bt_avrcp_unset_scan_mode_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief Registers an application that acts as the @a Sink role of HDP(Health Device Profile).
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remarks The @a app_id must be released with free() by you.
- * @param[in] data_type  The data type of MDEP. This value is defined in ISO/IEEE 11073-20601 spec.
- * For example, pulse oximeter is 0x1004 and blood pressure monitor is 0x1007.
- * @param[out] app_id  The ID of application
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see bt_hdp_deactivate_sink()
- */
-int bt_hdp_register_sink_app(unsigned short data_type, char **app_id);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief Unregisters the given application that acts as the @a Sink role of HDP(Health Device Profile).
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] app_id  The ID of application
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @see bt_hdp_register_sink_app()
- */
-int bt_hdp_unregister_sink_app(const char *app_id);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief Connects the remote device which acts as @a Source role, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] remote_address  The remote address
- * @param[in] app_id  The ID of application
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Sink role of HDP must be registered with bt_hdp_register_sink_app().
- * @pre The local device must be bonded with the remote device by bt_device_create_bond().
- * @post bt_hdp_connected_cb() will be invoked.
- * @see bt_hdp_disconnect()
- * @see bt_hdp_set_connection_state_changed_cb()
- * @see bt_hdp_unset_connection_state_changed_cb()
- */
-int bt_hdp_connect_to_source(const char *remote_address, const char *app_id);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief Disconnects the remote device, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] remote_address  The remote address
- * @param[in] channel  The connected data channel
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @post bt_hdp_disconnected_cb() will be invoked.
- * @see bt_hdp_set_connection_state_changed_cb()
- * @see bt_hdp_unset_connection_state_changed_cb()
- */
-int bt_hdp_disconnect(const char *remote_address, unsigned int channel);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief Sends the data to the remote device.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in] channel  The connected data channel
- * @param[in] data  The data to send
- * @param[in] size  The size of data to send (byte)
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected.
- * @see bt_hdp_data_received_cb()
- * @see bt_hdp_set_data_received_cb()
- * @see bt_hdp_unset_data_received_cb()
- */
-int bt_hdp_send_data(unsigned int channel, const char *data, unsigned int size);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Registers a callback function that will be invoked when the connection state is changed.
- * @since_tizen 2.3
- * @param[in] connected_cb The callback function called when a connection is established
- * @param[in] disconnected_cb The callback function called when a connection is disconnected
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_hdp_unset_connection_state_changed_cb()
- */
-int bt_hdp_set_connection_state_changed_cb(bt_hdp_connected_cb connected_cb, bt_hdp_disconnected_cb disconnected_cb, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Unregisters a callback function that will be invoked when the connection 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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_hdp_set_connection_state_changed_cb()
- */
-int bt_hdp_unset_connection_state_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Registers a callback function that will be invoked when you receive the data.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_hdp_unset_data_received_cb()
- */
-int bt_hdp_set_data_received_cb(bt_hdp_data_received_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Unregisters a callback function that will be invoked when you receive the data.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_hdp_set_data_received_cb()
- */
-int bt_hdp_unset_data_received_cb(void);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the primary services of GATT(Generic Attribute Profile).
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  remote_address  The address of the remote device
- * @param[in]  callback  The callback function to invoke
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval  #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post  @a callback will be called if there are primary services.
- * @see  bt_gatt_primary_service_cb()
- */
-int bt_gatt_foreach_primary_services(const char *remote_address, bt_gatt_primary_service_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Discovers the characteristics in service, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  service  The attribute handle of service
- * @param[in]  callback  The result callback
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post  @a callback will be called.
- * @see  bt_gatt_characteristics_discovered_cb()
- */
-int bt_gatt_discover_characteristics(bt_gatt_attribute_h service, bt_gatt_characteristics_discovered_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the UUID of service.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remarks  @a uuid must be released with free() by you.
- * @param[in]  service  The attribute handle of service
- * @param[out]  uuid  The UUID of service
- * @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_OPERATION_FAILED  Operation failed
- * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- */
-int bt_gatt_get_service_uuid(bt_gatt_attribute_h service, char **uuid);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the included services in service.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  service  The attribute handle of service
- * @param[in]  callback  The callback function to invoke
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval  #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post  @a callback will be called if there are included services.
- * @see  bt_gatt_included_service_cb()
- */
-int bt_gatt_foreach_included_services(bt_gatt_attribute_h service, bt_gatt_included_service_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function that will be invoked when a characteristic value 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
- * @pre  The Bluetooth service must be initialized with bt_initialize().
- * @see  bt_gatt_unset_characteristic_changed_cb()
- */
-int bt_gatt_set_characteristic_changed_cb(bt_gatt_characteristic_changed_cb callback, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a callback function that will be invoked when a characteristic 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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_gatt_set_characteristic_changed_cb()
- */
-int bt_gatt_unset_characteristic_changed_cb(void);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Watches all the characteristic value changes of the service
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  service  The attribute handle of service
- * @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_PERMISSION_DENIED  Permission denied
- * @pre  The Bluetooth service must be initialized with bt_initialize().
- * @see  bt_gatt_unset_characteristic_changed_cb()
- */
-int bt_gatt_watch_characteristic_changes(bt_gatt_attribute_h service);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Remove watching of all the characteristic value changes of the service
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  service  The attribute handle of service
- * @return  0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_gatt_set_characteristic_changed_cb()
- */
-int bt_gatt_unwatch_characteristic_changes(bt_gatt_attribute_h service);
-
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the characteristic declaration.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @remarks  @a uuid and @a value must be released with free() by you.
- * @param[in]  characteristic  The attribute handle of characteristic
- * @param[out]  uuid  The UUID of service
- * @param[out]  value  The value of characteristic (byte array)
- * @param[out]  value_length  The length of value
- * @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_OPERATION_FAILED  Operation failed
- * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_gatt_set_characteristic_value()
- */
-int bt_gatt_get_characteristic_declaration(bt_gatt_attribute_h characteristic, char **uuid, unsigned char **value, int *value_length);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Sets the value of characteristic.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  characteristic  The attribute handle of characteristic
- * @param[in]  value  The value of characteristic (byte array)
- * @param[in]  value_length  The length of value
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_gatt_get_characteristic_declaration()
- */
-int bt_gatt_set_characteristic_value(bt_gatt_attribute_h characteristic, const unsigned char *value, int value_length);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Sets the value of characteristic request.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  characteristic  The attribute handle of characteristic
- * @param[in]  value  The value of characteristic (byte array)
- * @param[in]  value_length  The length of value
-  * @param[in]  callback  The result callback
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_gatt_get_characteristic_declaration()
- */
-int bt_gatt_set_characteristic_value_request(bt_gatt_attribute_h characteristic, const unsigned char *value,
-                               int value_length, bt_gatt_characteristic_write_cb callback);
-
-/**
-* @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
-* @brief  Clones the attribute handle.
-* @since_tizen 2.3
-* @remarks  @a clone must be released with bt_gatt_destroy_attribute_handle().
-* @param[out]  clone  The cloned attribute handle
-* @param[in]  origin  The origin attribute handle
-* @return  0 on success, otherwise negative error value.
-* @retval  #BT_ERROR_NONE  Successful
-* @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
-* @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
-* @see  bt_gatt_destroy_attribute_handle()
-*/
-int bt_gatt_clone_attribute_handle(bt_gatt_attribute_h* clone, bt_gatt_attribute_h origin);
-
-/**
-* @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
-* @brief  Destroys the attribute handle.
-* @since_tizen 2.3
-* @param[in]  handle  The attribute handle
-* @return  0 on success, otherwise negative error value.
-* @retval  #BT_ERROR_NONE  Successful
-* @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
-* @see  bt_gatt_clone_attribute_handle()
-*/
-int bt_gatt_destroy_attribute_handle(bt_gatt_attribute_h handle);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Reads the value of characteristic from remote device
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  char_handle  The attribute handle of characteristic
- * @param[in]  callback  The result callback
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_gatt_get_characteristic_declaration()
- */
-int bt_gatt_read_characteristic_value(bt_gatt_attribute_h char_handle,
-               bt_gatt_characteristic_read_cb callback);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Discovers the characteristic descriptors of a characteristic within its definition, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  characteristic_handle  The attribute handle of characteristic
- * @param[in]  callback  The result callback
- * @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_OPERATION_FAILED  Operation failed
- * @retval  #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post  @a callback will be called.
- * @see  bt_gatt_characteristic_descriptor_discovered_cb()
- */
-int bt_gatt_discover_characteristic_descriptor(bt_gatt_attribute_h characteristic_handle,
-               bt_gatt_characteristic_descriptor_discovered_cb callback,
-               void *user_data);
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Sets the value of characteristic descriptor request.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- * @param[in]  characteristic  The attribute handle of characteristic
- * @param[in]  value  The value of characteristic (byte array), desc handle, desc value
- * @param[in]  value_length  The length of value
-  * @param[in] callback  The result callback
- * @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_OPERATION_FAILED      Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_gatt_get_characteristic_declaration()
- */
-int bt_gatt_set_characteristic_desc_value_request(bt_gatt_attribute_h characteristic,
-                               const unsigned char *value, int value_length,
-                               bt_gatt_characteristic_write_cb callback);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Connect to a specific LE based service on a remote bluetooth dievice address, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @remarks A connection can be disconnected by bt_gatt_disconnect().
- *
- * @param[in] address The address of the remote Bluetooth device.
- * @param[in] auto_connect The flag of the auto connection.
- *
- * @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_INVALID_PARAMETER Invalid paramater
- * @retval #BT_ERROR_OPERATION_FAILED Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @pre The remote device must support le connection.
- * @post This function invokes bt_gatt_connection_state_changed_cb().
- *
- * @see bt_initialize()
- * @see bt_gatt_disconnect()
- * @see bt_gatt_set_connection_state_changed_cb()
- * @see bt_gatt_unset_connection_state_changed_cb()
- * @see bt_gatt_connection_state_changed_cb()
- */
-int bt_gatt_connect(const char *address, bool auto_connect);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Disconnect to LE connection with the given remote Bluetooth dievice address, asynchronously.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] address The address of the remote Bluetooth device
- *
- * @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_INVALID_PARAMETER Invalid paramater
- * @retval #BT_ERROR_OPERATION_FAILED Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The connection must be established.
- * @post This function invokes bt_gatt_connection_state_changed_cb().
- *
- * @see bt_initialize()
- * @see bt_gatt_connect()
- * @see bt_gatt_set_connection_state_changed_cb()
- * @see bt_gatt_unset_connection_state_changed_cb()
- * @see bt_gatt_connection_state_changed_cb()
- */
-int bt_gatt_disconnect(const char *address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Registers a callback function that will be invoked when the connection 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.
- *
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid paramater
- *
- * @see bt_gatt_connect()
- * @see bt_gatt_disconnect()
- * @see bt_gatt_unset_connection_state_changed_cb()
- */
-int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Unregisters a callback function that will be invoked when the connection state is changed.
- * @since_tizen 2.3
- *
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- *
- * @see bt_gatt_connect()
- * @see bt_gatt_disconnect()
- * @see bt_gatt_connection_state_changed_cb()
- */
-int bt_gatt_unset_connection_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Initializes the Gatt Service.
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval     #BT_ERROR_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- */
-int _bt_gatt_init_service(void);
-
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  DeInitializes the Gatt Service.
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval     #BT_ERROR_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- * @see _bt_gatt_init_service(void)
- */
-int _bt_gatt_deinit_service(void);
-
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds Gatt Service to the service interface.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]  svc_uuid                Gatt service uuid.
- * @param[out] svc_path        Object path of the GATT service.
- * @remarks svc_path must be released with free() by you.
- *
- * @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_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- */
-int bt_gatt_add_service(const char *svc_uuid,
-                               char **svc_path);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Deletes a Gatt Service from the Gatt Server Database.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]  svc_path  Service path of the gatt service to remove.
- * @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_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- */
-int bt_gatt_remove_service(const char *svc_path);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds Gatt characteristic to the Characteristics interface.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]  char_uuid Gatt characteristic uuid.
- * @param[in]  char_value      Gatt characteristic value.
- * @param[in]  value_length Caracteristic value length.
- * @param[in]  char_flags    Characteristic flags.
- * @param[in]  flags_length Caracteristic flags length.
- * @param[in]  svc_path        service path to which this characteristic belongs to.
- * @param[out]  char_path      characteristic path registered on the interface.
- * @remarks char_path must be released with free() by you.
- *
- * @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_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- */
-int bt_gatt_add_characteristic(const char *char_uuid,
-                       const char *char_value, int value_length,
-                       const char *char_flags[], int flags_length,
-                       const char *svc_path, char **char_path);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds Gatt descriptor to the descriptor interface.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]  desc_uuid Gatt descriptor uuid.
- * @param[in]  desc_value      Gatt descriptor value.
- * @param[in]  desc_length     Gatt descriptor value.
- * @param[in]  permissions     Permissions for the descriptor.
- * @param[in]  char_path       Characteristic path to which this descriptor should belong to.
- * @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_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- */
-int bt_gatt_add_descriptor(const char *desc_uuid,
-                       const char *desc_value, int value_length,
-                       const char *permissions, const char *char_path,
-                       char **desc_path);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers the given service path (including characteristics and descriptor) with the Bluez.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]  svc_path Gatt service path obtained from the add_service.
- * @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_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre  bt_gatt_add_service, bt_gatt_add_characteristic and bt_gatt_add_descriptor
- *          must be called before calling bt_gatt_register_service
- *
- * @see  bt_adapter_enable()
- * @see  bt_gatt_add_service()
- * @see  bt_gatt_add_characteristic()
- * @see  bt_gatt_add_descriptor()
- */
-int bt_gatt_register_service(const char *svc_path,
-               bt_gatt_remote_characteristic_write_cb callback,
-               void *user_data);
-
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the existing characteristic value.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]  char_path       characteristic path registered on the interface.
- * @param[in]  char_value      Gatt characteristic value.
- * @param[in]  value_length    Characteristic value length.
- * @param[in]  address Remote device address, for which
- *                       Notification/Indication need to be sent.
- *
- * @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_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see  bt_adapter_enable()
- */
-int bt_gatt_update_characteristic(const char *char_path,
-                       const char *char_value, int value_length,
-                       const char *address);
-/**
- * @internal
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Delete Gatt Services from the Gatt Server Database.
- * @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_INVALID_PARAMETER  Invalid parameter
- * @retval     #BT_ERROR_OPERATION_FAILED      Operation failed
- * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post  @a callback will be called.
- * @see  bt_adapter_enable()
- */
-int bt_gatt_delete_services(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief Activates the NAP(Network Access Point).
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
- * @see bt_nap_deactivate()
- */
-int bt_nap_activate(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief Deactivates the NAP(Network Access Point).
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
- * @see bt_nap_activate()
- */
-int bt_nap_deactivate(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief Disconnects the all PANUs(Personal Area Networking User) which are connected to you.
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
- * @see bt_nap_activate()
- */
-int bt_nap_disconnect_all(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief Disconnects the specified PANU(Personal Area Networking User) which is connected to you.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] remote_address  The remote address
- * @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_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
- * @see bt_nap_activate()
- */
-int bt_nap_disconnect(const char *remote_address);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief  Registers a callback function that will be invoked when the connection state changes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_nap_connection_state_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_nap_connection_state_changed_cb()
- * @see bt_nap_unset_connection_state_changed_cb()
- */
-int bt_nap_set_connection_state_changed_cb(bt_nap_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief  Unregisters a callback function that will be invoked when the connection state changes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_nap_connection_state_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_nap_connection_state_changed_cb()
- * @see bt_nap_set_connection_state_changed_cb()
- */
-int bt_nap_unset_connection_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Registers a callback function that will be invoked when the connection state changes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_nap_connection_state_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_panu_connection_state_changed_cb()
- * @see bt_panu_unset_connection_state_changed_cb()
- */
-int bt_panu_set_connection_state_changed_cb(bt_panu_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Unregisters a callback function that will be invoked when the connection state changes.
- * @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
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post bt_nap_connection_state_changed_cb() will be invoked.
- * @see bt_initialize()
- * @see bt_panu_connection_state_changed_cb()
- * @see bt_panu_set_connection_state_changed_cb()
- */
-int bt_panu_unset_connection_state_changed_cb(void);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief Connects the remote device with the PAN(Personal Area Networking) service, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] remote_address  The remote address
- * @param[in] type  The type of PAN service
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The local device must be bonded with the remote device by bt_device_create_bond().
- * @post bt_panu_connection_state_changed_cb() will be invoked.
- * @see bt_panu_disconnect()
- * @see bt_panu_connection_state_changed_cb()
- */
-int bt_panu_connect(const char *remote_address, bt_panu_service_type_e type);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief Disconnects the remote device with the PAN(Personal Area Networking) service, asynchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] remote_address  The remote address
- * @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_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @pre The remote device must be connected by bt_panu_connect().
- * @post bt_panu_connection_state_changed_cb() will be invoked.
- * @see bt_panu_connect()
- * @see bt_panu_connection_state_changed_cb()
- */
-int bt_panu_disconnect(const char *remote_address);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief   update LE connection.
- * @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_PERMISSION_DENIED  Permission denied
- * @pre The Bluetooth service must be initialized by bt_initialize().
- * @pre The remote device must be connected with bt_gatt_connect().
- */
-int bt_device_le_conn_update(const char *device_address,
-                            const bt_le_conn_update_s *parameters);
-
-
-/**
- * @}
- */
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // __TIZEN_NETWORK_BLUETOOTH_H__
diff --git a/resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth_private.h b/resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth_private.h
deleted file mode 100644 (file)
index dbb8e44..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * 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_PRIVATE_H__
-#define __TIZEN_NETWORK_BLUETOOTH_PRIVATE_H__
-
-#include <dlog.h>
-#include <stdbool.h>
-#include <bluetooth-api.h>
-#include <bluetooth-audio-api.h>
-#include <bluetooth-telephony-api.h>
-#include <bluetooth-media-control.h>
-#include <bluetooth-hid-api.h>
-
-#include "bluetooth.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#undef LOG_TAG
-#define LOG_TAG "CAPI_NETWORK_BLUETOOTH"
-
-#define BT_INFO(fmt, args...) SLOGI(fmt, ##args)
-#define BT_DBG(fmt, args...) SLOGD(fmt, ##args)
-#define BT_ERR(fmt, args...) SLOGE(fmt, ##args)
-
-#define OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
-
-/**
- * @internal
- * @brief Bluetooth callback.
- */
-typedef enum
-{
-       BT_EVENT_STATE_CHANGED = 0x00, /**< Adapter state is changed */
-       BT_EVENT_LE_STATE_CHANGED, /**< Adapter le state is changed */
-       BT_EVENT_NAME_CHANGED, /**< Adapter name is changed */
-       BT_EVENT_VISIBILITY_MODE_CHANGED, /**< Adapter visibility mode is changed */
-       BT_EVENT_VISIBILITY_DURATION_CHANGED, /**< Adapter visibility duration is changed */
-       BT_EVENT_DEVICE_DISCOVERY_STATE_CHANGED, /**< Device discovery state is changed */
-       BT_EVENT_LE_DEVICE_DISCOVERY_STATE_CHANGED, /**< LE Device discovery state is changed */
-       BT_EVENT_BOND_CREATED, /**< A bond is created */
-       BT_EVENT_BOND_DESTROYED, /**< A bond is destroyed */
-       BT_EVENT_AUTHORIZATION_CHANGED, /**< Authorization is changed */
-       BT_EVENT_SERVICE_SEARCHED, /**< Service search finish */
-       BT_EVENT_DATA_RECEIVED, /**< Data is received */
-       BT_EVENT_CONNECTION_STATE_CHANGED, /**< Connection state is changed */
-       BT_EVENT_RFCOMM_CONNECTION_REQUESTED, /**< RFCOMM connection is requested */
-       BT_EVENT_OPP_CONNECTION_REQUESTED, /**< OPP connection is requested */
-       BT_EVENT_OPP_PUSH_REQUESTED, /**< OPP push is requested */
-       BT_EVENT_OPP_SERVER_TRANSFER_PROGRESS, /**< OPP transfer progress */
-       BT_EVENT_OPP_SERVER_TRANSFER_FINISHED, /**< OPP transfer is completed */
-       BT_EVENT_OPP_CLIENT_PUSH_RESPONSED, /**< OPP client connection is reponsed */
-       BT_EVENT_OPP_CLIENT_PUSH_PROGRESS, /**< OPP client push progress */
-       BT_EVENT_OPP_CLIENT_PUSH_FINISHED, /**< OPP client push is finished */
-       BT_EVENT_PAN_CONNECTION_STATE_CHANGED, /**< PAN connection change */
-       BT_EVENT_NAP_CONNECTION_STATE_CHANGED, /**< NAP connection change */
-       BT_EVENT_HDP_CONNECTED, /**< HDP connection change */
-       BT_EVENT_HDP_DISCONNECTED, /**< HDP disconnection change */
-       BT_EVENT_HDP_DATA_RECEIVED, /**< HDP Data receive Callabck */
-       BT_EVENT_AUDIO_CONNECTION_STATUS, /**< Audio Connection change callback */
-       BT_EVENT_AG_SCO_CONNECTION_STATUS, /**< Audio - AG SCO Connection state change callback */
-       BT_EVENT_AG_CALL_HANDLING_EVENT, /**< Audio - AG call event callback */
-       BT_EVENT_AG_MULTI_CALL_HANDLING_EVENT, /**< Audio - AG 3-way call event callback */
-       BT_EVENT_AG_DTMF_TRANSMITTED, /**< Audio - DTMF tone sending request */
-       BT_EVENT_AG_MICROPHONE_GAIN_CHANGE, /**< Audio Microphone change callback */
-       BT_EVENT_AG_SPEAKER_GAIN_CHANGE, /**< Audio Speaker gain change callback */
-       BT_EVENT_AG_VENDOR_CMD, /**< Audio - XSAT Vendor cmd */
-       BT_EVENT_AVRCP_CONNECTION_STATUS, /**< AVRCP connection change callback */
-       BT_EVENT_AVRCP_EQUALIZER_STATE_CHANGED, /**< AVRCP equalizer state change callback */
-       BT_EVENT_AVRCP_REPEAT_MODE_CHANGED, /**< AVRCP repeat mode change callback */
-       BT_EVENT_AVRCP_SHUFFLE_MODE_CHANGED, /**< AVRCP equalizer mode change callback */
-       BT_EVENT_AVRCP_SCAN_MODE_CHANGED, /**< AVRCP scan mode change callback */
-       BT_EVENT_HID_CONNECTION_STATUS, /**< HID connection status callback */
-       BT_EVENT_DEVICE_CONNECTION_STATUS, /**< Device connection status callback */
-       BT_EVENT_GATT_CONNECTION_STATUS, /** < GATT connection status callback */
-       BT_EVENT_GATT_PRIM_SVC_DISCOVERED, /**< GATT Primary Service discovered callback */
-       BT_EVENT_GATT_CHARACTERISTIC_DISCOVERED, /**< GATT characteristic discovered callback */
-       BT_EVENT_GATT_CHARACTERISTIC_DESCRIPTOR_DISCOVERED, /**< GATT characteristic descriptor discovered callback */
-       BT_EVENT_GATT_VALUE_CHANGED, /**< GATT characteristic value changed callback */
-       BT_EVENT_GATT_READ_CHARACTERISTIC, /**< GATT characteristic value read callback */
-       BT_EVENT_GATT_WRITE_CHARACTERISTIC, /**< GATT characteristic value write callback */
-       BT_EVENT_GATT_SERVER_ON_WRITE_CHAR, /**< GATT characteristic value write callback */
-       BT_EVENT_ADVERTISING_STATE_CHANGED, /**< Advertising state changed callback */
-       BT_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed callback */
-       BT_EVENT_CONNECTABLE_CHANGED_EVENT, /**< Adapter connectable changed callback */
-       BT_EVENT_RSSI_ENABLED_EVENT, /**< RSSI Enabled callback */
-       BT_EVENT_RSSI_ALERT_EVENT, /**< RSSI Alert callback */
-       BT_EVENT_GET_RSSI_EVENT, /**< Get RSSI Strength callback */
-#ifdef TIZEN_WEARABLE
-       BT_EVENT_PBAP_CONNECTION_STATUS, /**< PBAP connection status callback */
-       BT_EVENT_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size status callback */
-       BT_EVENT_PBAP_PHONEBOOK_PULL, /**< PBAP Phonebook Pull status callback */
-       BT_EVENT_PBAP_VCARD_LIST, /**< PBAP vCard List status callback */
-       BT_EVENT_PBAP_VCARD_PULL, /**< PBAP vCard Pull status callback */
-       BT_EVENT_PBAP_PHONEBOOK_SEARCH, /**< PBAP Phonebook Search status callback */
-       BT_EVENT_HF_SCO_CONNECTION_STATUS, /**< Audio - HF SCO Connection state change callback */
-       BT_EVENT_HF_SPEAKER_GAIN_CHANGE, /**< Audio - HF Speaker gain change callback */
-       BT_EVENT_HF_CALL_HANDLING_EVENT, /**< Audio - HF call event callback */
-       BT_EVENT_HF_VENDOR_DEP_CMD_EVENT, /**< Audio - HF Vendor Command callback */
-       BT_EVENT_HF_MULTI_CALL_HANDLING_EVENT, /**< Audio - HF 3-way call event callback */
-#endif
-} bt_event_e;
-
-/**
- * @internal
- */
-typedef struct {
-       int handle;
-
-       bt_adapter_le_advertising_state_changed_cb cb;
-       void *cb_data;
-
-       bt_adapter_le_advertising_params_s adv_params;
-
-       unsigned int adv_data_len;
-       char *adv_data;
-
-       unsigned int scan_rsp_data_len;
-       char *scan_rsp_data;
-
-       void *user_data;
-} bt_advertiser_s;
-
-/**
- * @internal
- */
-typedef struct bt_event_sig_event_slot_s
-{
-    int event_type;
-    const void *callback;
-    void *user_data;
-} bt_event_sig_event_slot_s;
-
-
-#define BT_CHECK_INPUT_PARAMETER(arg) \
-       if (arg == NULL) \
-       { \
-               LOGE("[%s] INVALID_PARAMETER(0x%08x)", __FUNCTION__, BT_ERROR_INVALID_PARAMETER); \
-               return BT_ERROR_INVALID_PARAMETER; \
-       }
-
-/**
- * @internal
- * @brief Check the initialzating status
- */
-int _bt_check_init_status(void);
-
-#define BT_CHECK_INIT_STATUS() \
-       if (_bt_check_init_status() == BT_ERROR_NOT_INITIALIZED) \
-       { \
-               LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
-               return BT_ERROR_NOT_INITIALIZED; \
-       }
-
-/**
- * @internal
- * @brief Initialize Bluetooth LE adapter
- */
-int _bt_le_adapter_init(void);
-
-/**
- * @internal
- * @brief Deinitialize Bluetooth LE adapter
- */
-int _bt_le_adapter_deinit(void);
-
-/**
- * @internal
- * @brief Set the event callback.
- */
-void _bt_set_cb(int events, void *callback, void *user_data);
-
-/**
- * @internal
- * @brief Unset the event callback.
- */
-void _bt_unset_cb(int events);
-
-/**
- * @internal
- * @brief Check if the event callback exist or not.
- */
-bool _bt_check_cb(int events);
-
-/**
- * @internal
- * @brief Convert Bluetooth F/W error codes to capi Bluetooth error codes.
- */
-int _bt_get_error_code(int origin_error);
-
-
-/**
- * @internal
- * @brief Convert Bluetooth F/W bluetooth_device_info_t to capi bt_device_info_s.
- */
-int _bt_get_bt_device_info_s(bt_device_info_s **dest_dev, bluetooth_device_info_t *source_dev);
-
-
-/**
- * @internal
- * @brief Free bt_device_info_s.
- */
-void _bt_free_bt_device_info_s(bt_device_info_s *device_info);
-
-/**
- * @internal
- * @brief Convert Bluetooth F/W bluetooth_device_address_t to string.
- */
-int _bt_convert_address_to_string(char **addr_str, bluetooth_device_address_t *addr_hex);
-
-
-/**
- * @internal
- * @brief Convert string to Bluetooth F/W bluetooth_device_address_t.
- */
-void _bt_convert_address_to_hex(bluetooth_device_address_t *addr_hex, const char *addr_str);
-
-
-/**
- * @internal
- * @brief Convert error code to string.
- */
-char* _bt_convert_error_to_string(int error);
-
-/**
- * @internal
- * @brief Convert the visibility mode
- */
-bt_adapter_visibility_mode_e _bt_get_bt_visibility_mode_e(bluetooth_discoverable_mode_t mode);
-
-/**
- * @internal
- * @brief Since the Audio call back and event proxy call backs have different prototype it is wrapper function.
- */
-void _bt_audio_event_proxy(int event, bt_audio_event_param_t *param, void *user_data);
-
-#ifdef TIZEN_WEARABLE
-/**
- * @internal
- * @brief Since the HF call back and event proxy call backs have different prototype it is wrapper function.
- */
-void _bt_hf_event_proxy(int event, bt_hf_event_param_t *param, void *user_data);
-#endif
-
-/**
- * @internal
- * @brief Since the Telephony call back and event proxy call backs have different prototype it is wrapper function.
- */
-void _bt_telephony_event_proxy(int event, telephony_event_param_t *param, void *user_data);
-
-/**
- * @internal
- * @brief Since the AVRCP call back and event proxy call backs have different prototype it is wrapper function.
- */
-void _bt_avrcp_event_proxy(int event, media_event_param_t *param, void *user_data);
-
-/**
- * @internal
- * @brief Since the HID call back and event proxy call backs have different prototype it is wrapper function.
- */
-void _bt_hid_event_proxy(int event, hid_event_param_t *param, void *user_data);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_NETWORK_BLUETOOTH_PRIVATE_H__ */
diff --git a/resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth_type.h b/resource/csdk/connectivity/lib/tizen/ble/inc/bluetooth_type.h
deleted file mode 100644 (file)
index 95d195d..0000000
+++ /dev/null
@@ -1,1495 +0,0 @@
-/*
- * 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_H__
-#define __TIZEN_NETWORK_BLUETOOTH_TYPE_H__
-
- #ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/**
- * @file bluetooth_type.h
- * @brief API to control the Bluetooth adapter, devices and communications.
- * @ingroup     CAPI_NETWORK_BLUETOOTH_TYPE_MODULE
- */
-
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
- * @brief Enumerations of Bluetooth error codes.
- */
-typedef enum
-{
-       BT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful*/
-       BT_ERROR_CANCELLED = TIZEN_ERROR_CANCELED, /**< Operation cancelled */
-       BT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
-       BT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
-       BT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */
-       BT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Timeout error */
-       BT_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /**< Operation now in progress */
-       BT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,
-       BT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
-       BT_ERROR_QUOTA_EXCEEDED = TIZEN_ERROR_QUOTA_EXCEEDED, /**< Quota exceeded */
-       BT_ERROR_NOT_INITIALIZED = TIZEN_ERROR_BLUETOOTH|0x0101, /**< Local adapter not initialized */
-       BT_ERROR_NOT_ENABLED = TIZEN_ERROR_BLUETOOTH|0x0102, /**< Local adapter not enabled */
-       BT_ERROR_ALREADY_DONE = TIZEN_ERROR_BLUETOOTH|0x0103, /**< Operation already done  */
-       BT_ERROR_OPERATION_FAILED = TIZEN_ERROR_BLUETOOTH|0x0104, /**< Operation failed */
-       BT_ERROR_NOT_IN_PROGRESS = TIZEN_ERROR_BLUETOOTH|0x0105, /**< Operation not in progress */
-       BT_ERROR_REMOTE_DEVICE_NOT_BONDED = TIZEN_ERROR_BLUETOOTH|0x0106, /**< Remote device not bonded */
-       BT_ERROR_AUTH_REJECTED = TIZEN_ERROR_BLUETOOTH|0x0107, /**< Authentication rejected */
-       BT_ERROR_AUTH_FAILED = TIZEN_ERROR_BLUETOOTH|0x0108, /**< Authentication failed */
-       BT_ERROR_REMOTE_DEVICE_NOT_FOUND = TIZEN_ERROR_BLUETOOTH|0x0109, /**< Remote device not found */
-       BT_ERROR_SERVICE_SEARCH_FAILED = TIZEN_ERROR_BLUETOOTH|0x010A, /**< Service search failed */
-       BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED = TIZEN_ERROR_BLUETOOTH|0x010B, /**< Remote device is not connected */
-       BT_ERROR_AGAIN = TIZEN_ERROR_BLUETOOTH|0x010C, /**< Resource temporarily unavailable */
-       BT_ERROR_SERVICE_NOT_FOUND = TIZEN_ERROR_BLUETOOTH|0x010D, /**< Service Not Found */
-} bt_error_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Enumerations of the Bluetooth adapter state.
- */
-typedef enum
-{
-       BT_ADAPTER_DISABLED = 0x00, /**< Bluetooth adapter is disabled */
-       BT_ADAPTER_ENABLED, /**< Bluetooth adapter is enabled */
-} bt_adapter_state_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Enumerations of the Bluetooth adapter le state.
- */
-typedef enum
-{
-       BT_ADAPTER_LE_DISABLED = 0x00, /**< Bluetooth le is disabled */
-       BT_ADAPTER_LE_ENABLED, /**< Bluetooth le is enabled */
-} bt_adapter_le_state_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Enumerations of the Bluetooth visibility mode.
- */
-typedef enum
-{
-       BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE = 0x00,  /**< Other devices cannot find your device via discovery */
-       BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE,  /**< Discoverable mode */
-       BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE,  /**< Discoverable mode with time limit. After specific period,
-                                                           it is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.*/
-} bt_adapter_visibility_mode_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Enumerations of the discovery state of Bluetooth device.
- *
- */
-typedef enum
-{
-       BT_ADAPTER_DEVICE_DISCOVERY_STARTED, /**< Device discovery is started */
-       BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, /**< Device discovery is finished */
-       BT_ADAPTER_DEVICE_DISCOVERY_FOUND, /**< The remote Bluetooth device is found */
-} bt_adapter_device_discovery_state_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Enumerations of the discovery state of Bluetooth LE device.
- *
- */
-typedef enum
-{
-       BT_ADAPTER_LE_DEVICE_DISCOVERY_STARTED, /**< LE device discovery is started */
-       BT_ADAPTER_LE_DEVICE_DISCOVERY_FINISHED, /**< LE device discovery is finished */
-       BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND, /**< The remote Bluetooth LE device is found */
-} bt_adapter_le_device_discovery_state_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Enumerations of the Bluetooth advertising state.
- */
-typedef enum {
-       BT_ADAPTER_LE_ADVERTISING_STOPPED = 0x00, /**< Bluetooth advertising is stopped */
-       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 filter policy.
- */
-typedef enum {
-       BT_ADAPTER_LE_ADVERTISING_FILTER_DEFAULT = 0x00, /**< White list is not in use */
-       BT_ADAPTER_LE_ADVERTISING_FILTER_ALLOW_SCAN_WL = 0x01, /**< Allow the scan
-                                       request that in the White list */
-       BT_ADAPTER_LE_ADVERTISING_FILTER_ALLOW_CONN_WL = 0x02, /**< Allow the connectoin
-                                       request that in the White list */
-       BT_ADAPTER_LE_ADVERTISING_FILTER_ALLOW_SCAN_CONN_WL = 0x03, /**< Allow the
-                                       scan and connectoin request that in the White list */
-} bt_adapter_le_advertising_filter_policy_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Enumerations of the Bluetooth advertising type.
- */
-typedef enum {
-       BT_ADAPTER_LE_ADVERTISING_CONNECTABLE = 0x00, /**< Connectable undirected advertising (ADV_IND) */
-       BT_ADAPTER_LE_ADVERTISING_CONNECTABLE_DIRECT_HIGH = 0x01, /**< Connectable high duty cycle directed advertising (ADV_DIRECT_IND) */
-       BT_ADAPTER_LE_ADVERTISING_SCANNABLE = 0x02, /**< Scannable undirected advertising (ADV_SCAN_IND) */
-       BT_ADAPTER_LE_ADVERTISING_NON_CONNECTABLE = 0x03, /**< Non connectable undirected advertising (ADV_NONCOND_IND) */
-       BT_ADAPTER_LE_ADVERTISING_CONNECTABLE_DIRECT_LOW = 0x04, /**< Connectable low duty cycle directed advertising (ADV_DIRECT_IND) */
-} bt_adapter_le_advertising_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Enumerations of the Bluetooth LE packet type.
- */
-typedef enum {
-       BT_ADAPTER_LE_PACKET_ADVERTISING, /**< Advertising packet */
-       BT_ADAPTER_LE_PACKET_SCAN_RESPONSE, /**< Sacn response packet */
-} bt_adapter_le_packet_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Enumerations of the Bluetooth LE data type
- *         that can be included in LE packets.
- */
-typedef enum {
-       BT_ADAPTER_LE_PACKET_DATA_COMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x03, /**< 16 bit UUID */
-       BT_ADAPTER_LE_PACKET_DATA_MANUFACTURER_SPECIFIC_DATA = 0xff, /**< Manufacturer data */
-} bt_adapter_le_packet_data_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Enumerations of device disconnect reason.
- */
-typedef enum
-{
-       BT_DEVICE_DISCONNECT_REASON_UNKNOWN, /**< Disconnected by unknown reason */
-       BT_DEVICE_DISCONNECT_REASON_TIMEOUT, /**< Disconnected by timeout */
-       BT_DEVICE_DISCONNECT_REASON_LOCAL_HOST, /**< Disconnected by local host */
-       BT_DEVICE_DISCONNECT_REASON_REMOTE, /**< Disconnected by remote */
-} bt_device_disconnect_reason_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Enumerations of connection link type.
- */
-typedef enum
-{
-       BT_DEVICE_CONNECTION_LINK_BREDR, /**< BR/EDR link */
-       BT_DEVICE_CONNECTION_LINK_LE, /**< LE link */
-       BT_DEVICE_CONNECTION_LINK_DEFAULT = 0xFF, /**< The connection type defualt */
-} bt_device_connection_link_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Enumerations of device authorization state.
- */
-typedef enum
-{
-       BT_DEVICE_AUTHORIZED, /**< The remote Bluetooth device is authorized */
-       BT_DEVICE_UNAUTHORIZED, /**< The remote Bluetooth device is unauthorized */
-} bt_device_authorization_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Enumerations of Bluetooth profile.
- */
-typedef enum
-{
-    BT_PROFILE_RFCOMM = 0x01, /**< RFCOMM Profile */
-    BT_PROFILE_A2DP = 0x02, /**< Advanced Audio Distribution Profile */
-    BT_PROFILE_HSP = 0x04, /**< Headset Profile */
-    BT_PROFILE_HID = 0x08, /**< Human Interface Device Profile */
-    BT_PROFILE_NAP = 0x10, /**< Network Access Point Profile */
-    BT_PROFILE_AG = 0x20, /**< Audio Gateway Profile */
-    BT_PROFILE_GATT = 0x40, /**< Generic Attribute Profile */
-    BT_PROFILE_NAP_SERVER = 0x80, /**< NAP server Profile */
-} bt_profile_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Enumerations of device address type.
- */
-typedef enum
-{
-       BT_DEVICE_PUBLIC_ADDRESS = 0x00, /**< Public address */
-       BT_DEVICE_RANDOM_ADDRESS, /**< Random address */
-} bt_device_address_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Enumerations of service class.
- */
-typedef enum {
-       BT_SC_NONE = 0, /**< No service class */
-       BT_SC_RES_SERVICE_MASK = 0x00000001, /**< RES service class */
-       BT_SC_SPP_SERVICE_MASK = 0x00000002, /**< SPP service class */
-       BT_SC_DUN_SERVICE_MASK = 0x00000004, /**< DUN service class */
-       BT_SC_FAX_SERVICE_MASK = 0x00000008, /**< FAX service class */
-       BT_SC_LAP_SERVICE_MASK = 0x00000010, /**< LAP service class */
-       BT_SC_HSP_SERVICE_MASK = 0x00000020, /**< HSP service class */
-       BT_SC_HFP_SERVICE_MASK = 0x00000040, /**< HFP service class */
-       BT_SC_OPP_SERVICE_MASK = 0x00000080, /**< OPP service class */
-       BT_SC_FTP_SERVICE_MASK = 0x00000100, /**< FTP service class */
-       BT_SC_CTP_SERVICE_MASK = 0x00000200, /**< CTP service class */
-       BT_SC_ICP_SERVICE_MASK = 0x00000400, /**< ICP service class */
-       BT_SC_SYNC_SERVICE_MASK = 0x00000800, /**< SYNC service class */
-       BT_SC_BPP_SERVICE_MASK = 0x00001000, /**< BPP service class */
-       BT_SC_BIP_SERVICE_MASK = 0x00002000, /**< BIP service class */
-       BT_SC_PANU_SERVICE_MASK = 0x00004000, /**< PANU service class */
-       BT_SC_NAP_SERVICE_MASK = 0x00008000, /**< NAP service class */
-       BT_SC_GN_SERVICE_MASK = 0x00010000, /**< GN service class */
-       BT_SC_SAP_SERVICE_MASK = 0x00020000, /**< SAP service class */
-       BT_SC_A2DP_SERVICE_MASK = 0x00040000, /**< A2DP service class */
-       BT_SC_AVRCP_SERVICE_MASK = 0x00080000, /**< AVRCP service class */
-       BT_SC_PBAP_SERVICE_MASK = 0x00100000, /**< PBAP service class */
-       BT_SC_HID_SERVICE_MASK = 0x00200000, /**< HID service class */
-       BT_SC_ALL_SERVICE_MASK = 0x00FFFFFF, /**< ALL service class */
-       BT_SC_MAX /**< MAX service class */
-} bt_service_class_t;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Enumerations of major service class.
- */
-typedef enum
-{
-       BT_MAJOR_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE  = 0x002000, /**< Limited discoverable mode */
-       BT_MAJOR_SERVICE_CLASS_POSITIONING                = 0x010000, /**< Positioning class */
-       BT_MAJOR_SERVICE_CLASS_NETWORKING                 = 0x020000, /**< Networking class */
-       BT_MAJOR_SERVICE_CLASS_RENDERING                  = 0x040000, /**< Rendering class */
-       BT_MAJOR_SERVICE_CLASS_CAPTURING                  = 0x080000, /**< Capturing class */
-       BT_MAJOR_SERVICE_CLASS_OBJECT_TRANSFER            = 0x100000, /**< Object transferring class */
-       BT_MAJOR_SERVICE_CLASS_AUDIO                      = 0x200000, /**< Audio class*/
-       BT_MAJOR_SERVICE_CLASS_TELEPHONY                  = 0x400000, /**< Telephony class */
-       BT_MAJOR_SERVICE_CLASS_INFORMATION                = 0x800000, /**< Information class */
-} bt_major_service_class_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Enumerations of major device class.
- */
-typedef enum
-{
-       BT_MAJOR_DEVICE_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
-       BT_MAJOR_DEVICE_CLASS_COMPUTER = 0x01, /**< Computer major device class */
-       BT_MAJOR_DEVICE_CLASS_PHONE = 0x02, /**< Phone major device class */
-       BT_MAJOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT = 0x03, /**< LAN/Network access point major device class */
-       BT_MAJOR_DEVICE_CLASS_AUDIO_VIDEO = 0x04, /**< Audio/Video major device class */
-       BT_MAJOR_DEVICE_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class */
-       BT_MAJOR_DEVICE_CLASS_IMAGING = 0x06, /**< Imaging major device class */
-       BT_MAJOR_DEVICE_CLASS_WEARABLE = 0x07, /**< Wearable device class */
-       BT_MAJOR_DEVICE_CLASS_TOY = 0x08, /**< Toy device class */
-       BT_MAJOR_DEVICE_CLASS_HEALTH = 0x09, /**< Health device class */
-       BT_MAJOR_DEVICE_CLASS_UNCATEGORIZED = 0x1F, /**< Uncategorized major device class */
-} bt_major_device_class_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Enumerations of minor device class.
- */
-typedef enum
-{
-       BT_MINOR_DEVICE_CLASS_COMPUTER_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of computer */
-       BT_MINOR_DEVICE_CLASS_COMPUTER_DESKTOP_WORKSTATION = 0x04, /**< Desktop workstation minor device class of computer */
-       BT_MINOR_DEVICE_CLASS_COMPUTER_SERVER_CLASS = 0x08, /**< Server minor device class of computer */
-       BT_MINOR_DEVICE_CLASS_COMPUTER_LAPTOP = 0x0C, /**< Laptop minor device class of computer */
-       BT_MINOR_DEVICE_CLASS_COMPUTER_HANDHELD_PC_OR_PDA = 0x10, /**< Handheld PC/PDA minor device class of computer */
-       BT_MINOR_DEVICE_CLASS_COMPUTER_PALM_SIZED_PC_OR_PDA = 0x14, /**< Palm sized PC/PDA minor device class of computer */
-       BT_MINOR_DEVICE_CLASS_COMPUTER_WEARABLE_COMPUTER = 0x18, /**< Wearable(watch sized) minor device class of computer */
-
-       BT_MINOR_DEVICE_CLASS_PHONE_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of phone */
-       BT_MINOR_DEVICE_CLASS_PHONE_CELLULAR = 0x04, /**< Cellular minor device class of phone */
-       BT_MINOR_DEVICE_CLASS_PHONE_CORDLESS = 0x08, /**< Cordless minor device class of phone */
-       BT_MINOR_DEVICE_CLASS_PHONE_SMART_PHONE = 0x0C, /**< Smart phone minor device class of phone */
-       BT_MINOR_DEVICE_CLASS_PHONE_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10, /**< Wired modem or voice gateway minor device class of phone */
-       BT_MINOR_DEVICE_CLASS_PHONE_COMMON_ISDN_ACCESS = 0x14, /**< Common ISDN minor device class of phone */
-
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_FULLY_AVAILABLE = 0x04, /**< Fully available minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor device class of LAN/Network access point */
-       BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor device class of LAN/Network access point */
-
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_WEARABLE_HEADSET = 0x04, /**< Wearable headset minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HANDS_FREE = 0x08, /**< Hands-free minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_MICROPHONE = 0x10, /**< Microphone minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_LOUDSPEAKER = 0x14, /**< Loudspeaker minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HEADPHONES = 0x18, /**< Headphones minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_PORTABLE_AUDIO = 0x1C, /**< Portable audio minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_CAR_AUDIO = 0x20, /**< Car audio minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_SET_TOP_BOX = 0x24, /**< Set-top box minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi audio minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VCR = 0x2C, /**< VCR minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_CAMERA = 0x30, /**< Video camera minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_CAMCORDER = 0x34, /**< Camcorder minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_MONITOR = 0x38, /**< Video monitor minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_DISPLAY_LOUDSPEAKER = 0x3C, /**< Video display and loudspeaker minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_CONFERENCING = 0x40, /**< Video conferencing minor device class of audio/video */
-       BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_GAMING_TOY = 0x48, /**< Gaming/toy minor device class of audio/video */
-
-       BT_MINOR_DEVICE_CLASS_PERIPHERA_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_KEY_BOARD = 0x40, /**< Key board minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_POINTING_DEVICE = 0x80, /**< Pointing device minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_COMBO_KEYBOARD_POINTING_DEVICE = 0xC0, /**< Combo keyboard or pointing device minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_JOYSTICK = 0x04, /**< Joystick minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_GAME_PAD = 0x08, /**< Game pad minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_REMOTE_CONTROL = 0x0C, /**< Remote control minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_SENSING_DEVICE = 0x10, /**< Sensing device minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_DIGITIZER_TABLET = 0x14, /**< Digitizer minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_CARD_READER = 0x18, /**< Card reader minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_DIGITAL_PEN = 0x1C, /**< Digital pen minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_HANDHELD_SCANNER = 0x20, /**< Handheld scanner minor device class of peripheral */
-       BT_MINOR_DEVICE_CLASS_PERIPHERAL_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor device class of peripheral */
-
-       BT_MINOR_DEVICE_CLASS_IMAGING_DISPLAY = 0x10, /**< Display minor device class of imaging */
-       BT_MINOR_DEVICE_CLASS_IMAGING_CAMERA = 0x20, /**< Camera minor device class of imaging */
-       BT_MINOR_DEVICE_CLASS_IMAGING_SCANNER = 0x40, /**< Scanner minor device class of imaging */
-       BT_MINOR_DEVICE_CLASS_IMAGING_PRINTER = 0x80, /**< Printer minor device class of imaging */
-
-       BT_MINOR_DEVICE_CLASS_WEARABLE_WRIST_WATCH = 0x04, /**< Wrist watch minor device class of wearable */
-       BT_MINOR_DEVICE_CLASS_WEARABLE_PAGER = 0x08, /**< Pager minor device class of wearable */
-       BT_MINOR_DEVICE_CLASS_WEARABLE_JACKET = 0x0C, /**< Jacket minor device class of wearable */
-       BT_MINOR_DEVICE_CLASS_WEARABLE_HELMET = 0x10, /**< Helmet minor device class of wearable */
-       BT_MINOR_DEVICE_CLASS_WEARABLE_GLASSES = 0x14, /**< Glasses minor device class of wearable */
-
-       BT_MINOR_DEVICE_CLASS_TOY_ROBOT = 0x04, /**< Robot minor device class of toy */
-       BT_MINOR_DEVICE_CLASS_TOY_VEHICLE = 0x08, /**< Vehicle minor device class of toy */
-       BT_MINOR_DEVICE_CLASS_TOY_DOLL_ACTION = 0x0C, /**< Doll/Action minor device class of toy */
-       BT_MINOR_DEVICE_CLASS_TOY_CONTROLLER = 0x10, /**< Controller minor device class of toy */
-       BT_MINOR_DEVICE_CLASS_TOY_GAME = 0x14, /**< Game minor device class of toy */
-
-       BT_MINOR_DEVICE_CLASS_HEALTH_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood pressure monitor minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_THERMOMETER = 0x08, /**< Thermometer minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_WEIGHING_SCALE = 0x0C, /**< Weighing scale minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_GLUCOSE_METER = 0x10, /**< Glucose minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_PULSE_OXIMETER = 0x14, /**< Pulse oximeter minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_HEART_PULSE_RATE_MONITOR = 0x18, /**< Heart/Pulse rate monitor minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_DATA_DISPLAY = 0x1C, /**< Health data display minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_STEP_COUNTER = 0x20, /**< Step counter minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor device class of health */
-       BT_MINOR_DEVICE_CLASS_HEALTH_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor device class of health */
-} bt_minor_device_class_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Enumerations of gap appearance type.
- */
-typedef enum
-{
-       BT_APPEARANCE_TYPE_UNKNOWN = 0x00, /**< Unknown appearance type */
-       BT_APPEARANCE_TYPE_GENERIC_PHONE = 0x40, /**< Generic Phone type - Generic category */
-       BT_APPEARANCE_TYPE_GENERIC_COMPUTER = 0x80, /**< Generic Computer type - Generic category */
-       BT_APPEARANCE_TYPE_GENERIC_WATCH = 0xC0, /**< Generic Watch type - Generic category */
-} bt_appearance_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Enumerations of connected Bluetooth device event role.
- */
-typedef enum
-{
-       BT_SOCKET_UNKNOWN = 0x00, /**< Unknown role*/
-       BT_SOCKET_SERVER , /**< Server role*/
-       BT_SOCKET_CLIENT, /**< Client role*/
-} bt_socket_role_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Enumerations of Bluetooth socket connection state.
- */
-typedef enum
-{
-       BT_SOCKET_CONNECTED, /**< RFCOMM is connected */
-       BT_SOCKET_DISCONNECTED, /**< RFCOMM is disconnected */
-} bt_socket_connection_state_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief  Enumerations for the types of profiles related with audio
- */
-typedef enum {
-    BT_AUDIO_PROFILE_TYPE_ALL = 0,  /**< All supported profiles related with audio */
-    BT_AUDIO_PROFILE_TYPE_HSP_HFP,  /**< HSP(Headset Profile) and HFP(Hands-Free Profile) */
-    BT_AUDIO_PROFILE_TYPE_A2DP,  /**< A2DP(Advanced Audio Distribution Profile) */
-    BT_AUDIO_PROFILE_TYPE_AG,  /**< AG(Audio Gateway) */
-} bt_audio_profile_type_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Enumerations for the call handling event
- */
-typedef enum {
-    BT_AG_CALL_HANDLING_EVENT_ANSWER = 0x00,  /**< Request to answer an incoming call */
-    BT_AG_CALL_HANDLING_EVENT_RELEASE,  /**< Request to release a call */
-    BT_AG_CALL_HANDLING_EVENT_REJECT,  /**< Request to reject an incoming call */
-} bt_ag_call_handling_event_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Enumerations for the multi call handling event
- */
-typedef enum {
-    BT_AG_MULTI_CALL_HANDLING_EVENT_RELEASE_HELD_CALLS = 0x00,  /**< Request to release held calls */
-    BT_AG_MULTI_CALL_HANDLING_EVENT_RELEASE_ACTIVE_CALLS,  /**< Request to release active calls */
-    BT_AG_MULTI_CALL_HANDLING_EVENT_ACTIVATE_HELD_CALL,  /**< Request to put active calls into hold state and activate another (held or waiting) call */
-    BT_AG_MULTI_CALL_HANDLING_EVENT_MERGE_CALLS,  /**< Request to add a held call to the conversation */
-    BT_AG_MULTI_CALL_HANDLING_EVENT_EXPLICIT_CALL_TRANSFER,  /**< Request to let a user who has two calls to connect these two calls together and release its connections to both other parties */
-} bt_ag_multi_call_handling_event_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Enumerations for the call state
- */
-typedef enum {
-    BT_AG_CALL_EVENT_IDLE = 0x00,  /**< Idle */
-    BT_AG_CALL_EVENT_ANSWERED,  /**< Answered */
-    BT_AG_CALL_EVENT_HELD,  /**< Held */
-    BT_AG_CALL_EVENT_RETRIEVED,  /**< Retrieved */
-    BT_AG_CALL_EVENT_DIALING,  /**< Dialing */
-    BT_AG_CALL_EVENT_ALERTING,  /**< Alerting */
-    BT_AG_CALL_EVENT_INCOMING,  /**< Incoming */
-} bt_ag_call_event_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Enumerations for the call state
- */
-typedef enum {
-    BT_AG_CALL_STATE_IDLE = 0x00,  /**< Idle state */
-    BT_AG_CALL_STATE_ACTIVE,  /**< Active state */
-    BT_AG_CALL_STATE_HELD,  /**< Held state */
-    BT_AG_CALL_STATE_DIALING,  /**< Dialing state */
-    BT_AG_CALL_STATE_ALERTING,  /**< Alerting state */
-    BT_AG_CALL_STATE_INCOMING,  /**< Incoming state */
-    BT_AG_CALL_STATE_WAITING,  /**< Waiting for connected indication event after answering an incoming call*/
-} bt_ag_call_state_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Enumerations for the equalizer state
- */
-typedef enum {
-    BT_AVRCP_EQUALIZER_STATE_OFF = 0x01,  /**< Equalizer Off */
-    BT_AVRCP_EQUALIZER_STATE_ON,  /**< Equalizer On */
-} bt_avrcp_equalizer_state_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Enumerations for the repeat mode
- */
-typedef enum {
-    BT_AVRCP_REPEAT_MODE_OFF = 0x01,  /**< Repeat Off */
-    BT_AVRCP_REPEAT_MODE_SINGLE_TRACK,  /**< Single track repeat */
-    BT_AVRCP_REPEAT_MODE_ALL_TRACK,  /**< All track repeat */
-    BT_AVRCP_REPEAT_MODE_GROUP,  /**< Group repeat */
-} bt_avrcp_repeat_mode_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Enumerations for the shuffle mode
- */
-typedef enum {
-    BT_AVRCP_SHUFFLE_MODE_OFF = 0x01,  /**< Shuffle Off */
-    BT_AVRCP_SHUFFLE_MODE_ALL_TRACK,  /**< All tracks shuffle */
-    BT_AVRCP_SHUFFLE_MODE_GROUP,  /**< Group shuffle */
-} bt_avrcp_shuffle_mode_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Enumerations for the scan mode
- */
-typedef enum {
-    BT_AVRCP_SCAN_MODE_OFF = 0x01,  /**< Scan Off */
-    BT_AVRCP_SCAN_MODE_ALL_TRACK,  /**< All tracks scan */
-    BT_AVRCP_SCAN_MODE_GROUP,  /**< Group scan */
-} bt_avrcp_scan_mode_e;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Enumerations for the player state
- */
-typedef enum {
-    BT_AVRCP_PLAYER_STATE_STOPPED = 0x00,  /**< Stopped */
-    BT_AVRCP_PLAYER_STATE_PLAYING,  /**< Playing */
-    BT_AVRCP_PLAYER_STATE_PAUSED,  /**< Paused */
-    BT_AVRCP_PLAYER_STATE_FORWARD_SEEK,  /**< Seek Forward */
-    BT_AVRCP_PLAYER_STATE_REWIND_SEEK,  /**< Seek Rewind */
-} bt_avrcp_player_state_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Enumerations for the data channel type
- */
-typedef enum {
-    BT_HDP_CHANNEL_TYPE_RELIABLE  = 0x01,  /**< Reliable Data Channel */
-    BT_HDP_CHANNEL_TYPE_STREAMING,  /**< Streaming Data Channel */
-} bt_hdp_channel_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Enumerations for the types of PAN(Personal Area Networking) service
- */
-typedef enum {
-    BT_PANU_SERVICE_TYPE_NAP = 0,  /**< Network Access Point */
-} bt_panu_service_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle to control Bluetooth LE advertising
- */
-typedef void* bt_advertiser_h;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  The attribute handle of GATT(Generic Attribute Profile)
- */
-typedef void* bt_gatt_attribute_h;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  The handle of calls state
- */
-typedef void* bt_call_list_h;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Class structure of device and service.
- *
- * @see #bt_device_info_s
- * @see #bt_adapter_device_discovery_info_s
- * @see bt_device_bond_created_cb()
- * @see bt_adapter_device_discovery_state_changed_cb()
- */
-typedef struct
-{
-       bt_major_device_class_e major_device_class;     /**< Major device class. */
-       bt_minor_device_class_e minor_device_class;     /**< Minor device class. */
-       int major_service_class_mask;   /**< Major service class mask.
-       This value can be a combination of #bt_major_service_class_e like #BT_MAJOR_SERVICE_CLASS_RENDERING | #BT_MAJOR_SERVICE_CLASS_AUDIO */
-} bt_class_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Structure of device discovery information.
- *
- * @see #bt_class_s
- * @see bt_adapter_device_discovery_state_changed_cb()
- */
-typedef struct
-{
-       char *remote_address;   /**< The address of remote device */
-       char *remote_name;      /**< The name of remote device */
-       bt_class_s bt_class;    /**< The Bluetooth classes */
-       int rssi;       /**< The strength indicator of received signal  */
-       bool is_bonded; /**< The bonding state */
-       char **service_uuid;  /**< The UUID list of service */
-       int service_count;      /**< The number of services */
-       bt_appearance_type_e appearance;        /**< The Bluetooth appearance */
-       int manufacturer_data_len;      /**< manufacturer specific data length */
-       char *manufacturer_data;                /**< manufacturer specific data */
-} bt_adapter_device_discovery_info_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Structure of le device discovery information.
- *
- * @see #bt_class_s
- * @see bt_adapter_le_device_discovery_state_changed_cb()
- */
-typedef struct
-{
-       char *remote_address;   /**< The address of remote device */
-       int address_type;       /**< The address type of remote device */
-       int rssi;       /**< The strength indicator of received signal  */
-       char **service_uuid;  /**< The UUID list of service */
-       int service_count;      /**< The number of services */
-       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_discovery_info_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Structure of advertising parameters
- *
- * @see #bt_class_s
- * @see bt_adapter_le_advertising_state_changed_cb()
- * @see bt_adapter_le_start_advertising()
- */
-typedef struct {
-       float interval_min; /**< Minimum advertising interval for non-directed advertising.
-                             A multiple of 0.625ms is only allowed (Time range : 20ms to 10.24sec). */
-       float interval_max; /**< Maximum advertising interval for non-directed advertising.
-                             A multiple of 0.625ms is only allowed (Time range : 20ms to 10.24sec). */
-       char filter_policy; /* Advertising filter policy */
-       char type; /* Advertising type */
-} bt_adapter_le_advertising_params_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Device information structure used for identifying pear device.
- *
- * @see #bt_class_s
- * @see bt_device_bond_created_cb()
- */
-typedef struct
-{
-       char *remote_address;   /**< The address of remote device */
-       char *remote_name;      /**< The name of remote device */
-       bt_class_s bt_class;    /**< The Bluetooth classes */
-       char **service_uuid;  /**< The UUID list of service */
-       int service_count;      /**< The number of services */
-       bool is_bonded; /**< The bonding state */
-       bool is_connected;      /**< The connection state */
-       bool is_authorized;     /**< The authorization state */
-       int manufacturer_data_len;      /**< manufacturer specific data length */
-       char *manufacturer_data;                /**< manufacturer specific data */
-} bt_device_info_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Service Discovery Protocol (SDP) data structure.
- *
- * @details This protocol is used for discovering available services or pear device,
- * and finding one to connect with.
- *
- * @see bt_device_service_searched_cb()
- */
-typedef struct
-{
-       char *remote_address;   /**< The address of remote device */
-       char **service_uuid;  /**< The UUID list of service */
-       int service_count;    /**< The number of services. */
-} bt_device_sdp_info_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Device connection information structure.
- *
- * @see bt_device_connection_state_changed_cb()
- */
-typedef struct
-{
-       char *remote_address;   /**< The address of remote device */
-       bt_device_connection_link_type_e link;  /**< Link type */
-       bt_device_disconnect_reason_e disconn_reason;  /**< Disconnection reason */
-} bt_device_connection_info_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Device LE connection update structure.
- *
- * @see bt_device_le_conn_update()
- */
-typedef struct
-{
-       unsigned int interval_min;   /**< Minimum value for the connection event interval (msec) */
-       unsigned int interval_max;   /**< Maximum value for the connection event interval (msec) */
-       unsigned int latency;   /**< Slave latency (msec) */
-       unsigned int time_out;   /**< Supervision timeout (msec) */
-} bt_le_conn_update_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- *
- * @brief Rfcomm connection data used for exchanging data between Bluetooth devices.
- *
- * @see bt_socket_connection_state_changed_cb()
- */
-typedef struct
-{
-       int socket_fd;  /**< The file descriptor of connected socket */
-       int server_fd;  /**< The file descriptor of the server socket or -1 for client connection */
-       bt_socket_role_e local_role;    /**< The local device role in this connection */
-       char *remote_address;   /**< The remote device address */
-       char *service_uuid;     /**< The service UUId */
-} bt_socket_connection_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- *
- * @brief Structure of RFCOMM received data.
- *
- * @remarks User can use standard linux functions for reading/writing
- * data from/to sockets.
- *
- * @see bt_socket_data_received_cb()
- */
-typedef struct
-{
-       int socket_fd;  /**< The socket fd */
-       int data_size;  /**< The length of the received data */
-       char *data;     /**< The received data */
-} bt_socket_received_data_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when the Bluetooth adapter state changes.
- * @param[in]   result  The result of the adapter state changing
- * @param[in]   adapter_state  The adapter state to be changed
- * @param[in]   user_data  The user data passed from the callback registration function
- * @see bt_adapter_set_state_changed_cb()
- * @see bt_adapter_unset_state_changed_cb()
- */
-typedef void (*bt_adapter_state_changed_cb)(int result, bt_adapter_state_e adapter_state, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when adapter name changes.
- * @param[in]   device_name    The name of the Bluetooth device to be changed
- * @param[in]   user_data      The user data passed from the callback registration function
- * @pre This function will be invoked when the name of Bluetooth adapter changes
- * if you register this callback using bt_adapter_set_name_changed_cb().
- * @see bt_adapter_set_name()
- * @see bt_adapter_set_name_changed_cb()
- * @see bt_adapter_unset_name_changed_cb()
- */
-typedef void (*bt_adapter_name_changed_cb)(char *device_name, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when the visibility mode changes.
- * @param[in] result The result of the visibility mode changing
- * @param[in] visibility_mode The visibility mode to be changed
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre This function will be invoked when the visibility of Bluetooth adapter changes
- * if you register this callback using bt_adapter_set_visibility_mode_changed_cb().
- *
- * @see bt_adapter_set_visibility_mode_changed_cb()
- * @see bt_adapter_unset_visibility_mode_changed_cb()
- */
-typedef void (*bt_adapter_visibility_mode_changed_cb)
-       (int result, bt_adapter_visibility_mode_e visibility_mode, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called every second until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
- * @remarks  This callback function is called only if visibility mode is #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE.
- * @param[in]  duration  The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds)
- * @param[in]  user_data  The user data passed from the callback registration function
- * @pre  This function will be invoked if you register this callback using bt_adapter_set_visibility_duration_changed_cb().
- * @see  bt_adapter_set_visibility_duration_changed_cb()
- * @see  bt_adapter_unset_visibility_duration_changed_cb()
- */
-typedef void (*bt_adapter_visibility_duration_changed_cb)(int duration, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when the state of device discovery changes.
- *
- * @remarks If \a discovery_state is #BT_ADAPTER_DEVICE_DISCOVERY_FOUND,
- * then you can get some information, such as remote device address, remote device name, rssi, and bonding state.
- *
- * @param[in] result The result of the device discovery
- * @param[in] discovery_state The discovery state to be changed
- * @param[in] discovery_info The information of the discovered device \n
- *                                     If \a discovery_state is #BT_ADAPTER_DEVICE_DISCOVERY_STARTED or
- * #BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, then \a discovery_info is NULL.
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre Either bt_adapter_start_device_discovery() or bt_adapter_stop_device_discovery() will invoke this function
- * if you register this callback using bt_adapter_set_device_discovery_state_changed_cb().
- *
- * @see bt_adapter_start_device_discovery()
- * @see bt_adapter_stop_device_discovery()
- * @see bt_adapter_set_device_discovery_state_changed_cb()
- * @see bt_adapter_unset_device_discovery_state_changed_cb()
- *
- */
-typedef 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, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when you get bonded devices repeatedly.
- *
- * @param[in] device_info The bonded device information
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop,
- * \n @c false to break out of the loop.
- * @pre bt_adapter_foreach_bonded_device() will invoke this function.
- *
- * @see bt_adapter_foreach_bonded_device()
- *
- */
-typedef bool (*bt_adapter_bonded_device_cb)(bt_device_info_s *device_info, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when the connectable state changes.
- * @param[in] result The result of the connectable state changing
- * @param[in] connectable The connectable to be changed
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre This function will be invoked when the connectable state of local Bluetooth adapter changes
- * if you register this callback using bt_adapter_set_connectable_changed_cb().
- *
- * @see bt_adapter_set_connectable()
- * @see bt_adapter_set_connectable_changed_cb()
- * @see bt_adapter_unset_connectable_changed_cb()
- */
-typedef void (*bt_adapter_connectable_changed_cb)
-       (int result, bool connectable, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Called when the state of LE device discovery changes.
- *
- * @remarks If \a discovery_state is #BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND,
- * then you can get some information, such as remote LE device address, remote device name, rssi, and bonding state.
- *
- * @param[in] result The result of the LE device discovery
- * @param[in] discovery_state The discovery state to be changed
- * @param[in] discovery_info The information of the discovered LE device \n
- *                                     If \a discovery_state is #BT_ADAPTER_LE_DEVICE_DISCOVERY_STARTED or
- * #BT_ADAPTER_LE_DEVICE_DISCOVERY_FINISHED, then \a discovery_info is NULL.
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre Either bt_adapter_start_device_discovery() or bt_adapter_stop_device_discovery() will invoke this function
- * if you register this callback using bt_adapter_set_device_discovery_state_changed_cb().
- *
- * @see bt_adapter_le_start_device_discovery()
- * @see bt_adapter_le_stop_device_discovery()
- * @see bt_adapter_le_set_device_discovery_state_changed_cb()
- * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
- *
- */
-typedef void (*bt_adapter_le_device_discovery_state_changed_cb)
-       (int result, bt_adapter_le_device_discovery_state_e discovery_state, bt_adapter_le_device_discovery_info_s *discovery_info, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Called when the state of advertiser changes.
- *
- * @param[out] result The result of the requested state change of advertiser
- * @param[out] advertiser The handle of the state changed advertiser
- * @param[out] adv_state The advertiser state to be changed
- * @param[out] user_data The user data passed from the start function
- *
- * @see bt_adapter_le_start_advertiser()
- * @see bt_adapter_le_stop_advertiser()
- */
-typedef void (*bt_adapter_le_advertising_state_changed_cb)(int result,
-               bt_advertiser_h advertiser, bt_adapter_le_advertising_state_e adv_state, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Called when the Bluetooth adapter le state changes.
- * @param[in]   result  The result of the adapter state changing
- * @param[in]   adapter_le_state  The adapter le state to be changed
- * @param[in]   user_data  The user data passed from the callback registration function
- * @pre Either bt_adapter_le_enable() or bt_adapter_le_disable() will invoke this callback if you register this callback using bt_adapter_le_set_state_changed_cb().
- * @see bt_adapter_le_enable()
- * @see bt_adapter_le_disable()
- * @see bt_adapter_le_set_state_changed_cb()
- * @see bt_adapter_le_unset_state_changed_cb()
- */
-typedef void (*bt_adapter_le_state_changed_cb)(int result, bt_adapter_le_state_e adapter_le_state, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Called when the process of creating bond finishes.
- * @remarks If the remote user does not respond within 60 seconds, a time out will happen with #BT_ERROR_TIMED_OUT result code.\n
- * If bt_device_cancel_bonding() is called and it returns #BT_ERROR_NONE, then this callback function will be called
- * with #BT_ERROR_CANCELLED result. \n
- * If creating a bond succeeds but service search fails, then this callback will be called with #BT_ERROR_SERVICE_SEARCH_FAILED.
- * In this case, you should try service search again by bt_device_start_service_search() to get the supported service list.
- *
- * @param[in] result The result of the bonding device
- * @param[in] device_info The device information which you creates bond with
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre Either bt_device_create_bond() will invoke this function
- * if you register this callback using bt_device_set_bond_created_cb().
- *
- * @see bt_device_create_bond()
- * @see bt_device_cancel_bonding()
- * @see bt_device_set_bond_created_cb()
- * @see bt_device_unset_bond_created_cb()
- */
-typedef void (*bt_device_bond_created_cb)(int result, bt_device_info_s *device_info, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when you get connected profiles repeatedly.
- * @param[in] profile The connected Bluetooth profile
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop,
- * \n @c false to break out of the loop.
- * @pre bt_device_foreach_connected_profiles() will invoke this function.
- * @see bt_device_foreach_connected_profiles()
- */
-typedef bool (*bt_device_connected_profile)(bt_profile_e profile, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when the bond destroys.
- * @param[in] result The result that a bond is destroyed
- * @param[in] remote_address The address of the remote Bluetooth device to destroy bond with
- * @param[in] user_data The user data passed from the callback registration function
- * @pre bt_device_destroy_bond() will invoke this function
- * if you register this callback using bt_device_set_bond_destroyed_cb().
- *
- * @see bt_device_destroy_bond()
- * @see bt_device_set_bond_destroyed_cb()
- * @see bt_device_unset_bond_destroyed_cb()
- */
-typedef void (*bt_device_bond_destroyed_cb)(int result, char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when the authorization of device changes.
- * @param[in] authorization The authorization of device
- * @param[in] remote_address The address of the remote Bluetooth device which is (un)authorized
- * @param[in] user_data The user data passed from the callback registration function
- * @pre bt_device_set_authorization() will invoke this function if you register this callback using bt_device_set_authorization_changed_cb().
- *
- * @see bt_device_set_authorization()
- * @see #bt_device_set_authorization_changed_cb()
- * @see #bt_device_unset_authorization_changed_cb()
- */
-typedef void (*bt_device_authorization_changed_cb)
-       (bt_device_authorization_e authorization, char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when the process of service search finishes.
- * @remark If bt_device_cancel_service_search() is called and it returns #BT_ERROR_NONE,
- * then this callback function will be called with #BT_ERROR_CANCELLED result.
- *
- * @param[in] result The result of the service searching
- * @param[in] sdp_info The structure of service lists found on a device
- * @param[in] user_data The user data passed from the callback registration function
- * @pre Either bt_device_start_service_search() will invoke this function
- * if you register this callback using  bt_device_set_service_searched_cb().
- *
- * @see bt_device_start_service_search()
- * @see bt_device_cancel_service_search()
- * @see bt_device_set_service_searched_cb()
- * @see bt_device_unset_service_searched_cb()
- *
- */
-typedef void (*bt_device_service_searched_cb)(int result, bt_device_sdp_info_s *sdp_info, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when the connection state is changed.
- * @param[in] connected The connection status: (@c true = connected, @c false = disconnected)
- * @param[in] conn_info The connection information
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_device_set_connection_state_changed_cb()
- * @see bt_device_unset_connection_state_changed_cb()
- */
-typedef void (*bt_device_connection_state_changed_cb)(bool connected, bt_device_connection_info_s *conn_info, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief Called when you receive data.
- *
- * @param[in] data The received data from the remote device
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre When the connected remote Bluetooth device invokes bt_socket_send_data(),
- *             this function will be invoked if you register this function using bt_socket_set_data_received_cb().
- *
- * @see bt_socket_set_data_received_cb()
- * @see bt_socket_unset_data_received_cb()
- * @see bt_socket_send_data()
- */
-typedef void (*bt_socket_data_received_cb)(bt_socket_received_data_s *data, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Called when the socket connection state changes.
- * @param[in] result The result of connection state changing
- * @param[in] connection_state The connection state
- * @param[in] connection The connection information which is established or disconnected
- * @param[in] user_data The user data passed from the callback registration function
- * @pre Either bt_socket_connect_rfcomm() will invoke this function.
- * In addtion, bt_socket_connection_state_changed_cb() will be invoked when the socket connection state is changed.
- * @see bt_socket_listen_and_accept_rfcomm()
- * @see bt_socket_connect_rfcomm()
- * @see bt_socket_set_connection_state_changed_cb()
- * @see bt_socket_unset_connection_state_changed_cb()
- */
-typedef void (*bt_socket_connection_state_changed_cb)
-       (int result, bt_socket_connection_state_e connection_state, bt_socket_connection_s *connection, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
- * @brief  Called when a RFCOMM connection is requested.
- * @details You must call bt_socket_accept() if you want to accept. Otherwise, you must call bt_socket_reject().
- * @param[in] socket_fd  The file descriptor of socket on which a connection is requested
- * @param[in] remote_address  The address of remote device
- * @param[in] user_data The user data passed from the callback registration function
- * @pre If you register this callback function by bt_socket_set_connection_requested_cb() and listen a socket by bt_socket_listen(),
- * bt_socket_connection_requested_cb() will be invoked.
- * @see bt_socket_listen()
- * @see bt_socket_accept()
- * @see bt_socket_reject()
- */
-typedef void (*bt_socket_connection_requested_cb) (int socket_fd, const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief  Called when the push is requested.
- * @details You must call bt_opp_server_accept() if you want to accept.
- * Otherwise, you must call bt_opp_server_reject().
- * @param[in] file  The path of file to be pushed
- * @param[in] size The file size (bytes)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_opp_server_initialize()
- */
-typedef void (*bt_opp_server_push_requested_cb)(const char *file, int size, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief  Called when an OPP connection is requested.
- * @details You must call bt_opp_server_accept_connection() if you want to accept.
- * Otherwise, you must call bt_opp_server_reject_connection().
- * @param[in] remote_address  The address of remote device
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_opp_server_initialize()
- * @see bt_opp_server_accept_connection()
- * @see bt_opp_server_reject_connection()
- */
-typedef void (*bt_opp_server_connection_requested_cb)(const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief  Called when a file is being transfered.
- * @param[in] file  The path of file to be pushed
- * @param[in] size The file size (bytes)
- * @param[in] percent The progress in percentage (1 ~ 100)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_opp_server_accept()
- * @see bt_opp_server_accept_connection()
- */
-typedef void (*bt_opp_server_transfer_progress_cb) (const char *file, long long size, int percent, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
- * @brief  Called when a transfer is finished.
- * @param[in] error_code  The result of push
- * @param[in] file  The path of file to be pushed
- * @param[in] size The file size (bytes)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_opp_server_accept()
- * @see bt_opp_server_accept_connection()
- */
-typedef void (*bt_opp_server_transfer_finished_cb) (int result, const char *file, long long size, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief  Called when OPP server responds to the push request.
- * @param[in] result  The result of OPP server response
- * @param[in] remote_address  The remote address
- * @param[in] user_data  The user data passed from the callback registration function
- * @pre bt_opp_client_push_files() will invoke this function.
- * @see bt_opp_client_push_files()
- */
-typedef void (*bt_opp_client_push_responded_cb)(int result, const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief  Called when each file is being transfered.
- * @param[in] file  The path of file to be pushed
- * @param[in] size The file size (bytes)
- * @param[in] percent The progress in percentage (1 ~ 100). 100 means that a file is transfered completely.
- * @param[in] user_data The user data passed from the callback registration function
- * @pre bt_opp_client_push_files() will invoke this function.
- * @see bt_opp_client_push_files()
- */
-typedef void (*bt_opp_client_push_progress_cb)(const char *file, long long size, int percent, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
- * @brief  Called when the push request is finished.
- * @param[in] result  The result of the push request
- * @param[in] remote_address  The remote address
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_opp_client_push_files()
- */
-typedef void (*bt_opp_client_push_finished_cb)(int result, const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
- * @brief  Called when the connection state is changed.
- * @details  This callback is called when the connection state is changed.
- * When you call bt_audio_connect() or bt_audio_disconnect(), this callback is also called with error result even though these functions fail.
- * @param[in] result  The result of changing the connection state
- * @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] type  The type of audio profile except #BT_AUDIO_PROFILE_TYPE_ALL
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_audio_set_connection_state_changed_cb()
- * @see bt_audio_unset_connection_state_changed_cb()
- */
-typedef void (*bt_audio_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_audio_profile_type_e type, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Called when the SCO(Synchronous Connection Oriented link) state is changed.
- * @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.
- * @param[in] event  The call handling event happened from Hands-Free
- * @param[in] call_id  The call ID
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_ag_set_call_handling_event_cb()
- * @see bt_ag_unset_call_handling_event_cb()
- */
-typedef void (*bt_ag_call_handling_event_cb) (bt_ag_call_handling_event_e event, unsigned int call_id, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Called when a multi call handling event happened from Hands-Free.
- * @param[in] event  The call handling event happened from Hands-Free
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_ag_set_multi_call_handling_event_cb()
- * @see bt_ag_unset_multi_call_handling_event_cb()
- */
-typedef void (*bt_ag_multi_call_handling_event_cb) (bt_ag_multi_call_handling_event_e event, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Called when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
- * @param[in] dtmf  The DTMF transmitted from Hands-Free
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_ag_set_dtmf_transmitted_cb()
- * @see bt_ag_unset_dtmf_transmitted_cb()
- */
-typedef void (*bt_ag_dtmf_transmitted_cb) (const char *dtmf, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Called when the speaker gain of the remote device is changed.
- * @param[in] gain The gain of speaker (0 ~ 15)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_ag_set_speaker_gain_changed_cb()
- * @see bt_ag_unset_speaker_gain_changed_cb()
- */
-typedef void (*bt_ag_speaker_gain_changed_cb) (int gain, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Called when the microphone gain of the remote device is changed.
- * @param[in] gain The gain of microphone (0 ~ 15)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_ag_set_microphone_gain_changed_cb()
- * @see bt_ag_unset_microphone_gain_changed_cb()
- */
-typedef void (*bt_ag_microphone_gain_changed_cb) (int gain, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Called when the connection state is changed.
- * @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_target_initialize()
- * @see bt_avrcp_target_deinitialize()
- */
-typedef void (*bt_avrcp_target_connection_state_changed_cb) (bool connected, const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Called when the equalizer state is changed by the remote control device.
- * @param[in] equalizer The equalizer state
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_avrcp_set_equalizer_state_changed_cb()
- * @see bt_avrcp_unset_equalizer_state_changed_cb()
- */
-typedef void (*bt_avrcp_equalizer_state_changed_cb) (bt_avrcp_equalizer_state_e equalizer, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Called when the repeat mode is changed by the remote control device.
- * @param[in] repeat The repeat mode
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_avrcp_set_repeat_mode_changed_cb()
- * @see bt_avrcp_unset_repeat_mode_changed_cb()
- */
-typedef void (*bt_avrcp_repeat_mode_changed_cb) (bt_avrcp_repeat_mode_e repeat, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Called when the shuffle mode is changed by the remote control device.
- * @param[in] shuffle The shuffle mode
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_avrcp_set_shuffle_mode_changed_cb()
- * @see bt_avrcp_unset_shuffle_mode_changed_cb()
- */
-typedef void (*bt_avrcp_shuffle_mode_changed_cb) (bt_avrcp_shuffle_mode_e shuffle, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
- * @brief  Called when the scan mode is changed by the remote control device.
- * @param[in] shuffle The shuffle mode
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_avrcp_set_scan_mode_changed_cb()
- * @see bt_avrcp_unset_scan_mode_changed_cb()
- */
-typedef void (*bt_avrcp_scan_mode_changed_cb) (bt_avrcp_scan_mode_e scan, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief  Called when the connection state is changed.
- * @details  This callback is called when the connection state is changed.
- * When you call bt_hid_host_connect() or bt_hid_host_disconnect(), this callback is also called with error result even though these functions fail.
- * @param[in] result  The result of changing the connection state
- * @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_hid_host_connect()
- * @see bt_hid_host_disconnect()
- */
-typedef void (*bt_hid_host_connection_state_changed_cb) (int result, bool connected, const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Called when the connection is established.
- * @param[in] result  The result of connecting to the remote device
- * @param[in] remote_address  The address of connected remote device
- * @param[in] app_id  The ID of application
- * @param[in] type  The type of HDP(Health Device Profile) channel
- * @param[in] channel  The connected data channel
- * @param[in] user_data The user data passed from the callback registration function
- * @see  bt_hdp_disconnected_cb
- * @see bt_hdp_set_connection_state_changed_cb()
- * @see bt_hdp_unset_connection_state_changed_cb()
- */
-typedef void (*bt_hdp_connected_cb) (int result, const char *remote_address, const char *app_id,
-    bt_hdp_channel_type_e type, unsigned int channel, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Called when the connection is disconnected.
- * @param[in] result  The result of disconnecting from the remote device
- * @param[in] remote_address  The address of disconnected remote device
- * @param[in] channel  The connected data channel
- * @param[in] user_data The user data passed from the callback registration function
- * @see  bt_hdp_connected_cb
- * @see bt_hdp_set_connection_state_changed_cb()
- * @see bt_hdp_unset_connection_state_changed_cb()
- */
-typedef void (*bt_hdp_disconnected_cb) (int result, const char *remote_address, unsigned int channel, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
- * @brief  Called when the you receive the data.
- * @param[in] channel  The connected data channel
- * @param[in] data  The received data
- * @param[in] size  The size of received data (byte)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_hdp_set_data_received_cb()
- * @see bt_hdp_unset_data_received_cb()
- */
-typedef void (*bt_hdp_data_received_cb) (unsigned int channel, const char *data, unsigned int size, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when you get the primary services repeatedly.
- * @param[in]  service  The attribute handle of service
- * @param[in]  index  The index of a service, starts from 0
- * @param[in]  total  The total number of services
- * @param[in]  user_data  The user data passed from the foreach function
- * @return  @c true to continue with the next iteration of the loop,
- * \n @c false to break out of the loop.
- * @pre  bt_gatt_foreach_primary_services() will invoke this function.
- * @see  bt_gatt_foreach_primary_services()
- */
-typedef bool (*bt_gatt_primary_service_cb) (bt_gatt_attribute_h service, int index, int total, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called after the characteristics are discovered by bt_gatt_discover_characteristics().
- * @remarks  If bt_gatt_discover_characteristics() failed, then this callback function is called only once with 0 totla and NULL characteristic_handle.
- * @param[in]  result  The result of discovering
- * @param[in]  index  The index of characteristics in a service, starts from 0
- * @param[in]  total  The total number of characteristics in a service
- * @param[in]  characteristic  The attribute handle of characteristic
- * @param[in]  user_data  The user data passed from the request function
- * @return  @c true to continue with the next iteration of the loop,
- * \n @c false to break out of the loop.
- * @pre  bt_gatt_discover_characteristics() will invoke this callback.
- * @see  bt_gatt_discover_characteristics()
- */
-typedef bool (*bt_gatt_characteristics_discovered_cb) (int result, int index, int total, bt_gatt_attribute_h characteristic, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when you get the included services repeatedly.
- * @param[in]  service  The attribute handle of service
- * @param[in]  user_data  The user data passed from the foreach function
- * @return  @c true to continue with the next iteration of the loop,
- * \n @c false to break out of the loop.
- * @pre  bt_gatt_foreach_included_services() will invoke this function.
- * @see  bt_gatt_foreach_included_services()
- */
-typedef bool (*bt_gatt_included_service_cb) (bt_gatt_attribute_h service, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when a characteristic in service is changed.
- * @param[in]  characteristic  The attribute handle of characteristic
- * @param[in]  value  The value of characteristic (byte array)
- * @param[in]  value_length  The length of value
- * @param[in]  user_data  The user data passed from the callback registration function
- * @see bt_gatt_set_characteristic_changed_cb()
- * @see bt_gatt_unset_characteristic_changed_cb()
- */
-typedef void (*bt_gatt_characteristic_changed_cb) (bt_gatt_attribute_h characteristic, unsigned char *value, int value_length, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when a characteristic value is written.
- * @see bt_gatt_set_characteristic_value()
- */
-typedef void (*bt_gatt_characteristic_write_cb) (int result, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when a characteristic value is read.
- * @param[in]  value  The value of characteristic (byte array)
- * @param[in]  value_length  The length of value
- * @param[in]  user_data  The user data passed from the foreach function
- * @see bt_gatt_read_characteristic_value()
- */
-typedef void (*bt_gatt_characteristic_read_cb) (unsigned char *value,
-                       int value_length, void *user_data);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called after the characteristics descriptors are discovered by bt_gatt_discover_characteristic_descriptor().
- * @param[in]  result  The result of discovering
- * @param[in]  characteristic_format  The format of the information data.
- *                        characteristic_format = 0x01 indicates UUIDs are 16-bits
- *                        characteristic_format = 0x02 indicates UUIDs are 128-bits
- * @param[in]  total  The total number of elements in characteristic_descriptor
- * @param[in]  characteristic descriptor  The attribute handle and the UUID of characteristic descriptor
- * @param[in]  characteristic  The attribute handle and the UUID of characteristic
- * @param[in]  user_data  The user data passed from the request function
- * @see  bt_gatt_discover_characteristic_descriptor()
- */
-typedef void (*bt_gatt_characteristic_descriptor_discovered_cb) (int result,
-               unsigned char characteristic_format, int total,
-               bt_gatt_attribute_h characteristic_descriptor,
-               bt_gatt_attribute_h characteristic, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Called when the connection state is changed.
- * @details This callback is called when the connection state is changed.
- * When you called bt_gatt_connect() or bt_gatt_disconnect(), this callback is also called with error result even though these functions fail.
- *
- * @param[in] result The result of changing the connection state.
- * @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_gatt_connect()
- * @see bt_gatt_disconnect()
- * @see bt_gatt_set_connection_state_changed_cb()
- * @see bt_gatt_unset_connection_state_changed_cb()
- */
-typedef void (*bt_gatt_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Called when the remote devices writes a characteristic to the server db.
- * @details This callback is called when the remote client device writes a characteristics
- *                     to the server attribute database.
- *
- * @param[in] char_path Characteristic path for which the value is writtten.
- * @param[in] char_value The characteristic value
- * @param[in] value_length The length of the characteristic value written.
- * @param[in] remote_address remote client device bd address.
- *
- * @see bt_gatt_connect()
- */
-typedef void (*bt_gatt_remote_characteristic_write_cb) (char *char_path,
-                                       unsigned char* char_value, int value_length,
-                                       const char *remote_address,
-                                       void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
- * @brief  Called when the connection state is changed.
- * @param[in] connected  Indicates whether a client is connected or disconnected
- * @param[in] remote_address  The remote address
- * @param[in] interface_name  The interface name. For example, bnep0, bnep1.
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_nap_set_connection_state_changed_cb()
- * @see bt_nap_unset_connection_state_changed_cb()
- */
-typedef void (*bt_nap_connection_state_changed_cb) (bool connected, const char *remote_address, const char *interface_name, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Called when the connection state is changed.
- * @details  This callback is called when the connection state is changed.
- * When you call bt_panu_connect() or bt_panu_disconnect(), this callback is also called with error result even though these functions fail.
- * @param[in] result  The result of changing the connection state
- * @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] type  The type of PAN service
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_nap_set_connection_state_changed_cb()
- * @see bt_nap_unset_connection_state_changed_cb()
- */
-typedef void (*bt_panu_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_panu_service_type_e type, void *user_data);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // __TIZEN_NETWORK_BLUETOOTH_TYPE_H__
diff --git a/resource/csdk/connectivity/lib/tizen/ble/inc/mobile/bluetooth_product.h b/resource/csdk/connectivity/lib/tizen/ble/inc/mobile/bluetooth_product.h
deleted file mode 100644 (file)
index 74f2b55..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * @file
- *
- *
- */
-
-#ifndef __TIZEN_NETWORK_BLUETOOTH_PRODUCT_H__
-#define __TIZEN_NETWORK_BLUETOOTH_PRODUCT_H__
-
-#include "bluetooth_type.h"
-#include "bluetooth_type_product.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Sets the manufacturer data of local Bluetooth adapter.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in]   data   The manufacturer specific data of the Bluetooth device.
- * @param[in]   len    The length of @a data.Maximaum length is 240 bytes.
- *
- * @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_OPERATION_FAILED Operation failed
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @post bt_adapter_manufacturer_data_changed_cb() will be invoked
- * if this function returns #BT_ERROR_NONE.
- *
- * @see bt_adapter_manufacturer_data_changed_cb
- * @see bt_adapter_set_manufacturer_data_changed_cb()
- * @see bt_adapter_unset_manufacturer_data_changed_cb()
- */
-int bt_adapter_set_manufacturer_data(char *data, int len);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Registers a callback function to be invoked
- * when the manufacturer data of Bluetooth adapter changes.
- * @since_tizen 2.3
- *
- * @param[in]   callback       The callback function to invoke
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @post  bt_adapter_manufacturer_data_changed_cb() will be invoked.
- *
- * @see bt_initialize()
- * @see bt_adapter_unset_manufacturer_data_changed_cb()
- */
-int bt_adapter_set_manufacturer_data_changed_cb(
-               bt_adapter_manufacturer_data_changed_cb callback,
-               void *user_data);
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief      Unregisters the callback function.
- * @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
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_initialize()
- * @see bt_adapter_set_manufacturer_data_changed_cb()
- */
-int bt_adapter_unset_manufacturer_data_changed_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Sets the scan interval and widow, synchronously.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in]  scan_params  The parameters of le scanning \n
- *                             If NULL is passed, default values which are defined in driver / controller are used.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled
- * @retval #BT_ERROR_INVALID_PARAM Parameter is invalid
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- */
-int bt_adapter_le_set_scan_parameter(bt_adapter_le_scan_params_s *scan_params);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Enables RSSI monitoring and sets threshold for LE/ACL link present with the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address The address of the remote Bluetooth device for which RSSI is to be monitored
- * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
- * @param[in] low_threshold Lower threshold value for the LE Link in dBm.
- * @param[in] in_range_threshold In-Range threshold value for the LE Link in dBm.
- * @param[in] cb_enable Callback to be called when RSSI monitoring is enabled.
- * @param[in] user_data_enable Data to be passed to RSSI enable callback.
- * @param[in] cb_alert Callback to receive RSSI Alert values.
- * @param[in] user_data_alert Data to be passed to RSSI Alert callback.
- *
- * @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_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @remarks High Threshold value is set to 127.
- *
- * @see bt_device_unset_rssi_alert_cb()
- * @see bt_device_disable_rssi_monitor()
- */
-int bt_device_enable_rssi_monitor(const char *remote_address,
-               bt_device_connection_link_type_e link_type,
-               int low_threshold, int in_range_threshold,
-               bt_rssi_monitor_enabled_cb cb_enable, void *user_data_enable,
-               bt_rssi_alert_cb cb_alert, void *user_data_alert);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Disables RSSI monitoring for LE/ACL link present with the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address The address of the remote Bluetooth device for which RSSI monitoring is to be disabled
- * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
- * @param[in] cb_disable Callback to be called when RSSI monitoring is disabled.
- * @param[in] user_data_enable Data to be passed to RSSI enable callback.
- *
- * @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_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @remarks Low Threshold, In-range Threshold and High Threshold value are set to 0 to disable RSSI monitoring.
- * @remarks This also calls bt_device_unset_rssi_alert_cb()
- *
- * @see bt_device_unset_rssi_alert_cb()
- * @see bt_device_enable_rssi_monitor()
- */
-int bt_device_disable_rssi_monitor(const char *remote_address,
-               bt_device_connection_link_type_e link_type,
-               bt_rssi_monitor_enabled_cb cb_disable, void *user_data_disable);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Get Raw RSSI for LE link present with the remote device.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address The address of the remote Bluetooth device for which RSSI is to be monitored
- * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
- * @param[in] callback Callback to receive Raw RSSI values.
- * @param[in] user_data Data to be passed to Raw RSSI callback.
- *
- * @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_RESOURCE_BUSY  Device or resource busy
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- *
- * @see bt_device_le_unset_rssi_strength_cb()
- */
-int bt_device_get_rssi_strength(const char *remote_address,
-               bt_device_connection_link_type_e link_type,
-               bt_rssi_strength_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Unset the callback to receive RSSI Alert values.
- * @since_tizen 2.3
- *
- * @return 0 on success, otherwise a negative error value.
- *
- * @see bt_device_le_enable_rssi()
- */
-int bt_device_unset_rssi_alert_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief Notifies the XSAT vendor command to the remote.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] state  The XSAT vendor dependent command string. Ex: "AT+SAT= 00,TY,WA"
- * @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
- * @pre The Bluetooth audio device must be connected with bt_audio_connect().
- * @see bt_audio_connect()
- */
-int bt_ag_notify_vendor_cmd(const char *command);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Registers a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free.
- * @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
- * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
- * @see bt_audio_initialize()
- * @see bt_ag_vendor_cmd_cb()
- * @see bt_ag_unset_vendor_cmd_cb()
- */
-int bt_ag_set_vendor_cmd_cb(bt_ag_vendor_cmd_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Unregisters a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free
- * @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
- * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
- * @see bt_audio_initialize()
- * @see bt_ag_vendor_cmd_cb()
- * @see bt_ag_set_vendor_cmd_cb()
- */
-int bt_ag_unset_vendor_cmd_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief Checks whether the remoted device is wbs (Wide Band Speech) mode or not.
- * @since_tizen 2.3
- * @param[out] wbs_mode The wbs status: (@c true = wide band speech, @c  false = narrow band speech)
- * @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
- * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
- * @see bt_audio_connect()
- */
-int bt_ag_is_wbs_mode(bool *wbs_mode);
-
-/**
- * @ingroup  CAPI_NETWORK_BLUETOOTH_AUDIO_A2DP_MODULE
- * @brief  Sets copy protection. streaming application that needs to have the copy protection for the streaming data, shall invoke this API.
- * @since_tizen 2.3
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- * @param[in] status - TRUE/FALSE
- * @return  0 on success, otherwise negative error value.
- * @retval  #BT_ERROR_NONE  Successful
- * @retval  #BT_ERROR_OPERATION_FAILED  on failure
- */
-int bt_a2dp_set_content_protection(bool status);
-
-
-/**
- * @}
- */
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // __TIZEN_NETWORK_BLUETOOTH_PRODUCT_H__
diff --git a/resource/csdk/connectivity/lib/tizen/ble/inc/mobile/bluetooth_type_product.h b/resource/csdk/connectivity/lib/tizen/ble/inc/mobile/bluetooth_type_product.h
deleted file mode 100644 (file)
index 999b847..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * @file
- *
- *
- */
-
-#ifndef __TIZEN_NETWORK_BLUETOOTH_TYPE_PRODUCT_H__
-#define __TIZEN_NETWORK_BLUETOOTH_TYPE_PRODUCT_H__
-
- #ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief  Enumerations of the Bluetooth adapter le scan type.
- */
-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 Structure of le scan parameters
- *
- * @see bt_adapter_le_set_scan_parameter()
- * @see bt_adapter_le_start_device_discovery()
- */
-typedef struct {
-       bt_adapter_le_scan_type_e type;  /**< LE scan type */
-       float interval;  /**< LE scan interval */
-       float window;  /**< LE scan window */
-} bt_adapter_le_scan_params_s;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief  Called when the manufacturer dat changes.
- * @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_DEVICE_MODULE
- * @brief  Called when RSSI monitoring is enabled.
- * @param[in] remote_address Remote Device address
- * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
- * @param[in] rssi_enabled RSSI monitoring status (@c 1 = enabled, @c 0 = disabled)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_device_enable_rssi_monitor()
- * @see bt_device_disable_rssi_monitor()
- */
-typedef void (*bt_rssi_monitor_enabled_cb)(const char *remote_address,
-               bt_device_connection_link_type_e link_type,
-               int rssi_enabled, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when RSSI Alert is received.
- * @param[in] remote_address Remote Device address
- * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
- * @param[in] rssi_alert_type RSSI Alert type (@c 1 = High Alert (In-Range Alert), @c 2 = Low Alert)
- * @param[in] rssi_alert_dbm RSSI Alert signal strength value
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_device_enable_rssi_monitor()
- * @see bt_device_disable_rssi_monitor()
- */
-typedef void (*bt_rssi_alert_cb)(char *bt_address,
-               bt_device_connection_link_type_e link_type,
-               int rssi_alert_type, int rssi_alert_dbm, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief  Called when Raw RSSI signal strength is received.
- * @param[in] remote_address Remote Device address
- * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
- * @param[in] rssi_dbm Raw RSSI signal strength value
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_device_get_rssi_strength()
- */
-typedef void (*bt_rssi_strength_cb)(char *bt_address,
-               bt_device_connection_link_type_e link_type,
-               int rssi_dbm, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  Called when a XSAT vendor command is transmitted from Hands-Free.
- * @param[in] command  The XSAT vendor command transmitted from Hands-Free
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_ag_set_vendor_cmd_cb()
- * @see bt_ag_unset_vendor_cmd_cb()
- */
-typedef void (*bt_ag_vendor_cmd_cb) (char *command, void *user_data);
-
-
-/**
- * @}
- */
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif // __TIZEN_NETWORK_BLUETOOTH_TYPE_PRODUCT_H__
index 1b9f836..d4bad5e 100644 (file)
@@ -72,7 +72,7 @@ void CALESetNetStateCallback(CALEDeviceStateChangedCallback callback)
     gCALEDeviceStateChangedCallback = callback;
 }
 
-CAResult_t CAInitializeLEAdapter()
+CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool)
 {
     OIC_LOG(DEBUG, TAG, "IN");
 
index 8c3c530..6f1732c 100644 (file)
@@ -63,7 +63,7 @@ void CATerminateLENetworkMonitor()
     OIC_LOG(DEBUG, TAG, "OUT");
 }
 
-CAResult_t CAInitializeLEAdapter()
+CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool)
 {
     OIC_LOG(DEBUG, TAG, "IN");
     OIC_LOG(DEBUG, TAG, "OUT");
index 3dbc615..20f0f60 100644 (file)
@@ -62,27 +62,6 @@ typedef enum
 } CABLEAdapter_t;
 
 /**
- * Stores the information of the Data to be sent from the queues.
- *
- * This structure will be pushed to the sender/receiver queue for
- * processing.
- */
-typedef struct
-{
-    /// Remote endpoint contains the information of remote device.
-    CAEndpoint_t *remoteEndpoint;
-
-    /// Data to be transmitted over LE transport.
-    uint8_t *data;
-
-    /// Length of the data being transmitted.
-    uint32_t dataLen;
-
-    /// Sender information list
-    u_arraylist_t * senderInfo;
-} CALEData_t;
-
-/**
  * Callback to provide the status of the network change to CA layer.
  */
 static CANetworkChangeCallback g_networkCallback = NULL;
@@ -810,8 +789,8 @@ static void CALEDataReceiverHandler(void *threadData)
             memcpy(senderInfo->defragData + senderInfo->recvDataLen, bleData->data,
                    bleData->dataLen);
             senderInfo->recvDataLen += bleData->dataLen ;
-            OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "totalDatalength  [%d] received Data lenhth [%d]",
-                      senderInfo->totalDataLen, senderInfo->recvDataLen);
+            OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "totalDatalength  [%d] received Datalen [%d]",
+                                                senderInfo->totalDataLen, senderInfo->recvDataLen);
         }
 
         if (senderInfo->totalDataLen == senderInfo->recvDataLen)
@@ -1736,8 +1715,7 @@ CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
         OIC_LOG(ERROR, CALEADAPTER_TAG, "CAInitializeLENetworkMonitor() failed");
         return CA_STATUS_FAILED;
     }
-
-    CAInitializeLEAdapter();
+    CAInitializeLEAdapter(handle);
 
     CASetLEClientThreadPoolHandle(handle);
 
index c2c59ff..3073ff5 100644 (file)
@@ -772,7 +772,7 @@ static bool CALEWaitForNonEmptyList(GList * const * list,
 
 // -----------------------------------------------------------------------
 
-CAResult_t CAInitializeLEAdapter()
+CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool)
 {
 #if !GLIB_CHECK_VERSION(2,36,0)
     /*
index 6ca670e..4a2cb7a 100644 (file)
@@ -6,15 +6,13 @@ Import('env', 'src_dir')
 import os.path
 
 root_dir = os.pardir
-env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'tizen'),
-                              os.path.join(root_dir, 'lib/tizen/ble/inc'),
-                              os.path.join(root_dir, 'lib/tizen/ble/inc/mobile')])
+env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'tizen')])
 
 env.ParseConfig("pkg-config --cflags --libs capi-network-bluetooth")
 
-src_files = [ 'cableclient.c',
-              'cableserver.c',
-              'cableutil.c',
-              'cablenwmonitor.c']
+src_files = [ 'caleclient.c',
+              'caleserver.c',
+              'caleutil.c',
+              'calenwmonitor.c']
 
 Return('src_files')
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableclient.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableclient.c
deleted file mode 100644 (file)
index 38068b0..0000000
+++ /dev/null
@@ -1,1474 +0,0 @@
-/* ****************************************************************
-*
-* Copyright 2014 Samsung Electronics 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.
-*
-******************************************************************/
-
-#include "cableclient.h"
-
-#include<stdio.h>
-#include<stdlib.h>
-#include<string.h>
-#include<arpa/inet.h>
-#include<sys/types.h>
-#include<sys/socket.h>
-#include<netinet/in.h>
-#include <pthread.h>
-#include <gio/gio.h>
-
-#include "camutex.h"
-#include "uarraylist.h"
-#include "caqueueingthread.h"
-#include "caadapterutils.h"
-#include "cafragmentation.h"
-#include "cagattservice.h"
-#include "oic_string.h"
-#include "oic_malloc.h"
-
-/**
- * Logging tag for module name.
- */
-#define TZ_BLE_CLIENT_TAG "TZ_BLE_GATT_CLIENT"
-
-/**
- * This contains the list of OIC services a client connect to.
- */
-static BLEServiceList *g_bLEServiceList = NULL;
-
-/**
- * Boolean variable to keep the state of the GATT Client.
- */
-static bool g_isBleGattClientStarted = false;
-
-/**
- * Mutex to synchronize access to BleServiceList.
- */
-static ca_mutex g_bleServiceListMutex = NULL;
-
-/**
- * Mutex to synchronize access to the requestResponse callback to be called
- *    when the data needs to be sent from GATTClient.
- */
-static ca_mutex g_bleReqRespClientCbMutex = NULL;
-
-/**
- * Mutex to synchronize access to the requestResponse callback to be called
- *    when the data needs to be sent from GATTClient.
- */
-static ca_mutex g_bleClientConnectMutex = NULL;
-
-
-/**
- * Mutex to synchronize the calls to be done to the platform from GATTClient
- *    interfaces from different threads.
- */
-static ca_mutex g_bleClientStateMutex = NULL;
-
-/**
- * Mutex to synchronize the Server BD Address update on client side.
- */
-static ca_mutex g_bleServerBDAddressMutex = NULL;
-
-/**
- * Condition used for notifying handler the presence of data in send queue.
- */
-static ca_cond g_bleClientSendCondWait = NULL;
-
-/**
- * Mutex to synchronize the task to be pushed to thread pool.
- */
-static ca_mutex g_bleClientThreadPoolMutex = NULL;
-
-/**
- * Maintains the callback to be notified on receival of network packets
- *    from other BLE devices
- */
-static CABLEDataReceivedCallback g_bleClientDataReceivedCallback = NULL;
-
-/**
- * callback to update the error to le adapter
- */
-static CABLEErrorHandleCallback g_clientErrorCallback;
-
-/**
- * gmainLoop to manage the threads to receive the callback from the platfrom.
- */
-static GMainLoop *g_eventLoop = NULL;
-
-/**
- * reference to threadpool.
- */
-static ca_thread_pool_t g_bleClientThreadPool = NULL;
-
-/**
- * structure to map the service attribute to BD Address.
- */
-typedef struct gattService
-{
-    bt_gatt_attribute_h serviceInfo;         /**< bluetoth attribute for oic service*/
-    char *address;                           /**< BD Address of */
-} stGattServiceInfo_t;
-
-/**
- * Remote address of Gatt Server.
- */
-static char *g_remoteAddress = NULL;
-
-void CABleGattCharacteristicChangedCb(bt_gatt_attribute_h characteristic,
-                                      unsigned char *value,
-                                      int valueLen,
-                                      void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Changed characteristic is  [%s]", (char *)characteristic);
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Changed characteristic value length [%d]", valueLen);
-
-    ca_mutex_lock(g_bleReqRespClientCbMutex);
-    if (NULL == g_bleClientDataReceivedCallback)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "gReqRespCallback is NULL!");
-        ca_mutex_unlock(g_bleReqRespClientCbMutex);
-        return;
-    }
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Sending data up !");
-
-    ca_mutex_lock(g_bleServerBDAddressMutex);
-    uint32_t sentLength = 0;
-    g_bleClientDataReceivedCallback(g_remoteAddress, value, valueLen,
-                                    &sentLength);
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Sent data Length is %d", sentLength);
-    ca_mutex_unlock(g_bleServerBDAddressMutex);
-
-    ca_mutex_unlock(g_bleReqRespClientCbMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-void CABleGattCharacteristicWriteCb(int result, void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN ");
-
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT ");
-}
-
-void CABleGattDescriptorDiscoveredCb(int result, unsigned char format, int total,
-                                     bt_gatt_attribute_h descriptor,
-                                     bt_gatt_attribute_h characteristic, void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    stGattCharDescriptor_t *stTemp = (stGattCharDescriptor_t *)OICCalloc(1, sizeof(
-                                                                         stGattCharDescriptor_t));
-
-    VERIFY_NON_NULL_VOID(stTemp, TZ_BLE_CLIENT_TAG, "malloc failed!");
-
-    stTemp->desc = (uint8_t *)OICMalloc(total);
-    if (NULL == stTemp->desc)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "malloc failed");
-        OICFree(stTemp);
-        return;
-    }
-    memcpy(stTemp->desc, descriptor, total);
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "result[%d] format[%d] total[%d]", result, format, total);
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "characteristic [%s]", (const char *) characteristic);
-
-
-    bt_gatt_clone_attribute_handle(&(stTemp->characteristic), characteristic);
-    stTemp->total = total;
-
-    ca_mutex_lock(g_bleClientThreadPoolMutex);
-    if (NULL == g_bleClientThreadPool)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
-        bt_gatt_destroy_attribute_handle(stTemp->characteristic);
-        OICFree(stTemp->desc);
-        OICFree(stTemp);
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-        return;
-    }
-
-    CAResult_t ret = ca_thread_pool_add_task(g_bleClientThreadPool,
-                                            CASetCharacteristicDescriptorValueThread,
-                                            stTemp);
-    if (CA_STATUS_OK != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_thread_pool_add_task failed");
-        bt_gatt_destroy_attribute_handle(stTemp->characteristic);
-        OICFree(stTemp->desc);
-        OICFree(stTemp);
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-        return;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG,
-            "LE Client initialization flow complete");
-
-    ca_mutex_unlock(g_bleClientThreadPoolMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-bool CABleGattCharacteristicsDiscoveredCb(int result,
-        int inputIndex, int total,
-        bt_gatt_attribute_h characteristic, void *userData)
-{
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(characteristic, TZ_BLE_CLIENT_TAG, "Param characteristic is NULL", false);
-
-    VERIFY_NON_NULL_RET(userData, TZ_BLE_CLIENT_TAG, "Param userData is NULL", false);
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
-              "result [%d] input_index [%d] total [%d]",
-              result, inputIndex, total);
-
-    BLEServiceInfo *bleServiceInfo = NULL;
-
-    ca_mutex_lock(g_bleServiceListMutex);
-
-    char *bdAddress = (char *) userData;
-    CAGetBLEServiceInfo(g_bLEServiceList, bdAddress, &bleServiceInfo);
-
-    ca_mutex_unlock(g_bleServiceListMutex);
-
-    char *uuid = NULL;
-    bt_gatt_get_service_uuid(characteristic, &uuid);
-
-    VERIFY_NON_NULL_RET(uuid, TZ_BLE_CLIENT_TAG, "uuid is NULL", false);
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "New Characteristics[%s] of uuid[%s] is obtained",
-              (char *)characteristic, uuid);
-
-    if(0 == strcasecmp(uuid, CA_GATT_RESPONSE_CHRC_UUID)) // Server will read on this characterisctics
-    {
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG , "Read characteristics is obtained");
-        OICFree(uuid);
-        CAResult_t retVal = CAAppendBLECharInfo(characteristic, BLE_GATT_READ_CHAR, bleServiceInfo);
-        if (CA_STATUS_OK != retVal)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CAAppendBLECharInfo failed! ");
-            return false;
-        }
-
-        stGattServiceInfo_t *stTemp = (stGattServiceInfo_t *)OICCalloc(1,
-                                                                      sizeof(stGattServiceInfo_t));
-
-        VERIFY_NON_NULL_RET(stTemp, TZ_BLE_CLIENT_TAG, "calloc failed!", false);
-
-        stTemp->address = OICStrdup(bdAddress);
-        if (NULL == stTemp->address)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "Malloc failed!");
-            OICFree(stTemp);
-            return false;
-        }
-
-        bt_gatt_clone_attribute_handle(&(stTemp->serviceInfo), characteristic);
-
-        ca_mutex_lock(g_bleClientThreadPoolMutex);
-        if (NULL == g_bleClientThreadPool)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
-            bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            ca_mutex_unlock(g_bleClientThreadPoolMutex);
-            return false;
-        }
-
-        retVal = ca_thread_pool_add_task(g_bleClientThreadPool,
-                                        CADiscoverDescriptorThread,
-                                        stTemp);
-        if (CA_STATUS_OK != retVal)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                      "ca_thread_pool_add_task failed with ret [%d]", retVal);
-            bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            ca_mutex_unlock(g_bleClientThreadPoolMutex);
-            return false;
-        }
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-    }
-    else if (0 == strcasecmp(uuid, CA_GATT_REQUEST_CHRC_UUID)) // Server will write on this characteristics.
-    {
-        OICFree(uuid);
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG , "Write characteristics is obtained");
-        CAResult_t retVal = CAAppendBLECharInfo(characteristic, BLE_GATT_WRITE_CHAR, bleServiceInfo);
-        if (CA_STATUS_OK != retVal)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CAAppendBLECharInfo failed ");
-            return false;
-        }
-    }
-    else
-    {
-        OICFree(uuid);
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "service_uuid characteristics is UNKNOWN");
-        return false;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return true;
-}
-
-bool CABleGattPrimaryServiceCb(bt_gatt_attribute_h service, int index, int count,
-                               void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(service, TZ_BLE_CLIENT_TAG, "Param service is NULL", false);
-
-    VERIFY_NON_NULL_RET(userData, TZ_BLE_CLIENT_TAG, "Param userData is NULL", false);
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Service info [%s] index [%d] count [%d]", (char *)service,
-              index, count);
-
-    CAResult_t result = CAVerifyOICServiceByServiceHandle(service);
-
-    if (CA_STATUS_OK == result)
-    {
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Its OIC service");
-
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG , "Registering to watch characteristics changes");
-
-        result = CABleGattWatchCharacteristicChanges(service);
-        if (CA_STATUS_OK != result)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG,
-                      "CABleGattWatchCharacteristicChanges failed!");
-            return false;
-        }
-
-        stGattServiceInfo_t *stTemp = (stGattServiceInfo_t *)OICCalloc(1,
-                                                                      sizeof(stGattServiceInfo_t));
-        VERIFY_NON_NULL_RET(stTemp, TZ_BLE_CLIENT_TAG, "Calloc Failed", false);
-
-        char *bdAddress = (char *)userData;
-
-        stTemp->address = OICStrdup(bdAddress);
-        if (NULL == stTemp->address)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "Malloc failed!");
-            OICFree(stTemp);
-            return false;
-        }
-
-        BLEServiceInfo *bleServiceInfo = NULL;
-
-        result = CACreateBLEServiceInfo(bdAddress, service, &bleServiceInfo);
-        if (CA_STATUS_OK != result)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CACreateBLEServiceInfo failed! ");
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            OICFree(bleServiceInfo);
-            return false;
-        }
-        if (NULL == bleServiceInfo )
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , " bleServiceInfo is NULL");
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            OICFree(bleServiceInfo);
-            return false;
-        }
-
-        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG ,
-                  " serviceInfo remote address [%s]", bleServiceInfo->bdAddress);
-
-        ca_mutex_lock(g_bleServiceListMutex);
-        result = CAAddBLEServiceInfoToList(&g_bLEServiceList, bleServiceInfo);
-        ca_mutex_unlock(g_bleServiceListMutex);
-        if (CA_STATUS_OK != result)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CAAddBLEServiceInfoToList failed!");
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            CAFreeBLEServiceInfo(bleServiceInfo);
-            return false;
-        }
-
-
-        ca_mutex_lock(g_bleClientThreadPoolMutex);
-        if (NULL == g_bleClientThreadPool)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            ca_mutex_lock(g_bleServiceListMutex);
-            CARemoveBLEServiceInfoToList(&g_bLEServiceList, bleServiceInfo,
-                                         bleServiceInfo->bdAddress);
-            ca_mutex_unlock(g_bleServiceListMutex);
-            ca_mutex_unlock(g_bleClientThreadPoolMutex);
-            return false;
-        }
-        bt_gatt_clone_attribute_handle(&(stTemp->serviceInfo), service);
-
-        result = ca_thread_pool_add_task(g_bleClientThreadPool,
-                                        CADiscoverCharThread,
-                                        stTemp);
-        if (CA_STATUS_OK != result)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                      "ca_thread_pool_add_task failed with ret [%d]", result);
-            OICFree(stTemp->address);
-            OICFree(stTemp);
-            ca_mutex_lock(g_bleServiceListMutex);
-            CARemoveBLEServiceInfoToList(&g_bLEServiceList, bleServiceInfo,
-                                         bleServiceInfo->bdAddress);
-            ca_mutex_unlock(g_bleServiceListMutex);
-            ca_mutex_unlock(g_bleClientThreadPoolMutex);
-            return false;
-        }
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT ");
-    return true;;
-}
-
-void CABleGattConnectionStateChangedCb(int result, bool connected,
-                                       const char *remoteAddress, void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN ");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "CABleGattConnectionStateChangedCb result[%d] ", result);
-
-    VERIFY_NON_NULL_VOID(remoteAddress, TZ_BLE_CLIENT_TAG, "remote address is NULL");
-
-    CAResult_t ret = CA_STATUS_FAILED;
-    if (!connected)
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "DisConnected from [%s] ", remoteAddress);
-
-        ret = CABleGattStartDeviceDiscovery();
-        if (CA_STATUS_OK != ret)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleGattStartDeviceDiscovery failed");
-            return;
-        }
-    }
-    else
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Connected to [%s] ", remoteAddress);
-
-        ca_mutex_lock(g_bleServerBDAddressMutex);
-
-        g_remoteAddress = OICStrdup(remoteAddress);
-
-        ca_mutex_unlock(g_bleServerBDAddressMutex);
-
-        VERIFY_NON_NULL_VOID(g_remoteAddress, TZ_BLE_CLIENT_TAG, "Malloc failed");
-
-        char *addr = OICStrdup(remoteAddress);
-
-        ca_mutex_lock(g_bleClientThreadPoolMutex);
-        if (NULL == g_bleClientThreadPool)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
-            OICFree(addr);
-
-            ca_mutex_lock(g_bleServerBDAddressMutex);
-            OICFree(g_remoteAddress);
-            ca_mutex_unlock(g_bleServerBDAddressMutex);
-
-            ca_mutex_unlock(g_bleClientThreadPoolMutex);
-            return;
-        }
-
-        ret = ca_thread_pool_add_task(g_bleClientThreadPool, CADiscoverBLEServicesThread,
-                                     addr);
-        if (CA_STATUS_OK != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "ca_thread_pool_add_task failed with ret [%d]", ret);
-            OICFree(addr);
-
-            ca_mutex_lock(g_bleServerBDAddressMutex);
-            OICFree(g_remoteAddress);
-            ca_mutex_unlock(g_bleServerBDAddressMutex);
-
-            ca_mutex_unlock(g_bleClientThreadPoolMutex);
-            return;
-        }
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-void CABtAdapterLeDeviceDiscoveryStateChangedCb(int result,
-        bt_adapter_le_device_discovery_state_e discoveryState,
-        bt_adapter_le_device_discovery_info_s *discoveryInfo,
-        void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    if (NULL  == discoveryInfo && BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND == discoveryState)
-    {
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "discoveryInfo is NULL");
-        return;
-    }
-
-    if (BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND != discoveryState)
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
-                  " LE Discovery state is [%s]",
-          discoveryState == BT_ADAPTER_LE_DEVICE_DISCOVERY_STARTED ? "Started" : "Finished");
-    }
-    else
-    {
-        CAPrintDiscoveryInformation(discoveryInfo);
-
-        if (discoveryInfo->service_uuid == NULL)
-        {
-            OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "NO UUIDS from device");
-        }
-        else
-        {
-            for (int32_t i = discoveryInfo->service_count - 1; i >= 0; i--)
-            {
-                OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "uuid[%d]: [%s]",
-                          i, discoveryInfo->service_uuid[i]);
-                CAResult_t res = CAVerifyOICServiceByUUID(discoveryInfo->service_uuid[i]);
-                if (CA_STATUS_OK == res)
-                {
-                    char *addr = OICStrdup(discoveryInfo->remote_address);
-                    VERIFY_NON_NULL_VOID(addr, TZ_BLE_CLIENT_TAG, "Malloc failed");
-
-                    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
-                              "Trying to do Gatt connection to [%s]", addr);
-
-                    ca_mutex_lock(g_bleClientThreadPoolMutex);
-                    if (NULL == g_bleClientThreadPool)
-                    {
-                        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
-                        OICFree(addr);
-                        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-                        return;
-                    }
-
-                    CAResult_t ret = ca_thread_pool_add_task(g_bleClientThreadPool,
-                                                  CAGattConnectThread, addr);
-                    if (CA_STATUS_OK != ret)
-                    {
-                        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                                  "ca_thread_pool_add_task failed with ret [%d]", ret);
-                        OICFree(addr);
-                        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-                        return;
-                    }
-                    ca_mutex_unlock(g_bleClientThreadPoolMutex);
-                    if (discoveryInfo->adv_data_len > 31 || discoveryInfo->scan_data_len > 31)
-                    {
-                        bt_adapter_le_stop_device_discovery();
-                        return;
-                    }
-                    break;  // Found the OIC Service. No need to verify remaining services.
-                }
-            }
-        }
-    }
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-
-void CAPrintDiscoveryInformation(const bt_adapter_le_device_discovery_info_s *discoveryInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    if (NULL == discoveryInfo)
-    {
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "discoveryInfo is NULL ");
-        return;
-    }
-
-    if (discoveryInfo->remote_address)
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Remote Address [%s]", discoveryInfo->remote_address);
-    }
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
-              " Adv data len [%d] Scan data len[%d]RSSI [%d] Addr_type [%d] ",
-              discoveryInfo->adv_data_len, discoveryInfo->scan_data_len, discoveryInfo->rssi,
-              discoveryInfo->address_type);
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
-              " Number of services present in device [%s] is [%d]",
-              discoveryInfo->remote_address, discoveryInfo->service_count);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-void CASetLEClientThreadPoolHandle(ca_thread_pool_t handle)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    ca_mutex_lock(g_bleClientThreadPoolMutex);
-    g_bleClientThreadPool = handle;
-    ca_mutex_unlock(g_bleClientThreadPoolMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-void CASetLEReqRespClientCallback(CABLEDataReceivedCallback callback)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    ca_mutex_lock(g_bleReqRespClientCbMutex);
-
-    g_bleClientDataReceivedCallback = callback;
-
-    ca_mutex_unlock(g_bleReqRespClientCbMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-
-void CASetBLEClientErrorHandleCallback(CABLEErrorHandleCallback callback)
-{
-    g_clientErrorCallback = callback;
-}
-
-CAResult_t CAStartLEGattClient()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    ca_mutex_lock(g_bleClientThreadPoolMutex);
-    if (NULL == g_bleClientThreadPool)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "gBleServerThreadPool is NULL");
-        CATerminateGattClientMutexVariables();
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    retVal = ca_thread_pool_add_task(g_bleClientThreadPool, CAStartBleGattClientThread,
-                                     NULL);
-    if (CA_STATUS_OK != retVal)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_thread_pool_add_task failed");
-        CATerminateGattClientMutexVariables();
-        ca_mutex_unlock(g_bleClientThreadPoolMutex);
-        return CA_STATUS_FAILED;
-    }
-    ca_mutex_unlock(g_bleClientThreadPoolMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CAStartBleGattClientThread(void *data)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    ca_mutex_lock(g_bleClientStateMutex);
-
-    if (true  == g_isBleGattClientStarted)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "Gatt Client is already running!!");
-        ca_mutex_unlock(g_bleClientStateMutex);
-        return;
-    }
-
-    CAResult_t  ret = CABleGattSetScanParameter();
-    if (CA_STATUS_OK != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleSetScanParameter Failed");
-        ca_mutex_unlock(g_bleClientStateMutex);
-        CATerminateLEGattClient();
-        return;
-    }
-
-    ret = CABleGattSetCallbacks();
-    if (CA_STATUS_OK != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleGattSetCallbacks Failed");
-        ca_mutex_unlock(g_bleClientStateMutex);
-        CATerminateLEGattClient();
-        return;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Starting LE device discovery");
-
-    ret = CABleGattStartDeviceDiscovery();
-    if (CA_STATUS_OK != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_start_device_discovery Failed");
-        ca_mutex_unlock(g_bleClientStateMutex);
-        CATerminateLEGattClient();
-        return;
-    }
-
-    g_isBleGattClientStarted = true;
-
-    ca_mutex_unlock(g_bleClientStateMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Giveing the control to threadPool");
-
-    GMainContext *thread_context = g_main_context_new();
-
-    g_eventLoop = g_main_loop_new(thread_context, FALSE);
-
-    g_main_context_push_thread_default(thread_context);
-
-    g_main_loop_run(g_eventLoop);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-void CAStopLEGattClient()
-{
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "IN");
-
-    ca_mutex_lock(g_bleClientStateMutex);
-
-    if (false == g_isBleGattClientStarted)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "Gatt Client is not running to stop");
-        ca_mutex_unlock(g_bleClientStateMutex);
-        return;
-    }
-
-    CABleGattUnSetCallbacks();
-
-    CABleGattUnWatchCharacteristicChanges();
-
-    CABleGattStopDeviceDiscovery();
-
-    g_isBleGattClientStarted = false;
-
-    GMainContext  *context_event_loop = NULL;
-    // Required for waking up the thread which is running in gmain loop
-    if (NULL != g_eventLoop)
-    {
-        context_event_loop = g_main_loop_get_context(g_eventLoop);
-    }
-    if (context_event_loop)
-    {
-        OIC_LOG_V(DEBUG,  TZ_BLE_CLIENT_TAG, "g_eventLoop context %x", context_event_loop);
-        g_main_context_wakeup(context_event_loop);
-
-        // Kill g main loops and kill threads.
-        g_main_loop_quit(g_eventLoop);
-    }
-    else
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_eventLoop context is NULL");
-    }
-
-    ca_mutex_unlock(g_bleClientStateMutex);
-
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CAInitializeLEGattClient()
-{
-    OIC_LOG(DEBUG, TAG, "Initialize GATT Client");
-
-    CAResult_t res = CAInitGattClientMutexVariables();
-    if (CA_STATUS_OK != res)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CAInitGattClientMutexVariables failed!");
-        CATerminateGattClientMutexVariables();
-        return CA_STATUS_FAILED;
-    }
-
-    return res;
-}
-
-void CATerminateLEGattClient()
-{
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "IN");
-    ca_mutex_lock(g_bleClientStateMutex);
-
-    ca_mutex_lock(g_bleServerBDAddressMutex);
-
-    OICFree(g_remoteAddress);
-
-    ca_mutex_unlock(g_bleServerBDAddressMutex);
-
-    ca_mutex_lock(g_bleServiceListMutex);
-    CAFreeBLEServiceList(g_bLEServiceList);
-    g_bLEServiceList = NULL;
-    ca_mutex_unlock(g_bleServiceListMutex);
-
-    CAResetRegisteredServiceCount();
-
-    ca_mutex_unlock(g_bleClientStateMutex);
-
-    CATerminateGattClientMutexVariables();
-
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CAInitGattClientMutexVariables()
-{
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "IN");
-    if (NULL == g_bleClientStateMutex)
-    {
-        g_bleClientStateMutex = ca_mutex_new();
-        if (NULL == g_bleClientStateMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleServiceListMutex)
-    {
-        g_bleServiceListMutex = ca_mutex_new();
-        if (NULL == g_bleServiceListMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleReqRespClientCbMutex)
-    {
-        g_bleReqRespClientCbMutex = ca_mutex_new();
-        if (NULL == g_bleReqRespClientCbMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleClientThreadPoolMutex)
-    {
-        g_bleClientThreadPoolMutex = ca_mutex_new();
-        if (NULL == g_bleClientThreadPoolMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleClientConnectMutex)
-    {
-        g_bleClientConnectMutex = ca_mutex_new();
-        if (NULL == g_bleClientConnectMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleClientSendCondWait)
-    {
-        g_bleClientSendCondWait = ca_cond_new();
-        if (NULL == g_bleClientSendCondWait)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_cond_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleServerBDAddressMutex)
-    {
-        g_bleServerBDAddressMutex = ca_mutex_new();
-        if (NULL == g_bleServerBDAddressMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CATerminateGattClientMutexVariables()
-{
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "IN");
-
-    ca_mutex_free(g_bleClientStateMutex);
-    g_bleClientStateMutex = NULL;
-
-    ca_mutex_free(g_bleServiceListMutex);
-    g_bleServiceListMutex = NULL;
-
-    ca_mutex_free(g_bleReqRespClientCbMutex);
-    g_bleReqRespClientCbMutex = NULL;
-
-    ca_mutex_free(g_bleClientConnectMutex);
-    g_bleClientConnectMutex = NULL;
-
-    ca_mutex_free(g_bleClientThreadPoolMutex);
-    g_bleClientThreadPoolMutex = NULL;
-
-    ca_mutex_free(g_bleServerBDAddressMutex);
-    g_bleServerBDAddressMutex = NULL;
-
-    ca_cond_free(g_bleClientSendCondWait);
-    g_bleClientSendCondWait = NULL;
-
-
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CABleGattSetScanParameter()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    bt_adapter_le_scan_params_s scan_param = { 0, };
-    scan_param.type = BT_ADAPTER_LE_PASSIVE_SCAN;
-    scan_param.interval = 1560;
-    scan_param.window = 160;
-
-    int ret = bt_adapter_le_set_scan_parameter(&scan_param);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_set_scan_parameter Failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CABleGattSetCallbacks()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    int ret = bt_gatt_set_connection_state_changed_cb(CABleGattConnectionStateChangedCb, NULL);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_set_connection_state_changed_cb Failed with return as [%s ]",
-                  CABTGetErrorMsg(ret));
-        return CA_STATUS_FAILED;
-    }
-
-    ret = bt_adapter_le_set_device_discovery_state_changed_cb(
-              CABtAdapterLeDeviceDiscoveryStateChangedCb, NULL);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_adapter_le_set_device_discovery_state_changed_cb Failed with return as [%s ]",
-                  CABTGetErrorMsg(ret));;
-        return CA_STATUS_FAILED;
-    }
-
-    ret = bt_gatt_set_characteristic_changed_cb(CABleGattCharacteristicChangedCb, NULL);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_gatt_set_characteristic_changed_cb Failed as [%s ]",
-                  CABTGetErrorMsg(ret));
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CABleGattUnSetCallbacks()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    bt_gatt_unset_characteristic_changed_cb();
-
-    bt_gatt_unset_connection_state_changed_cb();
-
-    bt_adapter_le_unset_device_discovery_state_changed_cb();
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CABleGattWatchCharacteristicChanges(bt_gatt_attribute_h service)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    int ret = bt_gatt_watch_characteristic_changes(service);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_watch_characteristic_changes failed  with [%s]",
-                  CABTGetErrorMsg(ret));
-
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CABleGattUnWatchCharacteristicChanges()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    int32_t count = CAGetRegisteredServiceCount();
-
-    for (int32_t index = 0; index < count; index++)
-    {
-        BLEServiceInfo *bleServiceInfo = NULL;
-
-        ca_mutex_lock(g_bleServiceListMutex);
-
-        CAResult_t  result = CAGetBLEServiceInfoByPosition(g_bLEServiceList, index, &bleServiceInfo);
-        if (CA_STATUS_OK == result && NULL != bleServiceInfo
-            && NULL != bleServiceInfo->service_clone)
-        {
-            bt_gatt_unwatch_characteristic_changes(bleServiceInfo->service_clone);
-            OIC_LOG(INFO, TZ_BLE_CLIENT_TAG, "bt_gatt_unwatch_characteristic_changes done");
-        }
-
-        ca_mutex_unlock(g_bleServiceListMutex);
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CABleGattStartDeviceDiscovery()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-    bool isDiscovering = false;
-
-    int ret = bt_adapter_le_is_discovering(&isDiscovering);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_is_discovering Failed");
-        return CA_STATUS_FAILED;
-    }
-
-    if(!isDiscovering)
-    {
-        ret = bt_adapter_le_start_device_discovery();
-        if (BT_ERROR_NONE != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_start_device_discovery Failed Ret: %d, %x", ret, ret);
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CABleGattStopDeviceDiscovery()
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    bool isDiscovering = false;
-
-    int ret = bt_adapter_le_is_discovering(&isDiscovering);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_is_discovering Failed");
-        return;
-    }
-
-    if(isDiscovering)
-    {
-        ret = bt_adapter_le_stop_device_discovery();
-        if (BT_ERROR_NONE != ret)
-        {
-            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_stop_device_discovery Failed");
-            return;
-        }
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-void CAGattConnectThread (void *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN ");
-
-    VERIFY_NON_NULL_VOID(remoteAddress, TZ_BLE_CLIENT_TAG, "remote address is NULL");
-
-    char *address  = (char *)remoteAddress;
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "remote address is [%s]", address);
-
-    CAResult_t result = CABleGattConnect(address);
-
-    if (CA_STATUS_OK != result)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_gatt_connect failed for [%s]", address);
-    }
-
-    OICFree(address);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CABleGattConnect(const char *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG,
-                        "remote address is NULL", CA_STATUS_FAILED);
-
-    //Because of the platform issue, we added. Once platform is stablized, then it will be removed
-    sleep(1);
-
-    ca_mutex_lock(g_bleClientConnectMutex);
-
-    int ret = bt_gatt_connect(remoteAddress, true);
-
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_gatt_connect Failed with ret value [%s] ",
-                  CABTGetErrorMsg(ret));
-        ca_mutex_unlock(g_bleClientConnectMutex);
-        return CA_STATUS_FAILED;
-    }
-    ca_mutex_unlock(g_bleClientConnectMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CABleGattDisConnect(const char *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG,
-                        "remote address is NULL", CA_STATUS_FAILED);
-
-    int32_t ret = bt_gatt_disconnect(remoteAddress);
-
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_gatt_disconnect Failed with ret value [%d] ",
-                  ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CADiscoverBLEServicesThread (void *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_VOID(remoteAddress, TZ_BLE_CLIENT_TAG, "remote address is NULL");
-
-    char *address  = (char *)remoteAddress;
-
-    CAResult_t result = CABleGattDiscoverServices(address);
-    if (CA_STATUS_OK != result)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleGattDiscoverServices failed");
-    }
-
-    OICFree(address);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT ");
-}
-
-CAResult_t CABleGattDiscoverServices(const char *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG,
-                        "remote address is NULL", CA_STATUS_FAILED);
-
-    char *addr = OICStrdup(remoteAddress);
-    VERIFY_NON_NULL_RET(addr, TZ_BLE_CLIENT_TAG, "Malloc failed", CA_STATUS_FAILED);
-
-    int32_t ret = bt_gatt_foreach_primary_services(remoteAddress, CABleGattPrimaryServiceCb,
-                  (void *)addr); // addr memory will be free in callback.
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_foreach_primary_services Failed with ret value [%d] ", ret);
-        OICFree(addr);
-        return CA_STATUS_FAILED;
-    }
-    else
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_foreach_primary_services success for address [%s]", remoteAddress);
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CADiscoverCharThread(void *stServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_VOID(stServiceInfo, TZ_BLE_CLIENT_TAG, "stServiceInfo is NULL");
-
-    stGattServiceInfo_t *stTemp  = (stGattServiceInfo_t *)stServiceInfo;
-
-    VERIFY_NON_NULL_VOID(stTemp->address, TZ_BLE_CLIENT_TAG, "stTemp->address is NULL");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "remote address [%s]", stTemp->address);
-
-    CAResult_t  result = CABleGattDiscoverCharacteristics(stTemp->serviceInfo, stTemp->address);
-    if (CA_STATUS_OK != result)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CABleGattDiscoverCharacteristics failed!");
-        bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
-        OICFree(stTemp->address);
-        OICFree(stTemp);
-        return;
-    }
-    bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
-    OICFree(stTemp->address);
-    OICFree(stTemp);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CABleGattDiscoverCharacteristics(bt_gatt_attribute_h service,
-        const char *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(service, TZ_BLE_CLIENT_TAG, "service is NULL", CA_STATUS_FAILED);
-
-    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG, "remoteAddress is NULL", CA_STATUS_FAILED);
-
-    char *addr = OICStrdup(remoteAddress);
-    VERIFY_NON_NULL_RET(addr, TZ_BLE_CLIENT_TAG, "Malloc failed", CA_STATUS_FAILED);
-
-    int32_t ret = bt_gatt_discover_characteristics(service, CABleGattCharacteristicsDiscoveredCb,
-                  (void *)addr); // addr will be freed in callback.
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_discover_characteristics failed with error [%d]", ret);
-        OICFree(addr);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CADiscoverDescriptorThread(void *stServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, " IN");
-
-    VERIFY_NON_NULL_VOID(stServiceInfo, TZ_BLE_CLIENT_TAG, "stServiceInfo is NULL");
-
-    stGattServiceInfo_t *stTemp  = (stGattServiceInfo_t *)stServiceInfo;
-
-    CAResult_t result = CABleGattDiscoverDescriptor(stTemp->serviceInfo, NULL);
-    if (CA_STATUS_OK != result)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_discover_characteristic_descriptor failed");
-        bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
-        OICFree(stTemp->address);
-        OICFree(stTemp);
-        return;
-    }
-
-    bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
-    OICFree(stTemp->address);
-    OICFree(stTemp);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CABleGattDiscoverDescriptor(bt_gatt_attribute_h service, const char *remoteAddress)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_RET(service, TZ_BLE_CLIENT_TAG, "service is NULL", CA_STATUS_FAILED);
-
-    int ret = bt_gatt_discover_characteristic_descriptor(service,
-                  CABleGattDescriptorDiscoveredCb, NULL);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_discover_characteristic_descriptor failed with returns[%s]",
-                  CABTGetErrorMsg(ret));
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CASetCharacteristicDescriptorValueThread(void *stServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL_VOID(stServiceInfo, TZ_BLE_CLIENT_TAG, "stServiceInfo is NULL");
-
-    stGattCharDescriptor_t *stTemp  = (stGattCharDescriptor_t *)stServiceInfo;
-
-    CAResult_t  result = CASetCharacteristicDescriptorValue(stTemp);
-    if (CA_STATUS_OK != result)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CASetCharacteristicDescriptorValue failed!");
-        bt_gatt_destroy_attribute_handle(stTemp->characteristic);
-        OICFree(stTemp->desc);
-        OICFree(stTemp);
-        return;
-    }
-    bt_gatt_destroy_attribute_handle(stTemp->characteristic);
-    OICFree(stTemp->desc);
-    OICFree(stTemp);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-}
-
-CAResult_t CASetCharacteristicDescriptorValue(stGattCharDescriptor_t *stGattCharDescInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    unsigned char noti[4] = {0,};
-
-    char *strUUID = (char *)OICCalloc(5, sizeof(char));
-
-    VERIFY_NON_NULL_RET(strUUID, TZ_BLE_CLIENT_TAG, "calloc failed", CA_STATUS_FAILED);
-
-    snprintf(strUUID, 4, "%x%x", stGattCharDescInfo->desc[3], stGattCharDescInfo->desc[2]);
-    noti[0] = stGattCharDescInfo->desc[0];
-    noti[1] = stGattCharDescInfo->desc[1];
-    noti[2] = 0x01;
-    noti[3] = 0x00;
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "desc x0 [%x]", stGattCharDescInfo->desc[0]);
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "desc x1 [%x]", stGattCharDescInfo->desc[1]);
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "desc x2 [%x]", stGattCharDescInfo->desc[2]);
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "desc x3 [%x]", stGattCharDescInfo->desc[3]);
-
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "CA_GATT_CONFIGURATION_DESC_UUID strUUID is [%s]",
-              strUUID);
-    //if (!strncmp(strUUID, CA_GATT_CONFIGURATION_DESC_UUID, 2))
-    {
-        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "setting notification/indication for descriptor");
-
-        int ret =  bt_gatt_set_characteristic_desc_value_request(
-                           stGattCharDescInfo->characteristic,
-                           noti,  4, CABleGattCharacteristicWriteCb);
-        if (BT_ERROR_NONE != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                      "bt_gatt_set_characteristic_desc_value_request failed with return[%s]",
-                      CABTGetErrorMsg(ret));
-            OICFree(strUUID);
-            return CA_STATUS_FAILED;
-        }
-    }
-    OICFree(strUUID);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t  CAUpdateCharacteristicsToGattServer(const char *remoteAddress,
-        const uint8_t *data, uint32_t dataLen,
-        CALETransferType_t type, int32_t position)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL(data, TZ_BLE_CLIENT_TAG, "data is NULL");
-
-    if (0 >= dataLen)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input!");
-        return CA_STATUS_INVALID_PARAM;
-    }
-
-    BLEServiceInfo *bleServiceInfo = NULL;
-
-    CAResult_t ret =  CA_STATUS_FAILED;
-
-    ca_mutex_lock(g_bleServiceListMutex);
-    if ( LE_UNICAST == type)
-    {
-        VERIFY_NON_NULL(remoteAddress, TZ_BLE_CLIENT_TAG, "remoteAddress is NULL");
-
-        ret = CAGetBLEServiceInfo(g_bLEServiceList, remoteAddress, &bleServiceInfo);
-    }
-    else if ( LE_MULTICAST == type)
-    {
-        ret = CAGetBLEServiceInfoByPosition(g_bLEServiceList, position, &bleServiceInfo);
-    }
-    ca_mutex_unlock(g_bleServiceListMutex);
-
-    if (CA_STATUS_OK != ret)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CAGetBLEServiceInfoByPosition is failed");
-        return CA_STATUS_FAILED;
-    }
-
-    VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_TAG, "bleServiceInfo is NULL");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Updating the data of length [%u] to [%s] ", dataLen,
-              bleServiceInfo->bdAddress);
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Updating to write char [%s]",
-              bleServiceInfo->read_char);
-
-    int result = bt_gatt_set_characteristic_value(bleServiceInfo->write_char, (unsigned char *)data,
-                     dataLen);
-    if (BT_ERROR_NONE != result)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                  "bt_gatt_set_characteristic_value Failed with return val [%d]",
-                  result);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t  CAUpdateCharacteristicsToAllGattServers(const uint8_t *data,
-            uint32_t dataLen)
-{
-    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "IN");
-
-    VERIFY_NON_NULL(data, TZ_BLE_CLIENT_TAG, "data is NULL");
-
-    if (0 >= dataLen)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input !");
-        return CA_STATUS_INVALID_PARAM;
-    }
-
-    int numOfServersConnected = CAGetRegisteredServiceCount();
-
-    for (int32_t pos = 0; pos < numOfServersConnected; pos++)
-    {
-        /*remoteAddress will be NULL.
-          Since we have to send to all destinations. pos will be used for getting remote address.
-         */
-        CAResult_t  ret = CAUpdateCharacteristicsToGattServer(NULL, data, dataLen, LE_MULTICAST, pos);
-
-        if (CA_STATUS_OK != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
-                      "CAUpdateCharacteristicsToGattServer Failed with return val [%d] ", ret);
-            g_clientErrorCallback(NULL, data, dataLen, ret);
-            continue;
-        }
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT ");
-    return CA_STATUS_OK;
-}
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableclient.h b/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableclient.h
deleted file mode 100644 (file)
index d4a96fc..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-/* ****************************************************************
-*
-* Copyright 2014 Samsung Electronics 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.
-*
-******************************************************************/
-
-/**
- * @file
- *
- * This file contains the functionalities of GATT Client. Functionalities
- * like LE device discovery, connecting to the LE device with OIC service,
- * registering to the service and there characteristics, registering to the
- * change in the charateristics, setting the value of the characteristcs
- * for the request and response will be done here.
- */
-
-#ifndef TZ_BLE_CLIENT_H_
-#define TZ_BLE_CLIENT_H_
-
-#include <bluetooth.h>
-#include <bluetooth_type.h>
-#include <bluetooth_product.h>
-
-#include "cacommon.h"
-#include "caadapterutils.h"
-#include "cableutil.h"
-#include "caadapterinterface.h"
-#include "logger.h"
-#include "cathreadpool.h"
-#include "caleinterface.h"
-#include "oic_malloc.h"
-
-
-/**
- * This is the callback which will be called after the characteristic
- * value changes happen.
- *
- * @param[in]  characteristic The attribute handle of characteristic.
- * @param[in]  value          Value of the characteristics of a service.
- * @param[in]  valueLen       length of data.
- * @param[in]  userData       The user data passed from the request function.
- */
-void CABleGattCharacteristicChangedCb(bt_gatt_attribute_h characteristic,
-                                      unsigned char *value,
-                                      int valueLen,
-                                      void *userData);
-/**
- * This is the callback which will be called after the characteristics changed.
- *
- * @param[in]  result   result of write value.
- * @param[in]  userData user context.
- */
-void CABleGattCharacteristicWriteCb(int result, void *userData);
-
-/**
- * This is the callback which will be called when descriptor of
- * characteristics is found.
- *
- * @param[in]  result         The result of discovering.
- * @param[in]  format         format of descriptor.
- * @param[in]  total          The total number of descriptor in a
- *                             characteristic.
- * @param[in]  descriptor     The attribute handle of descriptor.
- * @param[in]  characteristic The attribute handle of characteristic.
- * @param[in]  userData       The user data passed from the request function.
- */
-void CABleGattDescriptorDiscoveredCb(int result, unsigned char format, int total,
-                                     bt_gatt_attribute_h descriptor,
-                                     bt_gatt_attribute_h characteristic, void *userData);
-
-/**
- * This is the callback which will be called after the characteristics are
- * discovered by bt_gatt_discover_characteristics().
- *
- * @param[in]  result         The result of discovering.
- * @param[in]  inputIndex     The index of characteristics in a service,
- *                             starts from 0.
- * @param[in]  total          The total number of characteristics in a service.
- * @param[in]  characteristic The attribute handle of characteristic.
- * @param[in]  userData       The user data passed from the request function.
- *
- * @return  0 on failure and 1 on success.
- */
-bool CABleGattCharacteristicsDiscoveredCb(int result, int inputIndex, int total,
-                                          bt_gatt_attribute_h characteristic, void *userData);
-
-/**
- * This is the callback which will be called when we get the primary
- * services repeatedly.
- *
- * @param[in] service  The attribute handle of service. Unique identifier
- *                      for service.
- * @param[in] index    The current index of the service.
- * @param[in] count    Total number of services available in remote device.
- * @param[in] userData user data.
- *
- * @return  0 on failure and 1 on success.
- */
-bool CABleGattPrimaryServiceCb(bt_gatt_attribute_h service, int index, int count,
-                                   void *userData);
-
-/**
- * This is the callback which will be called whenever there is change in
- * gatt connection with server(Connected/Disconnected)
- *
- * @param[in]  result        The result of discovering.
- * @param[in]  connected     State of connection.
- * @param[in]  remoteAddress Mac address of the remote device in which we
- *                            made connection.
- * @param[in]  userData      The user data passed from the request function.
- */
-void CABleGattConnectionStateChangedCb(int result, bool connected,
-                const char *remoteAddress,void *userData);
-
-/**
- * This is the callback which will be called when the device discovery
- * state changes.
- *
- * @param[in]  result         The result of discovering.
- * @param[in]  discoveryState State of the discovery(FOUND/STARTED/ FINISHED).
- * @param[in]  discoveryInfo  Remote Device information.
- * @param[in]  userData       The user data passed from the request function.
- */
-void CABtAdapterLeDeviceDiscoveryStateChangedCb(int result,
-        bt_adapter_le_device_discovery_state_e discoveryState,
-        bt_adapter_le_device_discovery_info_s *discoveryInfo,
-        void *userData);
-
-/**
- * Used to print device information(Util method).
- * @param[in] discoveryInfo Device information structure.
- */
-void CAPrintDiscoveryInformation(const bt_adapter_le_device_discovery_info_s *discoveryInfo);
-
-/**
- * This thread will be used to initialize the Gatt Client and start device
- * discovery.
- *        1. Set scan parameters.
- *        2. Setting neccessary callbacks for connection, characteristics
- *          changed and discovery.
- *        3. Start device discovery.
- *
- * @param[in] data Currently it will be NULL(no parameter).
- */
-void CAStartBleGattClientThread(void *data);
-
-/**
- * Used to initialize all required mutex variable for Gatt Client
- * implementation.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAInitGattClientMutexVariables();
-
-/**
- * Used to terminate all required mutex variable for Gatt Client implementation.
- */
-void CATerminateGattClientMutexVariables();
-
-/**
- * Used to clear NonOICDeviceList.
- */
-void CAClearNonOICDeviceList();
-
-/**
- * Used to set scan parameter of starting discovery.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattSetScanParameter();
-
-/**
- * Used to register required callbacks to BLE platform(connection,
- * discovery, etc).
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattSetCallbacks();
-
-/**
- * Used to unset all the registerd callbacks to BLE platform.
- */
-void CABleGattUnSetCallbacks();
-
-/**
- * Used to watch all the changes happening in characteristics of the service.
- *
- * @param[in] service The attribute handle of the service.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattWatchCharacteristicChanges(bt_gatt_attribute_h service);
-
-/**
- * Used to unwatch characteristics changes using
- * bt_gatt_unwatch_characteristic_changes().
- */
-void CABleGattUnWatchCharacteristicChanges();
-
-/**
- * Used to start LE discovery for BLE  devices.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattStartDeviceDiscovery();
-
-/**
- * Used to stop LE discovery for BLE  devices.
- */
-void CABleGattStopDeviceDiscovery();
-
-/**
- * This is the thread  which will be used for making gatt connection with
- * remote devices.
- * @param[in] remoteAddress MAC address of remote device to connect.
- */
-void CAGattConnectThread (void *remoteAddress);
-
-/**
- * Used to do connection with remote device.
- *
- * @param[in] remoteAddress Remote address inwhich we wants to connect with.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattConnect(const char *remoteAddress);
-
-/**
- * Used to do disconnection with remote device.
- * @param[in] remoteAddress Remote address inwhich we wants to disconnect with.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattDisConnect(const char *remoteAddress);
-
-/**
- * This is thread which will be spawned for discovering ble services. Once
- * called discover api, then it will be terminated.
- * @param[in] remoteAddress Mac address of the remote device in which we
- *                           want to search services.
- */
-void CADiscoverBLEServicesThread (void *remoteAddress);
-
-/**
- * Used to discover the services that is advertised by Gatt Server
- * asynchronously.
- *
- * @param[in] remoteAddress MAC address of remote device in which we want
- *                           to discover the services.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattDiscoverServices(const char *remoteAddress);
-
-/**
- * This is the thread which will be used for finding characteristic of a
- * service.
- *
- * @param[in]  stServiceInfo Service Information which contains the remote
- *                            address, service handle and characteristic handle.
- */
-void CADiscoverCharThread(void *stServiceInfo);
-
-/**
- * Used to discover characteristics of service using
- * bt_gatt_discover_characteristics() api.
- *
- * @param[in] service        The attribute handle for service.
- * @param[in] remoteAddress  Remote address inwhich we wants to discover
- *                            characteristics of given service handle.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattDiscoverCharacteristics(bt_gatt_attribute_h service,
-                    const char *remoteAddress);
-
-/**
- * This is the thread which will be used for finding descriptor of
- * characteristic.
- *
- * @param[in]  stServiceInfo Service Information which contains the remote
- *                            address, service handle and characteristic handle.
- */
-void CADiscoverDescriptorThread(void *stServiceInfo);
-
-/**
- * This is thread which will be used for calling
- * CASetCharacteristicDescriptorValue() api.
- *
- * @param[in] service        The attribute handle for characteristics.
- * @param[in] remoteAddress  Remote address inwhich we wants to discover
- *                            descriptor of given char handle.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleGattDiscoverDescriptor(bt_gatt_attribute_h service,
-                const char *remoteAddress);
-
-/**
- * This is thread which will be used for calling
- * CASetCharacteristicDescriptorValue() api.
- *
- * @param[in]  stServiceInfo Service Information which contains the remote
- *                            address, service handle and characteristic handle.
- */
-void CASetCharacteristicDescriptorValueThread(void *stServiceInfo);
-
-/**
- * Used to set characteristic descriptor value using
- * bt_gatt_set_characteristic_desc_value_request() api.
- * @param[in]  stGattCharDescriptorInfo Structure which contains char
- *                                       handle and descriptor handle.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CASetCharacteristicDescriptorValue
-            (stGattCharDescriptor_t *stGattCharDescriptorInfo);
-
-/**
- * Used to enqueue the message into sender queue using
- * CAAdapterEnqueueMessage() and make signal to the thread to process.
- *
- * @param[in]  remoteEndpoint Remote device information.
- * @param[in]  data           Data to be sent to remote device.
- * @param[in]  dataLen        Length of data..
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CABleClientSenderQueueEnqueueMessage
-                            (const CAEndpoint_t *remoteEndpoint,
-                                                const uint8_t *data, uint32_t dataLen);
-
-/**
- * This is the thread which will be used for processing sender queue.
- */
-void CABleClientSenderQueueProcessor();
-
-/**
- * Synchronous function for reading characteristic value.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CALEReadDataFromLEClient();
-
-#endif /* TZ_BLE_CLIENT_H_ */
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableserver.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableserver.c
deleted file mode 100644 (file)
index 9132739..0000000
+++ /dev/null
@@ -1,848 +0,0 @@
-/******************************************************************
-*
-* Copyright 2014 Samsung Electronics 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.
-*
-******************************************************************/
-
-#include <bluetooth.h>
-#include <bluetooth_type.h>
-#include <bluetooth_product.h>
-
-#include "cableserver.h"
-#include <pthread.h>
-#include "cacommon.h"
-#include "caadapterutils.h"
-#include <gio/gio.h>
-#include "camutex.h"
-#include "caqueueingthread.h"
-#include "caadapterutils.h"
-#include "cafragmentation.h"
-#include "cagattservice.h"
-#include "cableutil.h"
-#include "oic_string.h"
-#include "oic_malloc.h"
-
-/**
- * @def TZ_BLE_SERVER_TAG
- * @brief Logging tag for module name
- */
-#define TZ_BLE_SERVER_TAG "TZ_BLE_GATT_SERVER"
-
-/**
- * @def CA_BLE_INITIAL_BUF_SIZE
- * @brief Initial buffer size for Gatt Server.
- */
-#define CA_BLE_INITIAL_BUF_SIZE 512
-
-/**
- * @var g_gattSvcPath
- * @brief attribute handler for OIC server attribute.
- */
-static char *g_gattSvcPath = NULL;
-
-/**
- * @var g_gattReadCharPath
- * @brief attribute handler for readCharacteristic of OIC server
- */
-static char *g_gattReadCharPath = NULL;
-
-/**
- * @var g_gattWriteCharPath
- * @brief attribute handler for writeCharacteristic of OIC server
- */
-static char *g_gattWriteCharPath = NULL;
-
-/**
- * @var g_hAdvertiser
- * @brief handler for OIC advertiser.
- */
-static bt_advertiser_h g_hAdvertiser = NULL;
-
-/**
- * @var    g_bleServerDataReceivedCallback
- * @brief  Maintains the callback to be notified on receival of network packets from other
- *           BLE devices
- */
-static CABLEDataReceivedCallback g_bleServerDataReceivedCallback = NULL;
-
-/**
- * @var g_serverErrorCallback
- * @brief callback to update the error to le adapter
- */
-static CABLEErrorHandleCallback g_serverErrorCallback;
-
-/**
- * @var g_isBleGattServerStarted
- * @brief Boolean variable to keep the state of the GATTServer
- */
-static bool g_isBleGattServerStarted = false;
-
-/**
- * @var g_bleServerStateMutex
- * @brief Mutex to synchronize the calls to be done to the platform from GATTServer
- *           interfaces from different threads.
- */
-static ca_mutex g_bleServerStateMutex = NULL;
-
-/**
- * @var g_bleCharacteristicMutex
- * @brief Mutex to synchronize writing operations on the characteristics.
- */
-static  ca_mutex g_bleCharacteristicMutex = NULL;
-
-/**
- * @var g_bleServiceMutex
- * @brief  Mutex to synchronize to create the OIC service..
- */
-static  ca_mutex g_bleServiceMutex = NULL;
-
-/**
- * @var g_bleReqRespCbMutex
- * @brief Mutex to synchronize access to the requestResponse callback to be called
- *           when the data needs to be sent from GATTClient.
- */
-static  ca_mutex g_bleReqRespCbMutex = NULL;
-
-/**
- * @var g_bleServerThreadPoolMutex
- * @brief Mutex to synchronize the task to be pushed to thread pool.
- */
-static ca_mutex g_bleServerThreadPoolMutex = NULL;
-
-/**
- * @var g_eventLoop
- * @brief gmainLoop to manage the threads to receive the callback from the platfrom.
- */
-static GMainLoop *g_eventLoop = NULL;
-
-/**
- * @var g_bleServerThreadPool
- * @brief reference to threadpool
- */
-static ca_thread_pool_t g_bleServerThreadPool = NULL;
-
-void CABleGattServerConnectionStateChangedCb(int result, bool connected,
-                                       const char *remoteAddress, void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "CABleGattConnectionStateChangedCb result[%d]", result);
-
-    VERIFY_NON_NULL_VOID(remoteAddress, TZ_BLE_SERVER_TAG, "remote address is NULL");
-
-    if (connected)
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "Connected to [%s]", remoteAddress);
-    }
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-CAResult_t CAStartLEGattServer()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    ca_mutex_lock(g_bleServerThreadPoolMutex);
-    if (NULL == g_bleServerThreadPool)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "g_bleServerThreadPool is NULL");
-        ca_mutex_unlock(g_bleServerThreadPoolMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    ret = ca_thread_pool_add_task(g_bleServerThreadPool, CAStartBleGattServerThread,
-                                 NULL);
-    if (CA_STATUS_OK != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "ca_thread_pool_add_task failed with ret [%d]", ret);
-        ca_mutex_unlock(g_bleServerThreadPoolMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    ca_mutex_unlock(g_bleServerThreadPoolMutex);
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CAStartBleGattServerThread(void *data)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-    ca_mutex_lock(g_bleServerStateMutex);
-    if (true == g_isBleGattServerStarted)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "Gatt Server is already running");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    CAResult_t ret  =  CAInitBleGattService();
-    if (CA_STATUS_OK != ret )
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "_bt_gatt_init_service failed");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    sleep(5); // Sleep is must because of the platform issue.
-
-    char *serviceUUID = CA_GATT_SERVICE_UUID;
-
-    ret  = CAAddNewBleServiceInGattServer(serviceUUID);
-    if (CA_STATUS_OK != ret )
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "CAAddNewBleServiceInGattServer failed");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    static const char charReadUUID[] = CA_GATT_RESPONSE_CHRC_UUID;
-    uint8_t charReadValue[] = {33, 44, 55, 66}; // These are initial random values
-
-    ret = CAAddNewCharacteristicsToGattServer(g_gattSvcPath, charReadUUID, charReadValue,
-            CA_BLE_INITIAL_BUF_SIZE, true); // For Read Characteristics.
-    if (CA_STATUS_OK != ret )
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "CAAddNewCharacteristicsToGattServer failed");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    static const char charWriteUUID[] = CA_GATT_REQUEST_CHRC_UUID;
-    uint8_t charWriteValue[] = {33, 44, 55, 66}; // These are initial random values
-
-
-    ret = CAAddNewCharacteristicsToGattServer(g_gattSvcPath, charWriteUUID, charWriteValue,
-            CA_BLE_INITIAL_BUF_SIZE, false); // For Write Characteristics.
-    if (CA_STATUS_OK != ret )
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "CAAddNewCharacteristicsToGattServer failed");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    ret = CARegisterBleServicewithGattServer(g_gattSvcPath);
-    if (CA_STATUS_OK != ret )
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "CARegisterBleServicewithGattServer failed");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    int res = bt_gatt_set_connection_state_changed_cb(CABleGattServerConnectionStateChangedCb,
-                                                          NULL);
-    if (BT_ERROR_NONE != res)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                  "bt_gatt_set_connection_state_changed_cb Failed with return as [%s]",
-                  CABTGetErrorMsg(res));
-        return;
-    }
-
-    bt_adapter_le_create_advertiser(&g_hAdvertiser);
-    if (NULL == g_hAdvertiser)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "g_hAdvertiser is NULL");
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    res = bt_adapter_le_start_advertising(g_hAdvertiser, NULL, NULL, NULL);
-    if (BT_ERROR_NONE != res)
-    {
-        OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "bt_adapter_le_start_advertising failed with ret [%d] ",
-                  res);
-        ca_mutex_unlock(g_bleServerStateMutex);
-        CATerminateLEGattServer();
-        return;
-    }
-
-    g_isBleGattServerStarted = true;
-
-    ca_mutex_unlock(g_bleServerStateMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG,
-            "LE Server initialization complete.");
-
-    GMainContext *thread_context = NULL;
-
-    thread_context = g_main_context_new();
-
-    g_eventLoop = g_main_loop_new(thread_context, FALSE);
-
-    g_main_context_push_thread_default(thread_context);
-
-    g_main_loop_run(g_eventLoop);
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-CAResult_t CAStopLEGattServer()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    ca_mutex_lock(g_bleServerStateMutex);
-
-    if (false == g_isBleGattServerStarted)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "Gatt Server is not running to stop");
-
-        ca_mutex_unlock(g_bleServerStateMutex);
-        return CA_STATUS_OK;
-    }
-
-    g_isBleGattServerStarted = false;
-    if (NULL != g_hAdvertiser )
-    {
-        int ret = 0;
-        ret  = bt_adapter_le_stop_advertising(g_hAdvertiser);
-        if (0 != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                      "bt_adapter_le_stop_advertising failed with ret [%d]", ret);
-        }
-
-        ret = bt_adapter_le_destroy_advertiser(g_hAdvertiser);
-        if (0 != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                      "bt_adapter_le_destroy_advertiser failed with ret [%d]", ret);
-        }
-        g_hAdvertiser = NULL;
-    }
-
-    CAResult_t res = CARemoveAllBleServicesFromGattServer();
-    if (CA_STATUS_OK != res)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "removeAllBleServicesFromGattServer failed");
-    }
-
-    res =  CADeInitBleGattService();
-    if (CA_STATUS_OK != res)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "_bt_gatt_deinit_service failed with ret [%d]", res);
-    }
-
-    GMainContext  *context_event_loop = NULL;
-    // Required for waking up the thread which is running in gmain loop
-    if (NULL != g_eventLoop)
-    {
-        context_event_loop = g_main_loop_get_context(g_eventLoop);
-
-        if (context_event_loop)
-        {
-            OIC_LOG_V(DEBUG,  TZ_BLE_SERVER_TAG, "g_eventLoop context %x", context_event_loop);
-            g_main_context_wakeup(context_event_loop);
-
-            // Kill g main loops and kill threads
-            g_main_loop_quit(g_eventLoop);
-        }
-    }
-    else
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "g_eventLoop context is NULL");
-    }
-
-    ca_mutex_unlock(g_bleServerStateMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAInitializeLEGattServer()
-{
-    OIC_LOG(DEBUG, TAG, "Initialize GATT Server");
-
-    CAResult_t ret = CAInitGattServerMutexVariables();
-    if (CA_STATUS_OK != ret )
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "CAInitGattServerMutexVariables failed!");
-        CATerminateGattServerMutexVariables();
-        return CA_SERVER_NOT_STARTED;
-    }
-
-    return ret;
-}
-
-void CATerminateLEGattServer()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    ca_mutex_lock(g_bleServerStateMutex);
-
-    // free service Path(unique identifier for ble service)
-    ca_mutex_lock(g_bleServiceMutex);
-    OICFree(g_gattSvcPath);
-    g_gattSvcPath = NULL;
-    ca_mutex_unlock(g_bleServiceMutex);
-
-    // freeing characteristics
-    ca_mutex_lock(g_bleCharacteristicMutex);
-    OICFree(g_gattReadCharPath);
-    g_gattReadCharPath = NULL;
-    OICFree(g_gattWriteCharPath);
-    g_gattWriteCharPath = NULL;
-    ca_mutex_unlock(g_bleCharacteristicMutex);
-
-    ca_mutex_unlock(g_bleServerStateMutex);
-
-    // Terminating all mutex variables.
-    CATerminateGattServerMutexVariables();
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-CAResult_t CAInitGattServerMutexVariables()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-    if (NULL == g_bleServerStateMutex)
-    {
-        g_bleServerStateMutex = ca_mutex_new();
-        if (NULL == g_bleServerStateMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleServiceMutex)
-    {
-        g_bleServiceMutex = ca_mutex_new();
-        if (NULL == g_bleServiceMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleCharacteristicMutex)
-    {
-        g_bleCharacteristicMutex = ca_mutex_new();
-        if (NULL == g_bleCharacteristicMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    if (NULL == g_bleReqRespCbMutex)
-    {
-        g_bleReqRespCbMutex = ca_mutex_new();
-        if (NULL == g_bleReqRespCbMutex)
-        {
-            OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "ca_mutex_new failed");
-            return CA_STATUS_FAILED;
-        }
-    }
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CATerminateGattServerMutexVariables()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-    ca_mutex_free(g_bleServerStateMutex);
-    g_bleServerStateMutex = NULL;
-
-
-    g_bleServerStateMutex = NULL;
-    ca_mutex_free(g_bleServiceMutex);
-    g_bleServiceMutex = NULL;
-    ca_mutex_free(g_bleCharacteristicMutex);
-    g_bleCharacteristicMutex = NULL;
-    ca_mutex_free(g_bleReqRespCbMutex);
-    g_bleReqRespCbMutex = NULL;
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-CAResult_t CAInitBleGattService()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    int ret =  _bt_gatt_init_service();
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "_bt_gatt_deinit_service failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CADeInitBleGattService()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    int ret =  _bt_gatt_deinit_service();
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "_bt_gatt_deinit_service failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CASetLEServerThreadPoolHandle(ca_thread_pool_t handle)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-    ca_mutex_lock(g_bleServerThreadPoolMutex);
-    g_bleServerThreadPool = handle;
-    ca_mutex_unlock(g_bleServerThreadPoolMutex);
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-CAResult_t CAAddNewBleServiceInGattServer(const char *serviceUUID)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceUUID, TZ_BLE_SERVER_TAG, "Param serviceUUID is NULL");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "service uuid %s", serviceUUID);
-
-    char *svcPath = NULL;
-
-    int ret = bt_gatt_add_service(serviceUUID, &svcPath);
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "bt_gatt_add_service failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    if (NULL != svcPath)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                  "AddNewBleServiceInGattServer ServicePath obtained is %s", svcPath);
-
-        ca_mutex_lock(g_bleServiceMutex);
-
-        if (NULL != g_gattSvcPath)
-        {
-            OICFree(g_gattSvcPath);
-            g_gattSvcPath = NULL;
-        }
-        g_gattSvcPath = svcPath;
-
-        ca_mutex_unlock(g_bleServiceMutex);
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CARemoveBleServiceFromGattServer(const char *svcPath)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    VERIFY_NON_NULL(svcPath, TZ_BLE_SERVER_TAG, "Param svcPath is NULL");
-
-    int ret = bt_gatt_remove_service(svcPath);
-
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "bt_gatt_remove_service failed [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CARemoveAllBleServicesFromGattServer()
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-    int ret = bt_gatt_delete_services();
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "bt_gatt_delete_services  failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CABleGattRemoteCharacteristicWriteCb(char *charPath,
-                                          unsigned char *charValue,
-                                          int charValueLen,
-                                          const char *remoteAddress,
-                                          void *userData)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    if (NULL == charPath || NULL == charValue || NULL == remoteAddress)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "Param callback values are NULL");
-        return;
-    }
-
-    OIC_LOG_V(DEBUG,
-              TZ_BLE_SERVER_TAG,
-              "charPath = [%s] charValue = [%p] len [%d]",
-              charPath,
-              charValue,
-              charValueLen);
-
-    uint8_t *data = OICMalloc(charValueLen);
-    if (NULL == data)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "Malloc failed!");
-        return;
-    }
-
-    memcpy(data, charValue, charValueLen);
-
-    ca_mutex_lock(g_bleReqRespCbMutex);
-    if (NULL == g_bleServerDataReceivedCallback)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "gReqRespCallback is NULL!");
-        ca_mutex_unlock(g_bleReqRespCbMutex);
-        OICFree(data);
-        return;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "Sending data up !");
-    uint32_t sentLength = 0;
-    g_bleServerDataReceivedCallback(remoteAddress, data, charValueLen,
-                                    &sentLength);
-
-    ca_mutex_unlock(g_bleReqRespCbMutex);
-
-    OICFree(data);
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-CAResult_t CARegisterBleServicewithGattServer(const char *svcPath)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    VERIFY_NON_NULL(svcPath, TZ_BLE_SERVER_TAG, "Param svcPath is NULL");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "svcPath:%s", svcPath);
-
-    int ret = bt_gatt_register_service(svcPath, CABleGattRemoteCharacteristicWriteCb, NULL);
-
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "bt_gatt_register_service failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAAddNewCharacteristicsToGattServer(const char *svcPath, const char *charUUID,
-        const uint8_t *charValue, int charValueLen, bool read)
-{
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    const char *charFlags[1];
-    if(read)
-    {
-        charFlags[0] = "notify";
-    }
-    else
-    {
-        charFlags[0] = "write-without-response";
-    }
-
-    size_t flagLen = sizeof(charFlags) / sizeof(charFlags[0]);
-
-    char *charPath = NULL;
-    int ret =
-        bt_gatt_add_characteristic(charUUID,
-                                   (const char *) charValue,
-                                   charValueLen,
-                                   charFlags,
-                                   flagLen,
-                                   svcPath,
-                                   &charPath);
-
-    if (0 != ret || NULL == charPath)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                  "bt_gatt_add_characteristic  failed with ret [%d]", ret);
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG,
-              "bt_gatt_add_characteristic charPath obtained: %s", charPath);
-
-    ca_mutex_lock(g_bleCharacteristicMutex);
-
-    if (read)
-    {
-        if (NULL != g_gattReadCharPath)
-        {
-            OICFree(g_gattReadCharPath);
-            g_gattReadCharPath = NULL;
-        }
-        g_gattReadCharPath = charPath;
-
-    }
-    else
-    {
-        if (NULL != g_gattWriteCharPath)
-        {
-            OICFree(g_gattWriteCharPath);
-            g_gattWriteCharPath = NULL;
-        }
-        g_gattWriteCharPath = charPath;
-    }
-
-    ca_mutex_unlock(g_bleCharacteristicMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CARemoveCharacteristicsFromGattServer(const char *charPath)
-{
-    ///TODO: There is no api provided in bluetooth.h for removing characteristics.
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAUpdateCharacteristicsToGattClient(const char *address,
-                                               const uint8_t *charValue,
-                                               uint32_t charValueLen)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    VERIFY_NON_NULL(charValue, TZ_BLE_SERVER_TAG, "Param charValue is NULL");
-
-    VERIFY_NON_NULL(address, TZ_BLE_SERVER_TAG, "Param address is NULL");
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "Client's Unicast address for sending data [%s]", address);
-
-    ca_mutex_lock(g_bleCharacteristicMutex);
-
-    if (NULL  == g_gattReadCharPath)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "g_gattReadCharPath is NULL");
-        ca_mutex_unlock(g_bleCharacteristicMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    char *data = OICCalloc(charValueLen, 1);
-    if (NULL == data)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "malloc failed!");
-        ca_mutex_unlock(g_bleCharacteristicMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    memcpy(data, charValue, charValueLen);   // Binary data
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "updating characteristics char [%s] data [%p] dataLen [%u]",
-              (const char *)g_gattReadCharPath, data, charValueLen);
-
-    int ret =
-        bt_gatt_update_characteristic(g_gattReadCharPath,
-                                      data,
-                                      charValueLen,
-                                      address);
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                  "bt_gatt_update_characteristic failed with return [%d]", ret);
-        OICFree(data);
-        ca_mutex_unlock(g_bleCharacteristicMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    OICFree(data);
-    ca_mutex_unlock(g_bleCharacteristicMutex);
-
-    OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAUpdateCharacteristicsToAllGattClients(const uint8_t *charValue, uint32_t charValueLen)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    VERIFY_NON_NULL(charValue, TZ_BLE_SERVER_TAG, "Param charValue is NULL");
-
-    ca_mutex_lock(g_bleCharacteristicMutex);
-
-    if (NULL  == g_gattReadCharPath)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "g_gattReadCharPath is NULL");
-        ca_mutex_unlock(g_bleCharacteristicMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    char *data = OICMalloc(charValueLen);
-    if (NULL == data)
-    {
-        OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "malloc failed!");
-        ca_mutex_unlock(g_bleCharacteristicMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    memcpy(data, charValue, charValueLen);   // Binary data
-
-    OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "updating characteristics char [%s] data [%p] dataLen [%u]",
-              (const char *)g_gattReadCharPath, data, charValueLen);
-
-    int ret =
-        bt_gatt_update_characteristic(g_gattReadCharPath,
-                                      data,
-                                      charValueLen,
-                                      NULL);
-    if (0 != ret)
-    {
-        OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
-                  "bt_gatt_update_characteristic failed with return [%d]", ret);
-        OICFree(data);
-        ca_mutex_unlock(g_bleCharacteristicMutex);
-        return CA_STATUS_FAILED;
-    }
-
-    OICFree(data);
-    ca_mutex_unlock(g_bleCharacteristicMutex);
-
-    OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-void CASetLEReqRespServerCallback(CABLEDataReceivedCallback callback)
-{
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
-
-    ca_mutex_lock(g_bleReqRespCbMutex);
-
-    g_bleServerDataReceivedCallback = callback;
-
-    ca_mutex_unlock(g_bleReqRespCbMutex);
-
-    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
-}
-
-void CASetBLEServerErrorHandleCallback(CABLEErrorHandleCallback callback)
-{
-    g_serverErrorCallback = callback;
-}
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableutil.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableutil.c
deleted file mode 100644 (file)
index a2e4ff6..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-/******************************************************************
-*
-* Copyright 2014 Samsung Electronics 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.
-*
-******************************************************************/
-
-#include "cableutil.h"
-
-#include<stdio.h>
-#include<stdlib.h>
-#include<string.h>
-#include<arpa/inet.h>
-#include<sys/types.h>
-#include<sys/socket.h>
-#include<netinet/in.h>
-
-
-#include "caadapterutils.h"
-#include "cagattservice.h"
-#include "oic_string.h"
-#include "oic_malloc.h"
-
-/**
- * @def TZ_BLE_CLIENT_UTIL_TAG
- * @brief Logging tag for module name
- */
-#define TZ_BLE_CLIENT_UTIL_TAG "TZ_BLE_GATT_CLIENT_UTIL"
-
-/**
- * @var g_numberOfServiceConnected
- * @brief Number of services connected.
- */
-static int32_t g_numberOfServiceConnected = 0;
-
-void CAIncrementRegisteredServiceCount()
-{
-    g_numberOfServiceConnected++;
-}
-
-void CADecrementRegisteredServiceCount()
-{
-    g_numberOfServiceConnected--;
-}
-
-void CAResetRegisteredServiceCount()
-{
-    g_numberOfServiceConnected = 0;
-}
-
-int32_t  CAGetRegisteredServiceCount()
-{
-    return g_numberOfServiceConnected ;
-}
-
-CAResult_t CACreateBLEServiceInfo(const char *bdAddress, bt_gatt_attribute_h service,
-                                  BLEServiceInfo **bleServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(bdAddress, TZ_BLE_CLIENT_UTIL_TAG, "Param bdAddress is NULL");
-    VERIFY_NON_NULL(service, TZ_BLE_CLIENT_UTIL_TAG, "Param service is NULL");
-    VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_UTIL_TAG, "Param bleServiceInfo is NULL");
-
-    *bleServiceInfo = (BLEServiceInfo *) OICCalloc(1, sizeof(BLEServiceInfo));
-    if (NULL == *bleServiceInfo)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "Malloc failed!");
-        return CA_STATUS_FAILED;
-    }
-
-    (*bleServiceInfo)->bdAddress = OICStrdup(bdAddress);
-
-    if (NULL == (*bleServiceInfo)->bdAddress)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "Malloc failed!");
-        OICFree(*bleServiceInfo);
-        return CA_STATUS_FAILED;
-    }
-
-    if (service)
-    {
-        int32_t ret = bt_gatt_clone_attribute_handle(&((*bleServiceInfo)->service_clone), service);
-
-        if (BT_ERROR_NONE != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "service handle clone failed with ret [%d]",
-                      ret);
-            OICFree((*bleServiceInfo)->bdAddress);
-            OICFree(*bleServiceInfo);
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAAppendBLECharInfo( bt_gatt_attribute_h characteristic, CHAR_TYPE type,
-                                BLEServiceInfo *bleServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(characteristic, TZ_BLE_CLIENT_UTIL_TAG, "Param characteristic is NULL");
-    VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_UTIL_TAG, "Param bleServiceInfo is NULL");
-
-    if (BLE_GATT_READ_CHAR == type )
-    {
-        int ret = bt_gatt_clone_attribute_handle(&((bleServiceInfo)->read_char),
-            characteristic);
-        if (BT_ERROR_NONE != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "read_char clone failed with ret [%d]",
-                      ret);
-            return CA_STATUS_FAILED;
-        }
-    }
-    else  if (BLE_GATT_WRITE_CHAR == type)
-    {
-        int ret = bt_gatt_clone_attribute_handle(&((bleServiceInfo)->write_char),
-            characteristic);
-        if (BT_ERROR_NONE != ret)
-        {
-            OIC_LOG_V(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "write_char clone failed with ret [%d]",
-                      ret);
-            return CA_STATUS_FAILED;
-        }
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAAddBLEServiceInfoToList(BLEServiceList **serviceList,
-    BLEServiceInfo *bleServiceInfo)
-{
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceList, TZ_BLE_CLIENT_UTIL_TAG, "Param serviceList is NULL");
-    VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_UTIL_TAG, "Param bleServiceInfo is NULL");
-
-    BLEServiceList *node = (BLEServiceList *) OICCalloc(1, sizeof(BLEServiceList));
-    if (NULL == node)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "Malloc failed!");
-        return CA_STATUS_FAILED;
-    }
-
-    node->serviceInfo = bleServiceInfo;
-    node->next = NULL;
-
-    if (*serviceList == NULL)   // Empty list
-    {
-        *serviceList = node;
-    }
-    else     // Add at front end
-    {
-        node->next = *serviceList;
-        *serviceList = node;
-    }
-
-    CAIncrementRegisteredServiceCount();
-
-    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "Device [%s] added to list",
-        bleServiceInfo->bdAddress);
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-
-    return CA_STATUS_OK;
-}
-
-CAResult_t CARemoveBLEServiceInfoToList(BLEServiceList **serviceList,
-                                        BLEServiceInfo *bleServiceInfo,
-                                        const char *bdAddress)
-{
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceList, TZ_BLE_CLIENT_UTIL_TAG, "Param serviceList is NULL");
-    VERIFY_NON_NULL(*serviceList, TZ_BLE_CLIENT_UTIL_TAG, "Param *serviceList is NULL");
-    VERIFY_NON_NULL(bdAddress, TZ_BLE_CLIENT_UTIL_TAG, "Param bdAddress is NULL");
-
-    BLEServiceList *prev = NULL;
-    BLEServiceList *cur = *serviceList;
-    while (cur != NULL)
-    {
-        if (!strcasecmp(cur->serviceInfo->bdAddress, bdAddress))
-        {
-            if (cur == *serviceList)
-            {
-                *serviceList = cur->next;
-
-                cur->next = NULL;
-                CAFreeBLEServiceList(cur);
-                CADecrementRegisteredServiceCount();
-                OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-                return CA_STATUS_OK;
-            }
-            else
-            {
-                prev->next = cur->next;
-
-                cur->next = NULL;
-                CAFreeBLEServiceList(cur);
-                CADecrementRegisteredServiceCount();
-                OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-                return CA_STATUS_OK;
-            }
-        }
-        else
-        {
-            prev = cur;
-            cur = cur->next;
-        }
-    }
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, " OUT");
-    return CA_STATUS_FAILED;
-}
-
-CAResult_t CAGetBLEServiceInfo(BLEServiceList *serviceList, const char *bdAddress,
-                               BLEServiceInfo **bleServiceInfo)
-{
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceList, TZ_BLE_CLIENT_UTIL_TAG, "Param serviceList is NULL");
-    VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_UTIL_TAG, "Param bleServiceInfo is NULL");
-    VERIFY_NON_NULL(bdAddress, TZ_BLE_CLIENT_UTIL_TAG, "Param bdAddress is NULL");
-
-
-    BLEServiceList *cur = serviceList;
-    *bleServiceInfo = NULL;
-    while (cur != NULL)
-    {
-        if (!strcasecmp(cur->serviceInfo->bdAddress, bdAddress))
-        {
-            *bleServiceInfo = cur->serviceInfo;
-            OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-            return CA_STATUS_OK;
-        }
-
-        cur = cur->next;
-    }
-
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, " OUT");
-    return CA_STATUS_FAILED;
-}
-
-CAResult_t CAGetBLEServiceInfoByPosition(BLEServiceList *serviceList, int32_t position,
-        BLEServiceInfo **bleServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceList, TZ_BLE_CLIENT_UTIL_TAG, "Param serviceList is NULL");
-    VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_UTIL_TAG, "Param bleServiceInfo is NULL");
-
-    if (0 > position)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "Position Invalid input !");
-        return CA_STATUS_INVALID_PARAM;
-    }
-
-    *bleServiceInfo = NULL;
-    int32_t count = 0;
-    BLEServiceList *cur = serviceList;
-    while (cur != NULL)
-    {
-        if (position == count)
-        {
-            *bleServiceInfo = cur->serviceInfo;
-            OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-            return CA_STATUS_OK;
-        }
-        count++;
-        cur = cur->next;
-    }
-    return CA_STATUS_FAILED;
-}
-
-void CAFreeBLEServiceList(BLEServiceList *serviceList)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-    while (serviceList)
-    {
-        BLEServiceList *temp = serviceList;
-        serviceList = serviceList->next;
-        CAFreeBLEServiceInfo(temp->serviceInfo);
-        OICFree(temp);
-    }
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-}
-
-void CAFreeBLEServiceInfo(BLEServiceInfo *bleServiceInfo)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-    if (bleServiceInfo)
-    {
-        if (bleServiceInfo->bdAddress)
-        {
-            bt_gatt_disconnect(bleServiceInfo->bdAddress);
-            OICFree(bleServiceInfo->bdAddress);
-            bt_gatt_destroy_attribute_handle(bleServiceInfo->service_clone);
-            bt_gatt_destroy_attribute_handle(bleServiceInfo->read_char);
-            bt_gatt_destroy_attribute_handle(bleServiceInfo->write_char);
-        }
-        OICFree(bleServiceInfo);
-    }
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-}
-
-CAResult_t CAVerifyOICServiceByUUID(const char* serviceUUID)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceUUID, TZ_BLE_CLIENT_UTIL_TAG, "Param serviceHandle is NULL");
-
-    if (strcasecmp(serviceUUID, CA_GATT_SERVICE_UUID) != 0)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "It is not OIC service!");
-        return CA_STATUS_FAILED;
-    }
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-CAResult_t CAVerifyOICServiceByServiceHandle(bt_gatt_attribute_h serviceHandle)
-{
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
-
-    VERIFY_NON_NULL(serviceHandle, TZ_BLE_CLIENT_UTIL_TAG, "Param serviceHandle is NULL");
-
-    char *uuid = NULL;
-    int ret = bt_gatt_get_service_uuid(serviceHandle, &uuid);
-
-    if (0 != ret || NULL == uuid)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "bt_gatt_get_service_uuid failed !");
-        return CA_STATUS_FAILED;
-    }
-
-    if (strcasecmp(uuid, CA_GATT_SERVICE_UUID) != 0)
-    {
-        OIC_LOG(ERROR, TZ_BLE_CLIENT_UTIL_TAG, "It is not OIC service!");
-        OICFree(uuid);
-        return CA_STATUS_FAILED;
-    }
-
-    OICFree(uuid);
-    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
-    return CA_STATUS_OK;
-}
-
-const char *CABTGetErrorMsg(bt_error_e err)
-{
-    const char *errStr = NULL;
-
-    switch (err)
-    {
-        case BT_ERROR_NONE:
-            errStr = "BT_ERROR_NONE";
-            break;
-        case BT_ERROR_CANCELLED:
-            errStr = "BT_ERROR_CANCELLED";
-            break;
-        case BT_ERROR_INVALID_PARAMETER:
-            errStr = "BT_ERROR_INVALID_PARAMETER";
-            break;
-        case BT_ERROR_OUT_OF_MEMORY:
-            errStr = "BT_ERROR_OUT_OF_MEMORY";
-            break;
-        case BT_ERROR_RESOURCE_BUSY:
-            errStr = "BT_ERROR_RESOURCE_BUSY";
-            break;
-        case BT_ERROR_TIMED_OUT:
-            errStr = "BT_ERROR_TIMED_OUT";
-            break;
-        case BT_ERROR_NOW_IN_PROGRESS:
-            errStr = "BT_ERROR_NOW_IN_PROGRESS";
-            break;
-        case BT_ERROR_NOT_INITIALIZED:
-            errStr = "BT_ERROR_NOT_INITIALIZED";
-            break;
-        case BT_ERROR_NOT_ENABLED:
-            errStr = "BT_ERROR_NOT_ENABLED";
-            break;
-        case BT_ERROR_ALREADY_DONE:
-            errStr = "BT_ERROR_ALREADY_DONE";
-            break;
-        case BT_ERROR_OPERATION_FAILED:
-            errStr = "BT_ERROR_OPERATION_FAILED";
-            break;
-        case BT_ERROR_NOT_IN_PROGRESS:
-            errStr = "BT_ERROR_NOT_IN_PROGRESS";
-            break;
-        case BT_ERROR_REMOTE_DEVICE_NOT_BONDED:
-            errStr = "BT_ERROR_REMOTE_DEVICE_NOT_BONDED";
-            break;
-        case BT_ERROR_AUTH_REJECTED:
-            errStr = "BT_ERROR_AUTH_REJECTED";
-            break;
-        case BT_ERROR_AUTH_FAILED:
-            errStr = "BT_ERROR_AUTH_FAILED";
-            break;
-        case BT_ERROR_REMOTE_DEVICE_NOT_FOUND:
-            errStr = "BT_ERROR_REMOTE_DEVICE_NOT_FOUND";
-            break;
-        case BT_ERROR_SERVICE_SEARCH_FAILED:
-            errStr = "BT_ERROR_SERVICE_SEARCH_FAILED";
-            break;
-        case BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED:
-            errStr = "BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED";
-            break;
-        case BT_ERROR_PERMISSION_DENIED:
-            errStr = "BT_ERROR_PERMISSION_DENIED";
-            break;
-        case BT_ERROR_SERVICE_NOT_FOUND:
-            errStr = "BT_ERROR_SERVICE_NOT_FOUND";
-            break;
-        case BT_ERROR_NOT_SUPPORTED:
-            errStr = "BT_ERROR_NOT_SUPPORTED";
-            break;
-        default:
-            errStr = "NOT Defined";
-            break;
-    }
-
-    return errStr;
-}
-
-
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableutil.h b/resource/csdk/connectivity/src/bt_le_adapter/tizen/cableutil.h
deleted file mode 100644 (file)
index e7fd434..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/* ****************************************************************
- *
- * Copyright 2014 Samsung Electronics 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.
- *
- ******************************************************************/
-
-/**
- * @file
- *
- * This file contains the util function for LE adapter. This maintains the
- * list of services an individual GATT Client connected to and operations on
- * that list, such as getting the service info with BD address or with
- * position etc. This is mainly useful for the multicast transmission of
- * data where client needs to have the info of all the services to which it
- * is connected.
- */
-
-#ifndef TZ_BLE_UTIL_H_
-#define TZ_BLE_UTIL_H_
-
-#include <bluetooth.h>
-
-#include "cacommon.h"
-
-/**
- * Information regarding the GATTServer.
- *
- * This structure holds the infomation about the GATTServer
- * in the service and the characteristic level.
- */
-typedef struct
-{
-    bt_gatt_attribute_h service_clone; /**< GATT attribute handler for the OIC service. */
-    bt_gatt_attribute_h read_char;     /**< GATT attribute handler for OIC read characteristic.
-                                            Server will read.*/
-    bt_gatt_attribute_h write_char;    /**< GATT attribute handler for OIC write characteristic.
-                                            server will write*/
-    char *bdAddress;                   /**< BD address where OIC service is running. */
-} BLEServiceInfo;
-
-/**
- * List of the BLEServiceInfo structures.
- *
- * A list of BLEServiceInfo and gives the info about all the
- * the registered services from the client side.
- */
-typedef struct _BLEServiceList
-{
-    BLEServiceInfo *serviceInfo;    /**< BLEServiceInfo structure from an OIC Server. */
-    struct _BLEServiceList *next;   /**< Next reference to the List. */
-} BLEServiceList;
-
-/**
- * Different characteristics types.
- *
- * This provides information of different characteristics
- * which will be added to OIC service.
- */
-typedef enum
-{
-    BLE_GATT_WRITE_CHAR = 0, /**< write_char This will be used to get the unicast response. */
-    BLE_GATT_READ_CHAR,      /**< read_char This will be used update value to OIC server. */
-    BLE_GATT_NOTIFY_CHAR     /**< Reserved char for the time being. */
-} CHAR_TYPE;
-
-/**
- * Stores the information required to set the descriptor value of the Service.
- */
-typedef struct gattCharDescriptor
-{
-    bt_gatt_attribute_h characteristic; /**< The attribute handle of descriptor. */
-    uint8_t *desc;                      /**< Descriptor handle of characteristic, in byte array. */
-    int total;                          /**< The total number of descriptor in a characteristic. */
-} stGattCharDescriptor_t;
-
-/**
- * Used to increment the registered service count.
- */
-void CAIncrementRegisteredServiceCount();
-
-/**
- * Used to decrement the registered service count.
- */
-void CADecrementRegisteredServiceCount();
-
-/**
- * Used to reset the registered service count.
- */
-void CAResetRegisteredServiceCount();
-
-/**
- * Used to get the total registered service count.
- * @return  Total registered service count.
- */
-int32_t  CAGetRegisteredServiceCount();
-
-/**
- * Used to create BLEServiceInfo structure with server handler and BD address will be
- * created.
- * @param[in] bdAddress        BD address of the device where GATTServer is running.
- * @param[in] service          service attribute handler.
- * @param[in] bleServiceInfo   Pointer where serviceInfo structure needs to be stored.
- *                             Memory will be allocated here and needs to be cleared by caller.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CACreateBLEServiceInfo(const char *bdAddress, bt_gatt_attribute_h service,
-                                  BLEServiceInfo **bleServiceInfo);
-
-/**
- * Used to append the characteristic info to the already created serviceInfo structure.
- *
- * @param[in] characteristic   Charecteristic attribute handler.
- * @param[in] type             Specifies whether its BLE_GATT_READ_CHAR or BLE_GATT_WRITE_CHAR
- * @param[in] bleServiceInfo   Pointer where serviceInfo structure needs to be appended with
- *                             char info.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAAppendBLECharInfo(bt_gatt_attribute_h characteristic, CHAR_TYPE type,
-                               BLEServiceInfo *bleServiceInfo);
-
-/**
- * Used to add the ServiceInfo structure to the Service List.
- *
- * @param[in] serviceList      Pointer to the ble service list which holds the info of list of
- *                             service registered from client.
- * @param[in] bleServiceInfo   Pointer where serviceInfo structure needs to be appended with
- *                             char info.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAAddBLEServiceInfoToList(BLEServiceList **serviceList,
-                BLEServiceInfo *bleServiceInfo);
-
-/**
- * Used to remove the ServiceInfo structure from the Service List.
- *
- * @param[in] serviceList      Pointer to the ble service list which holds the info of list of
- *                             service registered from client.
- * @param[in] bleServiceInfo   Pointer where serviceInfo structure needs to be appended with
- *                             char info.
- * @param[in] bdAddress        BD address of the device where GATTServer is disconnected.
- *
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CARemoveBLEServiceInfoToList(BLEServiceList **serviceList,
-                                        BLEServiceInfo *bleServiceInfo,
-                                        const char *bdAddress);
-
-/**
- * Used to get the serviceInfo from the list.
- *
- * @param[in] serviceList       Pointer to the ble service list which holds the info of list
- *                              of service registered from client.
- * @param[in] bdAddress         BD address of the device where GATTServer information is required.
- * @param[out] bleServiceInfo   Pointer where serviceInfo structure needs to provide the service
- *                              and char info.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAGetBLEServiceInfo(BLEServiceList *serviceList, const char *bdAddress,
-                               BLEServiceInfo **bleServiceInfo);
-
-/**
- * Used to get the serviceInfo from the list by position.
- *
- * @param[in] serviceList      Pointer to the ble service list which holds the info of list
- *                             of service registered from client.
- * @param[in] position         The service information of particular position in the list.
- * @param[out] bleServiceInfo  Pointer where serviceInfo structure needs to provide the service
- *                             and char info.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAGetBLEServiceInfoByPosition(BLEServiceList *serviceList, int32_t position,
-                                         BLEServiceInfo **bleServiceInfo);
-
-/**
- * Used to clear BLE service list.
- *
- * @param[in]  serviceList   Pointer to the ble service list which holds the info of list of
- *                           service registered from client.
- */
-void CAFreeBLEServiceList(BLEServiceList *serviceList);
-
-/**
- * Used to get remove particular BLE service info from list.
- * @param[in] serviceinfo   Pointer to the structure which needs to be cleared.
- */
-void CAFreeBLEServiceInfo(BLEServiceInfo *bleServiceInfo);
-
-/**
- * Used to check whether found handle is OIC service handle or not.
- *
- * @param[in] serviceHandle   Discovered service handle(unique identifier for service).
- * @return  STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAVerifyOICServiceByServiceHandle(bt_gatt_attribute_h serviceHandle);
-
-/**
- * Used to check whether UUID of the discovered device is OIC service or not.
- *
- * @param[in]  serviceUUID   Service UUID.
- * @return ::CA_STATUS_OK or Appropriate error code.
- * @retval ::CA_STATUS_OK  Successful.
- * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
- * @retval ::CA_STATUS_FAILED Operation failed.
- */
-CAResult_t CAVerifyOICServiceByUUID(const char* serviceUUID);
-
-/**
- * Used to get the Error message.
- * @param[in] err   Error code(::bt_error_e).
- * @return  Error string corresponding to the BT error code.
- */
-const char *CABTGetErrorMsg(bt_error_e err);
-
-#endif /* TZ_BLE_UTIL_H_ */
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c
new file mode 100644 (file)
index 0000000..1666724
--- /dev/null
@@ -0,0 +1,1091 @@
+/* ****************************************************************
+*
+* Copyright 2014 Samsung Electronics 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.
+*
+******************************************************************/
+
+#include "caleclient.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <pthread.h>
+#include <gio/gio.h>
+
+#include "camutex.h"
+#include "uarraylist.h"
+#include "caqueueingthread.h"
+#include "caadapterutils.h"
+#include "cafragmentation.h"
+#include "cagattservice.h"
+#include "oic_string.h"
+#include "oic_malloc.h"
+
+/**
+ * Logging tag for module name.
+ */
+#define TAG "OIC_CA_LE_CLIENT"
+
+#define MICROSECS_PER_SEC 1000000
+
+uint64_t const TIMEOUT = 30 * MICROSECS_PER_SEC;
+
+/**
+ * Flag to check if multicast is already in progress.
+ */
+static bool g_isMulticastInProgress = false;
+
+/**
+ * Pending multicast data list to be sent.
+ */
+static u_arraylist_t *g_multicastDataList = NULL;
+
+/**
+ * Mutex to synchronize the access to Pending multicast data list.
+ */
+static ca_mutex g_multicastDataListMutex = NULL;
+
+/**
+ * List of devices discovered.
+ */
+static u_arraylist_t *g_deviceDiscoveredList = NULL;
+
+/**
+ * Mutex to synchronize the access to discovered devices list.
+ */
+static ca_mutex g_deviceDiscoveredListMutex = NULL;
+
+/**
+ * Condition to start the timer for scanning.
+ */
+static ca_cond g_startTimerCond = NULL;
+
+/**
+ * Condition for scanning Time interval.
+ */
+static ca_cond g_scanningTimeCond = NULL;
+
+/**
+ * This contains the list of OIC services a client connect tot.
+ */
+static LEServerInfoList *g_LEServerList = NULL;
+
+/**
+ * Mutex to synchronize access to BleServiceList.
+ */
+static ca_mutex g_LEServerListMutex = NULL;
+
+/**
+ * Boolean variable to keep the state of the GATT Client.
+ */
+static bool g_isLEGattClientStarted = false;
+
+/**
+ * Mutex to synchronize access to the requestResponse callback to be called
+ * when the data needs to be sent from GATTClient.
+ */
+static ca_mutex g_LEReqRespClientCbMutex = NULL;
+
+/**
+ * Mutex to synchronize access to the requestResponse callback to be called
+ * when the data needs to be sent from GATTClient.
+ */
+static ca_mutex g_LEClientConnectMutex = NULL;
+
+/**
+ * Mutex to synchronize the calls to be done to the platform from GATTClient
+ * interfaces from different threads.
+ */
+static ca_mutex g_LEClientStateMutex = NULL;
+
+/**
+ * Mutex to synchronize the task to be pushed to thread pool.
+ */
+static ca_mutex g_LEClientThreadPoolMutex = NULL;
+
+/**
+ * Maintains the callback to be notified on receival of network packets from other
+ *           BLE devices
+ */
+static CABLEDataReceivedCallback g_LEClientDataReceivedCallback = NULL;
+
+/**
+ * callback to update the error to le adapter
+ */
+static CABLEErrorHandleCallback g_clientErrorCallback;
+
+/**
+ * gmainLoop to manage the threads to receive the callback from the platfrom.
+ */
+static GMainLoop *g_eventLoop = NULL;
+
+/**
+ * Reference to threadpool
+ */
+static ca_thread_pool_t g_LEClientThreadPool = NULL;
+
+bt_scan_filter_h g_scanFilter = NULL;
+
+bool CALEIsDeviceDiscovered(const char * address)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    if (g_deviceDiscoveredList)
+    {
+        ca_mutex_lock(g_deviceDiscoveredListMutex);
+        uint32_t arrayLength = u_arraylist_length(g_deviceDiscoveredList);
+        for (int i = 0; i < arrayLength; i++)
+        {
+            char *deviceAddr = u_arraylist_get(g_deviceDiscoveredList, i);
+            if (0 == strcasecmp(deviceAddr, address))
+            {
+                OIC_LOG(DEBUG, TAG, "Device Found");
+                ca_mutex_unlock(g_deviceDiscoveredListMutex);
+                return true;
+            }
+
+        }
+        ca_mutex_unlock(g_deviceDiscoveredListMutex);
+    }
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return false;
+}
+
+void CALEGattCharacteristicChangedCb(bt_gatt_h characteristic,
+                                     char *value,
+                                     int valueLen, void *userData)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    OIC_LOG_V(DEBUG, TAG, "Changed characteristic value length [%d]", valueLen);
+
+    ca_mutex_lock(g_LEReqRespClientCbMutex);
+    if (NULL == g_LEClientDataReceivedCallback)
+    {
+        OIC_LOG(ERROR, TAG, "Request response callback is not set");
+        ca_mutex_unlock(g_LEReqRespClientCbMutex);
+        return;
+    }
+
+    uint32_t sentLength = 0;
+    g_LEClientDataReceivedCallback(userData, (uint8_t *)value, valueLen, &sentLength);
+
+    OIC_LOG_V(DEBUG, TAG, "Sent data Length is %d", sentLength);
+
+    ca_mutex_unlock(g_LEReqRespClientCbMutex);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CALEGattCharacteristicWriteCb(int result, bt_gatt_h reqHandle, void *userData)
+{
+    OIC_LOG(DEBUG, TAG, "IN ");
+    OIC_LOG(DEBUG, TAG, "OUT ");
+}
+
+void CALEGattConnectionStateChangedCb(int result, bool connected,
+                                      const char *remoteAddress, void *userData)
+{
+    OIC_LOG(DEBUG, TAG, "IN ");
+
+    VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address is NULL");
+
+    // Start the scanning.
+    CAResult_t ret = CALEGattStartDeviceScanning();
+    if (CA_STATUS_OK != ret)
+    {
+        OIC_LOG(ERROR, TAG, "CALEGattStartDeviceDiscovery Failed");
+    }
+    // Signal the start timer.
+    ca_cond_signal(g_scanningTimeCond);
+
+    if (!connected)
+    {
+        OIC_LOG_V(DEBUG, TAG, "DisConnected from [%s] ", remoteAddress);
+    }
+    else
+    {
+        OIC_LOG_V(DEBUG, TAG, "Connected to [%s] ", remoteAddress);
+
+        char *addr = OICStrdup(remoteAddress);
+
+        ca_mutex_lock(g_LEClientThreadPoolMutex);
+        if (NULL == g_LEClientThreadPool)
+        {
+            OIC_LOG(ERROR, TAG, "g_LEClientThreadPool is NULL");
+            OICFree(addr);
+            ca_mutex_unlock(g_LEClientThreadPoolMutex);
+            return;
+        }
+
+        ret = ca_thread_pool_add_task(g_LEClientThreadPool, CADiscoverLEServicesThread,
+                                      addr);
+        if (CA_STATUS_OK != ret)
+        {
+            OIC_LOG_V(ERROR, TAG, "ca_thread_pool_add_task failed with ret [%d]", ret);
+            OICFree(addr);
+        }
+        ca_mutex_unlock(g_LEClientThreadPoolMutex);
+    }
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CALEAdapterScanResultCb(int result, bt_adapter_le_device_scan_result_info_s *scanInfo,
+                             void *userData)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL_VOID(scanInfo, TAG, "scanInfo");
+    VERIFY_NON_NULL_VOID(scanInfo->remote_address, TAG, "scanInfo->remote_address");
+
+    OIC_LOG_V(DEBUG, TAG, "Remote Address [%s]", scanInfo->remote_address);
+    OIC_LOG_V(DEBUG, TAG, "Scan Result [%d]", result);
+    OIC_LOG_V(DEBUG, TAG,
+              " Adv data len [%d] Scan data len[%d]RSSI [%d] Addr_type [%d] ",
+              scanInfo->adv_data_len, scanInfo->scan_data_len, scanInfo->rssi,
+              scanInfo->address_type);
+
+    // Check if device is already discovered.
+    if (CALEIsDeviceDiscovered(scanInfo->remote_address))
+    {
+        OIC_LOG_V(INFO, TAG, "Device[%s] is already discovered", scanInfo->remote_address);
+        return;
+    }
+
+    // Stop the scan before invoking bt_gatt_connect().
+    CALEGattStopDeviceScanning();
+
+    ca_mutex_lock(g_deviceDiscoveredListMutex);
+    // Add the the device Discovered list.
+    if (NULL == g_deviceDiscoveredList)
+    {
+        g_deviceDiscoveredList = u_arraylist_create();
+    }
+    char *deviceAddr = OICStrdup(scanInfo->remote_address);
+    u_arraylist_add(g_deviceDiscoveredList, (void *) deviceAddr);
+    ca_mutex_unlock(g_deviceDiscoveredListMutex);
+
+    size_t len = strlen(scanInfo->remote_address);
+
+    char *addr = (char *)OICMalloc(sizeof(char) * (len + 1));
+    VERIFY_NON_NULL_VOID(addr, TAG, "Malloc failed");
+
+    strncpy(addr, scanInfo->remote_address, len + 1);
+
+    OIC_LOG_V(DEBUG, TAG,
+              "Trying to do Gatt connection to [%s]", addr);
+
+    ca_mutex_lock(g_LEClientThreadPoolMutex);
+    if (NULL == g_LEClientThreadPool)
+    {
+        OIC_LOG(ERROR, TAG, "g_LEClientThreadPool is NULL");
+        OICFree(addr);
+        ca_mutex_unlock(g_LEClientThreadPoolMutex);
+        return;
+    }
+
+    CAResult_t res = ca_thread_pool_add_task(g_LEClientThreadPool, CAGattConnectThread, addr);
+    if (CA_STATUS_OK != res)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "ca_thread_pool_add_task failed with ret [%d]", res);
+        OICFree(addr);
+    }
+    ca_mutex_unlock(g_LEClientThreadPoolMutex);
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CASetLEClientThreadPoolHandle(ca_thread_pool_t handle)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    ca_mutex_lock(g_LEClientThreadPoolMutex);
+    g_LEClientThreadPool = handle;
+    ca_mutex_unlock(g_LEClientThreadPoolMutex);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CASetLEReqRespClientCallback(CABLEDataReceivedCallback callback)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    ca_mutex_lock(g_LEReqRespClientCbMutex);
+
+    g_LEClientDataReceivedCallback = callback;
+
+    ca_mutex_unlock(g_LEReqRespClientCbMutex);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CASetBLEClientErrorHandleCallback(CABLEErrorHandleCallback callback)
+{
+    g_clientErrorCallback = callback;
+}
+
+CAResult_t CAStartLEGattClient()
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    ca_mutex_lock(g_LEClientThreadPoolMutex);
+    if (NULL == g_LEClientThreadPool)
+    {
+        OIC_LOG(ERROR, TAG, "gBleServerThreadPool is NULL");
+        CATerminateGattClientMutexVariables();
+        ca_mutex_unlock(g_LEClientThreadPoolMutex);
+        return CA_STATUS_FAILED;
+    }
+
+    CAResult_t result = ca_thread_pool_add_task(g_LEClientThreadPool, CAStartLEGattClientThread,
+                                     NULL);
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG(ERROR, TAG, "ca_thread_pool_add_task failed");
+        CATerminateGattClientMutexVariables();
+        ca_mutex_unlock(g_LEClientThreadPoolMutex);
+        return CA_STATUS_FAILED;
+    }
+    ca_mutex_unlock(g_LEClientThreadPoolMutex);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CAStartLEGattClientThread(void *data)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    ca_mutex_lock(g_LEClientStateMutex);
+    if (true  == g_isLEGattClientStarted)
+    {
+        OIC_LOG(ERROR, TAG, "Gatt Client is already running!!");
+        ca_mutex_unlock(g_LEClientStateMutex);
+        return;
+    }
+
+    CAResult_t  result = CALEGattSetCallbacks();
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG(ERROR, TAG, "CABleGattSetCallbacks Failed");
+        ca_mutex_unlock(g_LEClientStateMutex);
+        CATerminateLEGattClient();
+        return;
+    }
+
+    g_isLEGattClientStarted = true;
+    ca_mutex_unlock(g_LEClientStateMutex);
+
+    ca_mutex_lock(g_LEClientThreadPoolMutex);
+    if (NULL == g_LEClientThreadPool)
+    {
+        OIC_LOG(ERROR, TAG, "gBleServerThreadPool is NULL");
+        CATerminateGattClientMutexVariables();
+        ca_mutex_unlock(g_LEClientThreadPoolMutex);
+        return;
+    }
+
+    result = ca_thread_pool_add_task(g_LEClientThreadPool, CAStartTimerThread,
+                                     NULL);
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG(ERROR, TAG, "ca_thread_pool_add_task failed");
+        ca_mutex_unlock(g_LEClientThreadPoolMutex);
+        return;
+    }
+    ca_mutex_unlock(g_LEClientThreadPoolMutex);
+
+    OIC_LOG(DEBUG, TAG, "Giving the control to threadPool");
+
+    GMainContext *thread_context = g_main_context_new();
+
+    g_eventLoop = g_main_loop_new(thread_context, FALSE);
+
+    g_main_context_push_thread_default(thread_context);
+
+    g_main_loop_run(g_eventLoop);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CAStartTimerThread(void *data)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    while (g_isLEGattClientStarted)
+    {
+        ca_mutex_lock(g_multicastDataListMutex);
+        if (!g_isMulticastInProgress)
+        {
+            OIC_LOG(DEBUG, TAG, "waiting....");
+            ca_cond_wait(g_startTimerCond, g_multicastDataListMutex);
+            OIC_LOG(DEBUG, TAG, "Wake up");
+            g_isMulticastInProgress = true;
+        }
+
+        // Timed conditional wait for stopping the scan.
+        CAWaitResult_t ret = ca_cond_wait_for(g_scanningTimeCond, g_multicastDataListMutex,
+                                              TIMEOUT);
+        if (CA_WAIT_TIMEDOUT == ret)
+        {
+            OIC_LOG(DEBUG, TAG, "Scan is timed Out");
+            // Call stop scan.
+            CALEGattStopDeviceScanning();
+
+            // Clear the data list and device list.
+            u_arraylist_destroy(g_multicastDataList);
+            g_multicastDataList = NULL;
+
+            ca_mutex_lock(g_deviceDiscoveredListMutex);
+            u_arraylist_destroy(g_deviceDiscoveredList);
+            g_deviceDiscoveredList = NULL;
+            ca_mutex_unlock(g_deviceDiscoveredListMutex);
+
+            g_isMulticastInProgress = false;
+        }
+        ca_mutex_unlock(g_multicastDataListMutex);
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CAStopLEGattClient()
+{
+    OIC_LOG(DEBUG,  TAG, "IN");
+
+    ca_mutex_lock(g_LEClientStateMutex);
+
+    if (false == g_isLEGattClientStarted)
+    {
+        OIC_LOG(ERROR, TAG, "Gatt Client is not running to stop");
+        ca_mutex_unlock(g_LEClientStateMutex);
+        return;
+    }
+
+    CALEGattUnSetCallbacks();
+
+    CALEGattStopDeviceScanning();
+
+    g_isLEGattClientStarted = false;
+
+    // Signal the conditions waiting in Start timer.
+    ca_cond_signal(g_startTimerCond);
+    ca_cond_signal(g_scanningTimeCond);
+
+    // Destroy the multicast data list and device list if not empty.
+    if (NULL != g_multicastDataList)
+    {
+        ca_mutex_lock(g_multicastDataListMutex);
+        u_arraylist_destroy(g_multicastDataList);
+        g_multicastDataList = NULL;
+        ca_mutex_unlock(g_multicastDataListMutex);
+    }
+
+    if (NULL != g_deviceDiscoveredList)
+    {
+        ca_mutex_lock(g_deviceDiscoveredListMutex);
+        u_arraylist_destroy(g_deviceDiscoveredList);
+        g_deviceDiscoveredList = NULL;
+        ca_mutex_unlock(g_deviceDiscoveredListMutex);
+    }
+
+    ca_mutex_lock(g_LEServerListMutex);
+    CAFreeLEServerList(g_LEServerList);
+    g_LEServerList = NULL;
+    ca_mutex_unlock(g_LEServerListMutex);
+
+    CAResetRegisteredServiceCount();
+
+    GMainContext  *context_event_loop = NULL;
+    // Required for waking up the thread which is running in gmain loop
+    if (NULL != g_eventLoop)
+    {
+        context_event_loop = g_main_loop_get_context(g_eventLoop);
+    }
+    if (context_event_loop)
+    {
+        OIC_LOG_V(DEBUG,  TAG, "g_eventLoop context %x", context_event_loop);
+        g_main_context_wakeup(context_event_loop);
+
+        // Kill g main loops and kill threads.
+        g_main_loop_quit(g_eventLoop);
+    }
+    else
+    {
+        OIC_LOG(ERROR, TAG, "g_eventLoop context is NULL");
+    }
+
+    ca_mutex_unlock(g_LEClientStateMutex);
+
+    OIC_LOG(DEBUG,  TAG, "OUT");
+}
+
+CAResult_t CAInitializeLEGattClient()
+{
+    OIC_LOG(DEBUG, TAG, "Initialize GATT Client");
+    CAResult_t res = CAInitGattClientMutexVariables();
+    if (CA_STATUS_OK != res)
+    {
+        OIC_LOG(ERROR, TAG, "CAInitGattClientMutexVariables failed!");
+        CATerminateGattClientMutexVariables();
+        return CA_STATUS_FAILED;
+    }
+    return res;
+}
+
+void CATerminateLEGattClient()
+{
+    OIC_LOG(DEBUG,  TAG, "IN");
+
+    CATerminateGattClientMutexVariables();
+
+    OIC_LOG(DEBUG,  TAG, "OUT");
+}
+
+CAResult_t CAInitGattClientMutexVariables()
+{
+    OIC_LOG(DEBUG,  TAG, "IN");
+    if (NULL == g_LEClientStateMutex)
+    {
+        g_LEClientStateMutex = ca_mutex_new();
+        if (NULL == g_LEClientStateMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_LEServerListMutex)
+    {
+        g_LEServerListMutex = ca_mutex_new();
+        if (NULL == g_LEServerListMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_LEReqRespClientCbMutex)
+    {
+        g_LEReqRespClientCbMutex = ca_mutex_new();
+        if (NULL == g_LEReqRespClientCbMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_LEClientThreadPoolMutex)
+    {
+        g_LEClientThreadPoolMutex = ca_mutex_new();
+        if (NULL == g_LEClientThreadPoolMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_LEClientConnectMutex)
+    {
+        g_LEClientConnectMutex = ca_mutex_new();
+        if (NULL == g_LEClientConnectMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_multicastDataListMutex)
+    {
+        g_multicastDataListMutex = ca_mutex_new();
+        if (NULL == g_multicastDataListMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_deviceDiscoveredListMutex)
+    {
+        g_deviceDiscoveredListMutex = ca_mutex_new();
+        if (NULL == g_deviceDiscoveredListMutex)
+        {
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_startTimerCond)
+    {
+        g_startTimerCond = ca_cond_new();
+        if (NULL == g_startTimerCond)
+        {
+            OIC_LOG(ERROR, TAG, "ca_cond_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    if (NULL == g_scanningTimeCond)
+    {
+        g_scanningTimeCond = ca_cond_new();
+        if (NULL == g_scanningTimeCond)
+        {
+            OIC_LOG(ERROR, TAG, "ca_cond_new failed");
+            return CA_STATUS_FAILED;
+        }
+    }
+
+    OIC_LOG(DEBUG,  TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CATerminateGattClientMutexVariables()
+{
+    OIC_LOG(DEBUG,  TAG, "IN");
+
+    ca_mutex_free(g_LEClientStateMutex);
+    g_LEClientStateMutex = NULL;
+
+    ca_mutex_free(g_LEServerListMutex);
+    g_LEServerListMutex = NULL;
+
+    ca_mutex_free(g_LEReqRespClientCbMutex);
+    g_LEReqRespClientCbMutex = NULL;
+
+    ca_mutex_free(g_LEClientConnectMutex);
+    g_LEClientConnectMutex = NULL;
+
+    ca_mutex_free(g_LEClientThreadPoolMutex);
+    g_LEClientThreadPoolMutex = NULL;
+
+    ca_mutex_free(g_multicastDataListMutex);
+    g_multicastDataListMutex = NULL;
+
+    ca_mutex_free(g_deviceDiscoveredListMutex);
+    g_deviceDiscoveredListMutex = NULL;
+
+    ca_cond_free(g_startTimerCond);
+    g_startTimerCond = NULL;
+
+    ca_cond_free(g_scanningTimeCond);
+    g_scanningTimeCond = NULL;
+
+    OIC_LOG(DEBUG,  TAG, "OUT");
+}
+
+CAResult_t CALEGattSetCallbacks()
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    int ret = bt_gatt_set_connection_state_changed_cb(CALEGattConnectionStateChangedCb, NULL);
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_set_connection_state_changed_cb Failed with return as [%s ]",
+                  CALEGetErrorMsg(ret));
+        return CA_STATUS_FAILED;
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CALEGattUnSetCallbacks()
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    bt_gatt_unset_connection_state_changed_cb();
+
+    int numOfServersConnected = CAGetRegisteredServiceCount();
+    LEServerInfo *leServerInfo = NULL;
+
+    for (int32_t index = 0; index < numOfServersConnected; index++)
+    {
+        CAGetLEServerInfoByPosition(g_LEServerList, index, &leServerInfo);
+        bt_gatt_client_unset_characteristic_value_changed_cb(leServerInfo->readChar);
+    }
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+CAResult_t CALEGattStartDeviceScanning()
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    int ret = bt_adapter_le_start_scan(CALEAdapterScanResultCb, NULL);
+    if(BT_ERROR_NONE != ret)
+    {
+        OIC_LOG_V(ERROR, TAG, "bt_adapter_le_start_scan failed[%s]",
+                  CALEGetErrorMsg(ret));
+        return CA_STATUS_FAILED;
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CALEGattStopDeviceScanning()
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    int ret = bt_adapter_le_stop_scan();
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG_V(ERROR, TAG, "bt_adapter_le_stop_scan failed[%s]",
+                  CALEGetErrorMsg(ret));
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CAGattConnectThread (void *remoteAddress)
+{
+    OIC_LOG(DEBUG, TAG, "IN ");
+
+    VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address is NULL");
+
+    char *address  = (char *)remoteAddress;
+
+    OIC_LOG_V(DEBUG, TAG, "remote address is [%s]", address);
+
+    CAResult_t result = CALEGattConnect(address);
+
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG_V(ERROR, TAG, "bt_gatt_connect failed for [%s]", address);
+    }
+
+    OICFree(address);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+CAResult_t CALEGattConnect(const char *remoteAddress)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL_RET(remoteAddress, TAG,
+                        "remote address is NULL", CA_STATUS_FAILED);
+
+    ca_mutex_lock(g_LEClientConnectMutex);
+
+    int ret = bt_gatt_connect(remoteAddress, true);
+
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG_V(ERROR, TAG, "bt_gatt_connect Failed with ret value [%s] ",
+                  CALEGetErrorMsg(ret));
+        ca_mutex_unlock(g_LEClientConnectMutex);
+        return CA_STATUS_FAILED;
+    }
+    ca_mutex_unlock(g_LEClientConnectMutex);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CALEGattDisConnect(const char *remoteAddress)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL_RET(remoteAddress, TAG,
+                        "remote address is NULL", CA_STATUS_FAILED);
+
+    int ret = bt_gatt_disconnect(remoteAddress);
+
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG_V(ERROR, TAG, "bt_gatt_disconnect Failed with ret value [%d] ",
+                  CALEGetErrorMsg(ret));
+        return CA_STATUS_FAILED;
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CADiscoverLEServicesThread (void *remoteAddress)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address is NULL");
+
+    char *address  = (char *)remoteAddress;
+
+    CAResult_t result = CALEGattDiscoverServices(address);
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG(ERROR, TAG, "CALEGattDiscoverServices failed");
+    }
+
+    OICFree(address);
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+CAResult_t CALEGattDiscoverServices(const char *remoteAddress)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL_RET(remoteAddress, TAG,
+                        "remote address is NULL", CA_STATUS_FAILED);
+
+    bt_gatt_client_h clientHandle = NULL;
+    int32_t ret = bt_gatt_client_create(remoteAddress, &clientHandle);
+    if (BT_ERROR_NONE != ret || NULL == clientHandle)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_client_create Failed with ret value [%s] ", CALEGetErrorMsg(ret));
+        CALEGattDisConnect(remoteAddress);
+        return CA_STATUS_FAILED;
+    }
+
+    bt_gatt_h serviceHandle = NULL;
+    ret = bt_gatt_client_get_service(clientHandle, CA_GATT_SERVICE_UUID, &serviceHandle);
+    if (BT_ERROR_NONE != ret || NULL == serviceHandle)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_client_get_service Failed with ret value [%s] ", CALEGetErrorMsg(ret));
+        bt_gatt_client_destroy(clientHandle);
+        CALEGattDisConnect(remoteAddress);
+        return CA_STATUS_FAILED;
+    }
+
+    // Server will read data on this characteristic.
+    bt_gatt_h writeChrHandle = NULL;
+    ret = bt_gatt_service_get_characteristic(serviceHandle, CA_GATT_REQUEST_CHRC_UUID,
+                                             &writeChrHandle);
+    if (BT_ERROR_NONE != ret || NULL == writeChrHandle)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_service_get_characteristic Failed with ret value [%s] ",
+                  CALEGetErrorMsg(ret));
+        bt_gatt_client_destroy(clientHandle);
+        CALEGattDisConnect(remoteAddress);
+        return CA_STATUS_FAILED;
+    }
+
+    // Server will notify data on this characteristic.
+    bt_gatt_h readChrHandle = NULL;
+    ret = bt_gatt_service_get_characteristic(serviceHandle, CA_GATT_RESPONSE_CHRC_UUID,
+                                             &readChrHandle);
+    if (BT_ERROR_NONE != ret || NULL == readChrHandle)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_service_get_characteristic Failed with ret value [%s] ",
+                  CALEGetErrorMsg(ret));
+        bt_gatt_client_destroy(clientHandle);
+        CALEGattDisConnect(remoteAddress);
+        return CA_STATUS_FAILED;
+    }
+
+
+    //TODO: This data has to be freed while unsetting the callback.
+    char *addr = OICStrdup(remoteAddress);
+    ret = bt_gatt_client_set_characteristic_value_changed_cb(readChrHandle,
+                                                             CALEGattCharacteristicChangedCb,
+                                                             (void *)addr);
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_client_set_characteristic_value_changed_cb Failed with ret value [%s]",
+                  CALEGetErrorMsg(ret));
+        bt_gatt_client_destroy(clientHandle);
+        CALEGattDisConnect(remoteAddress);
+        return CA_STATUS_FAILED;
+    }
+
+    LEServerInfo *serverInfo = (LEServerInfo *)OICCalloc(1, sizeof(LEServerInfo));
+    if (NULL == serverInfo)
+    {
+        OIC_LOG(ERROR, TAG, "Malloc failed");
+        CALEGattDisConnect(remoteAddress);
+        return CA_MEMORY_ALLOC_FAILED;
+    }
+    serverInfo->clientHandle = clientHandle;
+    serverInfo->serviceHandle = serviceHandle;
+    serverInfo->readChar = readChrHandle;
+    serverInfo->writeChar = writeChrHandle;
+    serverInfo->remoteAddress = OICStrdup(remoteAddress);
+
+    ca_mutex_lock(g_LEServerListMutex);
+    CAResult_t result = CAAddLEServerInfoToList(&g_LEServerList, serverInfo);
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG(ERROR, TAG, "CAAddBLEClientInfoToList failed");
+        bt_gatt_client_destroy(clientHandle);
+        CALEGattDisConnect(remoteAddress);
+        return CA_STATUS_FAILED;
+    }
+    ca_mutex_unlock(g_LEServerListMutex);
+
+    // Send the data of pending multicast data list if any.
+    if (g_multicastDataList)
+    {
+        ca_mutex_lock(g_multicastDataListMutex);
+        uint32_t arrayLength = u_arraylist_length(g_multicastDataList);
+        for (int i = 0; i < arrayLength; i++)
+        {
+            CALEData_t *multicastData = u_arraylist_get(g_multicastDataList, i);
+            if (NULL == multicastData)
+            {
+                OIC_LOG(DEBUG, TAG, "multicastData is NULL");
+                continue;
+            }
+            CAUpdateCharacteristicsToGattServer(remoteAddress, multicastData->data,
+                                                multicastData->dataLen, LE_UNICAST, 0);
+        }
+        ca_mutex_unlock(g_multicastDataListMutex);
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t  CAUpdateCharacteristicsToGattServer(const char *remoteAddress,
+                                                const uint8_t *data, const uint32_t dataLen,
+                                                CALETransferType_t type, const int32_t position)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL(data, TAG, "data is NULL");
+
+    if (0 >= dataLen)
+    {
+        OIC_LOG(ERROR, TAG, "dataLen is less than or equal zero. Invalid input!");
+        return CA_STATUS_INVALID_PARAM;
+    }
+
+    LEServerInfo *leServerInfo = NULL;
+    CAResult_t ret =  CA_STATUS_FAILED;
+
+    ca_mutex_lock(g_LEServerListMutex);
+    if (LE_UNICAST == type)
+    {
+        ret = CAGetLEServerInfo(g_LEServerList, remoteAddress, &leServerInfo);
+    }
+    else if (LE_MULTICAST == type)
+    {
+        ret = CAGetLEServerInfoByPosition(g_LEServerList, position, &leServerInfo);
+    }
+    ca_mutex_unlock(g_LEServerListMutex);
+
+    if (CA_STATUS_OK != ret)
+    {
+        OIC_LOG(ERROR, TAG, "CAGetBLEServiceInfoByPosition is failed");
+        return CA_STATUS_FAILED;
+    }
+
+    VERIFY_NON_NULL(leServerInfo, TAG, "bleServiceInfo is NULL");
+
+    OIC_LOG_V(DEBUG, TAG, "Updating the data of length [%d] to [%s] ", dataLen,
+              leServerInfo->remoteAddress);
+
+    int result = bt_gatt_set_value(leServerInfo->writeChar, (char *)data, dataLen);
+
+    if (BT_ERROR_NONE != result)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_set_value Failed with return val [%s]",
+                  CALEGetErrorMsg(result));
+        return CA_STATUS_FAILED;
+    }
+
+    result = bt_gatt_client_write_value(leServerInfo->writeChar, CALEGattCharacteristicWriteCb,
+                                        NULL);
+    if (BT_ERROR_NONE != result)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_client_write_value Failed with return val [%s]",
+                  CALEGetErrorMsg(result));
+        return CA_STATUS_FAILED;
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CAUpdateCharacteristicsToAllGattServers(const uint8_t *data, uint32_t dataLen)
+{
+    OIC_LOG(DEBUG,  TAG, "IN");
+
+    VERIFY_NON_NULL(data, TAG, "data is NULL");
+
+    if (0 >= dataLen)
+    {
+        OIC_LOG(ERROR, TAG, "dataLen is less than or equal zero. Invalid input !");
+        return CA_STATUS_INVALID_PARAM;
+    }
+
+    int numOfServersConnected = CAGetRegisteredServiceCount();
+
+    // Send data to already connected devices.
+    for (int32_t pos = 0; pos < numOfServersConnected; pos++)
+    {
+        /*remoteAddress will be NULL.
+          Since we have to send to all destinations. pos will be used for getting remote address.
+         */
+        int32_t ret = CAUpdateCharacteristicsToGattServer(NULL, data, dataLen, LE_MULTICAST, pos);
+
+        if (CA_STATUS_OK != ret)
+        {
+            OIC_LOG_V(ERROR, TAG,
+                      "CAUpdateCharacteristicsToGattServer Failed with return val [%d] ", ret);
+            g_clientErrorCallback(NULL, data, dataLen, ret);
+        }
+    }
+
+    // Add the data to pending list.
+    CALEData_t *multicastData = (CALEData_t *)OICCalloc(1, sizeof(CALEData_t));
+    if (NULL == multicastData)
+    {
+        OIC_LOG(ERROR, TAG, "Calloc failed");
+        goto exit;
+    }
+    multicastData->data = OICCalloc(1, dataLen);
+    if (NULL == multicastData->data)
+    {
+        OIC_LOG(ERROR, TAG, "Calloc failed");
+        goto exit;
+    }
+    memcpy(multicastData->data, data, dataLen);
+    multicastData->dataLen = dataLen;
+
+    ca_mutex_lock(g_multicastDataListMutex);
+    if (NULL == g_multicastDataList)
+    {
+        g_multicastDataList = u_arraylist_create();
+    }
+    u_arraylist_add(g_multicastDataList, (void *)multicastData);
+    ca_mutex_unlock(g_multicastDataListMutex);
+
+    // Start the scanning.
+    CAResult_t result = CALEGattStartDeviceScanning();
+    if (CA_STATUS_OK != result)
+    {
+        OIC_LOG(ERROR, TAG, "CALEGattStartDeviceDiscovery Failed");
+        goto exit;
+    }
+
+    // Start the timer by signalling it.
+    ca_cond_signal(g_startTimerCond);
+
+exit:
+    OIC_LOG(DEBUG, TAG, "OUT ");
+    return CA_STATUS_OK;
+}
+
+
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.h b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.h
new file mode 100644 (file)
index 0000000..32b4485
--- /dev/null
@@ -0,0 +1,202 @@
+/* ****************************************************************
+*
+* Copyright 2014 Samsung Electronics 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.
+*
+******************************************************************/
+
+/**
+ * @file
+ *
+ * This file contains the functionalities of GATT Client. Functionalities
+ * like LE device discovery, connecting to the LE device with OIC service,
+ * registering to the service and there characteristics, registering to the
+ * change in the charateristics, setting the value of the characteristcs
+ * for the request and response will be done here.
+ */
+
+#ifndef TZ_BLE_CLIENT_H_
+#define TZ_BLE_CLIENT_H_
+
+#include <bluetooth.h>
+#include <bluetooth_type.h>
+#include <bluetooth_type_internal.h>
+#include <bluetooth_internal.h>
+
+#include "cacommon.h"
+#include "caadapterutils.h"
+#include "caleutil.h"
+#include "caadapterinterface.h"
+#include "logger.h"
+#include "cathreadpool.h"
+#include "caleinterface.h"
+#include "oic_malloc.h"
+
+
+/**
+ * This callback is called when a characteristic value is changed by the GATT server.
+ *
+ * @param[in]  characteristic The attribute handle of characteristic.
+ * @param[in]  value          Value of the characteristics of a service.
+ * @param[in]  valueLen       Length of data.
+ * @param[in]  userData       The user data passed from the request function.
+ */
+void CALEGattCharacteristicChangedCb(bt_gatt_h characteristic,
+                                     char *value, int valueLen, void *userData);
+/**
+ * This callback will be called when the client write request is completed.
+ *
+ * @param[in]  result    Result of write value.
+ * @param[in]  reqHandle The request GATT handle.
+ * @param[in]  userData  User context
+ */
+void CALEGattCharacteristicWriteCb(int result, bt_gatt_h reqHandle, void *userData);
+
+/**
+ * This is the callback which will be called whenever there is change in gatt connection
+ * with server(Connected/Disconnected)
+ *
+ * @param[in]  result        The result of connection state change.
+ * @param[in]  connected     State of connection
+ * @param[in]  remoteAddress Mac address of the remote device in which we made connection.
+ * @param[in]  userData      The user data passed from the request function
+ */
+void CALEGattConnectionStateChangedCb(int result, bool connected,
+                                      const char *remoteAddress,void *userData);
+
+/**
+ * This is the callback which will be called when LE advertisement is found.
+ *
+ * @param[in]  result         The result of Scanning
+ * @param[in]  scanInfo       Remote Device information.
+ * @param[in]  userData       The user data passed from the request function
+ */
+void CALEAdapterScanResultCb(int result, bt_adapter_le_device_scan_result_info_s *scanInfo,
+                             void *userData);
+
+/**
+ * This thread will be used to initialize the Gatt Client and start device discovery.
+ * 1. Setting neccessary callbacks for connection, characteristics changed and discovery.
+ * 2. Start device discovery
+ *
+ * @param[in] data Currently it will be NULL(no parameter)
+ */
+void CAStartLEGattClientThread(void *data);
+
+/**
+ * This thread will be used to Start the timer for scanning.
+ *
+ * @param[in] data Currently it will be NULL(no parameter)
+ */
+void CAStartTimerThread(void *data);
+
+/**
+ * Used to initialize all required mutex variable for Gatt Client implementation.
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CAInitGattClientMutexVariables();
+
+/**
+ * Used to terminate all required mutex variable for Gatt Client implementation.
+ */
+void CATerminateGattClientMutexVariables();
+
+/**
+ * Used to register required callbacks to LE platform(connection, discovery, etc).
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CALEGattSetCallbacks();
+
+/**
+ * Used to unset all the registerd callbacks to BLE platform.
+ */
+void CALEGattUnSetCallbacks();
+
+/**
+ * Used to start LE Scanning.
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CALEGattStartDeviceScanning();
+
+/**
+ * Used to stop LE discovery for BLE  devices.
+ */
+void CALEGattStopDeviceScanning();
+
+/**
+ * This is the thread  which will be used for making gatt connection with
+ * remote devices.
+ * @param[in] remoteAddress MAC address of remote device to connect.
+ */
+void CAGattConnectThread (void *remoteAddress);
+
+/**
+ * Used to do connection with remote device.
+ *
+ * @param[in] remoteAddress Remote address inwhich we wants to connect with.
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CALEGattConnect(const char *remoteAddress);
+
+/**
+ * Used to do disconnection with remote device.
+ * @param[in] remoteAddress Remote address inwhich we wants to disconnect with.
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CALEGattDisConnect(const char *remoteAddress);
+
+/**
+ * This is thread which will be spawned for discovering ble services. Once
+ * called discover api, then it will be terminated.
+ * @param[in] remoteAddress Mac address of the remote device in which we
+ *                           want to search services.
+ */
+void CADiscoverLEServicesThread (void *remoteAddress);
+
+/**
+ * Used to discover the services and characteristics that is advertised by Gatt
+ * Server.
+ *
+ * @param[in] remoteAddress MAC address of remote device in which we want to discover
+ *                      the services and characteristics.
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CALEGattDiscoverServices(const char *remoteAddress);
+#endif /* TZ_BLE_CLIENT_H_ */
 #include<stdio.h>
 #include<stdlib.h>
 #include<string.h>
+#include<glib.h>
 #include<arpa/inet.h>
 #include<sys/types.h>
 #include<sys/socket.h>
 #include<netinet/in.h>
 
 #include <bluetooth.h>
+#include <bluetooth_internal.h>
 #include <bluetooth_type.h>
-#include <bluetooth_product.h>
 
 
 #include "camutex.h"
 #include "caadapterutils.h"
 
 /**
- * @def TZ_LE_NWK_MONITOR_TAG
- * @brief Logging tag for module name
+ * Logging tag for module name
  */
-#define TZ_LE_NWK_MONITOR_TAG "TZ_BLE_ADAPTER_CONTROLLER"
+#define TAG "OIC_CA_LE_MONITOR"
+
+static GMainLoop *g_mainloop = NULL;
+static ca_thread_pool_t g_threadPoolHandle = NULL;
 
 /**
- * @var g_bleDeviceStateChangedCallback
- * @brief Maintains the callback to be notified on device state changed.
+ * Maintains the callback to be notified on device state changed.
  */
 static CALEDeviceStateChangedCallback g_bleDeviceStateChangedCallback = NULL;
 
 /**
- * @var g_bleDeviceStateChangedCbMutex
- * @brief Mutex to synchronize access to the deviceStateChanged Callback when the state
+ * Mutex to synchronize access to the deviceStateChanged Callback when the state
  *           of the LE adapter gets change.
  */
 static ca_mutex g_bleDeviceStateChangedCbMutex = NULL;
 
 /**
-* @fn  CALEAdapterStateChangedCb
-* @brief  This is the callback which will be called when the adapter state gets changed.
+* This is the callback which will be called when the adapter state gets changed.
 *
 * @param result         [IN] Result of the query done to the platform.
 * @param adapter_state  [IN] State of the LE adapter.
@@ -69,66 +69,116 @@ static ca_mutex g_bleDeviceStateChangedCbMutex = NULL;
 void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state,
                         void *user_data);
 
+void *GMainLoopThread (void *param)
+{
+    g_main_loop_run(g_mainloop);
+    return NULL;
+}
+
 CAResult_t CAInitializeLENetworkMonitor()
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
+    OIC_LOG(DEBUG, TAG, "IN");
 
     if (NULL == g_bleDeviceStateChangedCbMutex)
     {
         g_bleDeviceStateChangedCbMutex = ca_mutex_new();
         if (NULL == g_bleDeviceStateChangedCbMutex)
         {
-            OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "ca_mutex_new failed");
+            OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
             return CA_STATUS_FAILED;
         }
     }
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
+    OIC_LOG(DEBUG, TAG, "OUT");
 
     return CA_STATUS_OK;
 }
 
 void CATerminateLENetworkMonitor()
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
+    OIC_LOG(DEBUG, TAG, "IN");
 
     ca_mutex_free(g_bleDeviceStateChangedCbMutex);
     g_bleDeviceStateChangedCbMutex = NULL;
 
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    g_threadPoolHandle = threadPool;
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
 }
 
-CAResult_t CAInitializeLEAdapter()
+CAResult_t CAStartLEAdapter()
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
+    OIC_LOG(DEBUG, TAG, "IN");
+    g_mainloop = g_main_loop_new(NULL, 0);
+    if(!g_mainloop)
+    {
+        OIC_LOG(ERROR, TAG, "g_main_loop_new failed\n");
+        return CA_STATUS_FAILED;
+    }
+
+    if (CA_STATUS_OK != ca_thread_pool_add_task(g_threadPoolHandle, GMainLoopThread, (void *) NULL))
+    {
+        OIC_LOG(ERROR, TAG, "Failed to create thread!");
+        return CA_STATUS_FAILED;
+    }
 
     int ret = bt_initialize();
     if (0 != ret)
     {
-        OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_initialize failed");
+        OIC_LOG(ERROR, TAG, "bt_initialize failed");
         return CA_STATUS_FAILED;
     }
 
     ret = bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE, 0);
     if (0 != ret)
     {
-        OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_adapter_set_visibility failed");
+        OIC_LOG(ERROR, TAG, "bt_adapter_set_visibility failed");
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
+    ret = bt_adapter_set_state_changed_cb(CALEAdapterStateChangedCb, NULL);
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG(DEBUG, TAG, "bt_adapter_set_state_changed_cb failed");
+        return CA_STATUS_FAILED;
+    }
+
+    OIC_LOG(DEBUG, TAG, "OUT");
     return CA_STATUS_OK;
 }
 
-CAResult_t CAStartLEAdapter()
+CAResult_t CAStopLEAdapter()
 {
-    // Nothing to do.
 
+    int ret = bt_adapter_unset_state_changed_cb();
+    if (BT_ERROR_NONE != ret)
+    {
+        OIC_LOG(DEBUG, TAG, "bt_adapter_unset_state_changed_cb failed");
+        return CA_STATUS_FAILED;
+    }
+
+    ret = bt_deinitialize();
+    if (0 != ret)
+    {
+        OIC_LOG(ERROR, TAG, "bt_deinitialize failed");
+        return CA_STATUS_FAILED;
+    }
+
+    if (g_mainloop)
+    {
+        g_main_loop_quit(g_mainloop);
+    }
     return CA_STATUS_OK;
 }
 
 CAResult_t CAGetLEAdapterState()
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
+    OIC_LOG(DEBUG, TAG, "IN");
 
     bt_adapter_state_e adapterState = BT_ADAPTER_DISABLED;
 
@@ -136,108 +186,91 @@ CAResult_t CAGetLEAdapterState()
     int ret = bt_adapter_get_state(&adapterState);
     if (BT_ERROR_NONE != ret)
     {
-        OIC_LOG_V(ERROR, TZ_LE_NWK_MONITOR_TAG, "Bluetooth get state failed!, error num [%x]",
+        OIC_LOG_V(ERROR, TAG, "Bluetooth get state failed!, error num [%x]",
                   ret);
         return CA_STATUS_FAILED;
     }
 
     if (BT_ADAPTER_ENABLED != adapterState)
     {
-        OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "BT Adapter is not enabled");
+        OIC_LOG(DEBUG, TAG, "BT Adapter is not enabled");
         return CA_ADAPTER_NOT_ENABLED;
     }
 
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
+    OIC_LOG(DEBUG, TAG, "OUT");
     return CA_STATUS_OK;
 }
 
 CAResult_t CAGetLEAddress(char **local_address)
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
+    OIC_LOG(DEBUG, TAG, "IN");
 
-    VERIFY_NON_NULL(local_address, TZ_LE_NWK_MONITOR_TAG, "local_address is null")
+    VERIFY_NON_NULL(local_address, TAG, "local_address is null")
 
     char *address = NULL;
 
     int ret = bt_adapter_get_address(&address);
     if (BT_ERROR_NONE != ret || !address)
     {
-        OIC_LOG_V(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_adapter_get_address failed!, error num [%x]",
+        OIC_LOG_V(ERROR, TAG, "bt_adapter_get_address failed!, error num [%x]",
                   ret);
         return CA_STATUS_FAILED;
     }
 
-    OIC_LOG_V(DEBUG, TZ_LE_NWK_MONITOR_TAG, "bd address[%s]", address);
+    OIC_LOG_V(DEBUG, TAG, "bd address[%s]", address);
 
     *local_address = address;
 
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
+    OIC_LOG(DEBUG, TAG, "OUT");
 
     return CA_STATUS_OK;
 }
 
 CAResult_t CASetLEAdapterStateChangedCb(CALEDeviceStateChangedCallback callback)
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
-
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "Setting CALEDeviceStateChangedCallback");
-
+    OIC_LOG(DEBUG, TAG, "IN");
     ca_mutex_lock(g_bleDeviceStateChangedCbMutex);
     g_bleDeviceStateChangedCallback = callback;
     ca_mutex_unlock(g_bleDeviceStateChangedCbMutex);
+    OIC_LOG(DEBUG, TAG, "OUT");
+    return CA_STATUS_OK;
+}
 
-    int ret = bt_adapter_set_state_changed_cb(CALEAdapterStateChangedCb, NULL);
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "bt_adapter_set_state_changed_cb failed");
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
+CAResult_t CAUnSetLEAdapterStateChangedCb()
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    ca_mutex_lock(g_bleDeviceStateChangedCbMutex);
+    g_bleDeviceStateChangedCallback = NULL;
+    ca_mutex_unlock(g_bleDeviceStateChangedCbMutex);
+    OIC_LOG(DEBUG, TAG, "OUT");
     return CA_STATUS_OK;
 }
 
 void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state,
                                           void *user_data)
 {
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
+    OIC_LOG(DEBUG, TAG, "IN");
 
     ca_mutex_lock(g_bleDeviceStateChangedCbMutex);
 
     if (NULL == g_bleDeviceStateChangedCallback)
     {
-        OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "g_bleDeviceStateChangedCallback is NULL!");
+        OIC_LOG(ERROR, TAG, "g_bleDeviceStateChangedCallback is NULL!");
         ca_mutex_unlock(g_bleDeviceStateChangedCbMutex);
         return;
     }
 
     if (BT_ADAPTER_DISABLED == adapter_state)
     {
-        OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "Adapter is disabled");
+        OIC_LOG(DEBUG, TAG, "Adapter is disabled");
         g_bleDeviceStateChangedCallback(CA_ADAPTER_DISABLED);
         ca_mutex_unlock(g_bleDeviceStateChangedCbMutex);
         return;
     }
 
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "Adapter is Enabled");
+    OIC_LOG(DEBUG, TAG, "Adapter is Enabled");
     g_bleDeviceStateChangedCallback(CA_ADAPTER_ENABLED);
     ca_mutex_unlock(g_bleDeviceStateChangedCbMutex);
 
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
-}
-
-
-CAResult_t CAUnSetLEAdapterStateChangedCb()
-{
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "IN");
-
-    int ret = bt_adapter_unset_state_changed_cb();
-    if (BT_ERROR_NONE != ret)
-    {
-        OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "bt_adapter_unset_state_changed_cb failed");
-        return CA_STATUS_FAILED;
-    }
-
-    OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
-    return CA_STATUS_OK;
+    OIC_LOG(DEBUG, TAG, "OUT");
 }
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver.c
new file mode 100644 (file)
index 0000000..1e2b594
--- /dev/null
@@ -0,0 +1,192 @@
+/******************************************************************
+*
+* Copyright 2014 Samsung Electronics 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.
+*
+******************************************************************/
+
+#include <bluetooth.h>
+#include <bluetooth_type.h>
+
+#include "caleserver.h"
+#include <pthread.h>
+#include "cacommon.h"
+#include "caadapterutils.h"
+#include <gio/gio.h>
+#include "camutex.h"
+#include "caqueueingthread.h"
+#include "caadapterutils.h"
+#include "cafragmentation.h"
+#include "cagattservice.h"
+#include "caleutil.h"
+#include "oic_string.h"
+#include "oic_malloc.h"
+
+/**
+ * @def TZ_BLE_SERVER_TAG
+ * @brief Logging tag for module name
+ */
+#define TZ_BLE_SERVER_TAG "OIC_CA_LE_SERVER"
+
+void CABleGattServerConnectionStateChangedCb(int result, bool connected,
+                                             const char *remoteAddress, void *userData)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+}
+
+CAResult_t CAStartLEGattServer()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CAStartBleGattServerThread(void *data)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+}
+
+CAResult_t CAStopLEGattServer()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CATerminateLEGattServer()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+}
+
+CAResult_t CAInitializeLEGattServer()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CAInitBleGattService()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CADeInitBleGattService()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CASetLEServerThreadPoolHandle(ca_thread_pool_t handle)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+}
+
+CAResult_t CAAddNewBleServiceInGattServer(const char *serviceUUID)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CARemoveBleServiceFromGattServer(const char *svcPath)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CARemoveAllBleServicesFromGattServer()
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CABleGattRemoteCharacteristicWriteCb(char *charPath,
+                                          unsigned char *charValue,
+                                          int charValueLen,
+                                          const char *remoteAddress,
+                                          void *userData)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+}
+
+CAResult_t CARegisterBleServicewithGattServer(const char *svcPath)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CAAddNewCharacteristicsToGattServer(const char *svcPath, const char *charUUID,
+        const uint8_t *charValue, int charValueLen, bool read)
+{
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CARemoveCharacteristicsFromGattServer(const char *charPath)
+{
+    ///TODO: There is no api provided in bluetooth.h for removing characteristics.
+    return CA_STATUS_OK;
+}
+
+CAResult_t CAUpdateCharacteristicsToGattClient(const char *address,
+                                               const uint8_t *charValue,
+                                               uint32_t charValueLen)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+CAResult_t CAUpdateCharacteristicsToAllGattClients(const uint8_t *charValue, uint32_t charValueLen)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "OUT");
+    return CA_STATUS_OK;
+}
+
+void CASetLEReqRespServerCallback(CABLEDataReceivedCallback callback)
+{
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
+
+    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
+}
+
+void CASetBLEServerErrorHandleCallback(CABLEErrorHandleCallback callback)
+{
+
+}
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c
new file mode 100644 (file)
index 0000000..8dc46dd
--- /dev/null
@@ -0,0 +1,279 @@
+/* ****************************************************************
+ *
+ * Copyright 2014 Samsung Electronics 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.
+ *
+ ******************************************************************/
+
+#include "caleutil.h"
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+#include<arpa/inet.h>
+#include<sys/types.h>
+#include<sys/socket.h>
+#include<netinet/in.h>
+
+
+#include "caadapterutils.h"
+#include "oic_string.h"
+#include "oic_malloc.h"
+
+/**
+ * Logging tag for module name
+ */
+#define TAG "OIC_CA_LE_UTIL"
+
+/**
+ * Number of services connected.
+ */
+static int32_t g_numberOfServiceConnected = 0;
+
+void CAIncrementRegisteredServiceCount()
+{
+    g_numberOfServiceConnected++;
+}
+
+void CADecrementRegisteredServiceCount()
+{
+    g_numberOfServiceConnected--;
+}
+
+void CAResetRegisteredServiceCount()
+{
+    g_numberOfServiceConnected = 0;
+}
+
+int32_t  CAGetRegisteredServiceCount()
+{
+    return g_numberOfServiceConnected ;
+}
+
+CAResult_t CAAddLEServerInfoToList(LEServerInfoList **serverList,
+                                   LEServerInfo *leServerInfo)
+{
+
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL(serverList, TAG, "clientList");
+    VERIFY_NON_NULL(leServerInfo, TAG, "leClientInfo");
+
+    LEServerInfoList *node = (LEServerInfoList *) OICCalloc(1, sizeof(LEServerInfoList));
+    if (NULL == node)
+    {
+        OIC_LOG(ERROR, TAG, "Malloc failed!");
+        return CA_STATUS_FAILED;
+    }
+
+    node->serverInfo = leServerInfo;
+    node->next = NULL;
+
+    if (*serverList == NULL)   // Empty list
+    {
+        *serverList = node;
+    }
+    else     // Add at front end
+    {
+        node->next = *serverList;
+        *serverList = node;
+    }
+
+    CAIncrementRegisteredServiceCount();
+
+    OIC_LOG_V(DEBUG, TAG, "Device [%s] added to list",
+              leServerInfo->remoteAddress);
+
+    OIC_LOG(DEBUG, TAG, "OUT");
+
+    return CA_STATUS_OK;
+}
+
+CAResult_t CAGetLEServerInfo(LEServerInfoList *serverList, const char *leAddress,
+                             LEServerInfo **leServerInfo)
+{
+
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL(serverList, TAG, "clientList");
+    VERIFY_NON_NULL(leServerInfo, TAG, "leClientInfo");
+    VERIFY_NON_NULL(leAddress, TAG, "leAddress");
+
+    LEServerInfoList *cur = serverList;
+    *leServerInfo = NULL;
+    while (cur != NULL)
+    {
+        if (!strcasecmp(cur->serverInfo->remoteAddress , leAddress))
+        {
+            *leServerInfo = cur->serverInfo;
+            OIC_LOG(DEBUG, TAG, "OUT");
+            return CA_STATUS_OK;
+        }
+
+        cur = cur->next;
+    }
+
+    OIC_LOG(DEBUG, TAG, " OUT");
+    return CA_STATUS_FAILED;
+}
+
+CAResult_t CAGetLEServerInfoByPosition(LEServerInfoList *serverList, int32_t position,
+                                       LEServerInfo **leServerInfo)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+
+    VERIFY_NON_NULL(serverList, TAG, "clientList");
+    VERIFY_NON_NULL(leServerInfo, TAG, "leClientInfo");
+
+    if (0 > position)
+    {
+        OIC_LOG(ERROR, TAG, "Position Invalid input !");
+        return CA_STATUS_INVALID_PARAM;
+    }
+
+    *leServerInfo = NULL;
+    int32_t count = 0;
+    LEServerInfoList *cur = serverList;
+    while (cur != NULL)
+    {
+        if (position == count)
+        {
+            *leServerInfo = cur->serverInfo;
+            OIC_LOG(DEBUG, TAG, "OUT");
+            return CA_STATUS_OK;
+        }
+        count++;
+        cur = cur->next;
+    }
+    OIC_LOG(DEBUG, TAG, "Client info not found for the position");
+    return CA_STATUS_FAILED;
+}
+
+void CAFreeLEServerList(LEServerInfoList *clientList)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    while (clientList)
+    {
+        LEServerInfoList *temp = clientList;
+        clientList = clientList->next;
+        CAFreeLEServerInfo(temp->serverInfo);
+        OICFree(temp);
+    }
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+void CAFreeLEServerInfo(LEServerInfo *leServerInfo)
+{
+    OIC_LOG(DEBUG, TAG, "IN");
+    if (leServerInfo)
+    {
+        if (leServerInfo->remoteAddress)
+        {
+            bt_gatt_client_destroy(leServerInfo->clientHandle);
+            int32_t ret = bt_gatt_disconnect(leServerInfo->remoteAddress);
+
+            if (BT_ERROR_NONE != ret)
+            {
+                OIC_LOG_V(ERROR, TAG,
+                          "bt_gatt_disconnect Failed with ret value [%d]",
+                          ret);
+                return;
+            }
+            OICFree(leServerInfo->remoteAddress);
+        }
+        OICFree(leServerInfo);
+    }
+    OIC_LOG(DEBUG, TAG, "OUT");
+}
+
+const char *CALEGetErrorMsg(bt_error_e err)
+{
+    const char *errStr = NULL;
+
+    switch (err)
+    {
+        case BT_ERROR_NONE:
+            errStr = "BT_ERROR_NONE";
+            break;
+        case BT_ERROR_CANCELLED:
+            errStr = "BT_ERROR_CANCELLED";
+            break;
+        case BT_ERROR_INVALID_PARAMETER:
+            errStr = "BT_ERROR_INVALID_PARAMETER";
+            break;
+        case BT_ERROR_OUT_OF_MEMORY:
+            errStr = "BT_ERROR_OUT_OF_MEMORY";
+            break;
+        case BT_ERROR_RESOURCE_BUSY:
+            errStr = "BT_ERROR_RESOURCE_BUSY";
+            break;
+        case BT_ERROR_TIMED_OUT:
+            errStr = "BT_ERROR_TIMED_OUT";
+            break;
+        case BT_ERROR_NOW_IN_PROGRESS:
+            errStr = "BT_ERROR_NOW_IN_PROGRESS";
+            break;
+        case BT_ERROR_NOT_INITIALIZED:
+            errStr = "BT_ERROR_NOT_INITIALIZED";
+            break;
+        case BT_ERROR_NOT_ENABLED:
+            errStr = "BT_ERROR_NOT_ENABLED";
+            break;
+        case BT_ERROR_ALREADY_DONE:
+            errStr = "BT_ERROR_ALREADY_DONE";
+            break;
+        case BT_ERROR_OPERATION_FAILED:
+            errStr = "BT_ERROR_OPERATION_FAILED";
+            break;
+        case BT_ERROR_NOT_IN_PROGRESS:
+            errStr = "BT_ERROR_NOT_IN_PROGRESS";
+            break;
+        case BT_ERROR_REMOTE_DEVICE_NOT_BONDED:
+            errStr = "BT_ERROR_REMOTE_DEVICE_NOT_BONDED";
+            break;
+        case BT_ERROR_AUTH_REJECTED:
+            errStr = "BT_ERROR_AUTH_REJECTED";
+            break;
+        case BT_ERROR_AUTH_FAILED:
+            errStr = "BT_ERROR_AUTH_FAILED";
+            break;
+        case BT_ERROR_REMOTE_DEVICE_NOT_FOUND:
+            errStr = "BT_ERROR_REMOTE_DEVICE_NOT_FOUND";
+            break;
+        case BT_ERROR_SERVICE_SEARCH_FAILED:
+            errStr = "BT_ERROR_SERVICE_SEARCH_FAILED";
+            break;
+        case BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED:
+            errStr = "BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED";
+            break;
+        case BT_ERROR_PERMISSION_DENIED:
+            errStr = "BT_ERROR_PERMISSION_DENIED";
+            break;
+        case BT_ERROR_SERVICE_NOT_FOUND:
+            errStr = "BT_ERROR_SERVICE_NOT_FOUND";
+            break;
+        case BT_ERROR_NOT_SUPPORTED:
+            errStr = "BT_ERROR_NOT_SUPPORTED";
+            break;
+        default:
+            errStr = "NOT Defined";
+            break;
+    }
+
+    return errStr;
+}
+
+
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h
new file mode 100644 (file)
index 0000000..5a38ec4
--- /dev/null
@@ -0,0 +1,156 @@
+/* ****************************************************************
+ *
+ * Copyright 2014 Samsung Electronics 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.
+ *
+ ******************************************************************/
+
+/**
+ * @file
+ *
+ * This file contains the util function for LE adapter. This maintains the
+ * list of services an individual GATT Client connected to and operations on
+ * that list, such as getting the service info with BD address or with
+ * position etc. This is mainly useful for the multicast transmission of
+ * data where client needs to have the info of all the services to which it
+ * is connected.
+ */
+
+#ifndef TZ_BLE_UTIL_H_
+#define TZ_BLE_UTIL_H_
+
+#include <bluetooth.h>
+
+#include "cacommon.h"
+
+typedef struct
+{
+    bt_gatt_client_h clientHandle;
+    bt_gatt_h serviceHandle;
+    bt_gatt_h readChar;
+    bt_gatt_h writeChar;
+    char *remoteAddress;
+} LEServerInfo;
+
+typedef struct _LEServerInfoList
+{
+    LEServerInfo *serverInfo;
+    struct _LEServerInfoList *next;
+}LEServerInfoList;
+
+/**
+ * Different characteristics types.
+ *
+ * This provides information of different characteristics
+ * which will be added to OIC service.
+ */
+typedef enum
+{
+    BLE_GATT_WRITE_CHAR = 0, /**< write_char This will be used to get the unicast response. */
+    BLE_GATT_READ_CHAR,      /**< read_char This will be used update value to OIC server. */
+    BLE_GATT_NOTIFY_CHAR     /**< Reserved char for the time being. */
+} CHAR_TYPE;
+
+/**
+ * Used to increment the registered service count.
+ */
+void CAIncrementRegisteredServiceCount();
+
+/**
+ * Used to decrement the registered service count.
+ */
+void CADecrementRegisteredServiceCount();
+
+/**
+ * Used to reset the registered service count.
+ */
+void CAResetRegisteredServiceCount();
+
+/**
+ * Used to get the total registered service count.
+ * @return  Total registered service count.
+ */
+int32_t  CAGetRegisteredServiceCount();
+
+/**
+ * @brief  Used to add the serverListInfo structure to the Client List.
+ *
+ * @param[in] serverList     Pointer to the ble server list which holds the info of list of
+ *                           servers registered by the client.
+ * @param[in] leServerInfo   Pointer where serverInfo structure needs to be appended with
+ *                           serverList.
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CAAddLEServerInfoToList(LEServerInfoList **serverList,
+                                   LEServerInfo *leServerInfo);
+
+/**
+ * Used to get the serviceInfo from the list.
+ *
+ * @param[in]  serverList       Pointer to the ble service list which holds the info of list
+ *                              of servers registered by the client.
+ * @param[in]  leAddress        BD address of the device where GATTServer information is required.
+ * @param[out] leServerInfo     Info of service and characteristic handle of the given BD address
+ *                              registered by client.
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CAGetLEServerInfo(LEServerInfoList *serverList, const char *leAddress,
+                             LEServerInfo **leServerInfo);
+
+/**
+ * Used to get the clientInfo from the list by position.
+ *
+ * @param[in]  serverList      Pointer to the ble service list which holds the info of list
+ *                             of servers registered by the client.
+ * @param[in]  position        The service information of particular position in the list.
+ * @param[out] leServerInfo    Info of service and characteristic handle of the given BD address
+ *                              registered by client.
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CAGetLEServerInfoByPosition(LEServerInfoList *serverList, int32_t position,
+                                       LEServerInfo **leServerInfo);
+
+/**
+ * Used to clear BLE service list.
+ *
+ * @param[in]  serverList   Pointer to the ble service list which holds the info of list of
+ *                          servers registered by the client.
+ */
+void CAFreeLEServerList(LEServerInfoList *serverList);
+
+/**
+ * @brief Used to get remove particular BLE service info from list
+ * @param[in] bleServerInfo Pointer to the structure which needs to be cleared.
+ */
+void CAFreeLEServerInfo(LEServerInfo *bleServerInfo);
+
+/**
+ * Used to get the Error message.
+ * @param[in] err   Error code(::bt_error_e).
+ * @return  Error string corresponding to the BT error code.
+ */
+const char *CALEGetErrorMsg(bt_error_e err);
+
+#endif /* TZ_BLE_UTIL_H_ */