+++ /dev/null
-build_log
-*.log
-*.pyc
-usr
-opt
-*.o
-*.os
-*.exe
-packages
-binaries
-*.ipk
-*~
# API library
ADD_SUBDIRECTORY(lib)
-# API library
-ADD_SUBDIRECTORY(bluetooth-media-control)
-
# Bluetooth FW Agent
ADD_SUBDIRECTORY(bluetooth-frwk-agent)
# install booting script
INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-agent DESTINATION /etc/rc.d/init.d)
-
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,
#include "MapiMessage.h"
/*Email Header Files*/
-#include "Emf_Mapi_Types.h"
+#include "email-types.h"
#include <bluetooth_map_agent.h>
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;
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);
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);
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);
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 };
}
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");
ERR("\n email_delete_message failed");
flag = FALSE;
}
- email_free_mail(&mail, 1);
+ email_free_mail_data(&mail_data, 1);
}
break;
}
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);
__bluetooth_map_stop_service();
return EXIT_FAILURE;
}
-
-
+++ /dev/null
-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)
+++ /dev/null
-/*
- * 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;
-}
-
-
+++ /dev/null
-/*
- * 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_*/
+++ /dev/null
-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
#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;
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)
&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;
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;
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);
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;
}
<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>
<arg type="s" name="id"/>
<arg type="s" name="phonebook_entry" direction="out"/>
</method>
-
<method name="AddContact">
<arg type="s" name="filename"/>
</method>
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
-
+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
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.
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
--- /dev/null
+/*\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
+++ /dev/null
-/*\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
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, };
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;
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;
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;
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);
(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);
_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);
}
} 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 )");
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");
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;
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);
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)
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 */
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",
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"
} 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);
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 */
*/
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)
*/
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
* 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.
* 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
*/
/**
- * @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(
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();
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();
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;
}
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("+");
}
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;
}
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;
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;
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} };
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;
}
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';
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;
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;
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;
}
- /* 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);
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();
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 } } };
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;
}
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 } } };
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;
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();
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;
}
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;
GError *error = NULL;
int ret = BLUETOOTH_ERROR_NONE;
+ DBG("+");
+
_bluetooth_internal_session_init();
if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
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);
bt_internal_info->is_discovery_cancel = TRUE;
+ DBG("-");
+
return BLUETOOTH_ERROR_NONE;
}
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,
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} };
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,
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("-");
}
GHashTable *hash = NULL;
GValue *value = NULL;
DBusGProxy *device_proxy = NULL;
+ char address[BT_ADDRESS_STRING_SIZE] = { 0 };
DBG("+");
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("-");
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();
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;
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");
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");
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");
}
{
DBG("+\n");
int ret_val = BLUETOOTH_ERROR_NONE;
+ int i;
bt_info_t *bt_internal_info = NULL;
GPtrArray *gp_array = NULL;
GPtrArray *result = NULL;
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;
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)
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;
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;
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;
/**********************************************************************
* 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);
* 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)
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;
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;
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");
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;
}
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);
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,
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);
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;
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;
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);
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");
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) {
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;
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;
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;
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);
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;
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;
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)
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)
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;
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("-");
}
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("-");
}
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;
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;
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)
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) {
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)
{
_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;
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;
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();
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;
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)
DBG("+");
- conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
-
+ conn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
if (conn == NULL)
return FALSE;
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");
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);
}
}
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);
}
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);
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;
#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())
{
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();
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;
}
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;
opc_obex_agent = NULL;
}
- __bt_opc_internal_event_cb(BLUETOOTH_EVENT_OPC_CONNECTED,
+ _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_CONNECTED,
result, NULL);
DBG("-");
}
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("-");
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);
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 {
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);
}
/*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("-");
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);
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);
}
#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"
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);
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);
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);
}
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);
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;
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;
__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);
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;
}
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);
}
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;
}
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);
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;
}
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);
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);
const char *property;
DBusConnection *conn = NULL;
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-
if (proxy == NULL || uuid == NULL)
return FALSE;
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)
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);
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);
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)"
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);
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);
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);
}
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);
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);
goto done;
}
- g_object_unref(proxy);
-
dev_node = g_strdup(rfcomm_device_node);
DBG("Succss Connect REMOTE Device RFCOMM Node[%s]", dev_node);
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;
}
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);
BT_EXPORT_API int bluetooth_rfcomm_disconnect(int socket_fd)
{
-
DBG("+\n");
static char *default_adapter_obj_path = NULL;
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 */
GHashTable *hash;
GValue *value = { 0 };
+ int result = BLUETOOTH_ERROR_NONE;
bluetooth_event_param_t bt_event = { 0, };
bt_info_t *bt_internal_info = NULL;
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;
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);
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;
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;
_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");
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;
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;
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);
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
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(appcore-efl)
-BuildRequires: pkgconfig(openobex)
BuildRequires: pkgconfig(msg-service)
BuildRequires: pkgconfig(email-service)
BuildRequires: cmake
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.