Use the prebuilt libbt-oal.so file 80/204080/1 tizen_rt
authorDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 19 Apr 2019 05:37:59 +0000 (14:37 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 19 Apr 2019 05:44:44 +0000 (14:44 +0900)
Change-Id: I804cb99cdf46791074b4e729dc0ae3b25489a175
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
36 files changed:
CMakeLists.txt
common/oal-common.c [deleted file]
common/oal-common.h [deleted file]
common/oal-event-dispatcher.c [deleted file]
common/oal-utils.c [deleted file]
common/oal-utils.h [deleted file]
hardware/bluetooth.h [deleted file]
hardware/bt_av.h [deleted file]
hardware/bt_gatt.h [deleted file]
hardware/bt_gatt_client.h [deleted file]
hardware/bt_gatt_server.h [deleted file]
hardware/bt_gatt_types.h [deleted file]
hardware/bt_hf.h [deleted file]
hardware/bt_hh.h [deleted file]
hardware/bt_hl.h [deleted file]
hardware/bt_rc.h [deleted file]
hardware/bt_sock.h [deleted file]
hardware/hardware.c [deleted file]
hardware/hardware.h [deleted file]
libraries/libbt-oal.so [new file with mode: 0755]
oal-a2dp-sink.c [deleted file]
oal-adapter-mgr.c [deleted file]
oal-audio-src.c [deleted file]
oal-avrcp-ctrl.c [deleted file]
oal-avrcp-tg.c [deleted file]
oal-device-mgr.c [deleted file]
oal-gatt.c [deleted file]
oal-hardware.c [deleted file]
oal-hdp.c [deleted file]
oal-hfp.c [deleted file]
oal-hid-host.c [deleted file]
oal-internal.h [deleted file]
oal-manager.c [deleted file]
oal-socket.c [deleted file]
packaging/libbt-oal.manifest [changed mode: 0644->0755]
packaging/libbt-oal.spec

index ec91139..9690bee 100644 (file)
@@ -1,28 +1,6 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(bt-oal C)
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/hardware/)
-
-SET(SRCS
-oal-hardware.c
-oal-manager.c
-oal-adapter-mgr.c
-oal-device-mgr.c
-oal-hid-host.c
-oal-socket.c
-oal-audio-src.c
-oal-a2dp-sink.c
-oal-avrcp-tg.c
-oal-avrcp-ctrl.c
-oal-hfp.c
-oal-hdp.c
-oal-gatt.c
-common/oal-utils.c
-common/oal-common.c
-common/oal-event-dispatcher.c
-)
-
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
        SET(CMAKE_BUILD_TYPE "Release")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
@@ -31,43 +9,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(EXEC_PREFIX "\${prefix}")
 SET(LIBDIR ${CMAKE_LIB_DIR})
 SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION_MAJOR 1)
-SET(VERSION ${VERSION_MAJOR}.0.0)
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lib)
-LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/bt-oal)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(packages REQUIRED vconf gio-unix-2.0 dlog gio-2.0 glib-2.0)
-SET(pc_dependents "vconf gio-unix-2.0 dlog gio-2.0 glib-2.0")
-
-FOREACH(flag ${packages_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g ")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
-
-FIND_PROGRAM(UNAME NAMES uname)
-EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
-IF("${ARCH}" STREQUAL "arm")
-       ADD_DEFINITIONS("-DTARGET")
-       MESSAGE("add -DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
-
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${packages_LDFLAGS} -ldl)
 
 INSTALL(
         DIRECTORY include/ DESTINATION include/bt-oal
@@ -86,30 +29,4 @@ CONFIGURE_FILE(
 )
 
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libbt-oal.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
-ADD_CUSTOM_COMMAND(
-        DEPENDS clean 
-        COMMENT "distribution clean"
-        COMMAND find
-        ARGS    . 
-        -not -name config.cmake -and \(
-        -name tester.c -or
-        -name Testing -or
-        -name CMakeFiles -or
-        -name cmake.depends -or
-        -name cmake.check_depends -or
-        -name CMakeCache.txt -or
-        -name cmake.check_cache -or
-        -name *.cmake -or
-        -name Makefile -or
-        -name core -or
-        -name core.* -or
-        -name gmon.out -or
-        -name install_manifest.txt -or
-        -name *.pc -or
-        -name *~ \)
-        | grep -v TC | xargs rm -rf
-        TARGET  distclean
-        VERBATIM
-)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libraries/libbt-oal.so DESTINATION ${LIB_INSTALL_DIR}/)
diff --git a/common/oal-common.c b/common/oal-common.c
deleted file mode 100644 (file)
index edf77ca..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
-* Open Adaptation Layer (OAL)
-*
-* Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
-*
-* Contact: Anupam Roy <anupam.r@samsung.com>
-*
-* 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 <stdio.h>
-#include <stdlib.h>
-#include <dlog.h>
-#include <string.h>
-#include <vconf.h>
-#include <sys/prctl.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-
-#include <bluetooth.h>
-#include "oal-internal.h"
-#include "oal-common.h"
-
-#define BT_UUID_STRING_SIZE 37
-#define BT_UUID_LENGTH_MAX 16
-
-void parse_device_properties(int num_properties, bt_property_t *properties,
-               remote_device_t *dev_info, ble_adv_data_t * adv_info)
-{
-       int i = 0;
-       int uuid_count = 0, table_len = 0;
-       int tmp_uuid_cnt = 0;
-       int chk = 0;
-       char lcl_uuid[BT_UUID_STRING_MAX];
-
-       bt_bdaddr_t * addr = {0};
-       bt_bdname_t *name = {0};
-       service_uuid_t *uuids;
-       bt_device_type_t dev_type;
-
-       BT_DBG("num_properties: %d", num_properties);
-
-       for (i = 0; i < num_properties; i++) {
-               BT_DBG("===>Prop type: %d, Len: %d<===", properties[i].type, properties[i].len);
-
-               switch (properties[i].type) {
-               case BT_PROPERTY_BDADDR: {
-                       addr = (bt_bdaddr_t *)properties[i].val;
-                               memcpy(dev_info->address.addr, addr->address, 6);
-                       BT_DBG("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
-                                       dev_info->address.addr[0], dev_info->address.addr[1],
-                                       dev_info->address.addr[2], dev_info->address.addr[3],
-                                       dev_info->address.addr[4], dev_info->address.addr[5]);
-                       break;
-               }
-               case BT_PROPERTY_CLASS_OF_DEVICE: {
-                       dev_info->cod = *((int *)properties[i].val);
-                       BT_DBG("CLASS: 0x%06x", dev_info->cod);
-                       break;
-               }
-               case BT_PROPERTY_BDNAME: {
-                       name = properties[i].val;
-
-                       g_strlcpy(dev_info->name, (const gchar *)name->name, BT_DEVICE_NAME_LENGTH_MAX);
-                       BT_DBG("NAME: %s", dev_info->name);
-                       break;
-               }
-               case  BT_PROPERTY_REMOTE_FRIENDLY_NAME: {
-                       bt_bdname_t *alias = properties[i].val;
-                       if (NULL != alias && (0 != properties[i].len))
-                               g_strlcpy(dev_info->alias, (const gchar *)alias->name, BT_DEVICE_NAME_LENGTH_MAX);
-                       BT_DBG("FRIENDLY NAME: [%s]", dev_info->alias);
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_PAIRED: {
-                       dev_info->is_bonded = *((unsigned char*)properties[i].val);
-                       BT_DBG("BONDED [%d]", dev_info->is_bonded);
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_CONNECTED: {
-                       dev_info->is_connected = *((int*)properties[i].val);
-                       BT_DBG("CONNECTED [%d]", dev_info->is_connected);
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_TRUST: {
-                       dev_info->is_trusted = *((unsigned char*)properties[i].val);
-                       BT_DBG("TRUSTED [%d]", dev_info->is_trusted);
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_RSSI: {
-                       dev_info->rssi = *((int *)properties[i].val);
-                       BT_DBG("RSSI: %d", dev_info->rssi);
-                       break;
-               }
-               case BT_PROPERTY_UUIDS: {
-                       uuids  = (service_uuid_t *)properties[i].val;
-                       BT_DBG("Length of properties from HAL [%d]", properties[i].len);
-                       uuid_count = properties[i].len/sizeof(bt_uuid_t);
-                       table_len += uuid_count;
-                       for (; tmp_uuid_cnt < table_len; tmp_uuid_cnt++) {
-                               uuid_to_string(&uuids[tmp_uuid_cnt], lcl_uuid);
-                               chk = check_duplicate_uuid(dev_info->uuid,
-                                       uuids[tmp_uuid_cnt], dev_info->uuid_count);
-                               if (chk != 0) {
-                                       memcpy(&dev_info->uuid[dev_info->uuid_count++].uuid,
-                                                       &uuids[tmp_uuid_cnt].uuid, 16);
-                               } else {
-                                       BT_DBG("Duplicate UUID found:%s\n", lcl_uuid);
-                               }
-                               BT_DBG("%d.BT_PROPERTY_UUIDS:%s", dev_info->uuid_count, lcl_uuid);
-                       }
-                       break;
-               }
-               case BT_PROPERTY_TYPE_OF_DEVICE: {
-                       dev_type = *((bt_device_type_t *)properties[i].val);
-                       if (dev_type == BT_DEVICE_DEVTYPE_BLE)
-                               BT_DBG("Single mode BLE Device");
-                       else if (dev_type == BT_DEVICE_DEVTYPE_DUAL)
-                               BT_DBG("Dual mode BLE Device");
-                       dev_info->type = dev_type - 1;//OAL enum starts with 0 and Bluedroid with 1
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_BLE_ADV_DATA: {
-                       if (adv_info) {
-                               adv_info->adv_data = properties[i].val;
-                               adv_info->len = properties[i].len;
-                       }
-                       BT_DBG("----Advertising Data Length: %d", properties[i].len);
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP: {
-                       BT_INFO("BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP: Not Handled!!");
-                       break;
-               }
-               case BT_PROPERTY_SERVICE_RECORD: {
-                       BT_INFO("BT_PROPERTY_SERVICE_RECORD: Not Handled!!");
-                       break;
-               }
-               case BT_PROPERTY_REMOTE_IS_ALIAS_SET: {
-                       dev_info->is_alias_set = *((unsigned char*)properties[i].val);
-                       BT_DBG("IS_ALIAS_SET [%d]", dev_info->is_alias_set);
-                       break;
-               }
-               default:
-                       BT_WARN("Property not handled");
-                       break;
-               }
-       }
-}
-
-oal_status_t convert_to_oal_status(bt_status_t status)
-{
-       oal_status_t ret = OAL_STATUS_INTERNAL_ERROR;
-
-       switch (status) {
-       case BT_STATUS_SUCCESS:
-       case BT_STATUS_DONE:
-               ret = OAL_STATUS_SUCCESS;
-               break;
-       case BT_STATUS_NOT_READY:
-               ret = OAL_STATUS_NOT_READY;
-               break;
-       case BT_STATUS_BUSY:
-               ret = OAL_STATUS_BUSY;
-               break;
-       case BT_STATUS_PARM_INVALID:
-               ret = OAL_STATUS_INVALID_PARAM;
-               break;
-       case BT_STATUS_RMT_DEV_DOWN:
-               ret = OAL_STATUS_RMT_DEVICE_DOWN;
-               break;
-       case BT_STATUS_AUTH_FAILURE:
-               ret = OAL_STATUS_AUTH_FAILED;
-               break;
-       case BT_STATUS_UNSUPPORTED:
-               ret = OAL_STATUS_NOT_SUPPORT;
-               break;
-       case BT_STATUS_UNHANDLED:
-       case BT_STATUS_FAIL:
-       case BT_STATUS_NOMEM:
-       default:
-               ret = OAL_STATUS_INTERNAL_ERROR;
-               break;
-       }
-       return ret;
-}
-
-static const char * status_str[] = {
-       "BT_STATUS_SUCCESS",
-       "BT_STATUS_FAIL",
-       "BT_STATUS_NOT_READY",
-       "BT_STATUS_NOMEM",
-       "BT_STATUS_BUSY",
-       "BT_STATUS_DONE",
-       "BT_STATUS_UNSUPPORTED",
-       "BT_STATUS_PARM_INVALID",
-       "BT_STATUS_UNHANDLED",
-       "BT_STATUS_AUTH_FAILURE",
-       "BT_STATUS_RMT_DEV_DOWN"
-};
-
-int check_duplicate_uuid(oal_uuid_t *table, oal_uuid_t toMatch, int table_len)
-{
-       int i;
-       int ret = 1;
-
-       for (i = 0; i < table_len; i++) {
-               ret = memcmp(table[i].uuid, toMatch.uuid, 16);
-               if (ret == 0)
-                       break;
-       }
-       return ret;
-}
-
-const char* status2string(bt_status_t status)
-{
-       if (status <= BT_STATUS_RMT_DEV_DOWN)
-               return status_str[status];
-       else {
-               BT_ERR("Invalid BT status from stack");
-               return "BT_STATUS_UNKNOWN";
-       }
-}
diff --git a/common/oal-common.h b/common/oal-common.h
deleted file mode 100644 (file)
index 52f67d4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* Open Adaptation Layer (OAL)
-*
-* Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
-*
-* 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 _OAL_COMMON_H_
-#define _OAL_COMMON_H_
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <bluetooth.h>
-#include "oal-internal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void parse_device_properties(int num_properties, bt_property_t *properties,
-                               remote_device_t *dev_info, ble_adv_data_t * adv_info);
-oal_status_t convert_to_oal_status(bt_status_t status);
-
-const char * status2string(bt_status_t status);
-
-int check_duplicate_uuid(oal_uuid_t *table, oal_uuid_t toMatch, int table_len);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /*_OAL_COMMON_H_*/
diff --git a/common/oal-event-dispatcher.c b/common/oal-event-dispatcher.c
deleted file mode 100644 (file)
index 3fd6796..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * bluetooth-frwk
- *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-#define _OAL_EVENT_DISPATCHER_C_
-
-#include <stdio.h>
-#include <glib.h>
-#include <dlog.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "oal-hardware.h"
-#include "oal-event.h"
-#include "oal-utils.h"
-#include "oal-manager.h"
-
-#define EVENT_TRACE(fmt, args...) {LOG_(LOG_ID_SYSTEM, DLOG_INFO, "OAL_EVENT", GREEN(fmt), ##args); \
-       LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, GREEN("[OAL_EVENT]"fmt), ##args); }
-
-typedef struct {
-       int event;
-       gsize size;
-       gpointer event_data;
-} event_t;
-
-static GMainContext *event_thread_context;
-static oal_event_callback event_handler_cb;
-GMainLoop *event_loop;
-
-void _bt_event_dispatcher_deinit()
-{
-       BT_DBG("+");
-       if (event_loop) {
-               BT_DBG("OAL event loop guit");
-               g_main_loop_quit(event_loop);
-       }
-
-       BT_DBG("-");
-}
-
-static gpointer __event_handler_loop(gpointer user_data)
-{
-       gboolean ret = FALSE;
-
-       /* Set up the thread�s context and run it forever. */
-       g_main_context_push_thread_default(event_thread_context);
-
-       event_loop = g_main_loop_new(event_thread_context, FALSE);
-       do {
-               ret = oal_lib_init(NULL);
-               if (ret == FALSE)
-                       BT_WARN("oal_lib_init failed, trying again...");
-       } while (ret == FALSE);
-
-       g_main_loop_run(event_loop);
-       BT_DBG("OAL event loop quited");
-
-       if (event_loop) {
-               g_main_loop_unref(event_loop);
-               event_loop = NULL;
-       }
-
-       g_main_context_pop_thread_default(event_thread_context);
-       g_main_context_unref(event_thread_context);
-
-       return NULL;
-}
-
-static void event_data_free(event_t *event_info)
-{
-       if (event_info->event_data)
-               g_free(event_info->event_data);
-       g_slice_free(event_t, event_info);
-}
-
-/* Convert an idle callback into a call to dispatch_idle(). */
-static gboolean dispatch_idle(gpointer user_data)
-{
-       event_t *event_info = user_data;
-       BT_DBG("+");
-
-       if (NULL == event_handler_cb)
-               BT_ERR("Upstream handler not registered");
-       else
-               (*event_handler_cb)(event_info->event, event_info->event_data, event_info->size);
-
-       BT_DBG("-");
-       return G_SOURCE_REMOVE;
-}
-
-static gboolean need_same_context(oal_event_t event)
-{
-       gboolean ret;
-
-       switch (event) {
-       default:
-               ret = FALSE;
-               break;
-       }
-       return ret;
-}
-
-void _bt_event_dispatcher_init(oal_event_callback cb)
-{
-       event_handler_cb = cb;
-       BT_DBG("+");
-       /* Spawn a background thread and pass it a reference to its
-        * GMainContext. Retain a reference for use in this thread
-        * too. */
-       event_thread_context = g_main_context_new();
-       g_thread_new("OALEventScheduler", __event_handler_loop, NULL);
-}
-
-void send_event_no_trace(oal_event_t event, gpointer event_data, gsize len)
-{
-       event_t *event_info;
-
-       /* Create a data closure to pass all the desired variables
-        * between threads. */
-       event_info = g_slice_new0(event_t);
-       event_info->event = event;
-       event_info->size = len;
-       event_info->event_data = event_data;
-       /* Invoke the function. */
-
-       if (need_same_context(event)) {
-               BT_INFO("Without context change");
-               dispatch_idle(event_info);
-               event_data_free(event_info);
-       } else
-               g_main_context_invoke_full(event_thread_context,
-                               G_PRIORITY_DEFAULT, dispatch_idle,
-                               event_info,
-                               (GDestroyNotify) event_data_free);
-}
-
-void send_event_bda_trace(oal_event_t event, gpointer event_data, gsize len, bt_address_t *address)
-{
-       if (event != OAL_EVENT_BLE_REMOTE_DEVICE_FOUND) {
-               if (address) {
-                       bdstr_t bdstr;
-                       EVENT_TRACE("[%s] %s", bdt_bd2str(address, &bdstr), str_event[event]);
-               } else
-                       EVENT_TRACE(" %s", str_event[event]);
-       }
-       send_event_no_trace(event, event_data, len);
-}
-
-void send_event(oal_event_t event, gpointer event_data, gsize len)
-{
-       send_event_bda_trace(event, event_data, len, NULL);
-}
-#undef _OAL_EVENT_DISPATCHER_C_
diff --git a/common/oal-utils.c b/common/oal-utils.c
deleted file mode 100644 (file)
index 4cec7a5..0000000
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdlib.h>
-#include <stdio.h>
-
-#include <dlog.h>
-#include <string.h>
-#include <bluetooth.h>
-#include "oal-utils.h"
-
-char *bdt_bd2str(const bt_address_t *bdaddr, bdstr_t *bdstr)
-{
-       const uint8_t *addr = bdaddr->addr;
-
-       if (bdaddr == NULL) {
-               *bdstr[0] = 0;
-               return *bdstr;
-       }
-
-       snprintf(*bdstr, sizeof(bdstr_t), "%02x:%02x:%02x:%02x:%02x:%02x",
-                       addr[0], addr[1], addr[2],
-                       addr[3], addr[4], addr[5]);
-       return *bdstr;
-}
-
-char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf)
-{
-       const uint8_t *p;
-
-       if (!bd_addr)
-               return strncpy(buf, "NULL", sizeof("NULL"));
-       p = bd_addr->address;
-
-       snprintf(buf, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
-                       p[0], p[1], p[2], p[3], p[4], p[5]);
-
-       return buf;
-}
-
-char *bdaddr_2_str(const bt_bdaddr_t *bd_addr)
-{
-       static char buf[18];
-       return convert_bdaddr_2_str(bd_addr, buf);
-}
-
-void string_to_uuid(char *str, service_uuid_t *p_uuid)
-{
-       uint32_t uuid0, uuid4;
-       uint16_t uuid1, uuid2, uuid3, uuid5;
-
-       sscanf(str, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
-                       &uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
-
-       uuid0 = htonl(uuid0);
-       uuid1 = htons(uuid1);
-       uuid2 = htons(uuid2);
-       uuid3 = htons(uuid3);
-       uuid4 = htonl(uuid4);
-       uuid5 = htons(uuid5);
-
-       memcpy(&(p_uuid->uuid[0]), &uuid0, 4);
-       memcpy(&(p_uuid->uuid[4]), &uuid1, 2);
-       memcpy(&(p_uuid->uuid[6]), &uuid2, 2);
-       memcpy(&(p_uuid->uuid[8]), &uuid3, 2);
-       memcpy(&(p_uuid->uuid[10]), &uuid4, 4);
-       memcpy(&(p_uuid->uuid[14]), &uuid5, 2);
-
-       return;
-}
-
-void oal_print_device_address_t(const bt_address_t *addr)
-{
-       BT_INFO("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", addr->addr[0], addr->addr[1], addr->addr[2],
-                       addr->addr[3], addr->addr[4], addr->addr[5]);
-}
-
-void oal_convert_addr_string_to_type(unsigned char *addr,
-               const char *address)
-{
-       int i;
-       char *ptr = NULL;
-
-       for (i = 0; i < BT_ADDRESS_BYTES_NUM; i++) {
-               addr[i] = strtol(address, &ptr, 16);
-               if (ptr != NULL) {
-                       if (ptr[0] != ':')
-                               return;
-                       address = ptr + 1;
-               }
-       }
-}
-
-int oal_is_address_zero(unsigned char *addr1)
-{
-       int i;
-       for (i = 0; i < BT_ADDRESS_BYTES_NUM; i++) {
-               if (addr1[i] == 0)
-                       continue;
-
-               break;
-       }
-       if (i == BT_ADDRESS_BYTES_NUM)
-               return 1;
-       else
-               return 0;
-}
-
-void uuid_to_string(service_uuid_t *p_uuid, char *str)
-{
-       uint32_t uuid0, uuid4;
-       uint16_t uuid1, uuid2, uuid3, uuid5;
-
-       memcpy(&uuid0, &(p_uuid->uuid[0]), 4);
-       memcpy(&uuid1, &(p_uuid->uuid[4]), 2);
-       memcpy(&uuid2, &(p_uuid->uuid[6]), 2);
-       memcpy(&uuid3, &(p_uuid->uuid[8]), 2);
-       memcpy(&uuid4, &(p_uuid->uuid[10]), 4);
-       memcpy(&uuid5, &(p_uuid->uuid[14]), 2);
-
-       snprintf((char *)str, BT_UUID_STRING_MAX, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
-                       ntohl(uuid0), ntohs(uuid1),
-                       ntohs(uuid2), ntohs(uuid3),
-                       ntohl(uuid4), ntohs(uuid5));
-}
-
-void uuid_to_stringname(service_uuid_t *p_uuid, char *str)
-{
-       uint32_t uuid0, uuid4;
-       uint16_t uuid1, uuid2, uuid3, uuid5;
-       const char *uuid_name;
-       const char *uuid_name1;
-
-       memcpy(&uuid0, &(p_uuid->uuid[0]), 4);
-       memcpy(&uuid1, &(p_uuid->uuid[4]), 2);
-       memcpy(&uuid2, &(p_uuid->uuid[6]), 2);
-       memcpy(&uuid3, &(p_uuid->uuid[8]), 2);
-       memcpy(&uuid4, &(p_uuid->uuid[10]), 4);
-       memcpy(&uuid5, &(p_uuid->uuid[14]), 2);
-
-
-       uuid_name = dump_uuid_name(ntohl(uuid0));
-       uuid_name1 = dump_uuid_name((ntohl(uuid4) >> 16));
-
-       BT_DBG("UUID Name [%s]", uuid_name);
-       BT_DBG("UUID Name Shifted [%s]", uuid_name1);
-
-       snprintf((char *)str, 2*BT_UUID_STRING_MAX, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x--%s",
-                       ntohl(uuid0), ntohs(uuid1),
-                       ntohs(uuid2), ntohs(uuid3),
-                       ntohl(uuid4), ntohs(uuid5),
-                       !(g_strcmp0(dump_uuid_name(ntohl(uuid0)), "--")) ? dump_uuid_name(((uuid4) >> 16)) : uuid_name);
-}
-
-int hex2bin(const char *s)
-{
-       int ret = 0;
-       int i;
-       for (i = 0; i < 2; i++) {
-               char c = *s++;
-               int n = 0;
-               if ('0' <= c && c <= '9')
-                       n = c-'0';
-               else if ('a' <= c && c <= 'f')
-                       n = 10 + c-'a';
-               else if ('A' <= c && c <= 'F')
-                       n = 10 + c-'A';
-               ret = n + ret*16;
-       }
-       return ret;
-}
-
-void convert_str_2_hex(unsigned char out[], char in[])
-{
-       int i = 0;
-       for (i = 0; i < 62; i++) {
-               out[i] = hex2bin(in); \
-                        in += 2; \
-       }
-}
-
-void convert_hex_2_str(unsigned char * hex, int len, char * str_out)
-{
-       int i = 0;
-
-       for (i = 0; i < len; i++)
-               snprintf(str_out + (i * 3), 3*(len - i), "%02x ", hex[i]);
-
-       str_out[3*len] = 0;
-}
-
-void print_bt_properties(int num_properties, bt_property_t *properties)
-{
-       int i;
-       for (i = 0; i < num_properties; i++) {
-               bt_property_t prop;
-               memcpy(&prop, properties + i, sizeof(prop));
-               BT_INFO("prop: %s\n", convert_bt_property_2_str(&prop));
-       }
-}
-
-char* convert_scan_mode_2_str(bt_scan_mode_t scan_mode)
-{
-       switch (scan_mode) {
-       case BT_SCAN_MODE_NONE:
-               return "Non Scannable";
-       case BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE:
-               return "Connectable And Discoverable";
-       case BT_SCAN_MODE_CONNECTABLE:
-               return "Connectable";
-       default:
-               return "Unknown Scan Mode";
-       }
-
-}
-
-char* convert_device_type_2_str(bt_device_type_t device_type)
-{
-       switch (device_type) {
-       case BT_DEVICE_DEVTYPE_BREDR:
-               return "BREDR Device";
-       case BT_DEVICE_DEVTYPE_BLE:
-               return "BLE Device";
-       case BT_DEVICE_DEVTYPE_DUAL:
-               return "Dual Device";
-       default:
-               return "Unknown Device Type";
-       }
-}
-
-char *convert_bt_property_2_str(const bt_property_t *property)
-{
-       static char buf[4096];
-       char *p;
-
-       p = buf + snprintf(buf, 4096, "type=%s len=%d val=",
-                       convert_property_type_2_str(property->type),
-                       property->len);
-
-       switch (property->type) {
-       case BT_PROPERTY_BDNAME:
-       case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
-               snprintf(p, property->len + 1, "%s",
-                               ((bt_bdname_t *) property->val)->name);
-               break;
-       case BT_PROPERTY_BDADDR:
-               sprintf(p, "%s", bdaddr_2_str((bt_bdaddr_t *) property->val));
-               break;
-       case BT_PROPERTY_CLASS_OF_DEVICE:
-               sprintf(p, "%06x", *((unsigned int *) property->val));
-               break;
-       case BT_PROPERTY_TYPE_OF_DEVICE:
-               sprintf(p, "%s", convert_device_type_2_str(
-                                       *((bt_device_type_t *) property->val)));
-               break;
-       case BT_PROPERTY_REMOTE_RSSI:
-               sprintf(p, "%d", *((char *) property->val));
-               break;
-       case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
-               sprintf(p, "%d", *((unsigned int *) property->val));
-               break;
-       case BT_PROPERTY_ADAPTER_SCAN_MODE:
-               sprintf(p, "%s",
-                               convert_scan_mode_2_str(*((bt_scan_mode_t *) property->val)));
-               break;
-       case BT_PROPERTY_ADAPTER_BONDED_DEVICES:
-               break;
-       case BT_PROPERTY_UUIDS:
-               break;
-       case BT_PROPERTY_SERVICE_RECORD:
-               break;
-               /* Tizen BlueZ specific Device properties */
-       case BT_PROPERTY_REMOTE_PAIRED:
-               sprintf(p, "%d", *((uint8_t *) property->val));
-               break;
-       case BT_PROPERTY_REMOTE_CONNECTED:
-               sprintf(p, "%d", *((unsigned int *) property->val));
-               break;
-       case BT_PROPERTY_REMOTE_TRUST:
-               sprintf(p, "%d", *((uint8_t *) property->val));
-               break;
-       case BT_PROPERTY_PAIRABLE:
-               sprintf(p, "%d", *((uint8_t *) property->val));
-               break;
-       case BT_PROPERTY_VERSION:
-               snprintf(p, property->len + 1, "%s",
-                               ((char *) property->val));
-               break;
-       case BT_PROPERTY_LOCAL_LE_FEATURES:
-               local_le_feat_2_string(p, property->val);
-               break;
-       case BT_PROPERTY_PAIRABLE_TIMEOUT:
-               sprintf(p, "%d", *((unsigned int *) property->val));
-               break;
-       case BT_PROPERTY_IPSP_INITIALIZED:
-               sprintf(p, "%d", *((uint8_t *) property->val));
-               break;
-       case BT_PROPERTY_MODALIAS:
-               snprintf(p, property->len + 1, "%s",
-                               ((char *) property->val));
-               break;
-       case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN:
-               sprintf(p, "%d", *((unsigned int *) property->val));
-               break;
-       case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA: {
-               int indx;
-               char *pppp = property->val;
-               for (indx = 0; indx < property->len; indx++)
-                       p += sprintf(p, " %2.2X", pppp[indx]);
-               break;
-       }
-       case BT_PROPERTY_REMOTE_BLE_ADV_DATA: {
-               int indx;
-               char *pppp = property->val;
-               for (indx = 0; indx < property->len; indx++)
-                       p += sprintf(p, " %2.2X", pppp[indx]);
-               break;
-       }
-       case BT_PROPERTY_REMOTE_IS_ALIAS_SET: {
-               sprintf(p, "%d", *((uint8_t *) property->val));
-               break;
-       }
-       /* End of Tizen BlueZ specific device propeties */
-       case BT_PROPERTY_REMOTE_VERSION_INFO:
-       case BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP:
-       default:
-               sprintf(p, "%p", property->val);
-               break;
-       }
-       return buf;
-}
-
-char *dump_char_prop(uint8_t prop)
-{
-       switch (prop) {
-       CASE_RETURN_STR(BROADCAST);
-       CASE_RETURN_STR(READ);
-       CASE_RETURN_STR(WRITE_NR);
-       CASE_RETURN_STR(WRITE);
-       CASE_RETURN_STR(NOTIFY);
-       CASE_RETURN_STR(INDICATE);
-       CASE_RETURN_STR(AUTH);
-       CASE_RETURN_STR(EXT_PROP);
-       default:
-               return "--";
-       }
-}
-
-char *dump_char_perm(uint8_t perm)
-{
-       switch (perm) {
-       CASE_RETURN_STR(RD);
-       CASE_RETURN_STR(WR);
-       CASE_RETURN_STR(ENCRYPT_RD);
-       CASE_RETURN_STR(ENCRYPT_WR);
-       CASE_RETURN_STR(ENC_AUTH_RD);
-       CASE_RETURN_STR(ENC_AUTH_WR);
-       default:
-               return "--";
-       }
-}
-
-char *char_prop_to_string(uint8_t prop, char *str)
-{
-       int i, ret = 0;
-       char *ptr = str;
-
-       for (i = 0; i < 8; i++) {
-               if (prop & (1 << i)) {
-                       ret = snprintf(ptr, 11, "%s|", dump_char_prop(prop & (1 << i)));
-                       ptr += ret;
-               }
-       }
-       --ptr;
-       *ptr = '\0';
-       return str;
-}
-
-char *char_perm_to_string(uint8_t perm, char *str)
-{
-       int i, ret = 0;
-       char *ptr = str;
-
-       for (i = 0; i < 6; i++) {
-               if (perm & (1 << i)) {
-                       ret = snprintf(ptr, 13, "%s|", dump_char_perm(perm & (1 << i)));
-                       ptr += ret;
-               }
-       }
-       --ptr;
-       *ptr = '\0';
-       return str;
-}
-
-void local_le_feat_2_string(char *str, const bt_local_le_features_t *f)
-{
-       uint16_t scan_num;
-
-       str += snprintf(str, strlen(str), "{\n");
-
-       str += sprintf(str, "Privacy supported: %s,\n",
-                       f->local_privacy_enabled ? "TRUE" : "FALSE");
-
-       str += sprintf(str, "Num of advertising instances: %u,\n",
-                       f->max_adv_instance);
-
-       str += sprintf(str, "PRA offloading support: %s,\n",
-                       f->rpa_offload_supported ? "TRUE" : "FALSE");
-
-       str += sprintf(str, "Num of offloaded IRKs: %u,\n",
-                       f->max_irk_list_size);
-
-       str += sprintf(str, "Num of offloaded scan filters: %u,\n",
-                       f->max_adv_filter_supported);
-
-       scan_num = (f->scan_result_storage_size_hibyte << 8) +
-               f->scan_result_storage_size_lobyte;
-
-       str += sprintf(str, "Num of offloaded scan results: %u,\n", scan_num);
-
-       str += sprintf(str, "Activity & energy report support: %s\n",
-                       f->activity_energy_info_supported ? "TRUE" : "FALSE");
-
-       sprintf(str, "}");
-}
-
-char* convert_property_type_2_str(bt_property_type_t prop_type)
-{
-       switch (prop_type) {
-       case BT_PROPERTY_BDNAME:
-               return "[Bluetooth Name]";
-       case BT_PROPERTY_BDADDR:
-               return "[Bluetooth Address]";
-       case BT_PROPERTY_UUIDS:
-               return "[UUIDS]";
-       case BT_PROPERTY_CLASS_OF_DEVICE:
-               return "[Class of Device]";
-       case BT_PROPERTY_TYPE_OF_DEVICE:
-               return "[Bluetooth Type of Device]";
-       case BT_PROPERTY_SERVICE_RECORD:
-               return "[Bluetooth Service record]";
-       case BT_PROPERTY_ADAPTER_SCAN_MODE:
-               return "[Bluetooth Adapter Scan Mode]";
-       case BT_PROPERTY_ADAPTER_BONDED_DEVICES:
-               return "[Bluetooth Bonded Devices]";
-       case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
-               return "[Bluetooth Adapter Discovery Timeout]";
-       case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
-               return "[Bluetooth Friendly Name]";
-       case BT_PROPERTY_REMOTE_RSSI:
-               return "[Bluetooth Rmote RSSI]";
-       case BT_PROPERTY_REMOTE_VERSION_INFO:
-               return "[Bluetooth Version Info]";
-       case BT_PROPERTY_LOCAL_LE_FEATURES:
-               return "[Bluetooth LE Features]";
-       case BT_PROPERTY_REMOTE_PAIRED:
-               return "[Bluetooth Remote Paired]";
-       case BT_PROPERTY_REMOTE_CONNECTED:
-               return "[Bluetooth Remote Connected]";
-       case BT_PROPERTY_REMOTE_TRUST:
-               return "[Bluetooth Remote TRUST]";
-       case BT_PROPERTY_PAIRABLE:
-               return "[Bluetooth Pairable]";
-       case BT_PROPERTY_PAIRABLE_TIMEOUT:
-               return "[Bluetooth Pairable Timeout]";
-       case BT_PROPERTY_VERSION:
-               return "[Bluetooth Version]";
-       case BT_PROPERTY_IPSP_INITIALIZED:
-               return "[Bluetooth IPSP Initialized]";
-       case BT_PROPERTY_MODALIAS:
-               return "[Bluetooth ModAlias]";
-       case BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP:
-               return "[Bluetooth Remote Device Timestamp]";
-       case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN:
-               return "[Bluetooth Remote Device Manufacturer Data Len]";
-       case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA:
-               return "[Bluetooth Remote Device Manufacturer Data]";
-       case BT_PROPERTY_REMOTE_BLE_ADV_DATA:
-               return "[Bluetooth Remote Device LE Advertising Data]";
-       default:
-               return "[Default Property]";
-       }
-}
-
-const char *dump_uuid_name(int uuid_no)
-{
-       switch (uuid_no) {
-       CASE_RETURN_STR(BASE)
-       CASE_RETURN_STR(SDP)
-       CASE_RETURN_STR(UDP)
-       CASE_RETURN_STR(RFCOMM)
-       CASE_RETURN_STR(TCP)
-       CASE_RETURN_STR(TCS_BIN)
-       CASE_RETURN_STR(TCS_AT)
-       CASE_RETURN_STR(ATT)
-       CASE_RETURN_STR(OBEX)
-       CASE_RETURN_STR(IP)
-       CASE_RETURN_STR(FTP)
-       CASE_RETURN_STR(HTTP)
-       CASE_RETURN_STR(WSP)
-       CASE_RETURN_STR(BNEP)
-       CASE_RETURN_STR(UPNP)
-       CASE_RETURN_STR(HIDP)
-       CASE_RETURN_STR(HardcopyControlChannel)
-       CASE_RETURN_STR(HardcopyDataChannel)
-       CASE_RETURN_STR(HardcopyNotification)
-       CASE_RETURN_STR(AVCTP)
-       CASE_RETURN_STR(AVDTP)
-       CASE_RETURN_STR(CMTP)
-       CASE_RETURN_STR(MCAPControlChannel)
-       CASE_RETURN_STR(MCAPDataChannel)
-       CASE_RETURN_STR(L2CAP)
-       CASE_RETURN_STR(ServiceDiscoveryServerServiceClassID)
-       CASE_RETURN_STR(BrowseGroupDescriptorServiceClassID)
-       CASE_RETURN_STR(SerialPort)
-       CASE_RETURN_STR(LANAccessUsingPPP)
-       CASE_RETURN_STR(DialupNetworking)
-       CASE_RETURN_STR(IrMCSync)
-       CASE_RETURN_STR(OBEXObjectPush)
-       CASE_RETURN_STR(OBEXFileTransfer)
-       CASE_RETURN_STR(IrMCSyncCommand)
-       CASE_RETURN_STR(Headset)
-       CASE_RETURN_STR(CordlessTelephony)
-       CASE_RETURN_STR(AudioSource)
-       CASE_RETURN_STR(AudioSink)
-       CASE_RETURN_STR(AV_RemoteControlTarget)
-       CASE_RETURN_STR(AdvancedAudioDistribution)
-       CASE_RETURN_STR(AV_RemoteControl)
-       CASE_RETURN_STR(AV_RemoteControlController)
-       CASE_RETURN_STR(Intercom)
-       CASE_RETURN_STR(Fax)
-       CASE_RETURN_STR(Headset_Audio_Gateway)
-       CASE_RETURN_STR(WAP)
-       CASE_RETURN_STR(WAP_CLIENT)
-       CASE_RETURN_STR(PANU)
-       CASE_RETURN_STR(NAP)
-       CASE_RETURN_STR(GN)
-       CASE_RETURN_STR(DirectPrinting)
-       CASE_RETURN_STR(ReferencePrinting)
-       CASE_RETURN_STR(Basic_Imaging_Profile)
-       CASE_RETURN_STR(ImagingResponder)
-       CASE_RETURN_STR(ImagingAutomaticArchive)
-       CASE_RETURN_STR(ImagingReferencedObjects)
-       CASE_RETURN_STR(Handsfree)
-       CASE_RETURN_STR(HandsfreeAudioGateway)
-       CASE_RETURN_STR(DirectPrintingReferenceObjectsService)
-       CASE_RETURN_STR(ReflectedUI)
-       CASE_RETURN_STR(BasicPrinting)
-       CASE_RETURN_STR(PrintingStatus)
-       CASE_RETURN_STR(HumanInterfaceDeviceService)
-       CASE_RETURN_STR(HardcopyCableReplacement)
-       CASE_RETURN_STR(HCR_Print)
-       CASE_RETURN_STR(HCR_Scan)
-       CASE_RETURN_STR(Common_ISDN_Access)
-       CASE_RETURN_STR(SIM_Access)
-       CASE_RETURN_STR(Phonebook_Access_PCE)
-       CASE_RETURN_STR(Phonebook_Access_PSE)
-       CASE_RETURN_STR(Phonebook_Access)
-       CASE_RETURN_STR(Headset_HS)
-       CASE_RETURN_STR(Message_Access_Server)
-       CASE_RETURN_STR(Message_Notification_Server)
-       CASE_RETURN_STR(Message_Access_Profile)
-       CASE_RETURN_STR(GNSS)
-       CASE_RETURN_STR(GNSS_Server)
-       CASE_RETURN_STR(ThreeD_Display)
-       CASE_RETURN_STR(ThreeD_Glasses)
-       CASE_RETURN_STR(ThreeD_Synchronization)
-       CASE_RETURN_STR(MPS_Profile)
-       CASE_RETURN_STR(MPS_SC)
-       CASE_RETURN_STR(CTN_Access_Service)
-       CASE_RETURN_STR(CTN_Notification_Service)
-       CASE_RETURN_STR(CTN_Profile)
-       CASE_RETURN_STR(PnPInformation)
-       CASE_RETURN_STR(GenericNetworking)
-       CASE_RETURN_STR(GenericFileTransfer)
-       CASE_RETURN_STR(GenericAudio)
-       CASE_RETURN_STR(GenericTelephony)
-       CASE_RETURN_STR(UPNP_Service)
-       CASE_RETURN_STR(UPNP_IP_Service)
-       CASE_RETURN_STR(ESDP_UPNP_IP_PAN)
-       CASE_RETURN_STR(ESDP_UPNP_IP_LAP)
-       CASE_RETURN_STR(ESDP_UPNP_L2CAP)
-       CASE_RETURN_STR(VideoSource)
-       CASE_RETURN_STR(VideoSink)
-       CASE_RETURN_STR(VideoDistribution)
-       CASE_RETURN_STR(HDP)
-       CASE_RETURN_STR(HDP_Source)
-       CASE_RETURN_STR(HDP_Sink)
-       CASE_RETURN_STR(Generic_Access)
-       CASE_RETURN_STR(Generic_Attribute)
-       CASE_RETURN_STR(Immediate_Alert)
-       CASE_RETURN_STR(Link_Loss)
-       CASE_RETURN_STR(Tx_Power)
-       CASE_RETURN_STR(Current_Time)
-       CASE_RETURN_STR(Reference_Time_Update)
-       CASE_RETURN_STR(Next_Dst_Change)
-       CASE_RETURN_STR(Glucose)
-       CASE_RETURN_STR(Health_Thermometer)
-       CASE_RETURN_STR(Device_Information)
-       CASE_RETURN_STR(Heart_Rate)
-       CASE_RETURN_STR(Phone_Alert_Status)
-       CASE_RETURN_STR(Battery_Service)
-       CASE_RETURN_STR(Blood_Pressure)
-       CASE_RETURN_STR(Alert_Notification)
-       CASE_RETURN_STR(Human_Interface_Device)
-       CASE_RETURN_STR(Scan_Parameters)
-       CASE_RETURN_STR(Running_Speed_And_Cadence)
-       CASE_RETURN_STR(Automation_IO)
-       CASE_RETURN_STR(Cycling_Speed_And_Cadence)
-       CASE_RETURN_STR(Cycling_Power)
-       CASE_RETURN_STR(Location_And_Navigation)
-       CASE_RETURN_STR(Environmental_Sensing)
-       CASE_RETURN_STR(Body_Composition)
-       CASE_RETURN_STR(User_Data)
-       CASE_RETURN_STR(Weight_Scale)
-       CASE_RETURN_STR(Bond_Management)
-       CASE_RETURN_STR(Continuous_Glucose_Monitoring)
-       CASE_RETURN_STR(Internet_Protocol_Support)
-       CASE_RETURN_STR(Indoor_Positioning)
-       CASE_RETURN_STR(Pulse_Oximeter)
-       CASE_RETURN_STR(Http_Proxy)
-       CASE_RETURN_STR(Transport_Discovery)
-       CASE_RETURN_STR(Object_Transfer)
-       CASE_RETURN_STR(Gap_Device_Name)
-       CASE_RETURN_STR(Gap_Appearance)
-       CASE_RETURN_STR(Gap_Peripheral_Privacy_Flag)
-       CASE_RETURN_STR(Gap_Reconnection_Address)
-       CASE_RETURN_STR(Gap_Peripheral_Preferred_Connection_Parameters)
-       CASE_RETURN_STR(Gatt_Service_Changed)
-       CASE_RETURN_STR(Alert_Level)
-       CASE_RETURN_STR(Tx_Power_Level)
-       CASE_RETURN_STR(Date_Time)
-       CASE_RETURN_STR(Day_Of_Week)
-       CASE_RETURN_STR(Day_Date_Time)
-       CASE_RETURN_STR(Exact_Time_256)
-       CASE_RETURN_STR(Dst_Offset)
-       CASE_RETURN_STR(Time_Zone)
-       CASE_RETURN_STR(Local_Time_Information)
-       CASE_RETURN_STR(Time_With_Dst)
-       CASE_RETURN_STR(Time_Accuracy)
-       CASE_RETURN_STR(Time_Source)
-       CASE_RETURN_STR(Reference_Time_Information)
-       CASE_RETURN_STR(Time_Update_Control_Point)
-       CASE_RETURN_STR(Time_Update_State)
-       CASE_RETURN_STR(Glucose_Measurement)
-       CASE_RETURN_STR(Battery_Level)
-       CASE_RETURN_STR(Temperature_Measurement)
-       CASE_RETURN_STR(Temperature_Type)
-       CASE_RETURN_STR(Intermediate_Temperature)
-       CASE_RETURN_STR(Measurement_Interval)
-       CASE_RETURN_STR(Boot_Keyboard_Input_Report)
-       CASE_RETURN_STR(System_Id)
-       CASE_RETURN_STR(Model_Number_String)
-       CASE_RETURN_STR(Serial_Number_String)
-       CASE_RETURN_STR(Firmware_Revision_String)
-       CASE_RETURN_STR(Hardware_Revision_String)
-       CASE_RETURN_STR(Software_Revision_String)
-       CASE_RETURN_STR(Manufacturer_Name_String)
-       CASE_RETURN_STR(Regulatory_Certification_Data_List)
-       CASE_RETURN_STR(Current_Time_Charac)
-       CASE_RETURN_STR(Magnetic_Declination)
-       CASE_RETURN_STR(Scan_Refresh)
-       CASE_RETURN_STR(Boot_Keyboard_Output_Report)
-       CASE_RETURN_STR(Boot_Mouse_Input_Report)
-       CASE_RETURN_STR(Glucose_Measurement_Context)
-       CASE_RETURN_STR(Blood_Pressure_Measurement)
-       CASE_RETURN_STR(Intermediate_Cuff_Pressure)
-       CASE_RETURN_STR(Heart_Rate_Measurement)
-       CASE_RETURN_STR(Body_Sensor_Location)
-       CASE_RETURN_STR(Heart_Rate_Control_Point)
-       CASE_RETURN_STR(Alert_Status)
-       CASE_RETURN_STR(Ringer_Control_Point)
-       CASE_RETURN_STR(Ringer_Setting)
-       CASE_RETURN_STR(Alert_Category_Id_Bit_Mask)
-       CASE_RETURN_STR(Alert_Category_Id)
-       CASE_RETURN_STR(Alert_Notification_Control_Point)
-       CASE_RETURN_STR(Unread_Alert_Status)
-       CASE_RETURN_STR(New_Alert)
-       CASE_RETURN_STR(Supported_New_Alert_Category)
-       CASE_RETURN_STR(Supported_Unread_Alert_Category)
-       CASE_RETURN_STR(Blood_Pressure_Feature)
-       CASE_RETURN_STR(Hid_Information)
-       CASE_RETURN_STR(Report_Map)
-       CASE_RETURN_STR(Hid_Control_Point)
-       CASE_RETURN_STR(Report)
-       CASE_RETURN_STR(Protocol_Mode)
-       CASE_RETURN_STR(Scan_Interval_Window)
-       CASE_RETURN_STR(Pnp_Id)
-       CASE_RETURN_STR(Glucose_Feature)
-       CASE_RETURN_STR(Record_Access_Control_Point)
-       CASE_RETURN_STR(Rsc_Measurement)
-       CASE_RETURN_STR(Rsc_Feature)
-       CASE_RETURN_STR(Sc_Control_Point)
-       CASE_RETURN_STR(Digital)
-       CASE_RETURN_STR(Analog)
-       CASE_RETURN_STR(Aggregate)
-       CASE_RETURN_STR(Csc_Measurement)
-       CASE_RETURN_STR(Csc_Feature)
-       CASE_RETURN_STR(Sensor_Location)
-       CASE_RETURN_STR(Plx_Spot_Check_Measurement)
-       CASE_RETURN_STR(Plx_Continuous_Measurement)
-       CASE_RETURN_STR(Plx_Features)
-       CASE_RETURN_STR(Cycling_Power_Measurement)
-       CASE_RETURN_STR(Cycling_Power_Vector)
-       CASE_RETURN_STR(Cycling_Power_Feature)
-       CASE_RETURN_STR(Cycling_Power_Control_Point)
-       CASE_RETURN_STR(Location_And_Speed)
-       CASE_RETURN_STR(Navigation)
-       CASE_RETURN_STR(Position_Quality)
-       CASE_RETURN_STR(Ln_Feature)
-       CASE_RETURN_STR(Ln_Control_Point)
-       CASE_RETURN_STR(Elevation)
-       CASE_RETURN_STR(Pressure)
-       CASE_RETURN_STR(Temperature)
-       CASE_RETURN_STR(Humidity)
-       CASE_RETURN_STR(True_Wind_Speed)
-       CASE_RETURN_STR(True_Wind_Direction)
-       CASE_RETURN_STR(Apparent_Wind_Speed)
-       CASE_RETURN_STR(Apparent_Wind_Direction)
-       CASE_RETURN_STR(Gust_Factor)
-       CASE_RETURN_STR(Pollen_Concentration)
-       CASE_RETURN_STR(Uv_Index)
-       CASE_RETURN_STR(Irradiance)
-       CASE_RETURN_STR(Rainfall)
-       CASE_RETURN_STR(Wind_Chill)
-       CASE_RETURN_STR(Heat_Index)
-       CASE_RETURN_STR(Dew_Point)
-       CASE_RETURN_STR(Descriptor_Value_Changed)
-       CASE_RETURN_STR(Aerobic_Threshold)
-       CASE_RETURN_STR(Age)
-       CASE_RETURN_STR(Anaerobic_Heart_Rate_Lower_Limit)
-       CASE_RETURN_STR(Anaerobic_Heart_Rate_Upper_Limit)
-       CASE_RETURN_STR(Anaerobic_Threshold)
-       CASE_RETURN_STR(Aerobic_Heart_Rate_Upper_Limit)
-       CASE_RETURN_STR(Date_Of_Birth)
-       CASE_RETURN_STR(Date_Of_Threshold_Assessment)
-       CASE_RETURN_STR(Email_Address)
-       CASE_RETURN_STR(Fat_Burn_Heart_Rate_Lower_Limit)
-       CASE_RETURN_STR(Fat_Burn_Heart_Rate_Upper_Limit)
-       CASE_RETURN_STR(First_Name)
-       CASE_RETURN_STR(Five_Zone_Heart_Rate_Limits)
-       CASE_RETURN_STR(Gender)
-       CASE_RETURN_STR(Heart_Rate_Max)
-       CASE_RETURN_STR(Height)
-       CASE_RETURN_STR(Hip_Circumference)
-       CASE_RETURN_STR(Last_Name)
-       CASE_RETURN_STR(Maximum_Recommended_Heart_Rate)
-       CASE_RETURN_STR(Resting_Heart_Rate)
-       CASE_RETURN_STR(Sport_Type_For_Aerobic_And_Anaerobic_Thresholds)
-       CASE_RETURN_STR(Three_Zone_Heart_Rate_Limits)
-       CASE_RETURN_STR(Two_Zone_Heart_Rate_Limit)
-       CASE_RETURN_STR(Vo2_Max)
-       CASE_RETURN_STR(Waist_Circumference)
-       CASE_RETURN_STR(Weight)
-       CASE_RETURN_STR(Database_Change_Increment)
-       CASE_RETURN_STR(User_Index)
-       CASE_RETURN_STR(Body_Composition_Feature)
-       CASE_RETURN_STR(Body_Composition_Measurement)
-       CASE_RETURN_STR(Weight_Measurement)
-       CASE_RETURN_STR(Weight_Scale_Feature)
-       CASE_RETURN_STR(User_Control_Point)
-       CASE_RETURN_STR(Magnetic_Flux_Density_2D)
-       CASE_RETURN_STR(Magnetic_Flux_Density_3D)
-       CASE_RETURN_STR(Language)
-       CASE_RETURN_STR(Barometric_Pressure_Trend)
-       CASE_RETURN_STR(Bond_Management_Control_Point)
-       CASE_RETURN_STR(Bond_Management_Feature)
-       CASE_RETURN_STR(Gap_Central_Address_Resolution_Support)
-       CASE_RETURN_STR(Cgm_Measurement)
-       CASE_RETURN_STR(Cgm_Feature)
-       CASE_RETURN_STR(Cgm_Status)
-       CASE_RETURN_STR(Cgm_Session_Start_Time)
-       CASE_RETURN_STR(Cgm_Session_Run_Time)
-       CASE_RETURN_STR(Cgm_Specific_Ops_Control_Point)
-       CASE_RETURN_STR(Indoor_Positioning_Configuration)
-       CASE_RETURN_STR(Latitude)
-       CASE_RETURN_STR(Longitude)
-       CASE_RETURN_STR(Local_North_Coordinate)
-       CASE_RETURN_STR(Local_East_Coordinate)
-       CASE_RETURN_STR(Floor_Number)
-       CASE_RETURN_STR(Altitude)
-       CASE_RETURN_STR(Uncertainty)
-       CASE_RETURN_STR(Location_Name)
-       CASE_RETURN_STR(Uri)
-       CASE_RETURN_STR(Http_Headers)
-       CASE_RETURN_STR(Http_Status_Code)
-       CASE_RETURN_STR(Http_Entity_Body)
-       CASE_RETURN_STR(Http_Control_Point)
-       CASE_RETURN_STR(Https_Security)
-       CASE_RETURN_STR(Tds_Control_Point)
-       CASE_RETURN_STR(Ots_Feature)
-       CASE_RETURN_STR(Object_Name)
-       CASE_RETURN_STR(Object_Type)
-       CASE_RETURN_STR(Object_Size)
-       CASE_RETURN_STR(Object_First_Created)
-       CASE_RETURN_STR(Object_Last_Modified)
-       CASE_RETURN_STR(Object_Id)
-       CASE_RETURN_STR(Object_Properties)
-       CASE_RETURN_STR(Object_Action_Control_Point)
-       CASE_RETURN_STR(Object_List_Control_Point)
-       CASE_RETURN_STR(Object_List_Filter)
-       CASE_RETURN_STR(Object_Changed)
-       CASE_RETURN_STR(Fitness_Machine_Control_Point)
-       CASE_RETURN_STR(Gatt_Characteristic_Extended_Properties)
-       CASE_RETURN_STR(Gatt_Characteristic_User_Description)
-       CASE_RETURN_STR(Gatt_Client_Characteristic_Configuration)
-       CASE_RETURN_STR(Gatt_Server_Characteristic_Configuration)
-       CASE_RETURN_STR(Gatt_Characteristic_Presentation_Format)
-       CASE_RETURN_STR(Gatt_Characteristic_Aggregate_Format)
-       CASE_RETURN_STR(Valid_Range)
-       CASE_RETURN_STR(External_Report_Reference)
-       CASE_RETURN_STR(Report_Reference)
-       CASE_RETURN_STR(Number_Of_Digitals)
-       CASE_RETURN_STR(Value_Trigger_Setting)
-       CASE_RETURN_STR(Es_Configuration)
-       CASE_RETURN_STR(Es_Measurement)
-       CASE_RETURN_STR(Es_Trigger_Setting)
-       CASE_RETURN_STR(Time_Trigger_Setting)
-       CASE_RETURN_STR(Gatt_Primary_Service_Declaration)
-       CASE_RETURN_STR(Gatt_Secondary_Service_Declaration)
-       CASE_RETURN_STR(Gatt_Include_Declaration)
-       CASE_RETURN_STR(Gatt_Characteristic_Declaration)
-       default:
-               return "--";
-       }
-}
diff --git a/common/oal-utils.h b/common/oal-utils.h
deleted file mode 100644 (file)
index 7c3a782..0000000
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
-* Open Adaptation Layer (OAL)
-*
-* Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
-*
-* 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 _OAL_UTILS_H_
-#define _OAL_UTILS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <arpa/inet.h>
-
-#include <sys/types.h>
-#include "oal-internal.h"
-
-#define ADVANCED_AUDIO_UUID            "0000110d-0000-1000-8000-00805f9b34fb"
-#define A2DP_SOURCE_UUID               "0000110a-0000-1000-8000-00805f9b34fb"
-#define A2DP_SINK_UUID                 "0000110b-0000-1000-8000-00805f9b34fb"
-#define AVRCP_REMOTE_UUID              "0000110e-0000-1000-8000-00805f9b34fb"
-#define AVRCP_TARGET_UUID              "0000110c-0000-1000-8000-00805f9b34fb"
-#define DEVICE_INFORMATION_UUID        "0000180a-0000-1000-8000-00805f9b34fb"
-#define HID_UUID                               "00001124-0000-1000-8000-00805f9b34fb"
-#define SPP_UUID                               "00001101-0000-1000-8000-00805f9b34fb"
-#define BASE_UUID                              "00000000-0000-1000-8000-00805F9B34FB"
-
-#define CASE_RETURN_STR(const) case const: return #const;
-
-// List of Protocols
-#define BASE                                    0x0000          //Base
-#define SDP                                     0x0001          //Bluetooth Core Specification
-#define UDP                                     0x0002          //[NO USE BY PROFILES]
-#define RFCOMM                                  0x0003          //RFCOMM with TS 07.10
-#define TCP                                     0x0004          //[NO USE BY PROFILES]
-#define TCS_BIN                                 0x0005          //Telephony Control Specification / TCS Binary [DEPRECATED]
-#define TCS_AT                                  0x0006          //[NO USE BY PROFILES]
-#define ATT                                     0x0007          //Attribute Protocol
-#define OBEX                                    0x0008          //IrDA Interoperability
-#define IP                                      0x0009          //[NO USE BY PROFILES]
-#define FTP                                     0x000A          //[NO USE BY PROFILES]
-#define HTTP                                    0x000C          //[NO USE BY PROFILES]
-#define WSP                                     0x000E          //[NO USE BY PROFILES]
-#define BNEP                                    0x000F          //Bluetooth Network Encapsulation Protocol (BNEP)
-#define UPNP                                    0x0010          //Extended Service Discovery Profile (ESDP) [DEPRECATED]
-#define HIDP                                    0x0011          //Human Interface Device Profile (HID)
-#define HardcopyControlChannel                  0x0012          //Hardcopy Cable Replacement Profile (HCRP)
-#define HardcopyDataChannel                     0x0014          //See Hardcopy Cable Replacement Profile (HCRP)
-#define HardcopyNotification                    0x0016          //Hardcopy Cable Replacement Profile (HCRP)
-#define AVCTP                                   0x0017          //Audio/Video Control Transport Protocol (AVCTP)
-#define AVDTP                                   0x0019          //Audio/Video Distribution Transport Protocol (AVDTP)
-#define CMTP                                    0x001B          //Common ISDN Access Profile (CIP) [DEPRECATED]
-#define MCAPControlChannel                      0x001E          //Multi-Channel Adaptation Protocol (MCAP)
-#define MCAPDataChannel                         0x001F          //Multi-Channel Adaptation Protocol (MCAP)
-#define L2CAP                                   0x0100          //Bluetooth Core Specification
-
-//List of Services
-#define ServiceDiscoveryServerServiceClassID    0x1000          //Bluetooth Core Specification Service Class
-#define BrowseGroupDescriptorServiceClassID     0x1001          //Bluetooth Core Specification Service Class
-#define SerialPort                              0x1101          //Serial Port Profile (SPP)
-#define LANAccessUsingPPP                       0x1102          //LAN Access Profile
-#define DialupNetworking                        0x1103          //Dial-up Networking Profile (DUN)
-#define IrMCSync                                0x1104          //Synchronization Profile (SYNC)
-#define OBEXObjectPush                          0x1105          //Object Push Profile (OPP)
-#define OBEXFileTransfer                        0x1106          //File Transfer Profile (FTP)
-#define IrMCSyncCommand                         0x1107          //Synchronization Profile (SYNC)
-#define Headset                                 0x1108          //Headset Profile (HSP)
-#define CordlessTelephony                       0x1109          //Cordless Telephony Profile (CTP)
-#define AudioSource                             0x110A          //Advanced Audio Distribution Profile (A2DP) Service Class
-#define AudioSink                               0x110B          //Advanced Audio Distribution Profile (A2DP) Service Class
-#define AV_RemoteControlTarget                  0x110C          //Audio/Video Remote Control Profile (AVRCP) Service Class
-#define AdvancedAudioDistribution               0x110D          //Advanced Audio Distribution Profile (A2DP) Profile
-#define AV_RemoteControl                        0x110E          //Audio/Video Remote Control Profile (AVRCP)
-#define AV_RemoteControlController              0x110F          //Audio/Video Remote Control Profile (AVRCP)
-#define Intercom                                0x1110          //Intercom Profile (ICP)
-#define Fax                                     0x1111          //Fax Profile (FAX)
-#define Headset_Audio_Gateway                   0x1112          //Headset Profile (HSP) Service Class
-#define WAP                                     0x1113          //Interoperability Requirements for Bluetooth technology as a WAP, Bluetooth SIG [DEPRECATED] Service Class
-#define WAP_CLIENT                              0x1114          //Interoperability Requirements for Bluetooth technology as a WAP, Bluetooth SIG [DEPRECATED] Service Class
-#define PANU                                    0x1115          //Personal Area Networking Profile (PAN)
-#define NAP                                     0x1116          //Personal Area Networking Profile (PAN)
-#define GN                                      0x1117          //Personal Area Networking Profile (PAN)
-#define DirectPrinting                          0x1118          //Basic Printing Profile (BPP) Service Class
-#define ReferencePrinting                       0x1119          //See Basic Printing Profile (BPP) Service Class
-#define Basic_Imaging_Profile                   0x111A          //Basic Imaging Profile (BIP) Profile
-#define ImagingResponder                        0x111B          //Basic Imaging Profile (BIP) Service Class
-#define ImagingAutomaticArchive                 0x111C          //Basic Imaging Profile (BIP) Service Class
-#define ImagingReferencedObjects                0x111D          //Basic Imaging Profile (BIP) Service Class
-#define Handsfree                               0x111E          //Hands-Free Profile (HFP)
-#define HandsfreeAudioGateway                   0x111F          //Hands-free Profile (HFP) Service Class
-#define DirectPrintingReferenceObjectsService   0x1120          //Basic Printing Profile (BPP) Service Class
-#define ReflectedUI                             0x1121          //Basic Printing Profile (BPP) Service Class
-#define BasicPrinting                           0x1122          //Basic Printing Profile (BPP) Profile
-#define PrintingStatus                          0x1123          //Basic Printing Profile (BPP) Service Class
-#define HumanInterfaceDeviceService             0x1124          //Human Interface Device (HID)
-#define HardcopyCableReplacement                0x1125          //Hardcopy Cable Replacement Profile (HCRP) Profile
-#define HCR_Print                               0x1126          //Hardcopy Cable Replacement Profile (HCRP) Service Class
-#define HCR_Scan                                0x1127          //Hardcopy Cable Replacement Profile (HCRP) Service Class
-#define Common_ISDN_Access                      0x1128          //Common ISDN Access Profile (CIP)
-#define SIM_Access                              0x112D          //SIM Access Profile (SAP)
-#define Phonebook_Access_PCE                    0x112E          //Phonebook Access Profile (PBAP) Service Class
-#define Phonebook_Access_PSE                    0x112F          //Phonebook Access Profile (PBAP) Service Class
-#define Phonebook_Access                        0x1130          //Phonebook Access Profile (PBAP) Profile
-#define Headset_HS                              0x1131          //Headset Profile (HSP)
-#define Message_Access_Server                   0x1132          //Message Access Profile (MAP) Service Class
-#define Message_Notification_Server             0x1133          //Message Access Profile (MAP) Service Class
-#define Message_Access_Profile                  0x1134          //Message Access Profile (MAP) Profile
-#define GNSS                                    0x1135          //Global Navigation Satellite System Profile (GNSS) Profile
-#define GNSS_Server                             0x1136          // Global Navigation Satellite System Profile (GNSS) Service Class
-#define ThreeD_Display                          0x1137          //3D Synchronization Profile (3DSP) Service Class?
-#define ThreeD_Glasses                          0x1138          //3D Synchronization Profile (3DSP) ?Service Class
-#define ThreeD_Synchronization                  0x1139          //3D Synchronization Profile (3DSP) ?Profile
-#define MPS_Profile                             0x113A          //Multi-Profile Specification (MPS) ?Profile
-#define MPS_SC                                  0x113B          //Multi-Profile Specification (MPS) ?Service Class
-#define CTN_Access_Service                      0x113C          //Calendar, Task, and Notes (CTN) Profile ?Service Class
-#define CTN_Notification_Service                0x113D          //Calendar Tasks and Notes (CTN) Profile ?Service Class
-#define CTN_Profile                             0x113E          //Calendar Tasks and Notes (CTN) Profile ?Profile
-#define PnPInformation                          0x1200          //Device Identification (DID)
-#define GenericNetworking                       0x1201          //N/A Service Class
-#define GenericFileTransfer                     0x1202          //N/A Service Class
-#define GenericAudio                            0x1203          //N/A Service Class
-#define GenericTelephony                        0x1204          //N/A Service Class
-#define UPNP_Service                            0x1205          //Enhanced Service Discovery Profile (ESDP) [DEPRECATED] Service Class
-#define UPNP_IP_Service                         0x1206          //Enhanced Service Discovery Profile (ESDP) [DEPRECATED] Service Class
-#define ESDP_UPNP_IP_PAN                        0x1300          //Enhanced Service Discovery Profile (ESDP) [DEPRECATED] Service Class
-#define ESDP_UPNP_IP_LAP                        0x1301          //Enhanced Service Discovery Profile (ESDP)[DEPRECATED] Service Class
-#define ESDP_UPNP_L2CAP                         0x1302          //Enhanced Service Discovery Profile (ESDP)[DEPRECATED] Service Class
-#define VideoSource                             0x1303          //Video Distribution Profile (VDP) Service Class
-#define VideoSink                               0x1304          //Video Distribution Profile (VDP) Service Class
-#define VideoDistribution                       0x1305          //Video Distribution Profile (VDP) Profile
-#define HDP                                     0x1400          //Health Device Profile Profile
-#define HDP_Source                              0x1401          //Health Device Profile (HDP) Service Class
-#define HDP_Sink                                0x1402          //Health Device Profile (HDP) Service Class
-
-/* List of GATT Services UUID */
-#define Generic_Access                                                 0x1800                  //Generic Access Service
-#define Generic_Attribute                                              0x1801                  //Generic Attribute Service
-#define Immediate_Alert                                                        0x1802                  //Immediate Alert Service
-#define Link_Loss                                                              0x1803                  //Link Loss Service
-#define Tx_Power                                                               0x1804                  //Tx Power Service
-#define Current_Time                                                   0x1805                  //Current Time Service
-#define Reference_Time_Update                                  0x1806                  //Reference Time Update Service
-#define Next_Dst_Change                                                        0x1807                  //Next Destination Change Service
-#define Glucose                                                                        0x1808                  //Glucose Service
-#define Health_Thermometer                                             0x1809                  //Health Thermometer Service
-#define Device_Information                                             0x180A                  //Device Information Service
-#define Heart_Rate                                                             0x180D                  //Heart Rate Service
-#define Phone_Alert_Status                                             0x180E                  //Phone Alert Status Service
-#define Battery_Service                                                        0x180F                  //Battery Service
-#define Blood_Pressure                                                 0x1810                  //Blood Pressure Service
-#define Alert_Notification                                             0x1811                  //Alert Notification Service
-#define Human_Interface_Device                                 0x1812                  //HID Service
-#define Scan_Parameters                                                        0x1813                  //Scan Parameters Service
-#define Running_Speed_And_Cadence                              0x1814                  //Running Speed and Cadence Service
-#define Automation_IO                                                  0x1815                  //Automation IO Service
-#define Cycling_Speed_And_Cadence                              0x1816                  //Cycling Speed and Cadence Service
-#define Cycling_Power                                                  0x1818                  //Cycling Power Service
-#define Location_And_Navigation                                        0x1819                  //Location and Navigation Service
-#define Environmental_Sensing                                  0x181A                  //Environment Sensing Service
-#define Body_Composition                                               0x181B                  //Body Composition Service
-#define User_Data                                                              0x181C                  //User Data Service
-#define Weight_Scale                                                   0x181D                  //Weight Scale Service
-#define Bond_Management                                                        0x181E                  //Bond Management Service
-#define Continuous_Glucose_Monitoring                  0x181F                  //Continuous Glucose Monitoring Service
-#define Internet_Protocol_Support                              0x1820                  //Internet Protocol Support Service
-#define Indoor_Positioning                                             0x1821                  //Indoor Positioning Service
-#define Pulse_Oximeter                                                 0x1822                  //Pulse Oximeter Service
-#define Http_Proxy                                                             0x1823                  //Http Proxy Service
-#define Transport_Discovery                                            0x1824                  //Transport Discovery Service
-#define Object_Transfer                                                        0x1825                  //Object Transfer Service
-
-/* List of GATT Characteristics UUID */
-#define Gap_Device_Name                                                                                0x2A00
-#define Gap_Appearance                                                                         0x2A01
-#define Gap_Peripheral_Privacy_Flag                                                    0x2A02
-#define Gap_Reconnection_Address                                                       0x2A03
-#define Gap_Peripheral_Preferred_Connection_Parameters         0x2A04
-#define Gatt_Service_Changed                                                           0x2A05
-#define Alert_Level                                                                                    0x2A06
-#define Tx_Power_Level                                                                         0x2A07
-#define Date_Time                                                                                      0x2A08
-#define Day_Of_Week                                                                                    0x2A09
-#define Day_Date_Time                                                                          0x2A0A
-#define Exact_Time_256                                                                         0x2A0C
-#define Dst_Offset                                                                                     0x2A0D
-#define Time_Zone                                                                                      0x2A0E
-#define Local_Time_Information                                                         0x2A0F
-#define Time_With_Dst                                                                          0x2A11
-#define Time_Accuracy                                                                          0x2A12
-#define Time_Source                                                                                    0x2A13
-#define Reference_Time_Information                                                     0x2A14
-#define Time_Update_Control_Point                                                      0x2A16
-#define Time_Update_State                                                                      0x2A17
-#define Glucose_Measurement                                                                    0x2A18
-#define Battery_Level                                                                          0x2A19
-#define Temperature_Measurement                                                                0x2A1C
-#define Temperature_Type                                                                       0x2A1D
-#define Intermediate_Temperature                                                       0x2A1E
-#define Measurement_Interval                                                           0x2A21
-#define Boot_Keyboard_Input_Report                                                     0x2A22
-#define System_Id                                                                                      0x2A23
-#define Model_Number_String                                                                    0x2A24
-#define Serial_Number_String                                                           0x2A25
-#define Firmware_Revision_String                                                       0x2A26
-#define Hardware_Revision_String                                                       0x2A27
-#define Software_Revision_String                                                       0x2A28
-#define Manufacturer_Name_String                                                       0x2A29
-#define Regulatory_Certification_Data_List                                     0x2A2A
-#define Current_Time_Charac                                                                    0x2A2B
-#define Magnetic_Declination                                                           0x2A2C
-#define Scan_Refresh                                                                           0x2A31
-#define Boot_Keyboard_Output_Report                                                    0x2A32
-#define Boot_Mouse_Input_Report                                                                0x2A33
-#define Glucose_Measurement_Context                                                    0x2A34
-#define Blood_Pressure_Measurement                                                     0x2A35
-#define Intermediate_Cuff_Pressure                                                     0x2A36
-#define Heart_Rate_Measurement                                                         0x2A37
-#define Body_Sensor_Location                                                           0x2A38
-#define Heart_Rate_Control_Point                                                       0x2A39
-#define Alert_Status                                                                           0x2A3F
-#define Ringer_Control_Point                                                           0x2A40
-#define Ringer_Setting                                                                         0x2A41
-#define Alert_Category_Id_Bit_Mask                                                     0x2A42
-#define Alert_Category_Id                                                                      0x2A43
-#define Alert_Notification_Control_Point                                       0x2A44
-#define Unread_Alert_Status                                                                    0x2A45
-#define New_Alert                                                                                      0x2A46
-#define Supported_New_Alert_Category                                           0x2A47
-#define Supported_Unread_Alert_Category                                                0x2A48
-#define Blood_Pressure_Feature                                                         0x2A49
-#define Hid_Information                                                                                0x2A4A
-#define Report_Map                                                                                     0x2A4B
-#define Hid_Control_Point                                                                      0x2A4C
-#define Report                                                                                         0x2A4D
-#define Protocol_Mode                                                                          0x2A4E
-#define Scan_Interval_Window                                                           0x2A4F
-#define Pnp_Id                                                                                         0x2A50
-#define Glucose_Feature                                                                                0x2A51
-#define Record_Access_Control_Point                                                    0x2A52
-#define Rsc_Measurement                                                                                0x2A53
-#define Rsc_Feature                                                                                    0x2A54
-#define Sc_Control_Point                                                                       0x2A55
-#define Digital                                                                                                0x2A56
-#define Analog                                                                                         0x2A58
-#define Aggregate                                                                                      0x2A5A
-#define Csc_Measurement                                                                                0x2A5B
-#define Csc_Feature                                                                                    0x2A5C
-#define Sensor_Location                                                                                0x2A5D
-#define Plx_Spot_Check_Measurement                                                     0x2A5E
-#define Plx_Continuous_Measurement                                                     0x2A5F
-#define Plx_Features                                                                           0x2A60
-#define Cycling_Power_Measurement                                                      0x2A63
-#define Cycling_Power_Vector                                                           0x2A64
-#define Cycling_Power_Feature                                                          0x2A65
-#define Cycling_Power_Control_Point                                                    0x2A66
-#define Location_And_Speed                                                                     0x2A67
-#define Navigation                                                                                     0x2A68
-#define Position_Quality                                                                       0x2A69
-#define Ln_Feature                                                                                     0x2A6A
-#define Ln_Control_Point                                                                       0x2A6B
-#define Elevation                                                                                      0x2A6C
-#define Pressure                                                                                       0x2A6D
-#define Temperature                                                                                    0x2A6E
-#define Humidity                                                                                       0x2A6F
-#define True_Wind_Speed                                                                                0x2A70
-#define True_Wind_Direction                                                                    0x2A71
-#define Apparent_Wind_Speed                                                                    0x2A72
-#define Apparent_Wind_Direction                                                                0x2A73
-#define Gust_Factor                                                                                    0x2A74
-#define Pollen_Concentration                                                           0x2A75
-#define Uv_Index                                                                                       0x2A76
-#define Irradiance                                                                                     0x2A77
-#define Rainfall                                                                                       0x2A78
-#define Wind_Chill                                                                                     0x2A79
-#define Heat_Index                                                                                     0x2A7A
-#define Dew_Point                                                                                      0x2A7B
-#define Descriptor_Value_Changed                                                       0x2A7D
-#define Aerobic_Threshold                                                                      0x2A7F
-#define Age                                                                                                    0x2A80
-#define Anaerobic_Heart_Rate_Lower_Limit                                       0x2A81
-#define Anaerobic_Heart_Rate_Upper_Limit                                       0x2A82
-#define Anaerobic_Threshold                                                                    0x2A83
-#define Aerobic_Heart_Rate_Upper_Limit                                         0x2A84
-#define Date_Of_Birth                                                                          0x2A85
-#define Date_Of_Threshold_Assessment                                           0x2A86
-#define Email_Address                                                                          0x2A87
-#define Fat_Burn_Heart_Rate_Lower_Limit                                                0x2A88
-#define Fat_Burn_Heart_Rate_Upper_Limit                                                0x2A89
-#define First_Name                                                                                     0x2A8A
-#define Five_Zone_Heart_Rate_Limits                                                    0x2A8B
-#define Gender                                                                                         0x2A8C
-#define Heart_Rate_Max                                                                         0x2A8D
-#define Height                                                                                         0x2A8E
-#define Hip_Circumference                                                                      0x2A8F
-#define Last_Name                                                                                      0x2A90
-#define Maximum_Recommended_Heart_Rate                                         0x2A91
-#define Resting_Heart_Rate                                                                     0x2A92
-#define Sport_Type_For_Aerobic_And_Anaerobic_Thresholds                0x2A93
-#define Three_Zone_Heart_Rate_Limits                                           0x2A94
-#define Two_Zone_Heart_Rate_Limit                                                      0x2A95
-#define Vo2_Max                                                                                                0x2A96
-#define Waist_Circumference                                                                    0x2A97
-#define Weight                                                                                         0x2A98
-#define Database_Change_Increment                                                      0x2A99
-#define User_Index                                                                                     0x2A9A
-#define Body_Composition_Feature                                                       0x2A9B
-#define Body_Composition_Measurement                                           0x2A9C
-#define Weight_Measurement                                                                     0x2A9D
-#define Weight_Scale_Feature                                                           0x2A9E
-#define User_Control_Point                                                                     0x2A9F
-#define Magnetic_Flux_Density_2D                                                       0x2AA0
-#define Magnetic_Flux_Density_3D                                                       0x2AA1
-#define Language                                                                                       0x2AA2
-#define Barometric_Pressure_Trend                                                      0x2AA3
-#define Bond_Management_Control_Point                                          0x2AA4
-#define Bond_Management_Feature                                                                0x2AA5
-#define Gap_Central_Address_Resolution_Support                         0x2AA6
-#define Cgm_Measurement                                                                                0x2AA7
-#define Cgm_Feature                                                                                    0x2AA8
-#define Cgm_Status                                                                                     0x2AA9
-#define Cgm_Session_Start_Time                                                         0x2AAA
-#define Cgm_Session_Run_Time                                                           0x2AAB
-#define Cgm_Specific_Ops_Control_Point                                         0x2AAC
-#define Indoor_Positioning_Configuration                                       0x2AAD
-#define Latitude                                                                                       0x2AAE
-#define Longitude                                                                                      0x2AAF
-#define Local_North_Coordinate                                                         0x2AB0
-#define Local_East_Coordinate                                                          0x2AB1
-#define Floor_Number                                                                           0x2AB2
-#define Altitude                                                                                       0x2AB3
-#define Uncertainty                                                                                    0x2AB4
-#define Location_Name                                                                          0x2AB5
-#define Uri                                                                                                    0x2AB6
-#define Http_Headers                                                                           0x2AB7
-#define Http_Status_Code                                                                       0x2AB8
-#define Http_Entity_Body                                                                       0x2AB9
-#define Http_Control_Point                                                                     0x2ABA
-#define Https_Security                                                                         0x2ABB
-#define Tds_Control_Point                                                                      0x2ABC
-#define Ots_Feature                                                                                    0x2ABD
-#define Object_Name                                                                                    0x2ABE
-#define Object_Type                                                                                    0x2ABF
-#define Object_Size                                                                                    0x2AC0
-#define Object_First_Created                                                           0x2AC1
-#define Object_Last_Modified                                                           0x2AC2
-#define Object_Id                                                                                      0x2AC3
-#define Object_Properties                                                                      0x2AC4
-#define Object_Action_Control_Point                                                    0x2AC5
-#define Object_List_Control_Point                                                      0x2AC6
-#define Object_List_Filter                                                                     0x2AC7
-#define Object_Changed                                                                         0x2AC8
-#define Fitness_Machine_Control_Point                                          0xEE1D
-
-/* List of GATT Descriptors UUID */
-#define Gatt_Characteristic_Extended_Properties                        0x2900
-#define Gatt_Characteristic_User_Description                   0x2901
-#define Gatt_Client_Characteristic_Configuration               0x2902
-#define Gatt_Server_Characteristic_Configuration               0x2903
-#define Gatt_Characteristic_Presentation_Format                        0x2904
-#define Gatt_Characteristic_Aggregate_Format                   0x2905
-#define Valid_Range                                                                            0x2906
-#define External_Report_Reference                                              0x2907
-#define Report_Reference                                                               0x2908
-#define Number_Of_Digitals                                                             0x2909
-#define Value_Trigger_Setting                                                  0x290A
-#define Es_Configuration                                                               0x290B
-#define Es_Measurement                                                                 0x290C
-#define Es_Trigger_Setting                                                             0x290D
-#define Time_Trigger_Setting                                                   0x290E
-
-/* List of GATT Declarations UUID */
-#define Gatt_Primary_Service_Declaration                               0x2800
-#define Gatt_Secondary_Service_Declaration                             0x2801
-#define Gatt_Include_Declaration                                               0x2802
-#define Gatt_Characteristic_Declaration                                        0x2803
-
-
-/* Characteristic properties
-*/
-#define  BROADCAST    (1 << 0)
-#define  READ         (1 << 1)
-#define  WRITE_NR     (1 << 2)
-#define  WRITE        (1 << 3)
-#define  NOTIFY       (1 << 4)
-#define  INDICATE     (1 << 5)
-#define  AUTH         (1 << 6)
-#define  EXT_PROP     (1 << 7)
-
-/* Characteristic permissions
-*/
-#define RD     (1 << 0)
-#define WR     (1 << 1)
-#define ENCRYPT_RD     (1 << 2)
-#define ENCRYPT_WR     (1 << 3)
-#define ENC_AUTH_RD    (1 << 4)
-#define ENC_AUTH_WR    (1 << 5)
-
-#define MENU_PRINT_ERROR(format, arg...) MENUPRINT(RED(format), ##arg)
-
-#define RED(text) "\033[31m"text"\033[0m"
-#define BLUE(text) "\033[34m"text"\033[0m"
-#define YELLOW(text) "\033[33m"text"\033[0m"
-#define GREEN(text) "\033[32m"text"\033[0m"
-#define MAGENTA(text) "\033[35m"text"\033[0m"
-#define CYAN(text) "\033[36m"text"\033[0m"
-
-typedef char bdstr_t[18];
-
-/* Common/util functions */
-char* bdt_bd2str(const bt_address_t *bdaddr, bdstr_t *bdstr);
-char* bdaddr_2_str(const bt_bdaddr_t *bd_addr);
-void string_to_uuid(char *str, service_uuid_t *p_uuid);
-void uuid_to_string(service_uuid_t *p_uuid, char *str);
-void uuid_to_stringname(service_uuid_t *p_uuid, char *str);
-void oal_print_device_address_t(const bt_address_t *addr);
-void oal_convert_addr_string_to_type(unsigned char *addr, const char *address);
-int oal_is_address_zero(unsigned char *addr1);
-void print_bt_properties(int num_properties, bt_property_t *properties);
-
-void convert_str_2_hex(unsigned char out[], char in[]);
-void convert_hex_2_str(unsigned char *hex, int len, char *str_out);
-char* convert_bt_property_2_str(const bt_property_t *property);
-char* convert_property_type_2_str(bt_property_type_t prop_type);
-char* convert_scan_mode_2_str(bt_scan_mode_t scan_mode);
-char* convert_device_type_2_str(bt_device_type_t device_type);
-char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf);
-
-void local_le_feat_2_string(char *str, const bt_local_le_features_t *f);
-const char *dump_uuid_name(int uuid_no);
-
-char *char_prop_to_string(uint8_t prop, char *str);
-char *char_perm_to_string(uint8_t perm, char *str);
-
-char *dump_char_prop(uint8_t prop);
-char *dump_char_perm(uint8_t perm);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /*_OAL_UTILS_H_*/
diff --git a/hardware/bluetooth.h b/hardware/bluetooth.h
deleted file mode 100644 (file)
index 2971117..0000000
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BLUETOOTH_H
-#define ANDROID_INCLUDE_BLUETOOTH_H
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <hardware/hardware.h>
-
-__BEGIN_DECLS
-
-/**
- * The Bluetooth Hardware Module ID
- */
-
-#define BT_HARDWARE_MODULE_ID "bluetooth"
-#define BT_STACK_MODULE_ID "bluetooth"
-#define BT_STACK_TEST_MODULE_ID "bluetooth_test"
-
-
-/* Bluetooth profile interface IDs */
-
-#define BT_PROFILE_HANDSFREE_ID "handsfree"
-#define BT_PROFILE_HANDSFREE_CLIENT_ID "handsfree_client"
-#define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp"
-#define BT_PROFILE_ADVANCED_AUDIO_SINK_ID "a2dp_sink"
-#define BT_PROFILE_HEALTH_ID "health"
-#define BT_PROFILE_SOCKETS_ID "socket"
-#define BT_PROFILE_HIDHOST_ID "hidhost"
-#define BT_PROFILE_PAN_ID "pan"
-#define BT_PROFILE_MAP_CLIENT_ID "map_client"
-
-#define BT_PROFILE_GATT_ID "gatt"
-#define BT_PROFILE_AV_RC_ID "avrcp"
-#define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl"
-
-/** Bluetooth Address */
-typedef struct {
-       uint8_t address[6];
-} __attribute__((packed))bt_bdaddr_t;
-
-/** Bluetooth Device Name */
-typedef struct {
-       uint8_t name[249];
-} __attribute__((packed))bt_bdname_t;
-
-/** Bluetooth Adapter Visibility Modes*/
-typedef enum {
-       BT_SCAN_MODE_NONE,
-       BT_SCAN_MODE_CONNECTABLE,
-       BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
-} bt_scan_mode_t;
-
-/** Bluetooth Adapter State */
-typedef enum {
-       BT_STATE_OFF,
-       BT_STATE_ON
-}   bt_state_t;
-
-/** Bluetooth Error Status */
-/** We need to build on this */
-
-typedef enum {
-       BT_STATUS_SUCCESS,
-       BT_STATUS_FAIL,
-       BT_STATUS_NOT_READY,
-       BT_STATUS_NOMEM,
-       BT_STATUS_BUSY,
-       BT_STATUS_DONE,        /* request already completed */
-       BT_STATUS_UNSUPPORTED,
-       BT_STATUS_PARM_INVALID,
-       BT_STATUS_UNHANDLED,
-       BT_STATUS_AUTH_FAILURE,
-       BT_STATUS_RMT_DEV_DOWN,
-       BT_STATUS_AUTH_REJECTED
-
-} bt_status_t;
-
-/** Bluetooth PinKey Code */
-typedef struct {
-       uint8_t pin[16];
-} __attribute__((packed))bt_pin_code_t;
-
-typedef struct {
-       uint8_t status;
-       uint8_t ctrl_state;     /* stack reported state */
-       uint64_t tx_time;       /* in ms */
-       uint64_t rx_time;       /* in ms */
-       uint64_t idle_time;     /* in ms */
-       uint64_t energy_used;   /* a product of mA, V and ms */
-} __attribute__((packed))bt_activity_energy_info;
-
-/** Bluetooth Adapter Discovery state */
-typedef enum {
-       BT_DISCOVERY_STOPPED,
-       BT_DISCOVERY_STARTED
-} bt_discovery_state_t;
-
-/** Bluetooth ACL connection state */
-typedef enum {
-       BT_ACL_STATE_CONNECTED,
-       BT_ACL_STATE_DISCONNECTED
-} bt_acl_state_t;
-
-/** Remote Device Trusted state */
-typedef enum {
-       BT_DEVICE_TRUSTED,
-       BT_DEVICE_NOT_TRUSTED
-} bt_device_trust_state_t;
-
-/** Bluetooth 128-bit UUID */
-typedef struct {
-       uint8_t uu[16];
-} bt_uuid_t;
-
-/** Bluetooth SDP service record */
-typedef struct {
-       bt_uuid_t uuid;
-       uint16_t channel;
-       char name[256]; // what's the maximum length
-} bt_service_record_t;
-
-
-/** Bluetooth Remote Version info */
-typedef struct {
-       int version;
-       int sub_ver;
-       int manufacturer;
-} bt_remote_version_t;
-
-typedef struct {
-       uint8_t local_privacy_enabled;
-       uint8_t max_adv_instance;
-       uint8_t rpa_offload_supported;
-       uint8_t max_irk_list_size;
-       uint8_t max_adv_filter_supported;
-       uint8_t scan_result_storage_size_lobyte;
-       uint8_t scan_result_storage_size_hibyte;
-       uint8_t activity_energy_info_supported;
-} bt_local_le_features_t;
-
-/* Bluetooth Adapter and Remote Device property types */
-typedef enum {
-       /* Properties common to both adapter and remote device */
-       /**
-        * Description - Bluetooth Device Name
-        * Access mode - Adapter name can be GET/SET. Remote device can be GET
-        * Data type   - bt_bdname_t
-        */
-       BT_PROPERTY_BDNAME = 0x1,
-       /**
-        * Description - Bluetooth Device Address
-        * Access mode - Only GET.
-        * Data type   - bt_bdaddr_t
-        */
-       BT_PROPERTY_BDADDR,
-       /**
-        * Description - Bluetooth Service 128-bit UUIDs
-        * Access mode - Only GET.
-        * Data type   - Array of bt_uuid_t (Array size inferred from property length).
-        */
-       BT_PROPERTY_UUIDS,
-       /**
-        * Description - Bluetooth Class of Device as found in Assigned Numbers
-        * Access mode - Only GET.
-        * Data type   - uint32_t.
-        */
-       BT_PROPERTY_CLASS_OF_DEVICE,
-       /**
-        * Description - Device Type - BREDR, BLE or DUAL Mode
-        * Access mode - Only GET.
-        * Data type   - bt_device_type_t
-        */
-       BT_PROPERTY_TYPE_OF_DEVICE,
-       /**
-        * Description - Bluetooth Service Record
-        * Access mode - Only GET.
-        * Data type   - bt_service_record_t
-        */
-       BT_PROPERTY_SERVICE_RECORD,
-
-       /* Properties unique to adapter */
-       /**
-        * Description - Bluetooth Adapter scan mode
-        * Access mode - GET and SET
-        * Data type   - bt_scan_mode_t.
-        */
-       BT_PROPERTY_ADAPTER_SCAN_MODE,
-       /**
-        * Description - List of bonded devices
-        * Access mode - Only GET.
-        * Data type   - Array of bt_bdaddr_t of the bonded remote devices
-        *               (Array size inferred from property length).
-        */
-       BT_PROPERTY_ADAPTER_BONDED_DEVICES,
-       /**
-        * Description - Bluetooth Adapter Discovery timeout (in seconds)
-        * Access mode - GET and SET
-        * Data type   - uint32_t
-        */
-       BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
-
-       /* Properties unique to remote device */
-       /**
-        * Description - User defined friendly name of the remote device
-        * Access mode - GET and SET
-        * Data type   - bt_bdname_t.
-        */
-       BT_PROPERTY_REMOTE_FRIENDLY_NAME,
-       /**
-        * Description - RSSI value of the inquired remote device
-        * Access mode - Only GET.
-        * Data type   - int32_t.
-        */
-       BT_PROPERTY_REMOTE_RSSI,
-       /**
-        * Description - Remote version info
-        * Access mode - SET/GET.
-        * Data type   - bt_remote_version_t.
-        */
-
-       BT_PROPERTY_REMOTE_VERSION_INFO,
-
-       /* Tizen Specific Adapter and Remote Device properties */
-       /**
-        * Description - Remote Device paired Info
-        * Access mode - GET.
-        * Data type   - uint8_t.
-        */
-       BT_PROPERTY_REMOTE_PAIRED,
-
-       /**
-        * Description - Remote Device connected Info
-        * Access mode - GET.
-        * Data type   - unsigned int.
-        */
-       BT_PROPERTY_REMOTE_CONNECTED,
-
-       /**
-        * Description - Remote Device Trusted info
-        * Access mode - GET.
-        * Data type   - uint8_t.
-        */
-       BT_PROPERTY_REMOTE_TRUST,
-
-       /**
-        * Description - Adapter Pairable info
-        * Access mode - GET\SET.
-        * Data type   - uint8_t
-        */
-       BT_PROPERTY_PAIRABLE,
-
-       /**
-        * Description - Adapter pairable Timeout value
-        * Access mode - GET.
-        * Data type   - uint32_t
-        */
-       BT_PROPERTY_PAIRABLE_TIMEOUT,
-
-       /**
-        * Description - Adapter version
-        * Access mode - GET
-        * Data type   - Array of character string
-        */
-       BT_PROPERTY_VERSION,
-
-       /**
-        * Description - Adapter IPSP initialized state info
-        * Access mode - GET
-        * Data type   - uint8_t
-        */
-       BT_PROPERTY_IPSP_INITIALIZED,
-
-       /**
-        * Description - Adapter Modalias info
-        * Access mode - GET
-        * Data type   - Array of character string
-        */
-       BT_PROPERTY_MODALIAS,
-
-       /**
-        * Description - BLE Device manufacturer data length
-        * Access mode - GET
-        * Data type   - uint32_t
-        */
-       BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
-
-       /**
-        * Description - BLE Device manufacturer data
-        * Access mode - GET
-        * Data type   - Array of character string
-        */
-       BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
-
-       /**
-        * Description - Remote BLE advertising data
-        * Access mode - Only received during device found callback.
-        * Data type   - Array of uint8_t of remote BLE adv data.
-        *               (Array size inferred from property length).
-        */
-       BT_PROPERTY_REMOTE_BLE_ADV_DATA,
-
-       /**
-        * Description - Local LE features
-        * Access mode - GET.
-        * Data type   - bt_local_le_features_t.
-        */
-       BT_PROPERTY_LOCAL_LE_FEATURES,
-
-       /**
-        * Description - Remote device friendly name set?
-        * Access mode - GET.
-        * Data type   - uint8_t
-        */
-       BT_PROPERTY_REMOTE_IS_ALIAS_SET,
-
-       BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
-} bt_property_type_t;
-
-/** Bluetooth Adapter Property data structure */
-typedef struct {
-       bt_property_type_t type;
-       int len;
-       void *val;
-} bt_property_t;
-
-
-/** Bluetooth Device Type */
-typedef enum {
-       BT_DEVICE_DEVTYPE_BREDR = 0x1,
-       BT_DEVICE_DEVTYPE_BLE,
-       BT_DEVICE_DEVTYPE_DUAL
-} bt_device_type_t;
-/** Bluetooth Bond state */
-typedef enum {
-       BT_BOND_STATE_NONE,
-       BT_BOND_STATE_BONDING,
-       BT_BOND_STATE_BONDED
-} bt_bond_state_t;
-
-/** Bluetooth SSP Bonding Variant */
-typedef enum {
-       BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
-       BT_SSP_VARIANT_PASSKEY_ENTRY,
-       BT_SSP_VARIANT_CONSENT,
-       BT_SSP_VARIANT_PASSKEY_NOTIFICATION
-} bt_ssp_variant_t;
-
-/** Bluetooth Profile Service IDs */
-typedef enum {
-       BT_RES_SERVICE_ID,              /* Reserved */
-       BT_SPP_SERVICE_ID,              /* Serial port profile. */
-       BT_DUN_SERVICE_ID,              /* Dial-up networking profile. */
-       BT_A2DP_SRC_SERVICE_ID,         /* A2DP Source profile. */
-       BT_LAP_SERVICE_ID,              /* LAN access profile. */
-       BT_HSP_SERVICE_ID,              /* Headset profile. */
-       BT_HFP_SERVICE_ID,              /* Hands-free profile. */
-       BT_OPP_SERVICE_ID,              /* Object push  */
-       BT_FTP_SERVICE_ID,              /* File transfer */
-       BT_AVRCP_CT_SERVICE_ID,         /* AVRC Controller Terminal */
-       BT_ICP_SERVICE_ID,              /* Intercom Terminal */
-       BT_SYNC_SERVICE_ID,             /* Synchronization */
-       BT_BPP_SERVICE_ID,              /* Basic printing profile */
-       BT_BIP_SERVICE_ID,              /* Basic Imaging profile */
-       BT_PANU_SERVICE_ID,             /* PAN User */
-       BT_NAP_SERVICE_ID,              /* PAN Network access point */
-       BT_GN_SERVICE_ID,               /* PAN Group Ad-hoc networks */
-       BT_SAP_SERVICE_ID,              /* SIM Access profile */
-       BT_A2DP_SERVICE_ID,             /* A2DP Sink */
-       BT_AVRCP_SERVICE_ID,            /* A/V remote control */
-       BT_HID_SERVICE_ID,              /* HID */
-       BT_VDP_SERVICE_ID,              /* Video distribution */
-       BT_PBAP_SERVICE_ID,             /* PhoneBook Access Server*/
-       BT_HSP_HS_SERVICE_ID,           /* HFP HS role */
-       BT_HFP_HS_SERVICE_ID,           /* HSP HS role */
-       BT_MAP_SERVICE_ID,              /* Message Access Profile */
-       BT_MN_SERVICE_ID,               /* Message Notification Service */
-       BT_HDP_SERVICE_ID,              /* Health Device Profile */
-       BT_PCE_SERVICE_ID,              /* PhoneBook Access Client*/
-#ifdef TIZEN_BT_HAL
-       BT_IOTIVITY_SERVICE_ID,         /* Custom IOTIVITY UUID */
-#endif
-} bt_service_id_t;
-
-#define BT_MAX_NUM_UUIDS 32
-
-#ifdef TIZEN_BT_HAL
-#define BT_OSP_SERVER_OBEX 0x00
-/* TODO: Add more types If and when required */
-#define BT_OSP_SERVER_MAX 0xFF
-
-/* Tizen BT discovery Types */
-typedef enum {
-       BT_DISC_ROLE_BREDR = 0x01,
-       BT_DISC_ROLE_LE,
-       BT_DISC_ROLE_DUAL
-} bt_disc_role_type_t;
-
-/** Bluetooth Trusted Profiles */
-typedef enum {
-       BT_TRUSTED_PROFILE_PBAP = 1,
-       BT_TRUSTED_PROFILE_MAP,
-       BT_TRUSTED_PROFILE_SAP,
-       BT_TRUSTED_PROFILE_HFP_HF,
-       BT_TRUSTED_PROFILE_A2DP,
-       BT_TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
-} bt_trusted_profile_t;
-
-/** Bluetooth Bonding Authentication Notifications */
-typedef enum {
-       BT_PASSKEY_CONFIRMATION = 1,
-       BT_PASSKEY_DISPLAY,
-       BT_PASSKEY_ENTRY,
-       BT_PINCODE_ENTRY,
-} bt_gap_auth_variant_t;
-#endif
-
-/** Bluetooth Interface callbacks */
-
-/** Bluetooth Enable/Disable Callback. */
-typedef void (*adapter_state_changed_callback)(bt_state_t state);
-
-#ifdef TIZEN_BT_HAL
-/** BLE Enable/Disable Callback. */
-typedef void (*le_state_changed_callback)(bt_state_t state);
-#endif
-
-/** GET/SET Adapter Properties callback */
-/* TODO: For the GET/SET property APIs/callbacks, we may need a session
- * identifier to associate the call with the callback. This would be needed
- * whenever more than one simultaneous instance of the same adapter_type
- * is get/set.
- *
- * If this is going to be handled in the Java framework, then we do not need
- * to manage sessions here.
- */
-typedef void (*adapter_properties_callback)(bt_status_t status,
-               int num_properties,
-               bt_property_t *properties);
-
-/** GET/SET Remote Device Properties callback */
-/** TODO: For remote device properties, do not see a need to get/set
- * multiple properties - num_properties shall be 1
- */
-typedef void (*remote_device_properties_callback)(bt_status_t status,
-               bt_bdaddr_t *bd_addr,
-               int num_properties,
-               bt_property_t *properties);
-
-/** New device discovered callback */
-/** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
- * respectively */
-typedef void (*device_found_callback)(int num_properties,
-               bt_property_t *properties);
-
-/** Discovery state changed callback */
-typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
-
-/** Bluetooth Legacy PinKey Request callback */
-typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
-               bt_bdname_t *bd_name, uint32_t cod);
-
-/** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
-/** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
- *  BT_SSP_PAIRING_PASSKEY_ENTRY */
-/* TODO: Passkey request callback shall not be needed for devices with display
- * capability. We still need support this in the stack for completeness */
-typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
-               bt_bdname_t *bd_name,
-               uint32_t cod,
-               bt_ssp_variant_t pairing_variant,
-               uint32_t pass_key);
-
-/** Bluetooth Bond state changed callback */
-/* Invoked in response to create_bond, cancel_bond or remove_bond */
-typedef void (*bond_state_changed_callback)(bt_status_t status,
-               bt_bdaddr_t *remote_bd_addr,
-               bt_bond_state_t state);
-
-/** Bluetooth ACL connection state changed callback */
-typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
-               bt_acl_state_t state);
-
-typedef enum {
-       ASSOCIATE_JVM,
-       DISASSOCIATE_JVM
-} bt_cb_thread_evt;
-
-/** Thread Associate/Disassociate JVM Callback */
-/* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
- * the JVM */
-typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
-
-/** Bluetooth Test Mode Callback */
-/* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
-typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
-
-/* LE Test mode callbacks
- * This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
- * The num_packets is valid only for le_test_end command */
-typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
-
-/** Callback invoked when energy details are obtained */
-/* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
- * If the ctrl_state value is 0, it means the API call failed
- * Time values-In milliseconds as returned by the controller
- * Energy used-Value as returned by the controller
- * Status-Provides the status of the read_energy_info API call */
-typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
-
-/* Service level Authorization request callback */
-typedef void (*authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
-
-#ifdef TIZEN_BT_HAL
-/* Service level Authorization request callback */
-typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
-
-/** Bluetooth ACL connection state */
-typedef enum {
-       BT_LE_CONN_STATE_CONNECTED,
-       BT_LE_CONN_STATE_DISCONNECTED
-} bt_le_conn_state_t;
-
-/** Bluetooth ACL connection state changed callback */
-typedef void (*le_conn_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
-               bt_le_conn_state_t state);
-
-/** Remote device trusted profiles changed callback */
-typedef void (*device_trusted_profiles_changed_callback)(bt_bdaddr_t *bd_addr, uint32_t trust_val);
-
-/** Remote device RSSI monitoring state changed callback */
-typedef void (*rssi_monitor_state_changed_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state);
-
-/** Remote device RSSI alert callback */
-typedef void (*rssi_alert_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
-
-/** Remote device Raw RSSI received callback */
-typedef void (*raw_rssi_received_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
-#endif
-
-/** TODO: Add callbacks for Link Up/Down and other generic
- *  notifications/callbacks */
-
-/** Remote Device Trust state changed callback */
-typedef void (*device_trust_state_changed_callback)(bt_bdaddr_t *remote_bd_addr,
-               bt_device_trust_state_t trust);
-
-/** Bluetooth DM callback structure. */
-typedef struct {
-       /** set to sizeof(bt_callbacks_t) */
-       size_t size;
-       adapter_state_changed_callback adapter_state_changed_cb;
-       adapter_properties_callback adapter_properties_cb;
-       remote_device_properties_callback remote_device_properties_cb;
-       device_found_callback device_found_cb;
-       discovery_state_changed_callback discovery_state_changed_cb;
-       pin_request_callback pin_request_cb;
-       ssp_request_callback ssp_request_cb;
-       bond_state_changed_callback bond_state_changed_cb;
-       acl_state_changed_callback acl_state_changed_cb;
-       callback_thread_event thread_evt_cb;
-       dut_mode_recv_callback dut_mode_recv_cb;
-       le_test_mode_callback le_test_mode_cb;
-       energy_info_callback energy_info_cb;
-       authorize_request_callback authorize_request_cb;
-       device_trust_state_changed_callback device_trust_state_changed_cb;
-#ifdef TIZEN_BT_HAL
-       sock_authorize_request_callback socket_authorize_request_cb;
-       le_state_changed_callback le_state_changed_cb;
-       le_conn_state_changed_callback le_conn_state_changed_cb;
-       device_trusted_profiles_changed_callback device_trusted_profiles_changed_cb;
-       rssi_monitor_state_changed_callback rssi_monitor_state_changed_cb;
-       rssi_alert_callback rssi_alert_cb;
-       raw_rssi_received_callback raw_rssi_received_cb;
-#endif
-} bt_callbacks_t;
-
-typedef void (*alarm_cb)(void *data);
-typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
-typedef int (*acquire_wake_lock_callout)(const char *lock_name);
-typedef int (*release_wake_lock_callout)(const char *lock_name);
-
-/** The set of functions required by bluedroid to set wake alarms and
- * grab wake locks. This struct is passed into the stack through the
- * |set_os_callouts| function on |bt_interface_t|.
- */
-typedef struct {
-       /* set to sizeof(bt_os_callouts_t) */
-       size_t size;
-
-       set_wake_alarm_callout set_wake_alarm;
-       acquire_wake_lock_callout acquire_wake_lock;
-       release_wake_lock_callout release_wake_lock;
-} bt_os_callouts_t;
-
-/** NOTE: By default, no profiles are initialized at the time of init/enable.
- *  Whenever the application invokes the 'init' API of a profile, then one of
- *  the following shall occur:
- *
- *    1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
- *        profile as enabled. Subsequently, when the application invokes the
- *        Bluetooth 'enable', as part of the enable sequence the profile that were
- *        marked shall be enabled by calling appropriate stack APIs. The
- *        'adapter_properties_cb' shall return the list of UUIDs of the
- *        enabled profiles.
- *
- *    2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
- *        profile API to initialize the profile and trigger a
- *        'adapter_properties_cb' with the current list of UUIDs including the
- *        newly added profile's UUID.
- *
- *   The reverse shall occur whenever the profile 'cleanup' APIs are invoked
- */
-
-/** Represents the standard Bluetooth DM interface. */
-typedef struct {
-       /** set to sizeof(bt_interface_t) */
-       size_t size;
-       /**
-        * Opens the interface and provides the callback routines
-        * to the implemenation of this interface.
-        */
-       int (*init)(bt_callbacks_t*callbacks);
-
-       /** Enable Bluetooth. */
-       int (*enable)(void);
-
-       /** Disable Bluetooth. */
-       int (*disable)(void);
-
-#ifdef TIZEN_BT_HAL
-       /** Reset Bluetooth. */
-       int (*reset)(void);
-#endif
-
-#ifdef TIZEN_BT_HAL
-       /** Enable LE Bluetooth. */
-       int (*le_enable)(void);
-
-       /** Disable LE Bluetooth. */
-       int (*le_disable)(void);
-
-       int (*le_init)(void);
-
-       void (*le_deinit)(void);
-
-       int (*is_advertising) (void);
-#endif
-
-       /** Closes the interface. */
-       void (*cleanup)(void);
-
-#ifdef TIZEN_BT_HAL
-       /** Get Bluetooth Adapter Powered status */
-       int (*get_adapter_powered_status)(uint8_t *status);
-#endif
-
-       /** Get all Bluetooth Adapter properties at init */
-       int (*get_adapter_properties)(void);
-
-       /** Get Bluetooth Adapter property of 'type' */
-       int (*get_adapter_property)(bt_property_type_t type);
-
-       /** Set Bluetooth Adapter property of 'type' */
-       /* Based on the type, val shall be one of
-        * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
-        */
-       int (*set_adapter_property)(const bt_property_t *property);
-
-       /** Get all Remote Device properties */
-       int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
-
-       /** Get Remote Device property of 'type' */
-       int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
-                       bt_property_type_t type);
-
-       /** Set Remote Device property of 'type' */
-       int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
-                       const bt_property_t *property);
-
-       /** Get Remote Device's service record  for the given UUID */
-       int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
-                       bt_uuid_t *uuid);
-
-       /** Start SDP to get remote services */
-       int (*get_remote_services)(bt_bdaddr_t *remote_addr);
-
-       /** Start Discovery */
-       int (*start_discovery)(void);
-
-#ifdef TIZEN_BT_HAL
-       int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
-#endif
-
-       /** Cancel Discovery */
-       int (*cancel_discovery)(void);
-
-       /** Create Bluetooth Bonding */
-       int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
-
-       /** Remove Bond */
-       int (*remove_bond)(const bt_bdaddr_t *bd_addr);
-
-       /** Cancel Bond */
-       int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
-
-       /**
-        * Get the connection status for a given remote device.
-        * return value of 0 means the device is not connected,
-        * non-zero return status indicates an active connection.
-        */
-       int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
-
-       /** BT Legacy PinKey Reply */
-       /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
-       int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
-                       uint8_t pin_len, bt_pin_code_t *pin_code);
-
-       /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
-        * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
-        * BT_SSP_VARIANT_CONSENT
-        * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
-        * shall be zero */
-       int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
-                       uint8_t accept, uint32_t passkey);
-
-       /** Get Bluetooth profile interface */
-       const void* (*get_profile_interface) (const char *profile_id);
-
-       /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
-       /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
-       int (*dut_mode_configure)(uint8_t enable);
-
-       /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
-       int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
-       /** BLE Test Mode APIs */
-       /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
-       int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
-
-       /* enable or disable bluetooth HCI snoop log */
-       int (*config_hci_snoop_log)(uint8_t enable);
-
-       /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
-        * This should be called immediately after a successful |init|.
-        */
-       int (*set_os_callouts)(bt_os_callouts_t *callouts);
-
-       /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
-        * Success indicates that the VSC command was sent to controller
-        */
-       int (*read_energy_info)();
-
-       /* Tizen Specific: Send  service level Authorization response */
-       int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
-                       uint8_t authorize, uint8_t save_settings);
-
-       /** Set auto authorization for peer device. Should be a paired device */
-       int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
-#ifdef TIZEN_BT_HAL
-       /**
-        * get the service connection status for a given remote device.
-        * return value of 0 means the device is not connected,
-        * non-zero return status indicates an active connection.
-        */
-       int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
-
-       /*
-        * Enable/Disable osp server in gap agent.
-        * enable == 0/1 -> Register/Unregister osp server.
-        */
-       int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
-
-       /**
-        * Set profile as trusted for remote device
-        */
-       int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
-
-       /**
-        * Get profile trusted status for remote device
-        */
-       int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
-
-       /**
-        * Get raw RSSI strength of remote device for connected link type
-        * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
-        */
-       int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
-
-       /**
-        * Enable RSSI monitoring of remote device for connected link type
-        * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
-        * Threshold : (low_threshold, in_range_threshold, high_threshold)
-        */
-       int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
-                       int low_threshold, int in_range_threshold, int high_threshold);
-       /*
-        * Enable/Disable GAP authentication notification to application
-        * enable == 0/1 -> Enable/Disable notification sending
-        * type == value from bt_gap_auth_variant_t
-        */
-       int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
-
-#endif
-} bt_interface_t;
-
-/** TODO: Need to add APIs for Service Discovery, Service authorization and
- *       connection management. Also need to add APIs for configuring
- *       properties of remote bonded devices such as name, UUID etc. */
-
-typedef struct {
-       struct hw_device_t common;
-       const bt_interface_t* (*get_bluetooth_interface)();
-} bluetooth_device_t;
-
-typedef bluetooth_device_t bluetooth_module_t;
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BLUETOOTH_H */
diff --git a/hardware/bt_av.h b/hardware/bt_av.h
deleted file mode 100644 (file)
index 80d0a42..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_AV_H
-#define ANDROID_INCLUDE_BT_AV_H
-
-__BEGIN_DECLS
-
-/* Bluetooth AV connection states */
-typedef enum {
-       BTAV_CONNECTION_STATE_DISCONNECTED = 0,
-       BTAV_CONNECTION_STATE_CONNECTING,
-       BTAV_CONNECTION_STATE_CONNECTED,
-       BTAV_CONNECTION_STATE_DISCONNECTING
-} btav_connection_state_t;
-
-/* Bluetooth AV datapath states */
-typedef enum {
-       BTAV_AUDIO_STATE_REMOTE_SUSPEND = 0,
-       BTAV_AUDIO_STATE_STOPPED,
-       BTAV_AUDIO_STATE_STARTED,
-} btav_audio_state_t;
-
-
-/** Callback for connection state change.
- *  state will have one of the values from btav_connection_state_t
- */
-typedef void (*btav_connection_state_callback)(btav_connection_state_t state,
-               bt_bdaddr_t *bd_addr);
-
-/** Callback for audiopath state change.
- *  state will have one of the values from btav_audio_state_t
- */
-typedef void (*btav_audio_state_callback)(btav_audio_state_t state,
-               bt_bdaddr_t *bd_addr);
-
-/** Callback for audio configuration change.
- *  Used only for the A2DP sink interface.
- *  state will have one of the values from btav_audio_state_t
- *  sample_rate: sample rate in Hz
- *  channel_count: number of channels (1 for mono, 2 for stereo)
- */
-typedef void (*btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
-               uint32_t sample_rate,
-               uint8_t channel_count);
-
-/** BT-AV callback structure. */
-typedef struct {
-       /** set to sizeof(btav_callbacks_t) */
-       size_t      size;
-       btav_connection_state_callback  connection_state_cb;
-       btav_audio_state_callback audio_state_cb;
-       btav_audio_config_callback audio_config_cb;
-} btav_callbacks_t;
-
-/**
- * NOTE:
- *
- * 1. AVRCP 1.0 shall be supported initially. AVRCP passthrough commands
- *    shall be handled internally via uinput
- *
- * 2. A2DP data path shall be handled via a socket pipe between the AudioFlinger
- *    android_audio_hw library and the Bluetooth stack.
- *
- */
-/** Represents the standard BT-AV interface.
- *  Used for both the A2DP source and sink interfaces.
- */
-typedef struct {
-
-       /** set to sizeof(btav_interface_t) */
-       size_t          size;
-       /**
-        * Register the BtAv callbacks
-        */
-       bt_status_t (*init)(btav_callbacks_t* callbacks);
-
-       /** connect to headset */
-       bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
-
-       /** dis-connect from headset */
-       bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
-
-       /** Closes the interface. */
-       void  (*cleanup)(void);
-} btav_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_AV_H */
diff --git a/hardware/bt_gatt.h b/hardware/bt_gatt.h
deleted file mode 100644 (file)
index 342066d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_GATT_H
-#define ANDROID_INCLUDE_BT_GATT_H
-
-#include <stdint.h>
-#include "bt_gatt_client.h"
-#include "bt_gatt_server.h"
-
-__BEGIN_DECLS
-
-/** BT-GATT callbacks */
-typedef struct {
-       /** Set to sizeof(btgatt_callbacks_t) */
-       size_t size;
-
-       /** GATT Client callbacks */
-       const btgatt_client_callbacks_t* client;
-
-       /** GATT Server callbacks */
-       const btgatt_server_callbacks_t* server;
-} btgatt_callbacks_t;
-
-/** Represents the standard Bluetooth GATT interface. */
-typedef struct {
-       /** Set to sizeof(btgatt_interface_t) */
-       size_t          size;
-
-       /**
-        * Initializes the interface and provides callback routines
-        */
-       bt_status_t (*init)(const btgatt_callbacks_t* callbacks);
-
-       /** Closes the interface */
-       void (*cleanup)(void);
-
-       /** Pointer to the GATT client interface methods.*/
-       const btgatt_client_interface_t* client;
-
-       /** Pointer to the GATT server interface methods.*/
-       const btgatt_server_interface_t* server;
-} btgatt_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_GATT_H */
diff --git a/hardware/bt_gatt_client.h b/hardware/bt_gatt_client.h
deleted file mode 100644 (file)
index b61c6e6..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * Copyright (C) 2009-2014 Broadcom Corporation
- *
- * 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 ANDROID_INCLUDE_BT_GATT_CLIENT_H
-#define ANDROID_INCLUDE_BT_GATT_CLIENT_H
-
-#include <stdint.h>
-#include "bt_gatt_types.h"
-
-__BEGIN_DECLS
-
-#ifdef TIZEN_BT_HAL
-#define BT_GATTC_LE_SCAN_TYPE_PASSIVE  0x00
-#define BT_GATTC_LE_SCAN_TYPE_ACTIVE   0x01
-#endif
-
-/** Buffer type for unformatted reads/writes */
-typedef struct {
-       uint8_t             value[BTGATT_MAX_ATTR_LEN];
-       uint16_t            len;
-} btgatt_unformatted_value_t;
-
-/** Parameters for GATT read operations */
-typedef struct {
-       btgatt_srvc_id_t    srvc_id;
-       btgatt_gatt_id_t    char_id;
-       btgatt_gatt_id_t    descr_id;
-       btgatt_unformatted_value_t value;
-       uint16_t            value_type;
-       uint8_t             status;
-} btgatt_read_params_t;
-
-/** Parameters for GATT write operations */
-typedef struct {
-       btgatt_srvc_id_t    srvc_id;
-       btgatt_gatt_id_t    char_id;
-       btgatt_gatt_id_t    descr_id;
-       uint8_t             status;
-} btgatt_write_params_t;
-
-/** Attribute change notification parameters */
-typedef struct {
-       uint8_t             value[BTGATT_MAX_ATTR_LEN];
-       bt_bdaddr_t         bda;
-       btgatt_srvc_id_t    srvc_id;
-       btgatt_gatt_id_t    char_id;
-       uint16_t            len;
-       uint8_t             is_notify;
-} btgatt_notify_params_t;
-
-typedef struct {
-       bt_bdaddr_t        *bda1;
-       bt_uuid_t          *uuid1;
-       uint16_t            u1;
-       uint16_t            u2;
-       uint16_t            u3;
-       uint16_t            u4;
-       uint16_t            u5;
-} btgatt_test_params_t;
-
-/** BT-GATT Client callback structure. */
-
-/** Callback invoked in response to register_client */
-typedef void (*register_client_callback)(int status, int client_if,
-               bt_uuid_t *app_uuid);
-
-/** Callback for scan results */
-typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, uint8_t* adv_data);
-
-/** GATT open callback invoked in response to open */
-typedef void (*connect_callback)(int conn_id, int status, int client_if, bt_bdaddr_t* bda);
-
-/** Callback invoked in response to close */
-typedef void (*disconnect_callback)(int conn_id, int status,
-               int client_if, bt_bdaddr_t* bda);
-
-/**
- * Invoked in response to search_service when the GATT service search
- * has been completed.
- */
-typedef void (*search_complete_callback)(int conn_id, int status);
-
-/** Reports GATT services on a remote device */
-typedef void (*search_result_callback)(int conn_id, btgatt_srvc_id_t *srvc_id);
-
-/** GATT characteristic enumeration result callback */
-typedef void (*get_characteristic_callback)(int conn_id, int status,
-               btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-               int char_prop);
-
-/** GATT descriptor enumeration result callback */
-typedef void (*get_descriptor_callback)(int conn_id, int status,
-               btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-               btgatt_gatt_id_t *descr_id);
-
-/** GATT included service enumeration result callback */
-typedef void (*get_included_service_callback)(int conn_id, int status,
-               btgatt_srvc_id_t *srvc_id, btgatt_srvc_id_t *incl_srvc_id);
-
-/** Callback invoked in response to [de]register_for_notification */
-typedef void (*register_for_notification_callback)(int conn_id,
-               int registered, int status, btgatt_srvc_id_t *srvc_id,
-               btgatt_gatt_id_t *char_id);
-
-/**
- * Remote device notification callback, invoked when a remote device sends
- * a notification or indication that a client has registered for.
- */
-typedef void (*notify_callback)(int conn_id, btgatt_notify_params_t *p_data);
-
-/** Reports result of a GATT read operation */
-typedef void (*read_characteristic_callback)(int conn_id, int status,
-               btgatt_read_params_t *p_data);
-
-/** GATT write characteristic operation callback */
-typedef void (*write_characteristic_callback)(int conn_id, int status,
-               btgatt_write_params_t *p_data);
-
-/** GATT execute prepared write callback */
-typedef void (*execute_write_callback)(int conn_id, int status);
-
-/** Callback invoked in response to read_descriptor */
-typedef void (*read_descriptor_callback)(int conn_id, int status,
-               btgatt_read_params_t *p_data);
-
-/** Callback invoked in response to write_descriptor */
-typedef void (*write_descriptor_callback)(int conn_id, int status,
-               btgatt_write_params_t *p_data);
-
-/** Callback triggered in response to read_remote_rssi */
-typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda,
-               int rssi, int status);
-
-/** Callback invoked when the MTU for a given connection changes */
-typedef void (*configure_mtu_callback)(int conn_id, int status, int mtu);
-
-/** Callback invoked when a scan filter configuration command has completed */
-typedef void (*scan_filter_cfg_callback)(int action, int client_if, int status, int filt_type,
-               int avbl_space);
-
-/** Callback invoked when scan param has been added, cleared, or deleted */
-typedef void (*scan_filter_param_callback)(int action, int client_if, int status,
-               int avbl_space);
-
-/** Callback invoked when a scan filter configuration command has completed */
-typedef void (*scan_filter_status_callback)(int enable, int client_if, int status);
-
-/**
- * Callback notifying an application that a remote device connection is currently congested
- * and cannot receive any more data. An application should avoid sending more data until
- * a further callback is received indicating the congestion status has been cleared.
- */
-typedef void (*congestion_callback)(int conn_id, bool congested);
-/** Callback invoked when batchscan storage config operation has completed */
-typedef void (*batchscan_cfg_storage_callback)(int client_if, int status);
-
-/** Callback invoked when batchscan enable / disable operation has completed */
-typedef void (*batchscan_enable_disable_callback)(int action, int client_if, int status);
-
-/** Callback invoked when batchscan reports are obtained */
-typedef void (*batchscan_reports_callback)(int client_if, int status, int report_format,
-               int num_records, int data_len, uint8_t* rep_data);
-
-/** Callback invoked when batchscan storage threshold limit is crossed */
-typedef void (*batchscan_threshold_callback)(int client_if);
-
-/** Track ADV VSE callback invoked when tracked device is found or lost */
-typedef void (*track_adv_event_callback)(int client_if, int filt_index, int addr_type,
-               bt_bdaddr_t* bda, int adv_state);
-typedef struct {
-       register_client_callback            register_client_cb;
-       scan_result_callback                scan_result_cb;
-       connect_callback                    open_cb;
-       disconnect_callback                 close_cb;
-       search_complete_callback            search_complete_cb;
-       search_result_callback              search_result_cb;
-       get_characteristic_callback         get_characteristic_cb;
-       get_descriptor_callback             get_descriptor_cb;
-       get_included_service_callback       get_included_service_cb;
-       register_for_notification_callback  register_for_notification_cb;
-       notify_callback                     notify_cb;
-       read_characteristic_callback        read_characteristic_cb;
-       write_characteristic_callback       write_characteristic_cb;
-       read_descriptor_callback            read_descriptor_cb;
-       write_descriptor_callback           write_descriptor_cb;
-       execute_write_callback              execute_write_cb;
-       read_remote_rssi_callback           read_remote_rssi_cb;
-       configure_mtu_callback              configure_mtu_cb;
-       scan_filter_cfg_callback            scan_filter_cfg_cb;
-       scan_filter_param_callback          scan_filter_param_cb;
-       scan_filter_status_callback         scan_filter_status_cb;
-       congestion_callback                 congestion_cb;
-       batchscan_cfg_storage_callback      batchscan_cfg_storage_cb;
-       batchscan_enable_disable_callback   batchscan_enb_disable_cb;
-       batchscan_reports_callback          batchscan_reports_cb;
-       batchscan_threshold_callback        batchscan_threshold_cb;
-       track_adv_event_callback            track_adv_event_cb;
-} btgatt_client_callbacks_t;
-
-/** Represents the standard BT-GATT client interface. */
-
-typedef struct {
-       /** Registers a GATT client application with the stack */
-       bt_status_t (*register_client)(bt_uuid_t *uuid);
-
-       /** Unregister a client application from the stack */
-       bt_status_t (*unregister_client)(int client_if);
-
-       /** Start or stop LE device scanning */
-       bt_status_t (*scan)(int client_if, bool start);
-
-       /** Create a connection to a remote LE or dual-mode device */
-       bt_status_t (*connect)(int client_if, const bt_bdaddr_t *bd_addr,
-                       bool is_direct);
-
-       /** Disconnect a remote device or cancel a pending connection */
-       bt_status_t (*disconnect)(int client_if, const bt_bdaddr_t *bd_addr,
-                       int conn_id);
-
-       /** Clear the attribute cache for a given device */
-       bt_status_t (*refresh)(int client_if, const bt_bdaddr_t *bd_addr);
-
-       /**
-        * Enumerate all GATT services on a connected device.
-        * Optionally, the results can be filtered for a given UUID.
-        */
-       bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid);
-
-       /**
-        * Enumerate included services for a given service.
-        * Set start_incl_srvc_id to NULL to get the first included service.
-        */
-       bt_status_t (*get_included_service)(int conn_id, btgatt_srvc_id_t *srvc_id,
-                       btgatt_srvc_id_t *start_incl_srvc_id);
-
-       /**
-        * Enumerate characteristics for a given service.
-        * Set start_char_id to NULL to get the first characteristic.
-        */
-       bt_status_t (*get_characteristic)(int conn_id,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id);
-
-       /**
-        * Enumerate descriptors for a given characteristic.
-        * Set start_descr_id to NULL to get the first descriptor.
-        */
-       bt_status_t (*get_descriptor)(int conn_id,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                       btgatt_gatt_id_t *start_descr_id);
-
-       /** Read a characteristic on a remote device */
-       bt_status_t (*read_characteristic)(int conn_id,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                       int auth_req);
-
-       /** Write a remote characteristic */
-       bt_status_t (*write_characteristic)(int conn_id,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                       int write_type, int len, int auth_req,
-                       char* p_value);
-
-       /** Read the descriptor for a given characteristic */
-       bt_status_t (*read_descriptor)(int conn_id,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                       btgatt_gatt_id_t *descr_id, int auth_req);
-
-       /** Write a remote descriptor for a given characteristic */
-       bt_status_t (*write_descriptor)(int conn_id,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                       btgatt_gatt_id_t *descr_id, int write_type, int len,
-                       int auth_req, char* p_value);
-
-       /** Execute a prepared write operation */
-       bt_status_t (*execute_write)(int conn_id, int execute);
-
-       /**
-        * Register to receive notifications or indications for a given
-        * characteristic
-        */
-       bt_status_t (*register_for_notification)(int client_if,
-                       const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
-                       btgatt_gatt_id_t *char_id);
-
-       /** Deregister a previous request for notifications/indications */
-       bt_status_t (*deregister_for_notification)(int client_if,
-                       const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
-                       btgatt_gatt_id_t *char_id);
-
-       /** Request RSSI for a given remote device */
-       bt_status_t (*read_remote_rssi)(int client_if, const bt_bdaddr_t *bd_addr);
-
-       /** OTA firmware download */
-       bt_status_t (*ota_fw_update)(int client_if, int conn_id, const bt_bdaddr_t *bd_addr, char* path);
-
-       /** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */
-       int (*get_device_type)(const bt_bdaddr_t *bd_addr);
-
-       /** Request a connection parameter update */
-       bt_status_t (*conn_parameter_update)(bt_bdaddr_t *bd, int min_int, int max_int, int latency, int timeout);
-
-       /** Test mode interface */
-       bt_status_t (*test_command)(int command, btgatt_test_params_t* params);
-
-       /** MTU Exchange request from client */
-       bt_status_t (*configure_mtu)(int conn_id, int mtu);
-
-       /** Setup scan filter params */
-       bt_status_t (*scan_filter_param_setup)(int client_if, int action, int filt_index, int feat_seln,
-                       int list_logic_type, int filt_logic_type, int rssi_high_thres,
-                       int rssi_low_thres, int dely_mode, int found_timeout,
-                       int lost_timeout, int found_timeout_cnt);
-
-
-       /** Configure a scan filter condition  */
-       bt_status_t (*scan_filter_add_remove)(int client_if, int action, int filt_type,
-                       int filt_index, int company_id,
-                       int company_id_mask, const bt_uuid_t *p_uuid,
-                       const bt_uuid_t *p_uuid_mask, const bt_bdaddr_t *bd_addr,
-                       char addr_type, int data_len, char* p_data, int mask_len,
-                       char* p_mask);
-
-       /** Clear all scan filter conditions for specific filter index*/
-       bt_status_t (*scan_filter_clear)(int client_if, int filt_index);
-
-       /** Enable / disable scan filter feature*/
-       bt_status_t (*scan_filter_enable)(int client_if, bool enable);
-
-       /** Sets the LE scan interval and window in units of N*0.625 msec */
-#ifdef TIZEN_BT_HAL
-       bt_status_t (*set_scan_parameters)(int scan_type, int scan_interval, int scan_window);
-#else
-       bt_status_t (*set_scan_parameters)(int scan_interval, int scan_window);
-#endif
-
-       /* Configure the batchscan storage */
-       bt_status_t (*batchscan_cfg_storage)(int client_if, int batch_scan_full_max,
-                       int batch_scan_trunc_max, int batch_scan_notify_threshold);
-
-       /* Enable batchscan */
-       bt_status_t (*batchscan_enb_batch_scan)(int client_if, int scan_mode,
-                       int scan_interval, int scan_window, int addr_type, int discard_rule);
-
-       /* Disable batchscan */
-       bt_status_t (*batchscan_dis_batch_scan)(int client_if);
-
-       /* Read out batchscan reports */
-       bt_status_t (*batchscan_read_reports)(int client_if, int scan_mode);
-
-} btgatt_client_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_GATT_CLIENT_H */
diff --git a/hardware/bt_gatt_server.h b/hardware/bt_gatt_server.h
deleted file mode 100644 (file)
index f8cd427..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_GATT_SERVER_H
-#define ANDROID_INCLUDE_BT_GATT_SERVER_H
-
-#include <stdint.h>
-
-#include "bt_gatt_types.h"
-
-__BEGIN_DECLS
-
-/** GATT value type used in response to remote read requests */
-typedef struct {
-       uint8_t           value[BTGATT_MAX_ATTR_LEN];
-       uint16_t          handle;
-       uint16_t          offset;
-       uint16_t          len;
-       uint8_t           auth_req;
-} btgatt_value_t;
-
-/** GATT remote read request response type */
-typedef union {
-       btgatt_value_t attr_value;
-       uint16_t            handle;
-} btgatt_response_t;
-
-typedef struct {
-       uint8_t  server_if;
-       bool     set_scan_rsp;
-       bool     include_name;
-       bool     include_txpower;
-       uint16_t  appearance;
-       char*    manufacturer_data;
-       uint16_t manufacturer_data_len;
-       char*    service_data;
-       uint16_t service_data_len;
-       char*    service_uuid;
-       uint16_t service_uuid_len;
-       char*    solicit_uuid;
-       uint16_t solicit_uuid_len;
-       uint16_t  min_interval;
-       uint16_t  max_interval;
-       uint8_t  adv_type;
-       uint8_t  chnl_map;
-       uint8_t  tx_power;
-       uint8_t  timeout_s;
-} btgatt_adv_param_setup_t;
-
-
-/** BT-GATT Server callback structure. */
-
-/** Callback invoked in response to register_server */
-typedef void (*register_server_callback)(int status, int server_if,
-               bt_uuid_t *app_uuid);
-
-/** Callback indicating that a remote device has connected or been disconnected */
-typedef void (*connection_callback)(int conn_id, int server_if, int connected,
-               bt_bdaddr_t *bda);
-
-/** Callback invoked in response to create_service */
-typedef void (*service_added_callback)(int status, int server_if,
-               btgatt_srvc_id_t *srvc_id, int srvc_handle);
-
-/** Callback indicating that an included service has been added to a service */
-typedef void (*included_service_added_callback)(int status, int server_if,
-               int srvc_handle, int incl_srvc_handle);
-
-/** Callback invoked when a characteristic has been added to a service */
-typedef void (*characteristic_added_callback)(int status, int server_if,
-               bt_uuid_t *uuid, int srvc_handle, int char_handle);
-
-/** Callback invoked when a descriptor has been added to a characteristic */
-typedef void (*descriptor_added_callback)(int status, int server_if,
-               bt_uuid_t *uuid, int srvc_handle, int descr_handle);
-
-/** Callback invoked in response to start_service */
-typedef void (*service_started_callback)(int status, int server_if,
-               int srvc_handle);
-
-/** Callback invoked in response to stop_service */
-typedef void (*service_stopped_callback)(int status, int server_if,
-               int srvc_handle);
-
-/** Callback triggered when a service has been deleted */
-typedef void (*service_deleted_callback)(int status, int server_if,
-               int srvc_handle);
-
-/**
- * Callback invoked when indication confirmation
- */
-typedef void (*indication_confirmation_callback) (int conn_id, int trans_id, int attr_handle, bt_bdaddr_t *bda);
-
-#ifdef TIZEN_BT_HAL
-/**
- * Callback invoked when indication confirmation
- */
-typedef void (*notification_enabled_callback) (int conn_id, int trans_id, int attr_handle, bool notify, bt_bdaddr_t *bda);
-#endif
-
-/**
- * Callback invoked when a remote device has requested to read a characteristic
- * or descriptor. The application must respond by calling send_response
- */
-typedef void (*request_read_callback)(int conn_id, int trans_id, bt_bdaddr_t *bda,
-               int attr_handle, int offset, bool is_long);
-
-/**
- * Callback invoked when a remote device has requested to write to a
- * characteristic or descriptor.
- */
-typedef void (*request_write_callback)(int conn_id, int trans_id, bt_bdaddr_t *bda,
-               int attr_handle, int offset, int length,
-               bool need_rsp, bool is_prep, uint8_t* value);
-
-/** Callback invoked when a previously prepared write is to be executed */
-typedef void (*request_exec_write_callback)(int conn_id, int trans_id,
-               bt_bdaddr_t *bda, int exec_write);
-
-/**
- * Callback triggered in response to send_response if the remote device
- * sends a confirmation.
- */
-typedef void (*response_confirmation_callback)(int status, int handle);
-
-/**
- * Callback indicationg the status of a listen() operation
- */
-typedef void (*listen_callback)(int status, int server_if);
-
-/** Callback invoked when multi-adv enable operation has completed */
-typedef void (*multi_adv_enable_callback)(int server_if, int status);
-
-/** Callback invoked when multi-adv param update operation has completed */
-typedef void (*multi_adv_update_callback)(int server_if, int status);
-
-/** Callback invoked when multi-adv instance data set operation has completed */
-typedef void (*multi_adv_data_callback)(int server_if, int status);
-
-/** Callback invoked when multi-adv disable operation has completed */
-typedef void (*multi_adv_disable_callback)(int server_if, int status);
-
-/** Callback invoked when the MTU for a given connection changes */
-typedef void (*mtu_changed_callback)(int conn_id, int mtu);
-
-typedef struct {
-       register_server_callback        register_server_cb;
-       connection_callback             connection_cb;
-       service_added_callback          service_added_cb;
-       included_service_added_callback included_service_added_cb;
-       characteristic_added_callback   characteristic_added_cb;
-       descriptor_added_callback       descriptor_added_cb;
-       service_started_callback        service_started_cb;
-       service_stopped_callback        service_stopped_cb;
-       service_deleted_callback        service_deleted_cb;
-       indication_confirmation_callback indication_confirmation_cb;
-       request_read_callback           request_read_cb;
-       request_write_callback          request_write_cb;
-       request_exec_write_callback     request_exec_write_cb;
-       response_confirmation_callback  response_confirmation_cb;
-       listen_callback                 listen_cb;
-       multi_adv_enable_callback       multi_adv_enable_cb;
-       multi_adv_update_callback       multi_adv_update_cb;
-       multi_adv_data_callback         multi_adv_data_cb;
-       multi_adv_disable_callback      multi_adv_disable_cb;
-       mtu_changed_callback            mtu_changed_cb;
-#ifdef TIZEN_BT_HAL
-       notification_enabled_callback   notif_enabled_cb;
-#endif
-} btgatt_server_callbacks_t;
-
-/** Represents the standard BT-GATT server interface. */
-typedef struct {
-       /** Registers a GATT server application with the stack */
-       bt_status_t (*register_server)(bt_uuid_t *uuid);
-
-       /** Unregister a server application from the stack */
-       bt_status_t (*unregister_server)(int server_if);
-
-       /** Create a connection to a remote peripheral */
-       bt_status_t (*connect)(int server_if, const bt_bdaddr_t *bd_addr, bool is_direct);
-
-       /** Disconnect an established connection or cancel a pending one */
-       bt_status_t (*disconnect)(int server_if, const bt_bdaddr_t *bd_addr,
-                       int conn_id);
-
-       /** Create a new service */
-       bt_status_t (*add_service)(int server_if, btgatt_srvc_id_t *srvc_id, int num_handles);
-
-       /** Assign an included service to it's parent service */
-       bt_status_t (*add_included_service)(int server_if, int service_handle, int included_handle);
-
-       /** Add a characteristic to a service */
-       bt_status_t (*add_characteristic)(int server_if,
-                       int service_handle, bt_uuid_t *uuid,
-                       int properties, int permissions);
-
-       /** Add a descriptor to a given service */
-       bt_status_t (*add_descriptor)(int server_if, int service_handle,
-                       bt_uuid_t *uuid, int permissions);
-
-       /** Starts a local service */
-       bt_status_t (*start_service)(int server_if, int service_handle,
-                       int transport);
-
-       /** Stops a local service */
-       bt_status_t (*stop_service)(int server_if, int service_handle);
-
-       /** Delete a local service */
-       bt_status_t (*delete_service)(int server_if, int service_handle);
-
-       /** Send value indication to a remote device */
-       bt_status_t (*send_indication)(int server_if, int attribute_handle,
-                       int conn_id, int len, int confirm,
-                       char* p_value);
-
-       /** Send a response to a read/write operation */
-       bt_status_t (*send_response)(int conn_id, int trans_id,
-                       int status, btgatt_response_t *response);
-
-       /** Update GATT server attribute value */
-       bt_status_t (*update_att_value)(int server_if, int attribute_handle,
-                       int value_length, char* att_value);
-
-       /** Start or stop advertisements to listen for incoming connections */
-       bt_status_t (*listen)(int server_if, bool start);
-
-       /** Set the advertising data or scan response data */
-       bt_status_t (*set_adv_data)(int server_if, bool set_scan_rsp, bool include_name,
-                       bool include_txpower, int min_interval, int max_interval, int appearance,
-                       uint16_t manufacturer_len, char* manufacturer_data,
-                       uint16_t service_data_len, char* service_data,
-                       uint16_t service_uuid_len, char* service_uuid);
-
-       /* Setup the parameters as per spec, user manual specified values and enable multi ADV */
-       bt_status_t (*multi_adv_enable)(int server_if);
-
-       /* Update the parameters as per spec, user manual specified values and restart multi ADV */
-       bt_status_t (*multi_adv_update)(int server_if, int min_interval, int max_interval, int adv_type,
-                       int chnl_map, int tx_power, int timeout_s);
-
-       /* Setup the data for the specified instance */
-       bt_status_t (*multi_adv_set_inst_data)(btgatt_adv_param_setup_t adv_param_setup);
-
-       /* Disable the multi adv instance */
-       bt_status_t (*multi_adv_disable)(int server_if);
-
-       /* Get current att mtu size of active connection */
-       bt_status_t (*get_att_mtu)(int conn_id, int *mtu_size);
-} btgatt_server_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_GATT_SERVER_H */
diff --git a/hardware/bt_gatt_types.h b/hardware/bt_gatt_types.h
deleted file mode 100644 (file)
index 289b543..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_GATT_TYPES_H
-#define ANDROID_INCLUDE_BT_GATT_TYPES_H
-
-#include <stdint.h>
-#include <stdbool.h>
-
-__BEGIN_DECLS
-
-/**
- * Buffer sizes for maximum attribute length and maximum read/write
- * operation buffer size.
- */
-#define BTGATT_MAX_ATTR_LEN 600
-
-/**
- * GATT Service types
- */
-#define BTGATT_SERVICE_TYPE_PRIMARY 0
-#define BTGATT_SERVICE_TYPE_SECONDARY 1
-
-/** GATT ID adding instance id tracking to the UUID */
-typedef struct {
-       bt_uuid_t           uuid;
-       uint8_t             inst_id;
-} btgatt_gatt_id_t;
-
-/** GATT Service ID also identifies the service type (primary/secondary) */
-typedef struct {
-       btgatt_gatt_id_t    id;
-       uint8_t             is_primary;
-} btgatt_srvc_id_t;
-
-/** Preferred physical Transport for GATT connection */
-typedef enum {
-       GATT_TRANSPORT_AUTO,
-       GATT_TRANSPORT_BREDR,
-       GATT_TRANSPORT_LE
-} btgatt_transport_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_GATT_TYPES_H */
diff --git a/hardware/bt_hf.h b/hardware/bt_hf.h
deleted file mode 100644 (file)
index 79d9398..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_HF_H
-#define ANDROID_INCLUDE_BT_HF_H
-
-__BEGIN_DECLS
-
-/* AT response code - OK/Error */
-typedef enum {
-       BTHF_AT_RESPONSE_ERROR = 0,
-       BTHF_AT_RESPONSE_OK
-} bthf_at_response_t;
-
-typedef enum {
-       BTHF_CONNECTION_STATE_DISCONNECTED = 0,
-       BTHF_CONNECTION_STATE_CONNECTING,
-       BTHF_CONNECTION_STATE_CONNECTED,
-       BTHF_CONNECTION_STATE_SLC_CONNECTED,
-       BTHF_CONNECTION_STATE_DISCONNECTING
-} bthf_connection_state_t;
-
-typedef enum {
-       BTHF_AUDIO_STATE_DISCONNECTED = 0,
-       BTHF_AUDIO_STATE_CONNECTING,
-       BTHF_AUDIO_STATE_CONNECTED,
-       BTHF_AUDIO_STATE_DISCONNECTING
-} bthf_audio_state_t;
-
-typedef enum {
-       BTHF_VR_STATE_STOPPED = 0,
-       BTHF_VR_STATE_STARTED
-} bthf_vr_state_t;
-
-typedef enum {
-       BTHF_VOLUME_TYPE_SPK = 0,
-       BTHF_VOLUME_TYPE_MIC
-} bthf_volume_type_t;
-
-/* Noise Reduction and Echo Cancellation */
-typedef enum {
-       BTHF_NREC_STOP,
-       BTHF_NREC_START
-} bthf_nrec_t;
-
-/* WBS codec setting */
-typedef enum {
-       BTHF_WBS_NONE,
-       BTHF_WBS_NO,
-       BTHF_WBS_YES
-} bthf_wbs_config_t;
-
-/* CHLD - Call held handling */
-typedef enum {
-       BTHF_CHLD_TYPE_RELEASEHELD,              // Terminate all held or set UDUB("busy") to a waiting call
-       BTHF_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD, // Terminate all active calls and accepts a waiting/held call
-       BTHF_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD,    // Hold all active calls and accepts a waiting/held call
-       BTHF_CHLD_TYPE_ADDHELDTOCONF,            // Add all held calls to a conference
-} bthf_chld_type_t;
-
-/** Callback for connection state change.
- *  state will have one of the values from BtHfConnectionState
- */
-typedef void (*bthf_connection_state_callback)(bthf_connection_state_t state, bt_bdaddr_t *bd_addr);
-
-/** Callback for audio connection state change.
- *  state will have one of the values from BtHfAudioState
- */
-typedef void (*bthf_audio_state_callback)(bthf_audio_state_t state, bt_bdaddr_t *bd_addr);
-
-/** Callback for VR connection state change.
- *  state will have one of the values from BtHfVRState
- */
-typedef void (*bthf_vr_cmd_callback)(bthf_vr_state_t state, bt_bdaddr_t *bd_addr);
-
-/** Callback for answer incoming call (ATA)
- */
-typedef void (*bthf_answer_call_cmd_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for disconnect call (AT+CHUP)
- */
-typedef void (*bthf_hangup_call_cmd_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for disconnect call (AT+CHUP)
- *  type will denote Speaker/Mic gain (BtHfVolumeControl).
- */
-typedef void (*bthf_volume_cmd_callback)(bthf_volume_type_t type, int volume, bt_bdaddr_t *bd_addr);
-
-/** Callback for dialing an outgoing call
- *  If number is NULL, redial
- */
-typedef void (*bthf_dial_call_cmd_callback)(char *number, bt_bdaddr_t *bd_addr);
-
-/** Callback for sending DTMF tones
- *  tone contains the dtmf character to be sent
- */
-typedef void (*bthf_dtmf_cmd_callback)(char tone, bt_bdaddr_t *bd_addr);
-
-/** Callback for enabling/disabling noise reduction/echo cancellation
- *  value will be 1 to enable, 0 to disable
- */
-typedef void (*bthf_nrec_cmd_callback)(bthf_nrec_t nrec, bt_bdaddr_t *bd_addr);
-
-/** Callback for AT+BCS and event from BAC
- *  WBS enable, WBS disable
- */
-typedef void (*bthf_wbs_callback)(bthf_wbs_config_t wbs, bt_bdaddr_t *bd_addr);
-
-/** Callback for call hold handling (AT+CHLD)
- *  value will contain the call hold command (0, 1, 2, 3)
- */
-typedef void (*bthf_chld_cmd_callback)(bthf_chld_type_t chld, bt_bdaddr_t *bd_addr);
-
-/** Callback for CNUM (subscriber number)
- */
-typedef void (*bthf_cnum_cmd_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for indicators (CIND)
- */
-typedef void (*bthf_cind_cmd_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for operator selection (COPS)
- */
-typedef void (*bthf_cops_cmd_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for call list (AT+CLCC)
- */
-typedef void (*bthf_clcc_cmd_callback) (bt_bdaddr_t *bd_addr);
-
-/** Callback for unknown AT command recd from HF
- *  at_string will contain the unparsed AT string
- */
-typedef void (*bthf_unknown_at_cmd_callback)(char *at_string, bt_bdaddr_t *bd_addr);
-
-/** Callback for keypressed (HSP) event.
- */
-typedef void (*bthf_key_pressed_cmd_callback)(bt_bdaddr_t *bd_addr);
-
-/** BT-HF callback structure. */
-typedef struct {
-       /** set to sizeof(BtHfCallbacks) */
-       size_t      size;
-       bthf_connection_state_callback  connection_state_cb;
-       bthf_audio_state_callback       audio_state_cb;
-       bthf_vr_cmd_callback            vr_cmd_cb;
-       bthf_answer_call_cmd_callback   answer_call_cmd_cb;
-       bthf_hangup_call_cmd_callback   hangup_call_cmd_cb;
-       bthf_volume_cmd_callback        volume_cmd_cb;
-       bthf_dial_call_cmd_callback     dial_call_cmd_cb;
-       bthf_dtmf_cmd_callback          dtmf_cmd_cb;
-       bthf_nrec_cmd_callback          nrec_cmd_cb;
-       bthf_wbs_callback               wbs_cb;
-       bthf_chld_cmd_callback          chld_cmd_cb;
-       bthf_cnum_cmd_callback          cnum_cmd_cb;
-       bthf_cind_cmd_callback          cind_cmd_cb;
-       bthf_cops_cmd_callback          cops_cmd_cb;
-       bthf_clcc_cmd_callback          clcc_cmd_cb;
-       bthf_unknown_at_cmd_callback    unknown_at_cmd_cb;
-       bthf_key_pressed_cmd_callback   key_pressed_cmd_cb;
-} bthf_callbacks_t;
-
-/** Network Status */
-typedef enum {
-       BTHF_NETWORK_STATE_NOT_AVAILABLE = 0,
-       BTHF_NETWORK_STATE_AVAILABLE
-} bthf_network_state_t;
-
-/** Service type */
-typedef enum {
-       BTHF_SERVICE_TYPE_HOME = 0,
-       BTHF_SERVICE_TYPE_ROAMING
-} bthf_service_type_t;
-
-typedef enum {
-       BTHF_CALL_STATE_ACTIVE = 0,
-       BTHF_CALL_STATE_HELD,
-       BTHF_CALL_STATE_DIALING,
-       BTHF_CALL_STATE_ALERTING,
-       BTHF_CALL_STATE_INCOMING,
-       BTHF_CALL_STATE_WAITING,
-       BTHF_CALL_STATE_IDLE
-} bthf_call_state_t;
-
-typedef enum {
-       BTHF_CALL_DIRECTION_OUTGOING = 0,
-       BTHF_CALL_DIRECTION_INCOMING
-} bthf_call_direction_t;
-
-typedef enum {
-       BTHF_CALL_TYPE_VOICE = 0,
-       BTHF_CALL_TYPE_DATA,
-       BTHF_CALL_TYPE_FAX
-} bthf_call_mode_t;
-
-typedef enum {
-       BTHF_CALL_MPTY_TYPE_SINGLE = 0,
-       BTHF_CALL_MPTY_TYPE_MULTI
-} bthf_call_mpty_type_t;
-
-typedef enum {
-       BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81,
-       BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91
-} bthf_call_addrtype_t;
-
-/** Represents the standard BT-HF interface. */
-typedef struct {
-
-       /** set to sizeof(BtHfInterface) */
-       size_t          size;
-       /**
-        * Register the BtHf callbacks
-        */
-       bt_status_t (*init)(bthf_callbacks_t* callbacks, int max_hf_clients);
-
-       /** connect to headset */
-       bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
-
-       /** dis-connect from headset */
-       bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
-
-       /** create an audio connection */
-       bt_status_t (*connect_audio)(bt_bdaddr_t *bd_addr);
-
-       /** close the audio connection */
-       bt_status_t (*disconnect_audio)(bt_bdaddr_t *bd_addr);
-
-       /** start voice recognition */
-       bt_status_t (*start_voice_recognition)(bt_bdaddr_t *bd_addr);
-
-       /** stop voice recognition */
-       bt_status_t (*stop_voice_recognition)(bt_bdaddr_t *bd_addr);
-
-       /** volume control */
-       bt_status_t (*volume_control) (bthf_volume_type_t type, int volume, bt_bdaddr_t *bd_addr);
-
-       /** Combined device status change notification */
-       bt_status_t (*device_status_notification)(bthf_network_state_t ntk_state, bthf_service_type_t svc_type, int signal,
-                       int batt_chg);
-
-       /** Response for COPS command */
-       bt_status_t (*cops_response)(const char *cops, bt_bdaddr_t *bd_addr);
-
-       /** Response for CIND command */
-       bt_status_t (*cind_response)(int svc, int num_active, int num_held, bthf_call_state_t call_setup_state,
-                       int signal, int roam, int batt_chg, bt_bdaddr_t *bd_addr);
-
-       /** Pre-formatted AT response, typically in response to unknown AT cmd */
-       bt_status_t (*formatted_at_response)(const char *rsp, bt_bdaddr_t *bd_addr);
-
-       /** ok/error response
-        *  ERROR (0)
-        *  OK    (1)
-        */
-       bt_status_t (*at_response) (bthf_at_response_t response_code, int error_code, bt_bdaddr_t *bd_addr);
-
-       /** response for CLCC command
-        *  Can be iteratively called for each call index
-        *  Call index of 0 will be treated as NULL termination (Completes response)
-        */
-       bt_status_t (*clcc_response) (int index, bthf_call_direction_t dir,
-                       bthf_call_state_t state, bthf_call_mode_t mode,
-                       bthf_call_mpty_type_t mpty, const char *number,
-                       bthf_call_addrtype_t type, bt_bdaddr_t *bd_addr);
-
-       /** notify of a call state change
-        *  Each update notifies
-        *    1. Number of active/held/ringing calls
-        *    2. call_state: This denotes the state change that triggered this msg
-        *                  This will take one of the values from BtHfCallState
-        *    3. number & type: valid only for incoming & waiting call
-        */
-       bt_status_t (*phone_state_change) (int num_active, int num_held, bthf_call_state_t call_setup_state,
-                       const char *number, bthf_call_addrtype_t type);
-
-       /** Closes the interface. */
-       void  (*cleanup)(void);
-
-       /** configureation for the SCO codec */
-       bt_status_t (*configure_wbs)(bt_bdaddr_t *bd_addr , bthf_wbs_config_t config);
-} bthf_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_HF_H */
diff --git a/hardware/bt_hh.h b/hardware/bt_hh.h
deleted file mode 100644 (file)
index 55c54bc..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_HH_H
-#define ANDROID_INCLUDE_BT_HH_H
-
-#include <stdint.h>
-
-__BEGIN_DECLS
-
-#define BTHH_MAX_DSC_LEN   884
-
-/* HH connection states */
-typedef enum {
-       BTHH_CONN_STATE_CONNECTED              = 0,
-       BTHH_CONN_STATE_CONNECTING,
-       BTHH_CONN_STATE_DISCONNECTED,
-       BTHH_CONN_STATE_DISCONNECTING,
-       BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST,
-       BTHH_CONN_STATE_FAILED_KBD_FROM_HOST,
-       BTHH_CONN_STATE_FAILED_TOO_MANY_DEVICES,
-       BTHH_CONN_STATE_FAILED_NO_BTHID_DRIVER,
-       BTHH_CONN_STATE_FAILED_GENERIC,
-       BTHH_CONN_STATE_UNKNOWN
-} bthh_connection_state_t;
-
-typedef enum {
-       BTHH_OK                = 0,
-       BTHH_HS_HID_NOT_READY,        /* handshake error : device not ready */
-       BTHH_HS_INVALID_RPT_ID,       /* handshake error : invalid report ID */
-       BTHH_HS_TRANS_NOT_SPT,        /* handshake error : transaction not spt */
-       BTHH_HS_INVALID_PARAM,        /* handshake error : invalid paremter */
-       BTHH_HS_ERROR,                /* handshake error : unspecified HS error */
-       BTHH_ERR,                     /* general BTA HH error */
-       BTHH_ERR_SDP,                 /* SDP error */
-       BTHH_ERR_PROTO,               /* SET_Protocol error,
-                                        only used in BTA_HH_OPEN_EVT callback */
-       BTHH_ERR_DB_FULL,             /* device database full error, used  */
-       BTHH_ERR_TOD_UNSPT,           /* type of device not supported */
-       BTHH_ERR_NO_RES,              /* out of system resources */
-       BTHH_ERR_AUTH_FAILED,         /* authentication fail */
-       BTHH_ERR_HDL
-} bthh_status_t;
-
-/* Protocol modes */
-typedef enum {
-       BTHH_REPORT_MODE       = 0x00,
-       BTHH_BOOT_MODE         = 0x01,
-       BTHH_UNSUPPORTED_MODE  = 0xff
-} bthh_protocol_mode_t;
-
-/* Report types */
-typedef enum {
-       BTHH_INPUT_REPORT      = 1,
-       BTHH_OUTPUT_REPORT,
-       BTHH_FEATURE_REPORT
-} bthh_report_type_t;
-
-typedef struct {
-       int         attr_mask;
-       uint8_t     sub_class;
-       uint8_t     app_id;
-       int         vendor_id;
-       int         product_id;
-       int         version;
-       uint8_t     ctry_code;
-       int         dl_len;
-       uint8_t     dsc_list[BTHH_MAX_DSC_LEN];
-} bthh_hid_info_t;
-
-/** Callback for connection state change.
- *  state will have one of the values from bthh_connection_state_t
- */
-typedef void (*bthh_connection_state_callback)(bt_bdaddr_t *bd_addr, bthh_connection_state_t state);
-
-/** Callback for vitual unplug api.
- *  the status of the vitual unplug
- */
-typedef void (*bthh_virtual_unplug_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
-
-/** Callback for get hid info
- *  hid_info will contain attr_mask, sub_class, app_id, vendor_id, product_id, version, ctry_code, len
- */
-typedef void (*bthh_hid_info_callback)(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info);
-
-/** Callback for get protocol api.
- *  the protocol mode is one of the value from bthh_protocol_mode_t
- */
-typedef void (*bthh_protocol_mode_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, bthh_protocol_mode_t mode);
-
-/** Callback for get/set_idle_time api.
- */
-typedef void (*bthh_idle_time_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate);
-
-/** Callback for get report api.
- *  if staus is ok rpt_data contains the report data
- */
-typedef void (*bthh_get_report_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size);
-
-/** Callback for set_report/set_protocol api and if error
- *  occurs for get_report/get_protocol api.
- */
-typedef void (*bthh_handshake_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
-
-/** BT-HH callback structure. */
-typedef struct {
-       /** set to sizeof(BtHfCallbacks) */
-       size_t      size;
-       bthh_connection_state_callback  connection_state_cb;
-       bthh_hid_info_callback          hid_info_cb;
-       bthh_protocol_mode_callback     protocol_mode_cb;
-       bthh_idle_time_callback         idle_time_cb;
-       bthh_get_report_callback        get_report_cb;
-       bthh_virtual_unplug_callback    virtual_unplug_cb;
-       bthh_handshake_callback         handshake_cb;
-} bthh_callbacks_t;
-
-/** Represents the standard BT-HH interface. */
-typedef struct {
-
-       /** set to sizeof(BtHhInterface) */
-       size_t          size;
-
-       /**
-        * Register the BtHh callbacks
-        */
-       bt_status_t (*init)(bthh_callbacks_t* callbacks);
-
-       /** connect to hid device */
-       bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
-
-       /** dis-connect from hid device */
-       bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
-
-       /** Virtual UnPlug (VUP) the specified HID device */
-       bt_status_t (*virtual_unplug)(bt_bdaddr_t *bd_addr);
-
-       /** Set the HID device descriptor for the specified HID device. */
-       bt_status_t (*set_info)(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info);
-
-       /** Get the HID proto mode. */
-       bt_status_t (*get_protocol) (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
-
-       /** Set the HID proto mode. */
-       bt_status_t (*set_protocol)(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
-
-       /** Send a GET_REPORT to HID device. */
-       bt_status_t (*get_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, uint8_t reportId, int bufferSize);
-
-       /** Send a SET_REPORT to HID device. */
-       bt_status_t (*set_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, char* report);
-
-       /** Send data to HID device. */
-       bt_status_t (*send_data)(bt_bdaddr_t *bd_addr, char* data);
-
-       /** Closes the interface. */
-       void (*cleanup)(void);
-
-} bthh_interface_t;
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_HH_H */
diff --git a/hardware/bt_hl.h b/hardware/bt_hl.h
deleted file mode 100644 (file)
index f9f9311..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_HL_H
-#define ANDROID_INCLUDE_BT_HL_H
-
-__BEGIN_DECLS
-
-/* HL connection states */
-
-typedef enum {
-       BTHL_MDEP_ROLE_SOURCE,
-       BTHL_MDEP_ROLE_SINK
-} bthl_mdep_role_t;
-
-typedef enum {
-       BTHL_APP_REG_STATE_REG_SUCCESS,
-       BTHL_APP_REG_STATE_REG_FAILED,
-       BTHL_APP_REG_STATE_DEREG_SUCCESS,
-       BTHL_APP_REG_STATE_DEREG_FAILED
-} bthl_app_reg_state_t;
-
-typedef enum {
-       BTHL_CHANNEL_TYPE_RELIABLE,
-       BTHL_CHANNEL_TYPE_STREAMING,
-       BTHL_CHANNEL_TYPE_ANY
-} bthl_channel_type_t;
-
-
-/* HL connection states */
-typedef enum {
-       BTHL_CONN_STATE_CONNECTING,
-       BTHL_CONN_STATE_CONNECTED,
-       BTHL_CONN_STATE_DISCONNECTING,
-       BTHL_CONN_STATE_DISCONNECTED,
-       BTHL_CONN_STATE_DESTROYED
-} bthl_channel_state_t;
-
-typedef struct {
-       bthl_mdep_role_t        mdep_role;
-       int                     data_type;
-       bthl_channel_type_t     channel_type;
-       const char                   *mdep_description; /* MDEP description to be used in the SDP (optional); null terminated */
-} bthl_mdep_cfg_t;
-
-typedef struct {
-       const char      *application_name;
-       const char      *provider_name;   /* provider name to be used in the SDP (optional); null terminated */
-       const char      *srv_name;        /* service name to be used in the SDP (optional); null terminated*/
-       const char      *srv_desp;        /* service description to be used in the SDP (optional); null terminated */
-       int             number_of_mdeps;
-       bthl_mdep_cfg_t *mdep_cfg;  /* Dynamic array */
-} bthl_reg_param_t;
-
-/** Callback for application registration status.
- *  state will have one of the values from  bthl_app_reg_state_t
- */
-typedef void (*bthl_app_reg_state_callback)(int app_id, bthl_app_reg_state_t state);
-
-/** Callback for channel connection state change.
- *  state will have one of the values from
- *  bthl_connection_state_t and fd (file descriptor)
- */
-typedef void (*bthl_channel_state_callback)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd);
-
-/** BT-HL callback structure. */
-typedef struct {
-       /** set to sizeof(bthl_callbacks_t) */
-       size_t      size;
-       bthl_app_reg_state_callback     app_reg_state_cb;
-       bthl_channel_state_callback     channel_state_cb;
-} bthl_callbacks_t;
-
-
-/** Represents the standard BT-HL interface. */
-typedef struct {
-
-       /** set to sizeof(bthl_interface_t)  */
-       size_t          size;
-
-       /**
-        * Register the Bthl callbacks
-        */
-       bt_status_t (*init)(bthl_callbacks_t* callbacks);
-
-       /** Register HL application */
-       bt_status_t (*register_application) (bthl_reg_param_t *p_reg_param, int *app_id);
-
-       /** Unregister HL application */
-       bt_status_t (*unregister_application) (int app_id);
-
-       /** connect channel */
-       bt_status_t (*connect_channel)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int *channel_id);
-
-       /** destroy channel */
-       bt_status_t (*destroy_channel)(int channel_id);
-
-       /** Close the  Bthl callback **/
-       void (*cleanup)(void);
-
-} bthl_interface_t;
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_HL_H */
diff --git a/hardware/bt_rc.h b/hardware/bt_rc.h
deleted file mode 100644 (file)
index 6c38d02..0000000
+++ /dev/null
@@ -1,681 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_RC_H
-#define ANDROID_INCLUDE_BT_RC_H
-
-__BEGIN_DECLS
-
-/* Change this macro to use multiple RC */
-#define BT_RC_NUM_APP 1
-
-/* Macros */
-#define BTRC_MAX_ATTR_STR_LEN       (1 << 16)
-#define BTRC_UID_SIZE               8
-#define BTRC_MAX_APP_SETTINGS       8
-#define BTRC_MAX_FOLDER_DEPTH       4
-#define BTRC_MAX_APP_ATTR_SIZE      16
-#define BTRC_MAX_ELEM_ATTR_SIZE     8
-#define BTRC_FEATURE_BIT_MASK_SIZE 16
-
-/* Macros for valid scopes in get_folder_items */
-#define BTRC_SCOPE_PLAYER_LIST  0x00 /* Media Player List */
-#define BTRC_SCOPE_FILE_SYSTEM  0x01 /* Virtual File System */
-#define BTRC_SCOPE_SEARCH  0x02 /* Search */
-#define BTRC_SCOPE_NOW_PLAYING   0x03 /* Now Playing */
-
-/* Macros for supported character encoding */
-#define BTRC_CHARSET_ID_UTF8  0x006A
-
-/* Macros for item types */
-#define BTRC_ITEM_PLAYER  0x01 /* Media Player */
-#define BTRC_ITEM_FOLDER  0x02 /* Folder */
-#define BTRC_ITEM_MEDIA   0x03 /* Media File */
-
-/* Macros for media attribute IDs */
-#define BTRC_MEDIA_ATTR_ID_INVALID               -1
-#define BTRC_MEDIA_ATTR_ID_TITLE                 0x00000001
-#define BTRC_MEDIA_ATTR_ID_ARTIST                0x00000002
-#define BTRC_MEDIA_ATTR_ID_ALBUM                 0x00000003
-#define BTRC_MEDIA_ATTR_ID_TRACK_NUM             0x00000004
-#define BTRC_MEDIA_ATTR_ID_NUM_TRACKS            0x00000005
-#define BTRC_MEDIA_ATTR_ID_GENRE                 0x00000006
-#define BTRC_MEDIA_ATTR_ID_PLAYING_TIME          0x00000007        /* in miliseconds */
-
-/* Macros for folder types */
-#define BTRC_FOLDER_TYPE_MIXED      0x00
-#define BTRC_FOLDER_TYPE_TITLES     0x01
-#define BTRC_FOLDER_TYPE_ALBUMS     0x02
-#define BTRC_FOLDER_TYPE_ARTISTS    0x03
-#define BTRC_FOLDER_TYPE_GENRES     0x04
-#define BTRC_FOLDER_TYPE_PLAYLISTS  0x05
-#define BTRC_FOLDER_TYPE_YEARS      0x06
-
-/* Macros for media types */
-#define BTRC_MEDIA_TYPE_AUDIO  0x00 /* audio */
-#define BTRC_MEDIA_TYPE_VIDEO  0x01 /* video */
-
-/* Macros for num attributes */
-#define BTRC_NUM_ATTR_NONE 0xFF /* No attributes required */
-#define BTRC_NUM_ATTR_ALL  0X00 /* All attributes required */
-
-#define BTRC_HANDLE_NONE 0xFF
-
-typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
-
-typedef enum {
-       BTRC_CONNECTION_STATE_DISCONNECTED = 0,
-       BTRC_CONNECTION_STATE_CONNECTED
-} btrc_connection_state_t;
-
-typedef enum {
-       BTRC_FEAT_NONE = 0x00,    /* AVRCP 1.0 */
-       BTRC_FEAT_METADATA = 0x01,    /* AVRCP 1.3 */
-       BTRC_FEAT_ABSOLUTE_VOLUME = 0x02,    /* Supports TG role and volume sync */
-       BTRC_FEAT_BROWSE = 0x04,    /* AVRCP 1.4 and up, with Browsing support */
-} btrc_remote_features_t;
-
-typedef enum {
-       BTRC_PLAYSTATE_STOPPED = 0x00,    /* Stopped */
-       BTRC_PLAYSTATE_PLAYING = 0x01,    /* Playing */
-       BTRC_PLAYSTATE_PAUSED = 0x02,    /* Paused  */
-       BTRC_PLAYSTATE_FWD_SEEK = 0x03,    /* Fwd Seek*/
-       BTRC_PLAYSTATE_REV_SEEK = 0x04,    /* Rev Seek*/
-       BTRC_PLAYSTATE_ERROR = 0xFF,    /* Error   */
-} btrc_play_status_t;
-
-typedef enum {
-       BTRC_EVT_PLAY_STATUS_CHANGED = 0x01,
-       BTRC_EVT_TRACK_CHANGE = 0x02,
-       BTRC_EVT_TRACK_REACHED_END = 0x03,
-       BTRC_EVT_TRACK_REACHED_START = 0x04,
-       BTRC_EVT_PLAY_POS_CHANGED = 0x05,
-       BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
-       BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
-       BTRC_EVT_AVAL_PLAYER_CHANGE = 0x0a,
-       BTRC_EVT_ADDR_PLAYER_CHANGE = 0x0b,
-       BTRC_EVT_UIDS_CHANGED = 0x0c,
-       BTRC_EVT_VOL_CHANGED = 0x0d,
-} btrc_event_id_t;
-
-typedef enum {
-       BTRC_NOTIFICATION_TYPE_INTERIM = 0,
-       BTRC_NOTIFICATION_TYPE_CHANGED = 1,
-} btrc_notification_type_t;
-
-typedef enum {
-       BTRC_PLAYER_ATTR_EQUALIZER = 0x01,
-       BTRC_PLAYER_ATTR_REPEAT = 0x02,
-       BTRC_PLAYER_ATTR_SHUFFLE = 0x03,
-       BTRC_PLAYER_ATTR_SCAN = 0x04,
-} btrc_player_attr_t;
-
-typedef enum {
-       BTRC_TRANSPORT_ATTR_DELAY = 0x01,
-       BTRC_TRANSPORT_ATTR_VOLUME
-} btrc_transport_attr_t;
-
-typedef enum {
-       BTRC_MEDIA_ATTR_TITLE = 0x01,
-       BTRC_MEDIA_ATTR_ARTIST = 0x02,
-       BTRC_MEDIA_ATTR_ALBUM = 0x03,
-       BTRC_MEDIA_ATTR_TRACK_NUM = 0x04,
-       BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05,
-       BTRC_MEDIA_ATTR_GENRE = 0x06,
-       BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07,
-} btrc_media_attr_t;
-
-typedef enum {
-       BTRC_PLAYER_VAL_OFF_REPEAT = 0x01,
-       BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02,
-       BTRC_PLAYER_VAL_ALL_REPEAT = 0x03,
-       BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04
-} btrc_player_repeat_val_t;
-
-typedef enum {
-       BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01,
-       BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02,
-       BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03
-} btrc_player_shuffle_val_t;
-
-typedef enum {
-       BTRC_STS_BAD_CMD        = 0x00, /* Invalid command */
-       BTRC_STS_BAD_PARAM      = 0x01, /* Invalid parameter */
-       BTRC_STS_NOT_FOUND      = 0x02, /* Specified parameter is wrong or not found */
-       BTRC_STS_INTERNAL_ERR   = 0x03, /* Internal Error */
-       BTRC_STS_NO_ERROR       = 0x04, /* Operation Success */
-       BTRC_STS_UID_CHANGED    = 0x05, /* UIDs changed */
-       BTRC_STS_RESERVED       = 0x06, /* Reserved */
-       BTRC_STS_INV_DIRN       = 0x07, /* Invalid direction */
-       BTRC_STS_INV_DIRECTORY  = 0x08, /* Invalid directory */
-       BTRC_STS_INV_ITEM       = 0x09, /* Invalid Item */
-       BTRC_STS_INV_SCOPE      = 0x0a, /* Invalid scope */
-       BTRC_STS_INV_RANGE      = 0x0b, /* Invalid range */
-       BTRC_STS_DIRECTORY      = 0x0c, /* UID is a directory */
-       BTRC_STS_MEDIA_IN_USE   = 0x0d, /* Media in use */
-       BTRC_STS_PLAY_LIST_FULL = 0x0e, /* Playing list full */
-       BTRC_STS_SRCH_NOT_SPRTD = 0x0f, /* Search not supported */
-       BTRC_STS_SRCH_IN_PROG   = 0x10, /* Search in progress */
-       BTRC_STS_INV_PLAYER     = 0x11, /* Invalid player */
-       BTRC_STS_PLAY_NOT_BROW  = 0x12, /* Player not browsable */
-       BTRC_STS_PLAY_NOT_ADDR  = 0x13, /* Player not addressed */
-       BTRC_STS_INV_RESULTS    = 0x14, /* Invalid results */
-       BTRC_STS_NO_AVBL_PLAY   = 0x15, /* No available players */
-       BTRC_STS_ADDR_PLAY_CHGD = 0x16, /* Addressed player changed */
-} btrc_status_t;
-
-typedef struct {
-       uint16_t player_id;
-       uint16_t uid_counter;
-} btrc_addr_player_changed_t;
-
-typedef struct {
-       uint8_t num_attr;
-       uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
-       uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
-} btrc_player_settings_t;
-
-typedef struct {
-       uint8_t   val;
-       uint16_t  charset_id;
-       uint16_t  str_len;
-       uint8_t   *p_str;
-} btrc_player_app_ext_attr_val_t;
-
-typedef struct {
-       uint8_t   attr_id;
-       uint16_t  charset_id;
-       uint16_t  str_len;
-       uint8_t   *p_str;
-       uint8_t   num_val;
-       btrc_player_app_ext_attr_val_t ext_attr_val[BTRC_MAX_APP_ATTR_SIZE];
-} btrc_player_app_ext_attr_t;
-
-typedef struct {
-       uint8_t attr_id;
-       uint8_t num_val;
-       uint8_t attr_val[BTRC_MAX_APP_ATTR_SIZE];
-} btrc_player_app_attr_t;
-
-typedef struct {
-       uint32_t start_item;
-       uint32_t end_item;
-       uint32_t size;
-       uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
-       uint8_t  attr_count;
-} btrc_getfolderitem_t;
-
-typedef struct {
-       uint16_t type;
-       uint16_t uid_counter;
-} btrc_uids_changed_t;
-
-typedef struct {
-       uint16_t type;
-} btrc_now_playing_changed_t;
-
-typedef union {
-       btrc_play_status_t play_status;
-       btrc_uid_t track; /* queue position in NowPlaying */
-       uint32_t song_pos;
-       uint16_t uid_counter;
-       btrc_player_settings_t player_setting;
-       btrc_addr_player_changed_t addr_player_changed;
-       btrc_uids_changed_t uids_changed;
-       btrc_now_playing_changed_t now_playing_changed;
-} btrc_register_notification_t;
-
-typedef struct {
-       uint8_t id; /* can be attr_id or value_id */
-       uint8_t text[BTRC_MAX_ATTR_STR_LEN];
-} btrc_player_setting_text_t;
-
-typedef struct {
-       uint32_t attr_id;
-       uint8_t text[BTRC_MAX_ATTR_STR_LEN];
-} btrc_element_attr_val_t;
-
-typedef struct {
-       uint16_t  player_id;
-       uint8_t   major_type;
-       uint32_t  sub_type;
-       uint8_t   play_status;
-       uint8_t   features[BTRC_FEATURE_BIT_MASK_SIZE];
-       uint16_t  charset_id;
-       uint8_t   name[BTRC_MAX_ATTR_STR_LEN];
-} btrc_item_player_t;
-
-typedef struct {
-       uint8_t   uid[BTRC_UID_SIZE];
-       uint8_t   type;
-       uint8_t   playable;
-       uint16_t  charset_id;
-       uint8_t   name[BTRC_MAX_ATTR_STR_LEN];
-} btrc_item_folder_t;
-
-typedef struct {
-       uint8_t  uid[BTRC_UID_SIZE];
-       uint8_t  type;
-       uint16_t charset_id;
-       uint8_t  name[BTRC_MAX_ATTR_STR_LEN];
-       int      num_attrs;
-       btrc_element_attr_val_t* p_attrs;
-} btrc_item_media_t;
-
-typedef struct {
-       uint8_t item_type;
-       union {
-               btrc_item_player_t player;
-               btrc_item_folder_t folder;
-               btrc_item_media_t  media;
-       };
-} btrc_folder_items_t;
-
-typedef struct {
-       uint16_t  str_len;
-       uint8_t   p_str[BTRC_MAX_ATTR_STR_LEN];
-} btrc_br_folder_name_t;
-
-#ifdef TIZEN_BT_HAL
-/** Callback for the target connection state */
-typedef void (*btrc_tg_connection_state_callback) (bt_bdaddr_t *bd_addr, btrc_connection_state_t state);
-#endif
-
-/** Callback for the controller's supported feautres */
-typedef void (*btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
-               btrc_remote_features_t features);
-
-/** Callback for play status request */
-typedef void (*btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for list player application attributes (Shuffle, Repeat,...) */
-typedef void (*btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
-
-/** Callback for list player application attributes (Shuffle, Repeat,...) */
-typedef void (*btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
-               bt_bdaddr_t *bd_addr);
-
-/** Callback for getting the current player application settings value
- **  num_attr: specifies the number of attribute ids contained in p_attrs
- */
-typedef void (*btrc_get_player_app_value_callback) (uint8_t num_attr,
-               btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
-
-/** Callback for getting the player application settings attributes' text
- **  num_attr: specifies the number of attribute ids contained in p_attrs
- */
-typedef void (*btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
-               btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
-
-/** Callback for getting the player application settings values' text
- **  num_attr: specifies the number of value ids contained in p_vals
- */
-typedef void (*btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val,
-               uint8_t *p_vals, bt_bdaddr_t *bd_addr);
-
-/** Callback for setting the player application settings values */
-typedef void (*btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
-               bt_bdaddr_t *bd_addr);
-
-/** Callback to fetch the get element attributes of the current song
- **  num_attr: specifies the number of attributes requested in p_attrs
- */
-typedef void (*btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
-               bt_bdaddr_t *bd_addr);
-
-/** Callback for register notification (Play state change/track change/...)
- **  param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
- */
-typedef void (*btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
-               bt_bdaddr_t *bd_addr);
-
-/* AVRCP 1.4 Enhancements */
-/** Callback for volume change on CT
- **  volume: Current volume setting on the CT (0-127)
- */
-typedef void (*btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
-
-/** Callback for delay change **/
-typedef void (*btrc_delay_change_callback) (uint16_t delay, bt_bdaddr_t *bd_addr);
-
-/** Callback for passthrough commands */
-typedef void (*btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
-
-/** Callback for set addressed player response on TG **/
-typedef void (*btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
-
-/** Callback for set browsed player response on TG **/
-typedef void (*btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
-
-/** Callback for get folder items on TG
- **  num_attr: specifies the number of attributes requested in p_attr_ids
- */
-typedef void (*btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
-               uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
-
-/** Callback for changing browsed path on TG **/
-typedef void (*btrc_change_path_callback) (uint8_t direction,
-               uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
-
-/** Callback to fetch the get item attributes of the media item
- **  num_attr: specifies the number of attributes requested in p_attrs
- */
-typedef void (*btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
-               uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
-
-/** Callback for play request for the media item indicated by an identifier */
-typedef void (*btrc_play_item_callback) (uint8_t scope,
-               uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
-
-/** Callback to fetch total number of items from a folder **/
-typedef void (*btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
-
-/** Callback for conducting recursive search on a current browsed path for a specified string */
-typedef void (*btrc_search_callback) (uint16_t charset_id,
-               uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
-
-/** Callback to add a specified media item indicated by an identifier to now playing queue. */
-typedef void (*btrc_add_to_now_playing_callback) (uint8_t scope,
-               uint8_t* uid, uint16_t  uid_counter, bt_bdaddr_t *bd_addr);
-
-/** BT-RC Target callback structure. */
-typedef struct {
-       /** set to sizeof(BtRcCallbacks) */
-       size_t      size;
-#ifdef TIZEN_BT_HAL
-       btrc_tg_connection_state_callback               connection_state_cb;
-#endif
-       btrc_remote_features_callback               remote_features_cb;
-       btrc_get_play_status_callback               get_play_status_cb;
-       btrc_list_player_app_attr_callback          list_player_app_attr_cb;
-       btrc_list_player_app_values_callback        list_player_app_values_cb;
-       btrc_get_player_app_value_callback          get_player_app_value_cb;
-       btrc_get_player_app_attrs_text_callback     get_player_app_attrs_text_cb;
-       btrc_get_player_app_values_text_callback    get_player_app_values_text_cb;
-       btrc_set_player_app_value_callback          set_player_app_value_cb;
-       btrc_get_element_attr_callback              get_element_attr_cb;
-       btrc_register_notification_callback         register_notification_cb;
-       btrc_volume_change_callback                 volume_change_cb;
-       btrc_delay_change_callback                  delay_change_cb;
-       btrc_passthrough_cmd_callback               passthrough_cmd_cb;
-       btrc_set_addressed_player_callback          set_addressed_player_cb;
-       btrc_set_browsed_player_callback            set_browsed_player_cb;
-       btrc_get_folder_items_callback              get_folder_items_cb;
-       btrc_change_path_callback                   change_path_cb;
-       btrc_get_item_attr_callback                 get_item_attr_cb;
-       btrc_play_item_callback                     play_item_cb;
-       btrc_get_total_num_of_items_callback        get_total_num_of_items_cb;
-       btrc_search_callback                        search_cb;
-       btrc_add_to_now_playing_callback            add_to_now_playing_cb;
-} btrc_callbacks_t;
-
-/** Represents the standard BT-RC AVRCP Target interface. */
-typedef struct {
-
-       /** set to sizeof(BtRcInterface) */
-       size_t          size;
-       /**
-        * Register the BtRc callbacks
-        */
-       bt_status_t (*init)(btrc_callbacks_t* callbacks);
-
-#ifdef TIZEN_BT_HAL
-       /** connect to AVRCP controller device */
-       bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
-
-       /** dis-connect from AVRCP controller device */
-       bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
-#endif
-
-       /** Respose to GetPlayStatus request. Contains the current
-        **  1. Play status
-        **  2. Song duration/length
-        **  3. Song position
-        */
-       bt_status_t (*get_play_status_rsp)(bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
-                       uint32_t song_len, uint32_t song_pos);
-
-       /** Lists the support player application attributes (Shuffle/Repeat/...)
-        **  num_attr: Specifies the number of attributes contained in the pointer p_attrs
-        */
-       bt_status_t (*list_player_app_attr_rsp)(bt_bdaddr_t *bd_addr, int num_attr,
-                       btrc_player_attr_t *p_attrs);
-
-       /** Lists the support player application attributes (Shuffle Off/On/Group)
-        **  num_val: Specifies the number of values contained in the pointer p_vals
-        */
-       bt_status_t (*list_player_app_value_rsp)(bt_bdaddr_t *bd_addr, int num_val, uint8_t *p_vals);
-
-       /** Returns the current application attribute values for each of the specified attr_id */
-       bt_status_t (*get_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
-
-       /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
-        **  num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
-        */
-       bt_status_t (*get_player_app_attr_text_rsp)(bt_bdaddr_t *bd_addr, int num_attr,
-                       btrc_player_setting_text_t *p_attrs);
-
-       /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
-        **  num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
-        */
-       bt_status_t (*get_player_app_value_text_rsp)(bt_bdaddr_t *bd_addr, int num_val,
-                       btrc_player_setting_text_t *p_vals);
-
-       /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
-        **  num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
-        */
-       bt_status_t (*get_element_attr_rsp)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
-                       btrc_element_attr_val_t *p_attrs);
-
-       /** Response to set player attribute request ("Shuffle"/"Repeat")
-        **  rsp_status: Status of setting the player attributes for the current media player
-        */
-       bt_status_t (*set_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
-       /* Response to the register notification request (Play state change/track change/...).
-        ** event_id: Refers to the event_id this notification change corresponds too
-        ** type: Response type - interim/changed
-        ** p_params: Based on the event_id, this parameter should be populated
-        */
-       bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
-                       btrc_notification_type_t type,
-                       btrc_register_notification_t *p_param);
-
-       /* AVRCP 1.4 enhancements */
-
-       /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
-        ** This can be enhanced to support Relative Volume (AVRCP 1.0).
-        ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
-        ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
-        */
-       bt_status_t (*set_volume)(uint8_t volume);
-
-       /* Set addressed player response from TG to CT */
-       bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
-       /* Set browsed player response from TG to CT */
-       bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
-                       uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
-                       btrc_br_folder_name_t *p_folders);
-
-       /* Get folder item list response from TG to CT */
-       bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
-                       uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
-
-       /* Change path response from TG to CT */
-       bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
-                       uint32_t num_items);
-
-       /** Returns the element's attributes num_attr: Specifies the number of attributes' text
-        * contained in the pointer p_attrs
-        */
-       bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
-                       uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
-
-       /* play media item response from TG to CT */
-       bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
-       /* get total number of items response from TG to CT*/
-       bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
-                       uint32_t uid_counter, uint32_t num_items);
-
-       /* Search VFS response from TG to CT */
-       bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
-                       uint32_t num_items);
-
-       /* add_to_now playing list response from TG to CT */
-       bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
-       /** Closes the interface. */
-       void  (*cleanup)(void);
-} btrc_interface_t;
-
-typedef void (*btrc_passthrough_rsp_callback) (bt_bdaddr_t *bd_addr, int id, int key_state);
-
-typedef void (*btrc_groupnavigation_rsp_callback) (int id, int key_state);
-
-typedef void (*btrc_connection_state_callback) (
-               bool rc_connect, bool bt_connect, bt_bdaddr_t *bd_addr);
-
-typedef void (*btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
-
-typedef void (*btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
-
-typedef void (*btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
-
-typedef void (*btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
-               uint8_t accepted);
-
-typedef void (*btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
-               uint8_t num_attr,
-               btrc_player_app_attr_t *app_attrs,
-               uint8_t num_ext_attr,
-               btrc_player_app_ext_attr_t *ext_attrs);
-
-typedef void (*btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
-               btrc_player_settings_t *p_vals);
-
-typedef void (*btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
-               btrc_element_attr_val_t *p_attrs);
-
-typedef void (*btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
-               uint32_t song_len, uint32_t song_pos);
-
-typedef void (*btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
-               btrc_play_status_t play_status);
-
-typedef void (*btrc_ctrl_get_folder_items_callback)(bt_bdaddr_t *bd_addr,
-               btrc_status_t status,
-               const btrc_folder_items_t *folder_items,
-               uint8_t count);
-
-typedef void (*btrc_ctrl_change_path_callback)(bt_bdaddr_t *bd_addr, uint8_t count);
-
-typedef void (*btrc_ctrl_set_browsed_player_callback)(
-               bt_bdaddr_t *bd_addr, uint8_t num_items, uint8_t depth);
-typedef void (*btrc_ctrl_set_addressed_player_callback)(bt_bdaddr_t *bd_addr, uint8_t status);
-/** BT-RC Controller callback structure. */
-typedef struct {
-       /** set to sizeof(BtRcCallbacks) */
-       size_t      size;
-       btrc_passthrough_rsp_callback                               passthrough_rsp_cb;
-       btrc_groupnavigation_rsp_callback                           groupnavigation_rsp_cb;
-       btrc_connection_state_callback                              connection_state_cb;
-       btrc_ctrl_getrcfeatures_callback                            getrcfeatures_cb;
-       btrc_ctrl_setplayerapplicationsetting_rsp_callback          setplayerappsetting_rsp_cb;
-       btrc_ctrl_playerapplicationsetting_callback                 playerapplicationsetting_cb;
-       btrc_ctrl_playerapplicationsetting_changed_callback         playerapplicationsetting_changed_cb;
-       btrc_ctrl_setabsvol_cmd_callback                            setabsvol_cmd_cb;
-       btrc_ctrl_registernotification_abs_vol_callback             registernotification_absvol_cb;
-       btrc_ctrl_track_changed_callback                            track_changed_cb;
-       btrc_ctrl_play_position_changed_callback                    play_position_changed_cb;
-       btrc_ctrl_play_status_changed_callback                      play_status_changed_cb;
-       btrc_ctrl_get_folder_items_callback                         get_folder_items_cb;
-       btrc_ctrl_change_path_callback                              change_folder_path_cb;
-       btrc_ctrl_set_browsed_player_callback                       set_browsed_player_cb;
-       btrc_ctrl_set_addressed_player_callback                     set_addressed_player_cb;
-} btrc_ctrl_callbacks_t;
-
-/** Represents the standard BT-RC AVRCP Controller interface. */
-typedef struct {
-
-       /** set to sizeof(BtRcInterface) */
-       size_t          size;
-       /**
-        * Register the BtRc callbacks
-        */
-       bt_status_t (*init)(btrc_ctrl_callbacks_t* callbacks);
-#ifdef TIZEN_BT_HAL
-       /** connect to headset */
-       bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
-
-       /** dis-connect from headset */
-       bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
-#endif
-       /** send pass through command to target */
-       bt_status_t (*send_pass_through_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
-                       uint8_t key_state);
-       /** send group navigation command to target */
-       bt_status_t (*send_group_navigation_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
-                       uint8_t key_state);
-
-       /** send command to set player applicaiton setting attributes to target */
-       bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
-                       uint8_t* attrib_ids, uint8_t* attrib_vals);
-
-       /** send command to set delay, volume to target */
-       bt_status_t (*set_transport_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
-                       int* attrib_ids, uint32_t* attrib_vals);
-
-       /** send command to play a particular item */
-       bt_status_t (*play_item_cmd) (
-                       bt_bdaddr_t *bd_addr, uint8_t scope, uint8_t *uid, uint16_t uid_counter);
-
-       /** get the playback state */
-       bt_status_t (*get_playback_state_cmd) (bt_bdaddr_t *bd_addr);
-
-       /** get the now playing list */
-       bt_status_t (*get_now_playing_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
-
-       /** get the folder list */
-       bt_status_t (*get_folder_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
-
-       /** get the folder list */
-       bt_status_t (*get_player_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
-
-       /** get the folder list */
-       bt_status_t (*change_folder_path_cmd) (bt_bdaddr_t *bd_addr, uint8_t direction, uint8_t * uid);
-
-       /** set browsed player */
-       bt_status_t (*set_browsed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
-
-       /** set addressed player */
-       bt_status_t (*set_addressed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
-
-       /** send rsp to set_abs_vol received from target */
-       bt_status_t (*set_volume_rsp) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
-
-       /** send notificaiton rsp for abs vol to target */
-       bt_status_t (*register_abs_vol_rsp) (bt_bdaddr_t *bd_addr, btrc_notification_type_t rsp_type,
-                       uint8_t abs_vol, uint8_t label);
-
-       /** Closes the interface. */
-       void  (*cleanup)(void);
-} btrc_ctrl_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_RC_H */
diff --git a/hardware/bt_sock.h b/hardware/bt_sock.h
deleted file mode 100644 (file)
index 45b2356..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_BT_SOCK_H
-#define ANDROID_INCLUDE_BT_SOCK_H
-
-__BEGIN_DECLS
-
-#define BTSOCK_FLAG_ENCRYPT 1
-#define BTSOCK_FLAG_AUTH (1 << 1)
-
-typedef enum {
-       BTSOCK_RFCOMM = 1,
-       BTSOCK_SCO = 2,
-       BTSOCK_L2CAP = 3
-} btsock_type_t;
-
-/** Represents the standard BT SOCKET interface. */
-typedef struct {
-       short size;
-       bt_bdaddr_t bd_addr;
-       int channel;
-       int status;
-} __attribute__((packed)) sock_connect_signal_t;
-
-typedef struct {
-
-       /** set to size of this struct*/
-       size_t          size;
-       /**
-        * listen to a rfcomm uuid or channel. It returns the socket fd from which
-        * btsock_connect_signal can be read out when a remote device connected
-        */
-       bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags);
-       /*
-        * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which
-        * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected
-        */
-       bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags);
-
-} btsock_interface_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_BT_SOCK_H */
diff --git a/hardware/hardware.c b/hardware/hardware.c
deleted file mode 100644 (file)
index 230f19a..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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 <hardware/hardware.h>
-
-#include <dlfcn.h>
-#include <string.h>
-#include <pthread.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-
-#define LOG_TAG "HAL"
-
-#define LOG_INFO " I"
-#define LOG_WARN " W"
-#define LOG_ERROR " E"
-#define LOG_DEBUG " D"
-#define ALOG(pri, tag, fmt, arg...) fprintf(stderr, tag pri": " fmt"\n", ##arg)
-
-#define info(fmt, arg...) ALOG(LOG_INFO, LOG_TAG, fmt, ##arg)
-#define warn(fmt, arg...) ALOG(LOG_WARN, LOG_TAG, fmt, ##arg)
-#define error(fmt, arg...) ALOG(LOG_ERROR, LOG_TAG, fmt, ##arg)
-
-#ifdef ARCH64
-#define HAL_LIBRARY_PATH               "/usr/lib64"
-#else
-#define HAL_LIBRARY_PATH               "/usr/lib"
-#endif
-
-/**
- * Load the file defined by the variant and if successful
- * return the dlopen handle and the hmi.
- * @return 0 = success, !0 = failure.
- */
-static int load(const char *id,
-               const char *path,
-               const struct hw_module_t **pHmi)
-{
-       int status;
-       void *handle;
-       struct hw_module_t *hmi;
-       const char *sym = HAL_MODULE_INFO_SYM_AS_STR;
-
-       /*
-        * load the symbols resolving undefined symbols before
-        * dlopen returns. Since RTLD_GLOBAL is not or'd in with
-        * RTLD_NOW the external symbols will not be global
-        */
-       handle = dlopen(path, RTLD_NOW);
-       if (handle == NULL) {
-               char const *err_str = dlerror();
-               error("load: module=%s\n%s", path, err_str ? err_str : "unknown");
-               status = -EINVAL;
-               goto done;
-       }
-
-       /* Get the address of the struct hal_module_info. */
-       hmi = (struct hw_module_t *)dlsym(handle, sym);
-       if (hmi == NULL) {
-               error("load: couldn't find symbol %s", sym);
-               status = -EINVAL;
-               goto done;
-       }
-
-       /* Check that the id matches */
-       if (strcmp(id, hmi->id) != 0) {
-               error("load: id=%s != hmi->id=%s", id, hmi->id);
-               status = -EINVAL;
-               goto done;
-       }
-
-       hmi->dso = handle;
-
-       *pHmi = hmi;
-
-       info("loaded HAL id=%s path=%s hmi=%p handle=%p",
-                       id, path, *pHmi, handle);
-
-       return 0;
-
-done:
-       hmi = NULL;
-       if (handle != NULL) {
-               dlclose(handle);
-               handle = NULL;
-       }
-
-       return status;
-}
-
-int hw_get_module_by_class(const char *class_id, const char *inst,
-               const struct hw_module_t **module)
-{
-       char path[PATH_MAX];
-       char name[PATH_MAX];
-
-       if (inst)
-               snprintf(name, PATH_MAX, "%s.%s", class_id, inst);
-       else
-               snprintf(name, PATH_MAX, "%s", class_id);
-
-       /*
-        * Here we rely on the fact that calling dlopen multiple times on
-        * the same .so will simply increment a refcount (and not load
-        * a new copy of the library).
-        * We also assume that dlopen() is thread-safe.
-        */
-       snprintf(path, sizeof(path), "%s/%s.default.so", HAL_LIBRARY_PATH, name);
-
-       return load(class_id, path, module);
-}
-
-int hw_get_module(const char *id, const struct hw_module_t **module)
-{
-       return hw_get_module_by_class(id, NULL, module);
-}
diff --git a/hardware/hardware.h b/hardware/hardware.h
deleted file mode 100644 (file)
index 3a3032a..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * 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 ANDROID_INCLUDE_HARDWARE_HARDWARE_H
-#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-/*
- * Value for the hw_module_t.tag field
- */
-
-#define MAKE_TAG_CONSTANT(A, B, C, D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
-
-#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
-#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
-
-#define HARDWARE_MAKE_API_VERSION(maj, min) \
-       ((((maj) & 0xff) << 8) | ((min) & 0xff))
-
-#define HARDWARE_MAKE_API_VERSION_2(maj, min, hdr) \
-       ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))
-#define HARDWARE_API_VERSION_2_MAJ_MIN_MASK 0xffff0000
-#define HARDWARE_API_VERSION_2_HEADER_MASK  0x0000ffff
-
-
-/*
- * The current HAL API version.
- *
- * All module implementations must set the hw_module_t.hal_api_version field
- * to this value when declaring the module with HAL_MODULE_INFO_SYM.
- *
- * Note that previous implementations have always set this field to 0.
- * Therefore, libhardware HAL API will always consider versions 0.0 and 1.0
- * to be 100% binary compatible.
- *
- */
-#define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0)
-
-/*
- * Helper macros for module implementors.
- *
- * The derived modules should provide convenience macros for supported
- * versions so that implementations can explicitly specify module/device
- * versions at definition time.
- *
- * Use this macro to set the hw_module_t.module_api_version field.
- */
-#define HARDWARE_MODULE_API_VERSION(maj, min) HARDWARE_MAKE_API_VERSION(maj, min)
-#define HARDWARE_MODULE_API_VERSION_2(maj, min, hdr) HARDWARE_MAKE_API_VERSION_2(maj, min, hdr)
-
-/*
- * Use this macro to set the hw_device_t.version field
- */
-#define HARDWARE_DEVICE_API_VERSION(maj, min) HARDWARE_MAKE_API_VERSION(maj, min)
-#define HARDWARE_DEVICE_API_VERSION_2(maj, min, hdr) HARDWARE_MAKE_API_VERSION_2(maj, min, hdr)
-
-struct hw_module_t;
-struct hw_module_methods_t;
-struct hw_device_t;
-
-/**
- * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
- * and the fields of this data structure must begin with hw_module_t
- * followed by module specific information.
- */
-typedef struct hw_module_t {
-       /** tag must be initialized to HARDWARE_MODULE_TAG */
-       uint32_t tag;
-
-       /**
-        * The API version of the implemented module. The module owner is
-        * responsible for updating the version when a module interface has
-        * changed.
-        *
-        * The derived modules such as gralloc and audio own and manage this field.
-        * The module user must interpret the version field to decide whether or
-        * not to inter-operate with the supplied module implementation.
-        * For example, SurfaceFlinger is responsible for making sure that
-        * it knows how to manage different versions of the gralloc-module API,
-        * and AudioFlinger must know how to do the same for audio-module API.
-        *
-        * The module API version should include a major and a minor component.
-        * For example, version 1.0 could be represented as 0x0100. This format
-        * implies that versions 0x0100-0x01ff are all API-compatible.
-        *
-        * In the future, libhardware will expose a hw_get_module_version()
-        * (or equivalent) function that will take minimum/maximum supported
-        * versions as arguments and would be able to reject modules with
-        * versions outside of the supplied range.
-        */
-       uint16_t module_api_version;
-#define version_major module_api_version
-       /**
-        * version_major/version_minor defines are supplied here for temporary
-        * source code compatibility. They will be removed in the next version.
-        * ALL clients must convert to the new version format.
-        */
-
-       /**
-        * The API version of the HAL module interface. This is meant to
-        * version the hw_module_t, hw_module_methods_t, and hw_device_t
-        * structures and definitions.
-        *
-        * The HAL interface owns this field. Module users/implementations
-        * must NOT rely on this value for version information.
-        *
-        * Presently, 0 is the only valid value.
-        */
-       uint16_t hal_api_version;
-#define version_minor hal_api_version
-
-       /** Identifier of module */
-       const char *id;
-
-       /** Name of this module */
-       const char *name;
-
-       /** Author/owner/implementor of the module */
-       const char *author;
-
-       /** Modules methods */
-       struct hw_module_methods_t* methods;
-
-       /** module's dso */
-       void* dso;
-
-       /** padding to 128 bytes, reserved for future use */
-       uint32_t reserved[32-7];
-
-} hw_module_t;
-
-typedef struct hw_module_methods_t {
-       /** Open a specific device */
-       int (*open)(const struct hw_module_t* module, const char* id,
-                       struct hw_device_t** device);
-
-} hw_module_methods_t;
-
-/**
- * Every device data structure must begin with hw_device_t
- * followed by module specific public methods and attributes.
- */
-typedef struct hw_device_t {
-       /** tag must be initialized to HARDWARE_DEVICE_TAG */
-       uint32_t tag;
-
-       /**
-        * Version of the module-specific device API. This value is used by
-        * the derived-module user to manage different device implementations.
-        *
-        * The module user is responsible for checking the module_api_version
-        * and device version fields to ensure that the user is capable of
-        * communicating with the specific module implementation.
-        *
-        * One module can support multiple devices with different versions. This
-        * can be useful when a device interface changes in an incompatible way
-        * but it is still necessary to support older implementations at the same
-        * time. One such example is the Camera 2.0 API.
-        *
-        * This field is interpreted by the module user and is ignored by the
-        * HAL interface itself.
-        */
-       uint32_t version;
-
-       /** reference to the module this device belongs to */
-       struct hw_module_t* module;
-
-       /** padding reserved for future use */
-       uint32_t reserved[12];
-
-       /** Close this device */
-       int (*close)(struct hw_device_t* device);
-
-} hw_device_t;
-
-/**
- * Name of the hal_module_info
- */
-#define HAL_MODULE_INFO_SYM         HMI
-
-/**
- * Name of the hal_module_info as a string
- */
-#define HAL_MODULE_INFO_SYM_AS_STR  "HMI"
-
-/**
- * Get the module info associated with a module by id.
- *
- * @return: 0 == success, <0 == error and *module == NULL
- */
-int hw_get_module(const char *id, const struct hw_module_t **module);
-
-/**
- * Get the module info associated with a module instance by class 'class_id'
- * and instance 'inst'.
- *
- * Some modules types necessitate multiple instances. For example audio supports
- * multiple concurrent interfaces and thus 'audio' is the module class
- * and 'primary' or 'a2dp' are module interfaces. This implies that the files
- * providing these modules would be named audio.primary.<variant>.so and
- * audio.a2dp.<variant>.so
- *
- * @return: 0 == success, <0 == error and *module == NULL
- */
-int hw_get_module_by_class(const char *class_id, const char *inst,
-               const struct hw_module_t **module);
-
-__END_DECLS
-
-#endif  /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */
diff --git a/libraries/libbt-oal.so b/libraries/libbt-oal.so
new file mode 100755 (executable)
index 0000000..500942d
Binary files /dev/null and b/libraries/libbt-oal.so differ
diff --git a/oal-a2dp-sink.c b/oal-a2dp-sink.c
deleted file mode 100644 (file)
index 1a18369..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * Contact: Nilesh Trimbake <t.shripati@samsung.com>
- *
- * 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 <stdio.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dlog.h>
-
-#include <bluetooth.h>
-#include <bt_av.h>
-
-#include "oal-internal.h"
-#include "oal-a2dp-sink.h"
-#include "oal-utils.h"
-#include "oal-common.h"
-
-#define CHECK_OAL_SINK_ENABLED() \
-       do { \
-               if (blued_a2dp_sink_interface == NULL) { \
-                       BT_ERR("OAL, Audio Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-
-static void cb_a2dp_sink_connection_state(btav_connection_state_t event, bt_bdaddr_t* bd_addr);
-static void cb_a2dp_sink_audio_state(btav_audio_state_t state, bt_bdaddr_t* bd_addr);
-
-const bt_interface_t * _bt_get_stack_interface(void);
-static const btav_interface_t *blued_a2dp_sink_interface = NULL;
-
-static btav_callbacks_t blued_a2dp_sink_cb = {
-       sizeof(blued_a2dp_sink_cb),
-       cb_a2dp_sink_connection_state,
-       cb_a2dp_sink_audio_state
-};
-
-oal_status_t a2dp_sink_enable(char *service_name , char *provider_name)
-{
-       const bt_interface_t* blued_inf;
-       int ret;
-
-       API_TRACE("Audio Sink Enable");
-
-       if ((blued_inf = adapter_get_stack_interface()) == NULL) {
-               BT_ERR("Bluetooth module is not loaded");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (blued_a2dp_sink_interface != NULL) {
-               BT_WARN("A2DP Sink Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       if ((blued_a2dp_sink_interface = (const btav_interface_t *)blued_inf->get_profile_interface(BT_PROFILE_ADVANCED_AUDIO_SINK_ID)) == NULL) {
-               BT_ERR("OAL, Failed to get Bluetooth A2DP Sink Interface");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       BT_DBG("Got profile interface");
-       if ((ret = blued_a2dp_sink_interface->init(&blued_a2dp_sink_cb)) != BT_STATUS_SUCCESS) {
-               BT_ERR("Failed to initialize Bluetooth A2DP, status: %s", status2string(ret));
-               blued_a2dp_sink_interface = NULL;
-               return convert_to_oal_status(ret);
-       }
-       BT_DBG("OAL, Bluetooth audio interface initialised");
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/* Audio deinit: Resets all the audio information
- * Note: Adapter should be disabled before calling deinit
- * */
-oal_status_t a2dp_sink_disable(void)
-{
-
-       API_TRACE("Audio Sink Disable");
-
-       CHECK_OAL_SINK_ENABLED();
-
-       blued_a2dp_sink_interface->cleanup();
-       blued_a2dp_sink_interface = NULL;
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t a2dp_sink_connect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_SINK_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       /* Call connect function of Bluedroid*/
-       status = blued_a2dp_sink_interface->connect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("Connection could not be established, err: %s", status2string(status));;
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-
-oal_status_t a2dp_sink_disconnect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       bt_status_t status;
-
-       API_TRACE();
-
-       CHECK_OAL_SINK_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       /* call Disconnect function of Bluedroid */
-       status = blued_a2dp_sink_interface->disconnect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("OAL, Disconnection failed err: %s", status2string(status));
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-static void cb_a2dp_sink_connection_state(btav_connection_state_t state, bt_bdaddr_t* bd_addr)
-{
-       bt_address_t * event_data = NULL;
-       bdstr_t bdstr;
-       oal_event_t event;
-
-       ret_if(bd_addr == NULL);
-       BT_INFO("state = %d,  BT Address = %s", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-
-       event_data = g_new0(bt_address_t, 1);
-       memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       switch (state) {
-               case BTAV_CONNECTION_STATE_CONNECTING: {
-                       event = OAL_EVENT_A2DP_SINK_CONNECTING;
-                       break;
-               }
-               case BTAV_CONNECTION_STATE_CONNECTED: {
-                       event = OAL_EVENT_A2DP_SINK_CONNECTED;
-                       break;
-               }
-               case BTAV_CONNECTION_STATE_DISCONNECTING: {
-                       event = OAL_EVENT_A2DP_SINK_DISCONNECTING;
-                       break;
-               }
-               case BTAV_CONNECTION_STATE_DISCONNECTED: {
-                       event = OAL_EVENT_A2DP_SINK_DISCONNECTED;
-                       break;
-               }
-               default: {
-                       BT_INFO("Invalid state");
-                       g_free(event_data);
-                       event_data = NULL;
-                       return;
-               }
-       }
-       send_event_bda_trace(event, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-}
-
-static void cb_a2dp_sink_audio_state(btav_audio_state_t state, bt_bdaddr_t* bd_addr)
-{
-       bdstr_t bdstr;
-
-       ret_if(bd_addr == NULL);
-       BT_INFO("A2DP state = %d,  BT Address = %s", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-
-       //stream_state = state; //removed by Moon
-
-       if (state == BTAV_AUDIO_STATE_REMOTE_SUSPEND) {
-               BT_INFO("Audio Streaming Suspended");
-       } else if (state == BTAV_AUDIO_STATE_STOPPED) {
-               BT_INFO("###Audio Streaming Stopped");
-               bt_address_t * event_data = g_new0(bt_address_t, 1);
-
-               memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-               send_event_bda_trace(OAL_EVENT_AUDIO_STOPPED, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-       } else if (state == BTAV_AUDIO_STATE_STARTED) {
-               BT_INFO("###Audio Streaming Startted");
-               bt_address_t * event_data = g_new0(bt_address_t, 1);
-
-               memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-               send_event_bda_trace(OAL_EVENT_AUDIO_STARTED, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-       } else {
-               BT_ERR("Unknown state received:%d", (int)state);
-       }
-}
diff --git a/oal-adapter-mgr.c b/oal-adapter-mgr.c
deleted file mode 100644 (file)
index ad865b7..0000000
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <dlog.h>
-#include <string.h>
-#include <vconf.h>
-#include <sys/wait.h>
-
-#include <bluetooth.h>
-
-#include "oal-event.h"
-#include "oal-internal.h"
-#include "oal-manager.h"
-#include "oal-hardware.h"
-#include "oal-common.h"
-#include "oal-utils.h"
-#include "oal-gatt.h"
-
-#define CHECK_MAX(max, x) (((max) > (x)) ? (x) : (max))
-
-static const bt_interface_t * blued_api;
-
-static bt_address_t local_address;
-static char local_name[BT_DEVICE_NAME_LENGTH_MAX + 1] = {'O', 'A', 'L', 0};
-static char local_version[BT_VERSION_STR_LEN_MAX + 1];
-static bt_scan_mode_t scan_mode = BT_SCAN_MODE_NONE;
-static int discoverable_timeout = 0;
-
-/* Forward declarations */
-oal_status_t convert_to_oal_status(bt_status_t status);
-static gboolean retry_enable_adapter(gpointer data);
-#ifdef TIZEN_BT_HAL
-static gboolean retry_enable_le(gpointer data);
-#endif
-oal_status_t oal_mgr_init_internal(void);
-
-
-/* Callback registered with Stack */
-static void cb_adapter_state_change(bt_state_t status);
-static void cb_adapter_discovery_state_changed(bt_discovery_state_t state);
-static void cb_adapter_device_found(int num_properties, bt_property_t *properties);
-static void cb_adapter_properties(bt_status_t status,
-               int num_properties, bt_property_t *properties);
-extern void cb_device_properties(bt_status_t status, bt_bdaddr_t *bd_addr,
-               int num_properties, bt_property_t *properties);
-extern void cb_device_bond_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
-               bt_bond_state_t state);
-extern void cb_device_acl_state_changed(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
-               bt_acl_state_t state);
-extern void cb_device_pin_request(bt_bdaddr_t *bd_addr, bt_bdname_t *bdname, uint32_t device_class);
-extern void cb_device_ssp_request(bt_bdaddr_t *bd_addr, bt_bdname_t *bdname, uint32_t device_class,
-                       bt_ssp_variant_t pairing_variant, uint32_t pass_key);
-extern void cb_device_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
-extern void cb_device_trust_state_changed(bt_bdaddr_t *remote_bd_addr, bt_device_trust_state_t trusted);
-#ifdef TIZEN_BT_HAL
-extern void cb_socket_conn_authorize_request(bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
-static void cb_ble_state_change(bt_state_t status);
-extern void cb_device_le_conn_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
-               bt_le_conn_state_t state);
-extern void cb_device_trusted_profiles_changed(bt_bdaddr_t *bd_addr, uint32_t trust_val);
-extern void cb_rssi_monitor_state_changed(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state);
-extern void cb_rssi_alert(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
-extern void cb_raw_rssi_received(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
-#endif
-
-static bt_callbacks_t callbacks = {
-       sizeof(callbacks),
-       cb_adapter_state_change,
-       cb_adapter_properties,
-       cb_device_properties,
-       cb_adapter_device_found,
-       cb_adapter_discovery_state_changed,
-       cb_device_pin_request,
-       cb_device_ssp_request,
-       cb_device_bond_state_changed,
-       cb_device_acl_state_changed,
-       NULL, /* callback_thread_event */
-       NULL, /* dut_mode_recv_callback */
-       NULL, /* le_test_mode_callback*/
-       NULL, /* energy_info_callback */
-       cb_device_authorize_request,
-       cb_device_trust_state_changed,
-#ifdef TIZEN_BT_HAL
-       cb_socket_conn_authorize_request,
-       cb_ble_state_change,
-       cb_device_le_conn_state_changed,
-       cb_device_trusted_profiles_changed,
-       cb_rssi_monitor_state_changed,
-       cb_rssi_alert,
-       cb_raw_rssi_received,
-#endif
-};
-
-oal_status_t adapter_mgr_init(const bt_interface_t * stack_if)
-{
-       int ret;
-       blued_api = stack_if;
-
-       ret = blued_api->init(&callbacks);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Adapter callback registration failed: [%s]", status2string(ret));
-               blued_api->cleanup();
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-const bt_interface_t* adapter_get_stack_interface(void)
-{
-       return blued_api;
-}
-
-void adapter_mgr_cleanup(void)
-{
-       /* Nothing to clean yet , do not set blued_api NULL as it will be used to clean Bluedroid states */
-       BT_DBG();
-}
-
-oal_status_t adapter_enable(void)
-{
-       int ret = BT_STATUS_SUCCESS;
-
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-       if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
-               g_timeout_add(200, retry_enable_adapter, NULL);
-               return OAL_STATUS_PENDING;
-       }
-
-       ret = blued_api->enable();
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Enable failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_disable(void)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-
-       ret = blued_api->disable();
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Disable failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t le_enable(void)
-{
-       int ret = BT_STATUS_SUCCESS;
-
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-
-#ifdef TIZEN_BT_HAL
-       if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
-               g_timeout_add(200, retry_enable_le, NULL);
-               return OAL_STATUS_PENDING;
-       }
-
-       ret = blued_api->le_enable();
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Enable failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-
-       return ret;
-}
-
-oal_status_t le_disable(void)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-
-#ifdef TIZEN_BT_HAL
-       ret = blued_api->le_disable();
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Disable failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-
-oal_status_t le_init(void)
-{
-       int ret = BT_STATUS_SUCCESS;
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-#ifdef TIZEN_BT_HAL
-       if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
-               g_timeout_add(200, retry_enable_le, NULL);
-               return OAL_STATUS_PENDING;
-       }
-       ret = blued_api->le_init();
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Enable failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-oal_status_t le_deinit(void)
-{
-       int ret = BT_STATUS_SUCCESS;
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-#ifdef TIZEN_BT_HAL
-       if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
-               g_timeout_add(200, retry_enable_le, NULL);
-               return OAL_STATUS_PENDING;
-       }
-       blued_api->le_deinit();
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-oal_status_t is_advertising(void)
-{
-       int ret = BT_STATUS_SUCCESS;
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-#ifdef TIZEN_BT_HAL
-       if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
-               g_timeout_add(200, retry_enable_le, NULL);
-               return OAL_STATUS_PENDING;
-       }
-       int r = blued_api->is_advertising();
-       if (r == TRUE)
-               ret = BT_STATUS_SUCCESS;
-       else
-               ret = BT_STATUS_FAIL;
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-oal_status_t adapter_start_custom_inquiry(discovery_type_t disc_type)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-       BT_INFO("Custom Discovery Type [0x%x]", disc_type);
-
-#ifdef TIZEN_BT_HAL
-       ret = blued_api->start_custom_discovery(disc_type);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("start_custom_discovery failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-
-oal_status_t adapter_get_powered_status(gboolean *status)
-{
-       int ret;
-       unsigned char powered = 0;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(status, return);
-       BT_INFO("Get Adapter Powered status");
-
-#ifdef TIZEN_BT_HAL
-       ret = blued_api->get_adapter_powered_status(&powered);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("adapter_get_powered_status failed: [%s]", status2string(ret));
-               *status = FALSE;
-               return convert_to_oal_status(ret);
-       }
-       if (powered == 1)
-               *status = TRUE;
-       else
-               *status = FALSE;
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-
-oal_status_t adapter_reset(void)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-       BT_INFO("Adapter Reset");
-
-#ifdef TIZEN_BT_HAL
-       ret = blued_api->reset();
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Adapter Reset failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#else
-       BT_INFO("Not Supported");
-       ret = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return ret;
-}
-
-oal_status_t adapter_start_inquiry(unsigned short duration)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-
-       ret = blued_api->start_discovery();
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("start_discovery failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_stop_inquiry(void)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_INITIALIZED();
-
-       ret = blued_api->cancel_discovery();
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("cancel_discovery failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/* Callbacks from Stack */
-static void cb_adapter_state_change(bt_state_t status)
-{
-       BT_DBG("+");
-       oal_event_t event;
-
-       event = (BT_STATE_ON == status) ? OAL_EVENT_ADAPTER_ENABLED : OAL_EVENT_ADAPTER_DISABLED;
-
-       send_event(event, NULL, 0);
-}
-
-#ifdef TIZEN_BT_HAL
-/* Callbacks from Stack */
-static void cb_ble_state_change(bt_state_t status)
-{
-       BT_DBG("+");
-       oal_event_t event;
-
-       event = (BT_STATE_ON == status) ? OAL_EVENT_BLE_ENABLED : OAL_EVENT_BLE_DISABLED;
-
-       send_event(event, NULL, 0);
-}
-#endif
-
-static gboolean retry_enable_adapter(gpointer data)
-{
-       adapter_enable();
-       return FALSE;
-}
-
-#ifdef TIZEN_BT_HAL
-static gboolean retry_enable_le(gpointer data)
-{
-       le_enable();
-       return FALSE;
-}
-#endif
-oal_status_t adapter_get_properties(void)
-{
-       int ret;
-
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-
-       ret = blued_api->get_adapter_properties();
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("get_adapter_properties failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_get_address(void)
-{
-       int ret;
-
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-
-       ret = blued_api->get_adapter_property(BT_PROPERTY_BDADDR);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_get_version(void)
-{
-       int ret;
-
-       API_TRACE();
-       CHECK_OAL_INITIALIZED();
-
-       ret = blued_api->get_adapter_property(BT_PROPERTY_VERSION);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_get_name(void)
-{
-       int ret;
-
-       CHECK_OAL_INITIALIZED();
-
-       API_TRACE();
-
-       ret = blued_api->get_adapter_property(BT_PROPERTY_BDNAME);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_set_name(char * name)
-{
-       int ret;
-       bt_property_t prop;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(name, return);
-       API_TRACE("Name: %s", name);
-
-       prop.type = BT_PROPERTY_BDNAME;
-       prop.len = strlen(name);
-       prop.val = name;
-
-       ret = blued_api->set_adapter_property(&prop);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("set_adapter_property: [%s]", status2string(ret));
-               ret = OAL_STATUS_INTERNAL_ERROR;
-       } else
-               ret = OAL_STATUS_SUCCESS;
-
-       return ret;
-}
-
-oal_status_t adapter_is_discoverable(int *p_discoverable)
-{
-       OAL_CHECK_PARAMETER(p_discoverable, return);
-
-       *p_discoverable = (scan_mode == BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
-
-       API_TRACE("%d", *p_discoverable);
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_is_connectable(int *p_connectable)
-{
-       OAL_CHECK_PARAMETER(p_connectable, return);
-
-       *p_connectable = (scan_mode == BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE)
-               || (scan_mode == BT_SCAN_MODE_CONNECTABLE);
-
-       API_TRACE("%d", *p_connectable);
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_get_discoverable_timeout(int *p_timeout)
-{
-       API_TRACE("%d", discoverable_timeout);
-
-       *p_timeout = discoverable_timeout;
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_get_service_uuids(void)
-{
-       int ret;
-
-       CHECK_OAL_INITIALIZED();
-
-       API_TRACE();
-
-       ret = blued_api->get_adapter_property(BT_PROPERTY_UUIDS);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_get_bonded_devices(void)
-{
-       int ret;
-
-       CHECK_OAL_INITIALIZED();
-
-       API_TRACE();
-
-       ret = blued_api->get_adapter_property(BT_PROPERTY_ADAPTER_BONDED_DEVICES);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("get_adapter_property failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-static oal_status_t set_scan_mode(bt_scan_mode_t mode)
-{
-       bt_property_t prop;
-       int res;
-
-       BT_DBG("+");
-
-       CHECK_OAL_INITIALIZED();
-
-       prop.type = BT_PROPERTY_ADAPTER_SCAN_MODE;
-       prop.len = sizeof(bt_scan_mode_t);
-       prop.val = &mode;
-       res = blued_api->set_adapter_property(&prop);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set scan mode failed [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       BT_DBG("-");
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_set_connectable(int connectable)
-{
-       bt_scan_mode_t mode;
-
-       API_TRACE("%d", connectable);
-
-       CHECK_OAL_INITIALIZED();
-
-       mode = connectable ? BT_SCAN_MODE_CONNECTABLE : BT_SCAN_MODE_NONE;
-
-       return set_scan_mode(mode);
-}
-
-oal_status_t adapter_set_discoverable(void)
-{
-       CHECK_OAL_INITIALIZED();
-       API_TRACE();
-
-       return set_scan_mode(BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
-}
-
-oal_status_t adapter_set_discoverable_timeout(int timeout)
-{
-       bt_property_t prop;
-       int res;
-       uint32_t prop_val = timeout;
-
-       CHECK_OAL_INITIALIZED();
-       API_TRACE("%d", timeout);
-
-       prop.type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
-       prop.len = sizeof(prop_val);
-       prop.val = &prop_val;
-       res = blued_api->set_adapter_property(&prop);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set_adapter_property failed [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_ble_multi_adv_update(int Ins_id, int min_intv, int max_intv,
-                       int adv_type, int chnl_map, int tx_power, int timeout_s)
-{
-       int res;
-       CHECK_OAL_INITIALIZED();
-       API_TRACE();
-
-       res = gatts_multi_adv_update(Ins_id, min_intv, max_intv,
-                       adv_type, chnl_map, tx_power, timeout_s);
-       if (res != OAL_STATUS_SUCCESS) {
-               BT_ERR("gatts_multi_adv_update: [%d]", res);
-               return res;
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_ble_multi_adv_set_inst_data(int instance_id,
-                       oal_ble_multi_adv_param_setup_t * adv_param_setup)
-{
-       int res;
-       CHECK_OAL_INITIALIZED();
-       OAL_CHECK_PARAMETER(adv_param_setup, return);
-
-       API_TRACE();
-
-       res = gatts_multi_adv_set_inst_data(instance_id, adv_param_setup);
-       if (res != OAL_STATUS_SUCCESS) {
-               BT_ERR("failed: [%d]", res);
-               return res;
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_ble_multi_adv_enable(int instance_id)
-{
-       int res;
-       CHECK_OAL_INITIALIZED();
-       API_TRACE();
-
-       res = gatts_multi_adv_enable(instance_id);
-       if (res != OAL_STATUS_SUCCESS) {
-               BT_ERR("failed: [%d]", res);
-               return res;
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t adapter_ble_multi_adv_disable(int instance_id)
-{
-       int res;
-       CHECK_OAL_INITIALIZED();
-       API_TRACE();
-
-       res = gatts_multi_adv_disable(instance_id);
-       if (res != OAL_STATUS_SUCCESS) {
-               BT_ERR("failed: [%d]", res);
-               return res;
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-static void cb_adapter_properties(bt_status_t status,
-               int num_properties,
-               bt_property_t *properties)
-{
-       int i;
-
-       BT_DBG("status: %d, count: %d", status, num_properties);
-
-       if (status != BT_STATUS_SUCCESS) {
-               if (num_properties == 1) {
-                       BT_ERR("Adapter Prop failed: status: [%s], count: %d, prop: %d",
-                               status2string(status), num_properties, properties[num_properties-1].type);
-               } else {
-                       BT_ERR("Adapter Prop failed: status: [%s], count: %d", status2string(status), num_properties);
-               }
-               return;
-       }
-
-       for (i = 0; i < num_properties; i++) {
-               BT_DBG("prop type %d, len %d", properties[i].type, properties[i].len);
-               switch (properties[i].type) {
-               case BT_PROPERTY_VERSION: {
-                       g_strlcpy(local_version, properties[i].val, BT_VERSION_STR_LEN_MAX);
-                       local_version[properties[i].len] = '\0';
-
-                       BT_DBG("Version: %s", local_version);
-                       /* Send event to application */
-                       if (num_properties == 1) {
-                               char *adapter_ver = g_strdup(local_version);
-
-                               /* Application has requested this property SET/GET hence send EVENT */
-                               send_event(OAL_EVENT_ADAPTER_PROPERTY_VERSION, adapter_ver, strlen(adapter_ver));
-                       }
-                       break;
-               }
-               case BT_PROPERTY_BDNAME: {
-                       g_strlcpy(local_name, properties[i].val, BT_DEVICE_NAME_LENGTH_MAX);
-                       local_name[properties[i].len] = '\0';
-
-                       BT_DBG("Name: %s", local_name);
-                       /* Send event to application */
-                       if (num_properties == 1) {
-                               char * adap_name = g_strdup(local_name);
-
-                               /* Application has requested this property SET/GET hence send EVENT */
-                               send_event(OAL_EVENT_ADAPTER_PROPERTY_NAME, adap_name, strlen(adap_name)+1);
-                       }
-                       break;
-               }
-               case BT_PROPERTY_BDADDR: {
-                       bt_bdaddr_t * addr;
-
-                       addr =  properties[i].val;
-                       memcpy(local_address.addr, addr->address, 6);
-                       if (num_properties == 1) {
-                               /* Application has requested this property SET/GET hence send EVENT */
-                               send_event(OAL_EVENT_ADAPTER_PROPERTY_ADDRESS,
-                                               g_memdup(&local_address, sizeof(local_address)),
-                                               sizeof(local_address));
-                       }
-                       break;
-               }
-               case BT_PROPERTY_UUIDS: {
-                       int num_uuid;
-
-                       num_uuid = properties[i].len/sizeof(bt_uuid_t);
-
-                       BT_DBG("num_uuid: %d", num_uuid);
-
-                       /* Send event to application */
-                       if (num_properties == 1) {
-                               event_adapter_services_t *uuids_event;
-
-                               uuids_event = g_malloc(sizeof(event_adapter_services_t) + properties[i].len);
-                               memcpy(uuids_event->service_list, properties[i].val, properties[i].len);
-                               uuids_event->num = num_uuid;
-
-                               /* Application has requested this property SET/GET hence send EVENT */
-                               send_event(OAL_EVENT_ADAPTER_PROPERTY_SERVICES,
-                                               uuids_event, (sizeof(event_adapter_services_t) + num_uuid * sizeof(bt_uuid_t)));
-                       }
-                       break;
-               }
-               case BT_PROPERTY_ADAPTER_SCAN_MODE: {
-                       bt_scan_mode_t cur_mode = *((bt_scan_mode_t *)properties[i].val);
-
-                       BT_INFO("Scan mode (%d)", cur_mode);
-
-                       scan_mode = cur_mode;
-
-                       /* Send event to application */
-                       if (num_properties == 1) {
-                               oal_event_t event = OAL_EVENT_ADAPTER_MODE_NON_CONNECTABLE;
-
-                               if (BT_SCAN_MODE_CONNECTABLE == cur_mode)
-                                       event = OAL_EVENT_ADAPTER_MODE_CONNECTABLE;
-                               else if (BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE == cur_mode)
-                                       event = OAL_EVENT_ADAPTER_MODE_DISCOVERABLE;
-
-                               /* Application has requested this property SET/GET hence send EVENT */
-                               send_event(event, NULL, 0);
-                       }
-                       break;
-               }
-               case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT: {
-                       int timeout;
-
-                       timeout = *((uint32_t*)properties[i].val);
-
-                       BT_INFO("Discoverability timeout: %d", timeout);
-                       discoverable_timeout = timeout;
-
-                       send_event(OAL_EVENT_ADAPTER_MODE_DISCOVERABLE_TIMEOUT,
-                                       g_memdup(properties[i].val, sizeof(uint32_t)),
-                                       sizeof(uint32_t));
-                       break;
-               }
-               case BT_PROPERTY_ADAPTER_BONDED_DEVICES: {
-                       int j;
-                       int num_bonded;
-                       bt_bdaddr_t *bonded_addr_list;
-                       event_device_list_t *event_data;
-
-                       num_bonded = properties[i].len/sizeof(bt_bdaddr_t);
-                       BT_DBG("num_bonded %d", num_bonded);
-
-                       if (num_properties > 1) /* No explicit req for this prop, ignore */
-                               break;
-
-                       bonded_addr_list = properties[i].val;
-                       event_data = g_malloc(sizeof(event_device_list_t) + num_bonded*sizeof(bt_address_t));
-                       event_data->num = num_bonded;
-
-                       for (j = 0; j < num_bonded; j++)
-                               memcpy(event_data->devices[j].addr, bonded_addr_list[j].address, 6);
-
-                       send_event(OAL_EVENT_ADAPTER_BONDED_DEVICE_LIST,
-                                       event_data, (sizeof(event_device_list_t) + num_bonded * sizeof(bt_bdaddr_t)));
-                       break;
-               }
-               default:
-                        BT_WARN("Unhandled property: %d", properties[i].type);
-                        break;
-               }
-       }
-}
-
-static void cb_adapter_discovery_state_changed(bt_discovery_state_t state)
-{
-       oal_event_t event;
-
-       event = (BT_DISCOVERY_STARTED == state) ? OAL_EVENT_ADAPTER_INQUIRY_STARTED : OAL_EVENT_ADAPTER_INQUIRY_FINISHED;
-
-       BT_DBG("%d", state);
-       send_event(event, NULL, 0);
-}
-
-static void cb_adapter_device_found(int num_properties, bt_property_t *properties)
-{
-       remote_device_t dev_info;
-       ble_adv_data_t adv_info;
-       oal_event_t event;
-       gpointer event_data;
-       gsize size = 0;
-       BT_DBG("+");
-
-       if (num_properties == 0) {
-               BT_ERR("Unexpected, properties count is zero!!");
-               return;
-       }
-
-       memset(&dev_info, 0x00, sizeof(remote_device_t));
-       memset(&adv_info, 0x00, sizeof(ble_adv_data_t));
-
-       print_bt_properties(num_properties, properties);
-       parse_device_properties(num_properties, properties, &dev_info, &adv_info);
-
-       BT_INFO("number of properties= [%d]", num_properties);
-
-       if (dev_info.type != DEV_TYPE_BREDR) {
-               /* BLE Single or DUAL mode found, so it should have Adv data */
-               event_ble_dev_found_t * ble_dev_event = g_new0(event_ble_dev_found_t, 1);
-
-               ble_dev_event->adv_len = adv_info.len;
-
-               if (adv_info.len > 0 && adv_info.adv_data) {
-                       memcpy(ble_dev_event->adv_data, adv_info.adv_data, adv_info.len);
-                       ble_dev_event->adv_len = adv_info.len;
-               } else
-                       ble_dev_event->adv_len = 0;
-
-               ble_dev_event->device_info = dev_info;
-
-               event_data = ble_dev_event;
-               size = sizeof(event_ble_dev_found_t);
-               event = OAL_EVENT_ADAPTER_INQUIRY_RESULT_BLE;
-       } else {
-               /* BREDR device, so No Adv data */
-               event_dev_found_t * dev_event = g_new0(event_dev_found_t, 1);
-
-               memcpy(dev_event, &dev_info, sizeof(remote_device_t));
-               event_data = dev_event;
-               size = sizeof(remote_device_t);
-               event = OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY;
-       }
-
-       send_event(event, event_data, size);
-
-       BT_DBG("-");
-}
diff --git a/oal-audio-src.c b/oal-audio-src.c
deleted file mode 100644 (file)
index 3834fc1..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dlog.h>
-
-#include <bluetooth.h>
-#include <bt_av.h>
-
-#include "oal-internal.h"
-#include "oal-audio-src.h"
-#include "oal-utils.h"
-#include "oal-common.h"
-
-#define CHECK_OAL_AUDIO_ENABLED() \
-       do { \
-               if (blued_a2dp_interface == NULL) { \
-                       BT_ERR("OAL, Audio Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-
-static void cb_audio_connection_state(btav_connection_state_t event, bt_bdaddr_t* bd_addr);
-static void cb_audio_state(btav_audio_state_t state, bt_bdaddr_t* bd_addr);
-
-const bt_interface_t * _bt_get_stack_interface(void);
-static const btav_interface_t *blued_a2dp_interface = NULL;
-
-static btav_callbacks_t blued_a2dp_cb = {
-       sizeof(blued_a2dp_cb),
-       cb_audio_connection_state,
-       cb_audio_state,
-       NULL /* Audio Config Callback */
-};
-
-oal_status_t audio_enable(char *service_name , char *provider_name)
-{
-       const bt_interface_t* blued_inf;
-       int ret;
-
-       API_TRACE("Audio Enable");
-
-       if ((blued_inf = adapter_get_stack_interface()) == NULL) {
-               BT_ERR("Bluetooth module is not loaded");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (blued_a2dp_interface != NULL) {
-               BT_WARN("A2DP Sink Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       if ((blued_a2dp_interface = (const btav_interface_t *)blued_inf->get_profile_interface(BT_PROFILE_ADVANCED_AUDIO_ID)) == NULL) {
-               BT_ERR("OAL, Failed to get Bluetooth A2DP Interface");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       BT_DBG("Got profile interface");
-       if ((ret = blued_a2dp_interface->init(&blued_a2dp_cb)) != BT_STATUS_SUCCESS) {
-               BT_ERR("Failed to initialize Bluetooth A2DP, status: %s", status2string(ret));
-               blued_a2dp_interface = NULL;
-               return convert_to_oal_status(ret);
-       }
-       BT_DBG("OAL, Bluetooth audio interface initialised");
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/* Audio deinit: Resets all the audio information
- * Note: Adapter should be disabled before calling deinit
- * */
-oal_status_t audio_disable(void)
-{
-       API_TRACE("audio disable");
-
-       CHECK_OAL_AUDIO_ENABLED();
-
-       blued_a2dp_interface->cleanup();
-       blued_a2dp_interface = NULL;
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t audio_connect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_AUDIO_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       /* Call connect function of Bluedroid*/
-       status = blued_a2dp_interface->connect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("Connection could not be established, err: %s", status2string(status));;
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-
-oal_status_t audio_disconnect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       bt_status_t status;
-
-       API_TRACE();
-
-       CHECK_OAL_AUDIO_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       /* call Disconnect function of Bluedroid */
-       status = blued_a2dp_interface->disconnect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("OAL, Disconnection failed err: %s", status2string(status));
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-static void cb_audio_connection_state(btav_connection_state_t state, bt_bdaddr_t* bd_addr)
-{
-       bt_address_t * event_data = NULL;
-       bdstr_t bdstr;
-       oal_event_t event;
-
-       ret_if(bd_addr == NULL);
-       BT_INFO("state = %d,  BT Address = %s", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-
-       event_data = g_new0(bt_address_t, 1);
-       memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       switch (state) {
-               case BTAV_CONNECTION_STATE_CONNECTING: {
-                       event = OAL_EVENT_AUDIO_CONNECTING;
-                       break;
-               }
-               case BTAV_CONNECTION_STATE_CONNECTED: {
-                       event = OAL_EVENT_AUDIO_CONNECTED;
-                       break;
-               }
-               case BTAV_CONNECTION_STATE_DISCONNECTING: {
-                       event = OAL_EVENT_AUDIO_DISCONNECTING;
-                       break;
-               }
-               case BTAV_CONNECTION_STATE_DISCONNECTED: {
-                       event = OAL_EVENT_AUDIO_DISCONNECTED;
-                       break;
-               }
-               default: {
-                       BT_INFO("Invalid state");
-                       g_free(event_data);
-                       event_data = NULL;
-                       return;
-               }
-       }
-       send_event_bda_trace(event, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-}
-
-static void cb_audio_state(btav_audio_state_t state, bt_bdaddr_t* bd_addr)
-{
-       bdstr_t bdstr;
-
-       ret_if(bd_addr == NULL);
-       BT_INFO("A2DP state = %d,  BT Address = %s", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-
-       if (state == BTAV_AUDIO_STATE_REMOTE_SUSPEND) {
-               BT_INFO("Audio Streaming Suspended");
-       } else if (state == BTAV_AUDIO_STATE_STOPPED) {
-               BT_INFO("###Audio Streaming Stopped");
-               bt_address_t * event_data = g_new0(bt_address_t, 1);
-
-               memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-               send_event_bda_trace(OAL_EVENT_AUDIO_STOPPED, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-       } else if (state == BTAV_AUDIO_STATE_STARTED) {
-               BT_INFO("###Audio Streaming Startted");
-               bt_address_t * event_data = g_new0(bt_address_t, 1);
-
-               memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-               send_event_bda_trace(OAL_EVENT_AUDIO_STARTED, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-       } else{
-               BT_ERR("Unknown state received:%d", (int)state);
-       }
-}
diff --git a/oal-avrcp-ctrl.c b/oal-avrcp-ctrl.c
deleted file mode 100644 (file)
index 6cb9d86..0000000
+++ /dev/null
@@ -1,952 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * Contact: Nilesh Trimbake <t.shripati@samsung.com>
- *
- * 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 <stdio.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dlog.h>
-#include <glib.h>
-
-#include <bluetooth.h>
-#include <bt_rc.h>
-
-#include "oal-internal.h"
-#include "oal-avrcp-ct.h"
-#include "oal-utils.h"
-#include "oal-common.h"
-
-#define CHECK_OAL_AVRCP_CTRL_ENABLED() \
-       do { \
-               if (avrcp_ct_interface == NULL) { \
-                       BT_ERR("OAL, Audio Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-#define NO_OF_ATTRIBUTE 1
-
-typedef struct {
-       long int song_pos;
-       long int playing_time;
-       uint8_t title_info[BTRC_MAX_ATTR_STR_LEN];
-       uint8_t artist_info[BTRC_MAX_ATTR_STR_LEN];
-       uint8_t album_info[BTRC_MAX_ATTR_STR_LEN];
-       uint8_t genre_info[BTRC_MAX_ATTR_STR_LEN];
-       long int total_track;
-       uint32_t track_number;
-} avrcp_ct_track_info_t;
-
-typedef struct {
-       bdstr_t bdstr;
-       int equalizer;
-       btrc_player_repeat_val_t repeat;
-       btrc_player_shuffle_val_t shuffle;
-       int scan;
-       btrc_play_status_t status;
-       unsigned int volume;
-} avrcp_ct_player_settings_t;
-
-typedef struct {
-       char address[BT_ADDRESS_STR_LEN];
-       avrcp_ct_player_settings_t player_setting;
-       avrcp_ct_track_info_t track_info;
-} avrcp_ct_player_info_t;
-
-static GSList *player_list = NULL;
-
-const btrc_ctrl_interface_t * _bt_get_stack_interface(void);
-static const btrc_ctrl_interface_t *avrcp_ct_interface = NULL;
-
-static void cb_avrcp_ct_connection_state(bool rc_connect, bool bt_connect, bt_bdaddr_t* bd_addr);
-static void cb_avrcp_ct_btrc_playerapplicationsetting_changed(bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
-static void cb_avrcp_ct_btrc_play_position_changed(bt_bdaddr_t *bd_addr, uint32_t song_len, uint32_t song_pos);
-static void cb_avrcp_ct_btrc_play_status_changed(bt_bdaddr_t *bd_addr, btrc_play_status_t play_status);
-static void cb_avrcp_ct_trak_info_chnaged(bt_bdaddr_t *bd_address, uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
-static void cb_avrcp_ct_btrc_passthrough_rsp(bt_bdaddr_t *bd_addr, int id, int key_state);
-static void cb_avrcp_ct_btrc_setplayerapplicationsetting_rsp(bt_bdaddr_t *bd_addr, uint8_t accepted);
-
-/** AVRCP Controller callback structure. */
-static btrc_ctrl_callbacks_t avrcp_ct_cb = {
-       /** set to sizeof(BtRcCallbacks) */
-       sizeof(avrcp_ct_cb),
-       cb_avrcp_ct_btrc_passthrough_rsp,
-       NULL, //cb_avrcp_ct_btrc_groupnavigation_rsp,
-       cb_avrcp_ct_connection_state,
-       NULL,/*btrc_ct_getrcfeatures_callback*/
-       cb_avrcp_ct_btrc_setplayerapplicationsetting_rsp,
-       NULL, /*btrc_ct_playerapplicationsetting_callback*/
-       cb_avrcp_ct_btrc_playerapplicationsetting_changed,
-       NULL, /*btrc_ct_setabsvol_cmd_callback*/
-       NULL, /*btrc_ct_registernotification_abs_vol_callback*/
-       cb_avrcp_ct_trak_info_chnaged,
-       cb_avrcp_ct_btrc_play_position_changed,
-       cb_avrcp_ct_btrc_play_status_changed,
-       NULL, /*btrc_ct_get_folder_items_callback*/
-       NULL, /*btrc_ct_change_path_callback*/
-       NULL, /*btrc_ct_set_browsed_player_callback*/
-       NULL /*btrc_ct_set_addressed_player_callback*/
-};
-
-static void __add_device_to_avrcp_list(bt_address_t *address)
-{
-       avrcp_ct_player_info_t *player_info;
-       avrcp_ct_player_settings_t *player_setting;
-       bdstr_t bdstr;
-       GSList *l;
-
-       bdt_bd2str(address, &bdstr);
-       BT_INFO("Address: %s", bdstr);
-       for (l = player_list; NULL != l; l = g_slist_next(l)) {
-               player_info = (avrcp_ct_player_info_t *)l->data;
-
-               if (!player_info)
-                       continue;
-
-               if (!strncmp(bdstr, player_info->address, BT_ADDRESS_STR_LEN)) {
-                       BT_INFO("Already added");
-                       return;
-               }
-       }
-
-       player_info = g_new0(avrcp_ct_player_info_t, 1);
-
-       /* Copy address to player_info->address */
-       g_strlcpy(player_info->address, bdstr, BT_ADDRESS_STR_LEN);
-
-       /* Init player settings with default values */
-       player_setting = &player_info->player_setting;
-       player_setting->equalizer = 0;
-       player_setting->repeat = BTRC_PLAYER_VAL_OFF_REPEAT;
-       player_setting->shuffle = BTRC_PLAYER_VAL_OFF_SHUFFLE;
-       player_setting->scan = 0;
-       player_setting->status = BTRC_PLAYSTATE_STOPPED;
-       player_setting->volume = 0;
-
-       /* Nothing to do for track_info as values are already initialized to 0 */
-
-       /* Add player_info to player_list */
-       player_list = g_slist_append(player_list, player_info);
-}
-
-static void __remove_device_from_avrcp_list(bt_address_t *address)
-{
-       avrcp_ct_player_info_t *player_info = NULL;
-       bdstr_t bdstr;
-       GSList *l;
-
-       bdt_bd2str(address, &bdstr);
-       BT_INFO("Address: %s", bdstr);
-       for (l = player_list; NULL != l; l = g_slist_next(l)) {
-               player_info = (avrcp_ct_player_info_t *)l->data;
-
-               if (!player_info)
-                       continue;
-
-               if (!strncmp(bdstr, player_info->address, BT_ADDRESS_STR_LEN)) {
-                       BT_INFO("Found");
-                       break;
-               }
-
-               player_info = NULL;
-       }
-
-       if (!player_info)
-               return;
-
-       player_list = g_slist_remove(player_list, player_info);
-       g_free(player_info);
-}
-
-static avrcp_ct_player_info_t *__get_player_info_from_list(bt_address_t *address)
-{
-       avrcp_ct_player_info_t *player_info;
-       bdstr_t bdstr;
-       GSList *l;
-
-       bdt_bd2str(address, &bdstr);
-       BT_INFO("Address: %s", bdstr);
-       for (l = player_list; NULL != l; l = g_slist_next(l)) {
-               player_info = (avrcp_ct_player_info_t *)l->data;
-
-               if (!player_info)
-                       continue;
-
-               if (!strncmp(bdstr, player_info->address, BT_ADDRESS_STR_LEN)) {
-                       BT_INFO("Found");
-                       return player_info;
-               }
-       }
-
-       return NULL;
-}
-
-oal_status_t avrcp_ct_enable(void)
-{
-       const bt_interface_t* blued_inf;
-       int ret;
-
-       API_TRACE("AVRCP Controller Enable");
-
-       if ((blued_inf = adapter_get_stack_interface()) == NULL) {
-               BT_ERR("Bluetooth module is not loaded");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (avrcp_ct_interface != NULL) {
-               BT_WARN("AVRCP Controller Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       if ((avrcp_ct_interface = (const btrc_ctrl_interface_t *)blued_inf->get_profile_interface(BT_PROFILE_AV_RC_CTRL_ID)) == NULL) {
-               BT_ERR("OAL, Failed to get Bluetooth AVRCP Controller Interface");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       BT_DBG("Got profile interface");
-       if ((ret = avrcp_ct_interface->init(&avrcp_ct_cb)) != BT_STATUS_SUCCESS) {
-               BT_ERR("Failed to initialize Bluetooth AVRCP Controller, status: %s", status2string(ret));
-               avrcp_ct_interface = NULL;
-               return convert_to_oal_status(ret);
-       }
-       BT_DBG("OAL, Bluetooth avrcp controller interface initialised");
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/* Audio deinit: Resets all the audio information
- * Note: Adapter should be disabled before calling deinit
- * */
-oal_status_t avrcp_ct_disable(void)
-{
-       API_TRACE("AVRCP Controller Disable");
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-
-       avrcp_ct_interface->cleanup();
-       avrcp_ct_interface = NULL;
-
-       return OAL_STATUS_SUCCESS;
-}
-
-void avrcp_ct_cleanup(void)
-{
-       BT_DBG();
-       avrcp_ct_interface = NULL;
-}
-
-
-oal_status_t avrcp_ct_connect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       status = avrcp_ct_interface->connect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("Connection could not be established, err: %s", status2string(status));;
-               result =  convert_to_oal_status(status);
-       }
-#else
-       BT_INFO("Not Supported");
-       result = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return result;
-}
-
-oal_status_t avrcp_ct_disconnect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       bt_status_t status;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       status = avrcp_ct_interface->disconnect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("OAL, Disconnection failed err: %s", status2string(status));
-               result =  convert_to_oal_status(status);
-       }
-#else
-       BT_INFO("Not Supported");
-       result = OAL_STATUS_NOT_SUPPORT;
-#endif
-       return result;
-}
-
-static void cb_avrcp_ct_connection_state(bool rc_connect, bool bt_connect, bt_bdaddr_t* bd_addr)
-{
-       bt_address_t *event_data = NULL;
-       bdstr_t bdstr;
-       oal_event_t event;
-
-       ret_if(bd_addr == NULL);
-       BT_INFO("rc_connect = %d, bt_connect = %d, BT Address = %s",
-                       rc_connect, bt_connect, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-
-       event_data = g_new0(bt_address_t, 1);
-       memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       if (rc_connect) {
-               event = OAL_EVENT_AVRCP_CT_CONNECTED;
-               __add_device_to_avrcp_list(event_data);
-       } else {
-               event = OAL_EVENT_AVRCP_CT_DISCONNECTED;
-               __remove_device_from_avrcp_list(event_data);
-       }
-
-       send_event_bda_trace(event, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-}
-
-notif_event_avrcp_ct_play_status_t __hal_to_oal_play_status(btrc_play_status_t play_status)
-{
-       notif_event_avrcp_ct_play_status_t status = OAL_PLAY_STATUS_ERROR;
-
-       switch (play_status) {
-       case BTRC_PLAYSTATE_STOPPED:
-               status = OAL_PLAY_STATUS_STOPPED;
-               break;
-       case BTRC_PLAYSTATE_PLAYING:
-               status = OAL_PLAY_STATUS_PLAYING;
-               break;
-       case BTRC_PLAYSTATE_PAUSED:
-               status = OAL_PLAY_STATUS_PAUSED;
-               break;
-       case BTRC_PLAYSTATE_FWD_SEEK:
-               status = OAL_PLAY_STATUS_FWD_SEEK;
-               break;
-       case BTRC_PLAYSTATE_REV_SEEK:
-               status = OAL_PLAY_STATUS_REV_SEEK;
-               break;
-       default:
-               BT_INFO("Incorrect Play status");
-               break;
-       }
-
-       return status;
-}
-
-static avrcp_ct_player_settings_t *__get_player_setting(bt_address_t *address)
-{
-       avrcp_ct_player_info_t *player_info;
-
-       BT_INFO("");
-       player_info = __get_player_info_from_list(address);
-       if (!player_info)
-               return NULL;
-
-       return &player_info->player_setting;
-}
-
-static void cb_avrcp_ct_btrc_playerapplicationsetting_changed(
-               bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals)
-{
-       avrcp_ct_property_value_t *event_data = NULL;
-       oal_event_t event;
-       int i;
-       bdstr_t bdstr;
-       avrcp_ct_player_settings_t *player_setting;
-
-       bdt_bd2str((bt_address_t *)bd_addr, &bdstr);
-       player_setting = __get_player_setting((bt_address_t *)bd_addr);
-       if (!player_setting) {
-               BT_INFO("player_setting is NULL");
-               /* Player info not yet added to player_list, first add it to list */
-               __add_device_to_avrcp_list((bt_address_t *)bd_addr);
-               player_setting = __get_player_setting((bt_address_t *)bd_addr);
-       }
-
-       for (i = 0; i < p_vals->num_attr; i++) {
-               event_data = g_new0(avrcp_ct_property_value_t, 1);
-
-               switch (p_vals->attr_ids[i]) {
-               case BTRC_PLAYER_ATTR_EQUALIZER:
-                       event = OAL_EVENT_AVRCP_CT_EQUALIZER_STATUS;
-                       event_data->type = OAL_EQUALIZER;
-                       event_data->value = p_vals->attr_values[i];
-                       player_setting->equalizer = p_vals->attr_values[i];
-                       break;
-               case BTRC_PLAYER_ATTR_REPEAT:
-                       event = OAL_EVENT_AVRCP_CT_REPEAT_STATUS;
-                       event_data->type = OAL_REPEAT;
-                       event_data->value = p_vals->attr_values[i];
-                       player_setting->repeat = p_vals->attr_values[i];
-                       break;
-               case BTRC_PLAYER_ATTR_SHUFFLE:
-                       event = OAL_EVENT_AVRCP_CT_SHUFFLE_STATUS;
-                       event_data->type = OAL_SHUFFLE;
-                       event_data->value = p_vals->attr_values[i];
-                       player_setting->shuffle = p_vals->attr_values[i];
-                       break;
-               case BTRC_PLAYER_ATTR_SCAN:
-                       event = OAL_EVENT_AVRCP_CT_SCAN_STATUS;
-                       event_data->type = OAL_SCAN;
-                       event_data->value = p_vals->attr_values[i];
-                       player_setting->scan = p_vals->attr_values[i];
-                       break;
-               default:
-                       event = OAL_EVENT_END;
-                       g_free(event_data);
-                       break;
-               }
-
-               if (OAL_EVENT_END != event)
-                       send_event(event, event_data, sizeof(avrcp_ct_property_value_t));
-       }
-}
-
-static avrcp_ct_track_info_t *__get_track_info(bt_address_t *address)
-{
-       avrcp_ct_player_info_t *player_info;
-
-       BT_INFO("");
-       player_info = __get_player_info_from_list(address);
-       if (!player_info)
-               return NULL;
-
-       return &player_info->track_info;
-}
-
-static void cb_avrcp_ct_btrc_play_position_changed(
-               bt_bdaddr_t *bd_addr, uint32_t song_len, uint32_t song_pos)
-{
-       event_notif_avrcp_ct_notif_info_t *event_data = NULL;
-       avrcp_ct_track_info_t *track_info;
-
-       track_info = __get_track_info((bt_address_t *)bd_addr);
-       if (!track_info) {
-               BT_INFO("track_info is NULL");
-               /* Player info not yet added to player_list, first add it to list */
-               __add_device_to_avrcp_list((bt_address_t *)bd_addr);
-               track_info = __get_track_info((bt_address_t *)bd_addr);
-       }
-       track_info->song_pos = song_pos;
-
-       event_data = g_new0(event_notif_avrcp_ct_notif_info_t, 1);
-       event_data->song_pos = song_pos;
-       send_event(OAL_EVENT_AVRCP_CT_NOTIF_PLAY_POS_CHANGED,
-                       event_data, sizeof(event_notif_avrcp_ct_notif_info_t));
-}
-
-static void cb_avrcp_ct_btrc_play_status_changed(
-               bt_bdaddr_t *bd_addr, btrc_play_status_t play_status)
-{
-       event_notif_avrcp_ct_notif_info_t *event_data = NULL;
-       avrcp_ct_player_settings_t *player_setting;
-
-       player_setting = __get_player_setting((bt_address_t *)bd_addr);
-       if (!player_setting) {
-               BT_INFO("player_setting is NULL");
-               /* Player info not yet added to player_list, first add it to list */
-               __add_device_to_avrcp_list((bt_address_t *)bd_addr);
-               player_setting = __get_player_setting((bt_address_t *)bd_addr);
-       }
-
-       player_setting->status = play_status;
-
-       event_data = g_new0(event_notif_avrcp_ct_notif_info_t, 1);
-       event_data->play_status = __hal_to_oal_play_status(play_status);
-       send_event(OAL_EVENT_AVRCP_CT_NOTIF_PLAY_STATUS_CHANGED,
-                       event_data, sizeof(event_notif_avrcp_ct_notif_info_t));
-}
-
-static void cb_avrcp_ct_btrc_passthrough_rsp(bt_bdaddr_t *bd_addr, int id, int state)
-{
-       avrcp_ct_pass_cmd_key_code_t key_code;
-       avrcp_ct_pass_state_t key_state;
-       avrcp_ct_pass_cmd_t *event_data;
-
-       event_data = g_new0(avrcp_ct_pass_cmd_t, 1);
-
-       key_code = id;
-       key_state = state;
-       if (key_code) {
-               event_data->key_code = key_code;
-               event_data->key_state = key_state;
-               send_event(OAL_EVENT_AVRCP_CT_PASS_CMD_RES,
-                               event_data, sizeof(avrcp_ct_pass_cmd_t));
-       } else {
-               BT_ERR("Invalid pass through command key code");
-               g_free(event_data);
-       }
-}
-
-static void cb_avrcp_ct_btrc_setplayerapplicationsetting_rsp(
-               bt_bdaddr_t *bd_addr, uint8_t accepted)
-{
-       avrcp_ct_playersetting_t *event_data;
-
-       event_data = g_new0(avrcp_ct_playersetting_t, 1);
-
-       event_data->accepted = accepted;
-       send_event(OAL_EVENT_AVRCP_CT_PLAYER_SETTING_RES,
-                       event_data, sizeof(avrcp_ct_playersetting_t));
-}
-
-static void cb_avrcp_ct_trak_info_chnaged(bt_bdaddr_t *device_address,
-               uint8_t num_attr, btrc_element_attr_val_t *p_attrs)
-{
-       int idx = 0;
-       avrcp_ct_track_info_t *track_info;
-       event_avrcp_ct_media_info_t *event_data = NULL;
-
-       track_info = __get_track_info((bt_address_t *)device_address);
-       if (!track_info) {
-               BT_INFO("track_info is NULL");
-               /* Player info not yet added to player_list, first add it to list */
-               __add_device_to_avrcp_list((bt_address_t *)device_address);
-               track_info = __get_track_info((bt_address_t *)device_address);
-       }
-
-       event_data = g_new0(event_avrcp_ct_media_info_t, 1);
-       for (idx = 0; idx < num_attr; idx++) {
-               BT_INFO("idx [%d]", p_attrs[idx].attr_id);
-
-               switch (p_attrs[idx].attr_id) {
-               case BTRC_MEDIA_ATTR_ID_TITLE:
-                       g_strlcpy((char *)track_info->title_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       g_strlcpy((char *)event_data->title_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       break;
-               case BTRC_MEDIA_ATTR_ID_ARTIST:
-                       g_strlcpy((char *)track_info->artist_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       g_strlcpy((char *)event_data->artist_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       break;
-               case BTRC_MEDIA_ATTR_ID_ALBUM:
-                       g_strlcpy((char *)track_info->album_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       g_strlcpy((char *)event_data->album_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       break;
-               case BTRC_MEDIA_ATTR_ID_GENRE:
-                       g_strlcpy((char *)track_info->genre_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       g_strlcpy((char *)event_data->genre_info, (const char *)&p_attrs[idx].text,
-                                       MEDIA_ATTIRBUTE_STRING_LENGTH);
-                       break;
-               case BTRC_MEDIA_ATTR_ID_NUM_TRACKS:
-                       if (p_attrs[idx].text != NULL) {
-                               track_info->total_track = g_ascii_strtoll(
-                                               (const gchar *)p_attrs[idx].text, NULL, 10);
-                               event_data->total_track = track_info->total_track;
-                       }
-                       break;
-               case BTRC_MEDIA_ATTR_ID_TRACK_NUM:
-                       if (p_attrs[idx].text != NULL) {
-                               track_info->track_number = g_ascii_strtoll(
-                                               (const gchar *)p_attrs[idx].text, NULL, 10);
-                               event_data->track_number = track_info->track_number;
-                       }
-                       break;
-               case BTRC_MEDIA_ATTR_ID_PLAYING_TIME:
-                               track_info->playing_time = g_ascii_strtoll(
-                                               (const gchar *)p_attrs[idx].text, NULL, 10);
-                               event_data->playing_time = (uint64_t) track_info->playing_time;
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       send_event(OAL_EVENT_AVRCP_CT_NOTIF_TRACK_CHANGE,
-                       event_data, sizeof(event_avrcp_ct_media_info_t));
-       return;
-}
-
-oal_status_t __avrcp_ct_send_pass_through_cmd(bt_address_t *device_address,
-               avrcp_ct_pass_cmd_key_code_t key_code, avrcp_ct_pass_state_t key_state)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       status = avrcp_ct_interface->send_pass_through_cmd((bt_bdaddr_t *)device_address,
-                       key_code, key_state);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("OAL, send pass through cmd failed err: %s", status2string(status));
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-oal_status_t avrcp_ct_play(bt_address_t *device_address)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-
-       result = __avrcp_ct_send_pass_through_cmd(device_address,
-                       OAL_RC_PASS_CMD_PLAY, PRESS_STATE);
-
-       return result;
-}
-
-oal_status_t avrcp_ct_pause(bt_address_t *device_address)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-
-       result = __avrcp_ct_send_pass_through_cmd(device_address,
-                       OAL_RC_PASS_CMD_PAUSE, PRESS_STATE);
-
-       return result;
-}
-
-oal_status_t avrcp_ct_stop(bt_address_t *device_address)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-
-       result = __avrcp_ct_send_pass_through_cmd(device_address,
-                       OAL_RC_PASS_CMD_STOP, PRESS_STATE);
-
-       return result;
-}
-
-oal_status_t avrcp_ct_next_track(bt_address_t *device_address)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-
-       result = __avrcp_ct_send_pass_through_cmd(device_address,
-                       OAL_RC_PASS_CMD_NEXT, PRESS_STATE);
-
-       return result;
-}
-
-oal_status_t avrcp_ct_prev_track(bt_address_t *device_address)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-
-       result = __avrcp_ct_send_pass_through_cmd(device_address,
-                       OAL_RC_PASS_CMD_PREVIOUS, PRESS_STATE);
-
-       return result;
-}
-
-oal_status_t avrcp_ct_fforward(bt_address_t *device_address, avrcp_ct_pass_state_t press_state)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-       switch (press_state) {
-       case PRESS_STATE:
-               result = __avrcp_ct_send_pass_through_cmd(device_address,
-                               OAL_RC_PASS_CMD_PRESS_FAST_FORWARD, press_state);
-               break;
-       case RELEASE_STATE:
-               result = __avrcp_ct_send_pass_through_cmd(device_address,
-                               OAL_RC_PASS_CMD_RELEASE_FAST_FORWARD, press_state);
-               break;
-       default:
-               result = OAL_STATUS_INVALID_PARAM;
-               break;
-       }
-
-       return result;
-}
-
-oal_status_t avrcp_ct_rewind(bt_address_t *device_address, avrcp_ct_pass_state_t press_state)
-{
-       oal_status_t result = OAL_STATUS_SUCCESS;
-
-       API_TRACE();
-       switch (press_state) {
-       case PRESS_STATE:
-               result = __avrcp_ct_send_pass_through_cmd(device_address,
-                               OAL_RC_PASS_CMD_PRESS_REWIND, press_state);
-               break;
-       case RELEASE_STATE:
-               result = __avrcp_ct_send_pass_through_cmd(device_address,
-                               OAL_RC_PASS_CMD_RELEASE_REWIND, press_state);
-               break;
-       default:
-               result = OAL_STATUS_INVALID_PARAM;
-               break;
-       }
-
-       return result;
-}
-
-uint8_t __oal_to_hal_property_type(avrcp_ct_player_property_type_t type)
-{
-       uint8_t property_type = 0;
-
-       switch (type) {
-       case OAL_EQUALIZER:
-               property_type = BTRC_PLAYER_ATTR_EQUALIZER;
-               break;
-       case OAL_REPEAT:
-               property_type = BTRC_PLAYER_ATTR_REPEAT;
-               break;
-       case OAL_SHUFFLE:
-               property_type = BTRC_PLAYER_ATTR_SHUFFLE;
-               break;
-       case OAL_SCAN:
-               property_type = BTRC_PLAYER_ATTR_SCAN;
-               break;
-       default:
-               BT_ERR(" Invalid Property type[%d]", type);
-               break;
-       }
-
-       return property_type;
-}
-
-oal_status_t avrcp_ct_set_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type, uint32_t value)
-{
-       int result = OAL_STATUS_SUCCESS;
-       uint8_t property_type;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       property_type = __oal_to_hal_property_type(type);
-       if (property_type) {
-               status = avrcp_ct_interface->set_player_app_setting_cmd((bt_bdaddr_t *)device_address, NO_OF_ATTRIBUTE,
-                               (uint8_t*)&property_type, (uint8_t*)&value);
-               if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-                       BT_ERR("OAL, Set property failed err: %s", status2string(status));
-                       result =  convert_to_oal_status(status);
-               }
-       } else {
-               result = OAL_STATUS_INTERNAL_ERROR;
-       }
-       return result;
-}
-
-oal_status_t avrcp_transport_set_property(bt_address_t *device_address, int type, unsigned int value)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(device_address, &bdstr));
-
-       if (type) {
-               status = avrcp_ct_interface->set_transport_setting_cmd((bt_bdaddr_t *)device_address, NO_OF_ATTRIBUTE,
-                               &type, &value);
-               if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-                       BT_ERR("OAL, Set property failed err: %s", status2string(status));
-                       result =  convert_to_oal_status(status);
-               }
-       } else {
-               result = OAL_STATUS_INTERNAL_ERROR;
-       }
-       return result;
-}
-
-static gboolean __send_avrcp_property_event(gpointer data)
-{
-       avrcp_ct_property_value_t *event_data = (avrcp_ct_property_value_t *)data;
-
-       send_event(OAL_EVENT_AVRCP_CT_GET_PROPERTY_RES,
-                       event_data, sizeof(avrcp_ct_property_value_t));
-       return FALSE;
-}
-
-oal_status_t avrcp_ct_get_property(bt_address_t *device_address, avrcp_ct_player_property_type_t type)
-{
-       avrcp_ct_player_info_t *player_info;
-       avrcp_ct_player_settings_t *player_setting;
-       avrcp_ct_track_info_t *track_info;
-       avrcp_ct_property_value_t *event_data;
-
-       API_TRACE();
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-
-       player_info = __get_player_info_from_list(device_address);
-       if (!player_info) {
-               BT_ERR("Player info not found");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       player_setting = &player_info->player_setting;
-       track_info = &player_info->track_info;
-
-       event_data = g_new0(avrcp_ct_property_value_t, 1);
-       event_data->type = type;
-
-       switch (type) {
-       case OAL_EQUALIZER:
-               event_data->value = player_setting->equalizer;
-               break;
-       case OAL_REPEAT:
-               event_data->value = player_setting->repeat;
-               break;
-       case OAL_SHUFFLE:
-               event_data->value = player_setting->shuffle;
-               break;
-       case OAL_SCAN:
-               event_data->value = player_setting->scan;
-               break;
-       case OAL_PLAY_POSITION:
-               event_data->value = track_info->song_pos;
-               break;
-       default:
-               BT_ERR("Invalid Type [%d]", type);
-               g_free(event_data);
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       g_idle_add(__send_avrcp_property_event, (gpointer)event_data);
-       return OAL_STATUS_SUCCESS;
-}
-
-static gboolean __send_avrcp_play_status_event(gpointer data)
-{
-       event_avrcp_ct_play_status_t *event_data = (event_avrcp_ct_play_status_t *)data;
-
-       send_event(OAL_EVENT_AVRCP_CT_PLAY_STATUS,
-                       event_data, sizeof(event_avrcp_ct_play_status_t));
-
-       return FALSE;
-}
-
-oal_status_t avrcp_ct_get_play_status(bt_address_t *device_address)
-{
-       avrcp_ct_player_info_t *player_info;
-       avrcp_ct_player_settings_t *player_setting;
-       avrcp_ct_track_info_t *track_info;
-       event_avrcp_ct_play_status_t *event_data = NULL;
-
-       API_TRACE();
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-
-       player_info = __get_player_info_from_list(device_address);
-       if (!player_info) {
-               BT_ERR("Player info not found");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       player_setting = &player_info->player_setting;
-       track_info = &player_info->track_info;
-
-       event_data = g_new0(event_avrcp_ct_play_status_t, 1);
-       event_data->song_len = track_info->playing_time;
-       event_data->song_pos = track_info->song_pos;
-
-       switch (player_setting->status) {
-       case BTRC_PLAYSTATE_STOPPED:
-               event_data->play_status = OAL_PLAY_STATUS_STOPPED;
-               break;
-       case BTRC_PLAYSTATE_PLAYING:
-               event_data->play_status = OAL_PLAY_STATUS_PLAYING;
-               break;
-       case BTRC_PLAYSTATE_PAUSED:
-               event_data->play_status = OAL_PLAY_STATUS_PAUSED;
-               break;
-       case BTRC_PLAYSTATE_FWD_SEEK:
-               event_data->play_status = OAL_PLAY_STATUS_FWD_SEEK;
-               break;
-       case BTRC_PLAYSTATE_REV_SEEK:
-               event_data->play_status = OAL_PLAY_STATUS_REV_SEEK;
-               break;
-       default:
-               event_data->play_status = OAL_PLAY_STATUS_ERROR;
-               break;
-       }
-
-       g_idle_add(__send_avrcp_play_status_event, (gpointer)event_data);
-       return OAL_STATUS_SUCCESS;
-}
-
-static gboolean __send_media_attribute_event(gpointer data)
-{
-       event_avrcp_ct_media_info_t *event_data = (event_avrcp_ct_media_info_t *)data;
-
-       send_event(OAL_EVENT_AVRCP_CT_MEDIA_INFO,
-                       event_data, sizeof(event_avrcp_ct_media_info_t));
-
-       return FALSE;
-}
-
-oal_status_t avrcp_ct_get_media_attribute(bt_address_t *device_address)
-{
-       avrcp_ct_track_info_t *track_info;
-       event_avrcp_ct_media_info_t *event_data;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_CTRL_ENABLED();
-
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       track_info = __get_track_info(device_address);
-       if (!track_info) {
-               BT_ERR("Player info not found");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       event_data = g_new0(event_avrcp_ct_media_info_t, 1);
-       g_strlcpy((char *)event_data->title_info, (const char *)track_info->title_info,
-                               MEDIA_ATTIRBUTE_STRING_LENGTH);
-       g_strlcpy((char *)event_data->album_info, (const char *)track_info->album_info,
-                               MEDIA_ATTIRBUTE_STRING_LENGTH);
-       g_strlcpy((char *)event_data->genre_info, (const char *)track_info->genre_info,
-                               MEDIA_ATTIRBUTE_STRING_LENGTH);
-       g_strlcpy((char *)event_data->artist_info, (const char *)track_info->artist_info,
-                               MEDIA_ATTIRBUTE_STRING_LENGTH);
-       event_data->playing_time = (uint64_t)track_info->playing_time;
-       event_data->total_track = track_info->total_track;
-       event_data->track_number = track_info->track_number;
-
-       g_idle_add(__send_media_attribute_event, (gpointer)event_data);
-
-       return OAL_STATUS_SUCCESS;
-}
diff --git a/oal-avrcp-tg.c b/oal-avrcp-tg.c
deleted file mode 100644 (file)
index de9df0d..0000000
+++ /dev/null
@@ -1,769 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <dlog.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "bluetooth.h"
-#include "bt_rc.h"
-
-#include "oal-event.h"
-#include "oal-internal.h"
-#include "oal-common.h"
-#include "oal-manager.h"
-#include "oal-avrcp-tg.h"
-
-#define NUM_MEDIA_ATTR_MAX (BTRC_MEDIA_ATTR_PLAYING_TIME)
-
-#define CHECK_OAL_AVRCP_ENABLED() \
-       do { \
-               if (avrcp_api == NULL) { \
-                       BT_ERR("AVRCP Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-static void remove_pos_timer();
-
-#ifdef TIZEN_BT_HAL
-static void cb_connection_state(bt_bdaddr_t* bd_addr, btrc_connection_state_t state);
-#endif
-
-static void cb_avrcp_remote_features(bt_bdaddr_t* bd_addr, btrc_remote_features_t features);
-
-static void cb_avrcp_get_play_status();
-static void cb_avrcp_set_player_app_value(btrc_player_settings_t *p_vals, bt_bdaddr_t *bd_addr);
-static void cb_avrcp_get_element_attr(uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
-static void cb_avrcp_register_notification(btrc_event_id_t event_id, uint32_t param, bt_bdaddr_t *bd_addr);
-static void cb_avrcp_volume_change(uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
-static void cb_avrcp_delay_change(uint16_t delay, bt_bdaddr_t *bd_addr);
-static void cb_avrcp_passthrough_command(int id, int pressed, bt_bdaddr_t *bd_addr);
-
-typedef struct {
-       int play_status:1;
-       int track_change:1;
-       int track_end:1;
-       int track_start:1;
-       int pos_change:1;
-       int setting_change:1;
-       int interval;
-} notif_t;
-
-typedef struct {
-       int equalizer;
-       btrc_player_repeat_val_t repeat;
-       btrc_player_shuffle_val_t shuffle;
-       int scan;
-       btrc_play_status_t status;
-       unsigned int volume;
-} player_settings_t;
-
-typedef struct {
-       uint32_t song_pos;
-       uint32_t playing_time;
-       uint8_t title[BTRC_MAX_ATTR_STR_LEN];
-       uint8_t artist[BTRC_MAX_ATTR_STR_LEN];
-       uint8_t album[BTRC_MAX_ATTR_STR_LEN];
-       uint8_t genre[BTRC_MAX_ATTR_STR_LEN];
-       unsigned int num_tracks;
-       uint32_t cur_track;
-} track_info_t;
-
-typedef enum {
-       STATUS_STOPPED = 0x00,
-       STATUS_PLAYING,
-       STATUS_PAUSED,
-       STATUS_FORWARD_SEEK,
-       STATUS_REVERSE_SEEK,
-       STATUS_ERROR,
-       STATUS_INVALID
-} media_player_status;
-
-static track_info_t track_info;
-static player_settings_t player_setting;
-
-static guint send_pos_timer = 0;
-
-static notif_t registered_notifications;
-static const btrc_interface_t *avrcp_api;
-
-static btrc_callbacks_t sBluetoothAvrcpCallbacks = {
-       sizeof(sBluetoothAvrcpCallbacks),
-#ifdef TIZEN_BT_HAL
-       cb_connection_state,
-#endif
-       cb_avrcp_remote_features,
-       cb_avrcp_get_play_status,
-       NULL, /* cb_avrcp_list_player_app_attr, */
-       NULL, /* cb_avrcp_list_player_app_values, */
-       NULL, /* cb_avrcp_get_player_app_value, */
-       NULL, /* cb_avrcp_get_player_app_attrs_text, */
-       NULL, /* cb_avrcp_get_player_app_values_text, */
-       cb_avrcp_set_player_app_value,
-       cb_avrcp_get_element_attr,
-       cb_avrcp_register_notification,
-       cb_avrcp_volume_change,
-       cb_avrcp_delay_change,
-       cb_avrcp_passthrough_command,
-       NULL, /* cb_avrcp_set_addressed_player, */
-       NULL, /* cb_avrcp_set_browsed_player, */
-       NULL, /* cb_avrcp_get_folder_items, */
-       NULL, /* cb_avrcp_change_path, */
-       NULL, /* cb_avrcp_get_item_attr, */
-       NULL, /* cb_avrcp_play_item, */
-       NULL, /* cb_avrcp_get_total_num_of_items, */
-       NULL, /* cb_avrcp_search, */
-       NULL, /* cb_avrcp_add_to_now_playing, */
-};
-
-static void send_pos_changed(void)
-{
-       BT_DBG("Pos changed");
-
-       if (avrcp_api == NULL) {
-               BT_ERR("AVRCP Not Enabled");
-               return ;
-       }
-
-       if (registered_notifications.pos_change) {
-               int ret;
-               btrc_register_notification_t response;
-
-               BT_DBG("Song Pos: %d", track_info.song_pos);
-               response.song_pos = track_info.song_pos;
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_PLAY_POS_CHANGED, BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-
-               if (ret != BT_STATUS_SUCCESS)
-                       BT_ERR("Notif send failed: %s", status2string(ret));
-       }
-}
-
-static gboolean send_pos_timeout(gpointer  param)
-{
-       BT_DBG("pos timeout");
-
-       if (!registered_notifications.pos_change)
-               return FALSE;
-
-       send_pos_changed();
-
-       if (player_setting.status != BTRC_PLAYSTATE_PLAYING &&
-               player_setting.status != BTRC_PLAYSTATE_FWD_SEEK &&
-               player_setting.status != BTRC_PLAYSTATE_REV_SEEK)
-               return FALSE;
-
-       return TRUE;
-}
-
-static void remove_pos_timer()
-{
-
-       if (send_pos_timer > 0) {
-               g_source_remove(send_pos_timer);
-               send_pos_timer = 0;
-       }
-}
-
-static void send_track_boundary_reached(void)
-{
-       int ret = BT_STATUS_SUCCESS;
-
-       if (avrcp_api == NULL) {
-               BT_ERR("AVRCP Not Enabled");
-               return;
-       }
-
-       if (track_info.song_pos == 0 &&
-               registered_notifications.track_start)
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_TRACK_REACHED_START, BTRC_NOTIFICATION_TYPE_CHANGED, NULL);
-       else if ((track_info.playing_time == track_info.song_pos) &&
-                       registered_notifications.track_end) {
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_TRACK_REACHED_END, BTRC_NOTIFICATION_TYPE_CHANGED, NULL);
-       }
-
-       if (ret != BT_STATUS_SUCCESS)
-               BT_ERR("Notif send failed: %s", status2string(ret));
-}
-
-gboolean avrcp_tg_enable_state(void)
-{
-       if (avrcp_api == NULL)
-               return FALSE;
-       else
-               return TRUE;
-}
-
-oal_status_t avrcp_enable(void)
-{
-       const bt_interface_t * blued_api = NULL;
-       int ret;
-
-       API_TRACE();
-
-       /*TODO: Need to check below logic */
-#if 0
-       if (a2dp_sink_enable_state() == TRUE || avrcp_ct_enable_state() == TRUE) {
-               BT_ERR("AVRCP_CT Role Enabled, cannot enable AVRCP_TG Role");
-               return OAL_STATUS_BUSY;
-       }
-#endif
-
-       blued_api = adapter_get_stack_interface();
-       if (blued_api == NULL) {
-               BT_ERR("Stack is not initialized");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (avrcp_api) {
-               BT_WARN("avrcp tg Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       avrcp_api = (const btrc_interface_t *)blued_api->get_profile_interface(BT_PROFILE_AV_RC_ID);
-       if (avrcp_api == NULL) {
-               BT_ERR("AVRCP interface failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       memset(&registered_notifications, 0x00, sizeof(registered_notifications));
-       memset(&track_info, 0x00, sizeof(track_info));
-       memset(&player_setting, 0, sizeof(player_settings_t));
-
-       /* Handle failure if return value is anything other than Success or Already done */
-       ret = avrcp_api->init(&sBluetoothAvrcpCallbacks);
-       if (ret != BT_STATUS_SUCCESS && ret != BT_STATUS_DONE) {
-               BT_ERR("AVRCP Init failed %s", status2string(ret));
-               avrcp_api->cleanup();
-               avrcp_api = NULL;
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t avrcp_disable(void)
-{
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_ENABLED();
-
-       remove_pos_timer();
-       avrcp_api->cleanup();
-       avrcp_api = NULL;
-
-       return OAL_STATUS_SUCCESS;
-}
-
-void avrcp_tg_cleanup(void)
-{
-
-       BT_DBG();
-
-       remove_pos_timer();
-       avrcp_api = NULL;
-}
-
-oal_status_t avrcp_tg_connect(bt_address_t *rem_addr)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_ENABLED();
-       OAL_CHECK_PARAMETER(rem_addr, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(rem_addr, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       status = avrcp_api->connect((bt_bdaddr_t *)rem_addr);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("Connection could not be established, err: %s", status2string(status));;
-               result =  convert_to_oal_status(status);
-       }
-#else
-       BT_INFO("Not Supported");
-       result = OAL_STATUS_NOT_SUPPORT;
-#endif
-
-       return result;
-}
-
-oal_status_t avrcp_tg_disconnect(bt_address_t *rem_addr)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       bt_status_t status;
-
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_ENABLED();
-       OAL_CHECK_PARAMETER(rem_addr, return);
-
-       BT_INFO("BT Audio Address: %s", bdt_bd2str(rem_addr, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       status = avrcp_api->disconnect((bt_bdaddr_t *)rem_addr);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("OAL, Disconnection failed err: %s", status2string(status));
-               result =  convert_to_oal_status(status);
-       }
-#else
-       BT_INFO("Not Supported");
-       result = OAL_STATUS_NOT_SUPPORT;
-#endif
-
-       return result;
-}
-
-oal_status_t avrcp_set_track_info(oal_media_metadata_attributes_t *meta_data)
-{
-       API_TRACE();
-
-       CHECK_OAL_AVRCP_ENABLED();
-
-       retv_if(meta_data == NULL, OAL_STATUS_INTERNAL_ERROR);
-
-       /********* Update media attribs **********/
-       g_strlcpy((char*)track_info.title, meta_data->title, BTRC_MAX_ATTR_STR_LEN);
-       g_strlcpy((char*)track_info.artist, meta_data->artist, BTRC_MAX_ATTR_STR_LEN);
-       g_strlcpy((char*)track_info.album, meta_data->album, BTRC_MAX_ATTR_STR_LEN);
-       g_strlcpy((char*)track_info.genre, meta_data->genre, BTRC_MAX_ATTR_STR_LEN);
-
-       track_info.num_tracks = meta_data->total_tracks;
-       track_info.playing_time = meta_data->duration;
-
-       if (registered_notifications.track_change &&
-                       track_info.cur_track != meta_data->number) {
-               int ret;
-               btrc_register_notification_t response;
-
-               memset(&response, 0x00, sizeof(btrc_register_notification_t));
-
-               track_info.cur_track = meta_data->number;
-
-               /* Send Track Change notification */
-               memcpy(&response.track, &track_info.cur_track, sizeof(uint32_t));
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_TRACK_CHANGE, BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-               if (ret != BT_STATUS_SUCCESS)
-                       BT_ERR("Notif send failed: %s",  status2string(ret));
-
-               send_pos_changed();
-       }
-
-       track_info.cur_track = meta_data->number;
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t avrcp_set_property(int type, unsigned int value)
-{
-       btrc_register_notification_t response;
-       int ret;
-
-       API_TRACE("type: %d, value: %d", type, value);
-       CHECK_OAL_AVRCP_ENABLED();
-
-       switch (type) {
-       case AVRCP_EQUALIZER: {
-               if (value == player_setting.equalizer &&
-                       !registered_notifications.setting_change)
-                       break;
-
-               response.player_setting.num_attr = 1;
-               response.player_setting.attr_ids[0] = BTRC_PLAYER_ATTR_EQUALIZER;
-               response.player_setting.attr_values[0] = value;
-               ret = avrcp_api->register_notification_rsp(BTRC_EVT_APP_SETTINGS_CHANGED,
-                               BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-               if (ret != BT_STATUS_SUCCESS)
-                       BT_ERR("Notif send failed: %s", status2string(ret));
-
-               player_setting.equalizer = value;
-               break;
-       }
-       case AVRCP_REPEAT: {
-               if (value == player_setting.repeat &&
-                       !registered_notifications.setting_change)
-                       break;
-
-               response.player_setting.num_attr = 1;
-               response.player_setting.attr_ids[0] = BTRC_PLAYER_ATTR_REPEAT;
-               response.player_setting.attr_values[0] = value;
-               ret = avrcp_api->register_notification_rsp(BTRC_EVT_APP_SETTINGS_CHANGED,
-                               BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-               if (ret != BT_STATUS_SUCCESS)
-                       BT_ERR("Notif send failed: %s", status2string(ret));
-
-               player_setting.repeat = value;
-               break;
-       }
-       case AVRCP_SHUFFLE: {
-               if (value == player_setting.shuffle &&
-                       !registered_notifications.setting_change)
-                       break;
-
-               response.player_setting.num_attr = 1;
-               response.player_setting.attr_ids[0] = BTRC_PLAYER_ATTR_SHUFFLE;
-               response.player_setting.attr_values[0] = value;
-               ret = avrcp_api->register_notification_rsp(BTRC_EVT_APP_SETTINGS_CHANGED,
-                               BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-               if (ret != BT_STATUS_SUCCESS)
-                       BT_ERR("Notif send failed: %s", status2string(ret));
-
-               player_setting.shuffle = value;
-               break;
-       }
-       case AVRCP_SCAN: {
-               if (value == player_setting.scan &&
-                       !registered_notifications.setting_change)
-                       break;
-
-               response.player_setting.num_attr = 1;
-               response.player_setting.attr_ids[0] = BTRC_PLAYER_ATTR_SCAN;
-               response.player_setting.attr_values[0] = value;
-               ret = avrcp_api->register_notification_rsp(BTRC_EVT_APP_SETTINGS_CHANGED,
-                               BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-               if (ret != BT_STATUS_SUCCESS)
-                       BT_ERR("Notif send failed: %s", status2string(ret));
-
-               player_setting.scan = value;
-               break;
-       }
-       case AVRCP_STATUS:
-               if (value != player_setting.status) {
-                       btrc_play_status_t play_status = player_setting.status;
-
-                       player_setting.status = (value == STATUS_ERROR) ? BTRC_PLAYSTATE_ERROR : value;
-
-                       if (registered_notifications.play_status) {
-                               gboolean is_timer = FALSE;
-
-                               response.play_status = player_setting.status;
-                               ret = avrcp_api->register_notification_rsp(BTRC_EVT_PLAY_STATUS_CHANGED,
-                                               BTRC_NOTIFICATION_TYPE_CHANGED, &response);
-                               if (ret != BT_STATUS_SUCCESS)
-                                       BT_ERR("Notif send failed: %s", status2string(ret));
-
-                               /* Check if old and new status value are changed from NOT PLAYING to PLAYING */
-                               switch (play_status) {
-                               case BTRC_PLAYSTATE_ERROR:      /* Intentional fall-through */
-                               case BTRC_PLAYSTATE_STOPPED:    /* Intentional fall-through */
-                               case BTRC_PLAYSTATE_PAUSED:     /* Intentional fall-through */
-                                       if (STATUS_PLAYING == value ||
-                                                       STATUS_REVERSE_SEEK == value ||
-                                                       STATUS_FORWARD_SEEK == value) {
-                                               BT_INFO("Play status changed from stopped to playing");
-                                               is_timer = TRUE;
-                                       }
-                                       break;
-                               default:
-                                       is_timer = FALSE;
-                               }
-
-                               if (is_timer) {
-                                       BT_DBG("Player is playing mode, start sending pos change notifications");
-                                       remove_pos_timer();
-                                       send_pos_timer = g_timeout_add(registered_notifications.interval * 1000,
-                                                       send_pos_timeout, NULL);
-                               }
-                       }
-               }
-               break;
-       case AVRCP_POSITION:
-               if (value != track_info.song_pos) {
-                       track_info.song_pos = value;
-                       send_pos_changed();
-                       send_track_boundary_reached();
-               }
-               break;
-       default:
-               BT_ERR("Invalid Type\n");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-#ifdef TIZEN_BT_HAL
-static void cb_connection_state(bt_bdaddr_t* bd_addr, btrc_connection_state_t state)
-{
-       bt_address_t * event_data = NULL;
-       int event;
-
-       BT_DBG("%d", state);
-
-       event_data = g_new0(bt_address_t, 1);
-       memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       switch (state) {
-       case BTRC_CONNECTION_STATE_DISCONNECTED:
-               event = OAL_EVENT_AVRCP_DISCONNECTED;
-               break;
-       case BTRC_CONNECTION_STATE_CONNECTED:
-               event = OAL_EVENT_AVRCP_CONNECTED;
-               break;
-       default:
-               BT_ERR("Unhandled Connection state %d", state);
-               return;
-       }
-
-       send_event_bda_trace(event, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-
-}
-#endif
-
-static void cb_avrcp_remote_features(bt_bdaddr_t* bd_addr, btrc_remote_features_t features)
-{
-       remote_feature *avrcp_rem_feature = g_new0(remote_feature, 1);
-
-       /* Reset variables */
-       memset(&registered_notifications, 0, sizeof(notif_t));
-       memset(&track_info, 0, sizeof(track_info_t));
-       memset(&player_setting, 0, sizeof(player_settings_t));
-       player_setting.volume =  0xFFFFFFFF/2;
-
-       /* TODO: need to check if this feature mask is useful */
-       BT_INFO("Remore features Mask: 0x%x", features);
-
-       avrcp_rem_feature->avrcp_feature = features;
-       memcpy(avrcp_rem_feature->address.addr, bd_addr->address, 6);
-
-       send_event_bda_trace(OAL_EVENT_AVRCP_REMOTE_FEATURES,
-               avrcp_rem_feature, sizeof(remote_feature), (bt_address_t *)bd_addr);
-}
-
-static void cb_avrcp_get_play_status(bt_bdaddr_t *bd_addr)
-{
-       int ret;
-
-       BT_DBG("");
-
-       if (avrcp_api == NULL) {
-               BT_ERR("AVRCP Not Enabled");
-               return ;
-       }
-
-       ret = avrcp_api->get_play_status_rsp(bd_addr, player_setting.status,
-                       track_info.playing_time, track_info.song_pos);
-       if (ret != BT_STATUS_SUCCESS)
-               BT_ERR("Play Status send failed: %s", status2string(ret));
-}
-
-static void cb_avrcp_set_player_app_value(btrc_player_settings_t *p_vals, bt_bdaddr_t *bd_addr)
-{
-       int i;
-       uint8_t *value ;
-       oal_event_t event;
-
-       BT_DBG("");
-
-       for (i = 0; i < p_vals->num_attr; i++) {
-               event = 0xffff;
-
-               switch (p_vals->attr_ids[i]) {
-               case BTRC_PLAYER_ATTR_EQUALIZER:
-                       event = OAL_EVENT_AVRCP_SETTING_EQUALIZER_STATUS;
-                       break;
-               case BTRC_PLAYER_ATTR_REPEAT:
-                       event = OAL_EVENT_AVRCP_SETTING_REPEAT_STATUS;
-                       break;
-               case BTRC_PLAYER_ATTR_SHUFFLE:
-                       event = OAL_EVENT_AVRCP_SETTING_SHUFFLE_STATUS;
-                       break;
-               case BTRC_PLAYER_ATTR_SCAN:
-                       event = OAL_EVENT_AVRCP_SETTING_SCAN_STATUS;
-                       break;
-               default:
-                       BT_ERR("Inavlid attr id= %d", p_vals->attr_ids[i]);
-               }
-
-               if (event != 0xffff) {
-                       value = g_new0(uint8_t, 1);
-                       *value = p_vals->attr_values[i];
-                       send_event(event, value, sizeof(*value));
-               }
-       }
-}
-
-static void cb_avrcp_get_element_attr(uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr)
-{
-       btrc_element_attr_val_t *p_attrs_vals;
-       int ret;
-       int i;
-
-       if (avrcp_api == NULL) {
-               BT_ERR("AVRCP Not Enabled");
-               return;
-       }
-
-       if (p_attrs == NULL) {
-               BT_ERR("p_attrs is NULL");
-               return;
-       }
-
-       BT_DBG("num_attr: %d", num_attr);
-       p_attrs_vals = g_malloc0(num_attr * sizeof(btrc_element_attr_val_t));
-
-       for (i = 0; i < num_attr; i++) {
-               p_attrs_vals[i].attr_id = p_attrs[i];
-
-               switch (p_attrs[i]) {
-               case BTRC_MEDIA_ATTR_TITLE:
-                       g_strlcpy((char*)p_attrs_vals[i].text,
-                               (const char *)track_info.title, BTRC_MAX_ATTR_STR_LEN);
-                       break;
-               case BTRC_MEDIA_ATTR_ARTIST:
-                       g_strlcpy((char*)p_attrs_vals[i].text,
-                               (const char *)track_info.artist, BTRC_MAX_ATTR_STR_LEN);
-                       break;
-               case BTRC_MEDIA_ATTR_ALBUM:
-                       g_strlcpy((char*)p_attrs_vals[i].text,
-                               (const char *)track_info.album, BTRC_MAX_ATTR_STR_LEN);
-                       break;
-               case BTRC_MEDIA_ATTR_TRACK_NUM:
-                       snprintf((char*)p_attrs_vals[i].text, BTRC_MAX_ATTR_STR_LEN, "%u", track_info.cur_track);
-                       break;
-               case BTRC_MEDIA_ATTR_NUM_TRACKS:
-                       snprintf((char*)p_attrs_vals[i].text, BTRC_MAX_ATTR_STR_LEN, "%u", track_info.num_tracks);
-                       break;
-               case BTRC_MEDIA_ATTR_GENRE:
-                       g_strlcpy((char*)p_attrs_vals[i].text,
-                               (const char *)track_info.genre, BTRC_MAX_ATTR_STR_LEN);
-                       break;
-               case BTRC_MEDIA_ATTR_PLAYING_TIME:
-                       snprintf((char*)p_attrs_vals[i].text, BTRC_MAX_ATTR_STR_LEN, "%u", track_info.playing_time);
-                       break;
-               default:
-                       BT_ERR("Inavlid attr id= %d", p_attrs[i]);
-               }
-       }
-
-       ret = avrcp_api->get_element_attr_rsp(bd_addr, num_attr, p_attrs_vals);
-       if (ret != BT_STATUS_SUCCESS)
-               BT_ERR("Element attr send failed: %s", status2string(ret));
-
-       g_free(p_attrs_vals);
-}
-
-static void cb_avrcp_register_notification(btrc_event_id_t event_id, uint32_t param, bt_bdaddr_t *bd_addr)
-{
-       btrc_register_notification_t response;
-       int ret;
-
-       BT_DBG("event_id: 0x%x", event_id);
-
-       if (avrcp_api == NULL) {
-               BT_ERR("AVRCP Not Enabled");
-               return ;
-       }
-       memset(&response, 0x00, sizeof(btrc_register_notification_t));
-
-       switch (event_id) {
-       case BTRC_EVT_PLAY_STATUS_CHANGED:
-               registered_notifications.play_status = 1;
-               response.play_status = player_setting.status;
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_PLAY_STATUS_CHANGED, BTRC_NOTIFICATION_TYPE_INTERIM, &response);
-               break;
-       case BTRC_EVT_TRACK_CHANGE:
-               registered_notifications.track_change = 1;
-               memcpy(response.track, &track_info.cur_track, sizeof(uint32_t));
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_TRACK_CHANGE, BTRC_NOTIFICATION_TYPE_INTERIM, &response);
-               break;
-       case BTRC_EVT_TRACK_REACHED_END:
-               registered_notifications.track_end = 1;
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_TRACK_REACHED_END, BTRC_NOTIFICATION_TYPE_INTERIM, NULL);
-               break;
-       case BTRC_EVT_TRACK_REACHED_START:
-               registered_notifications.track_start = 1;
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_TRACK_REACHED_START, BTRC_NOTIFICATION_TYPE_INTERIM, NULL);
-               break;
-       case BTRC_EVT_PLAY_POS_CHANGED:
-               registered_notifications.pos_change = 1;
-               registered_notifications.interval = param;
-               BT_DBG("Pos will be notified every %d secs", param);
-               /*
-                * start a timer with value of interval and send rsp on each timer fire.
-                * Other then this in below situations also send the response:
-                *      - Change in Play status
-                *      - Change in current track
-                *      - Reach end or beginning of track
-                */
-               response.song_pos = track_info.song_pos;
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_PLAY_POS_CHANGED, BTRC_NOTIFICATION_TYPE_INTERIM, &response);
-               remove_pos_timer();
-               send_pos_timer = g_timeout_add(param * 1000, send_pos_timeout, NULL);
-               break;
-       case BTRC_EVT_APP_SETTINGS_CHANGED:
-               registered_notifications.setting_change = 1;
-               ret = avrcp_api->register_notification_rsp(
-                       BTRC_EVT_APP_SETTINGS_CHANGED, BTRC_NOTIFICATION_TYPE_INTERIM, &response);
-               break;
-       default:
-               BT_ERR("Invalid event id: 0x%x", event_id);
-               ret = BT_STATUS_FAIL;
-       }
-
-       if (ret != BT_STATUS_SUCCESS)
-               BT_ERR("Notif send failed: %s", status2string(ret));
-}
-
-static void cb_avrcp_volume_change(uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr)
-{
-
-       oal_avrcp_volume_mute_t *avrcp_volume_mute = g_new0(oal_avrcp_volume_mute_t, 1);
-
-       BT_INFO("volume: %d, ctype: %d", volume, ctype);
-       player_setting.volume = volume;
-
-       avrcp_volume_mute->volume = volume;
-       if (0 == volume)
-               avrcp_volume_mute->mute_status = TRUE;
-       else
-               avrcp_volume_mute->mute_status = FALSE;
-
-       send_event(OAL_EVENT_AVRCP_VOLUME_MUTE_CHANGED,
-                       avrcp_volume_mute, sizeof(oal_avrcp_volume_mute_t));
-}
-
-static void cb_avrcp_delay_change(uint16_t delay, bt_bdaddr_t *bd_addr)
-{
-       BT_INFO("Delay : %d", delay);
-       oal_avrcp_delay_t *avrcp_delay = g_new0(oal_avrcp_delay_t, 1);
-       avrcp_delay->delay = delay;
-
-       send_event(OAL_EVENT_AVRCP_DELAY_CHANGED,
-                       avrcp_delay, sizeof(oal_avrcp_delay_t));
-}
-
-static void cb_avrcp_passthrough_command(int id, int key_state, bt_bdaddr_t *bd_addr)
-{
-       BT_DBG("id: %d, key_state: %d", id, key_state);
-       //TODO: need to check
-}
diff --git a/oal-device-mgr.c b/oal-device-mgr.c
deleted file mode 100644 (file)
index b738711..0000000
+++ /dev/null
@@ -1,934 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <dlog.h>
-#include <string.h>
-
-#include <bluetooth.h>
-
-#include "oal-event.h"
-#include "oal-internal.h"
-#include "oal-common.h"
-#include "oal-manager.h"
-#include "oal-utils.h"
-#include "oal-device-mgr.h"
-
-static const bt_interface_t * blued_api;
-
-void device_mgr_init(const bt_interface_t * stack_if)
-{
-       blued_api = stack_if;
-}
-
-void device_mgr_cleanup(void)
-{
-       BT_DBG();
-       blued_api = NULL;
-}
-
-oal_status_t device_query_attributes(bt_address_t *addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->get_remote_device_properties((bt_bdaddr_t *)addr);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("get_remote_device_properties error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_query_services(bt_address_t * addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->get_remote_services((bt_bdaddr_t *)addr);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("get_remote_services error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_stop_query_sevices(bt_address_t * addr)
-{
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("Stop SDP search");
-       /* Currently no HAL Interface for Stopping Service Search */
-       return BT_STATUS_UNSUPPORTED;
-}
-
-oal_status_t device_set_alias(bt_address_t * addr, char * alias)
-{
-       int res;
-       bt_property_t prop;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-       OAL_CHECK_PARAMETER(addr, return);
-       OAL_CHECK_PARAMETER(alias, return);
-
-       API_TRACE("%s ->Alias: %s", bdt_bd2str(addr, &bdstr), alias);
-
-       prop.type = BT_PROPERTY_REMOTE_FRIENDLY_NAME;
-       prop.len = strlen(alias);
-       prop.val = alias;
-       res = blued_api->set_remote_device_property((bt_bdaddr_t*)addr, &prop);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set_remote_device_property error: [%s]", status2string(res));
-               BT_ERR("Alias: %s", alias);
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_create_bond(bt_address_t *addr, connection_type_e transport)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->create_bond((bt_bdaddr_t *)addr, transport);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("create_bond error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_destroy_bond(bt_address_t * addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->remove_bond((bt_bdaddr_t *)addr);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("remove_bond error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_stop_bond(bt_address_t * addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->cancel_bond((bt_bdaddr_t *)addr);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("cancel_bond error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_accept_pin_request(bt_address_t * addr, const char * pin)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-       OAL_CHECK_PARAMETER(pin, return);
-
-       API_TRACE("[%s] PIN: %s", bdt_bd2str(addr, &bdstr), pin);
-
-       res = blued_api->pin_reply((bt_bdaddr_t *)addr, TRUE, strlen(pin), (bt_pin_code_t *)pin);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("pin_reply error: [%s]", status2string(res));
-               BT_ERR("PIN: %s", pin);
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_reject_pin_request(bt_address_t * addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->pin_reply((bt_bdaddr_t *)addr, FALSE, 0, NULL);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("pin_reply error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_accept_passkey_entry(bt_address_t * addr, uint32_t passkey)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s] Passkey: %d", bdt_bd2str(addr, &bdstr), passkey);
-
-       res = blued_api->ssp_reply((bt_bdaddr_t *)addr, BT_SSP_VARIANT_PASSKEY_ENTRY, TRUE, passkey);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("ssp_reply error: [%s]", status2string(res));
-               BT_ERR("Passkey: %d", passkey);
-               return convert_to_oal_status(res);
-
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_reject_passkey_entry(bt_address_t * addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->ssp_reply((bt_bdaddr_t *)addr, BT_SSP_VARIANT_PASSKEY_ENTRY, FALSE, 0);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("ssp_reply error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_reply_passkey_confirmation(bt_address_t * addr, int accept)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s] accept: %d", bdt_bd2str(addr, &bdstr), accept);
-
-       res = blued_api->ssp_reply((bt_bdaddr_t *)addr, BT_SSP_VARIANT_PASSKEY_CONFIRMATION, accept, 0);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("ssp_reply error: [%s]", status2string(res));
-               BT_ERR("%d", accept);
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-
-}
-
-oal_status_t device_reply_ssp_consent(bt_address_t * addr, int accept)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s] %d", bdt_bd2str(addr, &bdstr), accept);
-
-       res = blued_api->ssp_reply((bt_bdaddr_t *)addr, BT_SSP_VARIANT_CONSENT, accept, 0);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("ssp_reply error: [%s]", status2string(res));
-               BT_ERR("%d", accept);
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_reply_auth_request(bt_address_t * addr, oal_service_t service_type, int accept, int always)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s] Accept: %d, always: %d, service_type: %d", bdt_bd2str(addr, &bdstr), accept, always, service_type);
-
-       res = blued_api->authorize_response((bt_bdaddr_t *)addr, service_type, accept, always);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("authorize_response error: [%s]", status2string(res));
-               BT_ERR("Accept: [%d], always: [%d], service_type: [%d]", accept, always, service_type);
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t device_set_authorized(bt_address_t * addr, int authorize)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s] %d", bdt_bd2str(addr, &bdstr), authorize);
-
-       res = blued_api->set_authorization((bt_bdaddr_t *)addr, authorize);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set_authorization error: [%s]", status2string(res));
-               BT_ERR("%d", authorize);
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-gboolean device_get_acl_conn_state(bt_address_t * addr)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-       res = blued_api->get_connection_state((bt_bdaddr_t *)addr);
-       BT_ERR("get_connection_state returned: [%s]", res ? "TRUE" : "FALSE");
-
-       return res;
-}
-
-gboolean device_get_svc_conn_state(bt_address_t * addr, oal_service_t svc_id)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s] %d", bdt_bd2str(addr, &bdstr), svc_id);
-
-#ifdef TIZEN_BT_HAL
-       res = blued_api->get_service_connection_state((bt_bdaddr_t *)addr, svc_id);
-#else
-       BT_ERR("Not supported");
-       res = FALSE;
-#endif
-       BT_ERR("get_service_connection_state returned: [%s]", res ? "TRUE" : "FALSE");
-
-       return res;
-}
-
-oal_status_t device_set_osp_server(oal_osp_server_type_e type, int enable)
-{
-       int res;
-       uint32_t server_type;
-
-       CHECK_OAL_INITIALIZED();
-
-       API_TRACE("type: %d", type);
-
-#ifdef TIZEN_BT_HAL
-       switch (type) {
-       case OAL_OSP_SERVER_OBEX:
-               server_type = BT_OSP_SERVER_OBEX;
-               break;
-       default:
-               BT_ERR("unknown type: %d", type);
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       res = blued_api->set_agent_osp_server(server_type, enable);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set_agent_osp_server error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-#else
-       BT_ERR("Not supported");
-       res = OAL_STATUS_NOT_SUPPORT;
-       return res;
-#endif
-}
-
-oal_status_t device_set_trust_profile(bt_address_t *addr, oal_trusted_profile_e profile, gboolean trust)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       res = blued_api->set_trusted_profile((bt_bdaddr_t *)addr, profile, (trust ? 1 : 0));
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("set_trusted_profile error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-#else
-       BT_ERR("Not supported");
-       res = OAL_STATUS_NOT_SUPPORT;
-       return res;
-#endif
-}
-
-oal_status_t device_get_trust_profile(bt_address_t *addr, oal_trusted_profile_e profile, unsigned int *trusted)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       res = blued_api->get_trusted_profile((bt_bdaddr_t *)addr, profile, trusted);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("get_trusted_profile error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-#else
-       BT_ERR("Not supported");
-       res = OAL_STATUS_NOT_SUPPORT;
-       return res;
-#endif
-}
-
-oal_status_t device_enable_rssi_monitoring(bt_address_t *addr, unsigned int link_type,
-               int low_threshold, int in_range_threshold, int high_threshold)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       res = blued_api->enable_rssi_monitoring((bt_bdaddr_t *)addr, link_type,
-                       low_threshold, in_range_threshold, high_threshold);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("enable_rssi_monitoring error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-#else
-       BT_ERR("Not supported");
-       res = OAL_STATUS_NOT_SUPPORT;
-       return res;
-#endif
-}
-
-oal_status_t device_get_connected_link_rssi_strength(bt_address_t *addr, unsigned int link_type)
-{
-       int res;
-       bdstr_t bdstr;
-
-       CHECK_OAL_INITIALIZED();
-
-       OAL_CHECK_PARAMETER(addr, return);
-
-       API_TRACE("[%s]", bdt_bd2str(addr, &bdstr));
-
-#ifdef TIZEN_BT_HAL
-       res = blued_api->get_connected_link_rssi_strength((bt_bdaddr_t *)addr, link_type);
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("get_connected_link_rssi_strength error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-#else
-       BT_ERR("Not supported");
-       res = OAL_STATUS_NOT_SUPPORT;
-       return res;
-#endif
-}
-
-oal_status_t device_enable_gap_auth_notifications(oal_gap_auth_type_e type, gboolean enable)
-{
-       int res;
-
-       CHECK_OAL_INITIALIZED();
-
-       API_TRACE("type: [%d], enable: %d", type, enable);
-
-#ifdef TIZEN_BT_HAL
-       res = blued_api->enable_gap_auth_notifications(type, (enable ? 1 : 0));
-       if (res != BT_STATUS_SUCCESS) {
-               BT_ERR("enable_gap_auth_notifications error: [%s]", status2string(res));
-               return convert_to_oal_status(res);
-       }
-
-       return OAL_STATUS_SUCCESS;
-#else
-       BT_ERR("Not supported");
-       res = OAL_STATUS_NOT_SUPPORT;
-       return res;
-#endif
-}
-
-void cb_device_properties(bt_status_t status, bt_bdaddr_t *bd_addr,
-               int num_properties, bt_property_t *properties)
-{
-       oal_event_t event;
-       gpointer event_data = NULL;
-       remote_device_t *dev_info;
-       ble_adv_data_t adv_info;
-       gsize size = 0;
-       bdstr_t bdstr;
-
-       BT_DBG("[%s]status: [%d] num properties [%d]", bdt_bd2str((bt_address_t*)bd_addr, &bdstr),
-                       status, num_properties);
-
-       dev_info = g_new0(remote_device_t, 1);
-       memcpy(dev_info->address.addr, bd_addr->address, 6);
-       parse_device_properties(num_properties, properties, dev_info, &adv_info);
-
-       if (num_properties == 0) {
-               BT_ERR("!!Unexpected!! num properties is 0 status [%d]", status);
-               /* It is possible that app called get bonded device info for a device
-                  which is not yet bonded or udner bonding, in such case, stack will return no properties.
-                  It is also possible that after bonding is done, BT MW attempted to fetch
-                  bonded device info, but due to internal stack error, 0 properties with status FAIL
-                  are received from stack. In such cases, simply send the event to BT MW
-                  and let it handle this event */
-               event_dev_properties_t *dev_props_event = g_new0(event_dev_properties_t, 1);
-               memcpy(&dev_props_event->device_info,
-                               dev_info, sizeof(remote_device_t));
-               event_data = dev_props_event;
-               event = OAL_EVENT_DEVICE_PROPERTIES;
-               size = sizeof(event_dev_properties_t);
-       } else if (num_properties == 1) {
-               /* For one particular property a dedicated event to be sent */
-               switch (properties[0].type) {
-               case BT_PROPERTY_BDNAME:
-                       event = OAL_EVENT_DEVICE_NAME;
-                       event_data = dev_info;
-                       send_event_trace(event, event_data, sizeof(remote_device_t),
-                               (bt_address_t*)bd_addr, "Name: %s", dev_info->name);
-                       return;
-               case BT_PROPERTY_UUIDS: {
-                       event_dev_services_t *services_info;
-                       bt_uuid_t *uuids = (bt_uuid_t *) properties[0].val;
-                       BT_INFO("Properties len [%d] event structure size [%d]", properties[0].len, sizeof(event_dev_services_t));
-
-                       services_info = g_malloc(sizeof(event_dev_services_t) + properties[0].len);
-                       services_info->address = dev_info->address;
-                       memcpy(services_info->service_list, uuids, properties[0].len);
-                       services_info->num = properties[0].len/sizeof(bt_uuid_t);
-                       BT_INFO("Number of UUID [%d]", services_info->num);
-                       event = OAL_EVENT_DEVICE_SERVICES;
-                       event_data = services_info;
-                       size = sizeof(event_dev_services_t) + properties[0].len;
-                       g_free(dev_info);
-                       break;
-               }
-               default:
-                       BT_ERR("Single Property [%d] not handled", properties[0].type);
-                       g_free(dev_info);
-                       return;
-               }
-       } else {
-               event_dev_properties_t *dev_props_event = g_new0(event_dev_properties_t, 1);
-               if (dev_info->type != DEV_TYPE_BREDR) {
-                       int i;
-
-                       BT_INFO("BLE Device");
-                       /* BLE Single or DUAL mode found, so it should have Adv data */
-                       dev_props_event->adv_len = adv_info.len;
-                       if (dev_props_event->adv_len > 0)
-                               memcpy(dev_props_event->adv_data,
-                                       adv_info.adv_data, adv_info.len);
-
-                       for (i = 0; i < dev_props_event->adv_len; i++)
-                               BT_INFO("Adv Data[%d] = [0x%x]",
-                                       i, dev_props_event->adv_data[i]);
-                       memcpy(&dev_props_event->device_info,
-                               dev_info, sizeof(remote_device_t));
-               } else {
-                       BT_INFO("BREDR type Device");
-                       memcpy(&dev_props_event->device_info,
-                               dev_info, sizeof(remote_device_t));
-               }
-
-               event_data = dev_props_event;
-               event = OAL_EVENT_DEVICE_PROPERTIES;
-               size = sizeof(event_dev_properties_t);
-       }
-
-       send_event_bda_trace(event, event_data, size, (bt_address_t*)bd_addr);
-}
-
-void cb_device_bond_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
-               bt_bond_state_t state)
-{
-       bt_address_t * address = g_new0(bt_address_t, 1);
-       oal_event_t event;
-       gsize size = 0;
-
-       BT_DBG("status: %d, state: %d", status, state);
-
-       memcpy(address->addr, bd_addr->address, 6);
-
-       switch (state) {
-       case BT_BOND_STATE_BONDED:
-               event = OAL_EVENT_DEVICE_BONDING_SUCCESS;
-               break;
-       case BT_BOND_STATE_NONE:
-               /* Reaches both when bonding removed or bonding cancelled */
-               if (BT_STATUS_SUCCESS != status) {
-                       event_dev_bond_failed_t * bond_fail_info = g_new0(event_dev_bond_failed_t, 1);
-                       bond_fail_info->status = convert_to_oal_status(status);
-                       bond_fail_info->address = *address;
-                       size = sizeof(event_dev_bond_failed_t);
-                       send_event_bda_trace(OAL_EVENT_DEVICE_BONDING_FAILED, bond_fail_info, size, (bt_address_t*)bd_addr);
-                       g_free(address);
-                       return;
-               } else
-                       event = OAL_EVENT_DEVICE_BONDING_REMOVED;
-               break;
-       case BT_BOND_STATE_BONDING:
-               g_free(address);
-               return;
-       default:
-               BT_ERR("Unexpected Bond state %d", state);
-               g_free(address);
-               return;
-       }
-       send_event_bda_trace(event, address, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-}
-
-void cb_device_acl_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
-               bt_acl_state_t state)
-{
-       event_dev_conn_status_t * conn_status = g_new0(event_dev_conn_status_t, 1);
-       //bt_address_t * address = g_new0(bt_address_t, 1);
-       oal_event_t event;
-       gsize size = 0;
-
-       BT_DBG("ACL State:%d, state: %d", status, state);
-
-       memcpy(conn_status->address.addr, bd_addr->address, 6);
-
-       if (BT_STATUS_SUCCESS != status) {
-               /* At present only timeout will cause non-success status, later we can add more */
-               conn_status->status = OAL_STATUS_CONN_TIMEOUT;
-               BT_ERR("ACL State Error:%d, state: %d", status, state);
-       } else
-               conn_status->status = OAL_STATUS_SUCCESS;
-
-       memcpy(conn_status->address.addr, bd_addr->address, 6);
-       switch (state) {
-       case BT_ACL_STATE_CONNECTED:
-               event = OAL_EVENT_DEVICE_ACL_CONNECTED;
-               conn_status->status = OAL_STATUS_SUCCESS;
-               break;
-       case BT_ACL_STATE_DISCONNECTED:
-               event = OAL_EVENT_DEVICE_ACL_DISCONNECTED;
-               break;
-       default:
-               BT_ERR("Unexpected ACL state %d", state);
-               g_free(conn_status);
-               return;
-       }
-
-       size = sizeof(event_dev_conn_status_t);
-       send_event_bda_trace(event, conn_status, size, (bt_address_t*)bd_addr);
-}
-
-#ifdef TIZEN_BT_HAL
-void cb_device_le_conn_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr,
-               bt_le_conn_state_t state)
-{
-       event_dev_conn_status_t * conn_status = g_new0(event_dev_conn_status_t, 1);
-       //bt_address_t * address = g_new0(bt_address_t, 1);
-       oal_event_t event;
-       gsize size = 0;
-
-       BT_DBG("LE conn status:%d, state: %d", status, state);
-       memcpy(conn_status->address.addr, bd_addr->address, 6);
-       if (BT_STATUS_SUCCESS != status)
-               /* At present only timeout will cause non-success status, later we can add more */
-               conn_status->status = OAL_STATUS_CONN_TIMEOUT;
-       else
-               conn_status->status = OAL_STATUS_SUCCESS;
-
-       switch (state) {
-       case BT_LE_CONN_STATE_CONNECTED:
-               event = OAL_EVENT_DEVICE_LE_CONNECTED;
-               break;
-       case BT_LE_CONN_STATE_DISCONNECTED:
-               event = OAL_EVENT_DEVICE_LE_DISCONNECTED;
-               break;
-       default:
-               BT_ERR("Unexpected ACL state %d", state);
-               g_free(conn_status);
-               return;
-       }
-
-       size = sizeof(event_dev_conn_status_t);
-       send_event_bda_trace(event, conn_status, size, (bt_address_t*)bd_addr);
-}
-#endif
-
-void cb_device_pin_request(bt_bdaddr_t *bd_addr, bt_bdname_t *bdname, uint32_t device_class)
-{
-       remote_device_t * dev_info = g_new0(remote_device_t, 1);
-       gsize size = 0;
-       BT_DBG("+");
-
-       memcpy(dev_info->address.addr, bd_addr->address, 6);
-       g_strlcpy(dev_info->name, (const gchar *)bdname->name, BT_DEVICE_NAME_LENGTH_MAX);
-       dev_info->cod = device_class;
-       size = sizeof(remote_device_t);
-
-       send_event_bda_trace(OAL_EVENT_DEVICE_PIN_REQUEST, dev_info, size, (bt_address_t*)bd_addr);
-}
-
-void cb_device_ssp_request(bt_bdaddr_t *bd_addr, bt_bdname_t *bdname, uint32_t device_class,
-               bt_ssp_variant_t pairing_variant, uint32_t pass_key)
-{
-       oal_event_t event;
-       gpointer event_data = NULL;
-       gsize size = 0;
-       BT_DBG("+");
-
-       switch (pairing_variant) {
-       case BT_SSP_VARIANT_PASSKEY_ENTRY:
-       {
-               remote_device_t * dev_info = g_new0(remote_device_t, 1);
-               memcpy(dev_info->address.addr, bd_addr->address, 6);
-                       g_strlcpy(dev_info->name, (const gchar *)bdname->name, BT_DEVICE_NAME_LENGTH_MAX);
-               dev_info->cod = device_class;
-               event = OAL_EVENT_DEVICE_PASSKEY_ENTRY_REQUEST;
-               event_data = dev_info;
-               size = sizeof(remote_device_t);
-               break;
-       }
-       case BT_SSP_VARIANT_PASSKEY_NOTIFICATION:
-       {
-               event_dev_passkey_t * passkey_data = g_new0(event_dev_passkey_t, 1);
-
-               memcpy(passkey_data->device_info.address.addr, bd_addr->address, 6);
-                       g_strlcpy(passkey_data->device_info.name, (const gchar *)bdname->name, BT_DEVICE_NAME_LENGTH_MAX);
-               passkey_data->device_info.cod = device_class;
-               passkey_data->pass_key = pass_key;
-               event = OAL_EVENT_DEVICE_PASSKEY_DISPLAY;
-               event_data = passkey_data;
-               size = sizeof(event_dev_passkey_t);
-               break;
-       }
-       case BT_SSP_VARIANT_PASSKEY_CONFIRMATION:
-       {
-               event_dev_passkey_t * passkey_data = g_new0(event_dev_passkey_t, 1);
-
-               memcpy(passkey_data->device_info.address.addr, bd_addr->address, 6);
-                               g_strlcpy(passkey_data->device_info.name, (const gchar *)bdname->name, BT_DEVICE_NAME_LENGTH_MAX);
-               passkey_data->device_info.cod = device_class;
-               passkey_data->pass_key = pass_key;
-               event = OAL_EVENT_DEVICE_PASSKEY_CONFIRMATION_REQUEST;
-               event_data = passkey_data;
-               size = sizeof(event_dev_passkey_t);
-               break;
-       }
-       case BT_SSP_VARIANT_CONSENT:
-       {
-               remote_device_t * dev_info = g_new0(remote_device_t, 1);
-
-               memcpy(dev_info->address.addr, bd_addr->address, 6);
-                       g_strlcpy(dev_info->name, (const gchar *)bdname->name, BT_DEVICE_NAME_LENGTH_MAX);
-               dev_info->cod = device_class;
-               event = OAL_EVENT_DEVICE_SSP_CONSENT_REQUEST;
-               event_data = dev_info;
-               size = sizeof(remote_device_t);
-               break;
-       }
-       default:
-       {
-               BT_ERR("Unhandled SSP request [%d]", pairing_variant);
-               return;
-       }
-       }
-       send_event_bda_trace(event, event_data, size, (bt_address_t*)bd_addr);
-}
-
-void cb_device_authorize_request(bt_bdaddr_t *bd_addr, bt_service_id_t service_d)
-{
-       event_dev_authorize_req_t * auth_req = g_new0(event_dev_authorize_req_t, 1);
-
-       BT_INFO("service_d: %d", service_d);
-       memcpy(auth_req->address.addr, bd_addr->address, 6);
-       auth_req->service_id = service_d;
-
-       send_event_bda_trace(OAL_EVENT_DEVICE_AUTHORIZE_REQUEST, auth_req, sizeof(event_dev_authorize_req_t), (bt_address_t*)bd_addr);
-}
-
-void cb_device_trust_state_changed(bt_bdaddr_t *bd_addr, bt_device_trust_state_t trusted)
-{
-       oal_event_t event;
-       event_dev_trust_t * trust_val = g_new0(event_dev_trust_t, 1);
-
-       if (trusted == BT_DEVICE_TRUSTED) {
-               BT_INFO("Device is Trusted");
-               event = OAL_EVENT_DEVICE_TRUSTED;
-       } else {
-               BT_INFO("Device is Un Trusted");
-               event = OAL_EVENT_DEVICE_UNTRUSTED;
-       }
-       memcpy(trust_val->address.addr, bd_addr->address, 6);
-       trust_val->status = OAL_STATUS_SUCCESS;
-       send_event_bda_trace(event, trust_val, sizeof(event_dev_trust_t), (bt_address_t*)bd_addr);
-}
-
-#ifdef TIZEN_BT_HAL
-void cb_socket_conn_authorize_request(bt_bdaddr_t *bd_addr, bt_uuid_t *uuid)
-{
-       event_socket_authorize_req_t *auth_req = g_new0(event_socket_authorize_req_t, 1);
-
-       memcpy(auth_req->address.addr, bd_addr->address, 6);
-       memcpy(auth_req->uuid.uuid, uuid->uu, 16);
-
-       send_event_bda_trace(OAL_EVENT_SOCKET_AUTHORIZE_REQUEST, auth_req, sizeof(event_socket_authorize_req_t), (bt_address_t*)bd_addr);
-}
-
-void cb_device_trusted_profiles_changed(bt_bdaddr_t *bd_addr, uint32_t trust_val)
-{
-       event_device_trusted_profiles_t *ev = g_new0(event_device_trusted_profiles_t, 1);
-
-       BT_DBG("+");
-
-       memcpy(ev->address.addr, bd_addr->address, 6);
-       ev->trust_val = trust_val;
-       send_event_bda_trace(OAL_EVENT_DEVICE_TRUSTED_PROFILES_CHANGED,
-                       ev, sizeof(event_device_trusted_profiles_t), (bt_address_t*)bd_addr);
-       BT_DBG("-");
-}
-
-void cb_rssi_monitor_state_changed(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state)
-{
-       event_dev_rssi_info_t *ev = g_new0(event_dev_rssi_info_t, 1);
-       oal_event_t event = OAL_EVENT_RSSI_MONITORING_ENABLED;
-
-       BT_DBG("+");
-
-       memcpy(ev->address.addr, bd_addr->address, 6);
-       ev->link_type = link_type;
-       if (0 == state)
-               event = OAL_EVENT_RSSI_MONITORING_DISABLED;
-
-       send_event_bda_trace(event, ev, sizeof(event_dev_rssi_info_t), (bt_address_t*)bd_addr);
-
-       BT_DBG("-");
-}
-
-void cb_rssi_alert(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi)
-{
-       event_dev_rssi_info_t *ev = g_new0(event_dev_rssi_info_t, 1);
-
-       BT_DBG("+");
-
-       memcpy(ev->address.addr, bd_addr->address, 6);
-       ev->link_type = link_type;
-       ev->alert_type = alert_type;
-       ev->rssi = rssi;
-
-       send_event_bda_trace(OAL_EVENT_RSSI_ALERT_RECEIVED,
-                       ev, sizeof(event_dev_rssi_info_t), (bt_address_t*)bd_addr);
-       BT_DBG("-");
-}
-
-void cb_raw_rssi_received(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi)
-{
-       event_dev_rssi_info_t *ev = g_new0(event_dev_rssi_info_t, 1);
-
-       BT_DBG("+");
-
-       memcpy(ev->address.addr, bd_addr->address, 6);
-       ev->link_type = link_type;
-       ev->rssi = rssi;
-
-       send_event_bda_trace(OAL_EVENT_RAW_RSSI_RECEIVED,
-                       ev, sizeof(event_dev_rssi_info_t), (bt_address_t*)bd_addr);
-       BT_DBG("-");
-}
-#endif
diff --git a/oal-gatt.c b/oal-gatt.c
deleted file mode 100644 (file)
index 4cb4f8e..0000000
+++ /dev/null
@@ -1,1990 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <dlog.h>
-#include <bluetooth.h>
-#include "bt_gatt.h"
-#include "oal-event.h"
-#include "oal-internal.h"
-#include "oal-manager.h"
-#include "oal-adapter-mgr.h"
-#include "oal-utils.h"
-#include "oal-gatt.h"
-#include "oal-common.h"
-
-#define DEV_APPEARANCE  0x0000
-#define DEFAULT_GATT_CLIENT_UUID "0000A00A-1111-1111-0123-456789ABCDEF"
-#define MAX_PROP_LEN 95 /* SVACE WGID: 324403*/
-#define MAX_PERM_LEN 80 //Fix for svace wgid:324402
-
-#define NUM_SERVER_INST 10 // Maximum slots supported by stack is set to 10
-#define CHECK_OAL_GATT_ENABLED() \
-       do { \
-               if (gatt_api == NULL) { \
-                       BT_ERR("GATT Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-#define CHECK_SERVER_INSTANCE(instance_id) \
-       do { \
-               if (instance_id < 1 || instance_id > NUM_SERVER_INST) { \
-                       BT_ERR("Invalid Instance"); \
-                       return OAL_STATUS_INVALID_PARAM; \
-               } \
-       } while (0)
-
-#define CHECK_SERVER_REGISTRATION(instance_id) \
-       do { \
-               if (gatt_servers[instance_id - 1].server_id < 0)  {\
-                       BT_INFO("GATT server registeration is not done for server Instance : %d", instance_id);\
-                       return OAL_STATUS_INTERNAL_ERROR;\
-               } \
-       } while (0)
-
-#define CHECK_CORRECT_SERVER_ID(instance_id, server_if, server_inst)\
-       do { \
-               for (instance_id = 1 ; instance_id <= NUM_SERVER_INST; instance_id++) { \
-                       if (gatt_servers[instance_id - 1].server_id == server_if) { \
-                               server_inst = instance_id; \
-                               goto sendevent;\
-                       } \
-               } \
-       } while (0)
-
-#define PRINT_ADV_DATA(length, manuf_data, data_type) \
-       do { \
-               char * buf_str = g_malloc0(3*length + 1);\
-               if (NULL != buf_str) { \
-                       convert_hex_2_str(manuf_data, length, buf_str);\
-                       if (TRUE == data_type) \
-                       BT_INFO("Scan Response Data:%s\n", buf_str);\
-                       else \
-                       BT_INFO("Advertising Data:%s\n", buf_str);\
-                       g_free(buf_str);\
-               } \
-       } while (0)
-
-#define CHECK_CLIENT_REGISTRATION(client_id) \
-       do { \
-               if (client_id <= 0) { \
-                       BT_DBG("No client registered yet...");\
-                       return OAL_STATUS_INTERNAL_ERROR;\
-               } \
-       } while (0)
-
-#define CHECK_CLIENT_CONNECTION(conn_id) \
-       do { \
-               if (conn_id <= 0) {\
-                       BT_ERR("No active connection");\
-                       return OAL_STATUS_INTERNAL_ERROR;\
-               } \
-       } while (0)
-
-
-typedef enum {
-       GATT_INS_DISABLED,
-       GATT_INS_DATA_SETTING,
-       GATT_INS_DATA_SET,
-       GATT_INS_ENABLING,
-       GATT_INS_ENABLED,
-} gatt_data_state;
-
-typedef struct {
-       int server_id;
-       oal_uuid_t uuid;
-       int state;
-} gatt_server_t;
-
-const char *oal_device_type[] = {
-       "UNKNOWN",
-       "BR/EDR",
-       "BLE",
-       "DUAL_MODE",
-};
-
-typedef enum {
-       OAL_REQ_NONE,
-       OAL_REQ_LE_SCAN,
-       OAL_REQ_LE_CONNECT,
-} oal_pending_gattc_req_e;
-
-static const btgatt_interface_t * gatt_api;
-static gboolean cur_adv_state[NUM_SERVER_INST];
-static gatt_server_t gatt_servers[NUM_SERVER_INST];
-
-/* Forward declarations of GATT Server callbacks */
-static void cb_gatts_register_app(int status, int server_if, bt_uuid_t *uuid);
-static void cb_gatts_multi_adv_enable(int server_if, int status);
-static void cb_gatts_multi_adv_set_inst_data(int server_if, int status);
-static void cb_gatts_multi_adv_disable(int server_if, int status);
-static void cb_gatts_multi_adv_update(int server_if, int status);
-
-static void cb_gatts_listen(int status, int server_if);
-
-
-static void cb_gatts_service_added(int status, int server_if, btgatt_srvc_id_t *srvc_id, int srvc_handle);
-static void cb_gatts_included_service_added(int status, int server_if, int srvc_handle, int incl_srvc_handle);
-static void cb_gatts_characteristic_added(int status, int server_if, bt_uuid_t *char_id, int srvc_handle, int char_handle);
-static void cb_gatts_descriptor_added(int status, int server_if, bt_uuid_t *descr_id, int srvc_handle, int descr_handle);
-
-static void cb_gatts_service_started(int status, int server_if, int srvc_handle);
-static void cb_gatts_service_stopped(int status, int server_if, int srvc_handle);
-static void cb_gatts_service_deleted(int status, int server_if, int srvc_handle);
-
-static void cb_gatts_request_read(int conn_id, int trans_id, bt_bdaddr_t *bda, int attr_handle, int offset, bool is_long);
-static void cb_gatts_request_write(int conn_id, int trans_id, bt_bdaddr_t *bda, int attr_handle, int offset, int length,
-                                       bool need_rsp, bool is_prep, uint8_t* value);
-static void cb_gatts_response_confirmation(int status, int handle);
-
-static void cb_indication_confirmation(int conn_id, int trans_id, int attr_handle, bt_bdaddr_t *bda);
-static void cb_gatts_connection(int conn_id, int server_if, int connected, bt_bdaddr_t *bda);
-
-static void cb_gatts_mtu_changed(int conn_id, int mtu);
-
-#ifdef TIZEN_BT_HAL
-static void cb_notifcation_changed(int conn_id, int trans_id, int attr_handle, bool notify,  bt_bdaddr_t *bda);
-#endif
-
-/************************************HAL Interface *************************************/
-
-/*TODO GATT Server callbacks will be implemented in subsequent patches */
-static const btgatt_server_callbacks_t btgatt_server_callbacks = {
-       cb_gatts_register_app,
-       cb_gatts_connection,
-       cb_gatts_service_added,
-       cb_gatts_included_service_added,
-       cb_gatts_characteristic_added,
-       cb_gatts_descriptor_added,
-       cb_gatts_service_started,
-       cb_gatts_service_stopped,
-       cb_gatts_service_deleted,
-       cb_indication_confirmation,
-       cb_gatts_request_read,
-       cb_gatts_request_write,
-       NULL, /*cb_gatts_request_exec_write,*/
-       cb_gatts_response_confirmation,
-       cb_gatts_listen,
-       cb_gatts_multi_adv_enable,
-       cb_gatts_multi_adv_update,
-       cb_gatts_multi_adv_set_inst_data,
-       cb_gatts_multi_adv_disable,
-       cb_gatts_mtu_changed,
-#ifdef TIZEN_BT_HAL
-       cb_notifcation_changed,
-#endif
-};
-
-/* Forward declaration for GATT client callbacks */
-static void cb_gattc_register_app(int status, int clientIf, bt_uuid_t *app_uuid);
-static void cb_gattc_scan_result(bt_bdaddr_t* bdaddress, int rssi, uint8_t *adv_data);
-static void cb_gattc_connection(int conn_id, int status, int client_if, bt_bdaddr_t* bda);
-static void cb_gattc_disconnect(int conn_id, int status, int client_if, bt_bdaddr_t* bda);
-static void cb_gattc_search_result(int conn_id, btgatt_srvc_id_t *srvc_id);
-static void cb_gattc_search_complete(int conn_id, int status);
-static void cb_gattc_get_characteristics(int conn_id, int status, btgatt_srvc_id_t *srvc_id,
-                                               btgatt_gatt_id_t *char_id, int char_prop);
-static void cb_gattc_get_descriptor(int conn_id, int status, btgatt_srvc_id_t *srvc_id,
-                               btgatt_gatt_id_t *char_id, btgatt_gatt_id_t *descr_id);
-static void cb_gattc_read_characteristic(int conn_id, int status, btgatt_read_params_t *p_data);
-static void cb_gattc_read_descriptor(int conn_id, int status, btgatt_read_params_t *p_data);
-static void cb_gattc_write_characteristic(int conn_id, int status, btgatt_write_params_t *p_data);
-static void cb_gattc_write_descriptor(int conn_id, int status, btgatt_write_params_t *p_data);
-static void cb_gattc_register_for_notification(int conn_id, int registered, int status,
-                       btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id);
-
-/*TODO GATT CLient callbacks will be implemented in subsequent patches */
-static const btgatt_client_callbacks_t btgatt_client_callbacks = {
-       cb_gattc_register_app,
-       cb_gattc_scan_result,
-       cb_gattc_connection, /*cb_gattc_connection*/
-       cb_gattc_disconnect, /*cb_gattc_disconnect*/
-       cb_gattc_search_complete, /*cb_gattc_search_complete*/
-       cb_gattc_search_result, /*cb_gattc_search_result*/
-       cb_gattc_get_characteristics, /*cb_gattc_get_characteristics*/
-       cb_gattc_get_descriptor, /*cb_gattc_get_descriptor*/
-       NULL, /*cb_gattc_get_included_service*/
-       cb_gattc_register_for_notification, /*cb_gattc_register_for_notification*/
-       NULL, /*cb_gattc_notify*/
-       cb_gattc_read_characteristic, /*cb_gattc_read_characteristic*/
-       cb_gattc_write_characteristic, /*cb_gattc_write_characteristic*/
-       cb_gattc_read_descriptor, /*cb_gattc_read_descriptor*/
-       cb_gattc_write_descriptor, /*cb_gattc_write_descriptor*/
-       NULL, /*cb_gattc_execute_write*/
-       NULL, /*cb_gattc_remote_rssi*/
-       NULL, /*cb_gattc_configure_mtu_cmpl*/
-#ifdef PLATFORM_ANDROID_HAL
-       NULL, /*cb_scan_filter_cfg*/
-       NULL, /*cb_scan_filter_param*/
-       NULL, /*cb_scan_filter_status*/
-       NULL, /*cb_congestion*/
-       NULL, /*cb_batchscan_cfg_storag*/
-       NULL, /*cb_batchscan_enb_disable*/
-       NULL, /*cb_batchscan_reports*/
-       NULL, /*cb_batchscan_threshold*/
-       NULL, /*cb_track_adv_event*/
-#endif
-};
-
-static btgatt_callbacks_t btgatt_callbacks = {
-       sizeof(btgatt_callbacks_t),
-       &btgatt_client_callbacks,
-       &btgatt_server_callbacks
-};
-
-/*******************************GATT Initialisation - Deinitialisation********************************/
-oal_status_t gatt_enable(void)
-{
-       const bt_interface_t * blued_api;
-       int ret;
-       int i = 0;
-
-       for (i = 0; i < NUM_SERVER_INST; i++) {
-               gatt_servers[i].server_id = -1;
-               gatt_servers[i].state = GATT_INS_DISABLED;
-               memset(&gatt_servers[i].uuid, 0, sizeof(oal_uuid_t));
-               cur_adv_state[i] = FALSE;
-       }
-
-       /* Get stack interface */
-       blued_api = (const bt_interface_t *) adapter_get_stack_interface();
-
-       if (blued_api == NULL) {
-               BT_ERR("Stack is not initialized");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (gatt_api) {
-               BT_WARN("GATT Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       gatt_api = (const btgatt_interface_t *)blued_api->get_profile_interface(BT_PROFILE_GATT_ID);
-       if (gatt_api == NULL) {
-               BT_ERR("GATT interface failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       if ((ret = gatt_api->init(&btgatt_callbacks)) != BT_STATUS_SUCCESS) {
-               BT_ERR("Error: Unable to initialise GATT :%s", status2string(ret));
-               gatt_api->cleanup();
-               gatt_api = NULL;
-               return convert_to_oal_status(ret);
-       }
-
-       BT_INFO("GATT successfully initialized");
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatt_disable(void)
-{
-       int i;
-       if (gatt_api) {
-               gatt_api->cleanup();
-               gatt_api = NULL;
-       }
-
-       for (i = 0; i < NUM_SERVER_INST; i++) {
-               gatt_servers[i].server_id = -1;
-               gatt_servers[i].state = GATT_INS_DISABLED;
-               memset(&gatt_servers[i].uuid, 0, sizeof(oal_uuid_t));
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-/************************************GATT Server Functions*************************************/
-/*Public */
-oal_status_t gatts_register(oal_uuid_t* server_uuid)
-{
-       char str[2*BT_UUID_STRING_MAX];
-       int ret = OAL_STATUS_SUCCESS;
-       int i;
-
-       CHECK_OAL_GATT_ENABLED();
-       uuid_to_stringname((service_uuid_t*)server_uuid->uuid, str);
-       API_TRACE("Register the server instance: UUID: [%s]", str);
-
-       for (i = 0; i < NUM_SERVER_INST; i++) {
-               if (memcmp(server_uuid->uuid, gatt_servers[i].uuid.uuid, sizeof(oal_uuid_t)) == 0) {
-                       if (gatt_servers[i].server_id != -1) {
-                               BT_ERR("This is resevered UUID for easy set up application i = %d \
-                                               gatt_servers[i].server_id = %d", i, gatt_servers[i].server_id);
-                               return OAL_STATUS_ALREADY_DONE;
-                       }
-               }
-       }
-
-       ret = gatt_api->server->register_server((bt_uuid_t*)server_uuid);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT server registration with UUID:%s failed: %s", str, status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_unregister(int instance_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Unregister the registered server, instance_id: %d", instance_id);
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       ret = gatt_api->server->unregister_server(gatt_servers[instance_id - 1].server_id);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT server unregistration failed: %d", instance_id);
-               return convert_to_oal_status(ret);
-       }
-
-       gatt_servers[instance_id-1].server_id = -1;
-       gatt_servers[instance_id-1].state = GATT_INS_DISABLED;
-
-       if (instance_id != 1 && instance_id != 2)
-               memset(&gatt_servers[instance_id-1].uuid, 0, sizeof(oal_uuid_t));
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/* Legacy Advertisement */
-oal_status_t gatts_start_listen(int instance_id, gboolean enable)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("server-id:%d enable: %d", gatt_servers[instance_id-1].server_id, enable);
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       ret = gatt_api->server->listen(gatt_servers[instance_id-1].server_id, enable);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Error:Advertising start/stop on server-id:%d failed With Status: [%s]",
-                               gatt_servers[instance_id-1].server_id, status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_stop_advertising(int instance_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Stop advertising");
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       ret = gatt_api->server->listen(gatt_servers[instance_id - 1].server_id, FALSE);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Stop Advertising failed for server Instance:%d With Status: %s",
-                       instance_id, status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-#if 0
-/* Below API's need to be removed as they are hardcoded API's.
-   If at all, product specific API's are required to set specific data, then new naming should
-   be adopted for these API's */
-oal_status_t gatts_set_advertising_params(int instance_id, float min_intv, float max_intv)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Set advertising params min_int:%f, max_int:%f", min_intv, max_intv);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       /* Historically used for Legacy Advertising */
-       return OAL_STATUS_NOT_SUPPORT;
-}
-
-oal_status_t gatts_set_advertising_data(int instance_id, uint16_t manufac_len, char* manufac_data)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Set advertising data");
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       /* Historically used for Legacy Advertising */
-       return OAL_STATUS_NOT_SUPPORT;
-}
-
-oal_status_t gatts_set_scan_response(int instance_id, uint16_t manufac_len, char* manufac_data)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Set Scan Response data");
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       /* Historically used for Legacy Advertising */
-       return OAL_STATUS_NOT_SUPPORT;
-}
-#endif
-
-oal_status_t gatts_multi_adv_enable(int instance_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Start Multi advertising, srv_if: %d, instance_id: %d",
-                       gatt_servers[instance_id - 1].server_id, instance_id);
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (gatt_api->server->multi_adv_enable == NULL)
-               return OAL_STATUS_NOT_SUPPORT;
-
-/* Platform Requirement: Advertising to be enabled even when no data is set: i.e Empty Advertisement
-       if (gatt_servers[instance_id - 1].state != GATT_INS_DATA_SET){
-               BT_ERR("Not allowed, state: %d, instance_id: %d",
-                               gatt_servers[instance_id - 1].state, instance_id);
-               return OAL_STATUS_BUSY;
-       }
-*/
-       if (gatt_servers[instance_id - 1].state == GATT_INS_ENABLED) {
-               BT_ERR("Not allowed, state: %d, instance_id: %d",
-                               gatt_servers[instance_id - 1].state, instance_id);
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       if (gatt_servers[instance_id - 1].state == GATT_INS_ENABLING) {
-               BT_ERR("Not allowed, state: %d, instance_id: %d",
-                               gatt_servers[instance_id - 1].state, instance_id);
-               return OAL_STATUS_BUSY;
-       }
-
-       gatt_servers[instance_id - 1].state = GATT_INS_ENABLING;
-
-       ret = gatt_api->server->multi_adv_enable(gatt_servers[instance_id - 1].server_id);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT enable multi advertising failed for server Instance: %d With Status: %s",
-                               instance_id, status2string(ret));
-//             gatt_servers[instance_id - 1].state = GATT_INS_DATA_SET;
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_multi_adv_disable(int instance_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Stop Multi advertising, srv_if: %d, instance_id: %d",
-                       gatt_servers[instance_id - 1].server_id, instance_id);
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (gatt_api->server->multi_adv_disable == NULL)
-               return OAL_STATUS_NOT_SUPPORT;
-
-       if ((gatt_servers[instance_id - 1].state != GATT_INS_ENABLED)) {
-               BT_ERR("Not Allowed, state: %d, instance_id: %d",
-                       gatt_servers[instance_id - 1].state, instance_id);
-               return OAL_STATUS_BUSY;
-       }
-
-       ret = gatt_api->server->multi_adv_disable(gatt_servers[instance_id - 1].server_id);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT disable multi advertising failed for server Instance: %d With Status: %s",
-                               instance_id, status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_multi_adv_update(int instance_id,
-               int min_intv, int max_intv,
-               int adv_type, int chnl_map,
-               int tx_power, int timeout_s)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Multi advertising Update");
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (gatt_api->server->multi_adv_update == NULL)
-               return OAL_STATUS_NOT_SUPPORT;
-
-       ret = gatt_api->server->multi_adv_update(gatt_servers[instance_id - 1].server_id,
-                       min_intv, max_intv,
-                       adv_type, chnl_map,
-                       tx_power, timeout_s);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT update multi advertising failed for server Instance: %d With Status: %s",
-                               instance_id, status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_multi_adv_set_inst_data(int instance_id,
-               oal_ble_multi_adv_param_setup_t *adv_param_setup)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       btgatt_adv_param_setup_t adv_setup;
-       API_TRACE("Set Multi advertising data, srv_if: %d, instance_id: %d",
-                       gatt_servers[instance_id - 1].server_id, instance_id);
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (gatt_api->server->multi_adv_set_inst_data == NULL)
-               return OAL_STATUS_NOT_SUPPORT;
-
-       if ((gatt_servers[instance_id - 1].state >= GATT_INS_DATA_SETTING) && (gatt_servers[instance_id - 1].state != GATT_INS_DATA_SET)) {
-               BT_ERR("Not Allowed, state: %d, instance_id: %d", gatt_servers[instance_id - 1].state, instance_id);
-               return OAL_STATUS_BUSY;
-       }
-
-       gatt_servers[instance_id - 1].state = GATT_INS_DATA_SETTING;
-
-
-       adv_setup.set_scan_rsp = adv_param_setup->set_scan_rsp;
-       adv_setup.include_name = adv_param_setup->include_name;
-       adv_setup.include_txpower = adv_param_setup->include_txpower;
-       adv_setup.appearance = adv_param_setup->appearance;
-       adv_setup.manufacturer_data = adv_param_setup->manufacturer_data;
-       adv_setup.manufacturer_data_len = adv_param_setup->manufacturer_data_len;
-       adv_setup.service_data = adv_param_setup->service_data;
-       adv_setup.service_data_len = adv_param_setup->service_data_len;
-       adv_setup.service_uuid = adv_param_setup->service_uuid;
-       adv_setup.service_uuid_len = adv_param_setup->service_uuid_len;
-       /* Solicit UUID handler: Start */
-       adv_setup.solicit_uuid = adv_param_setup->solicit_uuid;
-       adv_setup.solicit_uuid_len = adv_param_setup->solicit_uuid_len;
-       /* Solicit UUID handler: End */
-       adv_setup.min_interval = adv_param_setup->min_interval;
-       adv_setup.max_interval = adv_param_setup->min_interval;
-       adv_setup.adv_type = adv_param_setup->adv_type;
-       adv_setup.chnl_map = adv_param_setup->chnl_map;
-       adv_setup.tx_power = adv_param_setup->tx_power;
-       adv_setup.timeout_s = adv_param_setup->timeout_s;
-
-       adv_setup.server_if = gatt_servers[instance_id - 1].server_id;
-       if (adv_setup.manufacturer_data_len > 0 && adv_setup.manufacturer_data != NULL) {
-               BT_INFO("Manufacture data.....\n");
-               PRINT_ADV_DATA(adv_setup.manufacturer_data_len, (unsigned char *)adv_setup.manufacturer_data, adv_setup.set_scan_rsp);
-       }
-
-       if (adv_setup.service_uuid_len > 0 && adv_setup.service_uuid != NULL) {
-               BT_INFO("Service uuid.....\n");
-               PRINT_ADV_DATA(adv_setup.service_uuid_len, (unsigned char*)adv_setup.service_uuid, FALSE);
-       }
-
-
-       ret = gatt_api->server->multi_adv_set_inst_data(adv_setup);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Set Multi advertising data failed: %s", status2string(ret));
-               gatt_servers[instance_id - 1].state = GATT_INS_DISABLED;
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-/************************************GATT Server Functions*************************************/
-/*Server Callbacks*/
-static void cb_gatts_register_app(int status, int server_if, bt_uuid_t *uuid)
-{
-       int i;
-       char str[2*BT_UUID_STRING_MAX];
-       uuid_to_stringname((service_uuid_t*)uuid, str);
-
-       event_gatts_register_t *event = g_malloc0(sizeof(event_gatts_register_t));
-
-       BT_INFO("BTGATT SERVER REGISTER APP CB, status:%d, server_if:%d", status, server_if);
-       BT_INFO("UUID: [%s]", str);
-
-       for (i = 0; i < NUM_SERVER_INST; i++) {
-               if (gatt_servers[i].server_id == -1) {
-                       BT_INFO("Server Instance registered with stack [%d]", i+1);
-                       gatt_servers[i].server_id = server_if;
-                       event->server_inst = i+1;
-                       memcpy(gatt_servers[i].uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
-                       memcpy(event->server_uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
-                       break;
-               }
-       }
-       send_event(OAL_EVENT_BLE_SERVER_INSTANCE_INITIALISED, event, sizeof(event_gatts_register_t));
-}
-
-static void cb_gatts_listen(int status, int server_if)
-{
-       gboolean prev_state[NUM_SERVER_INST];
-       gboolean new_state;
-       event_ble_adv_status *event = g_malloc0(sizeof(event_ble_adv_status));
-       int instance_id;
-
-       for (instance_id = 1 ; instance_id <= NUM_SERVER_INST ; instance_id++) {
-               if (gatt_servers[instance_id - 1].server_id == server_if) {
-                       event->server_inst = instance_id;
-                       break;
-               } else {
-                       BT_WARN("Server ID:%d recevied server Id:%d\n", gatt_servers[instance_id - 1].server_id, server_if);
-               }
-       }
-       if ((event->server_inst > 0) && (event->server_inst <= 10)) {
-               prev_state[event->server_inst - 1] = cur_adv_state[event->server_inst - 1];
-               new_state = (status == BT_STATUS_SUCCESS) ? !(prev_state[event->server_inst - 1]) : (prev_state[event->server_inst - 1]);
-               cur_adv_state[event->server_inst - 1] = new_state;
-       } else {
-               BT_ERR("Invalid Callback...");
-               return;
-       }
-
-       BT_INFO("Adv State of server instance %d :%d", instance_id, new_state);
-
-       if (TRUE == new_state)
-               send_event(OAL_EVENT_BLE_ADVERTISING_STARTED, event, sizeof(event_ble_adv_status));
-       else
-               send_event(OAL_EVENT_BLE_ADVERTISING_STOPPED, event, sizeof(event_ble_adv_status));
-}
-
-static void cb_gatts_multi_adv_enable(int server_if, int status)
-{
-
-       BT_INFO("BTGATT SERVER MULTI ADV ENABLE CB, status:%d, srv_if: %d", status, server_if);
-       event_ble_multiadv_status *event = g_malloc0(sizeof(event_ble_multiadv_status));
-       int instance_id;
-
-       if (status != BT_STATUS_SUCCESS)
-               BT_ERR("MULTI ADV ENABLE failed, status:%d, srv_if: %d", status, server_if);
-
-       for (instance_id = 1 ; instance_id <= NUM_SERVER_INST ; instance_id++) {
-               if (gatt_servers[instance_id - 1].server_id == server_if) {
-                       event->server_inst = instance_id;
-                       gatt_servers[instance_id - 1].state = GATT_INS_ENABLED;
-                       goto sendevent;
-               }
-       }
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_BLE_MULTI_ADVERTISING_ENABLE, event, sizeof(event_ble_multiadv_status));
-}
-
-static void cb_gatts_multi_adv_disable(int server_if, int status)
-{
-       BT_INFO("BTGATT SERVER MULTI ADV DISABLE CB, status:%d, srv_if: %d", status, server_if);
-       event_ble_multiadv_status *event = g_malloc0(sizeof(event_ble_multiadv_status));
-       int instance_id;
-
-       if (status != BT_STATUS_SUCCESS)
-               BT_ERR("MULTI ADV DISABLE failed, status:%d, srv_if: %d", status, server_if);
-
-       for (instance_id = 1 ; instance_id <= NUM_SERVER_INST; instance_id++) {
-               if (gatt_servers[instance_id - 1].server_id == server_if) {
-                       event->server_inst = instance_id;
-                       gatt_servers[instance_id - 1].state = GATT_INS_DISABLED;
-                       goto sendevent;
-               }
-       }
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_BLE_MULTI_ADVERTISING_DISABLE, event, sizeof(event_ble_multiadv_status));
-}
-
-static void cb_gatts_multi_adv_update(int server_if, int status)
-{
-       BT_INFO("BTGATT SERVER MULTI ADV UPDATE CB, status:%d, srv_if: %d", status, server_if);
-       event_ble_multiadv_status *event = g_malloc0(sizeof(event_ble_multiadv_status));
-       int instance_id;
-
-       if (status != BT_STATUS_SUCCESS)
-               BT_ERR("MULTI ADV UPDATE failed, status:%d, srv_if: %d", status, server_if);
-
-       for (instance_id = 1 ; instance_id <= NUM_SERVER_INST ; instance_id++) {
-               if (gatt_servers[instance_id - 1].server_id == server_if) {
-                       event->server_inst = instance_id;
-                       goto sendevent;
-               }
-       }
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_BLE_MULTI_ADVERTISING_UPDATE, event, sizeof(event_ble_multiadv_status));
-}
-
-static void cb_gatts_multi_adv_set_inst_data(int server_if, int status)
-{
-       BT_INFO("BTGATT SERVER MULTI ADV SET INST DATA CB, status:%d, srv_if: %d", status, server_if);
-       event_ble_multiadv_status *event = g_malloc0(sizeof(event_ble_multiadv_status));
-       int instance_id;
-
-       if (status != BT_STATUS_SUCCESS)
-               BT_ERR("MULTI ADV SET DATA failed, status:%d, srv_if: %d", status, server_if);
-
-       for (instance_id = 1 ; instance_id <= NUM_SERVER_INST ; instance_id++) {
-               if (gatt_servers[instance_id - 1].server_id == server_if) {
-                       event->server_inst = instance_id;
-                       gatt_servers[instance_id - 1].state = GATT_INS_DATA_SET;
-                       goto sendevent;
-               }
-       }
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_BLE_MULTI_ADVERTISING_SET_INST_DATA, event, sizeof(event_ble_multiadv_status));
-}
-
-oal_status_t gatts_get_att_mtu(int conn_id, int *mtu)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Get ATT MTU, conn_id: %d", conn_id);
-       CHECK_OAL_GATT_ENABLED();
-       OAL_CHECK_PARAMETER(mtu, return);
-
-       /* To prevent crash in case other libraries not support this api */
-       if (gatt_api->server->get_att_mtu == NULL) {
-               BT_WARN("get_att_mtu is NULL");
-               return OAL_STATUS_NOT_SUPPORT;
-       }
-
-       ret = gatt_api->server->get_att_mtu(conn_id, mtu);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT MTU Size failed, status: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       BT_INFO("Current ATT MTU Size: %d", *mtu);
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_add_service(int instance_id, oal_gatt_srvc_id_t *gatt_serv_id,
-               int num_handles)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       btgatt_srvc_id_t btgatt_srvc_id;
-       char str[2*BT_UUID_STRING_MAX];
-
-       API_TRACE("Server Add Service : instance_id = %d, num_handles = %d", instance_id, num_handles);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(instance_id);
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (gatt_serv_id != NULL) {
-               uuid_to_stringname(&(gatt_serv_id->id.uuid), str);
-               API_TRACE("Service uuid: [%s]", str);
-               memcpy(btgatt_srvc_id.id.uuid.uu,  gatt_serv_id->id.uuid.uuid, sizeof(gatt_serv_id->id.uuid));
-               btgatt_srvc_id.id.inst_id  = gatt_serv_id->id.inst_id;
-               btgatt_srvc_id.is_primary = gatt_serv_id->is_prmry;
-       } else {
-               BT_INFO("GATT Server Service Id is NULL");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       ret = gatt_api->server->add_service(gatt_servers[instance_id - 1].server_id, &btgatt_srvc_id, num_handles);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server add service failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_add_included_services(int instance_id, int serv_handle,
-               int incl_handle)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       API_TRACE("Server Add included Service : instance_id = %d, serv_handle = %d, incl_handle = %d",
-                       instance_id, serv_handle, incl_handle);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(instance_id);
-
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       ret = gatt_api->server->add_included_service(gatt_servers[instance_id - 1].server_id, serv_handle, incl_handle);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Add included Service failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_add_characteristics(int instance_id, int serv_handle,
-                       oal_uuid_t* charc_uuid, int propts, int permsn)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char str[2*BT_UUID_STRING_MAX];
-       char prop[MAX_PROP_LEN], perm[MAX_PERM_LEN];
-       char_prop_to_string(propts, prop);
-       char_perm_to_string(permsn, perm);
-       API_TRACE("Server Add Characteristic : instance_id = %d, serv_handle = %d, Properties =%s, Permisison = %s",
-               instance_id, serv_handle, prop, perm);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(instance_id);
-
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (charc_uuid != NULL) {
-               uuid_to_stringname(charc_uuid, str);
-               API_TRACE("uuid: [%s]", str);
-       }
-
-       ret = gatt_api->server->add_characteristic(gatt_servers[instance_id - 1].server_id,
-                       serv_handle, (bt_uuid_t*)charc_uuid, propts, permsn);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Add Characteristic failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_add_descriptor(int instance_id, int serv_handle,
-               oal_uuid_t* desc_uuid, int permsn)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char str[2*BT_UUID_STRING_MAX];
-       char perm[MAX_PERM_LEN];
-       char_perm_to_string(permsn, perm);
-       API_TRACE("Server Add Descriptor : instance_id = %d, serv_handle = %d, Permisison = %s",
-                       instance_id, serv_handle, perm);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(instance_id);
-
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       if (desc_uuid != NULL) {
-               uuid_to_stringname(desc_uuid, str);
-               API_TRACE("uuid: [%s]", str);
-       }
-
-       ret = gatt_api->server->add_descriptor(gatt_servers[instance_id - 1].server_id,
-                               serv_handle, (bt_uuid_t*)desc_uuid, permsn);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Add Descriptor failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_start_service(int instance_id, int svc_handle, int transport)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Server Start Service : Ins_id = %d, srvHndl = %d, transport = %d",
-                               instance_id, svc_handle, transport);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(instance_id);
-
-       CHECK_SERVER_REGISTRATION(instance_id);
-
-       ret = gatt_api->server->start_service(gatt_servers[instance_id - 1].server_id, svc_handle, transport);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Start Service failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_stop_service(int ins_id, int srv_hdl)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Server Stop Service : Ins_id = %d, srvHndl = %d, ", ins_id, srv_hdl);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(ins_id);
-       CHECK_SERVER_REGISTRATION(ins_id);
-
-       ret = gatt_api->server->stop_service(gatt_servers[ins_id - 1].server_id, srv_hdl);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Stop Service failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_delete_service(int ins_id, int srv_hdl)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Server Delete Service : Ins_id = %d, srvHndl = %d, ", ins_id, srv_hdl);
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(ins_id);
-
-       CHECK_SERVER_REGISTRATION(ins_id);
-
-       ret = gatt_api->server->delete_service(gatt_servers[ins_id - 1].server_id, srv_hdl);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Delete Service failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_send_response(int conn_id, int trans_id, int resp_status, oal_gatt_response_t *response)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Server Send Response : ConnId = %d, TransId = %d, ", conn_id, trans_id);
-       CHECK_OAL_GATT_ENABLED();
-
-       if (response == NULL) {
-               BT_ERR("GATT Server attribute value is empty");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       ret = gatt_api->server->send_response(conn_id, trans_id, resp_status, (btgatt_response_t *)response);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Send Response failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_send_indication(int ins_id, int attr_hndl, int conn_id, int len, int confirm, char* value)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Server Send Indication : Ins_id = %d, srvHndl = %d, [%s]",
-                       ins_id, attr_hndl, confirm == TRUE ? "INDICATION" : "NOTIFICATION");
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(ins_id);
-
-       CHECK_SERVER_REGISTRATION(ins_id);
-
-       if (value == NULL || len == 0) {
-               BT_ERR("GATT Server attribute value is empty");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       ret = gatt_api->server->send_indication(gatt_servers[ins_id - 1].server_id,
-                       attr_hndl, conn_id, len, confirm, value);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Send Indication failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gatts_update_att_value(int ins_id, oal_gatt_value_t *value)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       CHECK_OAL_GATT_ENABLED();
-
-       CHECK_SERVER_INSTANCE(ins_id);
-
-       CHECK_SERVER_REGISTRATION(ins_id);
-
-       if (value == NULL || value->len == 0) {
-               BT_ERR("GATT Server attribute value is empty");
-               return OAL_STATUS_INVALID_PARAM;
-       }
-
-       API_TRACE("Server Update Value: Ins_id = [%d], att handle = [%d] data len [%d]",
-                       ins_id, value->handle, value->len);
-
-       ret = gatt_api->server->update_att_value(gatt_servers[ins_id - 1].server_id,
-                       (int)value->handle, (int)value->len, (char*)value->value);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT Server Update Attribute Value failed: [%s]", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-/* GATT Server Callbacks:Start */
-static void cb_gatts_service_added(int status, int server_if,
-               btgatt_srvc_id_t *psrvc_id, int srvc_handle)
-{
-       int instance_id;
-
-       BT_INFO("BTGATT SERVER SERVICE ADDED CB, status:%d, handle:%d", status, srvc_handle);
-       event_gatts_srvc_prm_t* event = g_new0(event_gatts_srvc_prm_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(instance_id, server_if, event->gatt_srvc_stat.server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->gatt_srvc_stat.server_inst = -1;
-sendevent:
-       event->gatt_srvc_stat.servic_hndl = srvc_handle;
-       if (psrvc_id != NULL) {
-               event->gatt_srvc_id.id.inst_id = psrvc_id->id.inst_id;
-               //event->gatt_srvc_id.id.uuid = psrvc_id->id.uuid;
-               memcpy(event->gatt_srvc_id.id.uuid.uuid,  psrvc_id->id.uuid.uu, sizeof(psrvc_id->id.uuid));
-               event->gatt_srvc_id.is_prmry = psrvc_id->is_primary;
-       }
-
-       event->gatt_srvc_stat.status = convert_to_oal_status(status);
-
-       send_event(OAL_EVENT_GATTS_SERVICE_ADDED, event, sizeof(event_gatts_srvc_prm_t));
-}
-
-static void cb_gatts_included_service_added(int status, int server_if,
-               int srvc_handle,
-               int incl_srvc_handle)
-{
-       int ins_id ;
-       BT_INFO("BTGATT SERVER INCLUDED SERVICE ADDED CB, status:%d, srvc handle:%d, incl handle:%d",
-                       status, srvc_handle, incl_srvc_handle);
-
-       event_gatts_incld_srvc_t* event = g_new0(event_gatts_incld_srvc_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(ins_id, server_if, event->gatt_srvc_stat.server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->gatt_srvc_stat.server_inst = -1;
-sendevent:
-       event->gatt_srvc_stat.servic_hndl = srvc_handle;
-       event->incl_srvc_hndl = incl_srvc_handle;
-       event->gatt_srvc_stat.status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_GATTS_INCLUDED_SERVICE_ADDED, event, sizeof(event_gatts_incld_srvc_t));
-}
-
-static void cb_gatts_characteristic_added(int status, int server_if, bt_uuid_t *char_id,
-               int srvc_handle, int char_handle)
-{
-       int Ins_id ;
-
-       BT_INFO("BTGATT SERVER CHARACTERISTIC ADDED CB, status:%d, srvc handle:%d, char handle:%d",
-                       status, srvc_handle, char_handle);
-
-       event_gatts_srvc_charctr_t* event = g_new0(event_gatts_srvc_charctr_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(Ins_id, server_if, event->gatt_srvc_stat.server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->gatt_srvc_stat.server_inst = -1;
-sendevent:
-       event->gatt_srvc_stat.servic_hndl = srvc_handle;
-       event->charctr_hndl = char_handle;
-       event->gatt_srvc_stat.status = convert_to_oal_status(status);
-       memcpy(event->charctr_uuid.uuid, char_id->uu, sizeof(bt_uuid_t));
-       send_event(OAL_EVENT_GATTS_CHARACTERISTIC_ADDED, event, sizeof(event_gatts_srvc_charctr_t));
-}
-
-static void cb_gatts_descriptor_added(int status, int server_if,
-               bt_uuid_t *descr_id, int srvc_handle,
-               int descr_handle)
-{
-       int Ins_id ;
-       BT_INFO("BTGATT SERVER DESCRIPTOR ADDED CB, status:%d, srvc handle:%d, desc handle:%d",
-                       status, srvc_handle, descr_handle);
-
-       event_gatts_srvc_descr_t* event = g_new0(event_gatts_srvc_descr_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(Ins_id, server_if, event->gatt_srvc_stat.server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->gatt_srvc_stat.server_inst = -1;
-sendevent:
-       event->gatt_srvc_stat.servic_hndl = srvc_handle;
-       event->descrptr_hndl = descr_handle;
-       event->gatt_srvc_stat.status = convert_to_oal_status(status);
-       memcpy(event->descrptr_uuid.uuid, descr_id->uu, sizeof(bt_uuid_t));
-       send_event(OAL_EVENT_GATTS_DESCRIPTOR_ADDED, event, sizeof(event_gatts_srvc_descr_t));
-}
-
-static void cb_gatts_service_started(int status, int server_if, int srvc_handle)
-{
-       int Ins_id ;
-       BT_INFO("BTGATT SERVER SERVICE STARTED CB, status:%d, srvc_handle:%d", status, srvc_handle);
-
-       event_gatts_srvc_t* event = g_new0(event_gatts_srvc_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(Ins_id, server_if, event->server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->servic_hndl = srvc_handle;
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_GATTS_SERVICE_STARTED, event, sizeof(event_gatts_srvc_t));
-}
-
-static void cb_gatts_service_stopped(int status, int server_if, int srvc_handle)
-{
-       int ins_id ;
-       BT_INFO("BTGATT SERVER SERVICE STOPPED CB, status:%d, srvc_handle:%d", status, srvc_handle);
-
-       event_gatts_srvc_t* event = g_new0(event_gatts_srvc_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(ins_id, server_if, event->server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->servic_hndl = srvc_handle;
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_GATTS_SERVICE_STOPED, event, sizeof(event_gatts_srvc_t));
-}
-
-static void cb_gatts_service_deleted(int status, int server_if, int srvc_handle)
-{
-       int ins_id;
-       BT_INFO("BTGATT SERVER SERVICE DELETED CB, status:%d, srvc_handle:%d", status, srvc_handle);
-
-       event_gatts_srvc_t* event = g_new0(event_gatts_srvc_t, 1);
-
-       CHECK_CORRECT_SERVER_ID(ins_id, server_if, event->server_inst);
-
-       BT_ERR("Invalid Interface, srv_if: %d", server_if);
-       event->server_inst = -1;
-sendevent:
-       event->servic_hndl = srvc_handle;
-       event->status = convert_to_oal_status(status);
-       send_event(OAL_EVENT_GATTS_SERVICE_DELETED, event, sizeof(event_gatts_srvc_t));
-}
-
-static void cb_gatts_connection(int conn_id, int server_if, int connected, bt_bdaddr_t *bda)
-{
-       int ins_id ;
-       oal_event_t event_type;
-
-       BT_INFO("BTGATT SERVER CONNECTION  connnected:%d, conn_id:%d server_if:%d", connected, conn_id, server_if);
-       event_gatts_conn_t *event = g_new0(event_gatts_conn_t, 1);
-
-       for (ins_id = 1 ; ins_id <= NUM_SERVER_INST ; ins_id++) {
-               if ((gatt_servers[ins_id - 1].server_id == server_if) &&
-                               (gatt_servers[ins_id - 1].state == GATT_INS_ENABLED)) {
-                       event->server_inst = ins_id;
-                       break;
-               } else {
-                       BT_INFO("Server ID:%d recevied server Id:%d\n", gatt_servers[ins_id - 1].server_id, server_if);
-               }
-       }
-       if (ins_id == NUM_SERVER_INST+1) {
-               BT_WARN("Incorrect Server Interface received: %d\n",  server_if);
-               g_free(event);
-               return;
-       }
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-       event->conn_id = conn_id;
-       event_type = ((connected == TRUE) ? OAL_EVENT_GATTS_CONNECTION_COMPLETED : OAL_EVENT_GATTS_DISCONNECTION_COMPLETED);
-
-       send_event(event_type, event, sizeof(event_gatts_conn_t));
-}
-
-static void cb_gatts_request_read(int conn_id, int trans_id, bt_bdaddr_t *bda,
-               int attr_handle, int offset, bool is_long)
-{
-       BT_INFO("BTGATT SERVER REQUEST READ CB: conn_id:%d", conn_id);
-
-       event_gatts_srvc_read_attr_t* event = g_new0(event_gatts_srvc_read_attr_t, 1);
-
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-
-       event->attr_trans.attr_handle = attr_handle;
-       event->attr_trans.conn_id = conn_id;
-       event->attr_trans.trans_id = trans_id;
-       event->attr_trans.offset = offset;
-       event->is_long = is_long;
-
-       send_event(OAL_EVENT_GATTS_REQUEST_READ, event, sizeof(event_gatts_srvc_read_attr_t));
-}
-
-static void cb_gatts_request_write(int conn_id, int trans_id,
-               bt_bdaddr_t *bda, int attr_handle,
-               int offset, int length,
-               bool need_rsp, bool is_prep, uint8_t* value)
-{
-       BT_INFO("BTGATT SERVER REQUEST WRITE conn_id:%d", conn_id);
-
-       event_gatts_srvc_write_attr_t* event = g_new0(event_gatts_srvc_write_attr_t, 1);
-
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-
-       event->attr_trans.attr_handle = attr_handle;
-       event->attr_trans.conn_id = conn_id;
-       event->attr_trans.trans_id = trans_id;
-       event->attr_trans.offset = offset;
-       event->need_rsp = need_rsp;
-       event->is_prep = is_prep;
-
-       if (length > 0 && value != NULL) {
-               if (length > OAL_GATT_MAX_ATTR_LEN)
-                       length = OAL_GATT_MAX_ATTR_LEN;
-               memcpy(event->value, value, length);
-               event->length = length;
-       }
-       send_event(OAL_EVENT_GATTS_REQUEST_WRITE, event, sizeof(event_gatts_srvc_write_attr_t));
-}
-
-static void cb_gatts_response_confirmation(int status, int handle)
-{
-       BT_INFO("BTGATT SERVER RESPONSE CONFIRMATION CB, status:%d, handle:%d", status, handle);
-
-       event_gatts_respons_t* event = g_new0(event_gatts_respons_t, 1);
-
-       event->hndl = handle;
-       event->status = convert_to_oal_status(status);
-
-       send_event(OAL_EVENT_GATTS_RESPONSE_CONFIRMED, event, sizeof(event_gatts_respons_t));
-}
-
-static void cb_indication_confirmation(int conn_id, int trans_id, int attr_handle, bt_bdaddr_t *bda)
-{
-       BT_INFO("BTGATT SERVER Indication Confirmation CB, conn_id:%d, trans_id:%d attr_handle:%d",
-                       conn_id, trans_id, attr_handle);
-
-       event_gatts_ind_cnfrm_t* event = g_new0(event_gatts_ind_cnfrm_t, 1);
-
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-
-       event->attr_handle = attr_handle;
-       event->conn_id = conn_id;
-       event->trans_id = trans_id;
-       send_event(OAL_EVENT_GATTS_IND_CONFIRM, event, sizeof(event_gatts_ind_cnfrm_t));
-}
-
-static void cb_gatts_mtu_changed(int conn_id, int mtu)
-{
-       BT_INFO("BTGATT SERVER MTU CHANGED CB, conn_id: %d, mtu_size: %d", conn_id, mtu);
-       event_gatts_mtu_changed_t *event = g_new0(event_gatts_mtu_changed_t, 1);
-       event->conn_id = conn_id;
-       event->mtu_size = mtu;
-       send_event(OAL_EVENT_GATTS_MTU_CHANGED, event, sizeof(event_gatts_mtu_changed_t));
-}
-
-#ifdef TIZEN_BT_HAL
-static void cb_notifcation_changed(int conn_id, int trans_id, int attr_handle, bool notify,  bt_bdaddr_t *bda)
-{
-       BT_INFO("BTGATT SERVER Notication CB, conn_id:%d, trans_id:%d attr_handle:%d Notify:%d",
-                       conn_id, trans_id, attr_handle, notify);
-
-       event_gatts_notif_t* event = g_new0(event_gatts_notif_t, 1);
-
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-
-       event->attr_handle = attr_handle;
-       event->conn_id = conn_id;
-       event->trans_id = trans_id;
-       event->notify = notify;
-       send_event(OAL_EVENT_GATTS_NOTIFICATION, event, sizeof(event_gatts_notif_t));
-}
-#endif
-
-
-/* GATT Server Callbacks: End */
-/************************************ GATT Client ***********************************/
-/* Client Callbacks */
-static void cb_gattc_register_app(int status, int clientIf, bt_uuid_t *app_uuid)
-{
-       char uuid_str[BT_UUID_STRING_MAX];
-       event_gattc_register_t *event;
-
-       BT_INFO("+");
-
-       /* Check if GATT client registered for Default GATT client UUID */
-       uuid_to_string((service_uuid_t *)app_uuid, uuid_str);
-       BT_INFO("UUID:%s", uuid_str);
-
-       BT_INFO("BTGATT CLIENT REGISTER APP CB, status:%d, clientIf:%d", status, clientIf);
-       event = g_new0(event_gattc_register_t, 1);
-       event->client_if = clientIf;
-       event->status = (status == 0 ? OAL_STATUS_SUCCESS : OAL_STATUS_INTERNAL_ERROR);
-       memcpy(event->client_uuid.uuid, app_uuid->uu, sizeof(oal_uuid_t));
-       send_event(OAL_EVENT_GATTC_REGISTRATION, event, sizeof(event_gattc_register_t));
-}
-
-static void cb_gattc_scan_result(bt_bdaddr_t* bdaddress, int rssi, uint8_t *adv_data)
-{
-       event_ble_scan_result_info *event;
-
-       event = g_new0(event_ble_scan_result_info, 1);
-       event->rssi = rssi;
-       memcpy(event->address.addr, bdaddress->address, BT_ADDRESS_BYTES_NUM);
-       memcpy(event->adv_data, adv_data, BLE_ADV_DATA_LENGTH);
-       send_event_bda_trace(OAL_EVENT_BLE_REMOTE_DEVICE_FOUND, event,
-                       sizeof(event_ble_scan_result_info), (bt_address_t *)bdaddress);
-}
-
-static void cb_gattc_connection(int conn_id, int status, int client_if, bt_bdaddr_t* bda)
-{
-       event_gattc_conn_t *event;
-       BT_INFO("BTGATT CLIENT CONNECTED CB, status:[%d] client_if[%d] id[%d]",
-                                                       status, client_if, conn_id);
-
-       event = g_new0(event_gattc_conn_t, 1);
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-       event->client_if = client_if;
-
-       if (BT_STATUS_SUCCESS != status) {
-               event->status = OAL_STATUS_INTERNAL_ERROR;
-               BT_ERR("gattc connection Error: %d", status);
-       } else {
-               event->conn_id = conn_id;
-               event->status = OAL_STATUS_SUCCESS;
-       }
-
-       send_event_bda_trace(OAL_EVENT_GATTC_CONNECTION_COMPLETED, event,
-                                       sizeof(*event), (bt_address_t *)bda);
-}
-
-
-static void cb_gattc_disconnect(int conn_id, int status, int client_if, bt_bdaddr_t* bda)
-{
-       event_gattc_conn_t *event;
-       BT_INFO("BTGATT Client Disconnect Complete cb, status:[%d], client_if[%d] id[%d]",
-                                                       status, client_if, conn_id);
-       event = g_new0(event_gattc_conn_t, 1);
-       event->status = convert_to_oal_status(status);
-       event->client_if = client_if;
-       event->conn_id = conn_id;
-       memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
-       send_event_bda_trace(OAL_EVENT_GATTC_DISCONNECTION_COMPLETED, event,
-                                       sizeof(*event), (bt_address_t *)bda);
-}
-
-static void cb_gattc_search_result(int conn_id, btgatt_srvc_id_t *srvc_id)
-{
-       char uuid_str[2*BT_UUID_STRING_MAX];
-
-       BT_INFO("BTGATT Client Service Search Result cb, conn_id:%d", conn_id);
-
-       uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str);
-       BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
-               uuid_str, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
-
-       event_gattc_service_result_t *event = g_new0(event_gattc_service_result_t, 1);
-       event->conn_status.status = OAL_STATUS_SUCCESS;
-       event->conn_status.conn_id = conn_id;
-       memcpy(&(event->srvc_id), srvc_id, sizeof(oal_gatt_srvc_id_t));
-
-       send_event(OAL_EVENT_GATTC_SERVICE_SEARCH_RESULT, event, sizeof(*event));
-}
-
-static void cb_gattc_search_complete(int conn_id, int status)
-{
-       BT_INFO("BTGATT Client Service Search Complete cb, status:%d, conn_id:%d",
-       status, conn_id);
-
-       event_gattc_conn_status_t *event = g_new0(event_gattc_conn_status_t, 1);
-       event->conn_id = conn_id;
-       event->status = convert_to_oal_status(status);
-
-       send_event(OAL_EVENT_GATTC_SERVICE_SEARCH_DONE, event, sizeof(*event));
-}
-
-
-static void cb_gattc_get_characteristics(int conn_id, int status, btgatt_srvc_id_t *srvc_id,
-                                               btgatt_gatt_id_t *char_id, int char_prop)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       char str[50];
-       BT_INFO("BTGATT Client Get Characteristic Callback, conn_id:%d, status:%d", conn_id, status);
-       uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str1);
-       BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
-               uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
-
-       event_gattc_characteristic_result_t *event = g_new0(event_gattc_characteristic_result_t, 1);
-       event->conn_status.conn_id = conn_id;
-       event->conn_status.status = convert_to_oal_status(status);
-       memcpy(&(event->srvc_id), srvc_id, sizeof(oal_gatt_srvc_id_t));
-
-       if (status == 0) {
-               uuid_to_stringname((oal_uuid_t *)&(char_id->uuid), uuid_str2);
-               BT_INFO("Charac=> UUID: [%s], Inst_id: [%u], Prop: [%s]",
-                       uuid_str2, char_id->inst_id, char_prop_to_string(char_prop, str));
-               event->char_prop = char_prop;
-               memcpy(&(event->char_id), char_id, sizeof(oal_gatt_id_t));
-       }
-       send_event(OAL_EVENT_GATTC_CHARAC_SERACH_RESULT, event, sizeof(*event));
-}
-
-
-
-static void cb_gattc_get_descriptor(int conn_id, int status, btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, btgatt_gatt_id_t *descr_id)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       char uuid_str3[2*BT_UUID_STRING_MAX];
-       BT_INFO("BTGATT Client Get Descriptor Callback, conn_id:%d, status:%d", conn_id, status);
-       uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname((oal_uuid_t *)&(char_id->uuid), uuid_str2);
-       BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
-               uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
-       BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, char_id->inst_id);
-
-       event_gattc_descriptor_result_t *event = g_new0(event_gattc_descriptor_result_t, 1);
-       event->conn_status.conn_id = conn_id;
-       event->conn_status.status = convert_to_oal_status(status);
-       memcpy(&(event->srvc_id), srvc_id, sizeof(oal_gatt_srvc_id_t));
-       memcpy(&(event->char_id), char_id, sizeof(oal_gatt_id_t));
-
-       if (status == 0) {
-               uuid_to_stringname((oal_uuid_t *)&(descr_id->uuid), uuid_str3);
-               BT_INFO("Desc=> UUID: [%s], Inst_id: [%u]", uuid_str3, descr_id->inst_id);
-               memcpy(&(event->descr_id), descr_id, sizeof(oal_gatt_id_t));
-       }
-       send_event(OAL_EVENT_GATTC_DESC_SERACH_RESULT, event, sizeof(*event));
-}
-
-static void cb_gattc_register_for_notification(int client_if, int registered, int status, btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       BT_INFO("BTGATT Client Register For Notification Callback, client_if:%d, status:%d, registered: %s",
-               client_if, status, registered == 1 ? "REGISTERED" : "DEREGISTERED");
-       uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname((oal_uuid_t *)&(char_id->uuid), uuid_str2);
-       BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
-       BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, char_id->inst_id);
-
-       event_gattc_regdereg_notify_t *event = g_new0(event_gattc_regdereg_notify_t, 1);
-       oal_event_t event_type = (registered == 1 ? OAL_EVENT_GATTC_NOTIFICATION_REGISTERED : OAL_EVENT_GATTC_NOTIFICATION_DEREGISTERED);
-       event->client_if = client_if;
-       event->status = convert_to_oal_status(status);
-       memcpy(&(event->srvc_id), srvc_id, sizeof(oal_gatt_srvc_id_t));
-       memcpy(&(event->char_id), char_id, sizeof(oal_gatt_id_t));
-
-       send_event(event_type, event, sizeof(*event));
-}
-
-
-static void cb_gattc_read_characteristic(int conn_id, int status, btgatt_read_params_t *p_data)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       BT_INFO("BTGATT Client Read Charcateristic Callback, conn_id:%d, read_status:%d", conn_id, status);
-
-       event_gattc_read_data *event = g_new0(event_gattc_read_data, 1);
-       event->uuid_status.conn_status.conn_id = conn_id;
-       event->uuid_status.conn_status.status = convert_to_oal_status(status);
-       event->value_type = p_data->value_type;
-       memcpy(&(event->uuid_status.srvc_id), &(p_data->srvc_id), sizeof(oal_gatt_srvc_id_t));
-       memcpy(&(event->uuid_status.char_id), &(p_data->char_id), sizeof(oal_gatt_id_t));
-       if (status == 0) {
-               uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
-               uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
-               BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
-                       p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
-               BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
-               BT_INFO("Len: %u, value_type: %u", p_data->value.len, p_data->value_type);
-               if (p_data->value.len > 0 && event->value_type == GATTC_READ_VALUE_TYPE_VALUE) {
-                       char *data = NULL;
-                       data = g_malloc(3*p_data->value.len+1);
-                       if (!data) {
-                               BT_ERR("memory allocation failed");
-                               g_free(event);
-                               return;
-                       }
-                       convert_hex_2_str((unsigned char *)p_data->value.value, p_data->value.len, data);
-                       BT_INFO("Read Data: [%s]", data);
-                       event->data_len = p_data->value.len;
-                       memcpy(&(event->data), &(p_data->value.value), event->data_len);
-                       g_free(data);
-               }
-       }
-       send_event(OAL_EVENT_GATTC_READ_CHARAC, event, sizeof(*event));
-}
-
-static void cb_gattc_write_characteristic(int conn_id, int status, btgatt_write_params_t *p_data)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       BT_INFO("BTGATT Client Write Charcateristic Callback, conn_id:%d, write_status:%d", conn_id, status);
-
-       event_gattc_write_data *event = g_new0(event_gattc_write_data, 1);
-       event->conn_status.conn_id = conn_id;
-       event->conn_status.status = convert_to_oal_status(status);
-       memcpy(&(event->srvc_id), &(p_data->srvc_id), sizeof(oal_gatt_srvc_id_t));
-       memcpy(&(event->char_id), &(p_data->char_id), sizeof(oal_gatt_id_t));
-       if (status == 0) {
-               uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
-               uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
-               BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
-                       p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
-               BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
-       }
-       send_event(OAL_EVENT_GATTC_WRITE_CHARAC, event, sizeof(*event));
-}
-
-static void cb_gattc_write_descriptor(int conn_id, int status, btgatt_write_params_t *p_data)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       char uuid_str3[2*BT_UUID_STRING_MAX];
-       BT_INFO("BTGATT Client Write Descriptor Callback, conn_id:%d, write_status:%d", conn_id, status);
-
-       event_gattc_write_data *event = g_new0(event_gattc_write_data, 1);
-       event->conn_status.conn_id = conn_id;
-       event->conn_status.status = convert_to_oal_status(status);
-       memcpy(&(event->srvc_id), &(p_data->srvc_id), sizeof(oal_gatt_srvc_id_t));
-       memcpy(&(event->char_id), &(p_data->char_id), sizeof(oal_gatt_id_t));
-       memcpy(&(event->descr_id), &(p_data->descr_id), sizeof(oal_gatt_id_t));
-       if (status == 0) {
-               uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
-               uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
-               uuid_to_stringname((oal_uuid_t *)&(p_data->descr_id.uuid), uuid_str3);
-               BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
-                       p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
-               BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
-               BT_INFO("Desc=> UUID: [%s], Inst_id: [%u]", uuid_str3, p_data->descr_id.inst_id);
-       }
-       send_event(OAL_EVENT_GATTC_WRITE_DESCR, event, sizeof(*event));
-}
-
-
-
-static void cb_gattc_read_descriptor(int conn_id, int status, btgatt_read_params_t *p_data)
-{
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       char uuid_str3[2*BT_UUID_STRING_MAX];
-       BT_INFO("BTGATT Client Read Descriptor Callback, conn_id:%d, read_status:%d", conn_id, status);
-
-       event_gattc_read_data *event = g_new0(event_gattc_read_data, 1);
-       event->uuid_status.conn_status.conn_id = conn_id;
-       event->uuid_status.conn_status.status = convert_to_oal_status(status);
-       event->value_type = p_data->value_type;
-       memcpy(&(event->uuid_status.srvc_id), &(p_data->srvc_id), sizeof(oal_gatt_srvc_id_t));
-       memcpy(&(event->uuid_status.char_id), &(p_data->char_id), sizeof(oal_gatt_id_t));
-       memcpy(&(event->uuid_status.descr_id), &(p_data->descr_id), sizeof(oal_gatt_id_t));
-
-       if (status == 0) {
-               uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
-               uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
-               uuid_to_stringname((oal_uuid_t *)&(p_data->descr_id.uuid), uuid_str3);
-               BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
-                       p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
-               BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
-               BT_INFO("Desc=> UUID: [%s], Inst_id: [%u]", uuid_str3, p_data->descr_id.inst_id);
-               BT_INFO("Len: %u, value_type: %u", p_data->value.len, p_data->value_type);
-               if (p_data->value.len > 0 && event->value_type == GATTC_READ_VALUE_TYPE_VALUE) {
-                       char *data = NULL;
-                       data = g_malloc(3*p_data->value.len+1);
-                       if (!data) {
-                               BT_ERR("memory allocation failed");
-                               g_free(event);
-                               return;
-                       }
-                       convert_hex_2_str((unsigned char *)p_data->value.value, p_data->value.len, data);
-                       BT_INFO("Read Data: [%s]", data);
-                       event->data_len = p_data->value.len;
-                       memcpy(&(event->data), &(p_data->value.value), event->data_len);
-                       g_free(data);
-               }
-       }
-       send_event(OAL_EVENT_GATTC_READ_DESCR, event, sizeof(*event));
-}
-
-oal_status_t gattc_start_le_discovery(int client_id)
-{
-
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("BTGATT CLIENT SCAN START");
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-
-       ret = gatt_api->client->scan(client_id, 1);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Error:Start LE Discovery failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       send_event(OAL_EVENT_BLE_DISCOVERY_STARTED, NULL, 0);
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_stop_le_discovery(int client_id)
-{
-
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("Scan is stopped");
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-       ret = gatt_api->client->scan(client_id, 0);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Error:Stop LE Discovery failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       } else
-               send_event(OAL_EVENT_BLE_DISCOVERY_STOPPED, NULL, 0);
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_set_le_scan_param(int scan_type, int itv, int win)
-{
-       int ret;
-
-       API_TRACE("Scan is stopped");
-       CHECK_OAL_GATT_ENABLED();
-
-#ifdef TIZEN_BT_HAL
-       ret = gatt_api->client->set_scan_parameters(scan_type, itv, win);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Error:Set scan parameters failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#else
-       ret = gatt_api->client->set_scan_parameters(itv, win);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Error:Set scan parameters failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-#endif
-
-       return OAL_STATUS_SUCCESS;
-}
-/************************************ GATT Client ***********************************/
-oal_status_t gattc_register(oal_uuid_t* client_uuid)
-{
-
-       char str[2*BT_UUID_STRING_MAX];
-       int ret = OAL_STATUS_SUCCESS;
-
-       CHECK_OAL_GATT_ENABLED();
-       uuid_to_stringname(client_uuid, str);
-       API_TRACE("uuid: [%s]", str);
-       /* We will perform actual registration in cb_gattc_register_app callback */
-       ret = gatt_api->client->register_client((bt_uuid_t *)client_uuid);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client register failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_deregister(int client_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-
-       API_TRACE("GATT client deregister");
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-
-       ret = gatt_api->client->unregister_client(client_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client deregister failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_connect(int client_id, bt_address_t *device_address, int isDirect)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-
-       OAL_CHECK_PARAMETER(device_address, return);
-       API_TRACE("Client Connect: [%s]", bdt_bd2str(device_address, &bdstr));
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-
-       /* Handle the actual connection in cb_gattc_connection callback */
-       ret = gatt_api->client->connect(client_id, (bt_bdaddr_t *)device_address, isDirect);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client connect failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_disconnect(int client_id, bt_address_t *device_address, int conn_id)
-{
-
-       int ret = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-
-       OAL_CHECK_PARAMETER(device_address, return);
-       API_TRACE("Client Disconnect: [%s]", bdt_bd2str(device_address, &bdstr));
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-       CHECK_CLIENT_CONNECTION(conn_id);
-
-       /* Handle actual disconnection in callback */
-       ret = gatt_api->client->disconnect(client_id, (bt_bdaddr_t *) device_address, conn_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client disconnect failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-
-oal_status_t gattc_search_service(int conn_id, oal_uuid_t *service_uuid)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str[2*BT_UUID_STRING_MAX];
-
-       if (service_uuid) {
-               uuid_to_stringname(service_uuid, uuid_str);
-               API_TRACE("Client Service Search UUID: [%s]", uuid_str);
-       } else
-               API_TRACE("Client Service Search All");
-
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-       ret = gatt_api->client->search_service(conn_id, (bt_uuid_t *)service_uuid);
-
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client service search failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_get_characteristic(int conn_id, oal_gatt_srvc_id_t *srvc_id, oal_gatt_id_t *char_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str[2*BT_UUID_STRING_MAX];
-
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str);
-       API_TRACE("Client Get Characteristic, Service_uuid: [%s]", uuid_str);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-       ret = gatt_api->client->get_characteristic(conn_id, (btgatt_srvc_id_t *)srvc_id,
-                                       (btgatt_gatt_id_t *)char_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client get characteristic failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_get_descriptor(int conn_id, oal_gatt_srvc_id_t *srvc_id,
-                               oal_gatt_id_t *char_id, oal_gatt_id_t *desc_id)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       API_TRACE("Client Get Descriptor, Service_uuid: [%s], Char_uuid: [%s]", uuid_str1, uuid_str2);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-       ret = gatt_api->client->get_descriptor(conn_id, (btgatt_srvc_id_t *)srvc_id,
-                               (btgatt_gatt_id_t *)char_id, (btgatt_gatt_id_t *)desc_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client get descriptor failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_register_for_notification(int client_id, bt_address_t * address,
-                       oal_gatt_srvc_id_t *srvc_id, oal_gatt_id_t *char_id) {
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       bdstr_t bdstr;
-
-       OAL_CHECK_PARAMETER(address, return);
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       API_TRACE("Client Register Notification: [%s], Service_uuid: [%s], Char_uuid: [%s]", bdt_bd2str(address, &bdstr), uuid_str1, uuid_str2);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-
-       ret = gatt_api->client->register_for_notification(client_id, (bt_bdaddr_t *)address, (btgatt_srvc_id_t *)srvc_id, (btgatt_gatt_id_t *)char_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client register notification failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_deregister_for_notification(int client_id, bt_address_t * address,
-                       oal_gatt_srvc_id_t *srvc_id, oal_gatt_id_t *char_id) {
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       bdstr_t bdstr;
-
-       OAL_CHECK_PARAMETER(address, return);
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       API_TRACE("Client Deregister Notification: [%s], Service_uuid: [%s], Char_uuid: [%s]", bdt_bd2str(address, &bdstr), uuid_str1, uuid_str2);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_REGISTRATION(client_id);
-
-       ret = gatt_api->client->deregister_for_notification(client_id, (bt_bdaddr_t *)address, (btgatt_srvc_id_t *)srvc_id, (btgatt_gatt_id_t *)char_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client deregister notification failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-
-oal_status_t gattc_read_characteristic(int conn_id, oal_gatt_srvc_id_t *srvc_id,
-                               oal_gatt_id_t *char_id, oal_gatt_auth_req_t auth_req)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       API_TRACE("Client Read Characteristic: Service_uuid: [%s], Char_uuid: [%s]", uuid_str1, uuid_str2);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-
-       ret = gatt_api->client->read_characteristic(conn_id, (btgatt_srvc_id_t *)srvc_id,
-                                       (btgatt_gatt_id_t *)char_id, auth_req);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client read characteristic failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_read_descriptor(int conn_id, oal_gatt_srvc_id_t *srvc_id,
-               oal_gatt_id_t *char_id, oal_gatt_id_t *desc_id, oal_gatt_auth_req_t auth_req)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       char uuid_str3[2*BT_UUID_STRING_MAX];
-
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       OAL_CHECK_PARAMETER(desc_id, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       uuid_to_stringname(&(desc_id->uuid), uuid_str3);
-       API_TRACE("Client Read Descriptor: Service_uuid: [%s], Char_uuid: [%s], Desc_uuid: [%s]",
-                       uuid_str1, uuid_str2, uuid_str3);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-
-       ret = gatt_api->client->read_descriptor(conn_id, (btgatt_srvc_id_t *)srvc_id,
-                               (btgatt_gatt_id_t *)char_id, (btgatt_gatt_id_t *)desc_id, auth_req);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client read descriptor failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_write_characteristic(int conn_id, oal_gatt_srvc_id_t *srvc_id,
-               oal_gatt_id_t *char_id, oal_gatt_write_type_t write_type,
-               int len, oal_gatt_auth_req_t auth_req, char* data)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       OAL_CHECK_PARAMETER(data, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       API_TRACE("Client Write Characteristic: Service_uuid: [%s], Char_uuid: [%s]", uuid_str1, uuid_str2);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-
-       ret = gatt_api->client->write_characteristic(conn_id, (btgatt_srvc_id_t *)srvc_id,
-                       (btgatt_gatt_id_t *)char_id, write_type, len, auth_req, data);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client write characteristic failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_write_descriptor(int conn_id, oal_gatt_srvc_id_t *srvc_id,
-               oal_gatt_id_t *char_id, oal_gatt_id_t *desc_id,
-               oal_gatt_write_type_t write_type, int len, oal_gatt_auth_req_t auth_req, char* data)
-{
-       int ret = OAL_STATUS_SUCCESS;
-       char uuid_str1[2*BT_UUID_STRING_MAX];
-       char uuid_str2[2*BT_UUID_STRING_MAX];
-       char uuid_str3[2*BT_UUID_STRING_MAX];
-       OAL_CHECK_PARAMETER(srvc_id, return);
-       OAL_CHECK_PARAMETER(char_id, return);
-       OAL_CHECK_PARAMETER(desc_id, return);
-       OAL_CHECK_PARAMETER(data, return);
-       uuid_to_stringname(&(srvc_id->id.uuid), uuid_str1);
-       uuid_to_stringname(&(char_id->uuid), uuid_str2);
-       uuid_to_stringname(&(desc_id->uuid), uuid_str3);
-       API_TRACE("Client Write Descriptor: Service_uuid: [%s], Char_uuid: [%s], Desc_uuid: [%s]",
-                               uuid_str1, uuid_str2, uuid_str3);
-       CHECK_OAL_GATT_ENABLED();
-       CHECK_CLIENT_CONNECTION(conn_id);
-
-       ret = gatt_api->client->write_descriptor(conn_id, (btgatt_srvc_id_t *)srvc_id,
-                       (btgatt_gatt_id_t *)char_id, (btgatt_gatt_id_t *)desc_id, write_type, len, auth_req, data);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("GATT client write characteristic failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t gattc_conn_param_update(bt_address_t * address, int min, int max, int latency, int timeout)
-{
-       int ret;
-       bdstr_t bdstr;
-
-       OAL_CHECK_PARAMETER(address, return);
-       API_TRACE("Conn Param Update: [%s]", bdt_bd2str(address, &bdstr));
-       CHECK_OAL_GATT_ENABLED();
-
-       BT_INFO("[%s] min[%d] max[%d] latency[%d] timeout[%d]", bdt_bd2str(address, &bdstr), min, max, latency, timeout);
-       ret = gatt_api->client->conn_parameter_update((bt_bdaddr_t *)address, min, max, latency, timeout);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("error: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
diff --git a/oal-hardware.c b/oal-hardware.c
deleted file mode 100644 (file)
index abb8d9f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "oal-hardware.h"
-#include "oal-manager.h"
-#include "oal-internal.h"
-
-#define MAX_LINE_SIZE                   256
-#define MAX_STRING_SIZE                 128
-
-static bt_chip_type_t try_get_chip_type(void);
-
-static bt_chip_type_t bt_chip_type = BT_CHIP_TYPE_PLATFORM;
-
-const unsigned int nBTVidPidArry[][3] = {               /**< list of BT dongle's vid, pid */
-       /* { Vendor ID, Product ID, Chip Vendor } */
-       {0x0000, 0x0001, BT_CHIP_TYPE_PLATFORM},        /* Tizen Platform BT Chip */
-};
-
-static const char *str_chip_type[] = {
-       FOREACH_TYPE(GENERATE_TYPE_STRING)
-};
-
-int hw_is_chip_connected()
-{
-       /* Currently not supported, return TRUE as default */
-       return TRUE;
-}
-
-bt_chip_type_t hw_get_chip_type(void)
-{
-       bt_chip_type_t type;
-
-       type = ((bt_chip_type != BT_CHIP_TYPE_UNKNOWN) ? bt_chip_type : try_get_chip_type());
-
-       API_TRACE("Type: %s", str_chip_type[type]);
-       return type;
-}
-
-oal_status_t hw_chip_firmware_update(void)
-{
-       return OAL_STATUS_NOT_SUPPORT;
-}
-
-oal_status_t hw_is_module_ready(void)
-{
-       /* For Tizen Platform, set HW module ready to TRUE by default */
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t hw_is_fwupgrade_required(gboolean *is_required)
-{
-       return OAL_STATUS_NOT_SUPPORT;
-}
-
-static bt_chip_type_t try_get_chip_type(void)
-{
-       return bt_chip_type;
-}
-
diff --git a/oal-hdp.c b/oal-hdp.c
deleted file mode 100644 (file)
index 49c8b41..0000000
--- a/oal-hdp.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <dlog.h>
-#include <string.h>
-
-#include <bluetooth.h>
-#include <bt_hl.h>
-
-#include "oal-event.h"
-#include "oal-internal.h"
-#include "oal-common.h"
-#include "oal-manager.h"
-#include "oal-utils.h"
-#include "oal-hdp.h"
-
-#define CHECK_OAL_HDP_ENABLED() \
-       do { \
-               if (hdp_api == NULL) { \
-                       BT_ERR("HDP Not Enabled"); \
-                       return -1; \
-               } \
-       } while (0)
-
-typedef struct {
-       int app_id;
-       int role;
-       int data_type;
-       int channel_type;
-} oal_hdp_app_data_t;
-
-static void hdp_app_reg_state_cb(int app_id, bthl_app_reg_state_t state);
-static void hdp_channel_state_cb(int app_id, bt_bdaddr_t *bd_addr,
-               int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd);
-
-static bthl_callbacks_t sBluetoothHdpCallbacks = {
-       sizeof(sBluetoothHdpCallbacks),
-       hdp_app_reg_state_cb,
-       hdp_channel_state_cb,
-};
-
-static const bthl_interface_t *hdp_api;
-static GSList *app_list;
-
-static oal_hdp_app_data_t *__get_hdp_app_data(int app_id)
-{
-       GSList *l;
-
-       for (l = app_list; l != NULL; l = g_slist_next(l)) {
-               oal_hdp_app_data_t *app = l->data;
-
-               if (app && (app->app_id == app_id))
-                       return app;
-       }
-
-       return NULL;
-}
-
-static void __free_hdp_app_data(int app_id)
-{
-       oal_hdp_app_data_t *app = __get_hdp_app_data(app_id);
-
-       if (!app) {
-               BT_ERR("No app found with id: %d", app_id);
-               return;
-       }
-
-       app_list = g_slist_remove(app_list, app);
-       g_free(app);
-}
-
-static void hdp_app_reg_state_cb(int app_id, bthl_app_reg_state_t state)
-{
-       event_hdp_app_reg_t *event_data = g_new0(event_hdp_app_reg_t, 1);
-       oal_event_t event;
-
-       BT_DBG("app_id: %d, state: %d", app_id, state);
-
-       switch (state) {
-       case BTHL_APP_REG_STATE_REG_SUCCESS:
-               event = OAL_EVENT_HDP_APP_REGISTERED;
-               event_data->status = OAL_STATUS_SUCCESS;
-               break;
-       case BTHL_APP_REG_STATE_REG_FAILED:
-               event = OAL_EVENT_HDP_APP_REGISTERED;
-               event_data->status = OAL_STATUS_INTERNAL_ERROR;
-               __free_hdp_app_data(app_id);
-               break;
-       case BTHL_APP_REG_STATE_DEREG_SUCCESS:
-               event = OAL_EVENT_HDP_APP_UNREGISTERED;
-               event_data->status = OAL_STATUS_SUCCESS;
-               __free_hdp_app_data(app_id);
-               break;
-       case BTHL_APP_REG_STATE_DEREG_FAILED:
-               event = OAL_EVENT_HDP_APP_UNREGISTERED;
-               event_data->status = OAL_STATUS_INTERNAL_ERROR;
-               break;
-       default:
-               BT_ERR("Unknown state:%d received", state);
-               return;
-       }
-
-       event_data->app_id = app_id;
-       send_event(event, event_data, sizeof(event_hdp_app_reg_t));
-}
-
-static void hdp_channel_state_cb(int app_id, bt_bdaddr_t *bd_addr,
-               int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd)
-{
-       event_hdp_channel_conn_t *event_data;
-       oal_event_t event;
-       oal_hdp_app_data_t *app;
-
-       BT_DBG("app_id: %d, channel_id:%d, state:%d, fd:%d", app_id, channel_id, state, fd);
-
-       app = __get_hdp_app_data(app_id);
-       if (!app) {
-               BT_ERR("No app found with app_id: %d", app_id);
-               return;
-       }
-
-       switch (state) {
-       case BTHL_CONN_STATE_CONNECTING:
-               BT_DBG("BTHL_CONN_STATE_CONNECTING");
-               return;
-       case BTHL_CONN_STATE_DISCONNECTING:
-               BT_DBG("BTHL_CONN_STATE_DISCONNECTING");
-               return;
-       case BTHL_CONN_STATE_CONNECTED:
-               BT_DBG("BTHL_CONN_STATE_CONNECTED");
-               event = OAL_EVENT_HDP_CHANNEL_CONNECTED;
-               break;
-       case BTHL_CONN_STATE_DISCONNECTED:
-               BT_DBG("BTHL_CONN_STATE_DISCONNECTED");
-               event = OAL_EVENT_HDP_CHANNEL_DESTROYED;
-               break;
-       case BTHL_CONN_STATE_DESTROYED:
-               BT_DBG("BTHL_CONN_STATE_DESTROYED");
-               event = OAL_EVENT_HDP_CHANNEL_DESTROYED;
-               break;
-       default:
-               BT_ERR("Unknown stat: %d", state);
-               return;
-       }
-
-       event_data = g_new0(event_hdp_channel_conn_t, 1);
-       event_data->fd = fd;
-       event_data->app_id = app_id;
-       event_data->channel_id = channel_id;
-       event_data->ch_type = app->channel_type;
-       memcpy(event_data->address.addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       send_event_bda_trace(event, event_data,
-               sizeof(event_hdp_channel_conn_t), (bt_address_t*)bd_addr);
-}
-
-oal_status_t hdp_init(void)
-{
-       const bt_interface_t *blued_api;
-       int ret;
-
-       API_TRACE();
-
-       if (hdp_api != NULL) {
-               BT_WARN("HID Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       blued_api = adapter_get_stack_interface();
-       if (blued_api == NULL) {
-               BT_ERR("Stack is not initialized");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       hdp_api = (const bthl_interface_t *)blued_api->get_profile_interface(BT_PROFILE_HEALTH_ID);
-       if (hdp_api == NULL) {
-               BT_ERR("HDP interface failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       if ((ret = hdp_api->init(&sBluetoothHdpCallbacks)) != BT_STATUS_SUCCESS) {
-               BT_ERR("HDP Init failed: %s", status2string(ret));
-               hdp_api->cleanup();
-               hdp_api = NULL;
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t hdp_cleanup(void)
-{
-       GSList *l = app_list;
-
-       API_TRACE();
-
-       CHECK_OAL_HDP_ENABLED();
-
-       BT_DBG("+");
-
-       hdp_api->cleanup();
-       hdp_api = NULL;
-
-       for (l = app_list; NULL != l;) {
-               oal_hdp_app_data_t *app = l->data;
-               l = l->next;
-               if (app)
-                       __free_hdp_app_data(app->app_id);
-       }
-
-       if (app_list)
-               g_free(app_list);
-
-       BT_DBG("-");
-       return OAL_STATUS_SUCCESS;
-}
-
-int hdp_register_application(oal_hdp_role_t role,
-               oal_channel_type_t channel_type, const char *name, int data_type)
-{
-       int ret;
-       int app_id = -1;
-       bthl_mdep_role_t mdep_role;
-       bthl_channel_type_t ch_type;
-       bthl_reg_param_t *reg_param;
-       oal_hdp_app_data_t *app_data;
-
-       API_TRACE();
-
-       CHECK_OAL_HDP_ENABLED();
-
-       switch (role) {
-       case OAL_HDP_ROLE_SOURCE:
-               mdep_role = BTHL_MDEP_ROLE_SOURCE;
-               break;
-       case OAL_HDP_ROLE_SINK:
-               mdep_role = BTHL_MDEP_ROLE_SINK;
-               break;
-       default:
-               BT_ERR("Unknown role:%d", role);
-               return -1;
-       }
-
-       switch (channel_type) {
-       case OAL_CHANNEL_TYPE_RELIABLE:
-               ch_type = BTHL_CHANNEL_TYPE_RELIABLE;
-               break;
-       case OAL_CHANNEL_TYPE_STREAMING:
-               ch_type = BTHL_CHANNEL_TYPE_STREAMING;
-               break;
-       case OAL_CHANNEL_TYPE_ANY:
-               ch_type = BTHL_CHANNEL_TYPE_ANY;
-               break;
-       default:
-               BT_ERR("Unknown channel_type:%d", channel_type);
-               return -1;
-       }
-
-       reg_param = g_new0(bthl_reg_param_t, 1);
-       reg_param->application_name = name;
-       reg_param->number_of_mdeps = 1;
-       reg_param->mdep_cfg = g_new0(bthl_mdep_cfg_t, 1);
-       reg_param->mdep_cfg->mdep_role = mdep_role;
-       reg_param->mdep_cfg->data_type = data_type;
-       reg_param->mdep_cfg->channel_type = ch_type;
-
-       ret = hdp_api->register_application(reg_param, &app_id);
-       g_free(reg_param->mdep_cfg);
-       g_free(reg_param);
-
-       if (ret != BT_STATUS_SUCCESS || 0 > app_id) {
-               BT_ERR("HDP register_application failed: %s", status2string(ret));
-               return -1;
-       }
-
-       app_data = g_new0(oal_hdp_app_data_t, 1);
-       app_data->app_id = app_id;
-       app_data->role = role;
-       app_data->data_type = data_type;
-       app_data->channel_type = channel_type;
-
-       app_list = g_slist_append(app_list, app_data);
-
-       return app_id;
-}
-
-oal_status_t hdp_unregister_application(int app_id)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_HDP_ENABLED();
-
-       ret = hdp_api->unregister_application(app_id);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("HDP unregister_application failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-int hdp_connect_channel(int app_id, bt_address_t *address)
-{
-       int channel_id = -1;
-       int mdep_index = 0;
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_HDP_ENABLED();
-
-       ret = hdp_api->connect_channel(app_id, (bt_bdaddr_t*)address, mdep_index, &channel_id);
-       if (BT_STATUS_SUCCESS != ret || 0 > channel_id) {
-               BT_ERR("HDP connect_channel failed: %s", status2string(ret));
-               return -1;
-       }
-
-       return channel_id;
-}
-
-oal_status_t hdp_disconnect_channel(int channel_id)
-{
-       int ret;
-
-       API_TRACE();
-
-       CHECK_OAL_HDP_ENABLED();
-
-       ret = hdp_api->destroy_channel(channel_id);
-       if (BT_STATUS_SUCCESS != ret) {
-               BT_ERR("HDP destroy_channel failed: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
diff --git a/oal-hfp.c b/oal-hfp.c
deleted file mode 100644 (file)
index 6516245..0000000
--- a/oal-hfp.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * Contact: Anupam Roy <anupam.r@samsung.com>
- *
- * 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 <stdio.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dlog.h>
-
-#include <bluetooth.h>
-#include <bt_hf.h>
-
-#include "oal-common.h"
-#include "oal-internal.h"
-#include "oal-hfp.h"
-#include "oal-utils.h"
-
-#define CHECK_OAL_HF_ENABLED() \
-       do { \
-               if (blued_hfp_interface == NULL) { \
-                       BT_ERR("OAL, HFP Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-static void cb_hfp_connection_state(bthf_connection_state_t state, bt_bdaddr_t *bd_addr);
-static void cb_hfp_audio_connection_state(bthf_audio_state_t state, bt_bdaddr_t *bd_addr);
-
-const bt_interface_t * _bt_get_stack_interface(void);
-static const bthf_interface_t *blued_hfp_interface = NULL;
-
-static bthf_callbacks_t blued_hf_cb = {
-       sizeof(blued_hf_cb),
-       cb_hfp_connection_state,
-       cb_hfp_audio_connection_state,
-       NULL, /* vr_cmd_cb */
-       NULL, /* answer_call_cmd_cb */
-       NULL, /* hangup_call_cmd_cb */
-       NULL, /* volume_cmd_cb */
-       NULL, /* dial_call_cmd_cb */
-       NULL, /* dtmf_cmd_cb */
-       NULL, /* nrec_cmd_cb */
-       NULL, /* wbs_cb */
-       NULL, /* chld_cmd_cb */
-       NULL, /* cnum_cmd_cb */
-       NULL, /* cind_cmd_cb */
-       NULL, /* cops_cmd_cb */
-       NULL, /* clcc_cmd_cb */
-       NULL, /* unknown_at_cmd_cb */
-       NULL  /* key_pressed_cmd_cb */
-};
-
-oal_status_t hfp_enable(int max_hf_clients_supported)
-{
-       const bt_interface_t* blued_inf;
-       int ret;
-
-       API_TRACE("HF Enable");
-
-       if (max_hf_clients_supported > 1)
-               return OAL_STATUS_NOT_SUPPORT;
-
-       if ((blued_inf = adapter_get_stack_interface()) == NULL) {
-               BT_ERR("Bluetooth module is not loaded");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (blued_hfp_interface != NULL) {
-               BT_WARN("HF Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       if ((blued_hfp_interface = (const bthf_interface_t *)blued_inf->get_profile_interface(BT_PROFILE_HANDSFREE_ID)) == NULL) {
-               BT_ERR("OAL, Failed to get Bluetooth HF Interface");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       BT_DBG("Got profile interface");
-       if ((ret = blued_hfp_interface->init(&blued_hf_cb, 1)) != BT_STATUS_SUCCESS) {
-               BT_ERR("Failed to initialize Bluetooth HF, status: %s", status2string(ret));
-               blued_hfp_interface = NULL;
-               return convert_to_oal_status(ret);
-       }
-       BT_DBG("OAL, Bluetooth HF interface initialised");
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/* HF deinit: Resets all the HF information
- * Note: Adapter should be disabled before calling deinit
- * */
-oal_status_t hfp_disable(void)
-{
-       API_TRACE("HF disable");
-       CHECK_OAL_HF_ENABLED();
-
-       blued_hfp_interface->cleanup();
-       blued_hfp_interface = NULL;
-
-       return OAL_STATUS_SUCCESS;
-}
-
-void hfp_cleanup(void)
-{
-       API_TRACE("HF Cleanup");
-       blued_hfp_interface = NULL;
-}
-
-oal_status_t hfp_connect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bt_status_t status;
-       bdstr_t bdstr;
-       API_TRACE("HF Connect");
-
-       CHECK_OAL_HF_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT HF Address: %s", bdt_bd2str(device_address, &bdstr));
-       /* Call connect function of Bluedroid*/
-       status = blued_hfp_interface->connect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("Connection could not be established, err: %s", status2string(status));;
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-oal_status_t hfp_disconnect(bt_address_t *device_address)
-{
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       bt_status_t status;
-       API_TRACE("HF Disconnect");
-
-       CHECK_OAL_HF_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT HF Address: %s", bdt_bd2str(device_address, &bdstr));
-       /* call Disconnect function of Bluedroid */
-       status = blued_hfp_interface->disconnect((bt_bdaddr_t *)device_address);
-       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
-               BT_ERR("OAL, Disconnection failed err: %s", status2string(status));
-               result =  convert_to_oal_status(status);
-       }
-       return result;
-}
-
-oal_status_t hfp_connect_audio(bt_address_t *device_address)
-{
-       bt_status_t status;
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       API_TRACE("Connect HF Audio");
-
-       CHECK_OAL_HF_ENABLED();
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT HF Address: %s", bdt_bd2str(device_address, &bdstr));
-       status = blued_hfp_interface->connect_audio((bt_bdaddr_t *)device_address);
-
-       if (status != BT_STATUS_SUCCESS) {
-               BT_ERR("Start stream failed err: %s", status2string(status));
-               result = convert_to_oal_status(status);
-       }
-       return result;
-}
-
-oal_status_t hfp_disconnect_audio(bt_address_t *device_address)
-{
-       bt_status_t status;
-       int result = OAL_STATUS_SUCCESS;
-       bdstr_t bdstr;
-       API_TRACE("DisConnect HF Audio");
-
-       CHECK_OAL_HF_ENABLED();
-
-       OAL_CHECK_PARAMETER(device_address, return);
-
-       BT_INFO("BT HF Address: %s", bdt_bd2str(device_address, &bdstr));
-       status = blued_hfp_interface->disconnect_audio((bt_bdaddr_t *)device_address);
-
-       if (status != BT_STATUS_SUCCESS) {
-               BT_ERR("Start stream failed err: %s", status2string(status));
-               result = convert_to_oal_status(status);
-       }
-       return result;
-}
-
-static void cb_hfp_connection_state(bthf_connection_state_t state, bt_bdaddr_t *bd_addr)
-{
-       int event_type;
-       bdstr_t bdstr;
-       bt_address_t * event_data = NULL;
-       event_data = g_new0(bt_address_t, 1);
-       memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       if (bd_addr == NULL) {
-               BT_ERR("Address is NULL");
-               if (event_data)
-                       g_free(event_data);
-               return;
-       }
-
-       BT_INFO("HFP Profile state = [%d],  BT Address = [%s]", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-       switch (state) {
-       case BTHF_CONNECTION_STATE_DISCONNECTED: {
-                event_type = OAL_EVENT_HFP_DISCONNECTED;
-                break;
-       }
-       case BTHF_CONNECTION_STATE_CONNECTING: {
-               event_type = OAL_EVENT_HFP_CONNECTING;
-               break;
-       }
-       case BTHF_CONNECTION_STATE_CONNECTED: {
-               event_type = OAL_EVENT_HFP_CONNECTED;
-               break;
-       }
-       case BTHF_CONNECTION_STATE_DISCONNECTING: {
-               event_type = OAL_EVENT_HFP_DISCONNECTING;
-               break;
-       }
-       default: {
-               BT_INFO("Invalid state");
-               if (event_data)
-                       g_free(event_data);
-               return;
-       }
-       }
-       send_event_bda_trace(event_type, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-}
-
-static void cb_hfp_audio_connection_state(bthf_audio_state_t state, bt_bdaddr_t *bd_addr)
-{
-       int event_type;
-       bdstr_t bdstr;
-       bt_address_t * event_data = NULL;
-       event_data = g_new0(bt_address_t, 1);
-       memcpy(event_data->addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       if (bd_addr == NULL) {
-               BT_ERR("Address is NULL");
-               if (event_data)
-                       g_free(event_data);
-               return;
-       }
-       BT_INFO("HFP Audio state = [%d],  BT Address = [%s]", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
-
-       switch (state) {
-       case BTHF_AUDIO_STATE_DISCONNECTED: {
-               BT_INFO("HFP Audio(SCO) DisConnected");
-               event_type = OAL_EVENT_HFP_AUDIO_DISCONNECTED;
-               break;
-       }
-       case BTHF_AUDIO_STATE_CONNECTED: {
-               BT_INFO("HFP Audio(SCO) Connected");
-               event_type = OAL_EVENT_HFP_AUDIO_CONNECTED;
-               break;
-       }
-       case BTHF_AUDIO_STATE_CONNECTING: {
-               BT_INFO("HFP Audio(SCO) Connecting");
-               event_type = OAL_EVENT_HFP_AUDIO_CONNECTING;
-               break;
-       }
-       case BTHF_AUDIO_STATE_DISCONNECTING: {
-               BT_INFO("HFP Audio(SCO) DisConnecting");
-               event_type = OAL_EVENT_HFP_AUDIO_DISCONNECTING;
-               break;
-       }
-       default: {
-               BT_INFO("Invalid state");
-               if (event_data)
-                       g_free(event_data);
-               return;
-       }
-       }
-       send_event_bda_trace(event_type, event_data, sizeof(bt_address_t), (bt_address_t*)bd_addr);
-}
diff --git a/oal-hid-host.c b/oal-hid-host.c
deleted file mode 100644 (file)
index eb95e46..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <dlog.h>
-#include <string.h>
-
-#include <bluetooth.h>
-#include <bt_hh.h>
-
-#include "oal-event.h"
-#include "oal-internal.h"
-#include "oal-common.h"
-#include "oal-manager.h"
-#include "oal-hid-host.h"
-#include "oal-utils.h"
-
-#define CHECK_OAL_HID_ENABLED() \
-       do { \
-               if (hid_api == NULL) { \
-                       BT_ERR("HID Not Enabled"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-static void connection_state_callback(bt_bdaddr_t *bd_addr, bthh_connection_state_t state);
-static void hid_info_callback(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info);
-static void get_protocol_mode_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, bthh_protocol_mode_t mode);
-static void idle_time_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate);
-static void get_report_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size);
-static void virtual_unplug_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
-static void handshake_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
-
-static const bthh_interface_t * hid_api;
-
-static bthh_callbacks_t sBluetoothHidCallbacks = {
-       sizeof(sBluetoothHidCallbacks),
-       connection_state_callback,
-       hid_info_callback,
-       get_protocol_mode_callback,
-       idle_time_callback,
-       get_report_callback,
-       virtual_unplug_callback,
-       handshake_callback,
-};
-
-oal_status_t hid_enable(void)
-{
-       const bt_interface_t * blued_api;
-       int ret;
-
-       API_TRACE();
-       blued_api = adapter_get_stack_interface();
-
-       if (blued_api == NULL) {
-               BT_ERR("Stack is not initialized");
-               return OAL_STATUS_NOT_READY;
-       }
-       if (hid_api != NULL) {
-               BT_WARN("HID Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       hid_api = (const bthh_interface_t *)blued_api->get_profile_interface(BT_PROFILE_HIDHOST_ID);
-
-       if (hid_api == NULL) {
-               BT_ERR("HID interface failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       if ((ret = hid_api->init(&sBluetoothHidCallbacks)) != BT_STATUS_SUCCESS) {
-               BT_ERR("HID Init failed: %s", status2string(ret));
-               hid_api->cleanup();
-               hid_api = NULL;
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t hid_disable(void)
-{
-       API_TRACE();
-
-       CHECK_OAL_HID_ENABLED();
-
-       hid_api->cleanup();
-
-       hid_api = NULL;
-       return OAL_STATUS_SUCCESS;
-}
-
-void hid_cleanup(void)
-{
-       BT_DBG();
-       hid_api = NULL;
-}
-
-oal_status_t hid_connect(bt_address_t * address)
-{
-       int ret;
-       bdstr_t bdstr;
-
-       API_TRACE();
-       CHECK_OAL_HID_ENABLED();
-       BT_INFO("[%s]", bdt_bd2str(address, &bdstr));
-
-       ret = hid_api->connect((bt_bdaddr_t*)address);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("ret: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t hid_disconnect(bt_address_t * address)
-{
-       int ret;
-       bdstr_t bdstr;
-
-       API_TRACE();
-       CHECK_OAL_HID_ENABLED();
-
-       BT_INFO("[%s]", bdt_bd2str(address, &bdstr));
-
-       ret = hid_api->disconnect((bt_bdaddr_t*)address);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("ret: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t hid_set_report(bt_address_t *address,
-               bthh_report_type_t reportType, char *report)
-{
-       int ret;
-       bdstr_t bdstr;
-
-       API_TRACE("len: %d", strlen(report));
-       CHECK_OAL_HID_ENABLED();
-       OAL_CHECK_PARAMETER(address, return);
-       OAL_CHECK_PARAMETER(report, return);
-       BT_INFO("[%s]", bdt_bd2str(address, &bdstr));
-       BT_INFO("[data:%s]", report);
-
-       ret = hid_api->set_report((bt_bdaddr_t*)address, reportType, report);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("ret: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-oal_status_t hid_send_data(bt_address_t *address, uint8_t *buf, uint16_t len)
-{
-       int ret;
-       bdstr_t bdstr;
-
-       API_TRACE("len: %d", len);
-       CHECK_OAL_HID_ENABLED();
-       OAL_CHECK_PARAMETER(address, return);
-       OAL_CHECK_PARAMETER(buf, return);
-
-       BT_INFO("[%s]", bdt_bd2str(address, &bdstr));
-
-       ret = hid_api->send_data((bt_bdaddr_t*)address, (char *)buf);
-       if (ret != BT_STATUS_SUCCESS) {
-               BT_ERR("ret: %s", status2string(ret));
-               return convert_to_oal_status(ret);
-       }
-       return OAL_STATUS_SUCCESS;
-}
-
-static void connection_state_callback(bt_bdaddr_t *bd_addr, bthh_connection_state_t state)
-{
-       event_hid_conn_t *event = g_new0(event_hid_conn_t, 1);
-       int event_type;
-
-       BT_DBG("%d", state);
-
-       if (!event)
-               return;
-       memcpy(event->address.addr, bd_addr->address, BT_ADDRESS_BYTES_NUM);
-
-       event->status = OAL_STATUS_SUCCESS;
-
-       switch (state) {
-       case BTHH_CONN_STATE_CONNECTED:
-               event_type = OAL_EVENT_HID_CONNECTED;
-               break;
-       case BTHH_CONN_STATE_DISCONNECTED:
-               event_type = OAL_EVENT_HID_DISCONNECTED;
-               break;
-       case BTHH_CONN_STATE_CONNECTING:
-       case BTHH_CONN_STATE_DISCONNECTING:
-               g_free(event);
-               return;
-       case BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST:
-               event_type = OAL_EVENT_HID_DISCONNECTED;
-               event->status = OAL_STATUS_HID_FAILED_MOUSE;
-               break;
-       case BTHH_CONN_STATE_FAILED_KBD_FROM_HOST:
-       case BTHH_CONN_STATE_FAILED_TOO_MANY_DEVICES:
-       case BTHH_CONN_STATE_FAILED_NO_BTHID_DRIVER:
-       case BTHH_CONN_STATE_FAILED_GENERIC:
-               BT_ERR("HID Connection SPECIAL state(%d)", state);
-               event_type = OAL_EVENT_HID_DISCONNECTED;
-               event->status = OAL_STATUS_INTERNAL_ERROR;
-               break;
-       case BTHH_CONN_STATE_UNKNOWN:
-       default:
-               BT_ERR("Unhandled Connection state %d", state);
-               g_free(event);
-               return;
-       }
-
-       send_event_bda_trace(event_type, event, sizeof(event_hid_conn_t), (bt_address_t*)bd_addr);
-}
-
-static void hid_info_callback(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info)
-{
-       BT_INFO("");
-}
-
-static void get_protocol_mode_callback(bt_bdaddr_t *bd_addr,
-               bthh_status_t hh_status, bthh_protocol_mode_t mode)
-{
-       BT_INFO("status: %d, mode: %d", hh_status, mode);
-}
-
-static void idle_time_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate)
-{
-       BT_INFO("status: %d", hh_status);
-}
-
-static void get_report_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size)
-{
-       BT_INFO("status: %d", hh_status);
-}
-
-static void virtual_unplug_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status)
-{
-       BT_INFO("status: %d", hh_status);
-}
-
-static void handshake_callback(bt_bdaddr_t *bd_addr, bthh_status_t hh_status)
-{
-       BT_INFO("status: %d", hh_status);
-}
diff --git a/oal-internal.h b/oal-internal.h
deleted file mode 100644 (file)
index e1fbfad..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-* Open Adaptation Layer (OAL)
-*
-* Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
-*
-* 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 _OAL_INTERNAL_H_
-#define _OAL_INTERNAL_H_
-
-#include <glib.h>
-#include <sys/types.h>
-#include <dlog.h>
-#include <bluetooth.h>
-
-#include <oal-event.h>
-#include "oal-manager.h"
-#include "oal-utils.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define OAL_VERSION_STR "Samsung OAL Version v0.1"
-
-#define PR_TASK_PERF_USER_TRACE 666
-#define BT_ADDRESS_STRING_SIZE 18
-#define BT_UUID_STRING_MAX 50
-
-#undef LOG_TAG
-#define LOG_TAG "BT_OAL"
-
-#define BT_DBG(fmt, args...) \
-       LOGD(fmt, ##args)
-#define BT_ERR(fmt, args...) \
-       LOGE(RED(fmt), ##args)
-#define BT_INFO(fmt, args...) \
-               LOGI(fmt, ##args)
-#define BT_VBS(fmt, args...) \
-               {SLOGI(fmt, ##args); LOGI(fmt, ##args); }
-#define BT_WARN(fmt, args...) \
-               LOGW(YELLOW(fmt), ##args)
-#define NO_SUPP_CHK(status, fmt, args...) do {\
-                       if (status == BT_STATUS_UNSUPPORTED)    \
-                               BT_WARN(fmt, ##args);                   \
-                       else                                                            \
-                               BT_ERR(fmt, ##args);                    \
-                       } while (0)
-
-
-#define API_TRACE(fmt, args...) {LOG_(LOG_ID_SYSTEM, DLOG_INFO, "OAL_API", GREEN(fmt), ##args); \
-                       LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, GREEN("[OAL_API]"fmt), ##args); }
-
-#define send_event_trace(e, d, l, a, fmt, args...) do {\
-                                                                       bdstr_t bdstr;\
-                                                                       send_event_no_trace(e, d, l); \
-                                                                       LOG_(LOG_ID_SYSTEM, DLOG_INFO, "OAL_EVENT", GREEN(fmt" [%s] %s"), ##args, bdt_bd2str(a, &bdstr), str_event[event]); \
-                                                                       LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, GREEN("[OAL_EVENT]"fmt" [%s] %s"), ##args, bdt_bd2str(a, &bdstr), str_event[event]);\
-                                                                       } while (0)
-
-
-#define ret_if(expr) \
-       do { \
-               if (expr) { \
-                       BT_ERR("(%s) return", #expr); \
-                       return; \
-               } \
-       } while (0)
-
-#define retv_if(expr, val) \
-       do { \
-               if (expr) { \
-                       BT_ERR("(%s) return", #expr); \
-                       return (val); \
-               } \
-       } while (0)
-
-#define OAL_CHECK_PARAMETER(arg, func) \
-       do { \
-               if (arg == NULL) { \
-                       BT_ERR("INVALID PARAMETER"); \
-                       func OAL_STATUS_INVALID_PARAM; \
-               } \
-       } while (0)
-
-#define CHECK_OAL_INITIALIZED() \
-       do { \
-               if (blued_api == NULL) { \
-                       BT_ERR("OAL Not Initialized"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-#define BT_ADDRESS_STRING_SIZE 18
-
-typedef struct {
-       int len;
-       uint8_t * adv_data;
-} ble_adv_data_t;
-
-/* Adapter manager */
-void oal_mgr_cleanup(void);
-void oal_mgr_stack_reload(void);
-
-/* Device manager */
-void device_mgr_init(const bt_interface_t * stack_if);
-void device_mgr_cleanup(void);
-
-oal_status_t adapter_mgr_init(const bt_interface_t * stack_if);
-const bt_interface_t* adapter_get_stack_interface(void);
-
-/* Event Manager */
-/* Use this when Address is to be printed */
-void send_event_bda_trace(oal_event_t event, gpointer event_data, gsize len, bt_address_t *address);
-
-void send_event_no_trace(oal_event_t event, gpointer event_data, gsize len);
-
-/* Use this when no address printing is required */
-#define _bt_dispatch_event send_event
-void send_event(oal_event_t event, gpointer event_data, gsize len);
-void _bt_event_dispatcher_init(oal_event_callback cb);
-void _bt_event_dispatcher_deinit(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /*_OAL_HARDWARE_H_*/
-
diff --git a/oal-manager.c b/oal-manager.c
deleted file mode 100644 (file)
index 87b4869..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <dlog.h>
-#include <string.h>
-#include <vconf.h>
-#include <sys/prctl.h>
-#include <unistd.h>
-#include <dlfcn.h>
-
-#include <bluetooth.h>
-
-#include "oal-internal.h"
-#include "oal-event.h"
-#include <oal-hardware.h>
-
-#define BT_HAL_LIB_NAME                        "libbluetooth.default.so"
-
-#ifdef ARCH64
-#define HAL_LIBRARY_PATH               "/usr/lib64"
-#else
-#define HAL_LIBRARY_PATH               "/usr/lib"
-#endif
-
-#define LIB_PATH_SIZE                  50
-#define LIB_NAME_SIZE                  50
-
-static const hw_module_t* module = NULL;
-static const bt_interface_t *blued_api = NULL;
-
-static gboolean unload_libs(gpointer data);
-static bluetooth_device_t* load_hal_lib(void);
-static const bt_interface_t * get_stack_interface(bluetooth_device_t* bt_device);
-static int load(const char *libname, const struct hw_module_t **module);
-static int unload(const struct hw_module_t *module);
-
-oal_status_t oal_mgr_init_internal(void)
-{
-       bluetooth_device_t* bt_device;
-
-       bt_device = load_hal_lib();
-
-       if (bt_device == NULL) {
-               BT_ERR("HAL Library loading failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       blued_api = get_stack_interface(bt_device);
-
-       if (blued_api == NULL) {
-               BT_ERR("Stack Interface failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       device_mgr_init(blued_api);
-
-       return adapter_mgr_init(blued_api);
-}
-
-oal_status_t oal_bt_init(oal_event_callback cb)
-{
-       API_TRACE("Version: %s", OAL_VERSION_STR);
-       _bt_event_dispatcher_init(cb);
-       return OAL_STATUS_PENDING;
-}
-
-void oal_bt_deinit(void)
-{
-       BT_INFO("+");
-       blued_api->cleanup();
-       blued_api = NULL;
-       _bt_event_dispatcher_deinit();
-       sleep(1);
-       unload_libs(NULL);
-       BT_INFO("-");
-}
-
-void oal_mgr_cleanup(void)
-{
-       /*TODO Unsupported */
-}
-
-void oal_mgr_stack_reload(void)
-{
-       /*TODO Unsupported */
-}
-
-gboolean oal_lib_init(gpointer data)
-{
-       oal_status_t ret;
-       BT_INFO("Going to check Chip Attachment...");
-
-       if (hw_is_module_ready() == OAL_STATUS_SUCCESS) {
-               if (hw_get_chip_type() == BT_CHIP_TYPE_UNKNOWN) {
-                       BT_DBG("Chip Type Unknown, starting timer...");
-               } else {
-                       ret = oal_mgr_init_internal();
-                       if (OAL_STATUS_SUCCESS == ret)
-                               send_event(OAL_EVENT_OAL_INITIALISED_SUCCESS, NULL, 0);
-                       else
-                               send_event(OAL_EVENT_OAL_INITIALISED_FAILED, NULL, 0);
-               }
-       } else {
-               BT_DBG("Chip Not Yet Ready, try again...");
-               return FALSE;
-       }
-       return TRUE;
-}
-
-static gboolean unload_libs(gpointer data)
-{
-       unload((hw_module_t const*)module);
-       module = NULL;
-       return FALSE;
-}
-
-static bluetooth_device_t* load_hal_lib(void)
-{
-       int err = 0;
-       hw_device_t* device;
-       bluetooth_device_t* bt_device = NULL;
-
-       BT_DBG("Loading HAL lib");
-       if (module == NULL) {
-               switch (hw_get_chip_type()) {
-               case BT_CHIP_TYPE_PLATFORM:
-                       BT_INFO("Tizen Platform BT chip: Tizen Platform HAL library will be loaded");
-                       err = load(BT_HAL_LIB_NAME, (const hw_module_t **)&module);
-                       break;
-               default:
-                       BT_WARN("Chip type Unknown, So no Library Load");
-                       err = -EINVAL;
-                       break;
-               }
-       } else
-               BT_WARN("Lib already loaded");
-
-       if (err == 0) {
-               err = module->methods->open(module, BT_HARDWARE_MODULE_ID, &device);
-               if (err == 0) {
-                       bt_device = (bluetooth_device_t *)device;
-                       BT_INFO("HAL Library loaded successfullly");
-               }
-       }
-
-       if (err != 0)
-               BT_INFO("%d", err);
-       return bt_device;
-}
-
-static const bt_interface_t * get_stack_interface(bluetooth_device_t* bt_device)
-{
-       const bt_interface_t *blued_api = NULL;
-       /* Get the Bluetooth interface */
-       blued_api = bt_device->get_bluetooth_interface();
-
-       return blued_api;
-}
-
-static int load(const char *libname, const struct hw_module_t **module)
-{
-       int status = -ENOENT;
-       char libpath[LIB_PATH_SIZE];
-       void *handle;
-       struct hw_module_t *hmi;
-
-       OAL_CHECK_PARAMETER(libname, return);
-
-       snprintf(libpath, sizeof(libpath), "%s/%s", HAL_LIBRARY_PATH, libname);
-       BT_INFO("Loading Library: %s", libpath);
-
-       /*
-        * load the symbols resolving undefined symbols before
-        * dlopen returns. Since RTLD_GLOBAL is not or'd in with
-        * RTLD_NOW the external symbols will not be global
-        */
-
-       prctl(666, "[bt-service] Load Lib S", strlen("[bt-service] Load Lib S"));
-
-       handle = dlopen(libpath, RTLD_NOW);
-       if (handle == NULL) {
-               char const *err_str = dlerror();
-               BT_ERR("load: module=%s\n%s", libpath, err_str ? err_str : "unknown");
-               status = -EINVAL;
-               goto done;
-       }
-
-       prctl(666, "[bt-service] Load Lib E", strlen("[bt-service] Load Lib E"));
-
-       /* Get the address of the struct hal_module_info. */
-       const char *sym = HAL_MODULE_INFO_SYM_AS_STR;
-       hmi = (struct hw_module_t *)dlsym(handle, sym);
-       if (hmi == NULL) {
-               BT_ERR("load: couldn't find symbol %s", sym);
-               status = -EINVAL;
-               goto done;
-       }
-
-       /* Check that the id matches */
-       if (strcmp(BT_HARDWARE_MODULE_ID, hmi->id) != 0) {
-               BT_ERR("load: id=%s != hmi->id=%s", BT_HARDWARE_MODULE_ID, hmi->id);
-               status = -EINVAL;
-               goto done;
-       }
-
-       hmi->dso = handle;
-       status = 0;
-
-done:
-       if (status != 0) {
-               hmi = NULL;
-               if (handle != NULL) {
-                       dlclose(handle);
-                       handle = NULL;
-               }
-       } else {
-               BT_DBG("loaded HAL id=%s libpath=%s hmi=%p handle=%p",
-                               BT_HARDWARE_MODULE_ID, libpath, hmi, handle);
-       }
-       *module = hmi;
-       return status;
-}
-
-static int unload(const struct hw_module_t *module)
-{
-       int ret = 1;
-
-       if (module)
-               ret = dlclose(module->dso);
-
-       if (ret != 0)
-               BT_ERR("dlclose failed:%d", ret);
-       BT_WARN("Issues with dl: %s\n", dlerror());
-       return ret;
-}
-
-void oal_set_debug_mode(gboolean mode)
-{
-       /*TODO Unsupported */
-}
-
-gboolean oal_get_debug_mode(void)
-{
-       /*TODO Unsupported */
-       return FALSE;
-}
diff --git a/oal-socket.c b/oal-socket.c
deleted file mode 100644 (file)
index 0d3fe43..0000000
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Open Adaptation Layer (OAL)
- *
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
- *
- * 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 <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <glib.h>
-#include <dlog.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include <oal-event.h>
-#include <oal-manager.h>
-#include "oal-internal.h"
-
-#include "bluetooth.h"
-#include "bt_sock.h"
-#include "oal-socket.h"
-#include "oal-utils.h"
-
-#define CHECK_OAL_SOCKET_ENABLED() \
-       do { \
-               if (socket_api == NULL) { \
-                       BT_ERR("Socket is not Initialized"); \
-                       return OAL_STATUS_NOT_READY; \
-               } \
-       } while (0)
-
-/* Definitions */
-#define MAX_RETRY 5
-#define SOCK_SHORT_LEN 2
-#define SOCK_INT_LEN 4
-#define SOCK_CONNECT_INFO_LEN 16
-#define SOCK_BD_ADDR_LEN 6
-
-typedef struct {
-       int fd;
-       int sock_type;
-       bt_address_t address;
-       guint control_id;
-       GIOChannel *control_io;
-} oal_client_info_t;
-
-/*
- * Global variables
- */
-static const btsock_interface_t* socket_api = NULL;
-
-static int getInt(char *buf, int len)
-{
-       int val = 0;
-
-       if (len != SOCK_INT_LEN)
-               return -1;
-       val = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
-       return val;
-}
-
-static int getShort(char *buf, int len)
-{
-       int val = 0;
-
-       if (len != SOCK_SHORT_LEN)
-               return -1;
-       val = buf[0] | (buf[1] << 8);
-       return val;
-}
-
-static int getBdaddr(char *buf, int len, bt_bdaddr_t *bd)
-{
-       int val = 0;
-
-       if (len != SOCK_BD_ADDR_LEN)
-               return -1;
-       bd->address[0] = buf[0];
-       bd->address[1] = buf[1];
-       bd->address[2] = buf[2];
-       bd->address[3] = buf[3];
-       bd->address[4] = buf[4];
-       bd->address[5] = buf[5];
-       BT_DBG("Address: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
-                       bd->address[0], bd->address[1], bd->address[2],
-                       bd->address[3], bd->address[4], bd->address[5]);
-       return val;
-}
-static void remove_io_channel(guint gid, GIOChannel *gch)
-{
-       if (gch != NULL)
-               g_io_channel_shutdown(gch, TRUE, NULL);
-       if (gid > 0)
-               g_source_remove(gid);
-}
-
-static int socket_process_cmsg(struct msghdr *pMsg, int * data_fd)
-{
-       struct cmsghdr *cmsgptr = NULL;
-
-       for (cmsgptr = CMSG_FIRSTHDR(pMsg);
-                       cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(pMsg, cmsgptr)) {
-
-               if (cmsgptr->cmsg_level != SOL_SOCKET)
-                       continue;
-
-               if (cmsgptr->cmsg_type == SCM_RIGHTS) {
-                       int *pDescriptors = (int *)CMSG_DATA(cmsgptr);
-                       int count = ((cmsgptr->cmsg_len - CMSG_LEN(0)) / sizeof(int));
-
-                       if (count < 0) {
-                               BT_ERR("ERROR Invalid count of descriptors");
-                               continue;
-                       }
-
-                       BT_DBG("Server, socket fd for connection: %d", pDescriptors[0]);
-                       *data_fd = pDescriptors[0];
-               }
-       }
-
-       return 0;
-}
-
-static int socket_read(int fd, char *buf, size_t len, int *data_fd)
-{
-       int ret;
-       struct msghdr msg;
-       struct iovec iv;
-       struct cmsghdr cmsgbuf[2*sizeof(struct cmsghdr) + 0x100];
-       int retryCount = 0;
-       int flags = 0;
-
-       fd_set  toselect_fd;
-       struct timeval wait;
-
-       BT_INFO("socket_read, fd = %d", fd);
-
-       retv_if(fd < 0, -1);
-
-       memset(&msg, 0, sizeof(msg));
-       memset(&iv, 0, sizeof(iv));
-
-       iv.iov_base = buf;
-       iv.iov_len = len;
-
-       msg.msg_iov = &iv;
-       msg.msg_iovlen = 1;
-       msg.msg_control = cmsgbuf;
-       msg.msg_controllen = sizeof(cmsgbuf);
-
-       flags = fcntl(fd, F_GETFL, 0);
-       if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
-               BT_ERR("Not able to change socket nonblocking");
-               return -2;
-       }
-
-       FD_ZERO(&toselect_fd);
-       FD_SET(fd, &toselect_fd);
-       wait.tv_sec = 1;
-       wait.tv_usec = 0;
-
-       ret = select(fd + 1, &toselect_fd, NULL, NULL, &wait);
-       if (ret < 0) {
-               fcntl(fd, F_SETFL, flags);
-               BT_ERR("Time out on selecy = %d", ret);
-               return -1;
-       }
-
-repeat:
-       retryCount++;
-       ret = recvmsg(fd, &msg, 0); //MSG_NOSIGNAL);
-       BT_DBG("socket_read, recvmsg ret = %d", ret);
-       if (ret < 0 && errno == EINTR) {
-               if (retryCount < MAX_RETRY) {
-                       goto repeat;
-               } else {
-                       fcntl(fd, F_SETFL, flags);
-                       return -2;
-               }
-       }
-
-       if (ret < 0 && errno == EPIPE) {
-               // Treat this as an end of stream
-               fcntl(fd, F_SETFL, flags);
-               BT_ERR("EOS errno: %d", errno);
-               return 0;
-       }
-
-       if (ret < 0) {
-               fcntl(fd, F_SETFL, flags);
-               BT_ERR("Ret errno: %d", errno);
-               return -1;
-       }
-
-       /* FD_ISSET need not be checked */
-       fcntl(fd, F_SETFL, flags);
-       if ((msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) != 0) {
-               // To us, any of the above flags are a fatal error
-               BT_ERR("MSG Flags errno: %d", errno);
-               return -2;
-       }
-
-       if (ret >= 0 && data_fd) {
-               BT_INFO("Connection received");
-               socket_process_cmsg(&msg, data_fd);
-       }
-
-       return ret;
-}
-
-static int sock_wait_for_channel(int sock_fd)
-{
-       int readlen = -1;
-       char buf[SOCK_INT_LEN];
-
-       readlen = socket_read(sock_fd, buf, SOCK_INT_LEN, NULL);
-       return getInt(buf, readlen);
-}
-
-static int sock_wait_for_connect_signal(int sock_fd,
-               int *data_fd, bt_bdaddr_t *bd_addr)
-{
-       int readlen = -1;
-       char buf[SOCK_CONNECT_INFO_LEN];
-       int size = -1, channel = -1, status = -1;
-       int len = 0;
-
-       readlen = socket_read(sock_fd, buf, SOCK_CONNECT_INFO_LEN, data_fd);
-       BT_DBG("Socket Read len: %d", readlen);
-       if (readlen == 0) {
-               BT_WARN("Listen stopped");
-               return -1; /* This essentially means that the listen is stopped */
-       }
-
-       if (readlen != SOCK_CONNECT_INFO_LEN) {
-               BT_ERR("Read length is not same as socket info length");
-               return -2;
-       }
-
-       size = getShort(&buf[len], SOCK_SHORT_LEN);
-       len += SOCK_SHORT_LEN;
-       if (size != SOCK_CONNECT_INFO_LEN)
-               return -3;
-
-       getBdaddr(&buf[len], SOCK_BD_ADDR_LEN, bd_addr); len += SOCK_BD_ADDR_LEN;
-       channel = getInt(&buf[len], SOCK_INT_LEN); len += SOCK_INT_LEN;
-       status = getInt(&buf[len], SOCK_INT_LEN);
-
-       BT_INFO("BTSOCK CONNECTION ESTABLISHED REMOTE Channel:%d, Status:%d",
-                       channel, status);
-       return 0;
-}
-
-static int sock_wait_for_connection_setup(oal_client_info_t *p_oal_client_info)
-{
-       int channel = -1;
-       int ret = -1;
-
-       /* First, wait for channel number */
-       channel = sock_wait_for_channel(p_oal_client_info->fd);
-       if (channel < 0) {
-               BT_ERR("ERROR, incorrect channel= %d", channel);
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       BT_INFO("client channel= %d", channel);
-
-       /* Now, wait for connection signal */
-       ret = sock_wait_for_connect_signal(p_oal_client_info->fd,
-                       NULL, (bt_bdaddr_t *)&p_oal_client_info->address);
-       if (0 > ret) {
-               BT_ERR("ERROR, sock_wait_for_connect_signal failed");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       return OAL_STATUS_SUCCESS;
-}
-
-/*
- * This function will be called only once as connection setup is done here
- * and then data will be received directly in application context using fd
- * passed in socket connection event.
- */
-static gboolean sockclient_thread(GIOChannel *gio, GIOCondition cond, gpointer data)
-{
-       event_socket_client_conn_t *client_info_ev;
-       oal_client_info_t *p_oal_client_info = (oal_client_info_t *)data;
-
-       retv_if(p_oal_client_info == NULL, FALSE);
-       retv_if(p_oal_client_info->fd < 0, FALSE);
-
-       BT_DBG("Client fd= %d", p_oal_client_info->fd);
-
-       /* This memory will be freed by event dispatcher */
-       client_info_ev = g_new0(event_socket_client_conn_t, 1);
-       client_info_ev->fd = p_oal_client_info->fd;
-       client_info_ev->sock_type = p_oal_client_info->sock_type;
-       memcpy(&client_info_ev->address, &p_oal_client_info->address, sizeof(bt_address_t));
-
-       if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
-               BT_INFO("Client disconnected-0x%X (fd = %d)",
-                               cond, p_oal_client_info->fd);
-               goto failed;
-       }
-
-       if (OAL_STATUS_SUCCESS == sock_wait_for_connection_setup(p_oal_client_info)) {
-               BT_INFO("connection setup success");
-               send_event_bda_trace(OAL_EVENT_SOCKET_OUTGOING_CONNECTED, client_info_ev,
-                               sizeof(event_socket_client_conn_t), &p_oal_client_info->address);
-               goto done;
-       }
-
-       BT_ERR("ERROR, incorrect connection setup");
-
-failed:
-       remove_io_channel(p_oal_client_info->control_id, p_oal_client_info->control_io);
-       send_event_bda_trace(OAL_EVENT_SOCKET_DISCONNECTED, client_info_ev,
-                       sizeof(event_socket_client_conn_t), &p_oal_client_info->address);
-done:
-       g_free(p_oal_client_info);
-       return FALSE;
-}
-
-int socket_connect(oal_sock_type_t sock_type, oal_uuid_t *p_uuid, int channel, bt_address_t* bd)
-{
-       oal_client_info_t *p_oal_client_info = NULL;
-       int sock_fd = -1;
-       bdstr_t bdstr;
-
-       API_TRACE("Socket connect: %s", bdt_bd2str(bd, &bdstr));
-
-       CHECK_OAL_SOCKET_ENABLED();
-
-       p_oal_client_info = g_new0(oal_client_info_t, 1);
-
-       switch (sock_type) {
-       case OAL_SOCK_RFCOMM:
-               if (channel < 0)
-                       socket_api->connect((const bt_bdaddr_t *)bd,
-                               BTSOCK_RFCOMM, p_uuid->uuid, 0, &sock_fd, 0);
-               else
-                       socket_api->connect((const bt_bdaddr_t *)bd,
-                               BTSOCK_RFCOMM, NULL, channel, &sock_fd, 0);
-               break;
-       default:
-               BT_ERR("Socket type: %d not supported", sock_type);
-       }
-
-       if (sock_fd < 0) {
-               BT_ERR("Bluetooth socket connect failed");
-               g_free(p_oal_client_info);
-               return sock_fd;
-       }
-
-       BT_INFO("Bluetooth client socket created, sock_fd=%d", sock_fd);
-
-       p_oal_client_info->fd = sock_fd;
-       p_oal_client_info->sock_type = sock_type;
-       memcpy(&p_oal_client_info->address, bd, sizeof(bt_address_t));
-       p_oal_client_info->control_io = g_io_channel_unix_new(p_oal_client_info->fd);
-       p_oal_client_info->control_id = g_io_add_watch(p_oal_client_info->control_io,
-                       G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-                       sockclient_thread, p_oal_client_info);
-       g_io_channel_set_close_on_unref(p_oal_client_info->control_io, FALSE);
-       g_io_channel_unref(p_oal_client_info->control_io);
-
-       BT_DBG("Client watch added");
-       return sock_fd;
-}
-
-int socket_listen(oal_sock_type_t sock_type, oal_uuid_t *p_uuid, char *svc_name, int channel)
-{
-       int sock_fd = -1;
-       int srv_channel;
-       int ret = BT_STATUS_FAIL;
-
-       CHECK_OAL_SOCKET_ENABLED();
-       OAL_CHECK_PARAMETER(svc_name, return);
-       API_TRACE("svc_name: %s", svc_name);
-
-       switch (sock_type) {
-       case OAL_SOCK_RFCOMM:
-               if (channel < 0)
-                       ret = socket_api->listen(BTSOCK_RFCOMM,
-                                       svc_name, p_uuid->uuid, 0, &sock_fd, 0);
-               else
-                       ret = socket_api->listen(BTSOCK_RFCOMM,
-                                       svc_name, p_uuid->uuid, channel, &sock_fd, 0);
-               break;
-       default:
-               BT_ERR("Socket type: %d not supported", sock_type);
-       }
-
-       if (sock_fd < 0 || ret != BT_STATUS_SUCCESS) {
-               BT_ERR("Bluetooth socket creation failed");
-               return sock_fd;
-       }
-
-       BT_INFO("Bluetooth server socket created, sock_fd=%d", sock_fd);
-
-       /* Read server channel number sent by stack */
-       srv_channel = sock_wait_for_channel(sock_fd);
-       if (srv_channel < 0) {
-               BT_ERR("incorrect channel= %d", srv_channel);
-               return  -1;
-       }
-
-       BT_INFO("server channel= %d", srv_channel);
-
-       return sock_fd;
-}
-
-oal_status_t socket_enable()
-{
-       const bt_interface_t *blued_api;
-
-       API_TRACE("Socket Init");
-
-       blued_api = adapter_get_stack_interface();
-       if (blued_api == NULL) {
-               BT_ERR("Stack is not initialized");
-               return OAL_STATUS_NOT_READY;
-       }
-
-       if (socket_api != NULL) {
-               BT_WARN("Socket Interface is already initialized...");
-               return OAL_STATUS_ALREADY_DONE;
-       }
-
-       socket_api = (const btsock_interface_t*)blued_api->get_profile_interface(BT_PROFILE_SOCKETS_ID);
-       if (!socket_api) {
-               BT_ERR("OAL Socket failed to initialize");
-               return OAL_STATUS_INTERNAL_ERROR;
-       }
-
-       BT_DBG("Socket successfully initiated");
-       return OAL_STATUS_SUCCESS ;
-}
-
-oal_status_t socket_disable(void)
-{
-
-       API_TRACE("Socket Deinit");
-
-       CHECK_OAL_SOCKET_ENABLED();
-       socket_api = NULL;
-       return OAL_STATUS_SUCCESS;
-}
old mode 100644 (file)
new mode 100755 (executable)
index 491d14e..3acce58 100644 (file)
@@ -7,16 +7,16 @@ License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1001: %{name}.manifest
 
-BuildRequires:  pkgconfig(dbus-1)
-BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(gio-2.0)
-BuildRequires:  pkgconfig(gio-unix-2.0)
-BuildRequires:  pkgconfig(vconf)
-BuildRequires:  pkgconfig(libxml-2.0)
+#BuildRequires:  pkgconfig(dbus-1)
+#BuildRequires:  pkgconfig(dlog)
+#BuildRequires:  pkgconfig(glib-2.0)
+#BuildRequires:  pkgconfig(gio-2.0)
+#BuildRequires:  pkgconfig(gio-unix-2.0)
+#BuildRequires:  pkgconfig(vconf)
+#BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  cmake
 
-Requires(post): /usr/bin/vconftool
+#Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
@@ -70,9 +70,13 @@ make
 rm -rf %{buildroot}
 %make_install
 
-%if %{bt_bluez_hal} == ENABLED
-install -D -m 0644 libraries/libbluetooth.default.so %{buildroot}%{_libdir}/
-%endif
+#%if %{bt_bluez_hal} == ENABLED
+#install -D -m 0644 libraries/libbluetooth.default.so %{buildroot}%{_libdir}/
+#%endif
+
+%post
+ln -sf %{_libdir}/libbt-oal.so %{_libdir}/libbt-oal.so.1
+ln -sf %{_libdir}/libbt-oal.so %{_libdir}/libbt-oal.so.1.0.0
 
 %postun -p /sbin/ldconfig
 
@@ -80,14 +84,14 @@ install -D -m 0644 libraries/libbluetooth.default.so %{buildroot}%{_libdir}/
 %manifest %{name}.manifest
 %license LICENSE
 %{_libdir}/libbt-oal.so*
-%if %{bt_bluez_hal} == ENABLED
-%{_libdir}/libbluetooth.default.so*
-%endif
+#%if %{bt_bluez_hal} == ENABLED
+#%{_libdir}/libbluetooth.default.so*
+#%endif
 
 %files devel
 %defattr(-, root, root)
 %{_libdir}/libbt-oal.so
 %{_libdir}/pkgconfig/libbt-oal.pc
 %{_includedir}/bt-oal/*.h
-#%exclude /usr/lib/debug/*
-#%exclude /usr/lib/debug/.build-id/*
+%exclude /usr/lib/debug/*
+%exclude /usr/lib/debug/.build-id/*