upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:59:48 +0000 (16:59 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:59:48 +0000 (16:59 +0900)
30 files changed:
.gitignore [deleted file]
CMakeLists.txt
bluetooth-frwk-agent/CMakeLists.txt
bluetooth-frwk-agent/bluetooth-agent.c
bluetooth-map-agent/bluetooth_map_agent.c
bluetooth-media-control/CMakeLists.txt [deleted file]
bluetooth-media-control/bluetooth-media-control.c [deleted file]
bluetooth-media-control/bluetooth-media-control.h [deleted file]
bluetooth-media-control/bluetooth-media-control.pc.in [deleted file]
bluetooth-pb-agent/bluetooth_pb_agent.c
bluetooth-pb-agent/bluetooth_pb_agent.xml
debian/bluetooth-frwk-0.postinst
debian/changelog
debian/control
debian/rules
lib/BluetoothFW_PG.h [new file with mode: 0644]
lib/SLP_BluetoothFW_PG.h [deleted file]
lib/bluetooth-api-common.c
lib/bluetooth-api-common.h
lib/bluetooth-api.h
lib/bluetooth-gap-api.c
lib/bluetooth-hdp-api.c
lib/bluetooth-network-api.c
lib/bluetooth-obex-server-api.c
lib/bluetooth-obex-server-api.h
lib/bluetooth-opc-api.c
lib/bluetooth-rfcomm-api.c
lib/bluetooth-sdp-api.c
lib/obex-agent.c
packaging/bluetooth-frwk.spec

diff --git a/.gitignore b/.gitignore
deleted file mode 100755 (executable)
index 6c53821..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-build_log
-*.log
-*.pyc
-usr
-opt
-*.o
-*.os
-*.exe
-packages
-binaries
-*.ipk
-*~
index 179cde89b0b7807fc77754beb750fc8c6dbe146b..fca953f6335842c797a5a57429374b8045d084ea 100644 (file)
@@ -3,9 +3,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 # API library
 ADD_SUBDIRECTORY(lib)
 
-# API library
-ADD_SUBDIRECTORY(bluetooth-media-control)
-
 # Bluetooth FW Agent
 ADD_SUBDIRECTORY(bluetooth-frwk-agent)
 
index 15bd05b6fc4d561313a51216387091bd7a6b5f7d..4fc9b04663a41050afe06ed23bcad24fb9c32ed6 100644 (file)
@@ -59,4 +59,3 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.bluez.frwk_agent.service DESTINATI
 
 # install booting script
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-agent DESTINATION /etc/rc.d/init.d)
-
index 8f3a9aedbf3881d5f0732ee26360a228a38b9008..04a252ae30c1922e79525b34cf2629002bb42eb3 100644 (file)
@@ -92,6 +92,13 @@ static void __agent_adapter_added_cb(DBusGProxy *manager_proxy, const char *adap
        if (!aul_app_is_running("org.tizen.bluetooth"))
                __agent_launch_bt_service(BT_AGENT_RUN_STATUS_NO_CHANGE,
                                        BT_AGENT_ON_CURRENTVIEW);
+
+       /* Update Bluetooth Status to notify other modules */
+       if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_ON) != 0)
+               DBG("Set vconf failed\n");
+
+       if (vconf_set_int(VCONFKEY_BT_DEVICE, VCONFKEY_BT_DEVICE_NONE) != 0)
+               DBG("Set vconf failed\n");
 }
 
 static void __agent_adapter_removed_cb(DBusGProxy *manager_proxy, const char *adapter_path,
index 38896fd6f2c190d06108a973eb0554239bab2001..9630d0d05978d9fe5e6e65f9bcec34767ff4ae54 100644 (file)
@@ -42,7 +42,7 @@
 #include "MapiMessage.h"
 
 /*Email Header Files*/
-#include "Emf_Mapi_Types.h"
+#include "email-types.h"
 
 #include <bluetooth_map_agent.h>
 
@@ -547,7 +547,7 @@ static gboolean bluetooth_map_get_message(BluetoothMapAgent *agent,
        int account_id = 0;
        GPtrArray *array = g_ptr_array_new();
        emf_mailbox_t mailbox;
-       emf_mail_body_t *body = NULL;
+       emf_mail_data_t *mail_data = NULL;
        int nread = 0;
        char *buf = NULL;
        long l_size = 0;
@@ -596,11 +596,10 @@ static gboolean bluetooth_map_get_message(BluetoothMapAgent *agent,
                memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
                mailbox.account_id = account_id;
 
-               if (EMF_ERROR_NONE == email_get_body_info(&mailbox, message_id,
-                                                               &body)) {
-                       body_file = fopen(body->plain, "r");
+               if (EMF_ERROR_NONE == email_get_mail_data(message_id, &mail_data)) {
+                       body_file = fopen(mail_data->file_path_plain, "r");
                        if (body_file == NULL)
-                               body_file = fopen(body->html, "rb");
+                               body_file = fopen(mail_data->file_path_html, "rb");
 
                        if (body_file != NULL) {
                                fseek(body_file , 0, SEEK_END);
@@ -631,8 +630,8 @@ static gboolean bluetooth_map_get_message(BluetoothMapAgent *agent,
                fclose(body_file);
        if (buf)
                free(buf);
-       if (body)
-               email_free_body_info(&body, 1);
+       if (mail_data)
+               email_free_mail_data(&mail_data, 1);
        return TRUE;
 fail:
        g_free(value);
@@ -641,8 +640,8 @@ fail:
                fclose(body_file);
        if (buf)
                free(buf);
-       if (body)
-               email_free_body_info(&body, 1);
+       if (mail_data)
+               email_free_mail_data(&mail_data, 1);
        error = __bt_map_agent_error(BT_MAP_AGENT_ERROR_INTERNAL,
                                  "InternalError");
        dbus_g_method_return_error(context, error);
@@ -677,7 +676,7 @@ static gboolean bluetooth_map_message_status(BluetoothMapAgent *agent,
        char *last = NULL;
        int message_id = 0;
        emf_mailbox_t mailbox;
-       emf_mail_t *mail = NULL;
+       emf_mail_data_t *mail_data = NULL;
        msg_message_t msg;
        MSG_ERROR_T err = MSG_SUCCESS;
        MSG_SENDINGOPT_S sendOpt = { 0 };
@@ -777,7 +776,7 @@ static gboolean bluetooth_map_message_status(BluetoothMapAgent *agent,
                }
                case 1: {
                        memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-                       if (email_get_mail(&mailbox, message_id, &mail) < 0) {
+                       if (email_get_mail_data(message_id, &mail_data) < 0) {
                                ERR("email_get_mail failed\n");
                        } else {
                                DBG("email_get_mail success\n");
@@ -789,7 +788,7 @@ static gboolean bluetooth_map_message_status(BluetoothMapAgent *agent,
                                        ERR("\n email_delete_message failed");
                                        flag = FALSE;
                                }
-                               email_free_mail(&mail, 1);
+                               email_free_mail_data(&mail_data, 1);
                        }
                        break;
                }
@@ -828,7 +827,7 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
-       connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+       connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
 
        if (error != NULL) {
                ERR("Couldn't connect to system bus[%s]\n", error->message);
@@ -887,5 +886,3 @@ int main(int argc, char **argv)
        __bluetooth_map_stop_service();
        return EXIT_FAILURE;
 }
-
-
diff --git a/bluetooth-media-control/CMakeLists.txt b/bluetooth-media-control/CMakeLists.txt
deleted file mode 100644 (file)
index 2dee1e8..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-media-control C)
-
-SET(SRCS bluetooth-media-control.c)
-SET(HEADERS bluetooth-media-control.h)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "\${prefix}")
-SET(LIBDIR "\${prefix}/lib")
-SET(INCLUDEDIR "\${prefix}/include")
-SET(VERSION_MAJOR 1)
-SET(VERSION ${VERSION_MAJOR}.0.0)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(packages REQUIRED dlog dbus-glib-1)
-
-FOREACH(flag ${packages_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g ")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-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})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${packages_LDFLAGS})
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
-
-FOREACH(hfile ${HEADERS})
-       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/bluetooth-media-control)
-ENDFOREACH(hfile)
diff --git a/bluetooth-media-control/bluetooth-media-control.c b/bluetooth-media-control/bluetooth-media-control.c
deleted file mode 100644 (file)
index 6cd71ff..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *   bluetooth-media-control
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:    Hocheol Seo <hocheol.seo@samsung.com>
- *             Girishashok Joshi <girish.joshi@samsung.com>
- *             Chanyeol Park <chanyeol.park@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 <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <sys/types.h>
-#include <glib.h>
-#include <string.h>
-
-#include "bluetooth-media-control.h"
-
-#define MEDIA_PLAYER_OBJECT_PATH       "/Samsung/Player"
-#define MEDIA_PLAYER_INTERFACE "org.tizen.player"
-
-static int __bluetooth_media_dbus_signal_send(const char *path,
-               const char *interface, const char *method, int type, ...)
-{
-       DBusMessage *msg;
-       DBusConnection *conn;
-       va_list args;
-       DBG("+\n");
-
-       conn  = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-       if (NULL == conn)
-               return FALSE;
-
-       msg = dbus_message_new_signal(path, interface, method);
-       if (!msg) {
-               DBG("Unable to allocate new D-Bus %s message", method);
-               dbus_connection_unref(conn);
-               return FALSE;
-       }
-
-       va_start(args, type);
-
-       if (!dbus_message_append_args_valist(msg, type, args)) {
-               dbus_message_unref(msg);
-               va_end(args);
-               dbus_connection_unref(conn);
-               return FALSE;
-       }
-
-       va_end(args);
-
-       if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_SIGNAL)
-               dbus_message_set_no_reply(msg, TRUE);
-
-       if (!dbus_connection_send(conn, msg, NULL)) {
-               DBG("dbus_connection_send - ERROR\n");
-               dbus_message_unref(msg);
-               dbus_connection_unref(conn);
-               return FALSE;
-       }
-       dbus_message_unref(msg);
-       dbus_connection_unref(conn);
-
-       DBG(" -\n");
-       return TRUE;
-}
-
-BT_EXPORT_API int bluetooth_media_player_change_property(
-                       media_player_property_type type,
-                       unsigned int value)
-{
-       DBG("+\n");
-
-       if (type > POSITION)
-               return BT_MEDIA_CONTROL_ERROR;
-
-       switch (type) {
-       case EQUILIZER:
-               if (value >= EQUILIZER_INVALID) {
-                       return BT_MEDIA_CONTROL_ERROR;
-               }
-               break;
-       case REPEAT:
-               if (value >= REPEAT_INVALID) {
-                       return BT_MEDIA_CONTROL_ERROR;
-               }
-               break;
-       case SHUFFLE:
-               if (value >= SHUFFLE_INVALID) {
-                       return BT_MEDIA_CONTROL_ERROR;
-               }
-               break;
-       case SCAN:
-               if (value >= SCAN_INVALID) {
-                       return BT_MEDIA_CONTROL_ERROR;
-               }
-               break;
-       case STATUS:
-               if (value >= STATUS_INVALID) {
-                       return BT_MEDIA_CONTROL_ERROR;
-               }
-               break;
-       case POSITION:
-               if (0 == value) {
-                       return BT_MEDIA_CONTROL_ERROR;
-               }
-               break;
-       }
-
-       if (!__bluetooth_media_dbus_signal_send(
-               MEDIA_PLAYER_OBJECT_PATH,
-               MEDIA_PLAYER_INTERFACE,
-               "PropertyChanged",
-               DBUS_TYPE_UINT32, &type,
-               DBUS_TYPE_UINT32, &value,
-               DBUS_TYPE_INVALID)) {
-               DBG("Error sending the PropertyChanged signal \n");
-               return BT_MEDIA_CONTROL_ERROR;
-       }
-
-       DBG("-\n");
-       return BT_MEDIA_CONTROL_SUCCESS;
-}
-
-BT_EXPORT_API int bluetooth_media_player_change_track(
-               media_metadata_attributes_t metadata)
-{
-       DBusMessage *signal = NULL;
-       DBusMessageIter iter;
-       DBusMessageIter metadata_dict;
-
-       DBG("+\n");
-
-       if (!__bluetooth_media_dbus_signal_send(
-               MEDIA_PLAYER_OBJECT_PATH,
-               MEDIA_PLAYER_INTERFACE,
-               "TrackChanged",
-               DBUS_TYPE_STRING, &metadata.title,
-               DBUS_TYPE_STRING, &metadata.artist,
-               DBUS_TYPE_STRING, &metadata.album,
-               DBUS_TYPE_STRING, &metadata.genre,
-               DBUS_TYPE_UINT32, &metadata.total_tracks,
-               DBUS_TYPE_UINT32, &metadata.number,
-               DBUS_TYPE_UINT32, &metadata.duration,
-               DBUS_TYPE_INVALID)) {
-               DBG("Error sending the PropertyChanged signal \n");
-               return BT_MEDIA_CONTROL_ERROR;
-       }
-
-       DBG("-\n");
-       return BT_MEDIA_CONTROL_SUCCESS;
-}
-
-
diff --git a/bluetooth-media-control/bluetooth-media-control.h b/bluetooth-media-control/bluetooth-media-control.h
deleted file mode 100644 (file)
index 3156b32..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *   bluetooth-media-control
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:    Hocheol Seo <hocheol.seo@samsung.com>
- *             Girishashok Joshi <girish.joshi@samsung.com>
- *             Chanyeol Park <chanyeol.park@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.
- *
- */
-
-#ifndef _BT_MP_CONTROL_H_
-#define _BT_MP_CONTROL_H_
-
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib.h>
-#include <glib.h>
-#include <dlog.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /*__cplusplus*/
-
-#ifndef BT_EXPORT_API
-#define BT_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-#define BT_MEDIA_CONTROL "BT_MEDIA_CONTROL"
-#define DBG(fmt, args...) SLOG(LOG_DEBUG, BT_MEDIA_CONTROL, "%s():%d "fmt, __func__, __LINE__, ##args)
-#define ERR(fmt, args...) SLOG(LOG_ERROR, BT_MEDIA_CONTROL, "%s():%d "fmt, __func__, __LINE__, ##args)
-
-/* defines*/
-#define MEDIA_OBJECT_PATH_LENGTH       50
-
-#define BT_MEDIA_CONTROL_ERROR -1
-#define BT_MEDIA_CONTROL_SUCCESS       0
-
-typedef enum {
-       EQUILIZER = 0x00,
-       REPEAT,
-       SHUFFLE,
-       SCAN,
-       STATUS,
-       POSITION
-} media_player_property_type;
-
-typedef enum {
-       EQUILIZER_OFF = 0x00,
-       EQUILIZER_ON,
-       EQUILIZER_INVALID,
-} media_player_equilizer_status;
-
-typedef enum {
-       REPEAT_MODE_OFF = 0x00,
-       REPEAT_SINGLE_TRACK,
-       REPEAT_ALL_TRACK,
-       REPEAT_GROUP,
-       REPEAT_INVALID,
-} media_player_repeat_status;
-
-typedef enum {
-       SHUFFLE_MODE_OFF = 0x00,
-       SHUFFLE_ALL_TRACK,
-       SHUFFLE_GROUP,
-       SHUFFLE_INVALID,
-} media_player_shuffle_status;
-
-typedef enum {
-       SCAN_MODE_OFF = 0x00,
-       SCAN_ALL_TRACK,
-       SCAN_GROUP,
-       SCAN_INVALID,
-} media_player_scan_status;
-
-typedef enum {
-       STATUS_PLAYING  = 0x00,
-       STATUS_STOPPED,
-       STATUS_PAUSED,
-       STATUS_FORWARD_SEEK,
-       STATUS_REVERSE_SEEK,
-       STATUS_ERROR,
-       STATUS_INVALID
-} media_player_status;
-
-typedef struct {
-       media_player_equilizer_status equilizer;
-       media_player_repeat_status  repeat;
-       media_player_shuffle_status  shuffle;
-       media_player_scan_status scan;
-       media_player_status status;
-       unsigned int position;
-} media_player_settings_t;
-
-typedef struct {
-       const char *title;
-       const char *artist;
-       const char *album;
-       const char *genre;
-       unsigned int total_tracks;
-       unsigned int number;
-       unsigned int duration;
-} media_metadata_attributes_t;
-
-/**
- * @fn int bluetooth_media_player_change_property(media_player_property_type type,
- *                             unsigned int value);
- * @brief Notifies the remote bluetooth headset with change in music player settings
- *
- * This function is a asynchronous call.
- * No event for this api..
- *
- * @return   0  - Success \n
- *          -1 - On Failure\n
- *
- * @exception   None
- * @param[in]   type - Type of the music player property
- *                      value - Value of the property which is changed
- *
- * @remark       None
- * @see         None
- */
-int bluetooth_media_player_change_property(
-                       media_player_property_type type,
-                       unsigned int value);
-
-
-/**
- * @fn int bluetooth_media_player_change_track(media_metadata_attributes_t metadata)
- * @briefNotifies the remote bluetooth headset with change in media attributes of the track
- *
- * This function is a asynchronous call.
- * No event for this api..
- *
- * @return   0  - Success \n
- *          -1 - On Failure\n
- *
- * @exception   None
- * @param[in]    metadata -Meida attributes
- *
- * @remark       None
- * @see         None
- */
-int bluetooth_media_player_change_track(
-                       media_metadata_attributes_t metadata);
-
-#ifdef __cplusplus
-}
-#endif /*__cplusplus*/
-
-#endif /*_BT_MP_CONTROL_H_*/
diff --git a/bluetooth-media-control/bluetooth-media-control.pc.in b/bluetooth-media-control/bluetooth-media-control.pc.in
deleted file mode 100644 (file)
index 46c8ad3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: bluetooth-media-control
-Description: TIZEN Bluetooth framework API
-Version: @VERSION@
-Requires: dlog dbus-glib-1 vconf
-Libs: -L${libdir}
-Cflags: -I${includedir} -I${includedir}/bluetooth-media-control
index e0e81a947284fefa0740c1dd35156e4b53fa492d..2ad492e49d644504a47efeb1acfe64a7c1a4f828 100644 (file)
 #define DBUS_STRUCT_STRING_STRING_UINT (dbus_g_type_get_struct("GValueArray", G_TYPE_STRING, \
                                                        G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID))
 
+enum PhoneBookObject {
+       TELECOM_NONE = 0,
+       TELECOM_PB,
+       TELECOM_ICH,
+       TELECOM_OCH,
+       TELECOM_MCH,
+       TELECOM_CCH,
+};
+
 typedef struct {
        GObject parent;
 } BluetoothPbAgent;
@@ -96,29 +105,47 @@ G_DEFINE_TYPE(BluetoothPbAgent, bluetooth_pb_agent, G_TYPE_OBJECT)
 
 GMainLoop *mainloop = NULL;
 
-static gboolean bluetooth_pb_get_phonebook(BluetoothPbAgent *agent, gushort max_list,
-                                          gushort offset, DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_calls(BluetoothPbAgent *agent, gushort max_list, gushort offset,
-                                      gchar *call_type, DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_phonebook_size(BluetoothPbAgent *agent, gushort max_list,
-                                               gushort offset, DBusGMethodInvocation *context);
+static gboolean bluetooth_pb_get_phonebook(BluetoothPbAgent *agent,
+                                       gushort max_list,
+                                       gushort offset,
+                                       DBusGMethodInvocation *context);
+
+static gboolean bluetooth_pb_get_calls(BluetoothPbAgent *agent,
+                               gushort max_list,
+                               gushort offset,
+                               gchar *call_type,
+                               DBusGMethodInvocation *context);
+
+static gboolean bluetooth_pb_get_phonebook_size(BluetoothPbAgent *agent,
+                                               const char *name,
+                                               DBusGMethodInvocation *context);
 
 static gboolean bluetooth_pb_get_total_object_count(BluetoothPbAgent *agent,
-                                       gchar *path, DBusGMethodInvocation *context);
+                                               gchar *path,
+                                               DBusGMethodInvocation *context);
 
 static gboolean bluetooth_pb_get_phonebook_list(BluetoothPbAgent *agent,
                                                DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_calls_list(BluetoothPbAgent *agent, gchar *call_type,
+
+static gboolean bluetooth_pb_get_calls_list(BluetoothPbAgent *agent,
+                                       gchar *call_type,
                                            DBusGMethodInvocation *context);
 
-static gboolean bluetooth_pb_get_phonebook_entry(BluetoothPbAgent *agent, gchar *id,
+static gboolean bluetooth_pb_get_phonebook_entry(BluetoothPbAgent *agent,
+                                               gchar *id,
                                                 DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_calls_entry(BluetoothPbAgent *agent, gchar *id,
+
+static gboolean bluetooth_pb_get_calls_entry(BluetoothPbAgent *agent,
+                                       gchar *id,
                                             DBusGMethodInvocation *context);
 
-static gboolean bluetooth_pb_add_contact(BluetoothPbAgent *agent, const char *filename,
+static gboolean bluetooth_pb_add_contact (BluetoothPbAgent *agent,
+                                       const char *filename,
                                         GError **error);
 
+
+static unsigned int __bluetooth_pb_get_call_size(const enum PhoneBookObject pb_oject);
+
 #include "bluetooth_pb_agent_glue.h"
 
 static void bluetooth_pb_agent_init(BluetoothPbAgent *obj)
@@ -146,26 +173,56 @@ static void bluetooth_pb_agent_class_init(BluetoothPbAgentClass *klass)
                                        &dbus_glib_bluetooth_pb_object_info);
 }
 
-static gboolean bluetooth_pb_get_phonebook_size(BluetoothPbAgent *agent, gushort max_list,
-                                               gushort offset, DBusGMethodInvocation *context)
+static gboolean bluetooth_pb_get_phonebook_size(BluetoothPbAgent *agent,
+                                               const char *name,
+                                               DBusGMethodInvocation *context)
 {
-       unsigned int nr_contact = 0;
+       unsigned int phonebook_size = 0;
 
        DBG("%s() %d\n", __FUNCTION__, __LINE__);
-       contacts_svc_connect();
 
-       nr_contact = contacts_svc_count(CTS_GET_ALL_CONTACT);
-       DBG("Number of contacts is %d\n", nr_contact);
+       if (name == NULL) {
+               GError *error = NULL;
+               GQuark quark;
 
-       contacts_svc_disconnect();
+               quark = g_type_qname(bluetooth_pb_agent_get_type());
+               error = g_error_new(quark, -1, "No name defined");
 
-       DBG("%s() %d\n", __FUNCTION__, __LINE__);
+               DBG("no name defined\n");
 
-       dbus_g_method_return(context, nr_contact);
+               dbus_g_method_return_error(context, error);
+
+               g_error_free(error);
+
+               return FALSE;
+       }
+
+       if (g_strcmp0(name, "/telecom/pb.vcf") == 0) {
+               contacts_svc_connect();
+
+               phonebook_size = contacts_svc_count(CTS_GET_ALL_CONTACT);
+               DBG("Number of contacts is %d\n", phonebook_size);
+
+               contacts_svc_disconnect();
+
+               /* add count for owner (0.vcf) */
+               phonebook_size++;
+       } else if (g_strcmp0(name, "/telecom/ich.vcf") == 0) {
+               phonebook_size = __bluetooth_pb_get_call_size(TELECOM_ICH);
+       } else if (g_strcmp0(name, "/telecom/och.vcf") == 0) {
+               phonebook_size = __bluetooth_pb_get_call_size(TELECOM_OCH);
+       } else if (g_strcmp0(name, "/telecom/mch.vcf") == 0) {
+               phonebook_size = __bluetooth_pb_get_call_size(TELECOM_MCH);
+       } else if (g_strcmp0(name, "/telecom/cch.vcf") == 0) {
+               phonebook_size = __bluetooth_pb_get_call_size(TELECOM_CCH);
+       }
+
+       dbus_g_method_return(context, phonebook_size);
 
        return TRUE;
 }
 
+
 static int __bluetooth_get_calllog_type(int call_type)
 {
        int val = CTS_PLOG_TYPE_NONE;
@@ -926,6 +983,84 @@ static gboolean bluetooth_pb_add_contact(BluetoothPbAgent *agent, const char *fi
        return TRUE;
 }
 
+
+static unsigned int __bluetooth_pb_get_call_size(const enum PhoneBookObject pb_object)
+{
+       CTSiter *iter = NULL;
+       unsigned int call_size = 0;
+
+       int err = 0;
+
+       err = contacts_svc_connect();
+       if (err != CTS_SUCCESS) {
+               DBG("contacts_svc_connect fucntion call [error] = %d \n", err);
+               return call_size;
+       }
+
+       contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+
+       while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
+
+               CTSvalue *value = NULL;
+               int type = 0;
+
+               value = contacts_svc_iter_get_info(iter);
+               if (value == NULL)
+                       continue;
+
+               type = contacts_svc_value_get_int(value, CTS_LIST_PLOG_LOG_TYPE_INT);
+
+               DBG("type : %d\n", type);
+
+               switch (pb_object) {
+               case TELECOM_ICH:
+                       if (CTS_PLOG_TYPE_VOICE_INCOMMING == type ||
+                               CTS_PLOG_TYPE_VIDEO_INCOMMING == type) {
+                               call_size++;
+                       }
+                       break;
+               case TELECOM_OCH:
+                       if (CTS_PLOG_TYPE_VOICE_OUTGOING == type ||
+                               CTS_PLOG_TYPE_VIDEO_OUTGOING == type) {
+                               call_size++;
+                       }
+                       break;
+               case TELECOM_MCH:
+                       if (CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN == type ||
+                               CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN == type ||
+                               CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN == type ||
+                               CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN) {
+                               call_size++;
+                       }
+                       break;
+               case TELECOM_CCH:
+                       if (CTS_PLOG_TYPE_VOICE_INCOMMING == type ||
+                               CTS_PLOG_TYPE_VIDEO_INCOMMING == type ||
+                               CTS_PLOG_TYPE_VOICE_OUTGOING == type ||
+                               CTS_PLOG_TYPE_VIDEO_OUTGOING == type ||
+                               CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN == type ||
+                               CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN == type ||
+                               CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN == type ||
+                               CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN) {
+                               call_size++;
+                       }
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       if (iter)
+               contacts_svc_iter_remove(iter);
+
+       err = contacts_svc_disconnect();
+       if (err != CTS_SUCCESS)
+               DBG("contacts_svc_disconnect fucntion call [error] = %d \n", err);
+
+       return call_size;
+}
+
+
 int main(int argc, char **argv)
 {
        BluetoothPbAgent *bluetooth_pb_obj = NULL;
@@ -942,7 +1077,7 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
-       bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+       bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
        if (error != NULL) {
                DBG("Couldn't connect to system bus[%s]\n", error->message);
                g_error_free(error);
@@ -988,12 +1123,14 @@ int main(int argc, char **argv)
 
  failure:
        DBG("Terminate the bluetooth-pb-agent\n");
-       if (bus)
-               dbus_g_connection_unref(bus);
-       if (bus_proxy)
-               g_object_unref(bus_proxy);
        if (bluetooth_pb_obj)
                g_object_unref(bluetooth_pb_obj);
 
+       if (bus_proxy)
+               g_object_unref(bus_proxy);
+
+       if (bus)
+               dbus_g_connection_unref(bus);
+
        return EXIT_FAILURE;
 }
index 2433b360571958c36d044a5286f2235f9f46da80..64d3fe81587686eef6ce8fa4ea7e2824dc0bb8d3 100644 (file)
@@ -21,8 +21,7 @@
 
                <method name="GetPhonebookSize">
                        <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-                       <arg type="q" name="max_list"/>
-                       <arg type="q" name="offset"/>
+                       <arg type="s" name="name"/>
                        <arg type="u" name="phonebook_size" direction="out"/>
                </method>
 
@@ -54,7 +53,6 @@
                        <arg type="s" name="id"/>
                        <arg type="s" name="phonebook_entry" direction="out"/>
                </method>
-
                <method name="AddContact">
                        <arg type="s" name="filename"/>
                </method>
index 99dd1be8228adc5339014b30cac96a150a22eedd..467ed94e4143356e44700a8c4a34905fa8fd9119 100644 (file)
@@ -5,6 +5,5 @@ if [ ${USER} == "root" ]
 then
        # Set vconf values with -g/-u options
        # 0 is root user id
-       vconftool set -t bool memory/bluetooth/allow "0" -u 0
+       vconftool set -t int db/bluetooth/status "0" -g 6520
 fi
-
index 40edfa68908594faebefbabcb3f31435fbb4fd75..653480b31b4661dde6b94300a0e3bb94545ee8ad 100644 (file)
@@ -1,3 +1,51 @@
+bluetooth-frwk (0.1.56) unstable; urgency=low
+
+  * Upload the changes
+  * Git: pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.56
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Thu, 19 Apr 2012 08:57:02 +0900
+
+bluetooth-frwk (0.1.55) unstable; urgency=low
+
+  * Implement the MDM handsfree mode
+  * Git: pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.55
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Tue, 10 Apr 2012 08:36:02 +0900
+
+bluetooth-frwk (0.1.54) unstable; urgency=low
+
+  * Add the authorize API to support BADA
+  * Git: pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.54
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Fri, 30 Mar 2012 16:43:59 +0900
+
+bluetooth-frwk (0.1.53) unstable; urgency=low
+
+  * Revert session bus (agent) to system bus
+  * Git: pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.53
+
+ -- Chanyeol Park <chanyeol.park@samsung.com>  Sun, 25 Mar 2012 16:51:41 +0900
+
+bluetooth-frwk (0.1.52) unstable; urgency=low
+
+  * fixed dbus bus type to session bus
+  * Git: pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.52
+
+ -- Jaekyun Lee <jkyun.lee@samsung.com>  Sat, 24 Mar 2012 16:35:23 +0900
+
+bluetooth-frwk (0.1.51) unstable; urgency=low
+
+  * Release Tizen 1.0
+  * Git: pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.51
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Tue, 20 Mar 2012 17:23:57 +0900
+
 bluetooth-frwk (0.1.48-2) unstable; urgency=low
 
   * Change SAMSUNG -> TIZEN
index 50a0d186b67ce28c0178701d88d2d4505c2d15b7..298d4ae4f2998944f085f7b6487620dd32816dd5 100644 (file)
@@ -26,7 +26,7 @@ Description: Bluetooth framework for BlueZ
 
 Package: bluetooth-frwk-agent
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libappcore-efl-0, libslp-utilx-0, libaul-1
+Depends: ${shlibs:Depends}, ${misc:Depends}, libappcore-efl-0, libaul-1
 Description: Bluetooth Agent for pairing and authorization
  This package is Bluetooth useraction Agent to response pairing, authorization, and mode change with BlueZ.
 
index e469be01eadadaee5324c703d6a9f72e392c8e82..9ddb186eb6dc9c344e7899bcbc203cb1cb8e5e75 100755 (executable)
@@ -91,9 +91,6 @@ clean:
        rm -f bluetooth-pb-agent/bluetooth_pb_agent_glue.h
        rm -f bluetooth-map-agent/bluetooth_map_agent_glue.h
        
-       rm -f bluetooth-media-control/Makefile
-       rm -f bluetooth-media-control/bluetooth-media-control.pc
-       
        dh_clean 
 
 install: build
diff --git a/lib/BluetoothFW_PG.h b/lib/BluetoothFW_PG.h
new file mode 100644 (file)
index 0000000..a0dbba8
--- /dev/null
@@ -0,0 +1,2323 @@
+/*\r
+ * Bluetooth-frwk\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:  Hocheol Seo <hocheol.seo@samsung.com>\r
+ *              Girishashok Joshi <girish.joshi@samsung.com>\r
+ *              Chanyeol Park <chanyeol.park@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *             http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ *\r
+ * @ingroup   SLP_PG\r
+ * @defgroup   BLUETOOTH BluetoothFW\r
+@{\r
+<h1 class="pg">Introduction</h1>\r
+       <h2 class="pg">Purpose of this document</h2>\r
+The purpose of this document is to describe how applications can use Bluetooth APIs for handling or working with Bluetooth. This document gives programming guidelines to application engineers.\r
+\r
+       <h2 class="pg">Scope</h2>\r
+The scope of this document is limited to Bluetooth API usage\r
+\r
+       <h2 class="pg">Abbreviations</h2>\r
+<table>\r
+       <tr>            <td>API</td>            <td>Application Programming Interface</td></tr>\r
+       <tr>            <td>SDK</td>            <td>Software Development Kit</td></tr>\r
+       <tr>            <td>RFCOMM</td>         <td>Radio Frequency Communication</td></tr>\r
+       <tr>            <td>L2CAP</td>          <td>Logical Link Control and adaptation Protocol</td></tr>\r
+       <tr>            <td>LM</td>             <td>Link Manager</td></tr>\r
+</table>\r
+\r
+<h1>Bluetooth Framework Architecture</h1>\r
+       <h2 class="pg">Architecture overview</h2>\r
+@image html bluetooth_image001.png\r
+\r
+<h1>Bluetooth Framework Features</h1>\r
+The Bluetooth API exposes a high level interface that is used by applications.\r
+\r
+Bluetooth API currently provides 3 kinds of APIs.\r
+@n GAP APIs: These APIs are used to perform operations related to the local device such as set device name, set visibility mode etc. It also exposes APIs to perform basic Bluetooth related operations like device search\r
+@n SDP APIs: These APIs are used to search service list supported by a specific device. A record in the service list gives a description of a service supported by the device. Specific records having a service ID assigned by Bluetooth SIG give a exact information of predefined service roles.\r
+@n RFCOMM APIs: In order to establish a serial connection between two Bluetooth devices, this SDK provides simple RFCOMM APIs. After receiving FD from SDK, developer can use regular system functions like read() write() poll() select() etc to send or receive data.\r
+\r
+Bluetooth can be shared among several applications, and the Bluetooth framework will supervise some of the important functionalities like pairing, configuration, and authorization. These functions will be confirmed by the user with use of a Bluetooth agent daemon.\r
+\r
+<h1>Using Bluetooth API</h1>\r
+You can use Bluetooth API to communication with other Bluetooth enabled device (mobile phone, PC etc) over RFCOMM interface. This SDK provides supporting Device management functions to find the device you want to connect with. You can refer to the following use cases as examples for writing your own Bluetooth based application.\r
+\r
+       <h2 class="pg">Listening for events</h2>\r
+In general, Bluetooth API provided to you is asynchronous in nature. Hence it becomes mandatory for Application to listen for the events which may be sent by Bluetooth API as per the data received. An application developer can call bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr type. This registered function will receive events of bluetooth_event_type_t type along with any any data.\r
+\r
+       <h2 class="pg">Managing Adapter</h2>\r
+Bluetooth Adaptor represents the Bluetooth Chip present in your device. The bluetooth_enable_adapter() API can be used to activate Bluetooth. This API sends a request to Bluetooth chip for activation. This will also initialize Bluetooth adaptor. Upon completion of the procedure, it will send BLUETOOTH_EVENT_ENABLED event. Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power). bluetooth_disable_adapter() function will do that job for you. After switching off Bluetooth, BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation.\r
+\r
+       <h2 class="pg">Getting local device information</h2>\r
+Every Bluetooth device has a unique 48 bit address assigned to it. You can read your Bluetooth device's address by using bluetooth_get_local_address() API. It is a synchronous function call. In its output parameter, you can receive bluetooth_device_address_t type of pointer which will contain Bluetooth address. Since its inconvenient for user to remember the address, Bluetooth provides a method to have a friendly name for each device. You can get or set the device name by bluetooth_get_local_name() and bluetooth_set_local_name() respectively. If you set the name, BLUETOOTH_EVENT_LOCAL_NAME_CHANGED event will be sent to application to inform result of requested operation. As per Bluetooth standard, maximum length of device name can be BLUETOOTH_DEVICE_NAME_MAX_LENGTH or 248 bytes. It should be in UTF-8 format.\r
+\r
+In order to be discoverable to other devices, your Bluetooth device should respond to inquiry scan requests. You can retrieve the mode of your device by calling bluetooth_get_discoverable_mode() API. It is a synchronous API which will give you current mode in bluetooth_discoverable_mode_t format. You can choose from the four different modes: connectable only (non discoverable), general discoverable, time limited discoverable (discoverable for limited time duration) and limited discoverable.\r
+\r
+       <h2 class="pg">Searching for peer Bluetooth device</h2>\r
+You can search for peer Bluetooth devices using the bluetooth_start_discovery() API. It is an asynchronous function call. You can receive the BLUETOOTH_EVENT_DISCOVERY_STARTED event when any discovery session is successfully started from the target, even if your application does not request discovery. After the opened discovery session is closed, you will get the BLUETOOTH_EVENT_DISCOVERY_FINISHED event. During the discovery session, you can get several BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND events and BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED events. The former event gives information of a device without its name and the latter event includes a friendly name for the device, and is delivered after the former event. The latter event can be delivered more than once for a device.\r
+@n Since only one discovery session is permitted at a time, a discovery request will return failure if there is a session already open.\r
+\r
+       <h2 class="pg">Serial communication in wireless way</h2>\r
+There are two roles in serial communication. One is server role which is waiting a connection from another device. The other role is client role which initiates a connection. For serial communication between your application in two targets.\r
+@n At first you should open server in one device. It can be done with bluetooth_rfcomm_create_socket() API and bluetooth_rfcomm_listen_and_accept() API. You can get a server socket file descriptor with the first API and can start waiting with the second API.\r
+@n At next, client device can connect with a waiting server with bluetooth_rfcomm_remote_connect() API. When a client is successfully connected with a server, you will receive the device node path for serial connection. With opening this path you can communicate with server device by reading and writing it.\r
+@n You should match UUID string with a server. You can use a UUID predefined by Bluetooth SIG if you want to use a specific Bluetooth profile role. Otherwise you should use your own UUID with 128bits hexa value formatted as like "#######-####-####-####-############" Format of Bluetooth SIG predefined UUID is "000####-0000-1000-8000-00805F9B34FB"\r
+\r
+       <h2 class="pg">Tips & Tricks</h2>\r
+You can connect with PC having Bluetooth adapter with Serial Port emulation Profile. For this, you should use SPP UUID string, "0001101-0000-1000-8000-00805F9B34FB" If the serial connection is established, you can use a serial port in PC side for communicating with your application in a device.\r
+\r
+<h1>API descriptions</h1>\r
+       <h2 class="pg">Defines</h2>\r
+               <h3 class="pg">General</h3>\r
+<table>\r
+       <tr>            <td>Macro Name</td>\r
+               <td>Value</td>\r
+               <td>Description</td></tr>\r
+       <tr>            <td>BLUETOOTH_ADDRESS_LENGTH</td>\r
+               <td>6</td>\r
+               <td>Bluetooth address is represented as 48 bits. This is defined in Bluetooth Core Specification document. This macro represents Bluetooth address length in bytes</td></tr>\r
+       <tr>            <td>BLUETOOTH_DEVICE_NAME_LENGTH_MAX</td>\r
+               <td>248</td>\r
+               <td>The Bluetooth device name can be up to 248 bytes maximum according to "Link Manager Protocol". It shall be encoded according to UTF-8</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">Error codes</h3>\r
+<table>\r
+       <tr>            <td>Macro Name</td>\r
+               <td>Value</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_BASE</td>\r
+               <td>0</td>\r
+               <td>Error code base</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NONE</td>\r
+               <td>BLUETOOTH_ERROR_BASE</td>\r
+               <td>No error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_CANCEL</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x01</td>\r
+               <td>Cancelled</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_INVALID_CALLBACK</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x02</td>\r
+               <td>Callback error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_INVALID_PARAM</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x03</td>\r
+               <td>invalid parameter</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_INVALID_DATA</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x04</td>\r
+               <td>invalid data error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_MEMORY_ALLOCATION</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x05</td>\r
+               <td>Memory allocation error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_OUT_OF_MEMORY</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x06</td>\r
+               <td>out of memory error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_TIMEOUT</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x07</td>\r
+               <td>timeout error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NO_RESOURCES</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x08</td>\r
+               <td>No resource error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_INTERNAL</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x09</td>\r
+               <td>internal error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NOT_SUPPORT</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x0A</td>\r
+               <td>Not supported error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_DEVICE_NOT_ENABLED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x0B</td>\r
+               <td>Operation is failed because of not enabled BT Adapter</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x0C</td>\r
+               <td>Enabling is failed because of already enabled BT Adapter</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_DEVICE_BUSY</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x0D</td>\r
+               <td>Operation is failed because of other on going operation</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_ACCESS_DENIED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x0E</td>\r
+               <td>access denied error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_MAX_CLIENT</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x0F</td>\r
+               <td>max client error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NOT_FOUND</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x10</td>\r
+               <td>not found error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x11</td>\r
+               <td>service search fail</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_PARING_FAILED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x12</td>\r
+               <td>pairing failed error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NOT_PAIRED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x13</td>\r
+               <td>Not paired error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_SERVICE_NOT_FOUND</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x14</td>\r
+               <td>no service error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NOT_CONNECTED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x15</td>\r
+               <td>no connection error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_ALREADY_CONNECT</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x16</td>\r
+               <td>already connected error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_CONNECTION_BUSY</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x17</td>\r
+               <td>connection busy error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_CONNECTION_ERROR</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x18</td>\r
+               <td>connection error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_MAX_CONNECTION</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x19</td>\r
+               <td>max connection error</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_NOT_IN_OPERATION</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x1A</td>\r
+               <td>Not in operation</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_CANCEL_BY_USER</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x1B</td>\r
+               <td>cancelled by user</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_REGISTRATION_FAILED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x1C</td>\r
+               <td>registration failed</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_IN_PROGRESS</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x1D</td>\r
+               <td>operation is in progress </td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_AUTHENTICATION_FAILED</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x1E</td>\r
+               <td>authentication failed</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ERROR_HOST_DOWN</td>\r
+               <td>BLUETOOTH_ERROR_BASE - 0x1F</td>\r
+               <td>Remote host is down</td></tr>\r
+\r
+\r
+</table>\r
+\r
+       <h2 class="pg">Enums</h2>\r
+               <h3 class="pg">bluetooth_adapter_state_t</h2>\r
+Adapter state\r
+<table>\r
+       <tr><td colspan="2">bluetooth_adapter_state_t</td></tr>\r
+\r
+       <tr>            <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ADAPTER_DISABLED</td>\r
+               <td>Bluetooth adapter is disabled</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ADAPTER_ENABLED</td>\r
+               <td>Bluetooth adapter is enabled</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ADAPTER_CHANGING_ENABLE</td>\r
+               <td>Bluetooth adapter is currently enabling</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_ADAPTER_CHANGING_DISABLE</td>\r
+               <td>Bluetooth adapter is currently disabling</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_discoverable_mode_t</h3>\r
+Discoverable mode\r
+<table>\r
+       <tr><td colspan="2">bluetooth_discoverable_mode_t</td></tr>\r
+\r
+       <tr>            <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE</td>\r
+               <td>Non discoverable mode, other device cannot search the device</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE</td>\r
+               <td>Discoverable mode, other device can search the device</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE</td>\r
+               <td>Discoverable mode with time limit, After specific timeout it is changed to non discoverable mode</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_event_type_t</h3>\r
+Bluetooth event type\r
+<table>\r
+       <tr><td colspan="2">bluetooth_event_type_t</td></tr>\r
+\r
+       <tr>            <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_NONE</td>\r
+               <td>No event</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_ENABLED</td>\r
+               <td>Bluetooth adapter enabled broadcasting event</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DISABLED</td>\r
+               <td>Bluetooth adapter disabled broadcasting event</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_LOCAL_NAME_CHANGED</td>\r
+               <td>Local friendly name changed broadcasting event</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED</td>\r
+               <td>When setting  local discoverable mode to BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE, this event comes to set timeout for bluetooth_get_discoverable_mode() API.</td></tr>\r
+@n Only the API caller receive this event.\r
+@n (Not supported yet)\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED</td>\r
+               <td>Bluetooth discoverable mode changed, parameter is pointer to changed mode</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED</td>\r
+               <td>(Not supported)</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DISCOVERY_STARTED</td>\r
+               <td>Discovery session started broadcasting event</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DISCOVERY_FINISHED</td>\r
+               <td>Discovery session finished broadcasting event</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND</td>\r
+               <td>During discovery session, found device is reported with this event.</td></tr>\r
+@n Only the API caller receives this event.\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED</td>\r
+               <td>During discovery session, friendly name information of found device is reported with this event.</td></tr>\r
+@n Only the API caller receives this event.\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_BONDING_FINISHED</td>\r
+               <td>Newly bonded device is reported with this event. This is broadcasting event.</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED</td>\r
+               <td>If bonded device is locally removed, this event reported. This is broadcasting event. Removing is not sent to a unbonded peer device because it means removing locally stored key for the device.</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_BONDED_DEVICE_FOUND</td>\r
+               <td>Bonded device is reported with this event if you uses bluetooth_get_bonded_device_list() API. Only the API caller receives this event.</td></tr>\r
+@n (Not supported yet)\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_REMOTE_DEVICE_READ</td>\r
+               <td>Information directly getting from peer device is reported with this event if you uses bluetooth_get_remote_device() API.</td></tr>\r
+@n Only the API caller receives this event.\r
+@n (Not supported yet)\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DEVICE_AUTHORIZED</td>\r
+               <td>This event reports the result of bluetooth_authorize_device() API.</td></tr>\r
+@n Only the API caller receives this event.\r
+@n (Not supported yet)\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED</td>\r
+               <td>This event reports the result of bluetooth_authorize_device() API.</td></tr>\r
+@n Only the API caller receives this event.\r
+@n (Not supported yet)\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_SERVICE_SEARCHED</td>\r
+               <td>This event reports the result of bluetooth_search_service() API.</td></tr>\r
+@n Only the API caller receives this event.\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED</td>\r
+               <td>During searching service, bluetooth_cancel_service_search() API is called, this event indicated the cancellation of searching without BLUETOOTH_EVENT_SERVICE_SEARCHED event.</td></tr>\r
+@n Only the API caller receives this event.\r
+@n (Not supported yet)\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED</td>\r
+               <td>This event is occured if RFCOMM data recieves from remote device.</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_RFCOMM_CONNECTED</td>\r
+               <td>If RFCOMM socket is connected, this event reported </td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_RFCOMM_DISCONNECTED</td>\r
+               <td>If RFCOMM socket is disconnected, this event reported </td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_EVENT_MAX</td>\r
+               <td>Max value</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_device_service_class_t</h3>\r
+Service class part of class of device returned from device discovery, all service which supported found devi   ce is masked. Each type is defined by Bluetooth SIG.\r
+<table>\r
+       <tr><td colspan="2">bluetooth_device_service_class_t</td></tr>\r
+\r
+       <tr>            <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE</td>\r
+               <td>device in limited discoverable mode</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING</td>\r
+               <td>Positioning service</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING</td>\r
+               <td>Networking service</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING</td>\r
+               <td>Printing, Speaker</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING</td>\r
+               <td>Capturing (Scanner, Microphone)</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER</td>\r
+               <td>Object Transfer service</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO</td>\r
+               <td>Audio service</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY</td>\r
+               <td>Telephony service</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION</td>\r
+               <td>WEB-server, WAP-server</td></tr>\r
+\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_device_major_class_t</h3>\r
+Major device class (part of Class of Device)\r
+<table>\r
+       <tr><td colspan="2">bluetooth_device_service_class_t</td></tr>\r
+\r
+       <tr>            <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_MISC</td>\r
+               <td>Miscellaneous major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER</td>\r
+               <td>Computer major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE</td>\r
+               <td>Phone major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT</td>\r
+               <td>LAN major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO</td>\r
+               <td>AUDIO major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL</td>\r
+               <td>Peripheral major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING</td>\r
+               <td>Imaging major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE</td>\r
+               <td>Wearable major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_TOY</td>\r
+               <td>Toy major device class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH</td>\r
+               <td>Health major device class</td></tr>\r
+\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_device_minor_class_t</h3>\r
+Minor device class (part of Class of Device)\r
+<table>\r
+       <tr><td colspan="2">bluetooth_device_service_class_t</td></tr>\r
+\r
+       <tr>            <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED</td>\r
+               <td>Not classified class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Desktop PC</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Desktop Server</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Laptop</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, PDA</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Desktop PDA</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, wearable computer</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, cellular phone</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, cordless phone</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, Cellular phone, smart phone</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, voice gateway</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, ISDN</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Headset minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Handsfree minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Microphone minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Loud Speaker minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Headphones minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Portable Audio minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Car Audio minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Set top box minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Hifi audio device minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VCR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, VCR minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Camera minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Camcorder minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Monitor minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Display and Loud Speaker minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Conferencing minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Gaming or toy minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Key board minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Pointing Device minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Combo Keyboard or pointing device  minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, JoyStick minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Game Pad minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Remote Control minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Sensing Device minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Digitizer minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Card Reader minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Digital pen minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Handheld scanner minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Handheld gestural input device minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Display minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Camera minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Scanner minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Printer minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Wrist watch minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PAGER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Pager minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_JACKET</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Jacket minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HELMET</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Helmet minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Glasses minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Robot minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Vehicle minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Doll or Action minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Controller minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GAME</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Game minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Blood Pressure minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Thermometer minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Weighing Scale minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Glucose minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Pulse Oximeter minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Heart or pulse rate monitor minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Medical minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_STEP_COUNTER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Step counter minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Body composition analyzer minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Peak flow monitor minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Medication monitor minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Knee prosthesis minor class</td></tr>\r
+\r
+       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS</td>\r
+               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Ankle prosthesis minor class</td></tr>\r
+</table>\r
+\r
+       <h2 class="pg">Structures</h2>\r
+               <h3 class="pg">bluetooth_device_address_t</h3>\r
+This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##\r
+<table>\r
+       <tr><td colspan="3">bluetooth_device_service_class_t</td></tr>\r
+\r
+       <tr>            <td>Type</td>\r
+               <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>unsigned char [BLUETOOTH_ADDRESS_LENGTH]</td>\r
+               <td>addr</td>\r
+               <td>Address of Bluetooth device</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_device_name_t</h3>\r
+This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes\r
+<table>\r
+       <tr><td colspan="3">bluetooth_device_service_class_t</td></tr>\r
+\r
+       <tr>            <td>Type</td>\r
+               <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>char [BLUETOOTH_DEVICE_NAME_LENGTH_MAX]</td>\r
+               <td>name</td>\r
+               <td>Name of Bluetooth device</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_device_class_t</h3>\r
+Structure to hold the device class information\r
+<table>\r
+       <tr><td colspan="3">bluetooth_device_class_t</td></tr>\r
+\r
+       <tr>            <td>Type</td>\r
+               <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>bluetooth_device_major_class_t</td>\r
+               <td>major_class;</td>\r
+               <td>major device class</td></tr>\r
+\r
+       <tr>            <td>bluetooth_device_minor_class_t</td>\r
+               <td>minor_class</td>\r
+               <td>minor device class</td></tr>\r
+\r
+       <tr>            <td>bluetooth_device_service_class_t</td>\r
+               <td>service_class</td>\r
+               <td>service device class</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_device_info_t</h3>\r
+Structure to hold the device information\r
+<table>\r
+       <tr><td colspan="3">bluetooth_device_info_t</td></tr>\r
+\r
+       <tr>            <td>Type</td>\r
+               <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>bluetooth_device_address_t</td>\r
+               <td>device_address</td>\r
+               <td>Device address</td></tr>\r
+\r
+       <tr>            <td>bluetooth_device_name_t</td>\r
+               <td>device_name</td>\r
+               <td>Device name</td></tr>\r
+\r
+       <tr>            <td>bluetooth_device_class_t</td>\r
+               <td>device_class</td>\r
+               <td>Device class</td></tr>\r
+\r
+       <tr>            <td>unsigned int</td>\r
+               <td>service_list_array</td>\r
+               <td>Service list array</td></tr>\r
+\r
+       <tr>            <td>int</td>\r
+               <td>service_index</td>\r
+               <td>Service list number</td></tr>\r
+\r
+       <tr>            <td>int</td>\r
+               <td>rssi</td>\r
+               <td>Received signal strength indicator</td></tr>\r
+\r
+       <tr>            <td>gboolean</td>\r
+               <td>paired</td>\r
+               <td>Paired status</td></tr>\r
+\r
+       <tr>            <td>gboolean</td>\r
+               <td>connected</td>\r
+               <td>Connected status</td></tr>\r
+\r
+       <tr>            <td>gboolean</td>\r
+               <td>trust</td>\r
+               <td>Authorized status</td></tr>\r
+</table>\r
+\r
+               <h3 class="pg">bluetooth_event_param_t</h3>\r
+Structure to hold event information\r
+<table>\r
+       <tr><td colspan="3">bluetooth_device_info_t</td></tr>\r
+\r
+       <tr>            <td>Type</td>\r
+               <td>Name</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>int</td>\r
+               <td>event</td>\r
+               <td>Event type</td></tr>\r
+\r
+       <tr>            <td>int</td>\r
+               <td>result</td>\r
+               <td>Success or error value</td></tr>\r
+\r
+       <tr>            <td>void *</td>\r
+               <td>param_data</td>\r
+               <td>Parameter data pointer</td></tr>\r
+\r
+       <tr>            <td>void *</td>\r
+               <td>user_data</td>\r
+               <td>User data pointer</td></tr>\r
+</table>\r
+\r
+       <h2 class="pg">Call back functions</h2>\r
+               <h3 class="pg">bluetooth_cb_func_ptr</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">Void(* bluetooth_cb_func_ptr)(int event, bluetooth_event_param_t* event_param, void *user_data)</td></tr>\r
+\r
+       <tr><td rowspan="3">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>event</td>\r
+               <td>int</td>\r
+               <td>Event type</td></tr>\r
+\r
+       <tr>            <td>event_param</td>\r
+               <td>bluetooth_event_param_t*</td>\r
+               <td>Event data</td></tr>\r
+\r
+       <tr>            <td>user_data</td>\r
+               <td>void *</td>\r
+               <td>User data</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">Void*</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This call back function will be used to pass asynchronous events to application</td></tr>\r
+</table>\r
+\r
+       <h2 class="pg">Functions</h2>\r
+               <h3 class="pg">bluetooth_register_callback</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>callback_ptr</td>\r
+               <td>bluetooth_cb_func_ptr</td>\r
+               <td>a pointer to callback function</td></tr>\r
+\r
+       <tr>            <td>user_data</td>\r
+               <td>void *</td>\r
+               <td>a pointer to user data</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function will register the callback function, to handle events received from Bluetooth framework. </td></tr>\r
+\r
+       <tr><td colspan="4">This is a synchronous call. No event is returned after this function call</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_data)\r
+{\r
+       GMainLoop *main_loop = (GMainLoop*) user_data;\r
+\r
+       switch(event)\r
+       {\r
+               // Code for each event\r
+               default:\r
+                       g_main_loop_quit(main_loop);\r
+                       break;\r
+       }\r
+}\r
+\r
+int main()\r
+{\r
+       GMainLoop *main_loop = NULL;\r
+       int ret = 0;\r
+       g_type_init();\r
+       main_loop = g_main_loop_new(NULL, FALSE);\r
+       ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);\r
+       if (ret >= BLUETOOTH_ERROR_NONE)\r
+       {\r
+               // bluetooth_register_callback returned Success\r
+       }\r
+       else\r
+       {\r
+               // bluetooth_register_callback returned failiure\r
+       }\r
+       g_main_loop_run(main_loop);\r
+}\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image002.png\r
+\r
+               <h3 class="pg">bluetooth_enable_adapter</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_enable_adapter(void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function initializes Bluetooth protocol stack for use. This function is typically called at startup or when Bluetooth services are required. This function must be called before calling any other API of Bluetooth operations.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event through registered callback function.</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_ENABLED:\r
+                       if (param->result == BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               // Successfully Enabled\r
+                       }\r
+                       else\r
+                       {\r
+                               // Failed\r
+                       }\r
+                       break;\r
+       }\r
+}\r
+\r
+...\r
+\r
+int ret = 0;\r
+ret = bluetooth_enable_adapter();\r
+@endcode\r
+</table>\r
+\r
+ - Sequence flow\r
+@image html bluetooth_image003.png\r
+\r
+               <h3 class="pg">bluetooth_disable_adapter</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_disable_adapter(void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function disables Bluetooth protocol stack and hardware. This function should be called when Bluetooth is no longer used.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n If this call is successful then the application will receive BLUETOOTH_EVENT_DISABLED event through registered callback function.</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_DISABLED:\r
+                       if (param->result == BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               // Successfully disabled\r
+                       }\r
+                       else\r
+                       {\r
+                               // Failed\r
+                       }\r
+                       break;\r
+       }\r
+}\r
+\r
+...\r
+\r
+int ret = 0;\r
+ret = bluetooth_disable_adapter();\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image004.png\r
+\r
+               <h3 class="pg">bluetooth_check_adapter</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_check_adapter(void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">bluetooth_adapter_state_t - Adapter state\r
+@n or\r
+@n Negative value (Error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function checks whether the Bluetooth adapter is enabled or not.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
+\r
+@code\r
+\r
+bluetooth_device_address_t local_address={0,};\r
+int ret = 0;\r
+\r
+ret = bluetooth_get_local_address(&local_address);\r
+@endcode\r
+</table>\r
+\r
+\r
+- Sequence flow\r
+@image html bluetooth_image005.png\r
+\r
+               <h3 class="pg">bluetooth_get_local_address</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_get_local_address(bluetooth_device_address_t* local_address)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>local_address</td>\r
+               <td>bluetooth_device_address_t *</td>\r
+               <td>Device address of local Bluetooth adapter</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on Success, Negative value (Error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function is used to get the device address of the local Bluetooth adapter.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
+\r
+@code\r
+bluetooth_device_name_t local_name={0,}\r
+int ret = 0;\r
+ret = bluetooth_get_local_name (&local_name);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image006.png\r
+\r
+               <h3 class="pg">bluetooth_get_local_name</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_get_local_name(bluetooth_device_name_t* local_name)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>local_name</td>\r
+               <td>bluetooth_device_name_t*</td>\r
+               <td>Local device name</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function is used to get the local device name.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_LOCAL_NAME_CHANGED :\r
+                       if (param->result == BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               // Successfully local name changed\r
+                       }\r
+                       else\r
+                       {\r
+                               // Failed\r
+                       }\r
+                       break;\r
+       }\r
+}\r
+\r
+bluetooth_device_name_t local_name={0,}\r
+int ret = 0;\r
+ret = bluetooth_set_local_name (&local_name);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image007.png\r
+\r
+               <h3 class="pg">bluetooth_set_local_name</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_set_local_name(const bluetooth_device_name_t* local_name)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>local_name</td>\r
+               <td>const bluetooth_device_name_t*</td>\r
+               <td>Local device name</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function is used to set the local device name.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an synchronous call.\r
+\r
+ @code\r
+ bluetooth_discoverable_mode_t discoverable_mode_ptr;\r
+ int ret = 0;\r
+ ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);\r
+ @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image008.png\r
+\r
+               <h3 class="pg">bluetooth_get_discoverable_mode</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t* discoverable_mode_ptr)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>discoverable_mode_ptr</td>\r
+               <td>bluetooth_discoverable_mode_t*</td>\r
+               <td>current bluetooth discoverable mode</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function is used to get the discoverable mode (Visibility option)</td></tr>\r
+\r
+       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED :\r
+                       if (param->result == BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               // Successfully local name changed\r
+                       }\r
+                       else\r
+                       {\r
+                               // Failed\r
+                       }\r
+                       break;\r
+       }\r
+}\r
+\r
+bluetooth_discoverable_mode_t mode;\r
+int ret = 0;\r
+mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;\r
+ret = bluetooth_set_discoverable_mode (mode, 180);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image009.png\r
+\r
+               <h3 class="pg">bluetooth_set_discoverable_mode</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode, int timeout)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>discoverable_mode</td>\r
+               <td>bluetooth_discoverable_mode_t</td>\r
+               <td>Local device name</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function is used to set the discoverable mode (Visibility option).</td></tr>\r
+\r
+       <tr><td colspan="4">If new discoverable mode is time limited discoverable mode then application will receive BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED event through registered callback function. Application can use default timeout, 180 seconds, by ignoring this event.\r
+@n This function is an synchronous call.\r
+\r
+@code\r
+\r
+bluetooth_discoverable_mode_t mode;\r
+int ret = 0;\r
+mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;\r
+ret = bluetooth_set_discoverable_mode (mode, 180);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image010.png\r
+\r
+               <h3 class="pg">bluetooth_start_discovery</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration, unsigned int classOfDeviceMask)</td></tr>\r
+\r
+       <tr><td rowspan="4">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>max_response</td>\r
+               <td>unsigned short</td>\r
+               <td>the maximum response of the number of founded devices</td></tr>\r
+\r
+       <tr>            <td>Discovery_duration</td>\r
+               <td>unsigned short</td>\r
+               <td>Bluetooth discovery duration</td></tr>\r
+\r
+       <tr>            <td>ClassOfDeviceMask</td>\r
+               <td>unsigned int</td>\r
+               <td>Classes of the device mask which user wants</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function searches for peer Bluetooth devices. It first performs an inquiry; for each device found from the inquiry it gets the remote name of the device.\r
+@n To decide searching options like device type, maximum duration, filtering option, application will receive BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED event through registered callback function. Application can use ignore this event for just using default options, all devices, 30 seconds duration, no filter, general discover option.\r
+@n The device discovery can be cancelled by calling bluetooth_stop_discovery().</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event through registered callback function.\r
+@n The discovery is responded by BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it finds and BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for each device name it finds. The completion or cancellation of the discovery is indicated by BLUETOOTH_EVENT_DISCOVERY_FINISHED event.</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:\r
+               {\r
+                       bluetooth_device_info_t *device_info = NULL;\r
+                       printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]", param->result);\r
+                       device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                       memcpy(&searched_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
+                       printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]", \\r
+                               device_info->device_address.addr[0], device_info->device_address.addr[1], device_info->device_address.addr[2], \\r
+                               device_info->device_address.addr[3], device_info->device_address.addr[4], device_info->device_address.addr[5]);\r
+                       break;\r
+               }\r
+                   case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:\r
+               {\r
+                       bluetooth_device_info_t *device_info = NULL;\r
+                       printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]", param->result);\r
+                       device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                       memcpy(&searched_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
+                       printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]", device_info->device_name.name, \\r
+                               device_info->device_address.addr[0], device_info->device_address.addr[1], device_info->device_address.addr[2], \\r
+                               device_info->device_address.addr[3], device_info->device_address.addr[4], device_info->device_address.addr[5]);\r
+                       break;\r
+               }\r
+\r
+               case BLUETOOTH_EVENT_DISCOVERY_FINISHED:\r
+                       printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result [0x%04x]", param->result);\r
+                       break;\r
+       }\r
+}\r
+\r
+unsigned short max_response;\r
+unsigned short discovery_duration;\r
+unsigned classOfDeviceMask;\r
+int ret = 0;\r
+\r
+max_response =0;\r
+discovery_duration =0;\r
+classOfDeviceMask =0;\r
+\r
+ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image011.png\r
+\r
+               <h3 class="pg">bluetooth_cancel_discovery</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_cancel_discovery (void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">This function returns true on success or false on failure</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function stops the ongoing device discovery operation.\r
+@n * with an error code BLUETOOTH_ERROR_CANCEL</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n If the call is successful in canceling discovery then the application will receive BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function.</td></tr>\r
+\r
+@code\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_DISCOVERY_FINISHED:\r
+                       TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);\r
+                       break;\r
+       }\r
+}\r
+\r
+..\r
+\r
+int ret = 0;\r
+\r
+ret = bluetooth_cancel_discovery();\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image012.png\r
+\r
+               <h3 class="pg">bluetooth_is_discovering</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_is_discovering(void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 if there is no device discovery, 1 if there is a device discovery, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function checks whether the device discovery is started or not.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
+\r
+@code\r
+int ret = 0;\r
+ret = bluetooth_is_discovering ();\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image013.png\r
+\r
+               <h3 class="pg">bluetooth_bond_device</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_bond_device(const bluetooth_device_address_t *device_address)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>device_address</td>\r
+               <td>bluetooth_device_address_t *</td>\r
+               <td>This indicates an address of the device with which the pairing should be initiated</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">This function returns true on success or false on failure</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function initiates a bonding procedure with a peer device. The bonding procedure enables authentication and optionally encryption on the Bluetooth link.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event.</td></tr>\r
+\r
+@code\r
+bluetooth_device_address_t searched_device = {{0}};\r
+bluetooth_device_address_t bonded_device = {{0}};\r
+\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+        {\r
+               case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
+               {
+                       bluetooth_device_info_t *device_info = NULL;
+                       device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                       memset(&searched_device, 0x00, sizeof(bluetooth_device_address_t));\r
+                       memcpy(&searched_device, &device_info->device_address, sizeof(bluetooth_device_address_t));
+                       break;\r
+               }
+\r
+               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
+               {\r
+                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
+                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               bluetooth_device_info_t *device_info = NULL;\r
+                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
+                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
+                       }\r
+                       else\r
+                       {\r
+                               //bonding failed\r
+                       }\r
+                       break;\r
+               }\r
+       }\r
+}\r
+\r
+...\r
+\r
+int ret = 0;\r
+\r
+// After running bluetooth_start_discovery API, call this API if you are in testing.\r
+// Because we try to bond to the lastest searched device for testing in under code.\r
+if (searched_device.addr[0] || searched_device.addr[1] || searched_device.addr[2] \\r
+       || searched_device.addr[3] || searched_device.addr[4] || searched_device.addr[5])\r
+{\r
+       ret = bluetooth_bond_device(&searched_device);\r
+}\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image014.png\r
+\r
+               <h3 class="pg">bluetooth_cancel_bonding</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_cancel_bonding(void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This API is called to cancel the on-going bonding procedure.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an synchronous call.\r
+@code\r
+...\r
+\r
+int ret = 0;\r
+\r
+ret = bluetooth_cancel_bonding();\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image015.png\r
+\r
+               <h3 class="pg">bluetooth_unbond_device</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>device_address</td>\r
+               <td>const bluetooth_device_address_t *</td>\r
+               <td>This indicates an address of the device to remove bonding</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">This function returns true on success or false on failure</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function removes the bonded device from the bonded list.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n The request to remove the specified device from the bonded list is responded by BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event</td></tr>\r
+\r
+@code\r
+bluetooth_device_address_t bonded_device = {{0}};\r
+\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
+               {\r
+                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
+                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               bluetooth_device_info_t *device_info = NULL;\r
+                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
+                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
+                       }\r
+                       else\r
+                       {\r
+                               //bonding failed\r
+                       }\r
+                       break;\r
+               }\r
+\r
+               case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED:\r
+               {\r
+                       if (param->result == BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               //Unbound scuccess\r
+                       }\r
+                       else\r
+                               //unbound failure\r
+               }\r
+       }\r
+}\r
+\r
+\r
+...\r
+\r
+int ret = 0;\r
+\r
+// After running bluetooth_bond_device API, call this API if you are in testing.\r
+// Because we try to unbond to the lastest bonded device for testing in under code.\r
+\r
+ret = bluetooth_unbond_device(bonded_device);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image016.png\r
+\r
+               <h3 class="pg">bluetooth_get_bonded_device_list </h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_get_bonded_device_list(GPtrArray **dev_list)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">This function returns true on success or false on failure</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function gets a list of all the bonded(paired) devices.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an synchronous call.\r
+@n Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not, there is no valid information in the dev_list.\r
+ * The len field in the dev_list represents the number of bonded devices. The data structure for bonded device information is bluetooth_paired_device_info_t.\r
+\r
+ @code\r
+void bt_get_bonded_devices(void)\r
+{\r
+...\r
+       int i;\r
+       GPtrArray *devinfo = NULL;\r
+       bluetooth_paired_device_info_t *ptr;\r
+\r
+       // allocate the g_pointer_array\r
+       devinfo = g_ptr_array_new();\r
+\r
+       ret = bluetooth_get_bonded_device_list(&devinfo);\r
+       if (ret != BLUETOOTH_ERROR_NONE)\r
+       {\r
+               printf("bluetooth_get_bonded_device_list failed with [%d]",ret);\r
+       }\r
+       else\r
+       {\r
+               printf("g pointer arrary count : [%d]", devinfo->len);\r
+               for(i=0; i<devinfo->len;i++)\r
+               {\r
+                       ptr = g_ptr_array_index(devinfo, i);\r
+                       if(ptr != NULL)\r
+                       {\r
+                               printf("Name [%s]\n", ptr->device_name.name);\r
+                               printf("Major Class [%d]\n", ptr->device_class.major_class);\r
+                               printf("Minor Class [%d]\n", ptr->device_class.minor_class);\r
+                               printf("Service Class [%d]\n", ptr->device_class.service_class);\r
+                               printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", ptr->device_address.addr[0], ptr->device_address.addr[1], ptr->device_address.addr[2], ptr->device_address.addr[3], ptr->device_address.addr[4], ptr->device_address.addr[5]);\r
+\r
+                               // handle\r
+                               ...\r
+                       }\r
+               }\r
+       }\r
+       // free g_pointer_array\r
+       g_ptr_array_free(devinfo, TRUE);\r
+}
+\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image017.png\r
+\r
+               <h3 class="pg">bluetooth_get_remote_device (Not supported yet)</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>device_address</td>\r
+               <td>const bluetooth_device_address_t *</td>\r
+               <td>This indicates an address of the remote device</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function gets specific remote device.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n This API is responded by BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.</td></tr>\r
+\r
+@code\r
+int ret = 0;\r
+ret = bluetooth_get_remote_device(&remote_address);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image018.png\r
+\r
+               <h3 class="pg">bluetooth_authorize_device</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_authorize_device(const bluetooth_device_address_t *device_address, gboolean authorized)</td></tr>\r
+\r
+       <tr><td rowspan="3">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>device_address</td>\r
+               <td>const bluetooth_device_address_t *</td>\r
+               <td>This indicates an address of the device to authorize</td></tr>\r
+\r
+       <tr>            <td>authorized</td>\r
+               <td>gboolean</td>\r
+               <td>TRUE: authorized FALSE:unauthorized</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function authorizes a bonded device to be able to connect without user confirmation.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.</td></tr>\r
+\r
+@code\r
+bluetooth_device_address_t bonded_device = {{0}};\r
+\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
+               {\r
+                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
+                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               bluetooth_device_info_t *device_info = NULL;\r
+                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
+                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
+                       }\r
+                       else\r
+                       {\r
+                               //bonding failed\r
+                       }\r
+                       break;\r
+               }\r
+\r
+               case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :\r
+               {\r
+                       if (param->result == BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               //Device authorized\r
+                       }\r
+                       //device authorization failed failure\r
+               }\r
+       }\r
+}\r
+\r
+...\r
+\r
+int ret = 0;\r
+gboolean authorized;\r
+\r
+authorized =TRUE;\r
+\r
+ret = bluetooth_authorize_device(&bonded_device,authorized);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image019.png\r
+\r
+               <h3 class="pg">bluetooth_search_service</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_search_service(const bluetooth_device_address_t *device_address)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>device_address</td>\r
+               <td>const bluetooth_device_address_t *</td>\r
+               <td>This indicates an address of the device whose services need to be found</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This API call initiates the search for the services supported by the specified device.</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an asynchronous call.\r
+@n The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event</td></tr>\r
+\r
+@code\r
+bluetooth_device_address_t bonded_device = {{0}};\r
+\r
+void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+{\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
+               {\r
+                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
+                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               bluetooth_device_info_t *device_info = NULL;\r
+                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
+                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
+                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
+                       }\r
+                       else\r
+                       {\r
+                               //bonding failed\r
+                       }\r
+                       break;\r
+               }\r
+\r
+               case BLUETOOTH_EVENT_SERVICE_SEARCHED:\r
+               {\r
+                       int i = 0;
+                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
+                       {
+                               bt_sdp_info_t * bt_sdp_info=param->param_data;\r
+\r
+                               for(i=0; i<bt_sdp_info->service_index; i++)\r
+                                       printf("[%#x]\n", bt_sdp_info->service_list_array[i]);\r
+                       }
+                       else
+                       {\r
+                               // service searched fail\r
+                       }
+               }\r
+       }\r
+}\r
+\r
+...\r
+\r
+int ret = 0;\r
+ret = bluetooth_search_service(&bonded_device);\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image020.png\r
+\r
+               <h3 class="pg">bluetooth_cancel_service_search</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_cancel_service_search(void)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">0 on success, negative value if failed</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function cancels the ongoing service search operation</td></tr>\r
+\r
+       <tr><td colspan="4">This function is an synchronous call.\r
+\r
+@code\r
+...\r
+\r
+int ret = 0;\r
+ret = bluetooth_cancel_service_search();\r
+@endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image021.png\r
+\r
+               <h3 class="pg">bluetooth_rfcomm_create_socket</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_rfcomm_create_socket(const char *uuid)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>uuid</td>\r
+               <td>const char*</td>\r
+               <td>UUID (128 bits)</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">socket FD</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function register rfcomm socket with the given UUID</td></tr>\r
+\r
+       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
+ @code\r
+\r
+  int fd = 0;\r
+  const char * rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";\r
+  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);\r
+\r
+ @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image022.png\r
+\r
+               <h3 class="pg">bluetooth_rfcomm_listen_and_accept</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection)</td></tr>\r
+\r
+       <tr><td rowspan="3">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>socket_fd</td>\r
+               <td>int</td>\r
+               <td>Server socket FD</td></tr>\r
+\r
+       <tr>            <td>max_pending_connection</td>\r
+               <td>int</td>\r
+               <td>Max pending connection.</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">success or not</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function make rfcomm socket listen with socket. When ever a remote device gets connected, BLUETOOTH_EVENT_RFCOMM_CONNECTED event will get generated. This API is not a blocking call.\r
+ Once the connection is sucessfull, BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED event will get generated when there is some incoming data.</td></tr>\r
+\r
+       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
+  @code\r
+\r
+ void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+ {\r
+       Switch(event)\r
+       {\r
+           case BLUETOOTH_EVENT_RFCOMM_CONNECTED:\r
+           {\r
+                if (param->result == BLUETOOTH_ERROR_NONE)\r
+                {\r
+                    bluetooth_rfcomm_connection_t *con_ind =\r
+                      (bluetooth_rfcomm_connection_t *)param->param_data;\r
+\r
+                    if(con_ind->device_role == RFCOMM_ROLE_SERVER)\r
+                    {\r
+                        //A client has been connected to the sever\r
+                        printf("\nClient fd = %d", conn_ind->socket_fd;\r
+                    }\r
+                    else\r
+                    {\r
+\r
+                    }\r
+                }\r
+            }\r
+       }\r
+ }\r
+\r
+ int ret = 0;\r
+ int max_connect = 1;\r
+ const char * spp_uuid ="00001101-0000-1000-8000-00805F9B34FB";\r
+ int socket_fd = bluetooth_rfcomm_create_socket(spp_uuid);\r
+ ret = bluetooth_rfcomm_listen_and_accept(socket_fd, max_connect);\r
+\r
+ @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image024.png\r
+\r
+\r
+               <h3 class="pg">bluetooth_rfcomm_remove_socket</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)</td></tr>\r
+\r
+       <tr><td rowspan="3">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>socket_fd</td>\r
+               <td>int</td>\r
+               <td>Server socket FD</td></tr>\r
+\r
+       <tr>            <td>uuid</td>\r
+               <td>const char*</td>\r
+               <td>UUID (128 bits)</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">success or not</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">This function deregister rfcomm socket with the given socket descriptor and UUID. If a client connection exists, then BLUETOOTH_EVENT_RFCOMM_DISCONNECTED event will get generated to indicate that the client connection has been terminated.</td></tr>\r
+\r
+       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
+ @code\r
+ void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+ {\r
+       Switch(event)\r
+       {\r
+           case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:\r
+           {\r
+                if (param->result == BLUETOOTH_ERROR_NONE)\r
+                {\r
+                            //A connection exists and it got disconnect\r
+                }\r
+            }\r
+       }\r
+ }\r
+\r
+\r
+ ...\r
+\r
+ int ret = 0;\r
+ int fd = 0;\r
+ const char * spp_uuid ="00001101-0000-1000-8000-00805F9B34FB";\r
+ fd  = bluetooth_rfcomm_create_socket(spp_uuid);\r
+ ret = bluetooth_rfcomm_listen_and_accept(fd, 1);\r
+ ....\r
+ ret = bluetooth_rfcomm_remove_socket(fd, spp_uuid);\r
+\r
+ @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image023.png\r
+\r
+               <h3 class="pg">bluetooth_rfcomm_connect</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address, const char * remote_uuid)</td></tr>\r
+\r
+       <tr><td rowspan="3">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>remote_bt_address</td>\r
+               <td>const bluetooth_device_address_t  *</td>\r
+               <td>Remote device?\99s Bluetooth address</td></tr>\r
+\r
+       <tr>            <td>remot_uuid</td>\r
+               <td>const char*</td>\r
+               <td>remote uuid</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">success or not</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">Connect to a specific RFCOMM based service on a remote device. It is advisible to do a service search before connecting. When ever the connection is successful, BLUETOOTH_EVENT_RFCOMM_CONNECTED event will gets generated.\r
+ Once the connection is sucessfull, BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED event will get generated when there is some incoming data.</td></tr>\r
+\r
+       <tr><td colspan="4">This is Asynchronous operation</td></tr>\r
+  @code\r
+\r
+ void bt_event_callback(int event, bluetooth_event_param_t* param)\r
+ {\r
+       switch(event)\r
+       {\r
+               case BLUETOOTH_EVENT_SERVICE_SEARCHED:\r
+               {\r
+                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
+                       {\r
+                               bt_sdp_info_t * bt_sdp_info=param->param_data;\r
+\r
+                               printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",\r
+                                       bt_sdp_info->device_addr.addr[0], bt_sdp_info->device_addr.addr[1], bt_sdp_info->device_addr.addr[2], \\r
+                                       bt_sdp_info->device_addr.addr[3], bt_sdp_info->device_addr.addr[4], bt_sdp_info->device_addr.addr[5]);\r
+\r
+                                       printf("Supported service list:\n");\r
+                                       for(i=0; i<bt_sdp_info->service_index; i++)\r
+                                               printf("[%#x]\n", bt_sdp_info->service_list_array[i]);\r
+\r
+                               //Alternate method\r
+                               //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr, rfcomm_test_uuid);\r
+                       }\r
+                       break;\r
+               }\r
+               case BLUETOOTH_EVENT_RFCOMM_CONNECTED:\r
+               {\r
+                       bluetooth_rfcomm_connection_t *conn_ind = (bluetooth_rfcomm_connection_t *)param->param_data;\r
+\r
+                       printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,\r
+                                                               (conn_ind->device_role == RFCOMM_ROLE_SERVER)? "SERVER":"CLIENT");\r
+               }\r
+       }\r
+ }\r
+\r
+  bluetooth_device_address_t remote_address = {{0},};\r
+  const char * spp_uuid ="00001101-0000-1000-8000-00805F9B34FB";\r
+  remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;\r
+  remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;\r
+  ret = bluetooth_search_service(&remote_address);\r
+ if (ret < 0)\r
+       printf("Seach failed, Reason = %d", ret);\r
+  else\r
+        printf("Search Success, Ret = %d", ret);\r
+\r
+  ret = bluetooth_rfcomm_connect(&remote_address, spp_uuid);\r
+  if (ret < 0)\r
+       printf("Connection failed, Reason = %d", ret);\r
+  else\r
+        printf("Connection Success, Ret = %d", ret);\r
+\r
+  @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image025.png\r
+\r
+               <h3 class="pg">bluetooth_rfcomm_disconnect</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_rfcomm_disconnect(int socket_fd)</td></tr>\r
+\r
+       <tr><td rowspan="2">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>socket_fd</td>\r
+               <td>int</td>\r
+               <td>Client socket FD</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">success or not</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">Disconnect a specific(remote address)  RFCOMM connection</td></tr>\r
+\r
+       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
+ @code\r
+\r
+  ret = bluetooth_rfcomm_disconnect(g_ret_fd);\r
+  if (ret < 0)\r
+       printf("Disconnection failed");\r
+  else\r
+       printf("Disconnection Success");\r
+\r
+ @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image026.png\r
+\r
+               <h3 class="pg">bluetooth_rfcomm_write</h3>\r
+<table>\r
+       <tr>            <td>Function Prototype</td>\r
+<td colspan="3">int bluetooth_rfcomm_write(int fd, const char *buf, int length)</td></tr>\r
+\r
+       <tr><td rowspan="4">Input Parameters</td>\r
+               <td>Variable Name</td>\r
+               <td>Data Type</td>\r
+               <td>Description</td></tr>\r
+\r
+       <tr>            <td>fd</td>\r
+               <td>int</td>\r
+               <td>Socket descriptor</td></tr>\r
+\r
+       <tr>            <td>buf</td>\r
+               <td>const char*</td>\r
+               <td>Buffer data to send</td></tr>\r
+\r
+       <tr>            <td>length</td>\r
+               <td>int</td>\r
+               <td>Length of the buffer</td></tr>\r
+\r
+       <tr>            <td>Output Parameters</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td>\r
+               <td>n/a</td></tr>\r
+\r
+       <tr>            <td>Returns</td>\r
+<td colspan="3">success or not</td></tr>\r
+\r
+       <tr>            <td>Function Description</td>\r
+<td colspan="3">Send the data to the remote device. This API used by both the client and the sever to send the data.</td></tr>\r
+\r
+       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
+ @code\r
+\r
+ int ret = 0;\r
+ char *buff = "abcdefghijklmnopqrstuvwxyz";\r
+ int len = 26;\r
+ ret = bluetooth_rfcomm_write(fd, buff, len);\r
+\r
+\r
+ @endcode\r
+</table>\r
+\r
+- Sequence flow\r
+@image html bluetooth_image027.png\r
+\r
+*/\r
+/**\r
+@}\r
+*/\r
diff --git a/lib/SLP_BluetoothFW_PG.h b/lib/SLP_BluetoothFW_PG.h
deleted file mode 100644 (file)
index a0dbba8..0000000
+++ /dev/null
@@ -1,2323 +0,0 @@
-/*\r
- * Bluetooth-frwk\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>\r
- *              Girishashok Joshi <girish.joshi@samsung.com>\r
- *              Chanyeol Park <chanyeol.park@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *             http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- */\r
-\r
-/**\r
- *\r
- * @ingroup   SLP_PG\r
- * @defgroup   BLUETOOTH BluetoothFW\r
-@{\r
-<h1 class="pg">Introduction</h1>\r
-       <h2 class="pg">Purpose of this document</h2>\r
-The purpose of this document is to describe how applications can use Bluetooth APIs for handling or working with Bluetooth. This document gives programming guidelines to application engineers.\r
-\r
-       <h2 class="pg">Scope</h2>\r
-The scope of this document is limited to Bluetooth API usage\r
-\r
-       <h2 class="pg">Abbreviations</h2>\r
-<table>\r
-       <tr>            <td>API</td>            <td>Application Programming Interface</td></tr>\r
-       <tr>            <td>SDK</td>            <td>Software Development Kit</td></tr>\r
-       <tr>            <td>RFCOMM</td>         <td>Radio Frequency Communication</td></tr>\r
-       <tr>            <td>L2CAP</td>          <td>Logical Link Control and adaptation Protocol</td></tr>\r
-       <tr>            <td>LM</td>             <td>Link Manager</td></tr>\r
-</table>\r
-\r
-<h1>Bluetooth Framework Architecture</h1>\r
-       <h2 class="pg">Architecture overview</h2>\r
-@image html bluetooth_image001.png\r
-\r
-<h1>Bluetooth Framework Features</h1>\r
-The Bluetooth API exposes a high level interface that is used by applications.\r
-\r
-Bluetooth API currently provides 3 kinds of APIs.\r
-@n GAP APIs: These APIs are used to perform operations related to the local device such as set device name, set visibility mode etc. It also exposes APIs to perform basic Bluetooth related operations like device search\r
-@n SDP APIs: These APIs are used to search service list supported by a specific device. A record in the service list gives a description of a service supported by the device. Specific records having a service ID assigned by Bluetooth SIG give a exact information of predefined service roles.\r
-@n RFCOMM APIs: In order to establish a serial connection between two Bluetooth devices, this SDK provides simple RFCOMM APIs. After receiving FD from SDK, developer can use regular system functions like read() write() poll() select() etc to send or receive data.\r
-\r
-Bluetooth can be shared among several applications, and the Bluetooth framework will supervise some of the important functionalities like pairing, configuration, and authorization. These functions will be confirmed by the user with use of a Bluetooth agent daemon.\r
-\r
-<h1>Using Bluetooth API</h1>\r
-You can use Bluetooth API to communication with other Bluetooth enabled device (mobile phone, PC etc) over RFCOMM interface. This SDK provides supporting Device management functions to find the device you want to connect with. You can refer to the following use cases as examples for writing your own Bluetooth based application.\r
-\r
-       <h2 class="pg">Listening for events</h2>\r
-In general, Bluetooth API provided to you is asynchronous in nature. Hence it becomes mandatory for Application to listen for the events which may be sent by Bluetooth API as per the data received. An application developer can call bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr type. This registered function will receive events of bluetooth_event_type_t type along with any any data.\r
-\r
-       <h2 class="pg">Managing Adapter</h2>\r
-Bluetooth Adaptor represents the Bluetooth Chip present in your device. The bluetooth_enable_adapter() API can be used to activate Bluetooth. This API sends a request to Bluetooth chip for activation. This will also initialize Bluetooth adaptor. Upon completion of the procedure, it will send BLUETOOTH_EVENT_ENABLED event. Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power). bluetooth_disable_adapter() function will do that job for you. After switching off Bluetooth, BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation.\r
-\r
-       <h2 class="pg">Getting local device information</h2>\r
-Every Bluetooth device has a unique 48 bit address assigned to it. You can read your Bluetooth device's address by using bluetooth_get_local_address() API. It is a synchronous function call. In its output parameter, you can receive bluetooth_device_address_t type of pointer which will contain Bluetooth address. Since its inconvenient for user to remember the address, Bluetooth provides a method to have a friendly name for each device. You can get or set the device name by bluetooth_get_local_name() and bluetooth_set_local_name() respectively. If you set the name, BLUETOOTH_EVENT_LOCAL_NAME_CHANGED event will be sent to application to inform result of requested operation. As per Bluetooth standard, maximum length of device name can be BLUETOOTH_DEVICE_NAME_MAX_LENGTH or 248 bytes. It should be in UTF-8 format.\r
-\r
-In order to be discoverable to other devices, your Bluetooth device should respond to inquiry scan requests. You can retrieve the mode of your device by calling bluetooth_get_discoverable_mode() API. It is a synchronous API which will give you current mode in bluetooth_discoverable_mode_t format. You can choose from the four different modes: connectable only (non discoverable), general discoverable, time limited discoverable (discoverable for limited time duration) and limited discoverable.\r
-\r
-       <h2 class="pg">Searching for peer Bluetooth device</h2>\r
-You can search for peer Bluetooth devices using the bluetooth_start_discovery() API. It is an asynchronous function call. You can receive the BLUETOOTH_EVENT_DISCOVERY_STARTED event when any discovery session is successfully started from the target, even if your application does not request discovery. After the opened discovery session is closed, you will get the BLUETOOTH_EVENT_DISCOVERY_FINISHED event. During the discovery session, you can get several BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND events and BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED events. The former event gives information of a device without its name and the latter event includes a friendly name for the device, and is delivered after the former event. The latter event can be delivered more than once for a device.\r
-@n Since only one discovery session is permitted at a time, a discovery request will return failure if there is a session already open.\r
-\r
-       <h2 class="pg">Serial communication in wireless way</h2>\r
-There are two roles in serial communication. One is server role which is waiting a connection from another device. The other role is client role which initiates a connection. For serial communication between your application in two targets.\r
-@n At first you should open server in one device. It can be done with bluetooth_rfcomm_create_socket() API and bluetooth_rfcomm_listen_and_accept() API. You can get a server socket file descriptor with the first API and can start waiting with the second API.\r
-@n At next, client device can connect with a waiting server with bluetooth_rfcomm_remote_connect() API. When a client is successfully connected with a server, you will receive the device node path for serial connection. With opening this path you can communicate with server device by reading and writing it.\r
-@n You should match UUID string with a server. You can use a UUID predefined by Bluetooth SIG if you want to use a specific Bluetooth profile role. Otherwise you should use your own UUID with 128bits hexa value formatted as like "#######-####-####-####-############" Format of Bluetooth SIG predefined UUID is "000####-0000-1000-8000-00805F9B34FB"\r
-\r
-       <h2 class="pg">Tips & Tricks</h2>\r
-You can connect with PC having Bluetooth adapter with Serial Port emulation Profile. For this, you should use SPP UUID string, "0001101-0000-1000-8000-00805F9B34FB" If the serial connection is established, you can use a serial port in PC side for communicating with your application in a device.\r
-\r
-<h1>API descriptions</h1>\r
-       <h2 class="pg">Defines</h2>\r
-               <h3 class="pg">General</h3>\r
-<table>\r
-       <tr>            <td>Macro Name</td>\r
-               <td>Value</td>\r
-               <td>Description</td></tr>\r
-       <tr>            <td>BLUETOOTH_ADDRESS_LENGTH</td>\r
-               <td>6</td>\r
-               <td>Bluetooth address is represented as 48 bits. This is defined in Bluetooth Core Specification document. This macro represents Bluetooth address length in bytes</td></tr>\r
-       <tr>            <td>BLUETOOTH_DEVICE_NAME_LENGTH_MAX</td>\r
-               <td>248</td>\r
-               <td>The Bluetooth device name can be up to 248 bytes maximum according to "Link Manager Protocol". It shall be encoded according to UTF-8</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">Error codes</h3>\r
-<table>\r
-       <tr>            <td>Macro Name</td>\r
-               <td>Value</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_BASE</td>\r
-               <td>0</td>\r
-               <td>Error code base</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NONE</td>\r
-               <td>BLUETOOTH_ERROR_BASE</td>\r
-               <td>No error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_CANCEL</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x01</td>\r
-               <td>Cancelled</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_INVALID_CALLBACK</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x02</td>\r
-               <td>Callback error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_INVALID_PARAM</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x03</td>\r
-               <td>invalid parameter</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_INVALID_DATA</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x04</td>\r
-               <td>invalid data error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_MEMORY_ALLOCATION</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x05</td>\r
-               <td>Memory allocation error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_OUT_OF_MEMORY</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x06</td>\r
-               <td>out of memory error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_TIMEOUT</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x07</td>\r
-               <td>timeout error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NO_RESOURCES</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x08</td>\r
-               <td>No resource error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_INTERNAL</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x09</td>\r
-               <td>internal error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NOT_SUPPORT</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x0A</td>\r
-               <td>Not supported error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_DEVICE_NOT_ENABLED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x0B</td>\r
-               <td>Operation is failed because of not enabled BT Adapter</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x0C</td>\r
-               <td>Enabling is failed because of already enabled BT Adapter</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_DEVICE_BUSY</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x0D</td>\r
-               <td>Operation is failed because of other on going operation</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_ACCESS_DENIED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x0E</td>\r
-               <td>access denied error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_MAX_CLIENT</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x0F</td>\r
-               <td>max client error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NOT_FOUND</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x10</td>\r
-               <td>not found error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x11</td>\r
-               <td>service search fail</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_PARING_FAILED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x12</td>\r
-               <td>pairing failed error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NOT_PAIRED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x13</td>\r
-               <td>Not paired error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_SERVICE_NOT_FOUND</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x14</td>\r
-               <td>no service error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NOT_CONNECTED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x15</td>\r
-               <td>no connection error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_ALREADY_CONNECT</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x16</td>\r
-               <td>already connected error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_CONNECTION_BUSY</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x17</td>\r
-               <td>connection busy error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_CONNECTION_ERROR</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x18</td>\r
-               <td>connection error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_MAX_CONNECTION</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x19</td>\r
-               <td>max connection error</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_NOT_IN_OPERATION</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x1A</td>\r
-               <td>Not in operation</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_CANCEL_BY_USER</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x1B</td>\r
-               <td>cancelled by user</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_REGISTRATION_FAILED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x1C</td>\r
-               <td>registration failed</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_IN_PROGRESS</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x1D</td>\r
-               <td>operation is in progress </td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_AUTHENTICATION_FAILED</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x1E</td>\r
-               <td>authentication failed</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ERROR_HOST_DOWN</td>\r
-               <td>BLUETOOTH_ERROR_BASE - 0x1F</td>\r
-               <td>Remote host is down</td></tr>\r
-\r
-\r
-</table>\r
-\r
-       <h2 class="pg">Enums</h2>\r
-               <h3 class="pg">bluetooth_adapter_state_t</h2>\r
-Adapter state\r
-<table>\r
-       <tr><td colspan="2">bluetooth_adapter_state_t</td></tr>\r
-\r
-       <tr>            <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ADAPTER_DISABLED</td>\r
-               <td>Bluetooth adapter is disabled</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ADAPTER_ENABLED</td>\r
-               <td>Bluetooth adapter is enabled</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ADAPTER_CHANGING_ENABLE</td>\r
-               <td>Bluetooth adapter is currently enabling</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_ADAPTER_CHANGING_DISABLE</td>\r
-               <td>Bluetooth adapter is currently disabling</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_discoverable_mode_t</h3>\r
-Discoverable mode\r
-<table>\r
-       <tr><td colspan="2">bluetooth_discoverable_mode_t</td></tr>\r
-\r
-       <tr>            <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE</td>\r
-               <td>Non discoverable mode, other device cannot search the device</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE</td>\r
-               <td>Discoverable mode, other device can search the device</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE</td>\r
-               <td>Discoverable mode with time limit, After specific timeout it is changed to non discoverable mode</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_event_type_t</h3>\r
-Bluetooth event type\r
-<table>\r
-       <tr><td colspan="2">bluetooth_event_type_t</td></tr>\r
-\r
-       <tr>            <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_NONE</td>\r
-               <td>No event</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_ENABLED</td>\r
-               <td>Bluetooth adapter enabled broadcasting event</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DISABLED</td>\r
-               <td>Bluetooth adapter disabled broadcasting event</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_LOCAL_NAME_CHANGED</td>\r
-               <td>Local friendly name changed broadcasting event</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED</td>\r
-               <td>When setting  local discoverable mode to BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE, this event comes to set timeout for bluetooth_get_discoverable_mode() API.</td></tr>\r
-@n Only the API caller receive this event.\r
-@n (Not supported yet)\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED</td>\r
-               <td>Bluetooth discoverable mode changed, parameter is pointer to changed mode</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED</td>\r
-               <td>(Not supported)</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DISCOVERY_STARTED</td>\r
-               <td>Discovery session started broadcasting event</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DISCOVERY_FINISHED</td>\r
-               <td>Discovery session finished broadcasting event</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND</td>\r
-               <td>During discovery session, found device is reported with this event.</td></tr>\r
-@n Only the API caller receives this event.\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED</td>\r
-               <td>During discovery session, friendly name information of found device is reported with this event.</td></tr>\r
-@n Only the API caller receives this event.\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_BONDING_FINISHED</td>\r
-               <td>Newly bonded device is reported with this event. This is broadcasting event.</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED</td>\r
-               <td>If bonded device is locally removed, this event reported. This is broadcasting event. Removing is not sent to a unbonded peer device because it means removing locally stored key for the device.</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_BONDED_DEVICE_FOUND</td>\r
-               <td>Bonded device is reported with this event if you uses bluetooth_get_bonded_device_list() API. Only the API caller receives this event.</td></tr>\r
-@n (Not supported yet)\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_REMOTE_DEVICE_READ</td>\r
-               <td>Information directly getting from peer device is reported with this event if you uses bluetooth_get_remote_device() API.</td></tr>\r
-@n Only the API caller receives this event.\r
-@n (Not supported yet)\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DEVICE_AUTHORIZED</td>\r
-               <td>This event reports the result of bluetooth_authorize_device() API.</td></tr>\r
-@n Only the API caller receives this event.\r
-@n (Not supported yet)\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED</td>\r
-               <td>This event reports the result of bluetooth_authorize_device() API.</td></tr>\r
-@n Only the API caller receives this event.\r
-@n (Not supported yet)\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_SERVICE_SEARCHED</td>\r
-               <td>This event reports the result of bluetooth_search_service() API.</td></tr>\r
-@n Only the API caller receives this event.\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED</td>\r
-               <td>During searching service, bluetooth_cancel_service_search() API is called, this event indicated the cancellation of searching without BLUETOOTH_EVENT_SERVICE_SEARCHED event.</td></tr>\r
-@n Only the API caller receives this event.\r
-@n (Not supported yet)\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED</td>\r
-               <td>This event is occured if RFCOMM data recieves from remote device.</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_RFCOMM_CONNECTED</td>\r
-               <td>If RFCOMM socket is connected, this event reported </td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_RFCOMM_DISCONNECTED</td>\r
-               <td>If RFCOMM socket is disconnected, this event reported </td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_EVENT_MAX</td>\r
-               <td>Max value</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_device_service_class_t</h3>\r
-Service class part of class of device returned from device discovery, all service which supported found devi   ce is masked. Each type is defined by Bluetooth SIG.\r
-<table>\r
-       <tr><td colspan="2">bluetooth_device_service_class_t</td></tr>\r
-\r
-       <tr>            <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE</td>\r
-               <td>device in limited discoverable mode</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING</td>\r
-               <td>Positioning service</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING</td>\r
-               <td>Networking service</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING</td>\r
-               <td>Printing, Speaker</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING</td>\r
-               <td>Capturing (Scanner, Microphone)</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER</td>\r
-               <td>Object Transfer service</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO</td>\r
-               <td>Audio service</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY</td>\r
-               <td>Telephony service</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION</td>\r
-               <td>WEB-server, WAP-server</td></tr>\r
-\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_device_major_class_t</h3>\r
-Major device class (part of Class of Device)\r
-<table>\r
-       <tr><td colspan="2">bluetooth_device_service_class_t</td></tr>\r
-\r
-       <tr>            <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_MISC</td>\r
-               <td>Miscellaneous major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER</td>\r
-               <td>Computer major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE</td>\r
-               <td>Phone major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT</td>\r
-               <td>LAN major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO</td>\r
-               <td>AUDIO major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL</td>\r
-               <td>Peripheral major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING</td>\r
-               <td>Imaging major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE</td>\r
-               <td>Wearable major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_TOY</td>\r
-               <td>Toy major device class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH</td>\r
-               <td>Health major device class</td></tr>\r
-\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_device_minor_class_t</h3>\r
-Minor device class (part of Class of Device)\r
-<table>\r
-       <tr><td colspan="2">bluetooth_device_service_class_t</td></tr>\r
-\r
-       <tr>            <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED</td>\r
-               <td>Not classified class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Desktop PC</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Desktop Server</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Laptop</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, PDA</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, Desktop PDA</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER, wearable computer</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, cellular phone</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, cordless phone</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, Cellular phone, smart phone</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, voice gateway</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE, ISDN</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT, indicating network performance</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Headset minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Handsfree minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Microphone minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Loud Speaker minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Headphones minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Portable Audio minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Car Audio minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Set top box minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Hifi audio device minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VCR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, VCR minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Camera minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Camcorder minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Monitor minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Display and Loud Speaker minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Video Conferencing minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO, Gaming or toy minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Key board minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Pointing Device minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Combo Keyboard or pointing device  minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, JoyStick minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Game Pad minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Remote Control minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Sensing Device minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Digitizer minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Card Reader minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Digital pen minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Handheld scanner minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL, Handheld gestural input device minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Display minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Camera minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Scanner minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING, Printer minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Wrist watch minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PAGER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Pager minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_JACKET</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Jacket minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HELMET</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Helmet minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE, Glasses minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Robot minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Vehicle minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Doll or Action minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Controller minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GAME</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_TOY, Game minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Blood Pressure minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Thermometer minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Weighing Scale minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Glucose minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Pulse Oximeter minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Heart or pulse rate monitor minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Medical minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_STEP_COUNTER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Step counter minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Body composition analyzer minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Peak flow monitor minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Medication monitor minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Knee prosthesis minor class</td></tr>\r
-\r
-       <tr>            <td>BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS</td>\r
-               <td>Detailed class for BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH, Ankle prosthesis minor class</td></tr>\r
-</table>\r
-\r
-       <h2 class="pg">Structures</h2>\r
-               <h3 class="pg">bluetooth_device_address_t</h3>\r
-This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##\r
-<table>\r
-       <tr><td colspan="3">bluetooth_device_service_class_t</td></tr>\r
-\r
-       <tr>            <td>Type</td>\r
-               <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>unsigned char [BLUETOOTH_ADDRESS_LENGTH]</td>\r
-               <td>addr</td>\r
-               <td>Address of Bluetooth device</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_device_name_t</h3>\r
-This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes\r
-<table>\r
-       <tr><td colspan="3">bluetooth_device_service_class_t</td></tr>\r
-\r
-       <tr>            <td>Type</td>\r
-               <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>char [BLUETOOTH_DEVICE_NAME_LENGTH_MAX]</td>\r
-               <td>name</td>\r
-               <td>Name of Bluetooth device</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_device_class_t</h3>\r
-Structure to hold the device class information\r
-<table>\r
-       <tr><td colspan="3">bluetooth_device_class_t</td></tr>\r
-\r
-       <tr>            <td>Type</td>\r
-               <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>bluetooth_device_major_class_t</td>\r
-               <td>major_class;</td>\r
-               <td>major device class</td></tr>\r
-\r
-       <tr>            <td>bluetooth_device_minor_class_t</td>\r
-               <td>minor_class</td>\r
-               <td>minor device class</td></tr>\r
-\r
-       <tr>            <td>bluetooth_device_service_class_t</td>\r
-               <td>service_class</td>\r
-               <td>service device class</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_device_info_t</h3>\r
-Structure to hold the device information\r
-<table>\r
-       <tr><td colspan="3">bluetooth_device_info_t</td></tr>\r
-\r
-       <tr>            <td>Type</td>\r
-               <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>bluetooth_device_address_t</td>\r
-               <td>device_address</td>\r
-               <td>Device address</td></tr>\r
-\r
-       <tr>            <td>bluetooth_device_name_t</td>\r
-               <td>device_name</td>\r
-               <td>Device name</td></tr>\r
-\r
-       <tr>            <td>bluetooth_device_class_t</td>\r
-               <td>device_class</td>\r
-               <td>Device class</td></tr>\r
-\r
-       <tr>            <td>unsigned int</td>\r
-               <td>service_list_array</td>\r
-               <td>Service list array</td></tr>\r
-\r
-       <tr>            <td>int</td>\r
-               <td>service_index</td>\r
-               <td>Service list number</td></tr>\r
-\r
-       <tr>            <td>int</td>\r
-               <td>rssi</td>\r
-               <td>Received signal strength indicator</td></tr>\r
-\r
-       <tr>            <td>gboolean</td>\r
-               <td>paired</td>\r
-               <td>Paired status</td></tr>\r
-\r
-       <tr>            <td>gboolean</td>\r
-               <td>connected</td>\r
-               <td>Connected status</td></tr>\r
-\r
-       <tr>            <td>gboolean</td>\r
-               <td>trust</td>\r
-               <td>Authorized status</td></tr>\r
-</table>\r
-\r
-               <h3 class="pg">bluetooth_event_param_t</h3>\r
-Structure to hold event information\r
-<table>\r
-       <tr><td colspan="3">bluetooth_device_info_t</td></tr>\r
-\r
-       <tr>            <td>Type</td>\r
-               <td>Name</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>int</td>\r
-               <td>event</td>\r
-               <td>Event type</td></tr>\r
-\r
-       <tr>            <td>int</td>\r
-               <td>result</td>\r
-               <td>Success or error value</td></tr>\r
-\r
-       <tr>            <td>void *</td>\r
-               <td>param_data</td>\r
-               <td>Parameter data pointer</td></tr>\r
-\r
-       <tr>            <td>void *</td>\r
-               <td>user_data</td>\r
-               <td>User data pointer</td></tr>\r
-</table>\r
-\r
-       <h2 class="pg">Call back functions</h2>\r
-               <h3 class="pg">bluetooth_cb_func_ptr</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">Void(* bluetooth_cb_func_ptr)(int event, bluetooth_event_param_t* event_param, void *user_data)</td></tr>\r
-\r
-       <tr><td rowspan="3">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>event</td>\r
-               <td>int</td>\r
-               <td>Event type</td></tr>\r
-\r
-       <tr>            <td>event_param</td>\r
-               <td>bluetooth_event_param_t*</td>\r
-               <td>Event data</td></tr>\r
-\r
-       <tr>            <td>user_data</td>\r
-               <td>void *</td>\r
-               <td>User data</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">Void*</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This call back function will be used to pass asynchronous events to application</td></tr>\r
-</table>\r
-\r
-       <h2 class="pg">Functions</h2>\r
-               <h3 class="pg">bluetooth_register_callback</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>callback_ptr</td>\r
-               <td>bluetooth_cb_func_ptr</td>\r
-               <td>a pointer to callback function</td></tr>\r
-\r
-       <tr>            <td>user_data</td>\r
-               <td>void *</td>\r
-               <td>a pointer to user data</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function will register the callback function, to handle events received from Bluetooth framework. </td></tr>\r
-\r
-       <tr><td colspan="4">This is a synchronous call. No event is returned after this function call</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_data)\r
-{\r
-       GMainLoop *main_loop = (GMainLoop*) user_data;\r
-\r
-       switch(event)\r
-       {\r
-               // Code for each event\r
-               default:\r
-                       g_main_loop_quit(main_loop);\r
-                       break;\r
-       }\r
-}\r
-\r
-int main()\r
-{\r
-       GMainLoop *main_loop = NULL;\r
-       int ret = 0;\r
-       g_type_init();\r
-       main_loop = g_main_loop_new(NULL, FALSE);\r
-       ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);\r
-       if (ret >= BLUETOOTH_ERROR_NONE)\r
-       {\r
-               // bluetooth_register_callback returned Success\r
-       }\r
-       else\r
-       {\r
-               // bluetooth_register_callback returned failiure\r
-       }\r
-       g_main_loop_run(main_loop);\r
-}\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image002.png\r
-\r
-               <h3 class="pg">bluetooth_enable_adapter</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_enable_adapter(void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function initializes Bluetooth protocol stack for use. This function is typically called at startup or when Bluetooth services are required. This function must be called before calling any other API of Bluetooth operations.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event through registered callback function.</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_ENABLED:\r
-                       if (param->result == BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               // Successfully Enabled\r
-                       }\r
-                       else\r
-                       {\r
-                               // Failed\r
-                       }\r
-                       break;\r
-       }\r
-}\r
-\r
-...\r
-\r
-int ret = 0;\r
-ret = bluetooth_enable_adapter();\r
-@endcode\r
-</table>\r
-\r
- - Sequence flow\r
-@image html bluetooth_image003.png\r
-\r
-               <h3 class="pg">bluetooth_disable_adapter</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_disable_adapter(void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function disables Bluetooth protocol stack and hardware. This function should be called when Bluetooth is no longer used.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n If this call is successful then the application will receive BLUETOOTH_EVENT_DISABLED event through registered callback function.</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_DISABLED:\r
-                       if (param->result == BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               // Successfully disabled\r
-                       }\r
-                       else\r
-                       {\r
-                               // Failed\r
-                       }\r
-                       break;\r
-       }\r
-}\r
-\r
-...\r
-\r
-int ret = 0;\r
-ret = bluetooth_disable_adapter();\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image004.png\r
-\r
-               <h3 class="pg">bluetooth_check_adapter</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_check_adapter(void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">bluetooth_adapter_state_t - Adapter state\r
-@n or\r
-@n Negative value (Error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function checks whether the Bluetooth adapter is enabled or not.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
-\r
-@code\r
-\r
-bluetooth_device_address_t local_address={0,};\r
-int ret = 0;\r
-\r
-ret = bluetooth_get_local_address(&local_address);\r
-@endcode\r
-</table>\r
-\r
-\r
-- Sequence flow\r
-@image html bluetooth_image005.png\r
-\r
-               <h3 class="pg">bluetooth_get_local_address</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_get_local_address(bluetooth_device_address_t* local_address)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>local_address</td>\r
-               <td>bluetooth_device_address_t *</td>\r
-               <td>Device address of local Bluetooth adapter</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on Success, Negative value (Error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function is used to get the device address of the local Bluetooth adapter.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
-\r
-@code\r
-bluetooth_device_name_t local_name={0,}\r
-int ret = 0;\r
-ret = bluetooth_get_local_name (&local_name);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image006.png\r
-\r
-               <h3 class="pg">bluetooth_get_local_name</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_get_local_name(bluetooth_device_name_t* local_name)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>local_name</td>\r
-               <td>bluetooth_device_name_t*</td>\r
-               <td>Local device name</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function is used to get the local device name.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_LOCAL_NAME_CHANGED :\r
-                       if (param->result == BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               // Successfully local name changed\r
-                       }\r
-                       else\r
-                       {\r
-                               // Failed\r
-                       }\r
-                       break;\r
-       }\r
-}\r
-\r
-bluetooth_device_name_t local_name={0,}\r
-int ret = 0;\r
-ret = bluetooth_set_local_name (&local_name);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image007.png\r
-\r
-               <h3 class="pg">bluetooth_set_local_name</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_set_local_name(const bluetooth_device_name_t* local_name)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>local_name</td>\r
-               <td>const bluetooth_device_name_t*</td>\r
-               <td>Local device name</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function is used to set the local device name.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an synchronous call.\r
-\r
- @code\r
- bluetooth_discoverable_mode_t discoverable_mode_ptr;\r
- int ret = 0;\r
- ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);\r
- @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image008.png\r
-\r
-               <h3 class="pg">bluetooth_get_discoverable_mode</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t* discoverable_mode_ptr)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>discoverable_mode_ptr</td>\r
-               <td>bluetooth_discoverable_mode_t*</td>\r
-               <td>current bluetooth discoverable mode</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function is used to get the discoverable mode (Visibility option)</td></tr>\r
-\r
-       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED :\r
-                       if (param->result == BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               // Successfully local name changed\r
-                       }\r
-                       else\r
-                       {\r
-                               // Failed\r
-                       }\r
-                       break;\r
-       }\r
-}\r
-\r
-bluetooth_discoverable_mode_t mode;\r
-int ret = 0;\r
-mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;\r
-ret = bluetooth_set_discoverable_mode (mode, 180);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image009.png\r
-\r
-               <h3 class="pg">bluetooth_set_discoverable_mode</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode, int timeout)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>discoverable_mode</td>\r
-               <td>bluetooth_discoverable_mode_t</td>\r
-               <td>Local device name</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function is used to set the discoverable mode (Visibility option).</td></tr>\r
-\r
-       <tr><td colspan="4">If new discoverable mode is time limited discoverable mode then application will receive BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED event through registered callback function. Application can use default timeout, 180 seconds, by ignoring this event.\r
-@n This function is an synchronous call.\r
-\r
-@code\r
-\r
-bluetooth_discoverable_mode_t mode;\r
-int ret = 0;\r
-mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;\r
-ret = bluetooth_set_discoverable_mode (mode, 180);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image010.png\r
-\r
-               <h3 class="pg">bluetooth_start_discovery</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration, unsigned int classOfDeviceMask)</td></tr>\r
-\r
-       <tr><td rowspan="4">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>max_response</td>\r
-               <td>unsigned short</td>\r
-               <td>the maximum response of the number of founded devices</td></tr>\r
-\r
-       <tr>            <td>Discovery_duration</td>\r
-               <td>unsigned short</td>\r
-               <td>Bluetooth discovery duration</td></tr>\r
-\r
-       <tr>            <td>ClassOfDeviceMask</td>\r
-               <td>unsigned int</td>\r
-               <td>Classes of the device mask which user wants</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value (error code) if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function searches for peer Bluetooth devices. It first performs an inquiry; for each device found from the inquiry it gets the remote name of the device.\r
-@n To decide searching options like device type, maximum duration, filtering option, application will receive BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED event through registered callback function. Application can use ignore this event for just using default options, all devices, 30 seconds duration, no filter, general discover option.\r
-@n The device discovery can be cancelled by calling bluetooth_stop_discovery().</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event through registered callback function.\r
-@n The discovery is responded by BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it finds and BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for each device name it finds. The completion or cancellation of the discovery is indicated by BLUETOOTH_EVENT_DISCOVERY_FINISHED event.</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:\r
-               {\r
-                       bluetooth_device_info_t *device_info = NULL;\r
-                       printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]", param->result);\r
-                       device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                       memcpy(&searched_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
-                       printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]", \\r
-                               device_info->device_address.addr[0], device_info->device_address.addr[1], device_info->device_address.addr[2], \\r
-                               device_info->device_address.addr[3], device_info->device_address.addr[4], device_info->device_address.addr[5]);\r
-                       break;\r
-               }\r
-                   case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:\r
-               {\r
-                       bluetooth_device_info_t *device_info = NULL;\r
-                       printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]", param->result);\r
-                       device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                       memcpy(&searched_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
-                       printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]", device_info->device_name.name, \\r
-                               device_info->device_address.addr[0], device_info->device_address.addr[1], device_info->device_address.addr[2], \\r
-                               device_info->device_address.addr[3], device_info->device_address.addr[4], device_info->device_address.addr[5]);\r
-                       break;\r
-               }\r
-\r
-               case BLUETOOTH_EVENT_DISCOVERY_FINISHED:\r
-                       printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result [0x%04x]", param->result);\r
-                       break;\r
-       }\r
-}\r
-\r
-unsigned short max_response;\r
-unsigned short discovery_duration;\r
-unsigned classOfDeviceMask;\r
-int ret = 0;\r
-\r
-max_response =0;\r
-discovery_duration =0;\r
-classOfDeviceMask =0;\r
-\r
-ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image011.png\r
-\r
-               <h3 class="pg">bluetooth_cancel_discovery</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_cancel_discovery (void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">This function returns true on success or false on failure</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function stops the ongoing device discovery operation.\r
-@n * with an error code BLUETOOTH_ERROR_CANCEL</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n If the call is successful in canceling discovery then the application will receive BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function.</td></tr>\r
-\r
-@code\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_DISCOVERY_FINISHED:\r
-                       TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);\r
-                       break;\r
-       }\r
-}\r
-\r
-..\r
-\r
-int ret = 0;\r
-\r
-ret = bluetooth_cancel_discovery();\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image012.png\r
-\r
-               <h3 class="pg">bluetooth_is_discovering</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_is_discovering(void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 if there is no device discovery, 1 if there is a device discovery, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function checks whether the device discovery is started or not.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is a synchronous call.</td></tr>\r
-\r
-@code\r
-int ret = 0;\r
-ret = bluetooth_is_discovering ();\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image013.png\r
-\r
-               <h3 class="pg">bluetooth_bond_device</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_bond_device(const bluetooth_device_address_t *device_address)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>device_address</td>\r
-               <td>bluetooth_device_address_t *</td>\r
-               <td>This indicates an address of the device with which the pairing should be initiated</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">This function returns true on success or false on failure</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function initiates a bonding procedure with a peer device. The bonding procedure enables authentication and optionally encryption on the Bluetooth link.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event.</td></tr>\r
-\r
-@code\r
-bluetooth_device_address_t searched_device = {{0}};\r
-bluetooth_device_address_t bonded_device = {{0}};\r
-\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-        {\r
-               case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
-               {
-                       bluetooth_device_info_t *device_info = NULL;
-                       device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                       memset(&searched_device, 0x00, sizeof(bluetooth_device_address_t));\r
-                       memcpy(&searched_device, &device_info->device_address, sizeof(bluetooth_device_address_t));
-                       break;\r
-               }
-\r
-               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
-               {\r
-                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
-                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               bluetooth_device_info_t *device_info = NULL;\r
-                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
-                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
-                       }\r
-                       else\r
-                       {\r
-                               //bonding failed\r
-                       }\r
-                       break;\r
-               }\r
-       }\r
-}\r
-\r
-...\r
-\r
-int ret = 0;\r
-\r
-// After running bluetooth_start_discovery API, call this API if you are in testing.\r
-// Because we try to bond to the lastest searched device for testing in under code.\r
-if (searched_device.addr[0] || searched_device.addr[1] || searched_device.addr[2] \\r
-       || searched_device.addr[3] || searched_device.addr[4] || searched_device.addr[5])\r
-{\r
-       ret = bluetooth_bond_device(&searched_device);\r
-}\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image014.png\r
-\r
-               <h3 class="pg">bluetooth_cancel_bonding</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_cancel_bonding(void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This API is called to cancel the on-going bonding procedure.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an synchronous call.\r
-@code\r
-...\r
-\r
-int ret = 0;\r
-\r
-ret = bluetooth_cancel_bonding();\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image015.png\r
-\r
-               <h3 class="pg">bluetooth_unbond_device</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>device_address</td>\r
-               <td>const bluetooth_device_address_t *</td>\r
-               <td>This indicates an address of the device to remove bonding</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">This function returns true on success or false on failure</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function removes the bonded device from the bonded list.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n The request to remove the specified device from the bonded list is responded by BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event</td></tr>\r
-\r
-@code\r
-bluetooth_device_address_t bonded_device = {{0}};\r
-\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
-               {\r
-                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
-                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               bluetooth_device_info_t *device_info = NULL;\r
-                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
-                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
-                       }\r
-                       else\r
-                       {\r
-                               //bonding failed\r
-                       }\r
-                       break;\r
-               }\r
-\r
-               case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED:\r
-               {\r
-                       if (param->result == BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               //Unbound scuccess\r
-                       }\r
-                       else\r
-                               //unbound failure\r
-               }\r
-       }\r
-}\r
-\r
-\r
-...\r
-\r
-int ret = 0;\r
-\r
-// After running bluetooth_bond_device API, call this API if you are in testing.\r
-// Because we try to unbond to the lastest bonded device for testing in under code.\r
-\r
-ret = bluetooth_unbond_device(bonded_device);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image016.png\r
-\r
-               <h3 class="pg">bluetooth_get_bonded_device_list </h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_get_bonded_device_list(GPtrArray **dev_list)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">This function returns true on success or false on failure</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function gets a list of all the bonded(paired) devices.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an synchronous call.\r
-@n Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not, there is no valid information in the dev_list.\r
- * The len field in the dev_list represents the number of bonded devices. The data structure for bonded device information is bluetooth_paired_device_info_t.\r
-\r
- @code\r
-void bt_get_bonded_devices(void)\r
-{\r
-...\r
-       int i;\r
-       GPtrArray *devinfo = NULL;\r
-       bluetooth_paired_device_info_t *ptr;\r
-\r
-       // allocate the g_pointer_array\r
-       devinfo = g_ptr_array_new();\r
-\r
-       ret = bluetooth_get_bonded_device_list(&devinfo);\r
-       if (ret != BLUETOOTH_ERROR_NONE)\r
-       {\r
-               printf("bluetooth_get_bonded_device_list failed with [%d]",ret);\r
-       }\r
-       else\r
-       {\r
-               printf("g pointer arrary count : [%d]", devinfo->len);\r
-               for(i=0; i<devinfo->len;i++)\r
-               {\r
-                       ptr = g_ptr_array_index(devinfo, i);\r
-                       if(ptr != NULL)\r
-                       {\r
-                               printf("Name [%s]\n", ptr->device_name.name);\r
-                               printf("Major Class [%d]\n", ptr->device_class.major_class);\r
-                               printf("Minor Class [%d]\n", ptr->device_class.minor_class);\r
-                               printf("Service Class [%d]\n", ptr->device_class.service_class);\r
-                               printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", ptr->device_address.addr[0], ptr->device_address.addr[1], ptr->device_address.addr[2], ptr->device_address.addr[3], ptr->device_address.addr[4], ptr->device_address.addr[5]);\r
-\r
-                               // handle\r
-                               ...\r
-                       }\r
-               }\r
-       }\r
-       // free g_pointer_array\r
-       g_ptr_array_free(devinfo, TRUE);\r
-}
-\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image017.png\r
-\r
-               <h3 class="pg">bluetooth_get_remote_device (Not supported yet)</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>device_address</td>\r
-               <td>const bluetooth_device_address_t *</td>\r
-               <td>This indicates an address of the remote device</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function gets specific remote device.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n This API is responded by BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.</td></tr>\r
-\r
-@code\r
-int ret = 0;\r
-ret = bluetooth_get_remote_device(&remote_address);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image018.png\r
-\r
-               <h3 class="pg">bluetooth_authorize_device</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_authorize_device(const bluetooth_device_address_t *device_address, gboolean authorized)</td></tr>\r
-\r
-       <tr><td rowspan="3">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>device_address</td>\r
-               <td>const bluetooth_device_address_t *</td>\r
-               <td>This indicates an address of the device to authorize</td></tr>\r
-\r
-       <tr>            <td>authorized</td>\r
-               <td>gboolean</td>\r
-               <td>TRUE: authorized FALSE:unauthorized</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function authorizes a bonded device to be able to connect without user confirmation.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.</td></tr>\r
-\r
-@code\r
-bluetooth_device_address_t bonded_device = {{0}};\r
-\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
-               {\r
-                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
-                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               bluetooth_device_info_t *device_info = NULL;\r
-                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
-                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
-                       }\r
-                       else\r
-                       {\r
-                               //bonding failed\r
-                       }\r
-                       break;\r
-               }\r
-\r
-               case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :\r
-               {\r
-                       if (param->result == BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               //Device authorized\r
-                       }\r
-                       //device authorization failed failure\r
-               }\r
-       }\r
-}\r
-\r
-...\r
-\r
-int ret = 0;\r
-gboolean authorized;\r
-\r
-authorized =TRUE;\r
-\r
-ret = bluetooth_authorize_device(&bonded_device,authorized);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image019.png\r
-\r
-               <h3 class="pg">bluetooth_search_service</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_search_service(const bluetooth_device_address_t *device_address)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>device_address</td>\r
-               <td>const bluetooth_device_address_t *</td>\r
-               <td>This indicates an address of the device whose services need to be found</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This API call initiates the search for the services supported by the specified device.</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an asynchronous call.\r
-@n The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event</td></tr>\r
-\r
-@code\r
-bluetooth_device_address_t bonded_device = {{0}};\r
-\r
-void bt_event_callback(int event, bluetooth_event_param_t* param)\r
-{\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_BONDING_FINISHED:\r
-               {\r
-                       TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);\r
-                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               bluetooth_device_info_t *device_info = NULL;\r
-                               device_info  = (bluetooth_device_info_t *)param->param_data;\r
-                               memset(&bonded_device, 0x00, sizeof(bluetooth_device_address_t));\r
-                               memcpy(&bonded_device, &device_info->device_address, sizeof(bluetooth_device_address_t));\r
-                       }\r
-                       else\r
-                       {\r
-                               //bonding failed\r
-                       }\r
-                       break;\r
-               }\r
-\r
-               case BLUETOOTH_EVENT_SERVICE_SEARCHED:\r
-               {\r
-                       int i = 0;
-                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
-                       {
-                               bt_sdp_info_t * bt_sdp_info=param->param_data;\r
-\r
-                               for(i=0; i<bt_sdp_info->service_index; i++)\r
-                                       printf("[%#x]\n", bt_sdp_info->service_list_array[i]);\r
-                       }
-                       else
-                       {\r
-                               // service searched fail\r
-                       }
-               }\r
-       }\r
-}\r
-\r
-...\r
-\r
-int ret = 0;\r
-ret = bluetooth_search_service(&bonded_device);\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image020.png\r
-\r
-               <h3 class="pg">bluetooth_cancel_service_search</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_cancel_service_search(void)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">0 on success, negative value if failed</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function cancels the ongoing service search operation</td></tr>\r
-\r
-       <tr><td colspan="4">This function is an synchronous call.\r
-\r
-@code\r
-...\r
-\r
-int ret = 0;\r
-ret = bluetooth_cancel_service_search();\r
-@endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image021.png\r
-\r
-               <h3 class="pg">bluetooth_rfcomm_create_socket</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_rfcomm_create_socket(const char *uuid)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>uuid</td>\r
-               <td>const char*</td>\r
-               <td>UUID (128 bits)</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">socket FD</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function register rfcomm socket with the given UUID</td></tr>\r
-\r
-       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
- @code\r
-\r
-  int fd = 0;\r
-  const char * rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";\r
-  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);\r
-\r
- @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image022.png\r
-\r
-               <h3 class="pg">bluetooth_rfcomm_listen_and_accept</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection)</td></tr>\r
-\r
-       <tr><td rowspan="3">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>socket_fd</td>\r
-               <td>int</td>\r
-               <td>Server socket FD</td></tr>\r
-\r
-       <tr>            <td>max_pending_connection</td>\r
-               <td>int</td>\r
-               <td>Max pending connection.</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">success or not</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function make rfcomm socket listen with socket. When ever a remote device gets connected, BLUETOOTH_EVENT_RFCOMM_CONNECTED event will get generated. This API is not a blocking call.\r
- Once the connection is sucessfull, BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED event will get generated when there is some incoming data.</td></tr>\r
-\r
-       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
-  @code\r
-\r
- void bt_event_callback(int event, bluetooth_event_param_t* param)\r
- {\r
-       Switch(event)\r
-       {\r
-           case BLUETOOTH_EVENT_RFCOMM_CONNECTED:\r
-           {\r
-                if (param->result == BLUETOOTH_ERROR_NONE)\r
-                {\r
-                    bluetooth_rfcomm_connection_t *con_ind =\r
-                      (bluetooth_rfcomm_connection_t *)param->param_data;\r
-\r
-                    if(con_ind->device_role == RFCOMM_ROLE_SERVER)\r
-                    {\r
-                        //A client has been connected to the sever\r
-                        printf("\nClient fd = %d", conn_ind->socket_fd;\r
-                    }\r
-                    else\r
-                    {\r
-\r
-                    }\r
-                }\r
-            }\r
-       }\r
- }\r
-\r
- int ret = 0;\r
- int max_connect = 1;\r
- const char * spp_uuid ="00001101-0000-1000-8000-00805F9B34FB";\r
- int socket_fd = bluetooth_rfcomm_create_socket(spp_uuid);\r
- ret = bluetooth_rfcomm_listen_and_accept(socket_fd, max_connect);\r
-\r
- @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image024.png\r
-\r
-\r
-               <h3 class="pg">bluetooth_rfcomm_remove_socket</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)</td></tr>\r
-\r
-       <tr><td rowspan="3">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>socket_fd</td>\r
-               <td>int</td>\r
-               <td>Server socket FD</td></tr>\r
-\r
-       <tr>            <td>uuid</td>\r
-               <td>const char*</td>\r
-               <td>UUID (128 bits)</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">success or not</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">This function deregister rfcomm socket with the given socket descriptor and UUID. If a client connection exists, then BLUETOOTH_EVENT_RFCOMM_DISCONNECTED event will get generated to indicate that the client connection has been terminated.</td></tr>\r
-\r
-       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
- @code\r
- void bt_event_callback(int event, bluetooth_event_param_t* param)\r
- {\r
-       Switch(event)\r
-       {\r
-           case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:\r
-           {\r
-                if (param->result == BLUETOOTH_ERROR_NONE)\r
-                {\r
-                            //A connection exists and it got disconnect\r
-                }\r
-            }\r
-       }\r
- }\r
-\r
-\r
- ...\r
-\r
- int ret = 0;\r
- int fd = 0;\r
- const char * spp_uuid ="00001101-0000-1000-8000-00805F9B34FB";\r
- fd  = bluetooth_rfcomm_create_socket(spp_uuid);\r
- ret = bluetooth_rfcomm_listen_and_accept(fd, 1);\r
- ....\r
- ret = bluetooth_rfcomm_remove_socket(fd, spp_uuid);\r
-\r
- @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image023.png\r
-\r
-               <h3 class="pg">bluetooth_rfcomm_connect</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address, const char * remote_uuid)</td></tr>\r
-\r
-       <tr><td rowspan="3">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>remote_bt_address</td>\r
-               <td>const bluetooth_device_address_t  *</td>\r
-               <td>Remote device?\99s Bluetooth address</td></tr>\r
-\r
-       <tr>            <td>remot_uuid</td>\r
-               <td>const char*</td>\r
-               <td>remote uuid</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">success or not</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">Connect to a specific RFCOMM based service on a remote device. It is advisible to do a service search before connecting. When ever the connection is successful, BLUETOOTH_EVENT_RFCOMM_CONNECTED event will gets generated.\r
- Once the connection is sucessfull, BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED event will get generated when there is some incoming data.</td></tr>\r
-\r
-       <tr><td colspan="4">This is Asynchronous operation</td></tr>\r
-  @code\r
-\r
- void bt_event_callback(int event, bluetooth_event_param_t* param)\r
- {\r
-       switch(event)\r
-       {\r
-               case BLUETOOTH_EVENT_SERVICE_SEARCHED:\r
-               {\r
-                       if (param->result >= BLUETOOTH_ERROR_NONE)\r
-                       {\r
-                               bt_sdp_info_t * bt_sdp_info=param->param_data;\r
-\r
-                               printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",\r
-                                       bt_sdp_info->device_addr.addr[0], bt_sdp_info->device_addr.addr[1], bt_sdp_info->device_addr.addr[2], \\r
-                                       bt_sdp_info->device_addr.addr[3], bt_sdp_info->device_addr.addr[4], bt_sdp_info->device_addr.addr[5]);\r
-\r
-                                       printf("Supported service list:\n");\r
-                                       for(i=0; i<bt_sdp_info->service_index; i++)\r
-                                               printf("[%#x]\n", bt_sdp_info->service_list_array[i]);\r
-\r
-                               //Alternate method\r
-                               //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr, rfcomm_test_uuid);\r
-                       }\r
-                       break;\r
-               }\r
-               case BLUETOOTH_EVENT_RFCOMM_CONNECTED:\r
-               {\r
-                       bluetooth_rfcomm_connection_t *conn_ind = (bluetooth_rfcomm_connection_t *)param->param_data;\r
-\r
-                       printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,\r
-                                                               (conn_ind->device_role == RFCOMM_ROLE_SERVER)? "SERVER":"CLIENT");\r
-               }\r
-       }\r
- }\r
-\r
-  bluetooth_device_address_t remote_address = {{0},};\r
-  const char * spp_uuid ="00001101-0000-1000-8000-00805F9B34FB";\r
-  remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;\r
-  remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;\r
-  ret = bluetooth_search_service(&remote_address);\r
- if (ret < 0)\r
-       printf("Seach failed, Reason = %d", ret);\r
-  else\r
-        printf("Search Success, Ret = %d", ret);\r
-\r
-  ret = bluetooth_rfcomm_connect(&remote_address, spp_uuid);\r
-  if (ret < 0)\r
-       printf("Connection failed, Reason = %d", ret);\r
-  else\r
-        printf("Connection Success, Ret = %d", ret);\r
-\r
-  @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image025.png\r
-\r
-               <h3 class="pg">bluetooth_rfcomm_disconnect</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_rfcomm_disconnect(int socket_fd)</td></tr>\r
-\r
-       <tr><td rowspan="2">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>socket_fd</td>\r
-               <td>int</td>\r
-               <td>Client socket FD</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">success or not</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">Disconnect a specific(remote address)  RFCOMM connection</td></tr>\r
-\r
-       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
- @code\r
-\r
-  ret = bluetooth_rfcomm_disconnect(g_ret_fd);\r
-  if (ret < 0)\r
-       printf("Disconnection failed");\r
-  else\r
-       printf("Disconnection Success");\r
-\r
- @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image026.png\r
-\r
-               <h3 class="pg">bluetooth_rfcomm_write</h3>\r
-<table>\r
-       <tr>            <td>Function Prototype</td>\r
-<td colspan="3">int bluetooth_rfcomm_write(int fd, const char *buf, int length)</td></tr>\r
-\r
-       <tr><td rowspan="4">Input Parameters</td>\r
-               <td>Variable Name</td>\r
-               <td>Data Type</td>\r
-               <td>Description</td></tr>\r
-\r
-       <tr>            <td>fd</td>\r
-               <td>int</td>\r
-               <td>Socket descriptor</td></tr>\r
-\r
-       <tr>            <td>buf</td>\r
-               <td>const char*</td>\r
-               <td>Buffer data to send</td></tr>\r
-\r
-       <tr>            <td>length</td>\r
-               <td>int</td>\r
-               <td>Length of the buffer</td></tr>\r
-\r
-       <tr>            <td>Output Parameters</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td>\r
-               <td>n/a</td></tr>\r
-\r
-       <tr>            <td>Returns</td>\r
-<td colspan="3">success or not</td></tr>\r
-\r
-       <tr>            <td>Function Description</td>\r
-<td colspan="3">Send the data to the remote device. This API used by both the client and the sever to send the data.</td></tr>\r
-\r
-       <tr><td colspan="4">This is a synchronous operation</td></tr>\r
- @code\r
-\r
- int ret = 0;\r
- char *buff = "abcdefghijklmnopqrstuvwxyz";\r
- int len = 26;\r
- ret = bluetooth_rfcomm_write(fd, buff, len);\r
-\r
-\r
- @endcode\r
-</table>\r
-\r
-- Sequence flow\r
-@image html bluetooth_image027.png\r
-\r
-*/\r
-/**\r
-@}\r
-*/\r
index 7cb8139bdbb4c2c92bad8ceb809623e7ebcca345..a7b47b3c4874da02181edbed6d5781ad9de42033 100644 (file)
 
 static void __bluetooth_internal_mode_changed_cb(DBusGProxy *object, const char *changed_mode,
                                                gpointer user_data);
-static void __bluetooth_internal_connection_changed_cb(gboolean connected,
-                                                    const bluetooth_device_address_t *device_addr);
-static void __bluetooth_internal_authorized_cb(gboolean authorized,
-                                               const bluetooth_device_address_t *device_addr);
 
 /* Global session information*/
 static bt_info_t bt_info = { 0, };
@@ -52,6 +48,24 @@ bt_info_t *_bluetooth_internal_get_information(void)
        return bt_internal_info;
 }
 
+void _bluetooth_internal_event_cb(int event, int result, void *param_data)
+{
+       DBG("+");
+       bluetooth_event_param_t bt_event = { 0, };
+       bt_info_t *bt_internal_info = NULL;
+       bt_event.event = event;
+       bt_event.result = result;
+       bt_event.param_data = param_data;
+
+       bt_internal_info = _bluetooth_internal_get_information();
+
+       if (bt_internal_info->bt_cb_ptr)
+               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
+                                       bt_internal_info->user_data);
+
+       DBG("-");
+}
+
 bool _bluetooth_internal_is_adapter_enabled(void)
 {
        GError *err = NULL;
@@ -60,11 +74,6 @@ bool _bluetooth_internal_is_adapter_enabled(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL");
-               return FALSE;
-       }
-
        if (bt_internal_info->manager_proxy == NULL) {
                DBG("manager_proxy is NULL");
                return FALSE;
@@ -282,49 +291,6 @@ static int __bluetooth_internal_store_get_value(const char *key,
        return ret;
 }
 
-int _bluetooth_internal_get_value(bt_store_key_t key)
-{
-       int ret = 0;
-
-       switch (key) {
-       case BT_STORE_NAME:
-               ret = __bluetooth_internal_store_get_value(BT_SETTING_DEVICE_NAME,
-                                                       BT_STORE_STRING,
-                                                        BLUETOOTH_DEVICE_NAME_LENGTH_MAX,
-                                                       bt_info.bt_local_name.name);
-               break;
-
-       case BT_STORE_DISCOVERABLE_MODE:
-               break;
-
-       default:
-               break;
-       }
-
-       return ret;
-}
-
-int _bluetooth_internal_set_value(bt_store_key_t key)
-{
-       int ret = 0;
-
-       switch (key) {
-       case BT_STORE_NAME:
-               ret = __bluetooth_internal_store_set_value(BT_STORE_LOCAL_NAME_PATH,
-                                                       BT_STORE_STRING,
-                                                        bt_info.bt_local_name.name);
-               break;
-
-       case BT_STORE_DISCOVERABLE_MODE:
-               break;
-
-       default:
-               break;
-       }
-
-       return ret;
-}
-
 DBusGProxy *_bluetooth_internal_find_device_by_path(const char *dev_path)
 {
        GList *list = bt_info.device_proxy_list;
@@ -396,15 +362,19 @@ static void __bluetooth_internal_device_property_changed(DBusGProxy *device_prox
        GHashTable *hash = NULL;
        GValue *property_value;
 
-       bt_info_t *bt_internal_info = NULL;
-       bt_internal_info = _bluetooth_internal_get_information();
-       bluetooth_event_param_t bt_event = { 0, };
-
        DBG("+ remote device[%s] property[%s]\n", dev_path, property);
 
        if (g_strcmp0(property, "Paired") == 0) {
+               bt_info_t *bt_internal_info = NULL;
                gboolean paired = g_value_get_boolean(value);
-               char address[18] = { 0 };
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+               bt_internal_info = _bluetooth_internal_get_information();
+
+               if (bt_internal_info->is_bonding_req == TRUE) {
+                       DBG("Will recieve the async result");
+                       return;
+               }
 
                _bluetooth_internal_device_path_to_address(dev_path, address);
 
@@ -413,7 +383,7 @@ static void __bluetooth_internal_device_property_changed(DBusGProxy *device_prox
                                                        (gpointer)device_proxy);
                }
        } else if (g_strcmp0(property, "Trusted") == 0) {
-               char address[18] = { 0 };
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
                bluetooth_device_address_t device_addr = { {0} };
                gboolean trusted = g_value_get_boolean(value);
 
@@ -422,16 +392,21 @@ static void __bluetooth_internal_device_property_changed(DBusGProxy *device_prox
 
                _bluetooth_internal_device_path_to_address(dev_path, address);
                _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr, address);
-               __bluetooth_internal_authorized_cb(trusted, &device_addr);
+               _bluetooth_internal_event_cb(trusted ? BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
+                                               BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED,
+                                               BLUETOOTH_ERROR_NONE, &device_addr);
+
        } else if (g_strcmp0(property, "Connected") == 0) {
-               char address[18] = { 0 };
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
                bluetooth_device_address_t device_addr = { {0} };
                gboolean connected = g_value_get_boolean(value);
 
                _bluetooth_internal_device_path_to_address(dev_path, address);
                _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
                                                                        address);
-               __bluetooth_internal_connection_changed_cb(connected, &device_addr);
+               _bluetooth_internal_event_cb(connected ? BLUETOOTH_EVENT_DEVICE_CONNECTED :
+                                               BLUETOOTH_EVENT_DEVICE_DISCONNECTED,
+                                               BLUETOOTH_ERROR_NONE, &device_addr);
 
        } else if (g_strcmp0(property, "Name") == 0) {
                const gchar *name = g_value_get_string(value);
@@ -459,7 +434,10 @@ static void __bluetooth_internal_device_property_changed(DBusGProxy *device_prox
                }
        } else if (g_strcmp0(property, "UUIDs") == 0) {
                bt_sdp_info_t sdp_data;
-               char address[18] = { 0 };
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               int err = BLUETOOTH_ERROR_NONE;
+               bt_info_t *bt_internal_info = NULL;
+               bt_internal_info = _bluetooth_internal_get_information();
 
                DBG("Device Property Changed (UUIDs )");
 
@@ -474,22 +452,14 @@ static void __bluetooth_internal_device_property_changed(DBusGProxy *device_prox
                bt_internal_info->is_service_req = FALSE;
 
                /* Report UUID list as xml_parsed_sdp_data to the upper layer. */
-               if (bt_internal_info->bt_cb_ptr) {
-                       bt_event.event = BLUETOOTH_EVENT_SERVICE_SEARCHED;
-                       if (sdp_data.service_index <= 0 ||
-                               sdp_data.service_index >= BLUETOOTH_MAX_SERVICES_FOR_DEVICE) {
-                               bt_event.result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
-                               sdp_data.service_index = 0;
-                               bt_event.param_data = &sdp_data;
-                       } else {
-                               bt_event.result = BLUETOOTH_ERROR_NONE;
-                               bt_event.param_data = &sdp_data;
-                       }
-
-                       bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                               bt_internal_info->user_data);
-
+               if (sdp_data.service_index <= 0 ||
+                       sdp_data.service_index >= BLUETOOTH_MAX_SERVICES_FOR_DEVICE) {
+                       sdp_data.service_index = 0;
+                       err = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
                }
+
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                                       err, &sdp_data);
        }
 
        DBG("-\n");
@@ -587,7 +557,7 @@ static void __bluetooth_internal_device_removed(DBusGProxy *adapter,
 
        if (path != NULL) {
                DBusGProxy *device_proxy = _bluetooth_internal_find_device_by_path(path);
-               char address[18] = { 0 };
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
 
                if (device_proxy == NULL) {
                        return;
@@ -668,18 +638,11 @@ static void __bluetooth_internal_adapter_property_changed(DBusGProxy *adapter,
        if (g_strcmp0(property, "Name") == 0) {
                const gchar *name = g_value_get_string(value);
                if (name && strlen(name)) {
-                       if (strlen(name) <= BLUETOOTH_DEVICE_NAME_LENGTH_MAX) {
-                               DBG("Changed Name [%s]", name);
-                               strncpy(bt_info.bt_local_name.name, name,
-                                                               BLUETOOTH_DEVICE_NAME_LENGTH_MAX);
-                               bt_info.bt_local_name.name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX] = '\0';
-
-                               ret = _bluetooth_internal_set_value(BT_STORE_NAME);
-                               _bluetooth_internal_adapter_name_changed_cb();
-                       } else {
-                               DBG("The name length[%d] is over than %d", strlen(name),
-                                   BLUETOOTH_DEVICE_NAME_LENGTH_MAX);
-                       }
+                       DBG("Changed Name [%s]", name);
+                       g_strlcpy(bt_info.bt_local_name.name, name,
+                                       BLUETOOTH_DEVICE_NAME_LENGTH_MAX+1);
+
+                       _bluetooth_internal_adapter_name_changed_cb();
                }
        } else if (g_strcmp0(property, "Discovering") == 0) {
                gboolean discovering = g_value_get_boolean(value);
@@ -1040,27 +1003,16 @@ static void __bluetooth_internal_mode_changed_cb(DBusGProxy *object, const char
                                                gpointer user_data)
 {
 
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       DBG("+\n");
+       int result = BLUETOOTH_ERROR_NONE;
+       void *param_data = NULL;
+       int scanEnable = 0;
 
        DBG("Mode changed [%s]\n", changed_mode);
 
-       if (!bt_internal_info || !bt_internal_info->bt_cb_ptr)
-               return;
-
        if (strlen(changed_mode) == 0) {
                DBG("ModeChanged get mode failed\n");
-               bt_event.event = BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED;
-               bt_event.result = BLUETOOTH_ERROR_INTERNAL;
-               bt_event.param_data = NULL;
+               result = BLUETOOTH_ERROR_INTERNAL;
        } else {
-               int scanEnable = 0;
-               bt_event.event = BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED;
-               bt_event.result = BLUETOOTH_ERROR_NONE;
                if (strcmp(changed_mode, "connectable") == 0)
                        scanEnable = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
                else if (strcmp(changed_mode, "discoverable") == 0)
@@ -1070,58 +1022,15 @@ static void __bluetooth_internal_mode_changed_cb(DBusGProxy *object, const char
                else
                        scanEnable = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
 
-               bt_event.param_data = &scanEnable;
+               param_data = &scanEnable;
        }
 
-       bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                               bt_internal_info->user_data);
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
+                                       result, param_data);
 
        DBG("-\n");
 }
 
-static void __bluetooth_internal_connection_changed_cb(gboolean connected,
-                                               const bluetooth_device_address_t *device_addr)
-{
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-
-       DBG("+");
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       bt_event.event = connected ? BLUETOOTH_EVENT_DEVICE_CONNECTED :
-                                                       BLUETOOTH_EVENT_DEVICE_DISCONNECTED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = (void *)device_addr;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
-       DBG("-");
-}
-
-static void __bluetooth_internal_authorized_cb(gboolean authorized,
-                                               const bluetooth_device_address_t *device_addr)
-{
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-
-       DBG("+");
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       bt_event.event = authorized ? BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
-                                                               BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = (void *)device_addr;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
-       DBG("-");
-}
-
-
 static int __bluetooth_get_default_name(char *default_dev_name, int size)
 {
        /* Getting Phone name starts */
@@ -1212,9 +1121,6 @@ void _bluetooth_internal_session_init(void)
                        AST("Could not create a agent dbus proxy");
                }
 
-               ret = _bluetooth_internal_get_value(BT_STORE_NAME);
-               ret = _bluetooth_internal_get_value(BT_STORE_DISCOVERABLE_MODE);
-
                dbus_g_proxy_add_signal(bt_info.manager_proxy, "AdapterAdded",
                                        DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
                dbus_g_proxy_connect_signal(bt_info.manager_proxy, "AdapterAdded",
index 9d639321e927771aab27a2523d320500e41f3f62..77862fbae2858d965aed39a59f91c2fab70c6b23 100644 (file)
@@ -57,7 +57,6 @@
        SLOG(LOG_ERROR, BT_FRWK, "%s():%d "fmt, __func__, __LINE__, ##args)
 
 #define BT_STORE_PREFIX "db/bluetooth/"
-#define BT_STORE_LOCAL_NAME_PATH BT_STORE_PREFIX"localname"
 #define BT_STORE_VISIBILITY_PATH BT_STORE_PREFIX"visibility"
 #define BT_STORE_VISIBILITY_TIME_PATH BT_STORE_PREFIX"visibility_time"
 #define BT_MEMORY_KEY_RESTRICTION "memory/bluetooth/restriction"
@@ -180,6 +179,8 @@ typedef struct {
 } bt_info_t;
 
 bt_info_t *_bluetooth_internal_get_information(void);
+void _bluetooth_internal_event_cb(int event, int result, void *param_data);
+
 void _bluetooth_internal_session_init(void);
 
 bool _bluetooth_internal_is_adapter_enabled(void);
index 8abc0575cfac9e1a93b02e1f22bb1ceb35d932ec..e129417634fe262672763a58d9e6e05b1c9054b8 100644 (file)
@@ -222,7 +222,6 @@ typedef enum {
        BLUETOOTH_EVENT_REMOTE_DEVICE_READ,         /**< Bluetooth event read remote device */
        BLUETOOTH_EVENT_DEVICE_AUTHORIZED,          /**< Bluetooth event authorize device */
        BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED,        /**< Bluetooth event unauthorize device */
-       BLUETOOTH_EVENT_READ_LOCAL_OOB_DATA,        /**< Bluetooth event read local oob data */
 
        BLUETOOTH_EVENT_SERVICE_SEARCHED = BLUETOOTH_EVENT_SDP_BASE,
                                                    /**< Bluetooth event serice search base id */
@@ -1943,6 +1942,23 @@ int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid);
  */
 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
 
+/**
+ * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
+ * @brief Informs whether rfcomm server uuid is available or not.
+ *
+ * This function is a synchronous call.
+ *
+ * @return   TRUE  - RFCOMM uuid is available \n
+ *              FALSE - RFCOMM uuid is not available \n
+ *
+ * @param[in]  uuid UUID string
+ *
+ * @exception   None
+ *
+ * @remark       None
+ */
+gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
+
 /**
  * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address,
  *                                                                     const char *remote_uuid)
@@ -2087,6 +2103,21 @@ int bluetooth_rfcomm_disconnect(int socket_fd);
  */
 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
 
+/**
+ * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
+ * @brief Informs whether rfcomm client is connected.
+ *
+ * This function is a synchronous call.
+ *
+ * @return   TRUE  - RFCOMM client is connected \n
+ *              FALSE - RFCOMM client is not connected \n
+ *
+ * @exception   None
+ *
+ * @remark       None
+ */
+gboolean bluetooth_rfcomm_is_client_connected(void);
+
 /**
  * @fn int bluetooth_network_activate_server(void)
  * @brief Activate the NAP (Network Access Point) service
@@ -2407,12 +2438,13 @@ gboolean bluetooth_opc_session_is_exist(void);
   *             BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
  *
  * @exception   None
- *
+ * @param[in]  dst_path   OPS destination file path.
  * @remark       None
  * @see          bluetooth_obex_server_deinit
  */
 int bluetooth_obex_server_init(char *dst_path);
 
+
 /**
  * @fn int bluetooth_obex_server_deinit(void)
  * @brief Deinitialize OPP and FTP server.
@@ -2425,8 +2457,7 @@ int bluetooth_obex_server_init(char *dst_path);
  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
  *
  * @exception   None
- * @param[in]  dst_path   OPS destination file path.
-
+ *
  * @remark       None
  * @see          bluetooth_obex_server_init
  */
@@ -2561,81 +2592,24 @@ int bluetooth_obex_server_cancel_transfer(int transfer_id);
 
 
 /**
- * @fn int bluetooth_oob_read_local_data(void)
+ * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
  * @brief Read the local Hash and Randmizer.
  *
- * This function is a asynchronous call.
+ * This function is a synchronous call.
  *
  * @return   BLUETOOTH_ERROR_NONE  - Success \n
  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
  *
  * @exception  None
  * @param[in]  None.
- * @param[out]
+ * @param[out] local_oob_data - Pointer to the local OOB data
  *
  * @remark       None
  * @see         None
- @code
-void bt_event_callback(int event, bluetooth_event_param_t *param)
-{
-       switch(event)
-       {
-               case BLUETOOTH_EVENT_READ_LOCAL_OOB_DATA:
-               {
-                       if (param->result != BLUETOOTH_ERROR_NONE)  {
-                               printf("BLUETOOTH_EVENT_READ_LOCAL_OOB_DATA -BLUETOOTH_ERROR ");
-                               break;
-                       }
-
-                printf("BLUETOOTH_EVENT_READ_LOCAL_OOB_DATA - BLUETOOTH_ERROR_NONE");
-                memcpy(&g_local_oob_data.oob_data,
-                        (bt_oob_data_t *)param->param_data,
-                        sizeof(bt_oob_data_t));
-
-                printf("hash = [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
-                        "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]\n",
-                        g_local_oob_data.oob_data.hash[0],
-                        g_local_oob_data.oob_data.hash[1],
-                        g_local_oob_data.oob_data.hash[2],
-                        g_local_oob_data.oob_data.hash[3],
-                        g_local_oob_data.oob_data.hash[4],
-                        g_local_oob_data.oob_data.hash[5],
-                        g_local_oob_data.oob_data.hash[6],
-                        g_local_oob_data.oob_data.hash[7],
-                        g_local_oob_data.oob_data.hash[8],
-                        g_local_oob_data.oob_data.hash[9],
-                        g_local_oob_data.oob_data.hash[10],
-                        g_local_oob_data.oob_data.hash[11],
-                        g_local_oob_data.oob_data.hash[12],
-                        g_local_oob_data.oob_data.hash[13],
-                        g_local_oob_data.oob_data.hash[14],
-                        g_local_oob_data.oob_data.hash[15]);
-
-                printf("randomizer = [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X"
-                        "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]\n",
-                        g_local_oob_data.oob_data.randomizer[0],
-                        g_local_oob_data.oob_data.randomizer[1],
-                        g_local_oob_data.oob_data.randomizer[2],
-                        g_local_oob_data.oob_data.randomizer[3],
-                        g_local_oob_data.oob_data.randomizer[4],
-                        g_local_oob_data.oob_data.randomizer[5],
-                        g_local_oob_data.oob_data.randomizer[6],
-                        g_local_oob_data.oob_data.randomizer[7],
-                        g_local_oob_data.oob_data.randomizer[8],
-                        g_local_oob_data.oob_data.randomizer[9],
-                        g_local_oob_data.oob_data.randomizer[10],
-                        g_local_oob_data.oob_data.randomizer[11],
-                        g_local_oob_data.oob_data.randomizer[12],
-                        g_local_oob_data.oob_data.randomizer[13],
-                        g_local_oob_data.oob_data.randomizer[14],
-                        g_local_oob_data.oob_data.randomizer[15]);
-               }
-       }
-}
- @endcode
  */
 
-int bluetooth_oob_read_local_data(void);
+int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
+
 
 /**
  * @fn int bluetooth_oob_add_remote_data(
index 7ac32d554c45857c0ce0233d87b1654bc13e4bc3..92eac5e16a78ec6200d63581a96bab693bb000b9 100644 (file)
@@ -51,7 +51,6 @@ BT_EXPORT_API int bluetooth_check_adapter(void)
 
 void _bluetooth_internal_enabled_cb(void)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
 
        bt_internal_info = _bluetooth_internal_get_information();
@@ -73,19 +72,14 @@ void _bluetooth_internal_enabled_cb(void)
        if (bluetooth_set_local_name(&bt_internal_info->bt_local_name) < 0)
                ERR("init name setting failed");
 
-       bt_event.event = BLUETOOTH_EVENT_ENABLED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = NULL;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_ENABLED,
+                                         BLUETOOTH_ERROR_NONE, NULL);
 
        return;
 }
 
 void _bluetooth_internal_disabled_cb(void)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
 
        bt_internal_info = _bluetooth_internal_get_information();
@@ -94,40 +88,31 @@ void _bluetooth_internal_disabled_cb(void)
                bt_internal_info->bt_change_state_timer = 0;
        }
 
-       bt_event.event = BLUETOOTH_EVENT_DISABLED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = NULL;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_DISABLED,
+                                         BLUETOOTH_ERROR_NONE, NULL);
        return;
 }
 
 static int __bluetooth_internal_change_status_timeout_cb(void *data)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
+       int event = BLUETOOTH_EVENT_NONE;
 
        bt_internal_info = _bluetooth_internal_get_information();
        bt_internal_info->bt_change_state_timer = 0;
 
        if (bt_internal_info->bt_adapter_state == BLUETOOTH_ADAPTER_CHANGING_ENABLE) {
-               bt_event.event = BLUETOOTH_EVENT_ENABLED;
+               event = BLUETOOTH_EVENT_ENABLED;
                bt_internal_info->bt_adapter_state = BLUETOOTH_ADAPTER_DISABLED;
        } else if (bt_internal_info->bt_adapter_state == BLUETOOTH_ADAPTER_CHANGING_DISABLE) {
-               bt_event.event = BLUETOOTH_EVENT_DISABLED;
+               event = BLUETOOTH_EVENT_DISABLED;
                bt_internal_info->bt_adapter_state = BLUETOOTH_ADAPTER_ENABLED;
        } else {
                ERR("Wrong adapter state [%d]", bt_internal_info->bt_adapter_state);
                return 0;
        }
 
-       bt_event.result = BLUETOOTH_ERROR_TIMEOUT;
-       bt_event.param_data = NULL;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
+       _bluetooth_internal_event_cb(event, BLUETOOTH_ERROR_TIMEOUT, NULL);
 
        return 0;
 }
@@ -136,8 +121,8 @@ static void __bluetooth_internal_change_state_req_finish_cb(DBusGProxy *proxy, D
                                                          gpointer user_data)
 {
        GError *err = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
+       int event = BLUETOOTH_EVENT_NONE;
 
        DBG("+");
 
@@ -155,22 +140,17 @@ static void __bluetooth_internal_change_state_req_finish_cb(DBusGProxy *proxy, D
                }
 
                if (bt_internal_info->bt_adapter_state == BLUETOOTH_ADAPTER_CHANGING_ENABLE) {
-                       bt_event.event = BLUETOOTH_EVENT_ENABLED;
+                       event = BLUETOOTH_EVENT_ENABLED;
                        bt_internal_info->bt_adapter_state = BLUETOOTH_ADAPTER_DISABLED;
                } else if (bt_internal_info->bt_adapter_state == BLUETOOTH_ADAPTER_CHANGING_DISABLE) {
-                       bt_event.event = BLUETOOTH_EVENT_DISABLED;
+                       event = BLUETOOTH_EVENT_DISABLED;
                        bt_internal_info->bt_adapter_state = BLUETOOTH_ADAPTER_ENABLED;
                } else {
                        ERR("Wrong adapter state [%d]", bt_internal_info->bt_adapter_state);
                        return;
                }
 
-               bt_event.result = BLUETOOTH_ERROR_CANCEL_BY_USER;
-               bt_event.param_data = NULL;
-               if (bt_internal_info->bt_cb_ptr) {
-                       bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                                   bt_internal_info->user_data);
-               }
+               _bluetooth_internal_event_cb(event, BLUETOOTH_ERROR_CANCEL_BY_USER, NULL);
 
                return;
        }
@@ -298,9 +278,6 @@ BT_EXPORT_API int bluetooth_get_local_address(bluetooth_device_address_t *local_
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
@@ -340,9 +317,6 @@ BT_EXPORT_API int bluetooth_get_local_name(bluetooth_device_name_t *local_name)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
                DBG("Currently not enabled");
                return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
@@ -378,7 +352,6 @@ BT_EXPORT_API int bluetooth_get_local_name(bluetooth_device_name_t *local_name)
 
 void _bluetooth_internal_adapter_name_changed_cb(void)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
        bluetooth_device_name_t changed_name = { {0} };
 
@@ -387,12 +360,8 @@ void _bluetooth_internal_adapter_name_changed_cb(void)
        memcpy(&changed_name, &bt_internal_info->bt_local_name, sizeof(bluetooth_device_name_t));
        changed_name.name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX] = '\0';
 
-       bt_event.event = BLUETOOTH_EVENT_LOCAL_NAME_CHANGED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = &changed_name;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_LOCAL_NAME_CHANGED,
+                               BLUETOOTH_ERROR_NONE, &changed_name);
 
        return;
 }
@@ -423,9 +392,6 @@ BT_EXPORT_API int bluetooth_set_local_name(const bluetooth_device_name_t *local_
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (!g_utf8_validate(local_name->name, -1, (const char **)&ptr))
                *ptr = '\0';
 
@@ -468,9 +434,6 @@ BT_EXPORT_API int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
                DBG("Currently not enabled");
                return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
@@ -520,9 +483,6 @@ BT_EXPORT_API int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
                DBG("Currently not enabled");
                return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
@@ -547,10 +507,6 @@ BT_EXPORT_API int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t
        case BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE:
                inq_scan = TRUE;
                pg_scan = TRUE;
-
-               if (bt_internal_info->agent_proxy == NULL)
-                       break;
-
                break;
        default:
                return BLUETOOTH_ERROR_INVALID_PARAM;
@@ -558,11 +514,11 @@ BT_EXPORT_API int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t
 
        }
 
-       /* Set the discoverable timeout value in agent */
-       dbus_g_proxy_call_no_reply(bt_internal_info->agent_proxy,
-                                  "SetDiscoverableTimer",
-                                  G_TYPE_UINT, timeout,
-                                  G_TYPE_INVALID);
+       /* Set discoverable Timer in agent */
+       dbus_g_proxy_call_no_reply(bt_internal_info->agent_proxy, "SetDiscoverableTimer",
+                       G_TYPE_UINT, timeout,
+                       G_TYPE_INVALID,
+                       G_TYPE_INVALID);
 
        g_value_set_boolean(&connectable, pg_scan);
        g_value_set_boolean(&discoverable, inq_scan);
@@ -608,7 +564,6 @@ BT_EXPORT_API int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t
 
 void _bluetooth_internal_discovery_started_cb(void)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
 
        bt_internal_info = _bluetooth_internal_get_information();
@@ -619,20 +574,14 @@ void _bluetooth_internal_discovery_started_cb(void)
                bt_internal_info->is_discovery_req = 1;
        }
 
-       bt_event.event = BLUETOOTH_EVENT_DISCOVERY_STARTED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = NULL;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_DISCOVERY_STARTED,
+                                       BLUETOOTH_ERROR_NONE, NULL);
        return;
 }
 
 void _bluetooth_internal_remote_device_found_cb(const char *address,
                                               int rssi, unsigned int remote_class, gboolean paired)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
        bluetooth_device_info_t dev_info = { { { 0 } } };
 
@@ -643,13 +592,8 @@ void _bluetooth_internal_remote_device_found_cb(const char *address,
        dev_info.rssi = rssi;
        dev_info.paired = paired;
 
-       bt_event.event = BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = &dev_info;
-       if (bt_internal_info->bt_cb_ptr && bt_internal_info->is_discovery_req) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND,
+                                       BLUETOOTH_ERROR_NONE, &dev_info);
        return;
 }
 
@@ -718,7 +662,6 @@ void _bluetooth_internal_remote_device_name_updated_cb(const char *address,
                                                      const char *name, int rssi,
                                                      unsigned int remote_class, gboolean paired)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
        bluetooth_device_info_t dev_info = { { { 0 } } };
 
@@ -738,35 +681,26 @@ void _bluetooth_internal_remote_device_name_updated_cb(const char *address,
        dev_info.rssi = rssi;
        dev_info.paired = paired;
 
-       bt_event.event = BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = &dev_info;
-       if (bt_internal_info->bt_cb_ptr && bt_internal_info->is_discovery_req) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,
+                                       BLUETOOTH_ERROR_NONE, &dev_info);
        return;
 }
 
 void _bluetooth_internal_discovery_completed_cb(void)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
+       int result = BLUETOOTH_ERROR_NONE;
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       bt_event.event = BLUETOOTH_EVENT_DISCOVERY_FINISHED;
        if (bt_internal_info->is_discovery_cancel) {
-               bt_event.result = BLUETOOTH_ERROR_CANCEL_BY_USER;
+               result = BLUETOOTH_ERROR_CANCEL_BY_USER;
                bt_internal_info->is_discovery_cancel = FALSE;
-       } else {
-               bt_event.result = BLUETOOTH_ERROR_NONE;
-       }
-       bt_event.param_data = NULL;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
        }
 
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_DISCOVERY_FINISHED,
+                                       result, NULL);
+
        bt_internal_info->is_discovery_req = 0;
 
        return;
@@ -774,7 +708,6 @@ void _bluetooth_internal_discovery_completed_cb(void)
 
 static int __bluetooth_internal_discovery_req_timeout_cb(void *data)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
 
        bt_internal_info = _bluetooth_internal_get_information();
@@ -785,12 +718,8 @@ static int __bluetooth_internal_discovery_req_timeout_cb(void *data)
        dbus_g_proxy_call_no_reply(bt_internal_info->adapter_proxy, "StopDiscovery",
                                   G_TYPE_INVALID, G_TYPE_INVALID);
 
-       bt_event.event = BLUETOOTH_EVENT_DISCOVERY_STARTED;
-       bt_event.result = BLUETOOTH_ERROR_TIMEOUT;
-       bt_event.param_data = NULL;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_DISCOVERY_STARTED,
+                                       BLUETOOTH_ERROR_TIMEOUT, NULL);
 
        return 0;
 }
@@ -830,9 +759,6 @@ BT_EXPORT_API int bluetooth_start_discovery(unsigned short max_response,
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
@@ -861,6 +787,8 @@ BT_EXPORT_API int bluetooth_cancel_discovery(void)
        GError *error = NULL;
        int ret = BLUETOOTH_ERROR_NONE;
 
+       DBG("+");
+
        _bluetooth_internal_session_init();
 
        if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
@@ -870,11 +798,9 @@ BT_EXPORT_API int bluetooth_cancel_discovery(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
-       if (bt_internal_info->adapter_proxy == NULL)
+       if (bt_internal_info->adapter_proxy == NULL) {
                return BLUETOOTH_ERROR_INTERNAL;
+       }
 
        dbus_g_proxy_call(bt_internal_info->adapter_proxy, "StopDiscovery", &error,
                          G_TYPE_INVALID, G_TYPE_INVALID);
@@ -894,6 +820,8 @@ BT_EXPORT_API int bluetooth_cancel_discovery(void)
 
        bt_internal_info->is_discovery_cancel = TRUE;
 
+       DBG("-");
+
        return BLUETOOTH_ERROR_NONE;
 }
 
@@ -913,9 +841,6 @@ BT_EXPORT_API int bluetooth_is_discovering(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy != NULL) {
                dbus_g_proxy_call(bt_internal_info->adapter_proxy, "GetProperties", NULL,
                                  G_TYPE_INVALID,
@@ -1000,7 +925,6 @@ static void __bluetooth_internal_bonding_req_reply_cb(int error_type,
                                                    const bluetooth_device_info_t *device_info,
                                                    int is_headset)
 {
-       bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
        bluetooth_device_address_t device_address = { {0} };
 
@@ -1021,8 +945,8 @@ static void __bluetooth_internal_bonding_req_reply_cb(int error_type,
                DBG("error_type: %d", error_type);
 
                /* Add the codes about auto-headset pairing */
-               if (error_type == BLUETOOTH_ERROR_AUTHENTICATION_FAILED
-                   && bt_internal_info->is_headset_pin_req == FALSE) {
+               if (error_type == BLUETOOTH_ERROR_AUTHENTICATION_FAILED &&
+                       bt_internal_info->is_headset_pin_req == FALSE) {
                        if (is_headset) {
                                dbus_g_proxy_call_no_reply(bt_internal_info->agent_proxy,
                                                           "IgnoreAutoPairing", G_TYPE_STRING,
@@ -1049,13 +973,8 @@ static void __bluetooth_internal_bonding_req_reply_cb(int error_type,
        bt_internal_info->is_headset_bonding = FALSE;
        memset(bt_internal_info->bt_bonding_req_addrstr, 0x00, 18);
 
-       bt_event.event = BLUETOOTH_EVENT_BONDING_FINISHED;
-       bt_event.result = error_type;
-       bt_event.param_data = (void *)device_info;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_BONDING_FINISHED,
+                                       error_type, (void *)device_info);
        DBG("-");
 }
 
@@ -1142,6 +1061,7 @@ static void __bluetooth_internal_bonding_req_finish_cb(DBusGProxy *proxy, DBusGP
        GHashTable *hash = NULL;
        GValue *value = NULL;
        DBusGProxy *device_proxy = NULL;
+       char address[BT_ADDRESS_STRING_SIZE] = { 0 };
 
        DBG("+");
 
@@ -1250,6 +1170,21 @@ static void __bluetooth_internal_bonding_req_finish_cb(DBusGProxy *proxy, DBusGP
 
                if (err != NULL)
                        g_error_free(err);
+       } else {
+               dbus_g_proxy_call(bt_internal_info->adapter_proxy, "FindDevice", NULL,
+                                 G_TYPE_STRING, bt_internal_info->bt_bonding_req_addrstr,
+                                 G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, &device_path,
+                                 G_TYPE_INVALID);
+               if (!device_path) {
+                       DBG("device_path is NULL");
+               }
+
+               _bluetooth_internal_device_path_to_address(device_path, address);
+
+               device_proxy = _bluetooth_internal_find_device_by_path(device_path);
+
+               _bluetooth_internal_bonding_created_cb(address,
+                                               (gpointer)device_proxy);
        }
 
        DBG("-");
@@ -1264,73 +1199,18 @@ static int __bluetooth_internal_bonding_req_timeout_cb(void *data)
        return 0;
 }
 
-static void __bluetooth_oob_read_local_data_cb(DBusPendingCall *call, void *user_data)
+BT_EXPORT_API int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
 {
-       DBusError err;
+       DBG("+\n");
+       DBusMessage *msg = NULL;
        DBusMessage *reply = NULL;
-       unsigned char *hash = NULL;
-       unsigned char *randomizer = NULL;
-       unsigned int hash_len;
-       unsigned int randomizer_len;
-
-       bluetooth_event_param_t bt_event = {0,};
+       DBusError err;
+       unsigned char *local_hash = NULL;
+       unsigned char *local_randomizer = NULL;
        bt_info_t *bt_internal_info = NULL;
-       bt_oob_data_t local_oob_data = {{0},};
 
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       reply = dbus_pending_call_steal_reply(call);
-
-       dbus_error_init(&err);
-       if (dbus_set_error_from_message(&err, reply)) {
-               DBG("ReadLocalData - error: %s, %s",
-                       err.name, err.message);
-               dbus_error_free(&err);
-               bt_event.result = BLUETOOTH_ERROR_INTERNAL;
-               goto done;
-       }
-
-       if (dbus_message_get_args(reply, &err,
-                       DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
-                       &hash, &hash_len,
-                       DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
-                       &randomizer, &randomizer_len,
-                       DBUS_TYPE_INVALID) == FALSE) {
-               DBG("unable to parse get_radio_states reply: %s, %s",
-                       err.name, err.message);
-               dbus_error_free(&err);
-               bt_event.result = BLUETOOTH_ERROR_INVALID_DATA;
-               goto done;
-       }
-
-       if (NULL != hash && hash_len != 0) {
-               memcpy(&local_oob_data.hash, hash, hash_len);
-               local_oob_data.hash_len = hash_len;
-       }
-
-       if (NULL != randomizer && randomizer_len != 0) {
-               memcpy(&local_oob_data.randomizer, randomizer, randomizer_len);
-               local_oob_data.randomizer_len = randomizer_len;
-       }
-
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-
-done:
-       bt_event.event = BLUETOOTH_EVENT_READ_LOCAL_OOB_DATA;
-       bt_event.param_data = (void *)&local_oob_data;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                        bt_internal_info->user_data);
-       }
-       dbus_message_unref(reply);
-}
-
-BT_EXPORT_API int bluetooth_oob_read_local_data(void)
-{
-       DBG("+\n");
-       bt_info_t *bt_internal_info = NULL;
-       DBusMessage *msg = NULL;
-       DBusPendingCall *call;
+       if (NULL == local_oob_data)
+               return BLUETOOTH_ERROR_INVALID_PARAM;
 
        bt_internal_info = _bluetooth_internal_get_information();
 
@@ -1348,18 +1228,39 @@ BT_EXPORT_API int bluetooth_oob_read_local_data(void)
        if(msg == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
-       if (!dbus_connection_send_with_reply(bt_internal_info->sys_conn, msg,
-                       &call, -1)) {
+       dbus_error_init(&err);
+       reply = dbus_connection_send_with_reply_and_block(bt_internal_info->sys_conn,
+                                       msg, -1, &err);
+
+       dbus_message_unref(msg);
+       if (!reply) {
                DBG("Error in ReadLocalData \n");
-               dbus_message_unref(msg);
+               if (dbus_error_is_set(&err)) {
+                       DBG("%s", err.message);
+                       dbus_error_free(&err);
+               }
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
-       dbus_pending_call_set_notify(call, __bluetooth_oob_read_local_data_cb,
-                                       NULL, NULL);
-       dbus_pending_call_unref(call);
-       dbus_message_unref(msg);
+       if (!dbus_message_get_args(reply, NULL,
+                       DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+                       &local_hash, &local_oob_data->hash_len,
+                       DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+                       &local_randomizer, &local_oob_data->randomizer_len,
+                       DBUS_TYPE_INVALID)) {
+               DBG("Error in reading arguments\n");
+               dbus_message_unref(reply);
+               return BLUETOOTH_ERROR_INVALID_DATA;
+       }
+
+       if (NULL != local_hash)
+               memcpy(local_oob_data->hash, local_hash, local_oob_data->hash_len);
+
+       if (NULL != local_randomizer)
+               memcpy(local_oob_data->randomizer, local_randomizer,
+                                       local_oob_data->randomizer_len);
 
+       dbus_message_unref(reply);
        DBG("-\n");
 
        return BLUETOOTH_ERROR_NONE;
@@ -1611,22 +1512,15 @@ BT_EXPORT_API int bluetooth_cancel_bonding(void)
 
 void _bluetooth_internal_bonding_removed_cb(const char *bond_address, gpointer user_data)
 {
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
        bluetooth_device_address_t device_address = { {0} };
 
        DBG("+ Bonding Removed from [%s]\n", bond_address);
 
        _bluetooth_internal_convert_addr_string_to_addr_type(&device_address, bond_address);
 
-       bt_internal_info = _bluetooth_internal_get_information();
 
-       bt_event.event = BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = (void *)&device_address;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,
+                                       BLUETOOTH_ERROR_NONE, &device_address);
 
        DBG("-\n");
 
@@ -1637,8 +1531,6 @@ static void __bluetooth_internal_unbond_request_complete_cb(DBusGProxy *proxy, D
                                                          gpointer user_data)
 {
        GError *err = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
        bluetooth_device_address_t *device_address;
 
        DBG("+\n");
@@ -1647,28 +1539,18 @@ static void __bluetooth_internal_unbond_request_complete_cb(DBusGProxy *proxy, D
 
        device_address = (bluetooth_device_address_t *) user_data;
 
-       bt_internal_info = _bluetooth_internal_get_information();
-
        if (err != NULL) {
                DBG("Error occured in RemoveBonding [%s]\n", err->message);
                g_error_free(err);
 
-               if (bt_internal_info->bt_cb_ptr) {
-                       /* If control reaches here, it is always a debond request failure*/
-                       bt_event.event = BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED;
-                       bt_event.result = BLUETOOTH_ERROR_NOT_PAIRED;
-                       bt_event.param_data = (void *)device_address;
-                       if (bt_internal_info->bt_cb_ptr) {
-                               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                                           bt_internal_info->user_data);
-                       }
-               }
+               /* If control reaches here, it is always a debond request failure*/
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,
+                                               BLUETOOTH_ERROR_NOT_PAIRED, device_address);
        }
+
        /*release user_data which was allocated in caller*/
-       if (device_address != NULL) {
+       if (device_address != NULL)
                free(device_address);
-               device_address = NULL;
-       }
 
        DBG("-\n");
 }
@@ -1871,6 +1753,7 @@ static int bluetooth_internal_get_bonded_device_list(GPtrArray **dev_list)
 {
        DBG("+\n");
        int ret_val = BLUETOOTH_ERROR_NONE;
+       int i;
        bt_info_t *bt_internal_info = NULL;
        GPtrArray *gp_array = NULL;
        GPtrArray *result = NULL;
@@ -1883,9 +1766,6 @@ static int bluetooth_internal_get_bonded_device_list(GPtrArray **dev_list)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
@@ -1893,44 +1773,52 @@ static int bluetooth_internal_get_bonded_device_list(GPtrArray **dev_list)
                                G_TYPE_INVALID,
                                dbus_g_type_get_collection("GPtrArray", DBUS_TYPE_G_OBJECT_PATH),
                                &gp_array, G_TYPE_INVALID);
+       if (error != NULL)
+               goto err_listdev;
 
-       if (error == NULL) {
-               if (gp_array != NULL) {
-                       int i;
-                       if (gp_array->len == 0) {
-                               result->len = 0;
-                       } else {
-                               DBG("Num of ListDevices = [%d]", gp_array->len);
-                               for (i = 0; i < gp_array->len; i++) {
-                                       gchar *gp_path = g_ptr_array_index(gp_array, i);
-                                       if (gp_path != NULL) {
-                                               DBG("Newly list device [%s]\n", gp_path);
-                                               devinfo =
-                                                   (bluetooth_device_info_t *)
-                                                   malloc(sizeof(bluetooth_device_info_t));
-                                               memset(devinfo, 0, sizeof(bluetooth_device_info_t));
-                                               if (__bluetooth_internal_get_bonded_device_list_details(gp_path,
-                                                                       devinfo) == BLUETOOTH_ERROR_NONE) {                                                                             g_ptr_array_add(result, (gpointer) devinfo);
-                                               } else {
-                                                       DBG("Can't get the paired device path \n");
-                                                       free(devinfo);
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
-                       g_ptr_array_free(gp_array, TRUE);
+       if (gp_array == NULL) {
+               DBG("DBus error: \n");
+               goto err_done;
+       }
+
+
+       if (gp_array->len == 0) {
+               result->len = 0;
+               goto success;
+       }
+
+       DBG("Num of ListDevices = [%d]", gp_array->len);
+       for (i = 0; i < gp_array->len; i++) {
+               gchar *gp_path = g_ptr_array_index(gp_array, i);
+
+               if (gp_path == NULL)
+                       continue;
+
+               DBG("Newly list device [%s]\n", gp_path);
+               devinfo = (bluetooth_device_info_t *)malloc(sizeof(*devinfo));
+               memset(devinfo, 0, sizeof(*devinfo));
+               if (__bluetooth_internal_get_bonded_device_list_details(gp_path,
+                                       devinfo) == BLUETOOTH_ERROR_NONE) {
+                       g_ptr_array_add(result, (gpointer)devinfo);
                } else {
-                       DBG("DBus error: \n");
-                       ret_val = BLUETOOTH_ERROR_INTERNAL;
+                       DBG("Can't get the paired device path \n");
+                       free(devinfo);
+                       break;
                }
-       } else {
-               DBG("ListDevices error: [%s]\n", error->message);
-               g_error_free(error);
-               ret_val = BLUETOOTH_ERROR_INTERNAL;
        }
+
+success:
+       g_ptr_array_free(gp_array, TRUE);
        DBG("-\n");
        return ret_val;
+
+err_listdev:
+       DBG("ListDevices error: [%s]\n", error->message);
+       g_error_free(error);
+
+err_done:
+       DBG("-\n");
+       return BLUETOOTH_ERROR_INTERNAL;
 }
 
 BT_EXPORT_API int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
@@ -1970,9 +1858,6 @@ BT_EXPORT_API int bluetooth_get_bonded_device(const bluetooth_device_address_t *
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
@@ -2059,9 +1944,6 @@ BT_EXPORT_API int bluetooth_set_alias(const bluetooth_device_address_t *device_a
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
@@ -2114,9 +1996,6 @@ BT_EXPORT_API int bluetooth_authorize_device(const bluetooth_device_address_t *d
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
index 62a0b073eb9df1aa27abd4582b42cb8724a97dd3..7d26514044193c402682d03b6b35c2a2975acb98 100644 (file)
@@ -29,8 +29,6 @@
 /**********************************************************************
 *              Static Functions declaration                            *
 ***********************************************************************/
-static void __bt_hdp_internal_event_cb(int event, int result, void *param_data);
-
 static int __bt_hdp_internal_create_application(unsigned int data_type,
                                                bool role,
                                                bt_hdp_qos_type_t channel_type);
@@ -75,24 +73,6 @@ static GSList *g_app_list = NULL;
 *                      Health device APIs (HDP)                        *
 ***********************************************************************/
 
-static void __bt_hdp_internal_event_cb(int event, int result, void *param_data)
-{
-       DBG("+");
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-       bt_event.event = event;
-       bt_event.result = result;
-       bt_event.param_data = param_data;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                       bt_internal_info->user_data);
-
-       DBG("-");
-}
-
 BT_EXPORT_API int bluetooth_hdp_activate(unsigned short data_type,
                                        bt_hdp_role_type_t role,
                                        bt_hdp_qos_type_t channel_type)
@@ -105,11 +85,6 @@ BT_EXPORT_API int bluetooth_hdp_activate(unsigned short data_type,
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (bt_internal_info->bt_adapter_state != BLUETOOTH_ADAPTER_ENABLED) {
                DBG("Adapter not enabled");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -135,7 +110,7 @@ static gboolean  __bt_hdp_internal_create_application_cb(gpointer data)
        bt_hdp_activate_t act_cfm;
        act_cfm.app_handle = list->app_handle;
 
-       __bt_hdp_internal_event_cb(BLUETOOTH_EVENT_HDP_ACTIVATED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_ACTIVATED,
                                  BLUETOOTH_ERROR_NONE, &act_cfm);
        DBG(" -\n");
        return FALSE;
@@ -157,11 +132,6 @@ static int __bt_hdp_internal_create_application(unsigned int data_type,
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("Internal info == NULL");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
                                          BLUEZ_HDP_MANAGER_INTERFACE,
                                          "CreateApplication");
@@ -302,8 +272,8 @@ static int __bt_hdp_internal_add_filter(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL || bt_internal_info->conn == NULL) {
-               DBG("Internel info == NULL or Conn == NULL\n");
+       if (bt_internal_info->conn == NULL) {
+               DBG("Internel Conn == NULL\n");
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
@@ -424,7 +394,7 @@ static void __bt_hdp_internal_handle_disconnect(DBusMessage *msg)
                dis_ind.channel_id = list->fd;
                dis_ind.device_address = device_addr;
 
-               __bt_hdp_internal_event_cb(BLUETOOTH_EVENT_HDP_DISCONNECTED,
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DISCONNECTED,
                                          BLUETOOTH_ERROR_NONE, &dis_ind);
 
                close(list->fd);
@@ -499,10 +469,6 @@ static int __bt_hdp_internal_acquire_fd(const char *path)
        int fdd = -1;
 
        bt_internal_info = _bluetooth_internal_get_information();
-       if (bt_internal_info == NULL) {
-               DBG(" HDP:bt_internal_info NULL");
-               return BLUETOOTH_ERROR_INTERNAL;
-       }
 
        msg = dbus_message_new_method_call("org.bluez", path,
                                          BLUEZ_HDP_CHANNEL_INTERFACE,
@@ -654,7 +620,7 @@ static int __bt_hdp_internal_acquire_fd(const char *path)
 
        DBG("Going to give callback\n");
 
-       __bt_hdp_internal_event_cb(BLUETOOTH_EVENT_HDP_CONNECTED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_CONNECTED,
                                  BLUETOOTH_ERROR_NONE, &conn_ind);
 
        dbus_message_unref(reply);
@@ -725,7 +691,7 @@ static gboolean __bt_hdp_internal_data_received(GIOChannel *gio,
 
        data_ind.size = act_read;
 
-       __bt_hdp_internal_event_cb(BLUETOOTH_EVENT_HDP_DATA_RECEIVED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DATA_RECEIVED,
                                          BLUETOOTH_ERROR_NONE, &data_ind);
 
        return TRUE;
@@ -743,11 +709,6 @@ BT_EXPORT_API int bluetooth_hdp_deactivate(const char *app_handle)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (bt_internal_info->bt_adapter_state != BLUETOOTH_ADAPTER_ENABLED) {
                DBG("Adapter not enabled");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -821,7 +782,7 @@ static gboolean  __bt_hdp_internal_destroy_application_cb(gpointer data)
        bt_hdp_deactivate_t deact_cfm;
        hdp_app_list_t *list = NULL;
        deact_cfm.app_handle = (const char *)data;
-       __bt_hdp_internal_event_cb(BLUETOOTH_EVENT_HDP_DEACTIVATED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DEACTIVATED,
                                        BLUETOOTH_ERROR_NONE, &deact_cfm);
 
        list = __bt_hdp_internal_gslist_find_app_handler((void *)deact_cfm.app_handle);
@@ -855,10 +816,6 @@ static int __bt_hdp_internal_destroy_application(const char *app_handle)
        bt_info_t *bt_internal_info = NULL;
 
        bt_internal_info = _bluetooth_internal_get_information();
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
 
        msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
                        BLUEZ_HDP_MANAGER_INTERFACE, "DestroyApplication");
@@ -907,7 +864,7 @@ static void __bt_hdp_internal_remove_filter(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL || bt_internal_info->conn == NULL)
+       if (bt_internal_info->conn == NULL)
                return;
 
        if (g_hdp_dus_conn == NULL) {
@@ -936,11 +893,6 @@ BT_EXPORT_API int bluetooth_hdp_send_data(unsigned int channel_id,
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (bt_internal_info->bt_adapter_state != BLUETOOTH_ADAPTER_ENABLED) {
                DBG("Adapter not enabled");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -982,11 +934,6 @@ BT_EXPORT_API int bluetooth_hdp_connect(const char *app_handle,
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (bt_internal_info->bt_adapter_state != BLUETOOTH_ADAPTER_ENABLED) {
                DBG("Adapter not enabled");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -1094,11 +1041,6 @@ BT_EXPORT_API int bluetooth_hdp_disconnect(unsigned int channel_id,
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (bt_internal_info->bt_adapter_state != BLUETOOTH_ADAPTER_ENABLED) {
                DBG("Adapter not enabled");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
index 021d18fb0b49efcfe22a7a66c35a17229f6dd531..262849fc4a7796cbce8b368a1a5222a9c3d2b40e 100644 (file)
@@ -40,8 +40,6 @@ static void __bluetooth_network_server_connected(DBusGProxy *proxy, const char *
                                               const char *address, gpointer user_data);
 static void __bluetooth_network_server_disconnected(DBusGProxy *proxy, const char *device,
                                                  const char *address, gpointer user_data);
-static void __bluetooth_network_connection_changed_cb(gboolean connected,
-                                                   const bluetooth_device_address_t *device_addr);
 static DBusHandlerResult __bluetooth_network_event_filter(DBusConnection *sys_conn,
                                                        DBusMessage *msg, void *data);
 
@@ -156,8 +154,7 @@ static void __bluetooth_network_activate_request_cb(DBusGProxy *proxy, DBusGProx
                                                  gpointer user_data)
 {
        GError *g_error = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
+       int result = BLUETOOTH_ERROR_NONE;
        DBusGConnection *conn = NULL;
 
        conn = (DBusGConnection *) user_data;
@@ -170,26 +167,21 @@ static void __bluetooth_network_activate_request_cb(DBusGProxy *proxy, DBusGProx
        if (g_error != NULL) {
                DBG("Network server register Dbus Call Error: %s\n", g_error->message);
                g_error_free(g_error);
-               bt_event.result = BLUETOOTH_ERROR_INTERNAL;
+               result = BLUETOOTH_ERROR_INTERNAL;
        } else {
                DBG("Network server register Dbus Call is done\n");
-               bt_event.result = BLUETOOTH_ERROR_NONE;
        }
 
-       bt_event.event = BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED;
-
-       bt_internal_info = _bluetooth_internal_get_information();
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED,
+                                       result, NULL);
 
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
 }
 
 static void __bluetooth_network_deactivate_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
                                                    gpointer user_data)
 {
        GError *g_error = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
+       int result = BLUETOOTH_ERROR_NONE;
        DBusGConnection *conn = NULL;
 
        conn = (DBusGConnection *) user_data;
@@ -202,18 +194,14 @@ static void __bluetooth_network_deactivate_request_cb(DBusGProxy *proxy, DBusGPr
        if (g_error != NULL) {
                DBG("Network server unregister Dbus Call Error: %s\n", g_error->message);
                g_error_free(g_error);
-               bt_event.result = BLUETOOTH_ERROR_INTERNAL;
+               result = BLUETOOTH_ERROR_INTERNAL;
        } else {
                DBG("Network server unregister Dbus Call is done\n");
-               bt_event.result = BLUETOOTH_ERROR_NONE;
        }
 
-       bt_event.event = BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED;
-
-       bt_internal_info = _bluetooth_internal_get_information();
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED,
+                                       result, NULL);
 
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
 }
 
 void _bluetooth_network_server_add_signal(void)
@@ -224,7 +212,7 @@ void _bluetooth_network_server_add_signal(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL || bt_internal_info->conn == NULL)
+       if (bt_internal_info->conn == NULL)
                return;
 
        if (strlen(bt_internal_info->adapter_path) <= 0)
@@ -261,9 +249,6 @@ void _bluetooth_network_server_remove_signal(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return;
-
        if (bt_internal_info->network_server_proxy == NULL) {
                DBG("No network proxy exist");
                return;
@@ -287,29 +272,19 @@ static void __bluetooth_network_server_connected(DBusGProxy *proxy,
                                               const char *device, const char *address,
                                               gpointer user_data)
 {
-       bluetooth_event_param_t bt_event = { 0, };
-       bluetooth_network_device_info_t device_info = {{{0}}};
-       bt_info_t *bt_internal_info = NULL;
        DBG("+");
-
+       bluetooth_network_device_info_t device_info = {{{0}}};
        if (device == NULL || address == NULL)
                return;
 
-       DBG("device[%s]", device);
-       DBG("address[%s]", address);
+       DBG("device[%s], address[%s] ", device, address);
 
        _bluetooth_internal_convert_addr_string_to_addr_type(&device_info.device_address, address);
 
        memcpy(device_info.interface_name, device, BLUETOOTH_INTERFACE_NAME_LENGTH);
 
-       bt_event.event = BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED;
-       bt_event.param_data = (void *)&device_info;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED,
+                                       BLUETOOTH_ERROR_NONE, &device_info);
        DBG("-");
 }
 
@@ -317,29 +292,19 @@ static void __bluetooth_network_server_disconnected(DBusGProxy *proxy,
                                                  const char *device, const char *address,
                                                  gpointer user_data)
 {
-       bluetooth_event_param_t bt_event = { 0, };
-       bluetooth_network_device_info_t device_info = {{{0}}};
-       bt_info_t *bt_internal_info = NULL;
-
        DBG("+");
-
+       bluetooth_network_device_info_t device_info = {{{0}}};
        if (device == NULL || address == NULL)
                return;
 
-       DBG("device[%s]", device);
-       DBG("address[%s]", address);
+       DBG("device[%s], address[%s] ", device, address);
 
        _bluetooth_internal_convert_addr_string_to_addr_type(&device_info.device_address, address);
 
        memcpy(device_info.interface_name, device, BLUETOOTH_INTERFACE_NAME_LENGTH);
 
-       bt_event.event = BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED;
-       bt_event.param_data = (void *)&device_info;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED,
+                                       BLUETOOTH_ERROR_NONE, &device_info);
 
        DBG("-");
 }
@@ -520,10 +485,9 @@ static void __bluetooth_network_connect_request_cb(DBusGProxy *proxy, DBusGProxy
                                                 gpointer user_data)
 {
        GError *g_error = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
        char *device = NULL;
        DBusGConnection *conn = NULL;
+       int result = BLUETOOTH_ERROR_NONE;
 
        conn = (DBusGConnection *) user_data;
 
@@ -535,27 +499,22 @@ static void __bluetooth_network_connect_request_cb(DBusGProxy *proxy, DBusGProxy
        if (g_error != NULL) {
                DBG("Network Client connection  Dbus Call Error: %s\n", g_error->message);
                g_error_free(g_error);
-               bt_event.result = BLUETOOTH_ERROR_INTERNAL;
+               result = BLUETOOTH_ERROR_INTERNAL;
        } else {
                DBG("Network Client connection Dbus Call is done %s\n", device);
-               bt_event.result = BLUETOOTH_ERROR_NONE;
        }
 
-       bt_event.event = BLUETOOTH_EVENT_NETWORK_CONNECTED;
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_CONNECTED,
+                                       result, NULL);
 
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
 }
 
 static void __bluetooth_network_disconnect_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
                                                    gpointer user_data)
 {
        GError *g_error = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
        DBusGConnection *conn = NULL;
+       int result = BLUETOOTH_ERROR_NONE;
 
        conn = (DBusGConnection *) user_data;
 
@@ -567,18 +526,14 @@ static void __bluetooth_network_disconnect_request_cb(DBusGProxy *proxy, DBusGPr
        if (g_error != NULL) {
                DBG("Network Client disconnection Dbus Call Error: %s\n", g_error->message);
                g_error_free(g_error);
-               bt_event.result = BLUETOOTH_ERROR_INTERNAL;
+               result = BLUETOOTH_ERROR_INTERNAL;
        } else {
                DBG("Network Client disconnection Dbus Call is done\n");
-               bt_event.result = BLUETOOTH_ERROR_NONE;
        }
 
-       bt_event.event = BLUETOOTH_EVENT_NETWORK_DISCONNECTED;
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_DISCONNECTED,
+                                       result, NULL);
 
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
 }
 
 void _bluetooth_network_client_add_filter(void)
@@ -590,7 +545,7 @@ void _bluetooth_network_client_add_filter(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL || bt_internal_info->conn == NULL)
+       if (bt_internal_info->conn == NULL)
                return;
 
        if (bt_internal_info->sys_conn) {
@@ -643,27 +598,6 @@ void _bluetooth_network_client_remove_filter(void)
        DBG("-\n");
 }
 
-static void __bluetooth_network_connection_changed_cb(gboolean connected,
-                                                   const bluetooth_device_address_t *device_addr)
-{
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-
-       DBG("+");
-
-       bt_event.event =
-           connected ? BLUETOOTH_EVENT_NETWORK_CONNECTED : BLUETOOTH_EVENT_NETWORK_DISCONNECTED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = (void *)device_addr;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-
-       DBG("-");
-}
-
 static DBusHandlerResult __bluetooth_network_event_filter(DBusConnection *sys_conn,
                                                        DBusMessage *msg, void *data)
 {
@@ -707,8 +641,9 @@ static DBusHandlerResult __bluetooth_network_event_filter(DBusConnection *sys_co
 
                _bluetooth_internal_device_path_to_address(path, address);
                _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr, address);
-
-               __bluetooth_network_connection_changed_cb(connected, &device_addr);
+               _bluetooth_internal_event_cb(connected ? BLUETOOTH_EVENT_NETWORK_CONNECTED :
+                                               BLUETOOTH_EVENT_NETWORK_DISCONNECTED,
+                                               BLUETOOTH_ERROR_NONE, &device_addr);
        } else if (!strcmp(property, "Interface")) {
                const gchar *device = NULL;
 
index 64c60c8b29e43a54956640a261c3c8cb0a579932..dde53910fd2f675cf2d937cd2b179ac7bed99f8e 100644 (file)
@@ -60,24 +60,6 @@ static void __bt_transfer_progress_cb(DBusGProxy *object,
                                        gint transferred,
                                        gpointer user_data);
 
-static void __bt_ops_internal_event_cb(int event, int result, void *param_data)
-{
-       DBG("+");
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-       bt_event.event = event;
-       bt_event.result = result;
-       bt_event.param_data = param_data;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                       bt_internal_info->user_data);
-
-       DBG("-");
-}
-
 static GQuark __bt_obex_agent_error_quark(void)
 {
        static GQuark quark = 0;
@@ -93,11 +75,55 @@ static GError *__bt_obex_agent_error(bt_obex_agent_error_t error,
        return g_error_new(BT_OBEX_AGENT_ERROR, error, err_msg);
 }
 
+static void __bt_send_deinit_message(void)
+{
+       DBG("+");
+
+       DBusMessage *msg = NULL;
+       DBusGConnection *conn = NULL;
+       DBusConnection *connecton = NULL;
+
+       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (conn == NULL) {
+               DBG("conn is NULL");
+               return;
+       }
+
+       connecton = dbus_g_connection_get_connection(conn);
+
+       msg = dbus_message_new_signal(BT_FRWK_OBJECT,
+                                     BT_FRWK_INTERFACE,
+                                     BT_FRWK_SIGNAL_DEINIT);
+
+       if (msg == NULL) {
+               DBG("Unable to allocate D-Bus signal");
+               return;
+       }
+
+       if (!dbus_message_append_args(msg,
+                                     DBUS_TYPE_INVALID,
+                                     DBUS_TYPE_INVALID)) {
+               DBG("Deinit sending failed");
+               dbus_message_unref(msg);
+               dbus_g_connection_unref(conn);
+               return;
+       }
+
+       dbus_connection_send(connecton, msg, NULL);
+       dbus_message_unref(msg);
+       dbus_g_connection_unref(conn);
+
+       DBG("-");
+
+       return;
+}
+
 BT_EXPORT_API int bluetooth_obex_server_init(char *dst_path)
 {
        DBG("+\n");
 
-       bt_info_t *bt_internal_info = NULL;
+       int ret = BLUETOOTH_ERROR_NONE;
+       DBusGConnection *conn = NULL;
 
        _bluetooth_internal_session_init();
 
@@ -106,13 +132,6 @@ BT_EXPORT_API int bluetooth_obex_server_init(char *dst_path)
                return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
        }
 
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (g_obex_server_info.obex_server_agent) {
                DBG("Agent already registered");
                return BLUETOOTH_ERROR_AGENT_ALREADY_EXIST;
@@ -123,11 +142,30 @@ BT_EXPORT_API int bluetooth_obex_server_init(char *dst_path)
                return BLUETOOTH_ERROR_INVALID_PARAM;
        }
 
+       /* Get the session bus. This bus reff will be unref during deinit */
+       conn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+
+       if (conn == NULL) {
+               DBG("conn is NULL\n");
+               return BLUETOOTH_ERROR_NO_RESOURCES;
+       }
+
+       /* Send deinit signal (To deinit the native Obex server) */
+       __bt_send_deinit_message();
+
        g_dst_path = g_strdup(dst_path);
 
+       ret = __bt_obex_agent_register(&g_obex_server_info, conn);
+
+       if (ret != BLUETOOTH_ERROR_NONE) {
+               g_free(g_dst_path);
+               dbus_g_connection_unref(conn);
+               g_dst_path = NULL;
+       }
+
        DBG("- \n");
-       return __bt_obex_agent_register(&g_obex_server_info,
-                                       bt_internal_info->conn);
+
+       return ret;
 }
 
 BT_EXPORT_API int bluetooth_obex_server_deinit(void)
@@ -164,8 +202,7 @@ BT_EXPORT_API gboolean bluetooth_obex_server_is_activated(void)
 
        DBG("+");
 
-       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
-
+       conn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
        if (conn == NULL)
                return FALSE;
 
@@ -547,7 +584,7 @@ static gboolean __bt_authorize_callback(DBusGMethodInvocation *context,
        auth_info.filename = obex_server_info->filename;
        auth_info.length = length;
 
-       __bt_ops_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE,
                                                BLUETOOTH_ERROR_NONE, &auth_info);
 
        DBG("-\n");
@@ -586,7 +623,7 @@ static void __bt_transfer_progress_cb(DBusGProxy *object,
                DBG("Transfer ID : %d    Percentage : %d \n",
                        info.transfer_id, (int)percentage_progress);
 
-               __bt_ops_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,
                                                BLUETOOTH_ERROR_NONE, &info);
        }
 }
@@ -703,7 +740,7 @@ static void __bt_transfer_started_cb(DBusGProxy *object,
 
        DBG("Transfer id %d\n", app_transfer_info.transfer_id);
 
-       __bt_ops_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED,
                                        BLUETOOTH_ERROR_NONE, &app_transfer_info);
  }
 
@@ -730,7 +767,7 @@ static void __bt_transfer_completed_cb(DBusGProxy *object,
                transfer_complete_info.type = transfer_info->type;
                transfer_complete_info.device_name = transfer_info->device_name;
 
-               __bt_ops_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,
                                                result, &transfer_complete_info);
 
                __bt_obex_server_transfer_free(transfer_info);
@@ -830,7 +867,10 @@ static void __bt_obex_agent_unregister(obex_server_info_t *obex_server_info)
                                    G_CALLBACK(__bt_transfer_completed_cb),
                                    obex_server_info);
 
-       obex_server_info->bus = NULL;
+       if (obex_server_info->bus) {
+               dbus_g_connection_unref(obex_server_info->bus);
+               obex_server_info->bus = NULL;
+       }
 
        g_object_unref(obex_server_info->obex_proxy);
        obex_server_info->obex_proxy = NULL;
index 04a2c315dfce01254ccb1f82f493541692f516e2..296aed539731a0396b67a4bcfce64c4153811c62 100644 (file)
@@ -35,6 +35,11 @@ extern "C" {
 #define OBEX_SERVER_SERVICE "org.openobex"
 #define OBEX_SERVER_MANAGER "org.openobex.Manager"
 #define BT_OBEX_SERVICE_INTERFACE "org.openobex.Agent"
+
+#define BT_FRWK_OBJECT "/org/projectx/frwk"
+#define BT_FRWK_INTERFACE "User.Bluetooth.FRWK"
+#define BT_FRWK_SIGNAL_DEINIT "deinit"
+
 #define OBEX_SERVER_AGENT_PATH "/org/bluez/obex_server_agent"
 #define BT_INVALID_PATH "/Invalid/Path"
 #define BT_OBEX_AGENT_ERROR (__bt_obex_agent_error_quark())
index b9179d6eb1ff8c979c85278400db4767af5baaf7..9579fac4db40d8eacfd07642b327eefdc1780799 100644 (file)
@@ -66,30 +66,12 @@ static GError *__bt_opc_agent_error(bt_opc_agent_error_t error,
 {
        return g_error_new(BT_OPC_AGENT_ERROR, error, err_msg);
 }
-static void __bt_opc_internal_event_cb(int event, int result, void *param_data)
-{
-       DBG("+");
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-       bt_event.event = event;
-       bt_event.result = result;
-       bt_event.param_data = param_data;
-
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info && bt_internal_info->bt_cb_ptr)
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                       bt_internal_info->user_data);
-
-       DBG("-");
-}
-
 
 BT_EXPORT_API int bluetooth_opc_init(void)
 {
        DBG("+\n");
 
-       bt_info_t *bt_internal_info = NULL;
+       DBusGConnection *conn = NULL;
 
        _bluetooth_internal_session_init();
 
@@ -98,27 +80,29 @@ BT_EXPORT_API int bluetooth_opc_init(void)
                return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
        }
 
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info == NULL) {
-               DBG("bt_internal_info is NULL\n");
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-       }
-
        if (client_proxy) {
                DBG("Already initialized");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
        }
 
-       client_proxy =  dbus_g_proxy_new_for_name(bt_internal_info->conn,
-                                                       "org.openobex.client", "/",
-                                                        "org.openobex.Client");
+       /* Get the session bus. */
+       conn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+       if (conn == NULL) {
+               DBG("conn is NULL\n");
+               return BLUETOOTH_ERROR_NO_RESOURCES;
+       }
+
+       client_proxy =  dbus_g_proxy_new_for_name(conn, OBEX_CLIENT_SERVICE,
+                                               "/", OBEX_CLIENT_INTERFACE);
 
        if (NULL == client_proxy) {
                DBG("client_proxy is null");
+               dbus_g_connection_unref(conn);
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
+       dbus_g_connection_unref(conn);
+
        DBG("- \n");
        return BLUETOOTH_ERROR_NONE;
 }
@@ -257,8 +241,7 @@ BT_EXPORT_API gboolean bluetooth_opc_session_is_exist(void)
        GError *error = NULL;
        GPtrArray *gp_array = NULL;
 
-       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
-
+       conn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
        if (conn == NULL)
                return FALSE;
 
@@ -331,7 +314,7 @@ static void __bt_send_files_cb(DBusGProxy *proxy, DBusGProxyCall *call,
                opc_obex_agent = NULL;
        }
 
-       __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_CONNECTED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_CONNECTED,
                                                result, NULL);
        DBG("-");
 }
@@ -356,7 +339,7 @@ static gboolean __bt_progress_callback(DBusGMethodInvocation *context,
 
        percentage_int = percentage_progress;
 
-       __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,
                                                BLUETOOTH_ERROR_NONE, &percentage_int);
 
        DBG("-");
@@ -379,7 +362,7 @@ static gboolean __bt_complete_callback(DBusGMethodInvocation *context,
        info.filename = opc_current_transfer.name;
        info.size = opc_current_transfer.size;
 
-       __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,
                                                BLUETOOTH_ERROR_NONE, &info);
 
        __bt_free_obexd_transfer_hierarchy(&opc_current_transfer);
@@ -428,7 +411,7 @@ static gboolean __bt_request_callback(DBusGMethodInvocation *context,
                g_error_free(error);
                g_object_unref(opc_obex_agent);
                opc_obex_agent = NULL;
-               __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
                                                BLUETOOTH_ERROR_CANCEL_BY_USER, NULL);
                return TRUE;
        } else {
@@ -460,7 +443,7 @@ static gboolean __bt_request_callback(DBusGMethodInvocation *context,
                info.filename = opc_current_transfer.name;
                info.size = opc_current_transfer.size;
 
-               __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_STARTED,
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_STARTED,
                                                BLUETOOTH_ERROR_NONE, &info);
        }
 
@@ -486,7 +469,7 @@ static gboolean __bt_release_callback(DBusGMethodInvocation *context,
        /*release */
        __bt_free_obexd_transfer_hierarchy(&opc_current_transfer);
 
-       __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
                                                BLUETOOTH_ERROR_NONE, NULL);
        DBG("-");
 
@@ -527,7 +510,7 @@ static gboolean __bt_error_callback(DBusGMethodInvocation *context,
        info.filename = opc_current_transfer.name;
        info.size = opc_current_transfer.size;
 
-       __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,
                                                result, &info);
 
        __bt_free_obexd_transfer_hierarchy(&opc_current_transfer);
@@ -537,7 +520,7 @@ static gboolean __bt_error_callback(DBusGMethodInvocation *context,
                g_object_unref(opc_obex_agent);
                opc_obex_agent = NULL;
 
-               __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
                                                result, NULL);
        }
 
index 6049e6483335aadb5ef3a691550f425714b7df64..b288e7ef3f8148e3bd4cc7aea98adf2ae2e062c7 100644 (file)
@@ -42,7 +42,7 @@
 #include <termios.h>
 
 #define BLUEZ_SERVICE_NAME "org.bluez"
-#define BLUEZ_SERIAL_CLINET_INTERFACE "org.bluez.Serial"
+#define BLUEZ_SERIAL_CLIENT_INTERFACE "org.bluez.Serial"
 
 #define BLUEZ_MANAGER_OBJ_PATH "/"
 #define BLUEZ_MANAGER_INTERFACE "org.bluez.Manager"
@@ -144,9 +144,9 @@ static int __rfcomm_internal_terminate_server(rfcomm_server_t *server_info)
        DBG("+\n");
        DBusMessage *msg, *reply;
        DBusError error;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
        static char *default_adapter_obj_path = NULL;
+       bluetooth_rfcomm_disconnection_t disconnection_ind;
+
        int index;
 
        index = __bluetooth_rfcomm_internal_server_get_index_from_socket(server_info->server_sock_fd);
@@ -162,6 +162,11 @@ static int __rfcomm_internal_terminate_server(rfcomm_server_t *server_info)
                msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
                                                   rfcomm_server[index].uds_name,
                                                   BLUEZ_SERIAL_PROXY_INTERFACE, "Disable");
+               if (msg == NULL) {
+                       DBG("dbus method call is not allocated.");
+                       return -1;
+               }
+
                dbus_error_init(&error);
                reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
 
@@ -188,11 +193,16 @@ static int __rfcomm_internal_terminate_server(rfcomm_server_t *server_info)
                                                   default_adapter_obj_path,
                                                   BLUEZ_SERIAL_MANAGER_INTERFACE, "RemoveProxy");
 
+               g_free(default_adapter_obj_path);
+
+               if (msg == NULL) {
+                       DBG("dbus method call is not allocated.");
+                       return -1;
+               }
+
                dbus_message_append_args(msg, DBUS_TYPE_STRING, &rfcomm_server[index].uds_name,
                                         DBUS_TYPE_INVALID);
 
-               dbus_error_init(&error);
-               g_free(default_adapter_obj_path);
                reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
                dbus_message_unref(msg);
 
@@ -204,17 +214,13 @@ static int __rfcomm_internal_terminate_server(rfcomm_server_t *server_info)
                        }
                        return -1;
                }
-               bt_internal_info = _bluetooth_internal_get_information();
-               if (bt_internal_info->bt_cb_ptr) {
-                       bluetooth_rfcomm_disconnection_t disconnection_ind;
-                       bt_event.event = BLUETOOTH_EVENT_RFCOMM_DISCONNECTED;
-                       bt_event.result = BLUETOOTH_ERROR_NONE;
-                       disconnection_ind.socket_fd = rfcomm_server[index].client_sock_fd;
-                       disconnection_ind.device_addr = rfcomm_server[index].device_addr;
-                       bt_event.param_data = (void *)(&disconnection_ind);
-                       bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                                   bt_internal_info->user_data);
-               }
+
+               disconnection_ind.socket_fd = rfcomm_server[index].client_sock_fd;
+               disconnection_ind.device_addr = rfcomm_server[index].device_addr;
+
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
+                                               BLUETOOTH_ERROR_NONE, &disconnection_ind);
+
 
                if (rfcomm_server[index].client_sock_fd != -1) {
                        g_source_remove(rfcomm_server[index].client_event_src_id);
@@ -243,24 +249,15 @@ static int __rfcomm_internal_terminate_server(rfcomm_server_t *server_info)
 static int __rfcomm_internal_terminate_client(int index)
 {
        DBG("+\n");
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-       bt_internal_info = _bluetooth_internal_get_information();
+       bluetooth_rfcomm_disconnection_t disconnection_ind;
 
        __bluetooth_rfcomm_internal_disconnect(index);
 
-       if (bt_internal_info->bt_cb_ptr) {
-               bluetooth_rfcomm_disconnection_t disconnection_ind;
-
-               bt_event.event = BLUETOOTH_EVENT_RFCOMM_DISCONNECTED;
-               bt_event.result = BLUETOOTH_ERROR_NONE;
-               disconnection_ind.socket_fd = rfcomm_client[index].sock_fd;
-               disconnection_ind.device_addr = rfcomm_client[index].device_addr;
-               bt_event.param_data = (void *)(&disconnection_ind);
+       disconnection_ind.socket_fd = rfcomm_client[index].sock_fd;
+       disconnection_ind.device_addr = rfcomm_client[index].device_addr;
 
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-
-       }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
+                                       BLUETOOTH_ERROR_NONE, &disconnection_ind);
 
        g_source_remove(rfcomm_client[index].event_src_id);
        rfcomm_client[index].event_src_id = -1;
@@ -282,8 +279,6 @@ static gboolean __rfcomm_server_connected_cb(GIOChannel *chan, GIOCondition cond
        DBG("+\n");
        DBG("rfcomm_server.server_io_channel has %d \n", cond);
 
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
        DBusMessage *msg, *reply;
        DBusError error;
        DBusMessageIter reply_iter, reply_iter_entry;
@@ -342,15 +337,17 @@ static gboolean __rfcomm_server_connected_cb(GIOChannel *chan, GIOCondition cond
                           __rfcomm_server_data_received_cb, &rfcomm_server[index]);
 
        g_io_channel_unref(rfcomm_server[index].client_io_channel);
-       bt_internal_info = _bluetooth_internal_get_information();
-
-
 
        /* GetInfo Proxy Part */
        msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
                                           rfcomm_server[index].uds_name,
                                           BLUEZ_SERIAL_PROXY_INTERFACE, "GetInfo");
 
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return -1;
+       }
+
        dbus_error_init(&error);
 
        reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
@@ -464,15 +461,9 @@ static gboolean __rfcomm_server_connected_cb(GIOChannel *chan, GIOCondition cond
        con_ind.device_role = RFCOMM_ROLE_SERVER;
        con_ind.device_addr = rfcomm_server[index].device_addr;
        con_ind.socket_fd = rfcomm_server[index].client_sock_fd;
-       bt_event.event = BLUETOOTH_EVENT_RFCOMM_CONNECTED;
-       bt_event.result = BLUETOOTH_ERROR_NONE;
-       bt_event.param_data = (void *)&con_ind;
-
-       if (bt_internal_info->bt_cb_ptr) {
-               DBG("\ngoing to call callback BLUETOOTH_EVENT_RFCOMM_CONNECTED \n");
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
 
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_CONNECTED,
+                                       BLUETOOTH_ERROR_NONE, &con_ind);
        DBG("-\n");
        return TRUE;
 }
@@ -485,8 +476,7 @@ static gboolean __rfcomm_server_data_received_cb(GIOChannel *chan, GIOCondition
        char buf[RFCOMM_CLIENT_BUFFER_SIZE] = { 0 };
        unsigned int len;
        rfcomm_server_t *rfcomm_server_info = data;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
+       bluetooth_rfcomm_received_data_t rx_data;
 
        if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
                DBG("Unix server  disconnected (fd=%d)\n", rfcomm_server_info->client_sock_fd);
@@ -511,19 +501,13 @@ static gboolean __rfcomm_server_data_received_cb(GIOChannel *chan, GIOCondition
        }
 
        DBG("%s\n", buf);
-       bt_internal_info = _bluetooth_internal_get_information();
-       if (bt_internal_info->bt_cb_ptr) {
-               bluetooth_rfcomm_received_data_t rx_data;
-               rx_data.socket_fd = rfcomm_server_info->client_sock_fd;
-               rx_data.buffer_size = len;
-               rx_data.buffer = buf;
-               bt_event.event = BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED;
-               bt_event.result = BLUETOOTH_ERROR_NONE;
-               bt_event.param_data = (void *)&rx_data;
 
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
+       rx_data.socket_fd = rfcomm_server_info->client_sock_fd;
+       rx_data.buffer_size = len;
+       rx_data.buffer = buf;
 
-       }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED,
+                                       BLUETOOTH_ERROR_NONE, &rx_data);
 
        return TRUE;
 }
@@ -535,8 +519,8 @@ static gboolean __rfcomm_client_data_received_cb(GIOChannel *chan, GIOCondition
        char buf[RFCOMM_CLIENT_BUFFER_SIZE] = { 0 };
        unsigned int len;
        rfcomm_client_t *rfcomm_client_info = data;
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
+       bluetooth_rfcomm_received_data_t rx_data;
+
        int index = rfcomm_client_info->id;
        if ((index < 0) || (index >= RFCOMM_MAX_CONN)) {
                DBG("Invalid index %d ", index);
@@ -563,20 +547,14 @@ static gboolean __rfcomm_client_data_received_cb(GIOChannel *chan, GIOCondition
                return FALSE;
        }
 
-       bt_internal_info = _bluetooth_internal_get_information();
-       if (bt_internal_info->bt_cb_ptr) {
-               DBG("%s  -  clientfd = %d\n", buf, rfcomm_client_info->sock_fd);
-               bluetooth_rfcomm_received_data_t rx_data;
-               rx_data.socket_fd = rfcomm_client_info->sock_fd;
-               rx_data.buffer_size = len;
-               rx_data.buffer = buf;
-               bt_event.event = BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED;
-               bt_event.result = BLUETOOTH_ERROR_NONE;
-               bt_event.param_data = (void *)&rx_data;
+       DBG("%s  -  clientfd = %d\n", buf, rfcomm_client_info->sock_fd);
+       rx_data.socket_fd = rfcomm_client_info->sock_fd;
+       rx_data.buffer_size = len;
+       rx_data.buffer = buf;
 
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED,
+                                       BLUETOOTH_ERROR_NONE, &rx_data);
 
-       }
        return TRUE;
 }
 
@@ -602,7 +580,11 @@ static int __get_default_adapter_path(char **adapter_path)
                                           BLUEZ_MANAGER_OBJ_PATH, BLUEZ_MANAGER_INTERFACE,
                                           "DefaultAdapter");
 
-       dbus_error_init(&error);
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return -1;
+       }
+
        reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
 
        dbus_message_unref(msg);
@@ -650,8 +632,14 @@ static int __get_rfcomm_proxy_list(char ***proxy_list, int *len)
                                           default_adapter_obj_path, BLUEZ_SERIAL_MANAGER_INTERFACE,
                                           "ListProxies");
 
-       dbus_error_init(&error);
        g_free(default_adapter_obj_path);
+
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return -1;
+       }
+
+       dbus_error_init(&error);
        reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
        dbus_message_unref(msg);
 
@@ -698,8 +686,6 @@ static gboolean __get_rfcomm_is_match_uuid(char *proxy, const char *uuid)
        const char *property;
        DBusConnection *conn = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-
        if (proxy == NULL || uuid == NULL)
                return FALSE;
 
@@ -708,6 +694,11 @@ static gboolean __get_rfcomm_is_match_uuid(char *proxy, const char *uuid)
                                           proxy,
                                           BLUEZ_SERIAL_PROXY_INTERFACE, "GetInfo");
 
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return FALSE;
+       }
+
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
 
        if (conn == NULL)
@@ -841,8 +832,10 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid)
 
        g_free(default_adapter_obj_path);
 
-       /*Assign index */
-       len = index;
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
 
        g_strlcpy(address_string, RFCOMM_SER_DEV_PATH, sizeof(address_string));
        DBG("address_string1 = %s\n", address_string);
@@ -892,7 +885,11 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid)
        msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
                                           uds_proxy, BLUEZ_SERIAL_PROXY_INTERFACE, "Enable");
 
-       dbus_error_init(&error);
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
        reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
 
        dbus_message_unref(msg);
@@ -952,6 +949,36 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid)
                return sk;
 }
 
+BT_EXPORT_API gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
+{
+       DBG("+\n");
+       char **proxy_list = NULL;
+       int i;
+       int len;
+
+       if (uuid == NULL)
+               return FALSE;
+
+       if (strlen(uuid) != BT_128_UUID_LEN)
+               return FALSE;
+
+       /*Get all proxies */
+       if (__get_rfcomm_proxy_list(&proxy_list, &len) < 0) {
+               DBG("Fail to RFCOMM List Proxy\n");
+               return TRUE;
+       }
+
+       DBG("Proxy count = %d\n", len);
+
+       for (i = 0; i < len; i++) {
+               if (__get_rfcomm_is_match_uuid(proxy_list[i], uuid) == TRUE)
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
+
 /*
  * SLP 2.0 Bluetooth RFCOMM API
  * bluetooth_rfcomm_listen_and_accept(int sockfd, int max_pending_connection)"
@@ -1017,6 +1044,7 @@ BT_EXPORT_API int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid
        DBusError error;
        int index;
        static char *default_adapter_obj_path = NULL;
+
        index = __bluetooth_rfcomm_internal_server_get_index_from_socket(socket_fd);
        if (index < 0) {
                DBG("Invalid index %d", index);
@@ -1033,6 +1061,12 @@ BT_EXPORT_API int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid
        msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
                                           rfcomm_server[index].uds_name,
                                           BLUEZ_SERIAL_PROXY_INTERFACE, "Disable");
+
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
        dbus_error_init(&error);
        reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
 
@@ -1059,11 +1093,16 @@ BT_EXPORT_API int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid
                                           default_adapter_obj_path, BLUEZ_SERIAL_MANAGER_INTERFACE,
                                           "RemoveProxy");
 
+       g_free(default_adapter_obj_path);
+
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
        dbus_message_append_args(msg, DBUS_TYPE_STRING, &rfcomm_server[index].uds_name,
                                 DBUS_TYPE_INVALID);
 
-       dbus_error_init(&error);
-       g_free(default_adapter_obj_path);
        reply = dbus_connection_send_with_reply_and_block(connection, msg, -1, &error);
        dbus_message_unref(msg);
 
@@ -1077,19 +1116,11 @@ BT_EXPORT_API int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid
        }
 
        if (rfcomm_server[index].client_sock_fd) {
-               bluetooth_event_param_t bt_event = { 0, };
-               bt_info_t *bt_internal_info = NULL;
-               bt_internal_info = _bluetooth_internal_get_information();
-               if (bt_internal_info->bt_cb_ptr) {
-                       bluetooth_rfcomm_disconnection_t disconnection_ind;
-                       bt_event.event = BLUETOOTH_EVENT_RFCOMM_DISCONNECTED;
-                       bt_event.result = BLUETOOTH_ERROR_NONE;
-                       disconnection_ind.socket_fd = rfcomm_server[index].client_sock_fd;
-                       disconnection_ind.device_addr = rfcomm_server[index].device_addr;
-                       bt_event.param_data = (void *)(&disconnection_ind);
-                       bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event,
-                                                   bt_internal_info->user_data);
-               }
+               bluetooth_rfcomm_disconnection_t disconnection_ind;
+               disconnection_ind.socket_fd = rfcomm_server[index].client_sock_fd;
+               disconnection_ind.device_addr = rfcomm_server[index].device_addr;
+               _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
+                                               BLUETOOTH_ERROR_NONE, &disconnection_ind);
 
                g_source_remove(rfcomm_server[index].client_event_src_id);
                close(rfcomm_server[index].client_sock_fd);
@@ -1136,13 +1167,13 @@ static void __rfcomm_client_connected_cb(DBusGProxy *proxy, DBusGProxyCall *call
            remote_address->addr[1], remote_address->addr[2], remote_address->addr[3],
            remote_address->addr[4], remote_address->addr[5]);
 
-       DBG("+");
-
        bt_internal_info = _bluetooth_internal_get_information();
 
        dbus_g_proxy_end_call(proxy, call, &err,
                              G_TYPE_STRING, &rfcomm_device_node, G_TYPE_INVALID);
 
+       g_object_unref(proxy);
+
        if (err != NULL) {
                DBG("Error occured in connecting port [%s]", err->message);
 
@@ -1156,8 +1187,6 @@ static void __rfcomm_client_connected_cb(DBusGProxy *proxy, DBusGProxyCall *call
                goto done;
        }
 
-       g_object_unref(proxy);
-
        dev_node = g_strdup(rfcomm_device_node);
 
        DBG("Succss Connect REMOTE Device RFCOMM Node[%s]", dev_node);
@@ -1283,11 +1312,11 @@ BT_EXPORT_API int bluetooth_rfcomm_connect(const bluetooth_device_address_t *rem
 
        proxy_rfcomm_client = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
                                                        remote_device_path,
-                                                       BLUEZ_SERIAL_CLINET_INTERFACE);
+                                                       BLUEZ_SERIAL_CLIENT_INTERFACE);
        g_free(remote_device_path);
 
        if (proxy_rfcomm_client == NULL) {
-               DBG("Failed to get the network server proxy\n");
+               DBG("Failed to get the rfcomm proxy\n");
                return BLUETOOTH_ERROR_NOT_PAIRED;
        }
 
@@ -1350,8 +1379,13 @@ static int __bluetooth_rfcomm_internal_disconnect(int index)
        g_free(address_up);
        /* Disconnect */
        msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
-                                          remote_device_path, BLUEZ_SERIAL_CLINET_INTERFACE,
+                                          remote_device_path, BLUEZ_SERIAL_CLIENT_INTERFACE,
                                           "Disconnect");
+       if (msg == NULL) {
+               DBG("dbus method call is not allocated.");
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
        DBG("Device node name = %s\n", dev_node);
        dbus_message_append_args(msg, DBUS_TYPE_STRING, &dev_node, DBUS_TYPE_INVALID);
 
@@ -1386,7 +1420,6 @@ static int __bluetooth_rfcomm_internal_disconnect(int index)
 
 BT_EXPORT_API int bluetooth_rfcomm_disconnect(int socket_fd)
 {
-
        DBG("+\n");
 
        static char *default_adapter_obj_path = NULL;
@@ -1456,6 +1489,148 @@ BT_EXPORT_API int bluetooth_rfcomm_write(int fd, const char *buf, int length)
        DBG("-\n");
 }
 
+static gboolean __is_rfcomm_connected(DBusGConnection *conn, DBusGProxy *adapter,
+                               const bluetooth_device_address_t *bd_addr)
+{
+       DBG("+\n");
+
+       char *object_path = NULL;
+       char addr_str[BT_ADDRESS_STRING_SIZE];
+       gboolean connected = FALSE;
+       DBusGProxy *proxy = NULL;
+       GError *error = NULL;
+       GHashTable *hash = NULL;
+       GValue *value = NULL;
+
+       if (adapter == NULL || bd_addr == NULL)
+               return FALSE;
+
+       _bluetooth_internal_addr_type_to_addr_string(addr_str, bd_addr);
+
+       dbus_g_proxy_call(adapter, "FindDevice",
+                         &error, G_TYPE_STRING, addr_str,
+                         G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH,
+                         &object_path, G_TYPE_INVALID);
+
+       if (error != NULL) {
+               DBG("Failed to Find device: %s\n", error->message);
+               g_error_free(error);
+               return FALSE;
+       }
+
+       if (object_path == NULL)
+               return FALSE;
+
+       proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_NAME, object_path,
+                                               BLUEZ_SERIAL_CLIENT_INTERFACE);
+
+       if (proxy == NULL)
+               return FALSE;
+
+       dbus_g_proxy_call(proxy, "GetProperties", &error,
+                               G_TYPE_INVALID,
+                               dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+                               &hash, G_TYPE_INVALID);
+
+       if (error != NULL) {
+               DBG("Failed to get properties: %s\n", error->message);
+               g_error_free(error);
+               g_object_unref(proxy);
+               return FALSE;
+       }
+
+       if (hash != NULL) {
+               value = g_hash_table_lookup(hash, "Connected");
+               connected = value ? g_value_get_boolean(value) : FALSE;
+       }
+
+       g_object_unref(proxy);
+
+       DBG("-\n");
+
+       return connected;
+}
+
+BT_EXPORT_API gboolean bluetooth_rfcomm_is_client_connected()
+{
+       DBG("+\n");
+
+       GError *error = NULL;
+       DBusGConnection *conn = NULL;
+       char *adapter_path = NULL;
+       GPtrArray *dev_list = NULL;
+       bluetooth_device_info_t *p = NULL;
+       gboolean connected = FALSE;
+       int ret = 0;
+       int i;
+       DBusGProxy *adapter = NULL;
+
+       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+
+       if (error != NULL) {
+               DBG("Unable to connect to DBus :%s \n", error->message);
+               g_error_free(error);
+               goto done;
+       }
+
+       if (__get_default_adapter_path(&adapter_path) < 0) {
+               DBG("Fail to get default hci adapter path\n");
+               goto done;
+       }
+
+       adapter = dbus_g_proxy_new_for_name(conn, BLUEZ_NAME,
+                                       adapter_path, BLUEZ_ADAPTER_NAME);
+
+       g_free(adapter_path);
+
+       if (adapter == NULL)
+               goto done;
+
+       dev_list = g_ptr_array_new();
+
+       ret = bluetooth_get_bonded_device_list(&dev_list);
+
+       if (ret != BLUETOOTH_ERROR_NONE) {
+               DBG("Get bonded list failed : Error cause[%d]", ret);
+               goto done;
+       }
+
+       if (dev_list == NULL || dev_list->len == 0) {
+               DBG("There is no paired device");
+               goto done;
+       }
+
+       for (i = 0; i < dev_list->len; i++) {
+               p = g_ptr_array_index(dev_list, i);
+               if (!p) {
+                       DBG("device is none");
+                       break;
+               }
+
+               if (__is_rfcomm_connected(conn, adapter, &p->device_address) == TRUE) {
+                       free(p);
+                       g_ptr_array_free(dev_list, TRUE);
+                       connected = TRUE;
+                       goto done;
+               }
+
+               free(p);
+       }
+
+       g_ptr_array_free(dev_list, TRUE);
+done:
+       if (adapter)
+               g_object_unref(adapter);
+
+       if (conn)
+               dbus_g_connection_unref(conn);
+
+       DBG("connected: %d", connected);
+
+       return connected;
+}
+
+
 static int __bluetooth_internal_set_non_blocking(int sk)
 {
        /* Set Nonblocking */
index d8ae5182317bd8eb0d413c5cfbc870f98d0e8d21..512722162ab1cc097eee7b17c6410a1c0450686b 100644 (file)
@@ -73,6 +73,7 @@ static void __bluetooth_internal_get_remote_device_uuids_cb(DBusGProxy *proxy, D
 
        GHashTable *hash;
        GValue *value = { 0 };
+       int result = BLUETOOTH_ERROR_NONE;
        bluetooth_event_param_t bt_event = { 0, };
        bt_info_t *bt_internal_info = NULL;
 
@@ -131,22 +132,15 @@ static void __bluetooth_internal_get_remote_device_uuids_cb(DBusGProxy *proxy, D
        g_strfreev(array_list);
 
  done:
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_event.event = BLUETOOTH_EVENT_SERVICE_SEARCHED;
-               if (0 > ret) {
-                       bt_event.result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
-                       device_uuids.service_index = 0x00;
-               } else {
-                       bt_event.result = BLUETOOTH_ERROR_NONE;
-               }
-
-               bt_event.param_data = &device_uuids;
-
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
+               
+       if (0 > ret) {
+               result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
+               device_uuids.service_index = 0x00;
        }
 
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                       result, &device_uuids);
+
        DBG("-\n");
 
        return;
@@ -183,21 +177,6 @@ static void __bluetooth_internal_device_created_for_sdp_cb(DBusGProxy *proxy, DB
        return;
 }
 
-static void __bluetooth_internal_sdp_fail_cb(const bt_sdp_info_t *sdp_data, int error_code)
-{
-
-       bluetooth_event_param_t bt_event = { 0, };
-       bt_info_t *bt_internal_info = NULL;
-       bt_internal_info = _bluetooth_internal_get_information();
-
-       bt_event.event = BLUETOOTH_EVENT_SERVICE_SEARCHED;
-       bt_event.result = error_code;
-       bt_event.param_data = (void *)sdp_data;
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
-       }
-}
-
 static int __bluetooth_internal_parse_sdp_xml(const char *buf_name, int size,
                                                bt_sdp_info_t *xml_parsed_sdp);
 
@@ -410,7 +389,7 @@ static void __bluetooth_internal_discover_services_cb(DBusGProxy *proxy, DBusGPr
        const char *dev_path = NULL;
        static bt_sdp_info_t sdp_data;
        bt_info_t *bt_internal_info = NULL;
-       bluetooth_event_param_t bt_event = { 0, };
+       int result = BLUETOOTH_ERROR_NONE;
 
        bt_info_for_searching_support_service_t *bt_info_for_searching_support_service =
            (bt_info_for_searching_support_service_t *) user_data;
@@ -426,17 +405,17 @@ static void __bluetooth_internal_discover_services_cb(DBusGProxy *proxy, DBusGPr
                sdp_data.service_index = 0;
 
                if (!strcmp("Operation canceled", err->message)) {
-                       __bluetooth_internal_sdp_fail_cb(&sdp_data,
-                                                      BLUETOOTH_ERROR_CANCEL_BY_USER);
+                       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                                       BLUETOOTH_ERROR_CANCEL_BY_USER, &sdp_data);
                } else if (!strcmp("In Progress", err->message)) {
-                       __bluetooth_internal_sdp_fail_cb(&sdp_data,
-                                                      BLUETOOTH_ERROR_IN_PROGRESS);
+                       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                                       BLUETOOTH_ERROR_IN_PROGRESS, &sdp_data);
                } else if (!strcmp("Host is down", err->message)) {
-                       __bluetooth_internal_sdp_fail_cb(&sdp_data,
-                                                      BLUETOOTH_ERROR_HOST_DOWN);
+                       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                                       BLUETOOTH_ERROR_HOST_DOWN, &sdp_data);
                } else {
-                       __bluetooth_internal_sdp_fail_cb(&sdp_data,
-                                                      BLUETOOTH_ERROR_CONNECTION_ERROR);
+                       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                                       BLUETOOTH_ERROR_CONNECTION_ERROR, &sdp_data);
                }
 
                bt_internal_info->is_service_req = FALSE;
@@ -475,24 +454,19 @@ static void __bluetooth_internal_discover_services_cb(DBusGProxy *proxy, DBusGPr
                _bluetooth_change_uuids_to_sdp_info(value, &sdp_data);
        }
 
-       if (bt_internal_info->bt_cb_ptr) {
-               bt_event.event = BLUETOOTH_EVENT_SERVICE_SEARCHED;
-               DBG("service_index %d\n", sdp_data.service_index);
-               if (sdp_data.service_index < 0) {
-                       bt_event.result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
-                       sdp_data.service_index = 0;
-               } else if (sdp_data.service_index == 0) {
-                               /*This is for some carkit, printer.*/
-                       __bluetooth_internal_request_search_supported_services(
-                               &bt_info_for_searching_support_service->remote_device_addr);
-                       return;
-               } else {
-                       bt_event.result = BLUETOOTH_ERROR_NONE;
-                       bt_event.param_data = &sdp_data;
-               }
 
-               bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
+       DBG("service_index %d\n", sdp_data.service_index);
+       if (sdp_data.service_index < 0) {
+               result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
+               sdp_data.service_index = 0;
+       } else if (sdp_data.service_index == 0) {
+               /*This is for some carkit, printer.*/
+               __bluetooth_internal_request_search_supported_services(
+                       &bt_info_for_searching_support_service->remote_device_addr);
+               return;
        }
+       _bluetooth_internal_event_cb(BLUETOOTH_EVENT_SERVICE_SEARCHED,
+                                       result, &sdp_data);
 
        DBG("-\n");
 
@@ -523,9 +497,6 @@ BT_EXPORT_API int bluetooth_search_service(const bluetooth_device_address_t *dev
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
@@ -680,9 +651,6 @@ BT_EXPORT_API int bluetooth_cancel_service_search(void)
 
        bt_internal_info = _bluetooth_internal_get_information();
 
-       if (bt_internal_info == NULL)
-               return BLUETOOTH_ERROR_NO_RESOURCES;
-
        if (bt_internal_info->adapter_proxy == NULL)
                return BLUETOOTH_ERROR_INTERNAL;
 
index 52cffe58e7e29d9807fc4f3f40f421e97e9527b6..e1e24c4ab37e75c982834d905f96388ccbbed6ee 100644 (file)
@@ -286,7 +286,7 @@ static void obex_agent_class_init(ObexAgentClass *klass)
 
        object_class->finalize = obex_agent_finalize;
 
-       connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+       connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
 
        if (error != NULL) {
                DBG("error:%s", error->message);
index be45af2d80bd24d1e4cd8771e3296f1cfa28f3a6..ecd44ba854862b20d4620024d1b1559ba58c11e8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       bluetooth-frwk
-Summary:    Bluetooth framework for BlueZ This package is Bluetooth framework based on Blue
-Version:    0.1.48
+Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
+Version: 0.1.56
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
@@ -18,7 +18,6 @@ BuildRequires:  pkgconfig(bluez)
 BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(utilX)
 BuildRequires:  pkgconfig(appcore-efl)
-BuildRequires:  pkgconfig(openobex)
 BuildRequires:  pkgconfig(msg-service)
 BuildRequires:  pkgconfig(email-service)
 BuildRequires:  cmake
@@ -27,7 +26,7 @@ Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
 %description
-Bluetooth framework for BlueZ This package is Bluetooth framework based on BlueZ stack.
+Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
  This package contains API set for BT GAP, BT SDP, and BT RFCOMM.