# API library
ADD_SUBDIRECTORY(lib)
+# Bluetooth Telephony API library
+ADD_SUBDIRECTORY(bluetooth-telephony)
+
+# API library
+ADD_SUBDIRECTORY(bluetooth-media-control)
+
# Bluetooth FW Agent
ADD_SUBDIRECTORY(bluetooth-frwk-agent)
# Message FW Agent
ADD_SUBDIRECTORY(bluetooth-map-agent)
+
+# Bluetooth HFP Agent
+ADD_SUBDIRECTORY(bluetooth-hfp-agent)
PROJECT(bluetooth-agent C)
SET(SRCS bluetooth-agent.c bluetooth-agent-cb.c marshal.c sc_core_agent.c)
-SET(APP_VENDOR samsung)
+SET(APP_VENDOR tizen)
SET(APP_NAME bluetooth-agent)
SET(APP_DIR /usr/bin)
SET(APP_LOCALEDIR /usr/share/locale)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED vconf aul syspopup-caller contacts-service dbus-glib-1 msg-service email-service)
+pkg_check_modules(pkgs REQUIRED vconf aul syspopup-caller contacts-service dbus-glib-1 msg-service
+email-service)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
#include <malloc.h>
#include <stacktrim.h>
#include <syspopup_caller.h>
+#include <vconf.h>
#include "bluetooth-agent.h"
#include "sc_core_agent.h"
#define HFP_AUDIO_GATEWAY_UUID "0000111f-0000-1000-8000-00805f9b34fb"
#define A2DP_UUID "0000110D-0000-1000-8000-00805F9B34FB"
+#define OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
+#define FTP_UUID "00001106-0000-1000-8000-00805f9b34fb"
+#define SPP_UUID "00001101-0000-1000-8000-00805f9b34fb"
+
+#define BT_MEMORY_OBEX_NO_AGENT "memory/private/libbluetooth-frwk-0/obex_no_agent"
+#define BT_MEMORY_RFCOMM_UUID "memory/private/libbluetooth-frwk-0/uuid"
+
+#define BT_AGENT_OBJECT "/org/projectx/bt_agent"
+#define BT_AGENT_INTERFACE "User.Bluetooth.agent"
+#define BT_AGENT_SIGNAL_AUTHORIZE "Authorize"
+#define BT_AGENT_SIGNAL_OBEX_AUTHORIZE "ObexAuthorize"
#define BT_PIN_MAX_LENGTH 16
#define BT_PASSKEY_MAX_LENGTH 6
}
ret = syspopup_launch("bt-syspopup", b);
- if (0 > ret) {
+ if (0 > ret)
DBG("Sorry Can not launch popup\n");
- return TRUE;
- } else {
+ else
DBG("Hurray Popup launched \n");
- bundle_free(b);
- return FALSE;
- }
+
+ bundle_free(b);
+ return FALSE;
}
int _bt_agent_launch_system_popup(bt_agent_event_type_t event_type, const char *device_name,
strncpy(event_str, "terminate", BT_MAX_EVENT_STR_LENGTH);
break;
- default:
+ case BT_AGENT_EVENT_EXCHANGE_REQUEST:
+ strncpy(event_str, "exchange-request", BT_MAX_EVENT_STR_LENGTH);
+ break;
+ default:
break;
}
uint32_t device_class;
GHashTable *hash = NULL;
GValue *value;
- const gchar *address, *name;
+ const gchar *address = NULL;
+ const gchar *name = NULL;
GError *error = NULL;
DBG("+\n");
__bt_agent_generate_passkey(str_passkey, sizeof(str_passkey));
+ sc_core_agent_reply_pin_code(_sc_core_agent_get_proxy(),
+ SC_CORE_AGENT_ACCEPT, str_passkey, NULL);
+
if (name)
_bt_agent_launch_system_popup(BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
(const char *)name, str_passkey, NULL);
static gboolean __passkey_request(DBusGProxy *device)
{
+ uint32_t device_class;
GHashTable *hash = NULL;
GValue *value;
- const gchar *address, *name;
+ const gchar *address = NULL;
+ const gchar *name = NULL;
GError *error = NULL;
DBG("+\n");
&hash, G_TYPE_INVALID);
if (hash != NULL) {
+ value = g_hash_table_lookup(hash, "Class");
+ device_class = value ? g_value_get_uint(value) : 0;
+
value = g_hash_table_lookup(hash, "Address");
address = value ? g_value_get_string(value) : NULL;
static gboolean __confirm_request(DBusGProxy *device, guint passkey)
{
+ uint32_t device_class;
GHashTable *hash = NULL;
GValue *value;
- const gchar *address, *name;
+ const gchar *address = NULL;
+ const gchar *name = NULL;
GError *error = NULL;
char str_passkey[7] = { 0 };
&hash, G_TYPE_INVALID);
if (hash != NULL) {
+ value = g_hash_table_lookup(hash, "Class");
+ device_class = value ? g_value_get_uint(value) : 0;
+
value = g_hash_table_lookup(hash, "Address");
address = value ? g_value_get_string(value) : NULL;
return TRUE;
}
+static void __bt_send_autorize_message(char *address, char *name, char *signal)
+{
+ 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\n");
+ return;
+ }
+
+ connecton = dbus_g_connection_get_connection(conn);
+
+ msg = dbus_message_new_signal(BT_AGENT_OBJECT,
+ BT_AGENT_INTERFACE,
+ signal);
+
+ DBG("address: %s, name: %s", address, name);
+
+ if (!dbus_message_append_args(msg,
+ DBUS_TYPE_STRING, &address,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID)) {
+ DBG("Authorize sending failed\n");
+ 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;
+}
+
static gboolean __authorize_request(DBusGProxy *device, const char *uuid)
{
GHashTable *hash = NULL;
- GValue *value;
- const gchar *address, *name;
+ GValue *value = NULL;
+ const gchar *address = NULL;
+ const gchar *name = NULL;
gboolean trust = FALSE;
+ gboolean paired = FALSE;
GError *error = NULL;
+ char *rfcomm_uuid = NULL;
+ int val = 0;
+ int request_type = BT_AGENT_EVENT_AUTHORIZE_REQUEST;
DBG("+\n");
value = g_hash_table_lookup(hash, "Trusted");
trust = value ? g_value_get_boolean(value) : 0;
+ value = g_hash_table_lookup(hash, "Paired");
+ paired = value ? g_value_get_boolean(value) : 0;
+
+ if (paired == FALSE) {
+ DBG("No paired device");
+ sc_core_agent_reply_authorize(_sc_core_agent_get_proxy(),
+ SC_CORE_AGENT_REJECT, NULL);
+ return TRUE;
+ }
+
DBG("Authorization request for device [%s] Service:[%s]\n", address, uuid);
+ vconf_get_int(BT_MEMORY_OBEX_NO_AGENT, (void *)&val);
+
+ if (val == 1 && !strcasecmp(uuid, OPP_UUID)) {
+ /* Send dbus signal to FRWK */
+ __bt_send_autorize_message((char *)address,
+ (char *)name,
+ BT_AGENT_SIGNAL_OBEX_AUTHORIZE);
+
+ return TRUE;
+ }
+
+ rfcomm_uuid = vconf_get_str(BT_MEMORY_RFCOMM_UUID);
+
+ if (rfcomm_uuid && !strcasecmp(uuid, rfcomm_uuid)) {
+ DBG("rfcomm_uuid: %s, uuid: %s", rfcomm_uuid, uuid);
+ /* Send dbus signal to FRWK */
+ __bt_send_autorize_message((char *)address,
+ (char *)name,
+ BT_AGENT_SIGNAL_AUTHORIZE);
+ return TRUE;
+ }
+
+ if (!strcasecmp(uuid, OPP_UUID))
+ request_type = BT_AGENT_EVENT_EXCHANGE_REQUEST;
+
if (trust) {
DBG("Trusted device, so authorize\n");
sc_core_agent_reply_authorize(_sc_core_agent_get_proxy(),
SC_CORE_AGENT_ACCEPT, NULL);
- } else if (name != NULL)
- _bt_agent_launch_system_popup(BT_AGENT_EVENT_AUTHORIZE_REQUEST,
+ } else if (name != NULL) {
+ _bt_agent_launch_system_popup(request_type,
(const char *)name, NULL, NULL);
- else if (address != NULL)
- _bt_agent_launch_system_popup(BT_AGENT_EVENT_AUTHORIZE_REQUEST,
+ } else if (address != NULL) {
+ _bt_agent_launch_system_popup(request_type,
(const char *)address, NULL, NULL);
- else
+ } else {
sc_core_agent_reply_authorize(_sc_core_agent_get_proxy(),
SC_CORE_AGENT_REJECT, NULL);
+ }
} else {
DBG("error in GetBasicProperties [%s]\n", error->message);
g_error_free(error);
func_cb.ignore_auto_pairing_func = __ignore_auto_pairing_request;
if (_sc_core_agent_add(adapter_proxy, &func_cb) < 0) {
- if (adapter_proxy == NULL) {
- return;
- }
- ERR("Agent register failed, Agent finish.\n");
+ ERR("Agent not registered");
+ return;
}
- DBG("Agent registered.\n");
+ DBG("Agent registered");
}
static const int __bt_agent_is_hid_keyboard(uint32_t dev_class)
static int __bt_agent_generate_passkey(char *passkey, int size)
{
int i = 0;
+ ssize_t len;
int random_fd = 0;
unsigned int value = 0;
return -1;
for (i = 0; i < size - 1; i++) {
- read(random_fd, &value, sizeof(value));
+ len = read(random_fd, &value, sizeof(value));
passkey[i] = '0' + (value % 10);
}
#include <vconf.h>
#include <vconf-keys.h>
#include <aul.h>
+#include <stdlib.h>
#include "bluetooth-agent.h"
+#include "sc_core_agent.h"
+
struct bt_agent_appdata *app_data = NULL;
+static GMainLoop *main_loop = NULL;
-/* status - 0 : No operation, 1 : Activate , 2 : Deactivate, 3 : Search Test*/
-/* run_type - No window change, 1 : Top window, 2 : Background*/
-static void __agent_launch_bt_service(int status, int run_type)
-{
- bundle *kb;
- char status_val[5] = { 0, };
- char run_type_val[5] = { 0, };
+static void __bt_agent_release_service(void);
+static void __bt_agent_terminate(void);
- snprintf(status_val, sizeof(status_val), "%d", status);
- snprintf(run_type_val, sizeof(run_type_val), "%d", run_type);
+bt_status_t _bt_agent_bt_status_get()
+{
+ return app_data->bt_status;
+}
- DBG("status: %s, run_type: %s", status_val, run_type_val);
+void _bt_agent_bt_status_set(bt_status_t status)
+{
+ app_data->bt_status = status;
+}
- kb = bundle_create();
+int _bt_agent_destroy()
+{
+ DBG("_bt_agent_destroy");
- bundle_add(kb, "launch-type", "setstate");
- bundle_add(kb, "status", status_val);
- bundle_add(kb, "run-type", run_type_val);
+ __bt_agent_release_service();
- aul_launch_app("org.tizen.bluetooth", kb);
+ __bt_agent_terminate();
- bundle_free(kb);
+ return BT_AGENT_ERROR_NONE;
}
static int __agent_check_bt_service(void *data)
if (bt_status != VCONFKEY_BT_STATUS_OFF) {
DBG("Previous session was enabled.");
+ /* Enable the BT */
+ _sc_core_agent_mode_change(BT_AGENT_CHANGED_MODE_ENABLE);
+ } else {
+ DBG("State: %d", _bt_agent_bt_status_get());
- /*check BT service*/
- if (!aul_app_is_running("org.tizen.bluetooth")) {
- __agent_launch_bt_service(BT_AGENT_RUN_STATUS_ACTIVATE,
- BT_AGENT_ON_BACKGROUND);
+ if (_bt_agent_bt_status_get() != BT_ACTIVATING) {
+ /* Destroy the agent */
+ _sc_core_agent_remove();
+ _bt_agent_destroy();
}
}
- return 0;
+ return BT_AGENT_ERROR_NONE;
}
static void __agent_adapter_added_cb(DBusGProxy *manager_proxy, const char *adapter_path,
adapter_proxy = dbus_g_proxy_new_for_name(connection, "org.bluez", adapter_path,
"org.bluez.Adapter");
- if (adapter_proxy)
+ if (adapter_proxy) {
_bt_agent_register(adapter_proxy);
-
- /*check BT service*/
- if (!aul_app_is_running("org.tizen.bluetooth"))
- __agent_launch_bt_service(BT_AGENT_RUN_STATUS_NO_CHANGE,
- BT_AGENT_ON_CURRENTVIEW);
+ g_object_unref(adapter_proxy);
+ }
/* Update Bluetooth Status to notify other modules */
if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_ON) != 0)
if (vconf_set_int(VCONFKEY_BT_DEVICE, VCONFKEY_BT_DEVICE_NONE) != 0)
DBG("Set vconf failed\n");
+
+ _bt_agent_bt_status_set(BT_ACTIVATED);
}
static void __agent_adapter_removed_cb(DBusGProxy *manager_proxy, const char *adapter_path,
DBG("value=%d\n", flight_mode);
- if (flight_mode == TRUE && aul_app_is_running("org.tizen.bluetooth")) {
+ if (flight_mode == TRUE) {
DBG("Deactivate Bluetooth Service\n");
- __agent_launch_bt_service(BT_AGENT_RUN_STATUS_DEACTIVATE,
- BT_AGENT_ON_CURRENTVIEW);
+ _sc_core_agent_mode_change(BT_AGENT_CHANGED_MODE_DISABLE);
}
}
}
-
-static int __agent_init(void *data)
+static gboolean __agent_init(gpointer data)
{
- struct bt_agent_appdata *ad = (struct bt_agent_appdata *)data;
- static DBusGConnection *connection = NULL;
- static DBusGProxy *manager_proxy = NULL;
+ struct bt_agent_appdata *ad = data;
+ DBusGConnection *connection = NULL;
+ DBusGProxy *manager_proxy = NULL;
DBusGProxy *adapter_proxy = NULL;
GError *error = NULL;
const char *adapter_path = NULL;
- if (connection == NULL)
- connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ _bt_agent_bt_status_set(BT_DEACTIVATED);
+
+ connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
if (error != NULL) {
ERR("ERROR: Can't get on system bus [%s]", error->message);
g_error_free(error);
- return 1;
+ return TRUE;
}
- ad->g_connection = (void *)connection;
+ ad->g_connection = connection;
- if (manager_proxy == NULL)
- manager_proxy = dbus_g_proxy_new_for_name(connection, "org.bluez", "/",
+ manager_proxy = dbus_g_proxy_new_for_name(connection, "org.bluez", "/",
"org.bluez.Manager");
-
if (manager_proxy == NULL) {
ERR("ERROR: Can't make dbus proxy");
- return 1;
+ return TRUE;
}
if (!dbus_g_proxy_call(manager_proxy, "DefaultAdapter", &error,
_bt_agent_register(NULL);
- dbus_g_proxy_add_signal(manager_proxy, "AdapterAdded",
- DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal(manager_proxy, "AdapterAdded",
- G_CALLBACK(__agent_adapter_added_cb), ad, NULL);
} else {
DBG("DefaultAdapter [%s]", adapter_path);
adapter_proxy = dbus_g_proxy_new_for_name(connection, "org.bluez", adapter_path,
"org.bluez.Adapter");
- if (adapter_proxy)
+ if (adapter_proxy) {
+ _bt_agent_bt_status_set(BT_ACTIVATED);
_bt_agent_register(adapter_proxy);
+ g_object_unref(adapter_proxy);
+ }
}
+ dbus_g_proxy_add_signal(manager_proxy, "AdapterAdded",
+ DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(manager_proxy, "AdapterAdded",
+ G_CALLBACK(__agent_adapter_added_cb), ad, NULL);
+
dbus_g_proxy_add_signal(manager_proxy, "AdapterRemoved",
DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
dbus_g_proxy_connect_signal(manager_proxy, "AdapterRemoved",
- G_CALLBACK(__agent_adapter_removed_cb), NULL, NULL);
+ G_CALLBACK(__agent_adapter_removed_cb), ad, NULL);
- g_idle_add((GSourceFunc) __agent_check_bt_service, NULL);
+ ad->manager_proxy = manager_proxy;
- return 0;
+ vconf_notify_key_changed(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, __bt_agent_flight_mode_cb, ad);
+
+ g_idle_add((GSourceFunc) __agent_check_bt_service, ad);
+
+ return FALSE;
+}
+
+static void __bt_agent_terminate(void)
+{
+ if (main_loop != NULL)
+ g_main_loop_quit(main_loop);
+ else
+ exit(0);
+}
+
+static void __bt_agent_release_service(void)
+{
+ struct bt_agent_appdata *ad = app_data;
+
+ if (ad->manager_proxy) {
+ dbus_g_proxy_disconnect_signal(ad->manager_proxy, "AdapterAdded",
+ G_CALLBACK(__agent_adapter_added_cb),
+ NULL);
+
+ dbus_g_proxy_disconnect_signal(ad->manager_proxy, "AdapterRemoved",
+ G_CALLBACK(__agent_adapter_removed_cb),
+ NULL);
+
+ g_object_unref(ad->manager_proxy);
+ ad->manager_proxy = NULL;
+ }
+
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL,
+ __bt_agent_flight_mode_cb);
}
static int __bt_agent_create(void *data)
DBG("__bt_agent_create() start.\n");
- g_idle_add((GSourceFunc) __agent_init, ad);
+ __agent_init(ad);
- vconf_notify_key_changed(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, __bt_agent_flight_mode_cb, ad);
-
- return 0;
+ return BT_AGENT_ERROR_NONE;
}
-GMainLoop *main_loop = NULL;
-
int main(int argc, char *argv[])
{
struct bt_agent_appdata ad = { 0 };
g_main_loop_run(main_loop);
- if (main_loop != NULL) {
+ if (main_loop != NULL)
g_main_loop_unref(main_loop);
- }
return 0;
}
#define BT_AGENT_PADDING_SIZE 4096
#define BT_MAX_SERVICES_FOR_DEVICE 20 /**< This specifies maximum number of services a
+
device can support */
#define BT_MAX_EVENT_STR_LENGTH 50
#define BT_AGENT_ADDR_SIZE 18
+#define BT_TEMINATING_WAIT_TIME 200
+
+/* Define Error type */
+#define BT_AGENT_FAIL -1
+#define BT_AGENT_ERROR_NONE 0
+
+#define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
+
+/* Need to covert to design ID */
+#define BT_STR_HANDS_FREE_RESTRICTS \
+ "Security policy restricts use of Bluletooth connection to hands-free features only"
+
+typedef enum {
+ BT_DEACTIVATING = 0x00, /* BT Deactivating */
+ BT_DEACTIVATED = 0x01, /* BT Deactivated */
+ BT_ACTIVATING = 0x02, /* BT Activating */
+ BT_ACTIVATED = 0x03, /* BT Activated */
+} bt_status_t;
struct bt_agent_appdata {
- void *g_connection;
+ DBusGConnection *g_connection;
+ DBusGProxy *manager_proxy;
int ignore_auto_pairing;
char bonding_addr[BT_AGENT_ADDR_SIZE + 1]; /*bluetooth device address which currently
bonding is requested to */
+ bt_status_t bt_status;
};
typedef enum {
BT_AGENT_EVENT_APP_CONFIRM_REQUEST = 0x0040,
BT_AGENT_EVENT_FILE_RECIEVED = 0x0080,
BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST = 0x0100,
- BT_AGENT_EVENT_TERMINATE = 0x0200,
+ BT_AGENT_EVENT_SECURITY = 0x0200,
+ BT_AGENT_EVENT_TERMINATE = 0x0400,
+ BT_AGENT_EVENT_EXCHANGE_REQUEST = 0x0800,
} bt_agent_event_type_t;
typedef enum {
char *passkey, const char *filename);
void _bt_agent_register(DBusGProxy *adapter_proxy);
+bt_status_t _bt_agent_bt_status_get();
+
+void _bt_agent_bt_status_set(bt_status_t status);
+
+int _bt_agent_destroy();
+
#endif /* __DEF_BT_AGENT_H_ */
char authorize_addr[18];
guint timeout_id;
- unsigned int timeout;
+ int timeout;
SC_CORE_AGENT_FUNC_CB cb;
};
DBusGMethodInvocation *context);
static gboolean sc_core_agent_set_discoverable_timer(ScCoreAgent *agent,
- const guint timeout,
+ const gint timeout,
DBusGMethodInvocation *context);
static gboolean sc_core_agent_get_discoverable_timeout(ScCoreAgent *agent,
const char *prev, const char *new,
gpointer user_data);
-static void __sc_core_agent_mode_change(int changed_mode);
-
-static gboolean __sc_cre_core_agent_readd(gpointer data);
-
#include "sc_core_agent_glue.h"
typedef enum {
static void sc_core_agent_finalize(GObject *agent)
{
ScCoreAgentPrivate *priv = SC_CORE_AGENT_GET_PRIVATE(agent);
- SC_CORE_AGENT_FUNC_CB *cb_ptr = NULL;
DBG("Free agent %p\n", agent);
g_free(priv->path);
g_free(priv->busname);
- cb_ptr = (SC_CORE_AGENT_FUNC_CB *) malloc(sizeof(SC_CORE_AGENT_FUNC_CB));
- if (cb_ptr) {
- memcpy(cb_ptr, &priv->cb, sizeof(SC_CORE_AGENT_FUNC_CB));
- g_idle_add(__sc_cre_core_agent_readd, (void *)cb_ptr);
- } else {
- DBG("Error copy callback pointer\n");
- }
-
G_OBJECT_CLASS(sc_core_agent_parent_class)->finalize(agent);
}
if (need_asking && dbus_g_proxy_call(priv->dbus_proxy, "GetConnectionUnixProcessID", NULL,
G_TYPE_STRING,
- "org.tizen.SplusA.bluetooth.BluetoothService",
+ "com.samsung.SplusA.bluetooth.BluetoothService",
G_TYPE_INVALID, G_TYPE_UINT, &inhouse_pid,
G_TYPE_INVALID)) {
if (inhouse_pid > 0 && (sender_pid > 0 ||
memset(priv->pairing_addr, 0x00, sizeof(priv->pairing_addr));
memset(priv->authorize_addr, 0x00, sizeof(priv->authorize_addr));
- /* Check blocking this part */
- g_signal_handlers_disconnect_by_func(priv->dbus_proxy,
- G_CALLBACK(__sc_core_agent_name_owner_changed), NULL);
- g_object_unref(agent);
- gap_agent = NULL;
-
g_free(sender);
return TRUE;
}
priv->timeout--;
- if (priv->timeout == 0) {
+ if (priv->timeout <= 0) {
+ g_source_remove(priv->timeout_id);
priv->timeout_id = 0;
+
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
+ DBG("Set vconf failed\n");
+
return FALSE;
}
}
static gboolean sc_core_agent_set_discoverable_timer(ScCoreAgent *agent,
- const guint timeout,
+ const gint timeout,
DBusGMethodInvocation *context)
{
DBG("+\n");
priv->timeout = timeout;
- if (timeout == 0)
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
+ DBG("Set vconf failed\n");
+
+ if (timeout <= 0)
return TRUE;
priv->timeout_id = g_timeout_add_seconds(1,
gboolean sc_core_agent_reply_authorize(ScCoreAgent *agent, const guint accept,
DBusGMethodInvocation *context)
{
+ gboolean ret = TRUE;
+
DBG("+\n");
ScCoreAgentPrivate *priv = SC_CORE_AGENT_GET_PRIVATE(agent);
dbus_g_method_return_error(priv->reply_context, error);
g_error_free(error);
}
+
+ if (context)
+ dbus_g_method_return(context);
+ } else {
+ GError *error = sc_core_agent_error(SC_CORE_AGENT_ERROR_REJECT,
+ "No context");
+ DBG("No context");
+
+ if (context)
+ dbus_g_method_return_error(context, error);
+
+ g_error_free(error);
+ ret = FALSE;
}
priv->exec_type = SC_CORE_AGENT_EXEC_NO_OPERATION;
DBG("-\n");
- return TRUE;
+ return ret;
}
gboolean sc_core_agent_reply_adapter_enable(ScCoreAgent *agent, const guint changed_mode,
ScCoreAgentPrivate *priv = SC_CORE_AGENT_GET_PRIVATE(agent);
if (accept == SC_CORE_AGENT_ACCEPT) {
- __sc_core_agent_mode_change(changed_mode);
+ _sc_core_agent_mode_change(changed_mode);
dbus_g_method_return(priv->reply_context);
} else {
GError *error = NULL;
return TRUE;
}
-static void __sc_core_agent_mode_change(int changed_mode)
+void _sc_core_agent_mode_change(int changed_mode)
{
int ret = 0;
+ bt_status_t bt_up_status;
switch (changed_mode) {
case BT_AGENT_CHANGED_MODE_ENABLE:
/* Run BT intiate script */
+ bt_up_status = _bt_agent_bt_status_get();
+ if (bt_up_status == BT_ACTIVATING || bt_up_status == BT_ACTIVATED) {
+ DBG("BT is activating or already activated.\n");
+ break;
+ }
+
+ _bt_agent_bt_status_set(BT_ACTIVATING);
+
if ((ret = system("/usr/etc/bluetooth/bt-stack-up.sh &")) < 0) {
DBG("running script failed");
ret = system("/usr/etc/bluetooth/bt-dev-end.sh &");
-
+ _bt_agent_bt_status_set(BT_DEACTIVATED);
sc_core_agent_reply_adapter_enable(_sc_core_agent_get_proxy(), changed_mode,
SC_CORE_AGENT_REJECT, NULL);
return;
case BT_AGENT_CHANGED_MODE_DISABLE:
/* Run BT terminate script */
+ bt_up_status = _bt_agent_bt_status_get();
+ if (bt_up_status == BT_DEACTIVATING || bt_up_status == BT_DEACTIVATED) {
+ DBG("BT is deactivating or already deactivated.\n");
+ break;
+ }
+
+ _bt_agent_bt_status_set(BT_DEACTIVATING);
+
if ((ret = system("/usr/etc/bluetooth/bt-stack-down.sh &")) < 0) {
DBG("running script failed");
-
+ _bt_agent_bt_status_set(BT_ACTIVATED);
sc_core_agent_reply_adapter_enable(_sc_core_agent_get_proxy(), changed_mode,
SC_CORE_AGENT_REJECT, NULL);
return;
}
}
-static gboolean __sc_core_agent_register_on_adapter(ScCoreAgent *agent, DBusGProxy *adapter,
- SC_CORE_AGENT_FUNC_CB *func_cb)
+static gboolean __sc_core_agent_register_on_adapter(ScCoreAgent *agent, DBusGProxy *adapter)
{
ScCoreAgentPrivate *priv = SC_CORE_AGENT_GET_PRIVATE(agent);
DBusGProxy *proxy;
- GObject *object;
GError *error = NULL;
DBG("agent %p\n", agent);
- if (priv->adapter != NULL)
+ if (adapter == NULL)
return FALSE;
- /* DBUS method call install */
- if (priv->path == NULL) {
- priv->path = g_strdup_printf("/org/bluez/agent/frwk_agent");
-
- DBG("%s \n", priv->path);
-
- object = dbus_g_connection_lookup_g_object(connection, priv->path);
- if (object != NULL)
- g_object_unref(object);
-
- dbus_g_connection_register_g_object(connection, priv->path, G_OBJECT(agent));
- }
-
- if (func_cb) {
- priv->cb.pincode_func = func_cb->pincode_func;
- priv->cb.display_func = func_cb->display_func;
- priv->cb.passkey_func = func_cb->passkey_func;
- priv->cb.confirm_func = func_cb->confirm_func;
- priv->cb.authorize_func = func_cb->authorize_func;
- priv->cb.pairing_cancel_func = func_cb->pairing_cancel_func;
- priv->cb.authorization_cancel_func = func_cb->authorization_cancel_func;
- priv->cb.confirm_mode_func = func_cb->confirm_mode_func;
- priv->cb.ignore_auto_pairing_func = func_cb->ignore_auto_pairing_func;
- }
-
priv->exec_type = SC_CORE_AGENT_EXEC_NO_OPERATION;
memset(priv->pairing_addr, 0x00, sizeof(priv->pairing_addr));
memset(priv->authorize_addr, 0x00, sizeof(priv->authorize_addr));
priv->reply_context = NULL;
/* Adapter agent register */
- if (adapter) {
- priv->adapter = g_object_ref(adapter);
-
- proxy = dbus_g_proxy_new_for_name_owner(connection,
- dbus_g_proxy_get_bus_name(priv->adapter),
- dbus_g_proxy_get_path(priv->adapter),
- dbus_g_proxy_get_interface(priv->adapter),
- NULL);
+ priv->adapter = g_object_ref(adapter);
- if (priv->busname)
- g_free(priv->busname);
+ proxy = dbus_g_proxy_new_for_name_owner(connection,
+ dbus_g_proxy_get_bus_name(priv->adapter),
+ dbus_g_proxy_get_path(priv->adapter),
+ dbus_g_proxy_get_interface(priv->adapter),
+ NULL);
- if (proxy != NULL) {
- priv->busname = g_strdup(dbus_g_proxy_get_bus_name(proxy));
- g_object_unref(proxy);
- } else
- priv->busname = g_strdup(dbus_g_proxy_get_bus_name(adapter));
+ g_free(priv->busname);
- dbus_g_proxy_call(priv->adapter, "RegisterAgent", &error,
- DBUS_TYPE_G_OBJECT_PATH, priv->path,
- G_TYPE_STRING, "DisplayYesNo", G_TYPE_INVALID, G_TYPE_INVALID);
+ if (proxy != NULL) {
+ priv->busname = g_strdup(dbus_g_proxy_get_bus_name(proxy));
+ g_object_unref(proxy);
+ } else
+ priv->busname = g_strdup(dbus_g_proxy_get_bus_name(adapter));
- if (error != NULL) {
- DBG("Agent registration failed: %s\n", error->message);
- g_error_free(error);
- return FALSE;
- }
+ dbus_g_proxy_call(priv->adapter, "RegisterAgent", &error,
+ DBUS_TYPE_G_OBJECT_PATH, priv->path,
+ G_TYPE_STRING, "DisplayYesNo", G_TYPE_INVALID, G_TYPE_INVALID);
+ if (error != NULL) {
+ DBG("Agent registration failed: %s\n", error->message);
+ g_error_free(error);
+ return FALSE;
}
return TRUE;
dbus_g_proxy_call(priv->adapter, "UnregisterAgent", &error,
DBUS_TYPE_G_OBJECT_PATH, priv->path, G_TYPE_INVALID, G_TYPE_INVALID);
-
if (error != NULL) {
g_printerr("Agent unregistration failed: %s\n", error->message);
g_error_free(error);
g_object_unref(priv->adapter);
priv->adapter = NULL;
- g_free(priv->path);
- priv->path = NULL;
-
return TRUE;
}
+static gboolean __sc_core_agent_destroy_cb(gpointer user_data)
+{
+ if (_bt_agent_bt_status_get() != BT_ACTIVATING) {
+ /* Destroy the agent */
+ _bt_agent_destroy();
+ } else
+ DBG("Now activating!!!");
+
+ return FALSE;
+}
+
static void __sc_core_agent_name_owner_changed(DBusGProxy *object, const char *name,
const char *prev, const char *new, gpointer user_data)
{
if (vconf_set_int(VCONFKEY_BT_DEVICE, VCONFKEY_BT_DEVICE_NONE) != 0)
DBG("Set vconf failed\n");
+
+ __sc_core_agent_unregister(gap_agent);
+ _bt_agent_bt_status_set(BT_DEACTIVATED);
+
+ /* Wait some miliseconds,
+ because it is possible that anyone try to BT on.
+ So we need to yield the calling turn to dbus method */
+ g_timeout_add(BT_TEMINATING_WAIT_TIME,
+ (GSourceFunc)__sc_core_agent_destroy_cb, NULL);
}
}
-static void __sc_core_setup_dbus(ScCoreAgent *agent)
+static void __sc_core_setup_dbus(ScCoreAgent *agent, SC_CORE_AGENT_FUNC_CB *func_cb)
{
guint result;
GError *error = NULL;
gchar *agent_name = NULL;
ScCoreAgentPrivate *priv = SC_CORE_AGENT_GET_PRIVATE(agent);
+ GObject *object;
agent_name = g_strdup_printf("org.bluez.frwk_agent");
g_free(agent_name);
+ priv->path = g_strdup_printf("/org/bluez/agent/frwk_agent");
+
+ object = dbus_g_connection_lookup_g_object(connection, priv->path);
+ if (object != NULL)
+ g_object_unref(object);
+
+ dbus_g_connection_register_g_object(connection, priv->path, G_OBJECT(agent));
+
+ memcpy(&priv->cb, func_cb, sizeof(SC_CORE_AGENT_FUNC_CB));
+
dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
{
ScCoreAgentPrivate *priv = SC_CORE_AGENT_GET_PRIVATE(agent);
+ dbus_g_proxy_disconnect_signal(priv->dbus_proxy, "NameOwnerChanged",
+ G_CALLBACK(__sc_core_agent_name_owner_changed),
+ NULL);
+
g_object_unref(priv->dbus_proxy);
priv->dbus_proxy = NULL;
- priv->adapter = NULL;
+
+ g_free(priv->path);
+ priv->path = NULL;
}
int _sc_core_agent_add(DBusGProxy *adapter_proxy, SC_CORE_AGENT_FUNC_CB *func_cb)
{
if (gap_agent == NULL) {
gap_agent = sc_core_agent_new();
- __sc_core_setup_dbus(gap_agent);
+ __sc_core_setup_dbus(gap_agent, func_cb);
}
- if (__sc_core_agent_register_on_adapter(gap_agent, adapter_proxy, func_cb))
+ if (__sc_core_agent_register_on_adapter(gap_agent, adapter_proxy))
return 0;
return -1;
}
-static gboolean __sc_cre_core_agent_readd(gpointer data)
-{
- SC_CORE_AGENT_FUNC_CB *cb_ptr = (SC_CORE_AGENT_FUNC_CB *) data;
-
- _sc_core_agent_add(NULL, cb_ptr);
-
- if (cb_ptr) {
- free(cb_ptr);
- }
- return 0;
-}
-
void _sc_core_agent_remove(void)
{
__sc_core_agent_unregister(gap_agent);
int _sc_core_agent_add(DBusGProxy *adapter_proxy, SC_CORE_AGENT_FUNC_CB *func_cb);
void _sc_core_agent_remove(void);
+
+void _sc_core_agent_mode_change(int changed_mode);
+
ScCoreAgent *_sc_core_agent_get_proxy(void);
gboolean sc_core_agent_reply_pin_code(ScCoreAgent *agent, const guint accept, const char *pin_code,
<method name="SetDiscoverableTimer">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="u" name="timeout"/>
+ <arg type="i" name="timeout"/>
</method>
<method name="GetDiscoverableTimeout">
PROJECT(bluetooth-map-agent C)
SET(SRCS bluetooth_map_agent.c)
-SET(APP_VENDOR samsung)
+SET(APP_VENDOR tizen)
SET(APP_NAME bluetooth-map-agent)
SET(APP_DIR /usr/bin)
SET(APP_LOCALEDIR /usr/share/locale)
#include <dbus/dbus-glib.h>
#include <dbus/dbus.h>
#include <time.h>
-#include <errno.h>
#include "vconf.h"
#include "vconf-keys.h"
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
/*Messaging Header Files*/
-#include "MapiTransport.h"
-#include "MapiMessage.h"
+#include "msg.h"
+#include "msg_storage.h"
+#include "msg_storage_types.h"
+#include "msg_transport.h"
+#include "msg_transport_types.h"
+#include "msg_types.h"
/*Email Header Files*/
#include "email-types.h"
+#include "email-api-init.h"
+#include "email-api-account.h"
+#include "email-api-mailbox.h"
+#include "email-api-mail.h"
+#include "email-api-network.h"
#include <bluetooth_map_agent.h>
#define DBUS_STRUCT_MESSAGE_LIST (dbus_g_type_get_struct("GValueArray", \
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID))
-static MSG_HANDLE_T g_msg_handle = NULL;
+static msg_handle_t g_msg_handle = NULL;
#define BT_MAP_NEW_MESSAGE "NewMessage"
#define BT_MAP_STATUS_CB "sent status callback"
#define BT_MAP_MSG_CB "sms message callback"
#define BT_MAP_EMAIL "_e"
#define BT_MAP_MSG_INFO_MAX 256
#define BT_MAP_MSG_HANDLE_MAX 16
+#define BT_MAP_TIMESTAMP_MAX_LEN 16
#define BT_MNS_OBJECT_PATH "/org/bluez/mns"
#define BT_MNS_INTERFACE "org.bluez.mns"
#define BT_MSG_UPDATE 0
return g_error_new(BT_MAP_AGENT_ERROR, error, err_msg);
}
-static void __bluetooth_map_msg_incoming_status_cb(MSG_HANDLE_T handle,
- msg_message_t msg, void *user_param)
+static void __bluetooth_map_msg_incoming_status_cb(msg_handle_t handle,
+ msg_struct_t msg, void *user_param)
{
DBusMessage *message = NULL;
char *message_type = NULL;
DBusConnection *conn;
+ int msg_id = 0;
+ int msg_type = 0;
+ char msg_handle[BT_MAP_MSG_HANDLE_MAX] = {0,};
+ int ret = MSG_SUCCESS;
DBG("+\n");
return;
}
- switch (msg_get_message_type(msg)) {
+
+ ret = msg_get_int_value(msg,
+ MSG_MESSAGE_ID_INT, &msg_id);
+ if (ret != MSG_SUCCESS)
+ return;
+
+ snprintf(msg_handle, sizeof(msg_handle), "%d%s",
+ msg_id,
+ BT_MAP_SMS);
+
+ ret = msg_get_int_value(msg,
+ MSG_MESSAGE_TYPE_INT, &msg_type);
+ if (ret != MSG_SUCCESS)
+ return;
+
+ switch (msg_type) {
case MSG_TYPE_SMS:
- message_type = g_strdup("SMS_GSM");
+ message_type = g_strdup("SMS_GSM");
break;
case MSG_TYPE_MMS:
- message_type = g_strdup("MMS");
+ message_type = g_strdup("MMS");
break;
default:
- message_type = g_strdup("UNKNOWN");
+ message_type = g_strdup("UNKNOWN");
break;
}
dbus_message_append_args(message, DBUS_TYPE_STRING, &message_type,
- DBUS_TYPE_INT32, &handle,
+ DBUS_TYPE_INT32, &msg_handle,
DBUS_TYPE_INVALID);
dbus_message_set_no_reply(message, TRUE);
static gboolean __bluetooth_map_start_service()
{
- MSG_ERROR_T err = MSG_SUCCESS;
- int email_err = EMF_ERROR_NONE;
- bool msg_ret = TRUE;
- bool email_ret = TRUE;
+ msg_error_t err = MSG_SUCCESS;
+ int email_err = EMAIL_ERROR_NONE;
+ gboolean msg_ret = TRUE;
+ gboolean email_ret = TRUE;
err = msg_open_msg_handle(&g_msg_handle);
-
if (err != MSG_SUCCESS) {
ERR("msg_open_msg_handle error = %d\n", err);
msg_ret = FALSE;
- goto email;
+ goto email;
}
err = msg_reg_sms_message_callback(g_msg_handle,
__bluetooth_map_msg_incoming_status_cb,
0, (void *)BT_MAP_MSG_CB);
-
if (err != MSG_SUCCESS) {
ERR("msg_reg_sms_message_callback error = %d\n", err);
msg_ret = FALSE;
email:
email_err = email_service_begin();
-
- if (email_err != EMF_ERROR_NONE) {
+ if (email_err != EMAIL_ERROR_NONE) {
ERR("email_service_begin fail error = %d\n", email_err);
email_ret = FALSE;
}
g_msg_handle = NULL;
- if (EMF_ERROR_NONE != email_service_end())
+ if (EMAIL_ERROR_NONE != email_service_end())
ERR("email_service_end fail \n");
return;
}
+static void __get_msg_timestamp(time_t *ltime, char *timestamp)
+{
+ struct tm local_time;
+ int year;
+ int month;
+
+ if (!localtime_r(ltime, &local_time))
+ return;
+
+ year = local_time.tm_year + 1900; /* years since 1900 */
+ month = local_time.tm_mon + 1; /* months since January */
+ snprintf(timestamp, 16, "%04d%02d%02dT%02d%02d%02d",
+ year, month,
+ local_time.tm_mday, local_time.tm_hour,
+ local_time.tm_min, local_time.tm_sec);
+
+ return;
+}
+
+gboolean static __bt_msg_is_mms(int msg_type)
+{
+ gboolean result = FALSE;
+
+ switch (msg_type) {
+ case MSG_TYPE_MMS_NOTI:
+ case MSG_TYPE_MMS_JAVA:
+ case MSG_TYPE_MMS:
+ result = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ return result;
+}
+
static gboolean bluetooth_map_get_folder_tree(BluetoothMapAgent *agent,
DBusGMethodInvocation *context)
{
GPtrArray *array = g_ptr_array_new();
- MSG_FOLDER_LIST_S g_folderList;
- int i = 0;
+ GValue value;
+ GError *error = NULL;
+
char name[BT_MAP_MSG_INFO_MAX] = {0,};
- int vconf_err = 0;
+ char folder_name[BT_MAP_MSG_INFO_MAX] = {0,};
+ int i;
+ int j;
int account_id = 0;
- emf_mailbox_t *mailbox_list = NULL;
int mailbox_count = 0;
- bool flag = FALSE;
- int j = 0;
- GValue *value = NULL;
- GError *error = NULL;
- bool msg_ret = TRUE;
+ int ret = MSG_SUCCESS;
+ gboolean flag = FALSE;
+ gboolean msg_ret = TRUE;
- if (__bluetooth_map_start_service() == FALSE)
- goto fail;
+ msg_struct_list_s g_folderList;
+ msg_struct_t p_folder;
+ email_mailbox_t *mailbox_list = NULL;
if (g_msg_handle == NULL) {
msg_ret = FALSE;
goto email;
}
- value = g_new0(GValue, 1);
-
for (i = 0; i < g_folderList.nCount; i++) {
- g_strlcpy(name, g_folderList.folderInfo[i].folderName,
- sizeof(name));
-
- memset(value, 0, sizeof(GValue));
- g_value_init(value, DBUS_STRUCT_STRING_STRING_UINT);
- g_value_take_boxed(value, dbus_g_type_specialized_construct(
+ p_folder = g_folderList.msg_struct_info[i];
+ memset(folder_name, 0x00, BT_MAP_MSG_INFO_MAX);
+
+ ret = msg_get_str_value(p_folder, MSG_FOLDER_INFO_NAME_STR,
+ folder_name, BT_MAP_MSG_INFO_MAX);
+ if (ret != MSG_SUCCESS)
+ continue;
+
+ g_strlcpy(name, folder_name, sizeof(name));
+ memset(&value, 0, sizeof(GValue));
+ g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
+ g_value_take_boxed(&value, dbus_g_type_specialized_construct(
DBUS_STRUCT_STRING_STRING_UINT));
- dbus_g_type_struct_set(value, 0, name, G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(value));
+ dbus_g_type_struct_set(&value, 0, name, G_MAXUINT);
+ g_ptr_array_add(array, g_value_get_boxed(&value));
}
email:
- vconf_err = vconf_get_int(BT_MAP_EMAIL_DEFAULTACCOUNT, &account_id);
- if (vconf_err == -1) {
- if (!msg_ret)
- goto fail;
- }
+ if (EMAIL_ERROR_NONE != email_load_default_account_id(&account_id))
+ goto done;
- if (EMF_ERROR_NONE != email_get_mailbox_list(account_id,
- EMF_MAILBOX_ALL,
+ if (EMAIL_ERROR_NONE != email_get_mailbox_list(account_id,
+ EMAIL_MAILBOX_ALL,
&mailbox_list,
&mailbox_count)) {
- if (!msg_ret)
- goto fail;
+ goto done;
}
+ msg_ret = TRUE;
+
for (i = 0; i < mailbox_count; i++) {
flag = FALSE;
for (j = 0; j < g_folderList.nCount; j++) {
- if (!g_ascii_strncasecmp(
- mailbox_list[i].name,
- g_folderList.folderInfo[j].folderName,
- strlen(mailbox_list[i].name))) {
+
+ p_folder = g_folderList.msg_struct_info[j];
+ memset(folder_name, 0x00, BT_MAP_MSG_INFO_MAX);
+
+ ret = msg_get_str_value(p_folder, MSG_FOLDER_INFO_NAME_STR,
+ folder_name, BT_MAP_MSG_INFO_MAX);
+ if (ret != MSG_SUCCESS)
+ continue;
+
+ if (!g_ascii_strncasecmp(mailbox_list[i].alias,
+ folder_name, strlen(mailbox_list[i].alias))) {
flag = TRUE;
break;
}
}
+
if (!flag) {
- g_strlcpy(name, mailbox_list[i].name, sizeof(name));
- memset(value, 0, sizeof(GValue));
- g_value_init(value, DBUS_STRUCT_STRING_STRING_UINT);
- g_value_take_boxed(value,
+ g_strlcpy(name, mailbox_list[i].alias, sizeof(name));
+ memset(&value, 0, sizeof(GValue));
+ g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
+ g_value_take_boxed(&value,
dbus_g_type_specialized_construct(
DBUS_STRUCT_STRING_STRING_UINT));
- dbus_g_type_struct_set(value, 0, name, G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(value));
+ dbus_g_type_struct_set(&value, 0, name, G_MAXUINT);
+ g_ptr_array_add(array, g_value_get_boxed(&value));
}
}
if (mailbox_list != NULL)
email_free_mailbox(&mailbox_list, mailbox_count);
- g_free(value);
- dbus_g_method_return(context, array);
- g_ptr_array_free(array, TRUE);
- return TRUE;
-fail:
- if (mailbox_list != NULL)
- email_free_mailbox(&mailbox_list, mailbox_count);
- g_free(value);
- g_ptr_array_free(array, TRUE);
- error = __bt_map_agent_error(BT_MAP_AGENT_ERROR_INTERNAL,
- "InternalError");
- dbus_g_method_return_error(context, error);
- g_error_free(error);
- return FALSE;
+done:
+
+ if (msg_ret == FALSE) {
+ g_ptr_array_free(array, TRUE);
+
+ error = __bt_map_agent_error(BT_MAP_AGENT_ERROR_INTERNAL,
+ "InternalError");
+ dbus_g_method_return_error(context, error);
+ g_error_free(error);
+ return FALSE;
+ } else {
+ dbus_g_method_return(context, array);
+ g_ptr_array_free(array, TRUE);
+ return TRUE;
+ }
}
static gboolean bluetooth_map_get_message_list(BluetoothMapAgent *agent,
DBusGMethodInvocation *context)
{
GPtrArray *array = g_ptr_array_new();
- MSG_FOLDER_ID_T folder_id = 0;
- int i = 0;
- MSG_FOLDER_LIST_S g_folderList;
- MSG_SORT_RULE_S sortRule;
- MSG_LIST_S msg_list;
- GValue *value = NULL;
+ GValue value;
+ GError *error = NULL;
+
char msg_handle[BT_MAP_MSG_HANDLE_MAX] = {0,};
char msg_type[BT_MAP_MSG_INFO_MAX] = {0,};
- char msg_datetime[BT_MAP_MSG_INFO_MAX] = {0,};
+ char msg_datetime[BT_MAP_TIMESTAMP_MAX_LEN] = {0,};
char *folder = NULL;
- int vconf_err = 0;
+ char *type = NULL;
+ int i = 0;
int account_id = 0;
- emf_mailbox_t *mailbox_list = NULL;
int mailbox_count = 0;
- emf_mail_list_item_t *mail_list = NULL;
int mail_count = 0;
- emf_mailbox_t mailbox;
int total = 0;
- int unseen = 0;
- bool msg_ret = TRUE;
- GError *error = NULL;
+ gboolean msg_ret = TRUE;
+ int ret = 0;
+ int folder_id = 0;
+
+ msg_struct_list_s g_folderList;
+ msg_struct_list_s msg_list;
+
+ email_mailbox_t *mailbox_list = NULL;
+ email_mail_list_item_t *mail_list = NULL;
+ email_list_filter_t *filter_list = NULL;
+ email_list_sorting_rule_t *sorting_rule_list = NULL;
if (g_msg_handle == NULL) {
msg_ret = FALSE;
goto email;
}
- value = g_new0(GValue, 1);
-
folder = strrchr(folder_name, '/');
-
if (NULL == folder)
folder = folder_name;
else
folder++;
- if (msg_get_folder_list(g_msg_handle, &g_folderList) != MSG_SUCCESS) {
+ ret = msg_get_folder_list(g_msg_handle, &g_folderList);
+ if (ret != MSG_SUCCESS) {
msg_ret = FALSE;
goto email;
}
- for (i = 0; i < g_folderList.nCount; i++)
- if (!g_ascii_strncasecmp(folder,
- g_folderList.folderInfo[i].folderName,
- strlen(folder)))
- folder_id = g_folderList.folderInfo[i].folderId;
+ for (i = 0; i < g_folderList.nCount; i++) {
+ msg_struct_t pFolder = g_folderList.msg_struct_info[i];
+ char folderName[BT_MAP_MSG_INFO_MAX] = {0, };
+
+ ret = msg_get_str_value(pFolder, MSG_FOLDER_INFO_NAME_STR,
+ folderName, BT_MAP_MSG_INFO_MAX);
+ if (ret != MSG_SUCCESS)
+ continue;
+
+ if (!g_ascii_strncasecmp(folder, folderName, strlen(folder))) {
+ ret = msg_get_int_value(pFolder, MSG_FOLDER_INFO_ID_INT, &folder_id);
+ if (ret != MSG_SUCCESS) {
+ msg_ret = FALSE;
+ } else {
+ DBG("folder_id %d \n", folder_id);
+ }
+ break;
+ }
+ }
+ if (msg_ret == FALSE)
+ goto email;
+
+ /* Need to apply filter on the code based on remote request */
if (MSG_SUCCESS != msg_get_folder_view_list(g_msg_handle,
- folder_id, &sortRule, &msg_list)) {
+ folder_id, NULL, &msg_list)) {
msg_ret = FALSE;
goto email;
}
for (i = 0; i < msg_list.nCount; i++) {
- time_t *time = NULL;
- struct tm local_time = {0,};
+ int dptime;
+ int m_id = 0;
+ int m_type = 0;
- memset(value, 0, sizeof(GValue));
- g_value_init(value, DBUS_STRUCT_MESSAGE_LIST);
- g_value_take_boxed(value, dbus_g_type_specialized_construct(
+ memset(&value, 0, sizeof(GValue));
+ g_value_init(&value, DBUS_STRUCT_MESSAGE_LIST);
+ g_value_take_boxed(&value, dbus_g_type_specialized_construct(
DBUS_STRUCT_MESSAGE_LIST));
+ ret = msg_get_int_value(msg_list.msg_struct_info[i],
+ MSG_MESSAGE_ID_INT, &m_id);
+ if (ret != MSG_SUCCESS)
+ continue;
+
snprintf(msg_handle, sizeof(msg_handle), "%d%s",
- msg_get_message_id(msg_list.msgInfo[i]),
+ m_id,
BT_MAP_SMS);
- time = msg_get_time(msg_list.msgInfo[i]);
+ ret = msg_get_int_value(msg_list.msg_struct_info[i],
+ MSG_MESSAGE_DISPLAY_TIME_INT, &dptime);
+ if (ret == MSG_SUCCESS)
+ __get_msg_timestamp((time_t *)&dptime, msg_datetime);
- if (NULL != time)
- localtime_r(time, &local_time);
+ msg_get_int_value(msg_list.msg_struct_info[i],
+ MSG_MESSAGE_TYPE_INT, &m_type);
- snprintf(msg_datetime, sizeof(msg_datetime), "%d%d%dT%d%d%d",
- local_time.tm_year, local_time.tm_mon,
- local_time.tm_mday, local_time.tm_hour,
- local_time.tm_min, local_time.tm_sec);
-
- switch (msg_get_message_type(msg_list.msgInfo[i])) {
+ switch (m_type) {
case MSG_TYPE_SMS:
- g_strlcpy(msg_type, "SMS_GSM", sizeof(msg_type));
+ g_strlcpy(msg_type, "SMS_GSM", sizeof(msg_type));
break;
case MSG_TYPE_MMS:
- g_strlcpy(msg_type, "MMS", sizeof(msg_type));
+ g_strlcpy(msg_type, "MMS", sizeof(msg_type));
break;
default:
- g_strlcpy(msg_type, "UNKNOWN", sizeof(msg_type));
+ g_strlcpy(msg_type, "UNKNOWN", sizeof(msg_type));
break;
}
- dbus_g_type_struct_set(value, 0, msg_handle,
+
+ dbus_g_type_struct_set(&value, 0, msg_handle,
1, msg_type,
2, msg_datetime,
G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(value));
+ g_ptr_array_add(array, g_value_get_boxed(&value));
}
email:
- vconf_err = vconf_get_int(BT_MAP_EMAIL_DEFAULTACCOUNT, &account_id);
- if (vconf_err == -1) {
+ if (EMAIL_ERROR_NONE != email_load_default_account_id(&account_id)) {
if (!msg_ret)
- goto fail;
+ goto fail;
}
- if (EMF_ERROR_NONE != email_get_mailbox_list(account_id,
- EMF_MAILBOX_ALL,
+ if (EMAIL_ERROR_NONE != email_get_mailbox_list(account_id,
+ EMAIL_MAILBOX_ALL,
&mailbox_list,
&mailbox_count)) {
if (!msg_ret)
- goto fail;
+ goto fail;
}
- for (i = 0; i < mailbox_count; i++)
- if (!g_ascii_strncasecmp(mailbox_list[i].name, folder,
- strlen(mailbox_list[i].name)))
- folder_id = mailbox_list[i].account_id;
- memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- mailbox.account_id = folder_id;
- mailbox.name = strdup(folder);
- if (EMF_ERROR_NONE != email_count_message(&mailbox, &total, &unseen)) {
- if (!msg_ret)
+ if (mailbox_list == NULL)
goto fail;
- }
- if (mailbox.name != NULL)
- free(mailbox.name);
+ for (i = 0; i < mailbox_count; i++) {
+ DBG("mailbox alias = %s \n", mailbox_list[i].alias);
+ if (!g_ascii_strncasecmp(mailbox_list[i].alias, folder,
+ strlen(mailbox_list[i].alias))) {
+ total = mailbox_list[i].total_mail_count_on_server;
+ DBG("Total mail on sever : %d \n", total);
+ DBG("mailbox name : %s \n", mailbox_list[i].mailbox_name);
+
+ break;
+ }
- if (EMF_ERROR_NONE != email_get_mail_list_ex(folder_id, folder,
- EMF_LIST_TYPE_NORMAL,
- 0, total - 1, EMF_SORT_DATETIME_HIGH,
- &mail_list, &mail_count)) {
if (!msg_ret)
- goto fail;
+ goto fail;
+ else
+ goto done;
+ }
+
+ /* Need to modify the filter code, have to make it dynamic based on remote device request*/
+ /* Also to check whether it needs to be done in agent or in obexd */
+
+ filter_list = g_new0(email_list_filter_t, 3);
+ filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
+ filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
+ filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_EQUAL;
+ filter_list[0].list_filter_item.rule.key_value.integer_type_value = account_id;
+
+ filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+ filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_AND;
+
+ filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
+ filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_MAILBOX_NAME;
+ filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_EQUAL;
+ type = g_strdup(mailbox_list[i].mailbox_name);
+ filter_list[2].list_filter_item.rule.key_value.string_type_value = type;
+ filter_list[2].list_filter_item.rule.case_sensitivity = true;
+
+ sorting_rule_list = g_new0(email_list_sorting_rule_t, 1);
+ sorting_rule_list->target_attribute = EMAIL_MAIL_ATTRIBUTE_DATE_TIME;
+ sorting_rule_list->sort_order = EMAIL_SORT_ORDER_ASCEND;
+
+ ret = email_get_mail_list_ex(filter_list, 3,
+ sorting_rule_list, 1, 0, total - 1,
+ &mail_list, &mail_count);
+
+ DBG("email API ret %d \n", ret);
+ if (ret != EMAIL_ERROR_NONE) {
+ if (!msg_ret) {
+ g_free(type);
+ g_free(filter_list);
+ g_free(sorting_rule_list);
+ goto fail;
+ } else
+ goto done;
}
for (i = 0; i < mail_count; ++i) {
- memset(value, 0, sizeof(GValue));
- g_value_init(value, DBUS_STRUCT_MESSAGE_LIST);
- g_value_take_boxed(value, dbus_g_type_specialized_construct(
+ time_t time = {0,};
+ memset(&value, 0, sizeof(GValue));
+ g_value_init(&value, DBUS_STRUCT_MESSAGE_LIST);
+ g_value_take_boxed(&value, dbus_g_type_specialized_construct(
DBUS_STRUCT_MESSAGE_LIST));
snprintf(msg_handle, sizeof(msg_handle), "%d%s",
BT_MAP_EMAIL);
g_strlcpy(msg_type, "EMAIL", sizeof(msg_type));
- /*Dummy for testing purpose*/
- snprintf(msg_datetime, sizeof(msg_datetime), "%dT%d", 2011, 12);
- dbus_g_type_struct_set(value, 0, msg_handle,
+ time = mail_list[i].date_time;
+ __get_msg_timestamp(&time, msg_datetime);
+
+ dbus_g_type_struct_set(&value, 0, msg_handle,
1, msg_type,
2, msg_datetime, G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(value));
+ g_ptr_array_add(array, g_value_get_boxed(&value));
}
+done:
if (mailbox_list != NULL)
email_free_mailbox(&mailbox_list, mailbox_count);
if (mail_list != NULL)
g_free(mail_list);
dbus_g_method_return(context, array);
g_ptr_array_free(array, TRUE);
- g_free(value);
+ g_free(type);
+ g_free(filter_list);
+ g_free(sorting_rule_list);
return TRUE;
fail:
if (mail_list != NULL)
g_free(mail_list);
g_ptr_array_free(array, TRUE);
- g_free(value);
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;
FILE *body_file = NULL;
- GValue *value = NULL;
- int vconf_err = 0;
+ GValue value = { 0, };
int account_id = 0;
GPtrArray *array = g_ptr_array_new();
- emf_mailbox_t mailbox;
- emf_mail_data_t *mail_data = NULL;
+ email_mail_data_t *mail_data = NULL;
int nread = 0;
char *buf = NULL;
long l_size = 0;
- msg_message_t msg;
- MSG_ERROR_T msg_err = MSG_SUCCESS;
- MSG_SENDINGOPT_S sendOpt = { 0 };
+
GError *error = NULL;
if (message_name != NULL) {
goto fail;
message_id = atoi(pch);
+ DBG("message_id %d \n", message_id);
pch = strtok_r(NULL, "_", &last);
} else
goto fail;
- value = g_new0(GValue, 1);
-
- g_value_init(value, DBUS_STRUCT_STRING_STRING_UINT);
- g_value_take_boxed(value, dbus_g_type_specialized_construct(
+ g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
+ g_value_take_boxed(&value, dbus_g_type_specialized_construct(
DBUS_STRUCT_STRING_STRING_UINT));
if (!g_ascii_strncasecmp(pch, "s", 1)) {
if (g_msg_handle == NULL)
goto fail;
- msg = msg_new_message();
+ int msg_size = 0;
+ msg_error_t msg_err = MSG_SUCCESS;
+ msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
+ msg_struct_t send_opt = msg_create_struct(MSG_STRUCT_SENDOPT);
+
msg_err = msg_get_message(g_msg_handle,
- (MSG_MESSAGE_ID_T)message_id,
- msg, &sendOpt);
- if (msg_err == MSG_SUCCESS) {
- dbus_g_type_struct_set(value, 0,
- msg_sms_get_message_body(msg),
- G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(value));
+ (msg_message_id_t)message_id, msg, send_opt);
+ if (msg_err != MSG_SUCCESS)
+ goto fail;
+
+ msg_err = msg_get_int_value(msg,
+ MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
+ if (msg_err != MSG_SUCCESS) {
+ msg_release_struct(&msg);
+ goto fail;
}
- msg_release_message(&msg);
- } else if (!g_ascii_strncasecmp(pch, "e", 1)) {
- vconf_err = vconf_get_int(BT_MAP_EMAIL_DEFAULTACCOUNT,
- &account_id);
- if (vconf_err == -1)
+
+ buf = (char *)calloc(msg_size, sizeof(char));
+ if (NULL == buf)
goto fail;
- memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- mailbox.account_id = account_id;
+ msg_err = msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR,
+ buf, msg_size);
+ if (msg_err != MSG_SUCCESS) {
+ msg_release_struct(&msg);
+ goto fail;
+ }
+
+ dbus_g_type_struct_set(&value, 0,
+ buf, G_MAXUINT);
+ g_ptr_array_add(array, g_value_get_boxed(&value));
- if (EMF_ERROR_NONE == email_get_mail_data(message_id, &mail_data)) {
+ msg_release_struct(&msg);
+ } else if (!g_ascii_strncasecmp(pch, "e", 1)) {
+ if (EMAIL_ERROR_NONE != email_load_default_account_id(&account_id))
+ goto fail;
+
+ if (EMAIL_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(mail_data->file_path_html, "rb");
goto fail;
nread = fread(buf, 1, l_size, body_file);
-
if (nread != l_size)
goto fail;
- dbus_g_type_struct_set(value, 0, buf,
+ dbus_g_type_struct_set(&value, 0, buf,
G_MAXUINT);
g_ptr_array_add(array,
- g_value_get_boxed(value));
+ g_value_get_boxed(&value));
}
}
}
dbus_g_method_return(context, array);
- g_free(value);
g_ptr_array_free(array, TRUE);
if (body_file != NULL)
fclose(body_file);
email_free_mail_data(&mail_data, 1);
return TRUE;
fail:
- g_free(value);
g_ptr_array_free(array, TRUE);
if (body_file != NULL)
fclose(body_file);
free(buf);
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);
DBusGMethodInvocation *context)
{
unsigned handle = 0;
- int err = EMF_ERROR_NONE;
+ int err;
err = email_sync_header_for_all_account(&handle);
- if (err == EMF_ERROR_NONE) {
+ if (err == EMAIL_ERROR_NONE) {
DBG("Handle to stop download = %d \n", handle);
} else {
ERR("Message Update failed \n");
}
dbus_g_method_return(context, err);
- return (err == EMF_ERROR_NONE) ? TRUE : FALSE;
+ return (err == EMAIL_ERROR_NONE) ? TRUE : FALSE;
}
static gboolean bluetooth_map_message_status(BluetoothMapAgent *agent,
char *pch = NULL;
char *last = NULL;
int message_id = 0;
- emf_mailbox_t mailbox;
- emf_mail_data_t *mail_data = NULL;
- msg_message_t msg;
- MSG_ERROR_T err = MSG_SUCCESS;
- MSG_SENDINGOPT_S sendOpt = { 0 };
+ email_mail_data_t *mail_data = NULL;
int ret = 0;
- bool flag = FALSE;
+ gboolean flag = FALSE;
GError *error = NULL;
DBG("bluetooth_map_message_status");
if (!g_ascii_strncasecmp(pch, "s", 1)) {
switch (indicator) {
case BT_MSG_UPDATE:{
- msg = msg_new_message();
- err = msg_get_message(g_msg_handle,
- (MSG_MESSAGE_ID_T)message_id, msg,
- &sendOpt);
- if (err != MSG_SUCCESS) {
- msg_release_message(&msg);
+ msg_error_t msg_err = MSG_SUCCESS;
+ msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
+ msg_struct_t send_opt = msg_create_struct(MSG_STRUCT_SENDOPT);
+ int msg_type = 0;
+ bool read_status = true;
+
+
+ msg_err = msg_get_message(g_msg_handle,
+ (msg_message_id_t)message_id, msg,
+ send_opt);
+ if (msg_err != MSG_SUCCESS) {
+ msg_release_struct(&msg);
goto done;
}
- if (!msg_is_read(msg)) {
+ msg_err = msg_get_bool_value(msg, MSG_MESSAGE_READ_BOOL,
+ &read_status);
+ if (msg_err != MSG_SUCCESS) {
+ msg_release_struct(&msg);
+ goto done;
+ }
+
+ msg_err = msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT,
+ &msg_type);
+ if (msg_err != MSG_SUCCESS) {
+ msg_release_struct(&msg);
+ goto done;
+ }
+
+
+ if (read_status == false) {
DBG(" Message is UNREAD \n");
ret = msg_update_read_status(
g_msg_handle, message_id, TRUE);
- if (msg_is_mms(msg)) {
+ if (__bt_msg_is_mms(msg_type)) {
ret = msg_mms_send_read_report(
g_msg_handle,
message_id,
g_msg_handle,
message_id, FALSE);
- if (msg_is_mms(msg)) {
+ if (__bt_msg_is_mms(msg_type)) {
ret = msg_mms_send_read_report(
g_msg_handle,
message_id,
MSG_READ_REPORT_NONE);
}
}
+
if (ret == MSG_SUCCESS)
flag = TRUE;
- msg_release_message(&msg);
+
+ msg_release_struct(&msg);
break;
}
} else if (!g_ascii_strncasecmp(pch, "e", 1)) {
switch (indicator) {
case 0: {
- emf_mail_flag_t newflag;
- memset(&newflag, 0x00, sizeof(emf_mail_flag_t));
- newflag.seen = !newflag.seen;
- newflag.answered = 0;
- newflag.sticky = 1;
-
- if (email_modify_mail_flag(message_id, newflag,
- 1) < 0) {
- ERR("email_modify_mail_flag failed \n");
+ if (email_get_mail_data(message_id, &mail_data) != EMAIL_ERROR_NONE) {
+ ERR("email_get_mail_data failed\n");
+ flag = FALSE;
+ break;
+ }
+
+ if (email_set_flags_field(mail_data->account_id, &message_id, 1,
+ EMAIL_FLAGS_SEEN_FIELD, 1, 0) != EMAIL_ERROR_NONE) {
+
+ ERR("email_set_flags_field failed \n");
flag = FALSE;
} else {
- DBG("email_modify_mail_flag success \n");
+ DBG("email_set_flags_field success \n");
flag = TRUE;
}
break;
}
case 1: {
- memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- if (email_get_mail_data(message_id, &mail_data) < 0) {
+ if (email_get_mail_data(message_id, &mail_data) != EMAIL_ERROR_NONE) {
ERR("email_get_mail failed\n");
} else {
DBG("email_get_mail success\n");
- if (email_delete_message(&mailbox, &message_id,
- 1, 1) >= 9) {
- DBG("\n email_delete_message success");
+ if (email_delete_mail(mail_data->mailbox_id, &message_id,
+ 1, 1) == EMAIL_ERROR_NONE) {
+ DBG("\n email_delete_mail success");
flag = TRUE;
} else {
- ERR("\n email_delete_message failed");
+ ERR("\n email_delete_mail failed");
flag = FALSE;
}
email_free_mail_data(&mail_data, 1);
dbus_g_method_return(context, ret);
else {
error = __bt_map_agent_error(BT_MAP_AGENT_ERROR_INTERNAL,
- "InternalError");
+ "InternalError");
dbus_g_method_return_error(context, error);
g_error_free(error);
}
BT_MAP_SERVICE_OBJECT_PATH,
G_OBJECT(bluetooth_map_obj));
+ if (__bluetooth_map_start_service() == FALSE)
+ goto failure;
+
g_main_loop_run(mainloop);
failure:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(bluetooth-pb-agent C)
-SET(SRCS bluetooth_pb_agent.c)
-SET(APP_VENDOR samsung)
+SET(SRCS bluetooth_pb_agent.c bluetooth_pb_vcard.c)
+SET(APP_VENDOR tizen)
SET(APP_NAME bluetooth-pb-agent)
SET(APP_DIR /usr/bin)
SET(APP_LOCALEDIR /usr/share/locale)
* Contact: Hocheol Seo <hocheol.seo@samsung.com>
* Girishashok Joshi <girish.joshi@samsung.com>
* Chanyeol Park <chanyeol.park@samsung.com>
+ * Jaekyun Lee <jkyun.leek@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <signal.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
-#include <time.h>
#include <contacts-svc.h>
-#include "vconf.h"
-#include "vconf-keys.h"
-
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "bluetooth_pb_agent.h"
+#include "bluetooth_pb_vcard.h"
-#define CALL_LOG_VCARD "BEGIN:VCARD\r\n" \
- "VERSION:2.1\r\n" \
- "N:%s;%s\r\n" \
- "TEL:%s\r\n" \
- "X-IRMC-CALL-DATETIME;%s:%s\r\n" \
- "END:VCARD\r\n"
-
-#define PBAP_OWNER_VCARD "BEGIN:VCARD\r\n" \
- "VERSION:2.1\r\n" \
- "TEL:%s\r\n" \
- "END:VCARD\r\n"
-
-#define PBAP_EMPTY_VCARD "BEGIN:VCARD\r\n" \
- "VERSION:2.1\r\n" \
- "END:VCARD\r\n"
-
-#define VCARD_NO_NAME "Noname"
-#define MAX_CONTACT_NAME_LEN 256
-#define MAX_CONTACT_NUM_LEN 20
-#define PBAP_OWNER_VCARD_MAX_LEN 255
-#define VCARD_MAX_LEN 3000
-
-#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 {
+typedef enum {
TELECOM_NONE = 0,
TELECOM_PB,
TELECOM_ICH,
TELECOM_OCH,
TELECOM_MCH,
- TELECOM_CCH,
-};
+ TELECOM_CCH
+} PhoneBookType;
typedef struct {
GObject parent;
typedef struct {
GObjectClass parent;
+
+ void (*clear) (BluetoothPbAgent *agent);
} BluetoothPbAgentClass;
+
+enum {
+ CLEAR,
+ LAST_SIGNAL
+};
+
GType bluetooth_pb_agent_get_type(void);
#define BLUETOOTH_PB_TYPE_AGENT (bluetooth_pb_agent_get_type())
#define BLUETOOTH_PB_AGENT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
BLUETOOTH_PB_TYPE_AGENT , BluetoothPbAgentClass))
-#define BLUETOOTH_PB_IS_AGENT(object) \
+#define BLUETOOTH_IS_PB_AGENT(object) \
(G_TYPE_CHECK_INSTANCE_TYPE((object), \
BLUETOOTH_PB_TYPE_AGENT))
-#define BLUETOOTH_PB_IS_AGENT_CLASS(klass) \
+#define BLUETOOTH_IS_PB_AGENT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), \
BLUETOOTH_PB_TYPE_AGENT))
#define BLUETOOTH_PB_AGENT_GET_CLASS(obj) \
G_DEFINE_TYPE(BluetoothPbAgent, bluetooth_pb_agent, G_TYPE_OBJECT)
-GMainLoop *mainloop = NULL;
+#define DBUS_STRUCT_STRING_STRING_UINT (dbus_g_type_get_struct("GValueArray", G_TYPE_STRING, \
+ G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID))
+
+static guint signals[LAST_SIGNAL] = { 0 };
+static GMainLoop *mainloop = NULL;
+
+static GHashTable *contact_list_hash = NULL;
+
+static PhoneBookType g_current_pb_type = TELECOM_NONE;
+
+static void bluetooth_pb_agent_finalize(GObject *obj);
+
+static void bluetooth_pb_agent_clear(BluetoothPbAgent *agent);
+
+/* Dbus messages */
static gboolean bluetooth_pb_get_phonebook(BluetoothPbAgent *agent,
- gushort max_list,
- gushort offset,
+ const char *name,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_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,
+static gboolean bluetooth_pb_get_phonebook_list(BluetoothPbAgent *agent,
+ const char *name,
DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_phonebook_list(BluetoothPbAgent *agent,
+static gboolean bluetooth_pb_get_phonebook_entry(BluetoothPbAgent *agent,
+ const gchar *folder,
+ const gchar *id,
+ guint64 filter,
+ guint8 format,
DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_calls_list(BluetoothPbAgent *agent,
- gchar *call_type,
- DBusGMethodInvocation *context);
+static gboolean bluetooth_pb_get_phonebook_size_at(BluetoothPbAgent *agent,
+ const gchar *command,
+ DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_phonebook_entry(BluetoothPbAgent *agent,
- gchar *id,
- DBusGMethodInvocation *context);
+static gboolean bluetooth_pb_get_phonebook_entries_at(BluetoothPbAgent *agent,
+ const gchar *command,
+ gint32 start_index,
+ gint32 end_index,
+ DBusGMethodInvocation *context);
+
+static gboolean bluetooth_pb_get_phonebook_entries_find_at(BluetoothPbAgent *agent,
+ const gchar *command,
+ const gchar *find_text,
+ DBusGMethodInvocation *context);
-static gboolean bluetooth_pb_get_calls_entry(BluetoothPbAgent *agent,
- gchar *id,
- DBusGMethodInvocation *context);
+static gboolean bluetooth_pb_get_total_object_count(BluetoothPbAgent *agent,
+ gchar *path,
+ DBusGMethodInvocation *context);
static gboolean bluetooth_pb_add_contact (BluetoothPbAgent *agent,
const char *filename,
- GError **error);
+ GError **error);
+static void __bluetooth_pb_dbus_return_error(DBusGMethodInvocation *context,
+ gint code,
+ const gchar *message);
-static unsigned int __bluetooth_pb_get_call_size(const enum PhoneBookObject pb_oject);
+static PhoneBookType __bluetooth_pb_get_pb_type(const char *name);
-#include "bluetooth_pb_agent_glue.h"
+static PhoneBookType __bluetooth_pb_get_storage_pb_type(const char *name);
-static void bluetooth_pb_agent_init(BluetoothPbAgent *obj)
-{
- DBG("+\n");
- g_assert(obj != NULL);
-}
+static unsigned int __bluetooth_pb_get_contact_size(void);
-static void bluetooth_pb_agent_finalize(GObject *obj)
-{
- DBG("+\n");
+static unsigned int __bluetooth_pb_get_incoming_call_size(void);
- G_OBJECT_CLASS(bluetooth_pb_agent_parent_class)->finalize(obj);
-}
+static unsigned int __bluetooth_pb_get_outgoing_call_size(void);
-static void bluetooth_pb_agent_class_init(BluetoothPbAgentClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
+static unsigned int __bluetooth_pb_get_missed_call_size(void);
- g_assert(klass != NULL);
+static unsigned int __bluetooth_pb_get_combined_call_size(void);
- object_class->finalize = bluetooth_pb_agent_finalize;
- dbus_g_object_type_install_info(BLUETOOTH_PB_TYPE_AGENT,
- &dbus_glib_bluetooth_pb_object_info);
-}
+static GPtrArray *__bluetooth_pb_get_contact_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset);
-static gboolean bluetooth_pb_get_phonebook_size(BluetoothPbAgent *agent,
- const char *name,
- DBusGMethodInvocation *context)
-{
- unsigned int phonebook_size = 0;
+static GPtrArray *__bluetooth_pb_get_incoming_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset);
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
+static GPtrArray *__bluetooth_pb_get_outgoing_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset);
- if (name == NULL) {
- GError *error = NULL;
- GQuark quark;
+static GPtrArray *__bluetooth_pb_get_missed_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset);
- quark = g_type_qname(bluetooth_pb_agent_get_type());
- error = g_error_new(quark, -1, "No name defined");
+static GPtrArray *__bluetooth_pb_get_combined_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset);
- DBG("no name defined\n");
+static void __bluetooth_pb_create_contact_index(PhoneBookType pb_type);
- dbus_g_method_return_error(context, error);
+static void __bluetooth_pb_create_call_index(PhoneBookType pb_type);
- g_error_free(error);
+static void __bluetooth_pb_get_contact_list(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ gint start_index,
+ gint end_index,
+ gboolean formatted_name);
- return FALSE;
- }
+static void __bluetooth_pb_get_call_list(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ gint start_index,
+ gint end_index,
+ gboolean formatted_name);
- if (g_strcmp0(name, "/telecom/pb.vcf") == 0) {
- contacts_svc_connect();
+static void __bluetooth_pb_get_contact_list_by_name(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ const gchar *find_text,
+ gboolean formatted_name,
+ gboolean owner);
- phonebook_size = contacts_svc_count(CTS_GET_ALL_CONTACT);
- DBG("Number of contacts is %d\n", phonebook_size);
+static void __bluetooth_pb_get_call_list_by_name(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ const gchar *find_text,
+ gboolean formatted_name);
- contacts_svc_disconnect();
+static int __bluetooth_get_calllog_type(int call_type);
- /* 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);
- }
+static unsigned int __get_call_log_count(unsigned int call_log_type);
- dbus_g_method_return(context, phonebook_size);
- return TRUE;
-}
+static void __bluetooth_pb_list_hash_reset(void);
+static gboolean __bluetooth_pb_list_hash_insert(gint handle,
+ gint id);
-static int __bluetooth_get_calllog_type(int call_type)
-{
- int val = CTS_PLOG_TYPE_NONE;
- switch (call_type) {
- case CTS_PLOG_TYPE_VOICE_INCOMMING:
- case CTS_PLOG_TYPE_VIDEO_INCOMMING:
- val = CTS_PLOG_TYPE_VOICE_INCOMMING;
- break;
+static gint __bluetooth_pb_list_hash_lookup_id(gint handle);
- case CTS_PLOG_TYPE_VOICE_OUTGOING:
- case CTS_PLOG_TYPE_VIDEO_OUTGOING:
- val = CTS_PLOG_TYPE_VOICE_OUTGOING;
- break;
+static guint __bluetooth_pb_list_hash_size(void);
- case CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN:
- case CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN:
- case CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN:
- case CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN:
- val = CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN;
- break;
- default:
- break;
- }
+static void __bluetooth_pb_list_ptr_array_add(GPtrArray *ptr_array,
+ const gchar *name,
+ const gchar *number,
+ gint handle);
- return val;
-}
+static void __bluetooth_pb_list_ptr_array_free(gpointer data);
-static unsigned int __get_call_log_count(unsigned int call_log_type)
-{
- CTSiter *iter = NULL;
- unsigned int count = 0;
+static void __bluetooth_pb_agent_signal_handler(int signum);
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *plog = NULL;
+static void __bluetooth_pb_contact_changed(void *user_data);
- plog = contacts_svc_iter_get_info(iter);
- if (plog) {
- int type = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TYPE_INT);
- DBG("type: %d\n", type);
- int log_type = __bluetooth_get_calllog_type(type);
-
- if ((call_log_type == 0xFF || call_log_type == log_type) &&
- (log_type != CTS_PLOG_TYPE_NONE)) {
- count++;
- }
- }
- }
- return count;
+static void __bluetooth_pb_call_changed(void *user_data);
+
+
+#include "bluetooth_pb_agent_glue.h"
+
+static void bluetooth_pb_agent_init(BluetoothPbAgent *obj)
+{
}
-static gboolean bluetooth_pb_get_total_object_count(BluetoothPbAgent *agent,
- gchar *path, DBusGMethodInvocation *context)
+
+static void bluetooth_pb_agent_class_init(BluetoothPbAgentClass *klass)
{
- unsigned int nr_contact = 0;
+ GObjectClass *object_class = (GObjectClass *) klass;
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
- contacts_svc_connect();
+ klass->clear = bluetooth_pb_agent_clear;
- if ((g_strcmp0(path, "SM") == 0) || (g_strcmp0(path, "ME") == 0)) {
- nr_contact = contacts_svc_count(CTS_GET_ALL_CONTACT);
- } else if (g_strcmp0(path, "DC") == 0) {
- nr_contact = __get_call_log_count(CTS_PLOG_TYPE_VOICE_OUTGOING);
- } else if (g_strcmp0(path, "MC") == 0) {
- nr_contact = __get_call_log_count(CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN);
- } else if (g_strcmp0(path, "RC") == 0) {
- nr_contact = __get_call_log_count(CTS_PLOG_TYPE_VOICE_INCOMMING);
- }
- DBG("Number of contacts is %d\n", nr_contact);
+ object_class->finalize = bluetooth_pb_agent_finalize;
- contacts_svc_disconnect();
+ signals[CLEAR] = g_signal_new("clear",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(BluetoothPbAgentClass, clear),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
+ dbus_g_object_type_install_info(BLUETOOTH_PB_TYPE_AGENT,
+ &dbus_glib_bluetooth_pb_object_info);
+}
- dbus_g_method_return(context, nr_contact);
+static void bluetooth_pb_agent_finalize(GObject *obj)
+{
+ DBG("+\n");
- return TRUE;
+ G_OBJECT_CLASS(bluetooth_pb_agent_parent_class)->finalize(obj);
}
-static void __get_vcard_from_contact(int id, int *vcard_total_len, char **vcard)
+static void bluetooth_pb_agent_clear(BluetoothPbAgent *agent)
{
- int ret;
- int vcard_len;
- char *vcard_stream;
- CTSstruct *contact = NULL;
-
- contacts_svc_get_contact(id, &contact);
-
- ret = contacts_svc_get_vcard_from_contact(contact, &vcard_stream);
- if (CTS_SUCCESS == ret) {
- vcard_len = strlen(vcard_stream);
- *vcard_total_len += vcard_len;
- DBG("len:%d total:%d\n", vcard_len, *vcard_total_len);
- *vcard = strdup(vcard_stream);
- free(vcard_stream);
+ DBG("+\n");
+
+ if (contact_list_hash) {
+ g_hash_table_destroy(contact_list_hash);
+ contact_list_hash = NULL;
}
- contacts_svc_struct_free(contact);
+ g_current_pb_type = TELECOM_NONE;
}
static gboolean bluetooth_pb_get_phonebook(BluetoothPbAgent *agent,
- gushort max_list, gushort offset,
+ const char *name,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset,
DBusGMethodInvocation *context)
{
- int i = 0;
- int nr_contact = 0;
- int vcard_total_len = 0;
-
- CTSiter *iter = NULL;
- static int *contact_id = NULL;
- static int index = 0;
- int last_part = 0;
-
- char **vcard;
-
- DBG("max_list:%d offset:%d\n", max_list, offset);
-
- contacts_svc_connect();
-
- nr_contact = contacts_svc_count(CTS_GET_ALL_CONTACT);
- DBG("Number of contacts is %d\n", nr_contact);
-
- vcard = g_new0(char *, nr_contact + 1);
-
- /* first request */
- if (!contact_id) {
- contact_id = (int *)malloc(nr_contact * sizeof(int));
- if (!contact_id) {
- DBG("malloc error\n");
- contacts_svc_disconnect();
- g_strfreev(vcard);
-
- return FALSE;
- }
-
- contacts_svc_get_list(CTS_LIST_ALL_CONTACT, &iter);
+ PhoneBookType pb_type = TELECOM_NONE;
+ GPtrArray *vcards = NULL;
+ gchar **vcards_str = NULL;
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *row_info = NULL;
- int id;
+ gint new_missed_calls = 0;
- row_info = contacts_svc_iter_get_info(iter);
- id = contacts_svc_value_get_int(row_info,
- CTS_LIST_CONTACT_ID_INT);
- contact_id[i] = id;
+ DBG("\n");
- if (vcard_total_len < VCARD_MAX_LEN) {
- __get_vcard_from_contact(id, &vcard_total_len,
- &vcard[i]);
- DBG("vcard:%s\n", vcard[i]);
- index++;
-
- if (index >= max_list) {
- DBG("Over max list%d\n", max_list);
- break;
- }
- }
-
- contacts_svc_value_free(row_info);
- i++;
- }
- if( NULL != iter ) {
- contacts_svc_iter_remove(iter);
- }
- } else { /* subsequent request */
- while (vcard_total_len < VCARD_MAX_LEN) {
- __get_vcard_from_contact(contact_id[index],
- &vcard_total_len, &vcard[i]);
- DBG("vcard:%s\n", vcard[i]);
-
- index++;
- i++;
+ pb_type = __bluetooth_pb_get_pb_type(name);
- if (index >= nr_contact || index >= max_list) {
- DBG("Complete\n");
- break;
- }
- }
- }
- contacts_svc_disconnect();
+ switch (pb_type) {
+ case TELECOM_PB:
+ vcards = __bluetooth_pb_get_contact_vcards(agent,
+ filter, format,
+ max_list_count, list_start_offset);
+ break;
+ case TELECOM_ICH:
+ vcards = __bluetooth_pb_get_incoming_call_vcards(agent,
+ filter, format,
+ max_list_count, list_start_offset);
+ break;
+ case TELECOM_OCH:
+ vcards = __bluetooth_pb_get_outgoing_call_vcards(agent,
+ filter, format,
+ max_list_count, list_start_offset);
+ break;
+ case TELECOM_MCH:
+ vcards = __bluetooth_pb_get_missed_call_vcards(agent,
+ filter, format,
+ max_list_count, list_start_offset);
+ break;
+ case TELECOM_CCH:
+ vcards = __bluetooth_pb_get_combined_call_vcards(agent,
+ filter, format,
+ max_list_count, list_start_offset);
+ break;
+ default: {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
+ return FALSE;
+ }
- if (index >= nr_contact || index >= max_list) {
- free(contact_id);
- contact_id = NULL;
- index = 0;
- last_part = 1;
}
- dbus_g_method_return(context, last_part, vcard);
+ if (vcards)
+ vcards_str = (gchar **) g_ptr_array_free(vcards, FALSE);
+
+ /* TODO : new_missed_calls need to implement */
+ dbus_g_method_return(context, vcards_str, new_missed_calls);
- g_strfreev(vcard);
+ g_strfreev(vcards_str);
- return TRUE;
+ return TRUE;
}
-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)
{
- int call_log_type;
- int i = 0;
- char **vcard;
- char vcard_buffer[256] = {0,};
- CTSiter *iter = NULL;
-
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
- contacts_svc_connect();
-
- if (strncmp(call_type, "incoming", 8) == 0)
- call_log_type = CTS_PLOG_TYPE_VOICE_INCOMMING;
- else if (strncmp(call_type, "outgoing", 8) == 0)
- call_log_type = CTS_PLOG_TYPE_VOICE_OUTGOING;
- else if (strncmp(call_type, "missed", 6) == 0)
- call_log_type = CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN;
- else
- call_log_type = 0xFF;
-
- vcard = g_new0(char *, max_list + 1);
-
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
-
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *plog = NULL;
-
- plog = contacts_svc_iter_get_info(iter);
- if (plog) {
- struct tm timeinfo;
- char log_time_stamp[32] = {0,};
- char calllog_type[10] = {0,};
- int type = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TYPE_INT);
- DBG("type: %d\n", type);
- int log_type = __bluetooth_get_calllog_type(type);
-
- const char *number = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_NUMBER_STR);
- const char *first_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_FIRST_NAME_STR);
- const char *last_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_LAST_NAME_STR);
-
- time_t time = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TIME_INT);
-
- if (!number) {
- contacts_svc_value_free(plog);
- continue;
- }
- if (!first_name)
- first_name = "";
- if (!last_name)
- last_name = "";
-
- localtime_r(&time, &timeinfo);
-
- strftime(log_time_stamp, sizeof(log_time_stamp),
- "%Y%m%dT%H%M%S", &timeinfo);
-
- if (log_type == CTS_PLOG_TYPE_VOICE_INCOMMING)
- strncpy(calllog_type, "RECEIVED", strlen("RECEIVED"));
- else if (log_type == CTS_PLOG_TYPE_VOICE_OUTGOING)
- strncpy(calllog_type, "DIALED", strlen("DIALED"));
- else if (log_type == CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN)
- strncpy(calllog_type, "MISSED", strlen("MISSED"));
- else {
- DBG("no log type found \n");
- }
-
- if ((call_log_type == 0xFF || call_log_type == log_type) &&
- (log_type != CTS_PLOG_TYPE_NONE)) {
-
- snprintf(vcard_buffer, sizeof(vcard_buffer), CALL_LOG_VCARD,
- last_name, first_name, number, calllog_type, log_time_stamp);
+ PhoneBookType pb_type = TELECOM_NONE;
+ unsigned int phonebook_size = 0;
- vcard[i] = strdup((char *)vcard_buffer);
- DBG("%s() %d [%d] %s\n", __FUNCTION__, __LINE__, i, vcard[i]);
- i++;
- }
+ DBG("\n");
- contacts_svc_value_free(plog);
+ pb_type = __bluetooth_pb_get_pb_type(name);
- if (i >= max_list) {
- DBG("Over max list count %d\n", max_list);
- break;
- }
- }
+ switch (pb_type) {
+ case TELECOM_PB:
+ phonebook_size = __bluetooth_pb_get_contact_size();
+ break;
+ case TELECOM_ICH:
+ phonebook_size = __bluetooth_pb_get_incoming_call_size();
+ break;
+ case TELECOM_OCH:
+ phonebook_size = __bluetooth_pb_get_outgoing_call_size();
+ break;
+ case TELECOM_MCH:
+ phonebook_size = __bluetooth_pb_get_missed_call_size();
+ break;
+ case TELECOM_CCH:
+ phonebook_size = __bluetooth_pb_get_combined_call_size();
+ break;
+ default: {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
+ return FALSE;
}
- if( NULL != iter ) {
- contacts_svc_iter_remove(iter);
}
- contacts_svc_disconnect();
-
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
- dbus_g_method_return(context, vcard);
- g_strfreev(vcard);
+ dbus_g_method_return(context, phonebook_size);
return TRUE;
}
+
static gboolean bluetooth_pb_get_phonebook_list(BluetoothPbAgent *agent,
+ const char *name,
DBusGMethodInvocation *context)
{
- unsigned int nr_contact = 0;
- guint ret = 0;
- CTSiter *iter = NULL;
- GPtrArray *array = g_ptr_array_new();
- char *subscriber_number = NULL;
-
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
+ PhoneBookType pb_type = TELECOM_NONE;
- GValue owner_value = {0, };
+ GPtrArray *ptr_array;
- /* owner's vcard 0.vcf */
- g_value_init(&owner_value, DBUS_STRUCT_STRING_STRING_UINT);
- g_value_take_boxed(&owner_value,
- dbus_g_type_specialized_construct(DBUS_STRUCT_STRING_STRING_UINT));
+ DBG("\n");
- subscriber_number = vconf_get_str(VCONFKEY_TELEPHONY_SUBSCRIBER_NUMBER);
- if (NULL == subscriber_number) {
- DBG("vconf_get_int failed for VCONFKEY_TELEPHONY_SUBSCRIBER_NUMBER \n");
+ pb_type = __bluetooth_pb_get_pb_type(name);
- dbus_g_type_struct_set(&owner_value, 0, " ", 1, " ", 2, 0, G_MAXUINT);
- } else {
- dbus_g_type_struct_set(&owner_value, 0, subscriber_number, 1,
- subscriber_number, 2, 0, G_MAXUINT);
+ if (pb_type == TELECOM_NONE) {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
+ return FALSE;
}
- g_ptr_array_add(array, g_value_get_boxed(&owner_value));
-
- if (subscriber_number)
- free(subscriber_number);
+ ptr_array = g_ptr_array_new_with_free_func(__bluetooth_pb_list_ptr_array_free);
- contacts_svc_connect();
+ if (pb_type == TELECOM_PB)
+ __bluetooth_pb_get_contact_list(pb_type, ptr_array, 0, G_MAXINT, FALSE);
+ else
+ __bluetooth_pb_get_call_list(pb_type, ptr_array, 0, G_MAXINT, FALSE);
- nr_contact = contacts_svc_count(CTS_GET_ALL_CONTACT);
- DBG("Number of contacts is %d\n", nr_contact);
+ dbus_g_method_return(context, ptr_array);
- contacts_svc_get_list(CTS_LIST_ALL_CONTACT, &iter);
+ if (ptr_array)
+ g_ptr_array_free(ptr_array, TRUE);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- int index_num;
- char name[MAX_CONTACT_NAME_LEN + 2] = { 0 };
- const char *first = NULL;
- const char *last = NULL;
- const char *default_num = NULL;
+ return TRUE;
+}
- CTSvalue *row_info = NULL;
- CTSvalue *number = NULL;
- GValue value = {0, };
- row_info = contacts_svc_iter_get_info(iter);
+static gboolean bluetooth_pb_get_phonebook_entry(BluetoothPbAgent *agent,
+ const gchar *folder,
+ const gchar *id,
+ guint64 filter,
+ guint8 format,
+ DBusGMethodInvocation *context)
+{
+ PhoneBookType pb_type = TELECOM_NONE;
- if (!row_info) {
- DBG("contacts_svc_iter_get_info failed \n");
- break;
- }
+ gint handle = 0;
+ gint cid = -1;
+ gchar *str = NULL;
- first = contacts_svc_value_get_str(row_info, CTS_LIST_CONTACT_FIRST_STR);
- last = contacts_svc_value_get_str(row_info, CTS_LIST_CONTACT_LAST_STR);
-
- if (first && last) {
- g_strlcpy(name, last, sizeof(name) / 2);
- g_strlcat(name, ";", sizeof(name));
- g_strlcat(name, first, sizeof(name));
- } else if (first) {
- g_strlcpy(name, first, sizeof(name));
- } else if (last) {
- g_strlcpy(name, last, sizeof(name));
- } else {
- g_strlcpy(name, VCARD_NO_NAME, sizeof(name));
- }
+ DBG("\n");
- index_num = contacts_svc_value_get_int(row_info, CTS_LIST_CONTACT_ID_INT);
+ if (!g_str_has_suffix(id, ".vcf")) {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "invalid vcf file");
+ return FALSE;
+ }
- ret = contacts_svc_get_contact_value(CTS_GET_DEFAULT_NUMBER_VALUE, index_num,
- &number);
+ handle = (gint)g_ascii_strtoll(id, NULL, 10);
+ cid = __bluetooth_pb_list_hash_lookup_id(handle);
- if (CTS_SUCCESS != ret) {
- DBG("contacts_svc_get_contact_value() Failed(%d)\n", ret);
- } else {
- default_num = contacts_svc_value_get_str(number, CTS_NUM_VAL_NUMBER_STR);
- DBG("The default Number is %s\n", default_num);
- }
+ DBG("id %s handle%d, cid %d\n", id, handle, cid );
- g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
- g_value_take_boxed(&value,
- dbus_g_type_specialized_construct(DBUS_STRUCT_STRING_STRING_UINT));
- dbus_g_type_struct_set(&value, 0, name, 1, default_num, 2, index_num, G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(&value));
+ pb_type = __bluetooth_pb_get_pb_type(folder);
+ switch (pb_type) {
+ case TELECOM_PB:
+ __bluetooth_pb_create_contact_index(pb_type);
+ str = _bluetooth_pb_vcard_contact(cid, filter, format);
+ break;
+ case TELECOM_ICH:
+ __bluetooth_pb_create_call_index(pb_type);
+ str = _bluetooth_pb_vcard_call(cid, filter, format, "RECEIVED");
+ break;
+ case TELECOM_OCH:
+ __bluetooth_pb_create_call_index(pb_type);
+ str = _bluetooth_pb_vcard_call(cid, filter, format, "DIALED");
+ break;
+ case TELECOM_MCH:
+ __bluetooth_pb_create_call_index(pb_type);
+ str = _bluetooth_pb_vcard_call(cid, filter, format, "MISSED");
+ break;
+ case TELECOM_CCH: {
+ char *attr = NULL;
- if (number)
- contacts_svc_value_free(number);
+ if (_bluetooth_pb_is_incoming_call(cid))
+ attr = "RECEIVED";
+ else if (_bluetooth_pb_is_outgoing_call(cid))
+ attr = "DIALED";
+ else if (_bluetooth_pb_is_missed_call(cid))
+ attr = "MISSED";
- if (row_info)
- contacts_svc_value_free(row_info);
+ __bluetooth_pb_create_call_index(pb_type);
+ str = _bluetooth_pb_vcard_call(cid, filter, format, attr);
+ break;
}
-
- if( NULL != iter ) {
- contacts_svc_iter_remove(iter);
+ default: {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
+ return FALSE;
}
- contacts_svc_disconnect();
-
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
-
- dbus_g_method_return(context, array);
+ }
- g_ptr_array_foreach(array, (GFunc)g_value_array_free, NULL);
- g_ptr_array_free(array, TRUE);
+ dbus_g_method_return(context, str);
+ g_free(str);
return TRUE;
}
-static gboolean bluetooth_pb_get_calls_list(BluetoothPbAgent *agent, gchar *call_type,
- DBusGMethodInvocation *context)
+static gboolean bluetooth_pb_get_phonebook_size_at(BluetoothPbAgent *agent,
+ const gchar *command,
+ DBusGMethodInvocation *context)
{
- int call_log_type;
- char name[256] = {0,};
- GPtrArray *array = g_ptr_array_new();
-
- CTSiter *iter = NULL;
-
- DBG("%s() %d call_type:%s\n", __FUNCTION__, __LINE__, call_type);
+ PhoneBookType pb_type = TELECOM_NONE;
+ unsigned int phonebook_size = 0;
- if (strncmp(call_type, "incoming", 8) == 0)
- call_log_type = CTS_PLOG_TYPE_VOICE_INCOMMING;
- else if (strncmp(call_type, "outgoing", 8) == 0)
- call_log_type = CTS_PLOG_TYPE_VOICE_OUTGOING;
- else if (strncmp(call_type, "missed", 6) == 0)
- call_log_type = CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN;
- else
- call_log_type = 0xFF;
+ DBG("\n");
- contacts_svc_connect();
+ pb_type = __bluetooth_pb_get_storage_pb_type(command);
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
-
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *plog = NULL;
-
- plog = contacts_svc_iter_get_info(iter);
- if (plog) {
- int index = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_ID_INT);
- int type = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TYPE_INT);
- int log_type = __bluetooth_get_calllog_type(type);
- const char *number = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_NUMBER_STR);
- const char *first_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_FIRST_NAME_STR);
- const char *last_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_LAST_NAME_STR);
-
- if (!number) {
- DBG("number is NULL\n");
- contacts_svc_value_free(plog);
- continue;
- }
- DBG("number: %s\n", number);
-
- if (first_name && last_name)
- snprintf(name, sizeof(name), "%s;%s;", last_name, first_name);
- else if (first_name)
- snprintf(name, sizeof(name), ";%s", first_name);
- else if (last_name)
- snprintf(name, sizeof(name), "%s;", last_name);
- else
- strncpy(name, number, sizeof(name) - 1);
-
- if ((call_log_type == 0xFF || call_log_type == log_type) &&
- (log_type != CTS_PLOG_TYPE_NONE)) {
-
- GValue value = {0, };
- g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
- g_value_take_boxed(&value,
- dbus_g_type_specialized_construct(DBUS_STRUCT_STRING_STRING_UINT));
- dbus_g_type_struct_set(&value, 0, name, 1, number, 2, (guint) index,
- G_MAXUINT);
- g_ptr_array_add(array, g_value_get_boxed(&value));
- }
-
- contacts_svc_value_free(plog);
- }
+ switch (pb_type) {
+ case TELECOM_PB:
+ phonebook_size = __bluetooth_pb_get_contact_size();
+ break;
+ case TELECOM_ICH:
+ phonebook_size = __bluetooth_pb_get_incoming_call_size();
+ break;
+ case TELECOM_OCH:
+ phonebook_size = __bluetooth_pb_get_outgoing_call_size();
+ break;
+ case TELECOM_MCH:
+ phonebook_size = __bluetooth_pb_get_missed_call_size();
+ break;
+ default: {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
+ return FALSE;
}
- if( NULL != iter ) {
- contacts_svc_iter_remove(iter);
}
- contacts_svc_disconnect();
-
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
-
- dbus_g_method_return(context, array);
-
- g_ptr_array_foreach(array, (GFunc)g_value_array_free, NULL);
- g_ptr_array_free(array, TRUE);
+ dbus_g_method_return(context, phonebook_size);
return TRUE;
}
-static gboolean bluetooth_pb_get_phonebook_entry(BluetoothPbAgent *agent, gchar *id,
- DBusGMethodInvocation *context)
+static gboolean bluetooth_pb_get_phonebook_entries_at(BluetoothPbAgent *agent,
+ const gchar *command,
+ gint start_index,
+ gint end_index,
+ DBusGMethodInvocation *context)
{
+ PhoneBookType pb_type = TELECOM_NONE;
- int ret = -1;
- int index;
- CTSstruct *contact = NULL;
- char *phonebook_entry = NULL;
-
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
-
- if (sscanf(id, "%d.vcf", &index) != 1) {
- DBG("Failed to get index\n");
- return FALSE;
- }
+ GPtrArray *ptr_array = NULL;
- if (index != 0) {
- contacts_svc_connect();
+ DBG("command %s, start_index %d, end_index %d %s %d\n",
+ command, start_index, end_index, __FILE__, __LINE__);
- DBG("Get %dth phonebook entry\n", index);
- ret = contacts_svc_get_contact(index, &contact);
- if (CTS_SUCCESS == ret) {
- ret = contacts_svc_get_vcard_from_contact(contact, &phonebook_entry);
- if (CTS_SUCCESS == ret) {
- DBG("[%s]\n", phonebook_entry);
+ pb_type = __bluetooth_pb_get_storage_pb_type(command);
- dbus_g_method_return(context, phonebook_entry);
- }
- contacts_svc_struct_free(contact);
- }
- contacts_svc_disconnect();
+ if (pb_type == TELECOM_NONE || pb_type == TELECOM_CCH) {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
+ return FALSE;
}
- if (index == 0 || ret != CTS_SUCCESS) {
- DBG("Get owner vcard\n");
- char *subscriber_number = NULL;
-
- subscriber_number = vconf_get_str(VCONFKEY_TELEPHONY_SUBSCRIBER_NUMBER);
- if (NULL == subscriber_number) {
- DBG("vconf_get_int failed for VCONFKEY_TELEPHONY_SUBSCRIBER_NUMBER \n");
-
- phonebook_entry = strdup(PBAP_EMPTY_VCARD);
- dbus_g_method_return(context, phonebook_entry);
- } else {
- char vcard_buffer[PBAP_OWNER_VCARD_MAX_LEN + 1] = {0,};
-
- if (strlen(subscriber_number) > MAX_CONTACT_NUM_LEN) {
- char temp[MAX_CONTACT_NUM_LEN + 1] = {0,};
- strncpy(temp, subscriber_number, MAX_CONTACT_NUM_LEN);
- snprintf(vcard_buffer, sizeof(vcard_buffer), PBAP_OWNER_VCARD,
- temp);
- } else {
- snprintf(vcard_buffer, sizeof(vcard_buffer), PBAP_OWNER_VCARD,
- subscriber_number);
- DBG(" Owner vcard \n %s \n", vcard_buffer);
- }
+ ptr_array = g_ptr_array_new_with_free_func(__bluetooth_pb_list_ptr_array_free);
- dbus_g_method_return(context, vcard_buffer);
+ if (pb_type == TELECOM_PB)
+ __bluetooth_pb_get_contact_list(pb_type, ptr_array, start_index, end_index, TRUE);
+ else
+ __bluetooth_pb_get_call_list(pb_type, ptr_array, start_index, end_index, TRUE);
- free(subscriber_number);
- }
- }
+ dbus_g_method_return(context, ptr_array);
- if (phonebook_entry)
- free(phonebook_entry);
+ if (ptr_array)
+ g_ptr_array_free(ptr_array, TRUE);
return TRUE;
}
-static gboolean bluetooth_pb_get_calls_entry(BluetoothPbAgent *agent, gchar *id,
- DBusGMethodInvocation *context)
+static gboolean bluetooth_pb_get_phonebook_entries_find_at(BluetoothPbAgent *agent,
+ const gchar *command,
+ const gchar *find_text,
+ DBusGMethodInvocation *context)
{
- int calls_index;
- char *calls_entry;
- char vcard_buffer[256];
- CTSiter *iter = NULL;
+ PhoneBookType pb_type = TELECOM_NONE;
- DBG("%s() %d\n", __FUNCTION__, __LINE__);
- contacts_svc_connect();
+ GPtrArray *ptr_array = NULL;
+
+ pb_type = __bluetooth_pb_get_storage_pb_type(command);
- if (sscanf(id, "%d.vcf", &calls_index) != 1) {
- DBG("Failed to get index\n");
+ if (pb_type == TELECOM_NONE || pb_type == TELECOM_CCH) {
+ __bluetooth_pb_dbus_return_error(context,
+ G_FILE_ERROR_INVAL,
+ "unsupported name defined");
return FALSE;
}
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
+ ptr_array = g_ptr_array_new_with_free_func(__bluetooth_pb_list_ptr_array_free);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *plog = NULL;
+ if (pb_type == TELECOM_PB)
+ __bluetooth_pb_get_contact_list_by_name(pb_type, ptr_array, find_text, TRUE, FALSE);
+ else
+ __bluetooth_pb_get_call_list_by_name(pb_type, ptr_array, find_text, TRUE);
- plog = contacts_svc_iter_get_info(iter);
- if (plog) {
- int index = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_ID_INT);
- const char *number = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_NUMBER_STR);
- const char *first_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_FIRST_NAME_STR);
- const char *last_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_LAST_NAME_STR);
- const char *display_name = contacts_svc_value_get_str(plog,
- CTS_LIST_PLOG_DISPLAY_NAME_STR);
-
- if (!number)
- number = "";
- if (!first_name)
- first_name = "";
- if (!last_name)
- last_name = "";
- if (display_name) {
- DBG("display_name: %s\n", display_name);
- }
+ dbus_g_method_return(context, ptr_array);
- if (calls_index == index) {
- snprintf(vcard_buffer, sizeof(vcard_buffer), CALL_LOG_VCARD,
- last_name, first_name, number);
- calls_entry = vcard_buffer;
- }
+ if (ptr_array)
+ g_ptr_array_free(ptr_array, TRUE);
- contacts_svc_value_free(plog);
- }
- }
+ return TRUE;
+}
- if( NULL != iter ) {
- contacts_svc_iter_remove(iter);
+static gboolean bluetooth_pb_get_total_object_count(BluetoothPbAgent *agent,
+ gchar *path, DBusGMethodInvocation *context)
+{
+ unsigned int nr_contact = 0;
+
+ DBG("%s() %d\n", __FUNCTION__, __LINE__);
+ contacts_svc_connect();
+
+ if ((g_strcmp0(path, "SM") == 0) || (g_strcmp0(path, "ME") == 0)) {
+ nr_contact = contacts_svc_count(CTS_GET_ALL_CONTACT);
+ } else if (g_strcmp0(path, "DC") == 0) {
+ nr_contact = __get_call_log_count(CTS_PLOG_TYPE_VOICE_OUTGOING);
+ } else if (g_strcmp0(path, "MC") == 0) {
+ nr_contact = __get_call_log_count(CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN);
+ } else if (g_strcmp0(path, "RC") == 0) {
+ nr_contact = __get_call_log_count(CTS_PLOG_TYPE_VOICE_INCOMMING);
}
+ DBG("Number of contacts is %d\n", nr_contact);
contacts_svc_disconnect();
DBG("%s() %d\n", __FUNCTION__, __LINE__);
- dbus_g_method_return(context, calls_entry);
+ dbus_g_method_return(context, nr_contact);
return TRUE;
}
+
static int __bluetooth_pb_agent_read_file(const char *file_path, char **stream)
{
FILE *fp = NULL;
return TRUE;
}
+static void __bluetooth_pb_dbus_return_error(DBusGMethodInvocation *context,
+ gint code,
+ const gchar *message)
+{
+ GQuark quark;
+ GError *error = NULL;
+
+ quark = g_type_qname(bluetooth_pb_agent_get_type());
+ error = g_error_new_literal(quark, code, message);
+
+ dbus_g_method_return_error(context, error);
+ g_error_free(error);
+}
+
+static PhoneBookType __bluetooth_pb_get_pb_type(const char *name)
+{
+ gchar *suffix = ".vcf";
+ gint len;
+
+ if (name == NULL)
+ return TELECOM_NONE;
+
+ len = strlen(name);
+
+ if (g_str_has_suffix(name, suffix))
+ len -= strlen(suffix);
+
+ if (len < 0)
+ return TELECOM_NONE;
+
+ if (strncmp(name, "/telecom/pb", len) == 0)
+ return TELECOM_PB;
+
+ if (strncmp(name, "/telecom/ich", len) == 0)
+ return TELECOM_ICH;
+
+ if (strncmp(name, "/telecom/och", len) == 0)
+ return TELECOM_OCH;
+
+ if (strncmp(name, "/telecom/mch", len) == 0)
+ return TELECOM_MCH;
+
+ if (strncmp(name, "/telecom/cch", len) == 0)
+ return TELECOM_CCH;
+
+ return TELECOM_NONE;
+}
+
+static PhoneBookType __bluetooth_pb_get_storage_pb_type(const char *name)
+{
+ if (name == NULL)
+ return TELECOM_NONE;
+
+ if (g_strcmp0(name, "\"ME\"") == 0 )
+ return TELECOM_PB;
+
+ if (g_strcmp0(name, "\"RC\"") == 0)
+ return TELECOM_ICH;
+
+ if (g_strcmp0(name, "\"DC\"") == 0)
+ return TELECOM_OCH;
+
+ if (g_strcmp0(name, "\"MC\"") == 0)
+ return TELECOM_MCH;
+
+ return TELECOM_NONE;
+}
+
+static unsigned int __bluetooth_pb_get_contact_size(void)
+{
+ unsigned int phonebook_size = 0;
+
+ phonebook_size = contacts_svc_count(CTS_GET_ALL_CONTACT);
+ DBG("Number of contacts is %d\n", phonebook_size);
+
+ /* add count for owner (0.vcf) */
+ phonebook_size++;
+
+ return phonebook_size;
+}
-static unsigned int __bluetooth_pb_get_call_size(const enum PhoneBookObject pb_object)
+static unsigned int __bluetooth_pb_get_incoming_call_size(void)
{
CTSiter *iter = NULL;
+
unsigned int call_size = 0;
- int err = 0;
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
- err = contacts_svc_connect();
- if (err != CTS_SUCCESS) {
- DBG("contacts_svc_connect fucntion call [error] = %d \n", err);
- return call_size;
+ while (contacts_svc_iter_next(iter) == CTS_SUCCESS) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ if (_bluetooth_pb_is_incoming_call(phonelog_id))
+ call_size++;
+
+ contacts_svc_value_free(value);
}
- contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+ if (iter)
+ contacts_svc_iter_remove(iter);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
+ return call_size;
+}
+
+static unsigned int __bluetooth_pb_get_outgoing_call_size(void)
+{
+ CTSiter *iter = NULL;
+
+ unsigned int call_size = 0;
+
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+ while (contacts_svc_iter_next(iter) == CTS_SUCCESS) {
CTSvalue *value = NULL;
- int type = 0;
+ gint phonelog_id = 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);
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
- DBG("type : %d\n", type);
+ if (_bluetooth_pb_is_outgoing_call(phonelog_id))
+ call_size++;
- 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;
- }
+ contacts_svc_value_free(value);
}
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)
+static unsigned int __bluetooth_pb_get_missed_call_size(void)
{
- BluetoothPbAgent *bluetooth_pb_obj = NULL;
- DBusGConnection *bus = NULL;
- DBusGProxy *bus_proxy = NULL;
- guint result = 0;
- GError *error = NULL;
+ CTSiter *iter = NULL;
- g_type_init();
+ unsigned int call_size = 0;
- mainloop = g_main_loop_new(NULL, FALSE);
- if (mainloop == NULL) {
- DBG("Couldn't create GMainLoop\n");
- return EXIT_FAILURE;
- }
+ contacts_svc_get_list(CTS_LIST_ALL_MISSED_CALL, &iter);
- 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);
- return EXIT_FAILURE;
+ while (contacts_svc_iter_next(iter) == CTS_SUCCESS) {
+ call_size++;
}
- bus_proxy = dbus_g_proxy_new_for_name(bus, DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
- if (bus_proxy == NULL) {
- DBG("Failed to get a proxy for D-Bus\n");
- goto failure;
- }
+ if (iter)
+ contacts_svc_iter_remove(iter);
- if (!dbus_g_proxy_call(bus_proxy, "RequestName", &error, G_TYPE_STRING,
- BT_PB_SERVICE_NAME, G_TYPE_UINT, 0, G_TYPE_INVALID,
- G_TYPE_UINT, &result, G_TYPE_INVALID)) {
- if (error != NULL) {
- DBG("RequestName RPC failed[%s]\n", error->message);
- g_error_free(error);
- }
- goto failure;
+ return call_size;
+}
+
+static unsigned int __bluetooth_pb_get_combined_call_size(void)
+{
+ CTSiter *iter = NULL;
+
+ unsigned int call_size = 0;
+
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+
+ while (contacts_svc_iter_next(iter) == CTS_SUCCESS) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ if (_bluetooth_pb_is_incoming_call(phonelog_id) ||
+ _bluetooth_pb_is_outgoing_call(phonelog_id) ||
+ _bluetooth_pb_is_missed_call(phonelog_id))
+ call_size++;
+
+ contacts_svc_value_free(value);
}
- DBG("result : %d %d\n", result, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
- if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- DBG("Failed to get the primary well-known name.\n");
- goto failure;
+
+ if (iter)
+ contacts_svc_iter_remove(iter);
+
+ return call_size;
+}
+
+static GPtrArray *__bluetooth_pb_get_contact_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset)
+{
+ GPtrArray *vcards = NULL;
+
+ gint i = 1;
+ gboolean unrestricted = FALSE;
+
+ CTSiter *iter = NULL;
+
+ vcards = g_ptr_array_new();
+
+ if (max_list_count == 65535)
+ unrestricted = TRUE;
+
+ /* for owner */
+ if (list_start_offset == 0) {
+ gchar *vcard = NULL;
+ vcard = _bluetooth_pb_vcard_contact(0, filter, format);
+
+ g_ptr_array_add(vcards, vcard);
}
- g_object_unref(bus_proxy);
- bus_proxy = NULL;
+ contacts_svc_get_list(CTS_LIST_ALL_CONTACT, &iter);
+ while ((contacts_svc_iter_next(iter) == CTS_SUCCESS) &&
+ (unrestricted || (i < list_start_offset + max_list_count))) {
+ CTSvalue *value = NULL;
+ gchar *vcard = NULL;
+ gint id = 0;
- bluetooth_pb_obj = g_object_new(BLUETOOTH_PB_TYPE_AGENT, NULL);
- if (bluetooth_pb_obj == NULL) {
- DBG("Failed to create one BluetoothPbAgent instance.\n");
- goto failure;
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ id = contacts_svc_value_get_int(value, CTS_LIST_CONTACT_ID_INT);
+ vcard = _bluetooth_pb_vcard_contact(id, filter, format);
+
+ contacts_svc_value_free(value);
+
+ if (vcard == NULL)
+ continue;
+
+ if ( i >= list_start_offset)
+ g_ptr_array_add(vcards, vcard);
+
+ i++;
}
- /* Registering it on the D-Bus */
- dbus_g_connection_register_g_object(bus, BT_PB_SERVICE_OBJECT_PATH,
- G_OBJECT(bluetooth_pb_obj));
+ g_ptr_array_add(vcards, NULL);
- g_main_loop_run(mainloop);
+ if (iter)
+ contacts_svc_iter_remove(iter);
+
+ return vcards;
+}
+
+static GPtrArray *__bluetooth_pb_get_incoming_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset)
+{
+ GPtrArray *vcards = NULL;
+
+ gint i = 1;
+ guint16 offset = list_start_offset;
+
+ gboolean unrestricted = FALSE;
+
+ CTSiter *iter = NULL;
+
+ vcards = g_ptr_array_new();
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+
+ if (max_list_count == 65535)
+ unrestricted = TRUE;
+
+ if (offset == 0)
+ offset = 1;
+
+ DBG("i %d offset %d max_list_count %d\n", i, offset, max_list_count);
+
+ while ((contacts_svc_iter_next(iter) == CTS_SUCCESS) &&
+ (unrestricted || (i < offset + max_list_count))) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+ gchar *vcard = NULL;
+
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ if (_bluetooth_pb_is_incoming_call(phonelog_id)) {
+ vcard = _bluetooth_pb_vcard_call(phonelog_id, filter, format,
+ "RECEIVED");
+
+ if (vcard == NULL)
+ continue;
+
+ if ( i >= offset)
+ g_ptr_array_add(vcards, vcard);
+ i++;
+ }
+
+ contacts_svc_value_free(value);
+ }
+
+ g_ptr_array_add(vcards, NULL);
+
+ if (iter)
+ contacts_svc_iter_remove(iter);
+
+ return vcards;
+}
+
+static GPtrArray *__bluetooth_pb_get_outgoing_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset)
+{
+ GPtrArray *vcards = NULL;
+
+ gint i = 1;
+ guint16 offset = list_start_offset;
+
+ gboolean unrestricted = FALSE;
+
+ CTSiter *iter = NULL;
+
+ vcards = g_ptr_array_new();
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+
+ if (max_list_count == 65535)
+ unrestricted = TRUE;
+
+ if (offset == 0)
+ offset = 1;
+
+ while ((contacts_svc_iter_next(iter) == CTS_SUCCESS) &&
+ (unrestricted || (i < offset + max_list_count))) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+ gchar *vcard = NULL;
+
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ if (_bluetooth_pb_is_outgoing_call(phonelog_id)) {
+ vcard = _bluetooth_pb_vcard_call(phonelog_id, filter, format,
+ "DIALED");
+
+ if (vcard == NULL)
+ continue;
+
+ if (i >= offset)
+ g_ptr_array_add(vcards, vcard);
+ i++;
+ }
+
+ contacts_svc_value_free(value);
+ }
+
+ g_ptr_array_add(vcards, NULL);
+
+ if (iter)
+ contacts_svc_iter_remove(iter);
+
+ return vcards;
+}
+
+static GPtrArray *__bluetooth_pb_get_missed_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset)
+{
+ GPtrArray *vcards = NULL;
+
+ gint i = 1;
+ guint16 offset = list_start_offset;
+
+ gboolean unrestricted = FALSE;
+
+ CTSiter *iter = NULL;
+
+ vcards = g_ptr_array_new();
+ contacts_svc_get_list(CTS_LIST_ALL_MISSED_CALL, &iter);
+
+ if (max_list_count == 65535)
+ unrestricted = TRUE;
+
+ if (offset == 0)
+ offset = 1;
+
+ while ((contacts_svc_iter_next(iter) == CTS_SUCCESS) &&
+ (unrestricted || (i < offset + max_list_count))) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+ gchar *vcard = NULL;
+
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ if (_bluetooth_pb_is_missed_call(phonelog_id)) {
+ vcard = _bluetooth_pb_vcard_call(phonelog_id, filter, format,
+ "MISSED");
+
+ if (vcard == NULL)
+ continue;
+
+ if (i >= offset)
+ g_ptr_array_add(vcards, vcard);
+ i++;
+ }
+
+ contacts_svc_value_free(value);
+ }
+
+ g_ptr_array_add(vcards, NULL);
+
+ if (iter)
+ contacts_svc_iter_remove(iter);
+
+ return vcards;
+}
+
+static GPtrArray *__bluetooth_pb_get_combined_call_vcards(BluetoothPbAgent *agent,
+ guint64 filter,
+ guint8 format,
+ guint16 max_list_count,
+ guint16 list_start_offset)
+{
+ GPtrArray *vcards = NULL;
+
+ gint i = 1;
+ guint16 offset = list_start_offset;
+
+ gboolean unrestricted = FALSE;
+
+ CTSiter *iter = NULL;
+
+ vcards = g_ptr_array_new();
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+
+ if (max_list_count == 65535)
+ unrestricted = TRUE;
+
+ if (offset == 0)
+ offset = 1;
+
+ while ((contacts_svc_iter_next(iter) == CTS_SUCCESS) &&
+ (unrestricted || (i < offset + max_list_count))) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+ gchar *vcard = NULL;
+
+ gchar *attr = NULL;
+
+ value = contacts_svc_iter_get_info(iter);
+ if(value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ if (_bluetooth_pb_is_incoming_call(phonelog_id))
+ attr = "RECEIVED";
+ else if (_bluetooth_pb_is_outgoing_call(phonelog_id))
+ attr = "DIALED";
+ else if (_bluetooth_pb_is_missed_call(phonelog_id))
+ attr = "MISSED";
+
+ vcard = _bluetooth_pb_vcard_call(phonelog_id, filter, format,
+ attr);
+
+ if (vcard == NULL)
+ continue;
+
+ if (i >= offset)
+ g_ptr_array_add(vcards, vcard);
+ i++;
+
+ contacts_svc_value_free(value);
+ }
+
+ g_ptr_array_add(vcards, NULL);
+
+ if (iter)
+ contacts_svc_iter_remove(iter);
+
+ return vcards;
+}
+
+static void __bluetooth_pb_create_contact_index(PhoneBookType pb_type)
+{
+ CTSiter *iter = NULL;
+ gint i = 1;
+
+
+ if (g_current_pb_type == pb_type)
+ return;
+
+ /* create cache */
+ g_current_pb_type = pb_type;
+ __bluetooth_pb_list_hash_reset();
+
+ contacts_svc_get_list(CTS_LIST_ALL_CONTACT, &iter);
+
+ while (contacts_svc_iter_next(iter) == CTS_SUCCESS) {
+ CTSvalue *value = NULL;
+ gint contact_id = 0;
+
+ value = contacts_svc_iter_get_info(iter);
+ if (value == NULL)
+ continue;
+
+ contact_id = contacts_svc_value_get_int(value, CTS_LIST_CONTACT_ID_INT);
+ __bluetooth_pb_list_hash_insert(i, contact_id);
+
+
+ i++;
+ }
+}
+
+static void __bluetooth_pb_create_call_index(PhoneBookType pb_type)
+{
+ CTSiter *iter = NULL;
+ gint i = 1;
+
+ if (g_current_pb_type == pb_type)
+ return;
+
+ /* create cache */
+ g_current_pb_type = pb_type;
+ __bluetooth_pb_list_hash_reset();
+
+ contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
+
+ while(contacts_svc_iter_next(iter) == CTS_SUCCESS) {
+ CTSvalue *value = NULL;
+ gint phonelog_id = 0;
+
+ value = contacts_svc_iter_get_info(iter);
+ if(value == NULL)
+ continue;
+
+ phonelog_id = contacts_svc_value_get_int(value, CTS_LIST_PLOG_ID_INT);
+
+ switch (pb_type) {
+ case TELECOM_ICH: {
+ if(_bluetooth_pb_is_incoming_call(phonelog_id)) {
+ __bluetooth_pb_list_hash_insert(i, phonelog_id);
+ i++;
+ }
+ }
+ break;
+ case TELECOM_OCH: {
+ if(_bluetooth_pb_is_outgoing_call(phonelog_id)) {
+ __bluetooth_pb_list_hash_insert(i, phonelog_id);
+ i++;
+ }
+ }
+ break;
+ case TELECOM_MCH: {
+ if(_bluetooth_pb_is_missed_call(phonelog_id)) {
+ __bluetooth_pb_list_hash_insert(i, phonelog_id);
+ i++;
+ }
+ }
+ break;
+ case TELECOM_CCH: {
+ if(_bluetooth_pb_is_incoming_call(phonelog_id) ||
+ _bluetooth_pb_is_outgoing_call(phonelog_id) ||
+ _bluetooth_pb_is_missed_call(phonelog_id)) {
+ __bluetooth_pb_list_hash_insert(i, phonelog_id);
+ i++;
+ }
+ }
+ break;
+ default :
+ return;
+ }
+
+ contacts_svc_value_free(value);
+ }
+}
+
+
+static void __bluetooth_pb_get_contact_list(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ gint start_index,
+ gint end_index,
+ gboolean formatted_name)
+{
+ gint i;
+ guint hash_size;
+
+ if (ptr_array == NULL)
+ return;
+
+ __bluetooth_pb_create_contact_index(pb_type);
+
+ if (end_index < 0 || end_index < start_index)
+ end_index = start_index;
+
+ if (start_index <= 0) {
+ /* owner */
+ gchar *name = NULL;
+ gchar *number = NULL;
+
+ if (formatted_name)
+ name = _bluetooth_pb_name_owner();
+ else
+ name = _bluetooth_pb_fn_owner();
+
+ number = _bluetooth_pb_number_owner();
+
+ __bluetooth_pb_list_ptr_array_add(ptr_array, name, number, 0);
+
+ g_free(name);
+ g_free(number);
+
+ start_index = 1;
+ }
+
+ hash_size = __bluetooth_pb_list_hash_size();
+ if (hash_size < end_index)
+ end_index = hash_size;
+
+ for (i = start_index; i <= end_index; i++) {
+ gint contact_id;
+
+ gchar *name = NULL;
+ gchar *number = NULL;
+
+ contact_id = __bluetooth_pb_list_hash_lookup_id(i);
+
+ if (formatted_name)
+ name = _bluetooth_pb_fn_from_contact_id(contact_id);
+ else
+ name = _bluetooth_pb_name_from_contact_id(contact_id);
+
+ number = _bluetooth_pb_number_from_contact_id(contact_id);
+
+ __bluetooth_pb_list_ptr_array_add(ptr_array, name, number, i);
+
+ g_free(name);
+ g_free(number);
+ }
+}
+
+static void __bluetooth_pb_get_call_list(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ gint start_index,
+ gint end_index,
+ gboolean formatted_name)
+{
+ gint i;
+ guint hash_size;
+
+ if (ptr_array == NULL)
+ return;
+
+ __bluetooth_pb_create_call_index(pb_type);
+
+ if (end_index < 0 || end_index < start_index)
+ end_index = start_index;
+
+ if (start_index <= 0)
+ start_index = 1;
+
+ hash_size = __bluetooth_pb_list_hash_size();
+ if (hash_size < end_index)
+ end_index = hash_size;
+
+ DBG("start_index: %d end_index %d\n", start_index, end_index);
+
+ for (i = start_index; i <= end_index; i++) {
+ gint phonelog_id;
+
+ gchar *name = NULL;
+ gchar *number = NULL;
+
+ phonelog_id = __bluetooth_pb_list_hash_lookup_id(i);
+
+ if (formatted_name)
+ name = _bluetooth_pb_fn_from_phonelog_id(phonelog_id);
+ else
+ name = _bluetooth_pb_name_from_phonelog_id(phonelog_id);
+
+ number = _bluetooth_pb_number_from_phonelog_id(phonelog_id);
+
+ __bluetooth_pb_list_ptr_array_add(ptr_array, name, number, i);
+
+ g_free(name);
+ g_free(number);
+ }
+}
+
+static void __bluetooth_pb_get_contact_list_by_name(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ const gchar *find_text,
+ gboolean formatted_name,
+ gboolean owner)
+{
+ DBG("%s %d\n", __FILE__, __LINE__);
+ guint i;
+ guint hash_size;
+
+ if (ptr_array == NULL)
+ return;
+
+ __bluetooth_pb_create_contact_index(pb_type);
+
+ if (owner) {
+ /* owner */
+ gchar *name;
+
+ if (formatted_name)
+ name = _bluetooth_pb_name_owner();
+ else
+ name = _bluetooth_pb_fn_owner();
+
+ if (g_str_has_prefix(name, find_text)) {
+ gchar *number;
+
+ number = _bluetooth_pb_number_owner();
+
+ __bluetooth_pb_list_ptr_array_add(ptr_array, name, number, 0);
+
+ g_free(number);
+ }
+
+ g_free(name);
+ }
+
+ hash_size = __bluetooth_pb_list_hash_size();
+
+ for (i = 1; i <= hash_size; i++) {
+ gint contact_id;
+ gchar *name;
+
+ contact_id = __bluetooth_pb_list_hash_lookup_id(i);
+
+ if (formatted_name)
+ name = _bluetooth_pb_fn_from_contact_id(contact_id);
+ else
+ name = _bluetooth_pb_name_from_contact_id(contact_id);
+
+ if(g_str_has_prefix(name , find_text)) {
+ gchar *number;
+
+ number = _bluetooth_pb_number_from_contact_id(contact_id);
+
+ __bluetooth_pb_list_ptr_array_add(ptr_array, name, number, i);
+
+ g_free(number);
+ }
+
+ g_free(name);
+ }
+}
+
+static void __bluetooth_pb_get_call_list_by_name(PhoneBookType pb_type,
+ GPtrArray *ptr_array,
+ const gchar *find_text,
+ gboolean formatted_name)
+{
+ guint i;
+ guint hash_size;
+
+ if (ptr_array == NULL)
+ return;
+
+ __bluetooth_pb_create_call_index(pb_type);
+
+ hash_size = __bluetooth_pb_list_hash_size();
+
+ for (i = 1; i <= hash_size; i++) {
+ gint phonelog_id;
+ gchar *name;
+
+ phonelog_id = __bluetooth_pb_list_hash_lookup_id(i);
+
+ if (formatted_name)
+ name = _bluetooth_pb_fn_from_phonelog_id(phonelog_id);
+ else
+ name = _bluetooth_pb_name_from_phonelog_id(phonelog_id);
+
+ if(g_str_has_prefix(name , find_text)) {
+ gchar *number;
+
+ number = _bluetooth_pb_number_from_phonelog_id(phonelog_id);
+
+ __bluetooth_pb_list_ptr_array_add(ptr_array, name, number, i);
+
+ g_free(number);
+ }
+
+ g_free(name);
+ }
+}
+
+static int __bluetooth_get_calllog_type(int call_type)
+{
+ int val = CTS_PLOG_TYPE_NONE;
+
+ switch (call_type) {
+ case CTS_PLOG_TYPE_VOICE_INCOMMING:
+ case CTS_PLOG_TYPE_VIDEO_INCOMMING:
+ val = CTS_PLOG_TYPE_VOICE_INCOMMING;
+ break;
+
+ case CTS_PLOG_TYPE_VOICE_OUTGOING:
+ case CTS_PLOG_TYPE_VIDEO_OUTGOING:
+ val = CTS_PLOG_TYPE_VOICE_OUTGOING;
+ break;
+
+ case CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN:
+ case CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN:
+ case CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN:
+ case CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN:
+ val = CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN;
+ break;
+
+ default:
+ break;
+ }
+
+ return val;
+}
+
+static unsigned int __get_call_log_count(unsigned int call_log_type)
+{
+ CTSiter *iter = NULL;
+ unsigned int count = 0;
+
+ contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
+ while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
+ CTSvalue *plog = NULL;
+
+ plog = contacts_svc_iter_get_info(iter);
+ if(plog == NULL)
+ continue;
+
+ int type = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TYPE_INT);
+ DBG("type: %d\n", type);
+ int log_type = __bluetooth_get_calllog_type(type);
+
+ if ((call_log_type == 0xFF || call_log_type == log_type) &&
+ (log_type != CTS_PLOG_TYPE_NONE)) {
+ count++;
+ }
+ }
+ return count;
+}
+
+static void __bluetooth_pb_list_hash_reset(void)
+{
+ if (contact_list_hash)
+ g_hash_table_destroy(contact_list_hash);
+
+ contact_list_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
+}
+
+static gboolean __bluetooth_pb_list_hash_insert(gint handle,
+ gint id)
+{
+ if (contact_list_hash == NULL)
+ return FALSE;
+
+ g_hash_table_insert(contact_list_hash,
+ GINT_TO_POINTER(handle), GINT_TO_POINTER(id));
+
+ return TRUE;
+}
+
+static gint __bluetooth_pb_list_hash_lookup_id(gint handle)
+{
+ gint id;
+ if (contact_list_hash == NULL)
+ return 0;
+
+ id = GPOINTER_TO_INT(g_hash_table_lookup(contact_list_hash,
+ GINT_TO_POINTER(handle)));
+
+ return id;
+}
+
+static guint __bluetooth_pb_list_hash_size (void)
+{
+ if (contact_list_hash == NULL)
+ return 0;
+
+ return g_hash_table_size(contact_list_hash);
+}
+
+static void __bluetooth_pb_list_ptr_array_add(GPtrArray *ptr_array,
+ const gchar *name,
+ const gchar *number,
+ gint handle)
+{
+ GValue value = { 0, };
+
+ g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
+ g_value_take_boxed(&value,
+ dbus_g_type_specialized_construct(DBUS_STRUCT_STRING_STRING_UINT));
+
+ dbus_g_type_struct_set(&value,
+ 0, g_strdup(name),
+ 1, g_strdup(number),
+ 2, handle,
+ G_MAXUINT);
+
+ g_ptr_array_add(ptr_array, g_value_get_boxed(&value));
+}
+
+static void __bluetooth_pb_list_ptr_array_free(gpointer data)
+{
+ GValue value = { 0, };
+
+ gchar *name = NULL;
+ gchar *number = NULL;
+
+ if(data == NULL)
+ return;
+
+ g_value_init(&value, DBUS_STRUCT_STRING_STRING_UINT);
+ g_value_set_boxed(&value, data);
+
+ dbus_g_type_struct_get(&value,
+ 0, &name,
+ 1, &number,
+ G_MAXUINT);
+
+ g_free(name);
+ g_free(number);
+}
+
+static void __bluetooth_pb_agent_signal_handler(int signum)
+{
+ if (mainloop)
+ g_main_loop_quit(mainloop);
+ else
+ exit(0);
+}
+
+static void __bluetooth_pb_contact_changed(void *user_data)
+{
+ BluetoothPbAgent *agent;
+
+ g_return_if_fail(BLUETOOTH_IS_PB_AGENT(user_data));
+ agent = BLUETOOTH_PB_AGENT(user_data);
+
+ g_signal_emit(agent, signals[CLEAR], 0);
+}
+
+static void __bluetooth_pb_call_changed(void *user_data)
+{
+ BluetoothPbAgent *agent;
+
+ g_return_if_fail(BLUETOOTH_IS_PB_AGENT(user_data));
+ agent = BLUETOOTH_PB_AGENT(user_data);
+
+ g_signal_emit(agent, signals[CLEAR], 0);
+}
+
+int main(int argc, char **argv)
+{
+ BluetoothPbAgent *bluetooth_pb_obj = NULL;
+
+ DBusGConnection *bus = NULL;
+ DBusGProxy *bus_proxy = NULL;
+
+ guint result = 0;
+
+ gint ret = EXIT_SUCCESS;
+ struct sigaction sa;
+
+ GError *error = NULL;
+
+ cts_error status;
+
+ g_type_init();
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ if (mainloop == NULL) {
+ DBG("Couldn't create GMainLoop\n");
+ return EXIT_FAILURE;
+ }
+
+ bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ DBG("Couldn't connect to system bus[%s]\n", error->message);
+ g_error_free(error);
+ return EXIT_FAILURE;
+ }
+
+ bus_proxy = dbus_g_proxy_new_for_name(bus, DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+ if (bus_proxy == NULL) {
+ DBG("Failed to get a proxy for D-Bus\n");
+ ret = EXIT_FAILURE;
+ goto failure;
+ }
+
+ if (!dbus_g_proxy_call(bus_proxy, "RequestName", &error, G_TYPE_STRING,
+ BT_PB_SERVICE_NAME, G_TYPE_UINT, 0, G_TYPE_INVALID,
+ G_TYPE_UINT, &result, G_TYPE_INVALID)) {
+ if (error != NULL) {
+ DBG("RequestName RPC failed[%s]\n", error->message);
+ g_error_free(error);
+ }
+ ret = EXIT_FAILURE;
+ goto failure;
+ }
+ DBG("result : %d %d\n", result, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
+ if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ DBG("Failed to get the primary well-known name.\n");
+ ret = EXIT_FAILURE;
+ goto failure;
+ }
+
+ g_object_unref(bus_proxy);
+ bus_proxy = NULL;
+
+ bluetooth_pb_obj = g_object_new(BLUETOOTH_PB_TYPE_AGENT, NULL);
+ if (bluetooth_pb_obj == NULL) {
+ DBG("Failed to create one BluetoothPbAgent instance.\n");
+ ret = EXIT_FAILURE;
+ goto failure;
+ }
+
+ /* Registering it on the D-Bus */
+ dbus_g_connection_register_g_object(bus, BT_PB_SERVICE_OBJECT_PATH,
+ G_OBJECT(bluetooth_pb_obj));
+
+ /* connect contact */
+ status = (cts_error)contacts_svc_connect();
+ if (status != CTS_SUCCESS) {
+ DBG("Can not connect contacts server\n");
+ ret = EXIT_FAILURE;
+ goto failure;
+ }
+
+ contacts_svc_subscribe_change(CTS_SUBSCRIBE_CONTACT_CHANGE,
+ __bluetooth_pb_contact_changed,
+ bluetooth_pb_obj);
+ contacts_svc_subscribe_change(CTS_SUBSCRIBE_PLOG_CHANGE,
+ __bluetooth_pb_call_changed,
+ bluetooth_pb_obj);
+
+ /* set signal */
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = __bluetooth_pb_agent_signal_handler;
+ sigaction(SIGTERM, &sa, NULL);
+ sigaction(SIGINT, &sa, NULL);
+
+ g_main_loop_run(mainloop);
+
+ failure:
+ DBG("Terminate the bluetooth-pb-agent\n");
+
+ /* disconnect contact */
+ contacts_svc_unsubscribe_change(CTS_SUBSCRIBE_CONTACT_CHANGE,
+ __bluetooth_pb_contact_changed);
+ contacts_svc_unsubscribe_change(CTS_SUBSCRIBE_PLOG_CHANGE,
+ __bluetooth_pb_call_changed);
+
+ contacts_svc_disconnect();
+
+ g_signal_emit(bluetooth_pb_obj, signals[CLEAR], 0);
- failure:
- DBG("Terminate the bluetooth-pb-agent\n");
if (bluetooth_pb_obj)
g_object_unref(bluetooth_pb_obj);
if (bus)
dbus_g_connection_unref(bus);
- return EXIT_FAILURE;
+ return ret;
}
<method name="GetPhonebook">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="q" name="max_list"/>
- <arg type="q" name="offset"/>
- <arg type="i" name="last_part" direction="out"/>
- <arg type="as" name="phonebook" direction="out"/>
- </method>
-
- <method name="GetCalls">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="q" name="max_list"/>
- <arg type="q" name="offset"/>
- <arg type="s" name="call_type"/>
+ <arg type="s" name="name"/>
+ <arg type="t" name="filter"/>
+ <arg type="y" name="format"/>
+ <arg type="q" name="max_list_count"/>
+ <arg type="q" name="list_start_offset"/>
<arg type="as" name="phonebook" direction="out"/>
+ <arg type="q" name="new_missed_call" direction="out"/>
</method>
<method name="GetPhonebookSize">
<arg type="u" name="phonebook_size" direction="out"/>
</method>
- <method name="GetTotalObjectCount">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="s" name="path"/>
- <arg type="u" name="phonebook_size" direction="out"/>
- </method>
-
<method name="GetPhonebookList">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="s" name="name"/>
<arg type="a(ssu)" name="phonebook_list" direction="out"/>
</method>
- <method name="GetCallsList">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="s" name="call_type"/>
- <arg type="a(ssu)" name="calls_list" direction="out"/>
- </method>
-
<method name="GetPhonebookEntry">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="s" name="folder"/>
<arg type="s" name="id"/>
+ <arg type="t" name="filter"/>
+ <arg type="y" name="format"/>
<arg type="s" name="phonebook_entry" direction="out"/>
</method>
- <method name="GetCallsEntry">
+ <method name="GetTotalObjectCount">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="s" name="id"/>
- <arg type="s" name="phonebook_entry" direction="out"/>
+ <arg type="s" name="path"/>
+ <arg type="u" name="phonebook_size" direction="out"/>
</method>
+
<method name="AddContact">
<arg type="s" name="filename"/>
</method>
+ <signal name="clear"/>
+
+ </interface>
+
+ <interface name="org.bluez.PbAgent.At">
+ <method name="GetPhonebookSizeAt">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="s" name="command"/>
+ <arg type="u" name="phonebook_size" direction="out"/>
+ </method>
+
+ <method name="GetPhonebookEntriesAt">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="s" name="command"/>
+ <arg type="i" name="start_index"/>
+ <arg type="i" name="end_index"/>
+ <arg type="a(ssu)" name="phonebook_entries" direction="out"/>
+ </method>
+
+ <method name="GetPhonebookEntriesFindAt">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="s" name="command"/>
+ <arg type="s" name="find_text" />
+ <arg type="a(ssu)" name="phonebook_entries" direction="out"/>
+ </method>
</interface>
</node>
const char *adapter_path, gpointer user_data);
static int __bluetooth_telephony_proxy_init(void);
static void __bluetooth_telephony_proxy_deinit(void);
-static int __bluetooth_telephony_register(bt_telephony_func_ptr cb,
- void *user_data);
+static int __bluetooth_telephony_register(void);
static int __bluetooth_telephony_unregister(void);
static int __bluetooth_get_default_adapter_path(DBusGConnection *GConn,
char *path);
call_data.callid = callid;
- error = __bt_telephony_event_cb(BLUETOOTH_EVENT_AG_ANSWER,
+ error = __bt_telephony_event_cb(BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL,
BLUETOOTH_TELEPHONY_ERROR_NONE,
(void *)&call_data);
call_data.callid = callid;
- error = __bt_telephony_event_cb(BLUETOOTH_EVENT_AG_RELEASE,
+ error = __bt_telephony_event_cb(BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL,
BLUETOOTH_TELEPHONY_ERROR_NONE,
(void *)&call_data);
call_data.callid = callid;
- error = __bt_telephony_event_cb(BLUETOOTH_EVENT_AG_REJECT,
+ error = __bt_telephony_event_cb(BLUETOOTH_EVENT_TELEPHONY_REJECT_CALL,
BLUETOOTH_TELEPHONY_ERROR_NONE,
(void *)&call_data);
if (value >= 0) {
switch (value) {
case 0:
- event = BLUETOOTH_EVENT_AG_CALL_HOLD_RELEASE_ALL;
+ event = BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL;
break;
case 1:
- event = BLUETOOTH_EVENT_AG_CALL_HOLD_RELEASE_ACTIVE;
+ event = BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL;
break;
case 2:
- event = BLUETOOTH_EVENT_AG_CALL_HOLD_HOLD_ACTIVE;
+ event = BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL;
break;
case 3:
- event = BLUETOOTH_EVENT_AG_CALL_HOLD_ADD_NEW;
+ event = BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL;
break;
case 4:
- event = BLUETOOTH_EVENT_AG_CALL_HOLD_TRANSFER;
+ event = BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER;
break;
default:
DBG("Invalid CHLD command\n");
call_data.dtmf = g_strdup(dtmf);
- error = __bt_telephony_event_cb(BLUETOOTH_EVENT_AG_DTMF,
+ error = __bt_telephony_event_cb(BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF,
BLUETOOTH_TELEPHONY_ERROR_NONE, (void *)&call_data);
if (error != BLUETOOTH_TELEPHONY_ERROR_NONE) {
__bluetooth_telephony_get_connected_device_proxy();
DBG("Headset Connected\n");
+
+ __bt_telephony_event_cb(
+ BLUETOOTH_EVENT_TELEPHONY_HFP_CONNECTED,
+ BLUETOOTH_TELEPHONY_ERROR_NONE, NULL);
}
} else { /*Device disconnected*/
memset(telephony_info.address, 0x00,
g_object_unref(telephony_dbus_info.proxy);
telephony_dbus_info.proxy = NULL;
}
+
DBG("Headset Disconnected\n");
+
+ __bt_telephony_event_cb(
+ BLUETOOTH_EVENT_TELEPHONY_HFP_DISCONNECTED,
+ BLUETOOTH_TELEPHONY_ERROR_NONE, NULL);
}
return DBUS_HANDLER_RESULT_HANDLED;
}
+ if (g_strcmp0(property, "SpeakerGain") == 0) {
+ unsigned int spkr_gain;
+ guint16 gain;
+ dbus_message_iter_next(&item_iter);
+ dbus_message_iter_recurse(&item_iter, &value_iter);
+ dbus_message_iter_get_basic(&value_iter, &gain);
+
+ spkr_gain = (unsigned int)gain;
+ DBG("spk_gain[%d]\n", spkr_gain);
+
+ __bt_telephony_event_cb(
+ BLUETOOTH_EVENT_TELEPHONY_SET_SPEAKER_GAIN,
+ BLUETOOTH_TELEPHONY_ERROR_NONE,
+ (void *)&spkr_gain);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (g_strcmp0(property, "MicrophoneGain") == 0) {
+ unsigned int mic_gain;
+ guint16 gain;
+ dbus_message_iter_next(&item_iter);
+ dbus_message_iter_recurse(&item_iter, &value_iter);
+ dbus_message_iter_get_basic(&value_iter, &gain);
+
+ mic_gain = (unsigned int)gain;
+ DBG("mic_gain[%d]\n", mic_gain);
+
+ __bt_telephony_event_cb(
+ BLUETOOTH_EVENT_TELEPHONY_SET_MIC_GAIN,
+ BLUETOOTH_TELEPHONY_ERROR_NONE,
+ (void *)&mic_gain);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
if (g_strcmp0(property, "Playing") == 0) {
gboolean audio_sink_playing = FALSE;
dbus_message_iter_next(&item_iter);
}
telephony_info.headset_state = BLUETOOTH_STATE_PLAYING;
__bt_telephony_event_cb(
- BLUETOOTH_EVENT_AUDIO_CONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_AUDIO_CONNECTED,
BLUETOOTH_TELEPHONY_ERROR_NONE, NULL);
} else {
if (!vconf_set_bool(VCONFKEY_BT_HEADSET_SCO, FALSE)) {
telephony_info.headset_state =
BLUETOOTH_STATE_CONNECTED;
__bt_telephony_event_cb(
- BLUETOOTH_EVENT_AUDIO_DISCONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_AUDIO_DISCONNECTED,
BLUETOOTH_TELEPHONY_ERROR_NONE, NULL);
}
DBG("BlueZ is terminated and flag need to be reset");
is_active = FALSE;
DBG("Send disabled to application\n");
- __bt_telephony_event_cb(BLUETOOTH_EVENT_BT_DISABLED,
- BLUETOOTH_TELEPHONY_ERROR_NONE, NULL);
}
}
static void __bluetooth_telephony_adapter_added_cb(DBusGProxy *manager_proxy,
const char *adapter_path, gpointer user_data)
{
+ int ret;
+ DBusError dbus_error;
+ DBusConnection *conn;
+
DBG("Adapter added [%s] \n", adapter_path);
if (strstr(adapter_path, "hci0")) {
DBG("BlueZ is Activated and flag need to be reset");
is_active = TRUE;
DBG("Send enabled to application\n");
- __bt_telephony_event_cb(BLUETOOTH_EVENT_BT_ENABLED,
- BLUETOOTH_TELEPHONY_ERROR_NONE, NULL);
+
+ ret = __bluetooth_telephony_register();
+ if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE) {
+ DBG("__bluetooth_telephony_register failed\n");
+ return;
+ }
+
+ dbus_error_init(&dbus_error);
+ conn = dbus_g_connection_get_connection(telephony_dbus_info.conn);
+ dbus_connection_add_filter(conn, __bluetooth_telephony_event_filter,
+ NULL, NULL);
+
+ dbus_bus_add_match(conn,
+ "type='signal',interface='" BLUEZ_HEADSET_INTERFACE
+ "',member='PropertyChanged'", &dbus_error);
+
+ if (dbus_error_is_set(&dbus_error)) {
+ DBG("Fail to add dbus filter signal\n");
+ dbus_error_free(&dbus_error);
+ __bluetooth_telephony_unregister();
+ dbus_connection_remove_filter(dbus_g_connection_get_connection(
+ telephony_dbus_info.conn),
+ __bluetooth_telephony_event_filter, NULL);
+ }
}
}
{
DBG("__bluetooth_audio_proxy_init +\n");
- telephony_dbus_info.dbus_proxy = dbus_g_proxy_new_for_name(
- telephony_dbus_info.conn, DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
- if (NULL == telephony_dbus_info.dbus_proxy)
- return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
-
- /*Add Signal callback for BT disabled*/
- dbus_g_proxy_add_signal(telephony_dbus_info.dbus_proxy,
- "NameOwnerChanged",
- G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal(telephony_dbus_info.dbus_proxy,
- "NameOwnerChanged",
- G_CALLBACK(__bluetooth_telephony_name_owner_changed),
- NULL, NULL);
-
- /*Add Signal callback for BT enabled*/
-
- dbus_g_proxy_add_signal(telephony_dbus_info.manager_proxy,
- "AdapterAdded",
- DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal(telephony_dbus_info.manager_proxy,
- "AdapterAdded",
- G_CALLBACK(__bluetooth_telephony_adapter_added_cb),
- NULL, NULL);
-
object = (GObject *)__bluetooth_telephony_method_new();
- if (NULL == object) {
- g_object_unref(telephony_dbus_info.dbus_proxy);
- telephony_dbus_info.dbus_proxy = NULL;
+ if (NULL == object)
return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
- }
DBG("telephony_object = %d\n", object);
{
DBG("__bluetooth_telephony_proxy_deinit +\n");
-
- /*Remove BT disabled signal*/
- dbus_g_proxy_disconnect_signal(telephony_dbus_info.dbus_proxy ,
- "NameOwnerChanged",
- G_CALLBACK(__bluetooth_telephony_name_owner_changed),
- NULL);
-
- g_object_unref(telephony_dbus_info.dbus_proxy);
-
- /*Remove BT enabled signal*/
- dbus_g_proxy_disconnect_signal(
- telephony_dbus_info.manager_proxy,
- "AdapterAdded",
- G_CALLBACK(__bluetooth_telephony_adapter_added_cb),
- NULL);
-
dbus_g_connection_unregister_g_object(telephony_dbus_info.conn,
G_OBJECT(object));
g_object_unref(object);
object = NULL;
- g_object_unref(telephony_dbus_info.proxy);
- telephony_dbus_info.proxy = NULL;
-
DBG("__bluetooth_telephony_proxy_deinit -\n");
return;
}
-static int __bluetooth_telephony_register(bt_telephony_func_ptr cb,
- void *user_data)
+static int __bluetooth_telephony_register(void)
{
char *path = g_strdup(telephony_info.call_path);
int ret;
DBG("bluetooth_telephony_register +\n");
- telephony_info.cb = cb;
- telephony_info.user_data = user_data;
-
ret = __bluetooth_telephony_dbus_method_send(
HFP_AGENT_PATH, HFP_AGENT_INTERFACE,
"RegisterApplication", DBUS_TYPE_STRING, &path,
DBG("bluetooth_telephony_unregister +\n");
- telephony_info.cb = NULL;
- telephony_info.user_data = NULL;
- telephony_info.call_count = 0;
-
ret = __bluetooth_telephony_dbus_method_send(
HFP_AGENT_PATH, HFP_AGENT_INTERFACE,
"UnregisterApplication", DBUS_TYPE_STRING, &path,
return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
}
+ /* Call Path */
+ snprintf(telephony_info.call_path, sizeof(telephony_info.call_path),
+ CSD_CALL_APP_PATH, getpid());
+ DBG("Call Path = %s \n", telephony_info.call_path);
+ memset(telephony_info.address, 0x00, sizeof(telephony_info.address));
+
+ if (__bluetooth_telephony_proxy_init()) {
+ DBG("__bluetooth_telephony_proxy_init failed\n");
+ dbus_g_connection_unref(telephony_dbus_info.conn);
+ telephony_dbus_info.conn = NULL;
+ return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
+ }
+
telephony_dbus_info.manager_proxy = dbus_g_proxy_new_for_name(
telephony_dbus_info.conn,
BLUEZ_SERVICE_NAME,
return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
}
+ telephony_dbus_info.dbus_proxy = dbus_g_proxy_new_for_name(
+ telephony_dbus_info.conn, DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
- /*Check for BT status*/
- ret = __bluetooth_get_default_adapter_path(telephony_dbus_info.conn,
- object_path);
- if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE) {
+ if (NULL == telephony_dbus_info.dbus_proxy) {
dbus_g_connection_unref(telephony_dbus_info.conn);
telephony_dbus_info.conn = NULL;
g_object_unref(telephony_dbus_info.manager_proxy);
telephony_dbus_info.manager_proxy = NULL;
- return BLUETOOTH_TELEPHONY_ERROR_NOT_ENABLED;
+ return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
}
- /*Bluetooth is active, therefore set the flag */
- is_active = TRUE;
- /* Call Path */
- snprintf(telephony_info.call_path, sizeof(telephony_info.call_path),
- CSD_CALL_APP_PATH, getpid());
- DBG("Call Path = %s \n", telephony_info.call_path);
- memset(telephony_info.address, 0x00, sizeof(telephony_info.address));
+ /*Add Signal callback for BT disabled*/
+ dbus_g_proxy_add_signal(telephony_dbus_info.dbus_proxy,
+ "NameOwnerChanged", G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
- if (__bluetooth_telephony_proxy_init()) {
- DBG("__bluetooth_telephony_proxy_init failed\n");
- dbus_g_connection_unref(telephony_dbus_info.conn);
- telephony_dbus_info.conn = NULL;
- g_object_unref(telephony_dbus_info.manager_proxy);
- telephony_dbus_info.manager_proxy = NULL;
- return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
- }
+ dbus_g_proxy_connect_signal(telephony_dbus_info.dbus_proxy,
+ "NameOwnerChanged", G_CALLBACK(
+ __bluetooth_telephony_name_owner_changed),
+ NULL, NULL);
+
+ /*Add Signal callback for BT enabled*/
+ dbus_g_proxy_add_signal(telephony_dbus_info.manager_proxy,
+ "AdapterAdded",
+ DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(telephony_dbus_info.manager_proxy,
+ "AdapterAdded",
+ G_CALLBACK(__bluetooth_telephony_adapter_added_cb),
+ NULL, NULL);
+
+ /*Callback and user applicaton data*/
+ telephony_info.cb = cb;
+ telephony_info.user_data = user_data;
+
+ /*Check for BT status*/
+ ret = __bluetooth_get_default_adapter_path(telephony_dbus_info.conn,
+ object_path);
+ if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE)
+ return BLUETOOTH_TELEPHONY_ERROR_NOT_ENABLED;
- ret = __bluetooth_telephony_register(cb, user_data);
+ /*Bluetooth is active, therefore set the flag */
+ is_active = TRUE;
+
+ ret = __bluetooth_telephony_register();
if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE) {
DBG("__bluetooth_telephony_register failed\n");
- __bluetooth_telephony_proxy_deinit();
- dbus_g_connection_unref(telephony_dbus_info.conn);
- telephony_dbus_info.conn = NULL;
- g_object_unref(telephony_dbus_info.manager_proxy);
- telephony_dbus_info.manager_proxy = NULL;
- return ret;
+ goto fail;
}
dbus_error_init(&dbus_error);
DBG("Fail to add dbus filter signal\n");
dbus_error_free(&dbus_error);
__bluetooth_telephony_unregister();
- __bluetooth_telephony_proxy_deinit();
dbus_connection_remove_filter(dbus_g_connection_get_connection(
telephony_dbus_info.conn),
__bluetooth_telephony_event_filter, NULL);
- dbus_g_connection_unref(telephony_dbus_info.conn);
- telephony_dbus_info.conn = NULL;
- g_object_unref(telephony_dbus_info.manager_proxy);
- telephony_dbus_info.manager_proxy = NULL;
- return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
+ goto fail;
}
DBG("bluetooth_telephony_init -\n");
return ret;
+fail:
+ telephony_info.cb = NULL;
+ telephony_info.user_data = NULL;
+ telephony_info.call_count = 0;
+
+ __bluetooth_telephony_proxy_deinit();
+
+ /*Remove BT disabled signal*/
+ dbus_g_proxy_disconnect_signal(telephony_dbus_info.dbus_proxy ,
+ "NameOwnerChanged",
+ G_CALLBACK(__bluetooth_telephony_name_owner_changed),
+ NULL);
+
+ g_object_unref(telephony_dbus_info.dbus_proxy);
+
+ /*Remove BT enabled signal*/
+ dbus_g_proxy_disconnect_signal(
+ telephony_dbus_info.manager_proxy,
+ "AdapterAdded",
+ G_CALLBACK(__bluetooth_telephony_adapter_added_cb),
+ NULL);
+
+ dbus_g_connection_unref(telephony_dbus_info.conn);
+ telephony_dbus_info.conn = NULL;
+ g_object_unref(telephony_dbus_info.manager_proxy);
+ telephony_dbus_info.manager_proxy = NULL;
+ g_object_unref(telephony_dbus_info.dbus_proxy);
+ telephony_dbus_info.dbus_proxy = NULL;
+ return ret;
}
BT_EXPORT_API int bluetooth_telephony_deinit(void)
__bluetooth_telephony_unregister();
__bluetooth_telephony_proxy_deinit();
+ telephony_info.cb = NULL;
+ telephony_info.user_data = NULL;
+ telephony_info.call_count = 0;
+
+ /*Remove BT disabled signal*/
+ dbus_g_proxy_disconnect_signal(telephony_dbus_info.dbus_proxy ,
+ "NameOwnerChanged",
+ G_CALLBACK(__bluetooth_telephony_name_owner_changed),
+ NULL);
+
+ g_object_unref(telephony_dbus_info.dbus_proxy);
+
+ /*Remove BT enabled signal*/
+ dbus_g_proxy_disconnect_signal(
+ telephony_dbus_info.manager_proxy,
+ "AdapterAdded",
+ G_CALLBACK(__bluetooth_telephony_adapter_added_cb),
+ NULL);
+
g_object_unref(telephony_dbus_info.manager_proxy);
telephony_dbus_info.manager_proxy = NULL;
dbus_g_connection_unref(telephony_dbus_info.conn);
telephony_dbus_info.conn = NULL;
+ g_object_unref(telephony_dbus_info.dbus_proxy);
+ telephony_dbus_info.dbus_proxy = NULL;
+
DBG("bluetooth_telephony_deinit -\n");
return BLUETOOTH_TELEPHONY_ERROR_NONE;
}
#define BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE (unsigned int)(0x00100)
typedef enum {
- BLUETOOTH_EVENT_AG_ANSWER = BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE,
- BLUETOOTH_EVENT_AG_RELEASE,
- BLUETOOTH_EVENT_AG_REJECT,
- BLUETOOTH_EVENT_AG_CALL_HOLD_RELEASE_ALL,
- BLUETOOTH_EVENT_AG_CALL_HOLD_RELEASE_ACTIVE,
- BLUETOOTH_EVENT_AG_CALL_HOLD_HOLD_ACTIVE,
- BLUETOOTH_EVENT_AG_CALL_HOLD_ADD_NEW,
- BLUETOOTH_EVENT_AG_CALL_HOLD_TRANSFER,
- BLUETOOTH_EVENT_AG_DTMF,
- BLUETOOTH_EVENT_BT_ENABLED,
- BLUETOOTH_EVENT_BT_DISABLED,
- BLUETOOTH_EVENT_AUDIO_CONNECTED,
- BLUETOOTH_EVENT_AUDIO_DISCONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL = BLUETOOTH_EVENT_TYPE_TELEPHONY_BASE,
+ BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL,
+ BLUETOOTH_EVENT_TELEPHONY_REJECT_CALL,
+ BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL,
+ BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL,
+ BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL,
+ BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL,
+ BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER,
+ BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF,
+ BLUETOOTH_EVENT_TELEPHONY_HFP_CONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_HFP_DISCONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_AUDIO_CONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_AUDIO_DISCONNECTED,
+ BLUETOOTH_EVENT_TELEPHONY_SET_SPEAKER_GAIN,
+ BLUETOOTH_EVENT_TELEPHONY_SET_MIC_GAIN,
} bluetooth_telephony_event_type;
typedef enum {
+bluetooth-frwk (0.1.80) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.80
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 17 Aug 2012 13:02:55 +0900
+
+bluetooth-frwk (0.1.79) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.79
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 16 Aug 2012 17:11:17 +0900
+
+bluetooth-frwk (0.1.78) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.78
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 08 Aug 2012 17:01:37 +0900
+
+bluetooth-frwk (0.1.77) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.77
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 08 Aug 2012 12:16:50 +0900
+
+bluetooth-frwk (0.1.76) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.76
+
+ -- Sunil Kumar Behera <sunil.behera@samsung.com> Tue, 07 Aug 2012 15:58:21 +0530
+
+bluetooth-frwk (0.1.75) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.75
+
+ -- Sunil Kumar Behera <sunil.behera@samsung.com> Tue, 07 Aug 2012 09:29:55 +0530
+
+bluetooth-frwk (0.1.74) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.74
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 06 Aug 2012 18:01:12 +0900
+
+bluetooth-frwk (0.1.73) unstable; urgency=low
+
+ * Replace deprecated APIs about glib-2.3.0
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.73
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 01 Aug 2012 13:50:43 +0900
+
+bluetooth-frwk (0.1.72) unstable; urgency=low
+
+ * Taging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.72
+
+ -- Chethan T N <chethan.tn@samsung.com> Tue, 31 Jul 2012 18:09:09 +0530
+
+bluetooth-frwk (0.1.71) unstable; urgency=low
+
+ * Re-upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.71
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 26 Jul 2012 08:34:33 +0900
+
+bluetooth-frwk (0.1.70) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.70
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 25 Jul 2012 10:56:30 +0900
+
+bluetooth-frwk (0.1.69) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.69
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 20 Jul 2012 14:07:19 +0900
+
+bluetooth-frwk (0.1.68) unstable; urgency=low
+
+ * Tagging and upload the package
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.68
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 19 Jul 2012 16:59:27 +0900
+
+bluetooth-frwk (0.1.67) unstable; urgency=low
+
+ * Upload package for changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.67
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 18 Jul 2012 12:44:25 +0900
+
+bluetooth-frwk (0.1.66) unstable; urgency=low
+
+ * Upload package for changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.66
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 10 Jul 2012 17:56:58 +0900
+
+bluetooth-frwk (0.1.65) unstable; urgency=low
+
+ * Upload package for changes.
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.65
+
+ -- Sunil Kumar Behera <sunil.behera@samsung.com> Wed, 20 Jun 2012 13:02:11 +0530
+
+bluetooth-frwk (0.1.64) unstable; urgency=low
+
+ * Implement the requirements from OSP
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.64
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 13 Jun 2012 09:12:44 +0900
+
+bluetooth-frwk (0.1.63) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.63
+
+ -- Chethan T N <chethan.tn@samsung.com> Tue, 22 May 2012 11:26:43 +0530
+
+bluetooth-frwk (0.1.62) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.62
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 21 May 2012 11:05:02 +0900
+
+bluetooth-frwk (0.1.61) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.61
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 18 May 2012 17:44:58 +0900
+
+bluetooth-frwk (0.1.60) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.60
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 14 May 2012 08:59:54 +0900
+
+bluetooth-frwk (0.1.59) unstable; urgency=low
+
+ * Use the MDM system popup
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.59
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 08 May 2012 08:58:56 +0900
+
+bluetooth-frwk (0.1.58) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.58
+
+ -- Sunil Kumar Behera <sunil.behera@samsung.com> Thu, 26 Apr 2012 12:03:49 +0530
+
+bluetooth-frwk (0.1.57) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.57
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 24 Apr 2012 11:43:25 +0900
+
bluetooth-frwk (0.1.56) unstable; urgency=low
* Upload the changes
- * Git: pkgs/b/bluetooth-frwk
+ * Git: slp/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
+ * Git: slp/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
+ * Git: slp/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
+ * Git: slp/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
+ * Git: slp/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
+ * Set the agent timer
+ * Git: slp/pkgs/b/bluetooth-frwk
* Tag: bluetooth-frwk_0.1.51
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 20 Mar 2012 17:23:57 +0900
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 20 Mar 2012 14:53:10 +0900
+
+bluetooth-frwk (0.1.50) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.50
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 24 Feb 2012 09:50:40 +0900
+
+bluetooth-frwk (0.1.49) unstable; urgency=low
+
+ * Upload the changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.49
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 14 Feb 2012 13:23:45 +0900
+
+bluetooth-frwk (0.1.48) unstable; urgency=low
+
+ * Fix the cancel discovery issue
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.48
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 01 Feb 2012 15:22:45 +0900
+
+bluetooth-frwk (0.1.47) unstable; urgency=low
+
+ * Add the code to get MDM service / release MDM service
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.47
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 31 Jan 2012 17:01:18 +0900
+
+bluetooth-frwk (0.1.46) unstable; urgency=low
-bluetooth-frwk (0.1.48-2) unstable; urgency=low
+ * Remove bluetooth-frwk-test dpkg
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.46
- * Change SAMSUNG -> TIZEN
- * Git: pkgs/b/bluetooth-frwk
- * Tag: bluetooth-frwk_0.1.48-2
+ -- Chanyeol Park <chanyeol.park@samsung.com> Thu, 26 Jan 2012 16:39:08 +0900
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 21 Feb 2012 18:08:53 +0900
+bluetooth-frwk (0.1.45) unstable; urgency=low
-bluetooth-frwk (0.1.48-1) unstable; urgency=low
+ * Restrict BT enable, if mdm_get_allow_bluetooth_mode is MDM_BT_RESTRICTED
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.45
- * Merge with lastest private git
- * Git: pkgs/b/bluetooth-frwk
- * Tag: bluetooth-frwk_0.1.48-1
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 16 Jan 2012 15:36:42 +0900
- -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 09 Feb 2012 14:06:25 +0900
+bluetooth-frwk (0.1.44) unstable; urgency=low
-bluetooth-frwk (0.1.41-1) unstable; urgency=low
+ * Fix the spelling of API name (sessioin -> session)
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.44
- * change "com.samsung" -> "org.tizen"
- * Git: pkgs/b/bluetooth-frwk
- * Tag: bluetooth-frwk_0.1.41-1
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 05 Jan 2012 17:53:01 +0900
- -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 22 Dec 2011 17:57:59 +0900
+bluetooth-frwk (0.1.43) unstable; urgency=low
+
+ * Increase the version number to upload
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.43
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 02 Jan 2012 10:32:04 +0900
+
+bluetooth-frwk (0.1.42) unstable; urgency=low
+
+ * Upload the package to changes
+ * Git: slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.42
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 30 Dec 2011 07:59:59 +0900
bluetooth-frwk (0.1.41) unstable; urgency=low
- * Update Version for build
+ * Remove the input parameter of get_transfers dbus method for obexd
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.41
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 21 Nov 2011 18:07:12 +0900
+
+bluetooth-frwk (0.1.40) unstable; urgency=low
+
+ * Modify the bluetooth_is_supported API
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.40
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 14 Nov 2011 17:16:28 +0900
+
+bluetooth-frwk (0.1.39) unstable; urgency=low
+
+ * Add the 2 APIs for the MDM service
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.39
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 11 Nov 2011 08:35:55 +0900
+
+bluetooth-frwk (0.1.38) unstable; urgency=low
+
+ * Add the full values of the uuid in service list information (Support the CAPI)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.38
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 08 Nov 2011 15:08:35 +0900
+
+bluetooth-frwk (0.1.37) unstable; urgency=low
+
+ * Fix the prevent defect (CID: 57479)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.37
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 28 Oct 2011 14:50:31 +0900
+
+bluetooth-frwk (0.1.36) unstable; urgency=low
+
+ * Change bluetooth_set_discoverable_mode API to sync call (Support the CAPI)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.36
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 26 Oct 2011 17:21:32 +0900
+
+bluetooth-frwk (0.1.35) unstable; urgency=low
+
+ * Modify the error types
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.35
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 25 Oct 2011 10:18:24 +0900
+
+bluetooth-frwk (0.1.34) unstable; urgency=low
+
+ * Modify bluetooth_set_local_name / bluetooth_get_local_name API
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.34
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 19 Oct 2011 12:57:12 +0900
+
+bluetooth-frwk (0.1.33) unstable; urgency=low
+
+ * Change the bluetooth_set_local_name to synchronous call (Support BADA / CAPI)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.33
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 12 Oct 2011 14:47:55 +0900
+
+bluetooth-frwk (0.1.32) unstable; urgency=low
- -- Chanyeol Park <chanyeol.park@samsung.com> Thu, 15 Dec 2011 12:56:57 +0900
+ * Arrange the error type (Support the CAPI)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.32
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 12 Oct 2011 13:48:15 +0900
+
+bluetooth-frwk (0.1.31) unstable; urgency=low
+
+ * Fix the bug about device name (CQ H0100134651)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.31
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 06 Oct 2011 19:32:56 +0900
+
+bluetooth-frwk (0.1.30) unstable; urgency=low
+
+ * Don't call the AUL, if the beat-bluetooth process is not running
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.30
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 06 Oct 2011 18:56:01 +0900
+
+bluetooth-frwk (0.1.29) unstable; urgency=low
+
+ * Return the paired device only in bluetooth_get_bonded_device_list
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.29
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 04 Oct 2011 08:38:03 +0900
+
+bluetooth-frwk (0.1.28) unstable; urgency=low
+
+ * Modify the contact-service API
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.28
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 26 Sep 2011 17:21:23 +0900
+
+bluetooth-frwk (0.1.27) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.27
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 07 Sep 2011 16:34:10 +0900
+
+bluetooth-frwk (0.1.26) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.26
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 07 Sep 2011 08:54:01 +0900
+
+bluetooth-frwk (0.1.25) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.25
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 06 Sep 2011 08:30:18 +0900
+
+bluetooth-frwk (0.1.24) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.24
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 02 Sep 2011 08:37:37 +0900
+
+bluetooth-frwk (0.1.23) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.23
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 29 Aug 2011 19:17:05 +0900
+
+bluetooth-frwk (0.1.22) unstable; urgency=low
+
+ * Upload package for changes
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.22
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 12 Aug 2011 15:57:26 +0900
+
+bluetooth-frwk (0.1.21) unstable; urgency=low
+
+ * Upload package for changes
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.21
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 09 Aug 2011 08:33:57 +0900
+
+bluetooth-frwk (0.1.20) unstable; urgency=low
+
+ * Remove the system popup when the remote device cancel the event (H0100131180)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.20
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 01 Aug 2011 08:27:40 +0900
+
+bluetooth-frwk (0.1.19) unstable; urgency=low
+
+ * Upload package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.19
+
+ -- Jaganath K <jaganath.k@samsung.com> Thu, 07 Jul 2011 13:16:30 +0530
+
+bluetooth-frwk (0.1.18) unstable; urgency=low
+
+ * Fix the bus in stop discoverying
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.18
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 07 Jul 2011 15:29:07 +0900
+
+bluetooth-frwk (0.1.17) unstable; urgency=low
+
+ * Add the bluetooth_get_bonded_device API
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.17
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 28 Jun 2011 15:44:17 +0900
+
+bluetooth-frwk (0.1.16) unstable; urgency=low
+
+ * Upload package for changes
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.16
+
+ -- Sunil Kumar Behera <sunil.behera@samsung.com> Fri, 24 Jun 2011 17:40:21 +0530
+
+bluetooth-frwk (0.1.15) unstable; urgency=low
+
+ * Fix dbus system bus double unref problem
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.15
+
+ -- Chanyeol Park <chanyeol.park@samsung.com> Wed, 22 Jun 2011 21:56:17 +0900
+
+bluetooth-frwk (0.1.14) unstable; urgency=low
+
+ * Add the network API for BT tethering
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.14
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 17 Jun 2011 13:26:44 +0900
+
+bluetooth-frwk (0.1.13) unstable; urgency=low
+
+ * Add the NULL check routine
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.13
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 10 Jun 2011 11:16:56 +0900
+
+bluetooth-frwk (0.1.12) unstable; urgency=low
+
+ * Fix de-init session bug
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.12
+
+ -- Chanyeol Park <chanyeol.park@samsung.com> Thu, 09 Jun 2011 21:57:11 +0900
+
+bluetooth-frwk (0.1.11) unstable; urgency=low
+
+ * Upload package for changes
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.11
+
+ -- Sunil Kumar Behera <sunil.behera@samsung.com> Tue, 07 Jun 2011 19:19:13 +0530
+
+bluetooth-frwk (0.1.10) stable; urgency=low
+
+ * Modify the 'BT enable' check routine
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.10
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 30 May 2011 16:36:11 +0900
+
+bluetooth-frwk (0.1.9) unstable; urgency=low
+
+ * Fix the BS when the process is terminated without deleting the g_timer. (Defect H0100127300)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.9
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 27 May 2011 13:58:01 +0900
+
+bluetooth-frwk (0.1.8) unstable; urgency=low
+
+ * Add the uuid values for developers
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.8
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 25 May 2011 11:07:33 +0900
+
+bluetooth-frwk (0.1.7) unstable; urgency=low
+
+ * Add the 'user_data' parameter in bluetooth_register_callback
+ * Modify the DTS makefile to sbs
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.7
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 20 May 2011 09:01:34 +0900
+
+bluetooth-frwk (0.1.6) unstable; urgency=low
+
+ * Fix Crash while receive image
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.6
+
+ -- Chanyeol Park <chanyeol.park@samsung.com> Thu, 19 May 2011 20:19:04 +0900
+
+bluetooth-frwk (0.1.5) unstable; urgency=low
+
+ * Show the ticker noti when the file recieved (Defect H0100126544)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.5
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 13 May 2011 17:35:58 +0900
+
+bluetooth-frwk (0.1.4) unstable; urgency=low
+
+ * Correct the code about variable memory.
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.4
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 04 May 2011 11:00:59 +0900
+
+bluetooth-frwk (0.1.3) unstable; urgency=low
+
+ * Add the event signal of the authorized (Requested by CAPI part)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.3
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 02 May 2011 18:11:50 +0900
+
+bluetooth-frwk (0.1.2) unstable; urgency=low
+
+ * Remove the obex-agent.h file in install
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.2
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 28 Apr 2011 11:39:33 +0900
+
+bluetooth-frwk (0.1.1) unstable; urgency=low
+
+ * Increase the version
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.1
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 28 Apr 2011 11:23:53 +0900
bluetooth-frwk (0.1.0) unstable; urgency=low
+ * Release ug-obexd init dpkg
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.1.0
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 26 Apr 2011 11:24:07 +0900
+
+bluetooth-frwk (0.0.94) unstable; urgency=low
+
+ * Add the package dependency of the dbus-glib-1
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.94
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 06 Apr 2011 13:16:52 +0900
+
+bluetooth-frwk (0.0.93) unstable; urgency=low
+
+ * Fix the build break
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.93
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 06 Apr 2011 13:01:04 +0900
+
+bluetooth-frwk (0.0.92) unstable; urgency=low
+
+ * Re-upload package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.92
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 07 Mar 2011 15:33:50 +0900
+
+bluetooth-frwk (0.0.91) unstable; urgency=low
+
+ * Upload package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.91
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 07 Mar 2011 10:07:43 +0900
+
+bluetooth-frwk (0.0.90) unstable; urgency=low
+
+ * Modify the API and test case
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.90
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 04 Mar 2011 17:22:45 +0900
+
+bluetooth-frwk (0.0.89) unstable; urgency=low
+
+ * Modify the headset check-routin in auto-pairing
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.89
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 03 Mar 2011 11:16:27 +0900
+
+bluetooth-frwk (0.0.88) unstable; urgency=low
+
+ * Uploading Package
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.88
+
+ -- Jaganath <jaganath.k@samsung.com> Tue, 22 Feb 2011 13:05:13 +0530
+
+bluetooth-frwk (0.0.87) unstable; urgency=low
+
+ * Remove the authorizing popup in enable / diable adapter
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.87
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 11 Feb 2011 10:54:00 +0900
+
+bluetooth-frwk (0.0.86) unstable; urgency=low
+
+ * Fix the prevent defect (FOWARD NULL / BUFFER OVERFLOW)
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.86
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 10 Feb 2011 09:33:29 +0900
+
+bluetooth-frwk (0.0.85) unstable; urgency=low
+
+ * Implement bt_get_bonded_device_list API
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.85
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 20 Jan 2011 19:10:41 +0900
+
+bluetooth-frwk (0.0.84) unstable; urgency=low
+
+ * Move the popup UI to bt-syspopup
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.84
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 06 Jan 2011 14:38:09 +0900
+
+bluetooth-frwk (0.0.83) unstable; urgency=low
+
+ * BT name request fucntion returns error, when BT is not activated
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.83
+
+ -- ChanYeol Park <chanyeol.park@samsung.com> Tue, 04 Jan 2011 14:03:28 +0900
+
+bluetooth-frwk (0.0.82) unstable; urgency=low
+
+ * Made the Adapter.GetProperties Sync during device enable
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.82
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Fri, 24 Dec 2010 15:36:19 +0530
+
+bluetooth-frwk (0.0.81) unstable; urgency=low
+
+ * Block the elm_exit when END key press
+ * Git: 165.213.180.234:slp/pkgs/b/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.81
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 09 Dec 2010 16:24:25 +0900
+
+bluetooth-frwk (0.0.80) unstable; urgency=low
+
+ * Enable the auto-pairing in headset case
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.80
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 26 Nov 2010 13:59:34 +0900
+
+bluetooth-frwk (0.0.79) unstable; urgency=low
+
+ * Add auto-pairing code in headset case
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.79
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 24 Nov 2010 19:02:16 +0900
+
+bluetooth-frwk (0.0.78) unstable; urgency=low
+
+ * Change the AUL name
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.78
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 24 Nov 2010 13:18:10 +0900
+
+bluetooth-frwk (0.0.77) unstable; urgency=low
+
+ * Pop the navigation bar when the passkey view destroy
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.77
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 22 Nov 2010 19:59:09 +0900
+
+bluetooth-frwk (0.0.76) unstable; urgency=low
+
+ * Focus in the entry view
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.76
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 17 Nov 2010 20:37:56 +0900
+
+bluetooth-frwk (0.0.75) unstable; urgency=low
+
+ * Fixed Get Bonded device list end of indication, updated the doxygen PG
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.75
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Wed, 17 Nov 2010 15:54:34 +0530
+
+bluetooth-frwk (0.0.74) unstable; urgency=low
+
+ * Modify the condition value about flight mode
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.74
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 10 Nov 2010 09:49:55 +0900
+
+bluetooth-frwk (0.0.73) unstable; urgency=low
+
+ * Upload package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.73
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 09 Nov 2010 17:29:38 +0900
+
+bluetooth-frwk (0.0.72) unstable; urgency=low
+
+ * Rollback codes
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.72
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 09 Nov 2010 16:36:52 +0900
+
+bluetooth-frwk (0.0.71) unstable; urgency=low
+
+ * Remove evas_object_del after elm_navigationbar_pop
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.71
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 09 Nov 2010 15:19:12 +0900
+
+bluetooth-frwk (0.0.70) unstable; urgency=low
+
+ * Set the intial timeout value to zero
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.70
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 08 Nov 2010 13:44:37 +0900
+
+bluetooth-frwk (0.0.69) unstable; urgency=low
+
+ * Display the indicator
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.69
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 05 Nov 2010 14:12:31 +0900
+
+bluetooth-frwk (0.0.68) unstable; urgency=low
+
+ * Implemented the get bonded device list through DBUS
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.68
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Thu, 04 Nov 2010 12:50:06 +0530
+
+bluetooth-frwk (0.0.67) unstable; urgency=low
+
+ * Move the popup over lock screen
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.67
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 03 Nov 2010 20:54:43 +0900
+
+bluetooth-frwk (0.0.66) unstable; urgency=low
+
+ * Add the homepage in control file
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.66
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 29 Oct 2010 17:13:06 +0900
+
+bluetooth-frwk (0.0.65) unstable; urgency=low
+
+ * Moved the sc_core_agent from btstack
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.65
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 29 Oct 2010 11:00:30 +0900
+
+bluetooth-frwk (0.0.64) unstable; urgency=low
+
+ * Modify / Add files about LiMo Contribution
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.64
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 25 Oct 2010 21:35:37 +0900
+
+bluetooth-frwk (0.0.63) unstable; urgency=low
+
+ * Show the IME when the passkey input
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.63
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 21 Oct 2010 17:48:55 +0900
+
+bluetooth-frwk (0.0.62) unstable; urgency=low
+
+ * Fix Device Property Changed UUIDs signal call back bug
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.62
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 21 Oct 2010 11:25:34 +0900
+
+bluetooth-frwk (0.0.61) unstable; urgency=low
+
+ * Upload package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.61
+
+ -- Hye-Jin Kim <hyejin0906.kim@samsung.com> Wed, 20 Oct 2010 16:48:47 +0900
+
+bluetooth-frwk (0.0.60) unstable; urgency=low
+
+ * Modified the rfcomm connect API
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.60
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Tue, 19 Oct 2010 11:13:38 +0530
+
+bluetooth-frwk (0.0.59) unstable; urgency=low
+
+ * Reupload the package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.59
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 13 Oct 2010 20:25:41 +0900
+
+bluetooth-frwk (0.0.58) unstable; urgency=low
+
+ * Move the bt-agent script to rc.5
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.58
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 13 Oct 2010 18:11:18 +0900
+
+bluetooth-frwk (0.0.57) unstable; urgency=low
+
+ * Implemented bluetooth_get_bonded_device_list API
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.57
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Fri, 08 Oct 2010 18:32:51 +0530
+
+bluetooth-frwk (0.0.56) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.56
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 06 Oct 2010 16:41:39 +0900
+
+bluetooth-frwk (0.0.55) unstable; urgency=low
+
+ * Modify the TETware code
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.55
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 06 Oct 2010 16:08:56 +0900
+
+bluetooth-frwk (0.0.54) unstable; urgency=low
+
+ * Update the Programming Guide
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.54
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 01 Oct 2010 15:22:54 +0900
+
+bluetooth-frwk (0.0.53) unstable; urgency=low
+
+ * Modify the visibility
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.53
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 01 Oct 2010 13:42:02 +0900
+
+bluetooth-frwk (0.0.52) unstable; urgency=low
+
+ * Modify the BT aul to the backgroud mode
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.52
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 01 Oct 2010 09:00:45 +0900
+
+bluetooth-frwk (0.0.51) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.51
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Thu, 30 Sep 2010 18:20:43 +0530
+
+bluetooth-frwk (0.0.50) unstable; urgency=low
+
+ * Upload the package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.50
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 17 Sep 2010 19:39:58 +0900
+
+bluetooth-frwk (0.0.49) unstable; urgency=low
+
+ * Fix the TETware code
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.49
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 17 Sep 2010 19:02:30 +0900
+
+bluetooth-frwk (0.0.48) unstable; urgency=low
+
+ * Add the TETware code
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.48
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 17 Sep 2010 10:47:01 +0900
+
+bluetooth-frwk (0.0.47) unstable; urgency=low
+
+ * Upload package
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.47
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 16 Sep 2010 09:35:21 +0900
+
+bluetooth-frwk (0.0.46) unstable; urgency=low
+
+ * Added the Connected event and made connect Async
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.46
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Tue, 14 Sep 2010 12:48:33 +0530
+
+bluetooth-frwk (0.0.45) unstable; urgency=low
+
+ * Modify the GAP API
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.45
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 14 Sep 2010 16:02:42 +0900
+
+bluetooth-frwk (0.0.44) unstable; urgency=low
+
+ * Apply new font guide
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.44
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Sat, 11 Sep 2010 10:16:37 +0900
+
+bluetooth-frwk (0.0.43) unstable; urgency=low
+
+ * Repacke for EFL upgrade
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.43
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 10 Sep 2010 19:09:14 +0900
+
+bluetooth-frwk (0.0.42) unstable; urgency=low
+
+ * Added the support for Rfcomm api's multiple server and client with in
+ single process
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.42
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Mon, 06 Sep 2010 18:50:55 +0530
+
+bluetooth-frwk (0.0.41) unstable; urgency=low
+
+ * Fixed the socket fd leak during the ACL link break when the client is connected
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.41
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Tue, 31 Aug 2010 21:36:19 +0530
+
+bluetooth-frwk (0.0.40) unstable; urgency=low
+
+ * Added device address to the connection status structure
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.40
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Tue, 31 Aug 2010 14:30:32 +0530
+
+bluetooth-frwk (0.0.39) unstable; urgency=low
+
+ * Added rfcomm API's
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.39
+
+ -- Syam Sidhardhan <s.syam@samsung.com> Mon, 30 Aug 2010 21:37:52 +0530
+
+bluetooth-frwk (0.0.38) unstable; urgency=low
+
+ * Code cleanup
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.38
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 30 Aug 2010 14:23:28 +0900
+
+bluetooth-frwk (0.0.37) unstable; urgency=low
+
+ * Add the SLP-DevGuide files
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.37
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 26 Aug 2010 08:25:20 +0900
+
+bluetooth-frwk (0.0.36) unstable; urgency=low
+
+ * Fix the prevent defect
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.36
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 24 Aug 2010 21:04:28 +0900
+
+bluetooth-frwk (0.0.35) unstable; urgency=low
+
+ * Modify the doxygen comments
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.35
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 20 Aug 2010 18:15:04 +0900
+
+bluetooth-frwk (0.0.34) unstable; urgency=low
+
+ * Apply the beat winset
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.34
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 20 Aug 2010 09:53:49 +0900
+
+bluetooth-frwk (0.0.33) unstable; urgency=low
+
+ * Apply the beat winset
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.33
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 17 Aug 2010 16:38:31 +0900
+
+bluetooth-frwk (0.0.32) unstable; urgency=low
+
+ * Chane elm_notify APIs to elm_popup APIs
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.32
+
+ -- Hye-Jin Kim <hyejin0906.kim@samsung.com> Tue, 10 Aug 2010 10:04:18 +0900
+
+bluetooth-frwk (0.0.31) unstable; urgency=low
+
+ * Call the AUL message when agent start
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.31
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 06 Aug 2010 18:16:42 +0900
+
+bluetooth-frwk (0.0.30) unstable; urgency=low
+
+ * Apply new appcore
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.30
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 05 Aug 2010 22:05:49 +0900
+
+bluetooth-frwk (0.0.29) unstable; urgency=low
+
+ * Fix disabled event code
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.29
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Tue, 03 Aug 2010 16:35:28 +0900
+
+bluetooth-frwk (0.0.28) unstable; urgency=low
+
+ * Fix the bug about discovering (Adjust the range of unsigned int)
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.28
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Fri, 30 Jul 2010 15:30:25 +0900
+
+bluetooth-frwk (0.0.27) unstable; urgency=low
+
+ * Fix print log format
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.27
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Fri, 30 Jul 2010 09:41:25 +0900
+
+bluetooth-frwk (0.0.25) unstable; urgency=low
+
+ * Fix password entry in input view to show the last inputed value
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.25
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Fri, 23 Jul 2010 19:50:35 +0900
+
+bluetooth-frwk (0.0.24) unstable; urgency=low
+
+ * Add missing major class enum and fix wrong discoverable mode value in
+ visibility changed event
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.24
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Thu, 22 Jul 2010 22:23:04 +0900
+
+bluetooth-frwk (0.0.23) unstable; urgency=low
+
+ * Fix theme setting envrionment string
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.23
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Thu, 22 Jul 2010 19:58:50 +0900
+
+bluetooth-frwk (0.0.22) unstable; urgency=low
+
+ * Fix to send proper device information after pairing
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.22
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Tue, 20 Jul 2010 20:44:54 +0900
+
+bluetooth-frwk (0.0.21) unstable; urgency=low
+
+ * Fix doxygen group for SDK document
+ * Git: 165.213.180.234:/git/slp/pkgs/bluetooth-frwk
+ * Tag: bluetooth-frwk_0.0.21
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Thu, 15 Jul 2010 14:10:23 +0900
+
+bluetooth-frwk (0.0.20) unstable; urgency=low
+
+ * Fix to show IME on paring by adding focusing option
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.20
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Tue, 13 Jul 2010 11:39:37 +0900
+
+bluetooth-frwk (0.0.19) unstable; urgency=low
+
+ * Add window layer lower API to hide function
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.19
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Mon, 12 Jul 2010 19:25:21 +0900
+
+bluetooth-frwk (0.0.18) unstable; urgency=low
+
+ * Fix PIN code length display in agent as scalable UI
+ * Fix input method framework API to new version
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.18
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Mon, 12 Jul 2010 14:58:55 +0900
+
+bluetooth-frwk (0.0.17) unstable; urgency=low
+
+ * Fix set local name after enabling
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.17
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Thu, 08 Jul 2010 19:45:40 +0900
+
+bluetooth-frwk (0.0.16) unstable; urgency=low
+
+ * Fix set discoverable mode with no timeout
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.16
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Thu, 08 Jul 2010 19:18:47 +0900
+
+bluetooth-frwk (0.0.15) unstable; urgency=low
+
+ * Modify the maintainer list
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.15
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 08 Jul 2010 10:52:24 +0900
+
+bluetooth-frwk (0.0.14) unstable; urgency=low
+
+ * Fix struct for doc
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.14
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Mon, 05 Jul 2010 19:06:41 +0900
+
+bluetooth-frwk (0.0.13) unstable; urgency=low
+
+ * Enable SDP API, Add GAP API implementation
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.13
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Thu, 24 Jun 2010 13:57:12 +0900
+
+bluetooth-frwk (0.0.12) unstable; urgency=low
+
+ * Add func,line info in dlog
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.12
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Wed, 16 Jun 2010 20:59:12 +0900
+
+bluetooth-frwk (0.0.11) unstable; urgency=low
+
+ * Dlog api changes applied
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.11
+
+ -- Shriram Joshi <shriram.j@samsung.com> Tue, 15 Jun 2010 19:44:16 +0530
+
+bluetooth-frwk (0.0.10) unstable; urgency=low
+
+ * Add show/hide win_main evas object
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.10
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Tue, 15 Jun 2010 17:34:49 +0900
+
+bluetooth-frwk (0.0.9) unstable; urgency=low
+
+ * Fix Window Show/Hide operation
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.9
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Tue, 15 Jun 2010 15:15:24 +0900
+
+bluetooth-frwk (0.0.8) unstable; urgency=low
+
+ * Hide Agent during booting time with BT activation state
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.8
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Tue, 15 Jun 2010 12:15:52 +0900
+
+bluetooth-frwk (0.0.7) unstable; urgency=low
+
+ * Modify bool as gboolean
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.7
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Mon, 14 Jun 2010 18:34:36 +0900
+
+bluetooth-frwk (0.0.6) unstable; urgency=low
+
+ * Fix debug dpkg option
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.6
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Sat, 12 Jun 2010 15:20:57 +0900
+
+bluetooth-frwk (0.0.5) unstable; urgency=low
+
+ * Add agent activation/deactivation mechanism
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.5
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Thu, 10 Jun 2010 21:49:46 +0900
+
+bluetooth-frwk (0.0.4) unstable; urgency=low
+
+ * Temporarily Remove Adapter Signal Handle
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.4
+
+ -- chanyeol.park <chanyeol.park@samsung.com> Wed, 09 Jun 2010 13:55:31 +0900
+
+bluetooth-frwk (0.0.3) unstable; urgency=low
+
+ * Add more APIs for GAP
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.3
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Mon, 31 May 2010 22:56:59 +0900
+
+bluetooth-frwk (0.0.2) unstable; urgency=low
+
+ * Add Doxygen generate flag in control
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.2
+
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Mon, 31 May 2010 11:21:26 +0900
+
+bluetooth-frwk (0.0.1) unstable; urgency=low
+
* Initial Release.
+ * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/bluetooth-frwk-0
+ * Tag: bluetooth-frwk_0.0.1
- -- Chanyeol Park <chanyeol.park@samsung.com> Wed, 07 Dec 2011 13:00:03 +0900
+ -- Seung-Woo Kim <sw0312.kim@samsung.com> Sat, 29 May 2010 18:44:49 +0900
#export DH_VERBOSE=1
CFLAGS ?= -Wall -g
-LDFLAGS ?=
+LDFLAGS ?=
PREFIX ?= /usr
DATADIR ?= /opt
rm -f bluetooth-map-agent/Makefile
rm -f bluetooth-frwk-agent/po/Makefile
rm -f lib/test/Makefile
-
+
rm -f lib/*.pc
rm -f lib/marshal.c
rm -f lib/marshal.h
rm -f bluetooth-frwk-agent/marshal.c
rm -f bluetooth-frwk-agent/marshal.h
+ rm -f bluetooth-telephony/marshal.c
+ rm -f bluetooth-telephony/marshal.h
+
rm -f bluetooth-frwk-agent/sc_core_agent_glue.h
rm -f bluetooth-frwk-agent/bluetooth_obex_agent_glue.h
rm -f bluetooth-pb-agent/bluetooth_pb_agent_glue.h
rm -f bluetooth-map-agent/bluetooth_map_agent_glue.h
-
- dh_clean
+ rm -f bluetooth-telephony/bluetooth-telephony-glue.h
+
+ rm -f bluetooth-media-control/Makefile
+ rm -f bluetooth-media-control/bluetooth-media-control.pc
+ rm -f bluetooth-media-control/test/Makefile
+
+ dh_clean
install: build
dh_testdir
dh_testroot
- dh_clean -k
+ dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/wavplayer.
binary-arch: build install
dh_testdir
dh_testroot
- dh_installchangelogs
+ dh_installchangelogs
dh_installdocs
dh_installexamples
dh_install --sourcedir=debian/tmp
# dh_installmenu
-# dh_installdebconf
+# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(bluetooth-api C)
-SET(SRCS bluetooth-api-common.c marshal.c bluetooth-gap-api.c bluetooth-sdp-api.c bluetooth-rfcomm-api.c bluetooth-network-api.c bluetooth-hdp-api.c obex-agent.c bluetooth-opc-api.c
-bluetooth-obex-server-api.c bluetooth-hid-api.c)
-SET(HEADERS bluetooth-api.h bluetooth-hid-api.h)
+SET(SRCS bluetooth-api-common.c marshal.c bluetooth-gap-api.c bluetooth-sdp-api.c bluetooth-rfcomm-api.c bluetooth-network-api.c bluetooth-hdp-api.c obex-agent.c bluetooth-opc-api.c bluetooth-obex-server-api.c bluetooth-hid-api.c bluetooth-audio-api.c bluetooth-control-api.c bluetooth-le/bluetooth-gatt-api.c)
+SET(HEADERS bluetooth-api.h bluetooth-hid-api.h bluetooth-audio-api.h bluetooth-control-api.h)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE(FindPkgConfig)
-pkg_check_modules(packages REQUIRED dlog dbus-glib-1 gobject-2.0 gmodule-2.0 vconf
+pkg_check_modules(packages REQUIRED dlog dbus-glib-1 gobject-2.0 gmodule-2.0 vconf
libxml-2.0 syspopup-caller)
FOREACH(flag ${packages_CFLAGS})
FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool)
EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=obex_agent ${CMAKE_CURRENT_SOURCE_DIR}/obex-agent.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/obex-agent-glue.h")
+EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bluetooth_gatt ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-le/bluetooth-gatt.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-le/bluetooth-gatt-glue.h")
#SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
FOREACH(hfile ${HEADERS})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/bluetooth-api)
ENDFOREACH(hfile)
-
DBG("+\n");
- manager_proxy = dbus_g_proxy_new_for_name(conn, "org.bluez", "/", "org.bluez.Manager");
+ if (conn == NULL)
+ return BLUETOOTH_ERROR_INTERNAL;
+
+ manager_proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
+ BLUEZ_MANAGER_OBJ_PATH, BLUEZ_MANAGER_INTERFACE);
if (manager_proxy == NULL) {
DBG("Could not create a dbus proxy\n");
return BLUETOOTH_ERROR_NONE;
}
+DBusGProxy *_bluetooth_internal_get_adapter_proxy(DBusGConnection *conn)
+{
+ GError *err = NULL;
+ DBusGProxy *manager_proxy = NULL;
+ DBusGProxy *adapter_proxy = NULL;
+ char *adapter_path = NULL;
+
+ DBG("+\n");
+
+ if (conn == NULL)
+ return NULL;
+
+ manager_proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
+ BLUEZ_MANAGER_OBJ_PATH, BLUEZ_MANAGER_INTERFACE);
+
+ if (manager_proxy == NULL) {
+ DBG("Could not create a dbus proxy\n");
+ return NULL;
+ }
+
+ if (!dbus_g_proxy_call(manager_proxy, "DefaultAdapter", &err,
+ G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, &adapter_path,
+ G_TYPE_INVALID)) {
+ if (err != NULL) {
+ DBG("Getting DefaultAdapter failed: [%s]\n", err->message);
+ g_error_free(err);
+ }
+ g_object_unref(manager_proxy);
+ return NULL;
+ }
+
+ if (adapter_path == NULL || strlen(adapter_path) >= BT_ADAPTER_OBJECT_PATH_MAX) {
+ DBG("Adapter path is inproper\n");
+ g_object_unref(manager_proxy);
+ return NULL;
+ }
+
+ adapter_proxy = dbus_g_proxy_new_for_name(conn,
+ BLUEZ_SERVICE_NAME,
+ adapter_path,
+ BLUEZ_ADAPTER_INTERFACE);
+
+ g_object_unref(manager_proxy);
+
+ return adapter_proxy;
+}
+
+
void _bluetooth_internal_convert_addr_string_to_addr_type(bluetooth_device_address_t *addr,
const char *address)
{
}
}
-static int __bluetooth_internal_store_set_value(const char *key, bt_store_type_t store_type,
- void *value)
-{
- int ret = 0;
- int int_vlaue = 0;
-
- if (value == NULL) {
- return -1;
- }
-
- switch (store_type) {
- case BT_STORE_BOOLEAN:
- int_vlaue = *((gboolean *) value);
- ret = vconf_set_bool(key, int_vlaue);
- break;
- case BT_STORE_INT:
- int_vlaue = *((int *)value);
- ret = vconf_set_int(key, int_vlaue);
- break;
- case BT_STORE_STRING:
- ret = vconf_set_str(key, (char *)value);
- break;
- default:
- DBG("Unknown Store Type");
- return -1;
- }
-
- return ret;
-}
-
static int __bluetooth_internal_store_get_value(const char *key,
bt_store_type_t store_type,
unsigned int size, void *value)
{
DBusGProxy *device_proxy = NULL;
- device_proxy = dbus_g_proxy_new_for_name(bt_info.conn, "org.bluez",
- path, "org.bluez.Device");
+ device_proxy = dbus_g_proxy_new_for_name(bt_info.conn, BLUEZ_SERVICE_NAME,
+ path, BLUEZ_DEVICE_INTERFACE);
if (device_proxy) {
bt_info.device_proxy_list = g_list_append(bt_info.device_proxy_list,
device_proxy);
GValue *value,
gpointer user_data)
{
- int ret = 0;
DBG("+ property[%s]", property);
if (g_strcmp0(property, "Name") == 0) {
paired);
} else {
_bluetooth_internal_remote_device_found_cb(address,
+ rssi,
remote_class,
- rssi, paired);
+ paired);
}
}
g_strlcpy(bt_info.adapter_path, adapter_path, BT_ADAPTER_OBJECT_PATH_MAX);
bt_info.adapter_proxy =
- dbus_g_proxy_new_for_name(bt_info.conn, "org.bluez", bt_info.adapter_path,
- "org.bluez.Adapter");
+ dbus_g_proxy_new_for_name(bt_info.conn, BLUEZ_SERVICE_NAME, bt_info.adapter_path,
+ BLUEZ_ADAPTER_INTERFACE);
if (!bt_info.adapter_proxy) {
AST("Could not create a dbus proxy");
return BLUETOOTH_ERROR_INTERNAL;
DBG("Name str = %s", name);
- if (g_strcmp0(name, "org.bluez") == 0 && *new == '\0') {
+ if (g_strcmp0(name, BLUEZ_SERVICE_NAME) == 0 && *new == '\0') {
DBG("BlueZ is terminated");
bt_info.bt_adapter_state = BLUETOOTH_ADAPTER_DISABLED;
void *param_data = NULL;
int scanEnable = 0;
+ if (changed_mode == NULL) {
+ ERR("changed_mode is NULL");
+ return;
+ }
+
DBG("Mode changed [%s]\n", changed_mode);
if (strlen(changed_mode) == 0) {
{
GError *err = NULL;
const char *adapter_path = NULL;
- int ret = 0;
DBG("+\n");
if (bt_info.application_pid == 0) {
NULL, NULL);
}
- bt_info.manager_proxy = dbus_g_proxy_new_for_name(bt_info.conn, "org.bluez", "/",
- "org.bluez.Manager");
+ bt_info.manager_proxy = dbus_g_proxy_new_for_name(bt_info.conn, BLUEZ_SERVICE_NAME,
+ BLUEZ_MANAGER_OBJ_PATH, BLUEZ_MANAGER_INTERFACE);
if (!bt_info.manager_proxy) {
AST("Could not create a dbus proxy");
return;
return is_supported;
}
-BT_EXPORT_API int bluetooth_allow_service(gboolean allow)
-{
- DBG("+\n");
-
- /* Vconf value 1: Restrict to use BT service
- Vconf value 0: Allow to use BT service */
- if (vconf_set_bool(BT_MEMORY_KEY_RESTRICTION, !allow))
- return BLUETOOTH_ERROR_ACCESS_DENIED;
-
- if (allow == FALSE)
- bluetooth_disable_adapter();
-
- DBG("-\n");
-
- return BLUETOOTH_ERROR_NONE;
-}
-
-
BT_EXPORT_API int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
{
_bluetooth_internal_session_init();
#include <malloc.h>
#include <errno.h>
#include <sys/types.h>
+#include <libintl.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
#define AST(fmt, args...) \
SLOG(LOG_ERROR, BT_FRWK, "%s():%d "fmt, __func__, __LINE__, ##args)
-#define BT_STORE_PREFIX "db/bluetooth/"
-#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"
#define BT_SETTING_DEVICE_NAME "db/setting/device_name"
+#define BT_MEMORY_OBEX_NO_AGENT "memory/private/libbluetooth-frwk-0/obex_no_agent"
+#define BT_MEMORY_RFCOMM_UUID "memory/private/libbluetooth-frwk-0/uuid"
+#define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
-#define BT_SYSPOPUP_NAME "bt-syspopup"
-#define BT_SECURITY_EVENT "bt-security"
-#define BT_SECURITY_DISABLED "disabled"
+#define BLUEZ_SERVICE_NAME "org.bluez"
+#define BLUEZ_MANAGER_OBJ_PATH "/"
+#define BLUEZ_MANAGER_INTERFACE "org.bluez.Manager"
-#define BLUEZ_NAME "org.bluez"
-#define BLUEZ_ADAPTER_NAME "org.bluez.Adapter"
+#define BLUEZ_ADAPTER_INTERFACE "org.bluez.Adapter"
+#define BLUEZ_DEVICE_INTERFACE "org.bluez.Device"
+
+#define BT_AGENT_INTERFACE "User.Bluetooth.agent"
#define HCI_SCAN_ENABLE_NO_SCAN 0x00
#define HCI_SCAN_ENABLE_INQUIRY_ONLY 0x01
#define BLUETOOTH_UUID_POSTFIX "0000-1000-8000-00805f9b34fb"
+#define BT_COMMON_PKG "ug-setting-bluetooth-efl"
+
+#define BT_STR_DISABLED_RESTRICTS \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SECURITY_POLICY_RESTRICTS_USE_OF_BLUETOOTH_CONNECTION")
+
+#define BT_STR_HANDS_FREE_RESTRICTS \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SECURITY_POLICY_RESTRICTS_USE_OF_BLUETOOTH_CONNECTION_TO_HANDS_FREE_FEATURES_ONLY")
+
#define RFKILL_EVENT_SIZE 8
#define BT_PHONE_NUM_LEN 50
#define BT_FILE_BUFFER_MAX 256
+#define SLEEP_TIME 50000 /* 50 ms */
+#define BLOCK_MAX_TIMEOUT 2000000 /* 2 seconds */
+
typedef enum {
BT_STORE_BOOLEAN,
BT_STORE_INT,
NUM_RFKILL_TYPES,
} rfkill_type;
+typedef enum {
+ BT_ACCEPT,
+ BT_REJECT,
+ BT_CANCEL,
+ BT_TIMEOUT,
+} bt_accept_type_t;
+
typedef struct {
unsigned int idx;
unsigned char type;
DBusGProxy *adapter_proxy; /**< bluez adapter ipc proxy */
DBusGProxy *agent_proxy; /**< Agent ipc proxy */
DBusGProxy *network_server_proxy;
+ DBusGProxy *rfcomm_proxy;
char adapter_path[BT_ADAPTER_OBJECT_PATH_MAX]; /*bluez adapter path*/
+ char *connecting_uuid;
GList *device_proxy_list; /**< bluez device ipc proxy list */
bluetooth_adapter_state_t bt_adapter_state; /*Current bluetooth state*/
void _bluetooth_internal_device_path_to_address(const char *device_path,
char *device_address);
-int _bluetooth_internal_get_value(bt_store_key_t key);
-int _bluetooth_internal_set_value(bt_store_key_t key);
-
int _bluetooth_get_default_adapter_name(bluetooth_device_name_t *dev_name, int size);
int _bluetooth_internal_get_adapter_path(DBusGConnection *conn, char *path);
+DBusGProxy *_bluetooth_internal_get_adapter_proxy(DBusGConnection *conn);
#ifdef __cplusplus
extern "C" {
/**< Base ID for OPC events */
#define BLUETOOTH_EVENT_OBEX_SERVER_BASE ((int)(BLUETOOTH_EVENT_OPC_BASE + 0x0020))
/**< Base ID for Obex Server events */
+#define BLUETOOTH_EVENT_GATT_BASE ((int)(BLUETOOTH_EVENT_OBEX_SERVER_BASE + 0x0020))
+ /**< Base ID for GATT events */
+
+#define BLUETOOTH_EVENT_AUDIO_BASE ((int)(BLUETOOTH_EVENT_GATT_BASE + 0x0020))
+ /**< Base ID for Audio events */
+#define BLUETOOTH_EVENT_HID_BASE ((int)(BLUETOOTH_EVENT_AUDIO_BASE + 0x0020))
+ /**< Base ID for Audio events */
/**
* Bluetooth event type
*/
BLUETOOTH_EVENT_RFCOMM_CONNECTED, /**< Rfcomm server incomming connection */
BLUETOOTH_EVENT_RFCOMM_DISCONNECTED, /**< Rfcomm server/client disconnect */
+ BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
+
BLUETOOTH_EVENT_DEVICE_CONNECTED, /**< Bluetooth event device connected */
BLUETOOTH_EVENT_DEVICE_DISCONNECTED, /**< Bluetooth event device disconnected */
BLUETOOTH_EVENT_NETWORK_CONNECTED, /**< Network connected event in client*/
BLUETOOTH_EVENT_NETWORK_DISCONNECTED, /**< Network disconnected evnet in client*/
- BLUETOOTH_EVENT_HDP_ACTIVATED
- = BLUETOOTH_EVENT_HDP_BASE, /**<HDP Activation for Source and Sync>*/
- BLUETOOTH_EVENT_HDP_DEACTIVATED, /**<HDP DeActivation for Source and Sync>*/
- BLUETOOTH_EVENT_HDP_CONNECTED, /**<HDP Connect>*/
+ BLUETOOTH_EVENT_HDP_CONNECTED
+ = BLUETOOTH_EVENT_HDP_BASE, /**<HDP Connect>*/
BLUETOOTH_EVENT_HDP_DISCONNECTED, /**<HDP Disconnect>*/
BLUETOOTH_EVENT_HDP_DATA_RECEIVED, /**<HDP Data Indication>*/
BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED, /* Obex Server transfer started event*/
BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,/* Obex Server transfer progress event*/
BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,/* Obex Server transfer complete event*/
-
- BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
+ BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE,
+
+ BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED = BLUETOOTH_EVENT_GATT_BASE,
+ /**<Discovered GATT service characteristics event*/
+ BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
+ /**<Remote GATT charateristic value changed event*/
+ BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
+ BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
+ BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
+ BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
+ BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
+ BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED, /**<AV & AG service disconnected event*/
+ BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
+ BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
+ BLUETOOTH_HID_CONNECTED= BLUETOOTH_EVENT_HID_BASE, /**<HID Connected event*/
+ BLUETOOTH_HID_DISCONNECTED, /**<HID Disconnected event*/
+ BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
} bluetooth_event_type_t;
/**
BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101), /**<SPP*/
BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102), /**<LAP*/
BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103), /**<DUN*/
- BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104), /**<OBEX IR MC SYNC*/
- BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105), /**<OPP*/
+ BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104), /**<OBEX IR MC SYNC*/
+ BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105), /**<OPP*/
BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106), /**<FTP*/
BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107), /**<IRMC SYNC COMMAND*/
BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108), /**<HS*/
BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109), /**<CTP*/
BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A), /**<AUDIO SOURCE*/
BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B), /**<AUDIO SINK*/
- BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C), /**<AV REMOTE CONTROL
+ BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C), /**<AV REMOTE CONTROL
TARGET*/
- BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
- BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E), /**<AV REMOTE CONTROL UUID*/
+ BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
+ BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E), /**<AV REMOTE CONTROL UUID*/
BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110), /**<ICP*/
BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111), /**<FAX*/
int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
bluetooth_device_address_t device_addr;
/**< device address */
+ char *uuid;
} bluetooth_rfcomm_connection_t;
/**
typedef struct {
int socket_fd;
/**< the socket fd */
+ int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
bluetooth_device_address_t device_addr;
/**< device address */
+ char *uuid;
} bluetooth_rfcomm_disconnection_t;
+typedef struct {
+ int socket_fd;
+ /**< the socket fd */
+ bluetooth_device_address_t device_addr;
+ /**< device address */
+} bluetooth_rfcomm_connection_request_t;
+
/**
* HDP QOS types
*/
HDP_ROLE_SINK
}bt_hdp_role_type_t;
-/**
- * Stucture to HDP activated
- */
-typedef struct {
- const char *app_handle; /**< the application handle */
-} bt_hdp_activate_t;
-
-/**
- * Stucture to HDP deactivate
- */
-typedef struct {
- const char *app_handle; /**< the application handle */
-} bt_hdp_deactivate_t;
/**
* Stucture to HDP connected
typedef struct {
char *filename;
int size;
+ int percentage;
}bt_opc_transfer_info_t;
/* Obex Server transfer type */
} bt_oob_data_t;
/**
+ * Structure to GATT attribute handle data
+ */
+
+typedef struct {
+ int count;
+ char **handle;
+} bt_gatt_handle_info_t;
+
+/**
+ * Structure to GATT Remote service data
+ */
+
+typedef struct {
+ char *uuid;
+ bt_gatt_handle_info_t handle_info;
+} bt_gatt_service_property_t;
+
+/**
+ * Structure to GATT Remote characteristic data
+ */
+
+typedef struct {
+ char *service_handle;
+ bt_gatt_handle_info_t handle_info;
+} bt_gatt_discovered_char_t;
+
+/**
+ * Structure to format of GATT Characteristic Value
+ */
+
+typedef struct {
+ unsigned char format;
+ unsigned char exponent;
+ unsigned short unit;
+ unsigned char name_space;
+ unsigned short description;
+} bt_gatt_char_format_t;
+
+/**
+ * Structure to GATT Characteristic property
+ */
+
+typedef struct {
+ char *uuid;
+ char *name;
+ char *description;
+ bt_gatt_char_format_t format;
+ unsigned char *val;
+ unsigned int val_len;
+ char *representation;
+} bt_gatt_char_property_t;
+
+/**
+ * Structure to GATT Characteristic value
+ */
+
+typedef struct {
+ char *char_handle;
+ guint8 *char_value;
+} bt_gatt_char_value_t;
+
+/**
* Callback pointer type
*/
typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
*
* @return BLUETOOTH_ERROR_NONE - Success\n
* BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
- * BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
* BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
* @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
* @remark None
*
* This API checks whether the bluetooth is supported or not.
* This API only run by root permission.
- * This API was made for the MDM service.
*
* This function is a synchronous call.
*
*/
int bluetooth_is_supported(void);
-/**
- * @fn int bluetooth_allow_service(gboolean allow)
- * @brief Allow to start the bluetooth service
- *
- * This API is to allow the bluetooth service.
- * If allow value is FALSE, disable the adapter. and user can't enable the adapter
- * before allow value is to be TRUE or reboot.
- * If user reboot the phone, this allow value will be TRUE. (If no one set the allow value again)
- * This API only run by root permission.
- * This API was made for the MDM service.
- *
- * This function is a synchronous call.
- *
- * @param[in] allow the mode to allow BT service
- * @return BLUETOOTH_ERROR_NONE - success to change the value\n
- * BLUETOOTH_ERROR_ACCESS_DENIED - access denied because of the permission \n
- * @remark None
-@code
-
-int ret = 0;
-ret = bluetooth_is_supported();
-@endcode
- */
-int bluetooth_allow_service(gboolean allow);
-
/**
* @fn int bluetooth_check_adapter(void)
*
* @remark None
+@code
bluetooth_device_name_t local_name={0,}
int ret = 0;
ret = bluetooth_set_local_name (&local_name);
*/
int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
+
+/**
+ * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
+ * @brief Check if the uuid is used or not
+ *
+ * This function is used to check if the uuid is used or not.
+ *
+ * This function is a synchronous call.
+ *
+ * @param[in] service_uuid service uuid (UUID 128 bit as string)
+ * @param[out] used if the uuid is used or not
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
+ * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
+ *
+ * @remark None
+ *
+@code
+gboolean used = FALSE;
+const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
+ret = bluetooth_is_service_used(uuid, &used);
+@endcode
+ */
+int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
+
+
/**
* @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
* @brief Get the visibility mode
* BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
* BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
* @param[in] int socket_fd
- * @param[in] UUID (128 bits)
*
* @remark None
* @see bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
....
- ret = bluetooth_rfcomm_remove_socket(fd, rfcomm_test_uuid);
+ ret = bluetooth_rfcomm_remove_socket(fd);
@endcode
*/
-int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid);
+int bluetooth_rfcomm_remove_socket(int socket_fd);
+
+
+/**
+ * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
+ * @brief Disconnect rfcomm connection
+ *
+ *
+ * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
+ * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
+ * remote server.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
+ * @param[in] char remote bt_address
+ *
+ * @remark None
+ *
+ @code
+
+ ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
+ if (ret < 0)
+ printf("Disconnection failed");
+ else
+ printf("Disconnection Success");
+
+ @endcode
+ */
+int bluetooth_rfcomm_server_disconnect(int socket_fd);
+
/**
* @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
/**
+ * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
+ * @brief Rfcomm socket listen
+ *
+ *
+ * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
+ * after the bluetooth_rfcomm_create_socket API.
+ * This API listen for the incomming connection and once it receives a connection, it will give
+ * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
+ * event to the application. This is an Asynchronous API call.
+ *
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
+
+ * @param[in] int socket_fd
+ * @param[in] max pending connection.
+ *
+ * @remark None
+ * @see bluetooth_rfcomm_create_socket
+ *
+ @code
+ void bt_event_callback(int event, bluetooth_event_param_t* param)
+ {
+ switch(event)
+ {
+ case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
+ {
+ char *name = (char *)param->param_data;
+
+ printf("\nConnected from %s", name);
+
+ bluetooth_rfcomm_accept_connection();
+ }
+ }
+ }
+
+ ...
+
+ int ret = 0;
+ fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
+ ret = bluetooth_rfcomm_listen(fd, 1);
+
+ @endcode
+ */
+int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
+
+/**
+ * @fn int bluetooth_rfcomm_accept_connection()
+ * @brief Accepts the authorization request indicated by the event
+ * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ *
+ * @param[in] the socket fd of the server
+ * @param[out] the socket fd of the client
+ *
+ * @exception None
+ * @remark None
+ * @see bluetooth_rfcomm_reject_connection
+ */
+int bluetooth_rfcomm_accept_connection(int server_fd, int *client_fd);
+
+/**
+ * @fn int bluetooth_rfcomm_reject_connection()
+ * @brief Rejects the authorization request indicated by the event
+ * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ *
+ * @param[in] the socket fd of the server
+ *
+ * @exception None
+ * @remark None
+ * @see bluetooth_rfcomm_accept_connection
+ */
+int bluetooth_rfcomm_reject_connection(int server_fd);
+
+/**
* @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
* @brief Informs whether rfcomm server uuid is available or not.
*
/**
* @fn int bluetooth_hdp_activate(unsigned short data_type,
* bt_hdp_role_type_t role,
- * bt_hdp_qos_type_t channel_type)
+ * bt_hdp_qos_type_t channel_type,
+ * char **app_handle)
* @brief Activate the HDP service for a particular data type
*
- * This function is a asynchronous call.
- * The HDP activate is responded by BLUETOOTH_EVENT_HDP_ACTIVATED event.
+ * This function is a synchronous call.
*
* @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
* HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
* For role = HDP_ROLE_SINK, the channel_type
* should be HDP_QOS_ANY.
+ * @param[out] app_handle The application handler against corresponding service
* @remark None
* @see bluetooth_hdp_deactivate
*/
int bluetooth_hdp_activate(unsigned short data_type,
bt_hdp_role_type_t role,
- bt_hdp_qos_type_t channel_type);
+ bt_hdp_qos_type_t channel_type,
+ char **app_handle);
/**
* @fn int bluetooth_hdp_deactivate(const char *app_handle)
* @brief Deactivate the HDP service for a particular service using the handler
*
- * This function is a asynchronous call.
- * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DEACTIVATED event.
+ * This function is a synchronous call.
*
* @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
* No event corresponding to this api
*
* @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
* BLUETOOTH_ERROR_INTERNAL - Internal Error \n
* BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
* BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
* No event corresponding to this api
*
* @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
- * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
*
* @exception None
*
int bluetooth_opc_deinit(void);
/**
- * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *device_address,
- unsigned char **file_name_array)
+ * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
+ char **file_name_array)
* @brief Send multiple files to a remote device.
*
* This function is a asynchronous call.
* This api is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
*
* @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
* BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
* BLUETOOTH_ERROR_INTERNAL - Internal Error \n
* BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
- * BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
+ * BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
*
* @exception None
* @param[in] device_address The remote device Bd address.
* BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
*
* @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
- * BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ * BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
*
* @exception None
*
/**
- * @fn int bluetooth_obex_server_init(char *dst_path)
+ * @fn int bluetooth_obex_server_init(const char *dst_path)
* @brief Initialize OPP and FTP server.
*
* This function is a synchronous call.
* No event corresponding to this api
*
* @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
* BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
- * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
+ * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \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);
+int bluetooth_obex_server_init(const char *dst_path);
/**
* No event corresponding to this api
*
* @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
* BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
*
* @exception None
* @remark None
* @see bluetooth_obex_server_init
*/
-
int bluetooth_obex_server_deinit(void);
/**
- * @fn int bluetooth_obex_server_accept_authorize(char *filename)
+ * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
+ * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
+ *
+ * This function is a synchronous call.
+ * No event corresponding to this api
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ *
+ *
+ * @exception None
+ * @param[in] dst_path OPS destination file path.
+ * @remark None
+ * @see bluetooth_obex_server_deinit_without_agent
+ */
+int bluetooth_obex_server_init_without_agent(const char *dst_path);
+
+
+/**
+ * @fn int bluetooth_obex_server_deinit_without_agent(void)
+ * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
+ *
+ * This function is a synchronous call.
+ * No event corresponding to this api
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
+ *
+ * @exception None
+ *
+ * @remark None
+ * @see bluetooth_obex_server_init_without_agent
+ */
+int bluetooth_obex_server_deinit_without_agent(void);
+
+
+/**
+ * @fn int bluetooth_obex_server_accept_connection(void)
+ * @brief Accepts the authorization request indicated by the event
+ * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ *
+ * @exception None
+ * @remark None
+ * @see bluetooth_obex_server_reject_authorize
+ */
+int bluetooth_obex_server_accept_connection(void);
+
+
+/**
+ * @fn int bluetooth_obex_server_reject_connection(void)
+ * @brief Rejects the authorization request indicated by the event
+ * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal error \n
+ *
+ * @exception None
+ * @remark None
+ * @see bluetooth_obex_server_reject_authorize
+ */
+int bluetooth_obex_server_reject_connection(void);
+
+
+/**
+ * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
* @brief Accepts the authorization request indicated by the event
* BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
*
* This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
*
* @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
* BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
*
* @exception None
* @see bluetooth_obex_server_reject_authorize
*/
-int bluetooth_obex_server_accept_authorize(char *filename);
+int bluetooth_obex_server_accept_authorize(const char *filename);
/**
* @fn int bluetooth_obex_server_reject_authorize(void)
* No event for this api..
*
* @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
* BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
*
* @exception None
int bluetooth_obex_server_reject_authorize(void);
/**
- * @fn int bluetooth_obex_server_set_destination_path(char *dst_path)
+ * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
* @brief Set the OPS destination file path..
*
* This function is a asynchronous call.
* @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
* BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
- * BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
*
* @exception None
* @param[in] dst_path OPS destination file path.
* @see None
*/
-int bluetooth_obex_server_set_destination_path(char *dst_path);
+int bluetooth_obex_server_set_destination_path(const char *dst_path);
/**
- * @fn int bluetooth_obex_server_set_root(char *root)
+ * @fn int bluetooth_obex_server_set_root(const char *root)
* @brief Set the FTS root folder..
*
* This function is a asynchronous call.
* No event for this api..
*
* @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
* BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
- * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
- * BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
+ * BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
+ * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
*
* @exception None
* @param[in] root FTS root folder.
* @see None
*/
-int bluetooth_obex_server_set_root(char *root);
+int bluetooth_obex_server_set_root(const char *root);
/**
* @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
* @brief Cancel the transfer on server
*
- * This function is a asynchronous call.
- * If the call is success to cancel transfering then the application will receive
+ * This function is an asynchronous call.
+ * If the function call that cancels transfer is successful, the application would recieve
* BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
* function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
* the error code will be BLUETOOTH_ERROR_NONE
* @remark None
* @see None
*/
-
int bluetooth_obex_server_cancel_transfer(int transfer_id);
/**
+ * @fn int bluetooth_obex_server_cancel_all_transfers(void)
+ * @brief Cancel the transfer on server
+ *
+ * This function is an asynchronous call.
+ * If the function call that cancels transfer is successful, the application would recieve
+ * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
+ * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
+ * the error code will be BLUETOOTH_ERROR_NONE
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
+ * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
+ * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
+ * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
+ *
+ * @exception None
+ *
+ * @remark None
+ * @see None
+ */
+int bluetooth_obex_server_cancel_all_transfers(void);
+
+
+/**
* @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
* @brief Read the local Hash and Randmizer.
*
const bluetooth_device_address_t *remote_device_address);
/**
+ * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
+ * bt_gatt_handle_info_t *prim_svc);
+ *
+ * @brief Gets the GATT based primary services handle supported by remote device
+ *
+ * This function is a synchronous call.
+ * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] address - Remote device address
+ * @param[out] prim_svc - Structure containing remote service count and handle list.
+ *
+ * @remark None
+ * @see bluetooth_gatt_free_primary_services()
+ */
+int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
+ bt_gatt_handle_info_t *prim_svc);
+
+/**
+ * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
+ *
+ * @brief Discovers the characteristics of GATT based service of remote device
+ *
+ * This function is an asynchronous call.
+ * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] service_handle - Handle for remote service.
+ *
+ * @remark None
+ * @see None
+ */
+int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
+
+/**
+ * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
+ * bt_gatt_service_property_t *service);
+ *
+ * @brief Gets the properties of GATT based service of remote device
+ *
+ * This function is a synchronous call.
+ * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] service_handle - Handle for remote service.
+ * @param[out] service - Structure containing remote service property.
+ *
+ * @remark None
+ * @see bluetooth_gatt_free_service_property()
+ */
+int bluetooth_gatt_get_service_property(const char *service_handle,
+ bt_gatt_service_property_t *service);
+
+/**
+ * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
+ *
+ * @brief Register to GATT based service to receive value change notification/indication.
+ *
+ * This function is a synchronous call.
+ * No event for this api.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] service_handle - Handle for remote service.
+ *
+ * @remark None
+ * @see None
+ */
+int bluetooth_gatt_watch_characteristics(const char *service_handle);
+
+/**
+ * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
+ *
+ * @brief Unregister GATT based service to receive value change notification/indication.
+ *
+ * This function is a synchronous call.
+ * No event for this api.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] service_handle - Handle for remote service.
+ *
+ * @remark None
+ * @see None
+ */
+int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
+
+/**
+ * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
+ * bt_gatt_char_property_t *characteristic);
+ *
+ * @brief Provides characteristic value along with properties.
+ *
+ * This function is a synchronous call.
+ * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] char_handle - Handle for Characteristic property.
+ * @param[out] characteristic - Structure containing remote characteristic property.
+ *
+ * @remark None
+ * @see bluetooth_gatt_free_char_property()
+ */
+int bluetooth_gatt_get_characteristics_property(const char *char_handle,
+ bt_gatt_char_property_t *characteristic);
+
+/**
+ * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
+ * const guint8 *value, int length)
+ *
+ * @brief Set characteristic value.
+ *
+ * This function is a synchronous call.
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
+ *
+ * @exception None
+ * @param[in] char_handle - Handle for Characteristic property.
+ * @param[in] value - New value to set for characteristic property.
+ * @param[in] length - Length of the value to be set.
+ *
+ * @remark None
+ * @see None
+ */
+int bluetooth_gatt_set_characteristics_value(const char *char_handle,
+ const guint8 *value, int length);
+
+/**
+ * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
+ *
+ * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
+ *
+ * This function is a synchronous call.
+ * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ *
+ * @exception None
+ * @param[in] prim_svc - GATT handle info structure
+ *
+ * @remark None
+ * @see bluetooth_gatt_get_primary_services()
+ */
+int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
+
+/**
+ * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
+ *
+ * @brief Releases the memory allocated by bluetooth_gatt_get_service_property()
+ *
+ * This function is a synchronous call.
+ * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ *
+ * @exception None
+ * @param[in] svc_pty - GATT service property structure.
+ *
+ * @remark None
+ * @see bluetooth_gatt_get_service_property()
+ */
+int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
+
+/**
+ * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
+ *
+ * @brief Provides characteristic value along with properties.
+ *
+ * This function is a synchronous call.
+ * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
+ *
+ * @return BLUETOOTH_ERROR_NONE - Success \n
+ * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
+ *
+ * @exception None
+ * @param[in] char_pty - GATT characteristics property structure.
+ *
+ * @remark None
+ * @see bluetooth_gatt_get_characteristics_property()
+ */
+ int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
+
+/**
* @}
*/
includedir=@INCLUDEDIR@
Name: bluetooth-api
-Description: SAMSUNG Linux platform Bluetooth framework API
+Description: Tizen Linux platform Bluetooth framework API
Version: @VERSION@
Requires: dlog dbus-glib-1 vconf
Libs: -L${libdir} -lbluetooth-api
static int __bluetooth_internal_bonding_req(void);
static void __bluetooth_internal_get_service_list(GValue *value, bluetooth_device_info_t *dev);
+static int __bt_launch_terminate_popup(void)
+{
+ int ret = 0;
+ bundle *b = NULL;
+
+ b = bundle_create();
+
+ if (b == NULL)
+ return BLUETOOTH_ERROR_INTERNAL;
+
+ bundle_add(b, "event-type", "terminate");
+
+ ret = syspopup_launch("bt-syspopup", b);
+
+ if (ret < 0)
+ DBG("Popup launch failed: %d\n", ret);
+
+ bundle_free(b);
+
+ return ret;
+}
+
BT_EXPORT_API int bluetooth_check_adapter(void)
{
int adapter_state = BLUETOOTH_ADAPTER_DISABLED;
BT_EXPORT_API int bluetooth_enable_adapter(void)
{
bt_info_t *bt_internal_info = NULL;
- int value;
DBG("+\n");
return ret;
}
+BT_EXPORT_API int bluetooth_is_service_used(const char *service_uuid,
+ gboolean *used)
+{
+ bt_info_t *bt_internal_info = NULL;
+ char **uuids = NULL;
+ int i = 0;
+ GHashTable *hash = NULL;
+ GValue *value = NULL;
+
+ if (service_uuid == NULL) {
+ ERR("wrong parameter");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ if (used == NULL) {
+ ERR("wrong parameter");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ bt_internal_info = _bluetooth_internal_get_information();
+
+ if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
+ DBG("Currently not enabled");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ if (bt_internal_info->adapter_proxy == NULL) {
+ DBG("adapter_proxy is NULL");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ dbus_g_proxy_call(bt_internal_info->adapter_proxy, "GetProperties", NULL,
+ G_TYPE_INVALID,
+ dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+ &hash, G_TYPE_INVALID);
+
+ if (hash == NULL) {
+ DBG("hash is NULL");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ value = g_hash_table_lookup(hash, "UUIDs");
+ uuids = g_value_get_boxed(value);
+
+ if (uuids == NULL) {
+ *used = FALSE;
+ return BLUETOOTH_ERROR_NONE;
+ }
+
+ for (i = 0; uuids[i] != NULL; i++) {
+ DBG("UUIDs %s ", uuids[i]);
+ if (strcasecmp(uuids[i], service_uuid) == 0) {
+ *used = TRUE;
+ return BLUETOOTH_ERROR_NONE;
+ }
+ }
+
+ *used = FALSE;
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
BT_EXPORT_API int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *
discoverable_mode_ptr)
{
DBG("+");
bt_info_t *bt_internal_info = NULL;
+ int timeout = 0;
GHashTable *hash = NULL;
GValue *value = NULL;
GValue *timeout_value = NULL;
if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
DBG("Currently not enabled");
- return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ if (vconf_get_int(BT_FILE_VISIBLE_TIME, &timeout) != 0) {
+ DBG("Fail to get the timeout value");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (timeout == -1) {
+ *discoverable_mode_ptr = BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE;
+ } else {
+ *discoverable_mode_ptr = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
+ }
+
+ return BLUETOOTH_ERROR_NONE;
}
if (bt_internal_info->adapter_proxy != NULL) {
}
- /* 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);
g_value_set_uint(&val_timeout, timeout);
if (error != NULL) {
DBG("Powered set err:[%s]", error->message);
g_error_free(error);
- ret = BLUETOOTH_ERROR_INTERNAL;
+ return BLUETOOTH_ERROR_INTERNAL;
}
dbus_g_proxy_call(bt_internal_info->adapter_proxy, "SetProperty", &error,
if (error != NULL) {
DBG("Discoverable set err:[%s]", error->message);
g_error_free(error);
- ret = BLUETOOTH_ERROR_INTERNAL;
+ return BLUETOOTH_ERROR_INTERNAL;
}
dbus_g_proxy_call(bt_internal_info->adapter_proxy, "SetProperty", &error,
if (error != NULL) {
DBG("Timeout set err:[%s]", error->message);
g_error_free(error);
- ret = BLUETOOTH_ERROR_INTERNAL;
+ return BLUETOOTH_ERROR_INTERNAL;
}
+ /* Set discoverable Timer in agent */
+ if (discoverable_mode == BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE)
+ timeout = -1;
+
+ dbus_g_proxy_call_no_reply(bt_internal_info->agent_proxy, "SetDiscoverableTimer",
+ G_TYPE_INT, timeout,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
g_value_unset(&val_timeout);
g_value_unset(&connectable);
g_value_unset(&discoverable);
/* Check the major class */
switch (device_class.major_class) {
- case BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_PHONE;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_TOY:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_TOY;
- break;
- case BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH;
- break;
- default:
- major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_MISC;
- break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_PHONE;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_TOY:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_TOY;
+ break;
+ case BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH;
+ break;
+ default:
+ major_mask = BLUETOOTH_DEVICE_MAJOR_MASK_MISC;
+ break;
}
DBG("major_mask: %x", major_mask);
discovery_option.classOfDeviceMask) == FALSE)
return;
+ if (name == NULL || address == NULL)
+ return;
+
_bluetooth_internal_convert_addr_string_to_addr_type(&dev_info.device_address, address);
if (strlen(name) <= BLUETOOTH_DEVICE_NAME_LENGTH_MAX) {
memcpy(&dev_info.device_name, name, strlen(name));
DBG("+");
bt_info_t *bt_internal_info = NULL;
+ DBusGProxy *adapter_proxy;
_bluetooth_internal_session_init();
bt_internal_info = _bluetooth_internal_get_information();
- if (bt_internal_info->adapter_proxy == NULL)
+ adapter_proxy = _bluetooth_internal_get_adapter_proxy(bt_internal_info->conn);
+
+ if (adapter_proxy == NULL)
return BLUETOOTH_ERROR_INTERNAL;
- if (!dbus_g_proxy_call(bt_internal_info->adapter_proxy, "StartDiscovery", NULL,
+ if (!dbus_g_proxy_call(adapter_proxy, "StartDiscovery", NULL,
G_TYPE_INVALID, G_TYPE_INVALID)) {
DBG("Discover start failed");
+ g_object_unref(adapter_proxy);
return BLUETOOTH_ERROR_INTERNAL;
}
+ g_object_unref(adapter_proxy);
+
if (bt_internal_info->bt_discovery_req_timer != 0) {
g_source_remove(bt_internal_info->bt_discovery_req_timer);
bt_internal_info->bt_discovery_req_timer = 0;
bt_info_t *bt_internal_info = NULL;
GError *error = NULL;
int ret = BLUETOOTH_ERROR_NONE;
+ DBusGProxy *adapter_proxy;
DBG("+");
bt_internal_info = _bluetooth_internal_get_information();
- if (bt_internal_info->adapter_proxy == NULL) {
+ adapter_proxy = _bluetooth_internal_get_adapter_proxy(bt_internal_info->conn);
+
+ if (adapter_proxy == NULL)
return BLUETOOTH_ERROR_INTERNAL;
- }
- dbus_g_proxy_call(bt_internal_info->adapter_proxy, "StopDiscovery", &error,
+ dbus_g_proxy_call(adapter_proxy, "StopDiscovery", &error,
G_TYPE_INVALID, G_TYPE_INVALID);
+ g_object_unref(adapter_proxy);
+
if (error) {
DBG("error in StopDiscovery [%s]\n", error->message);
GHashTable *hash = NULL;
GValue *value = NULL;
int is_discovering = 0;
+ DBusGProxy *adapter_proxy;
_bluetooth_internal_session_init();
bt_internal_info = _bluetooth_internal_get_information();
- if (bt_internal_info->adapter_proxy != NULL) {
- dbus_g_proxy_call(bt_internal_info->adapter_proxy, "GetProperties", NULL,
- G_TYPE_INVALID,
- dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
- &hash, G_TYPE_INVALID);
+ adapter_proxy = _bluetooth_internal_get_adapter_proxy(bt_internal_info->conn);
- if (hash != NULL) {
- value = g_hash_table_lookup(hash, "Discovering");
+ if (adapter_proxy == NULL)
+ return is_discovering;
- if (value)
- is_discovering = g_value_get_boolean(value);
- }
+ dbus_g_proxy_call(adapter_proxy, "GetProperties", NULL,
+ G_TYPE_INVALID,
+ dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+ &hash, G_TYPE_INVALID);
+
+ g_object_unref(adapter_proxy);
+
+ if (hash != NULL) {
+ value = g_hash_table_lookup(hash, "Discovering");
+
+ if (value)
+ is_discovering = (g_value_get_boolean(value) == FALSE) ? 0 : 1;
}
return is_discovering;
bt_internal_info->is_headset_pin_req = TRUE;
bt_internal_info->is_bonding_req = FALSE;
bt_internal_info->is_headset_bonding = FALSE;
- memset(bt_internal_info->bt_bonding_req_addrstr, 0x00, 18);
+ memset(bt_internal_info->bt_bonding_req_addrstr,
+ 0x00, BT_ADDRESS_STRING_SIZE);
bluetooth_bond_device(&device_address);
return;
bt_internal_info->is_headset_pin_req = FALSE;
bt_internal_info->is_bonding_req = FALSE;
bt_internal_info->is_headset_bonding = FALSE;
- memset(bt_internal_info->bt_bonding_req_addrstr, 0x00, 18);
+ memset(bt_internal_info->bt_bonding_req_addrstr, 0x00, BT_ADDRESS_STRING_SIZE);
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_BONDING_FINISHED,
error_type, (void *)device_info);
int remote_class = 0;
gboolean trust = FALSE;
- DBusGProxy *device_proxy = (DBusGProxy *) user_data;
+ DBusGProxy *device_proxy = (DBusGProxy *)user_data;
GHashTable *hash = NULL;
GValue *value = NULL;
GValue *uuid_value = NULL;
(gpointer)device_proxy);
}
+ /* Terminate the BT system popup (In the keyboard case) */
+ __bt_launch_terminate_popup();
+
DBG("-");
}
bt_internal_info->conn);
}
- msg = dbus_message_new_method_call("org.bluez",
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
bt_internal_info->adapter_path,
"org.bluez.OutOfBand",
"ReadLocalData");
- if(msg == NULL)
+ if (msg == NULL)
return BLUETOOTH_ERROR_INTERNAL;
dbus_error_init(&err);
_bluetooth_internal_addr_type_to_addr_string(address,
remote_device_address);
- msg = dbus_message_new_method_call("org.bluez",
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
bt_internal_info->adapter_path,
"org.bluez.OutOfBand",
"AddRemoteData");
const char *dev_addr = g_strdup(address);
DBG("dev_addr = [%s]\n", dev_addr);
- msg = dbus_message_new_method_call("org.bluez",
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME,
bt_internal_info->adapter_path,
"org.bluez.OutOfBand",
"RemoveRemoteData");
dbus_g_proxy_end_call(proxy, call, &err, G_TYPE_INVALID);
- device_address = (bluetooth_device_address_t *) user_data;
+ device_address = (bluetooth_device_address_t *)user_data;
if (err != NULL) {
DBG("Error occured in RemoveBonding [%s]\n", err->message);
_bluetooth_internal_addr_type_to_addr_string(address, device_address);
- /*allocate user data so that it can be retrieved in callback */
+ /* allocate user data so that it can be retrieved in callback */
bluetooth_address =
- (bluetooth_device_address_t *) malloc(sizeof(bluetooth_device_address_t));
+ (bluetooth_device_address_t *)malloc(sizeof(bluetooth_device_address_t));
if (bluetooth_address == NULL) {
DBG("Out of memory");
return BLUETOOTH_ERROR_INTERNAL;
if (device_path != NULL) {
if (!dbus_g_proxy_begin_call(bt_internal_info->adapter_proxy, "RemoveDevice",
(DBusGProxyCallNotify) __bluetooth_internal_unbond_request_complete_cb,
- (gpointer) bluetooth_address, NULL, DBUS_TYPE_G_OBJECT_PATH, device_path,
+ (gpointer)bluetooth_address, NULL, DBUS_TYPE_G_OBJECT_PATH, device_path,
G_TYPE_INVALID)) {
DBG("RemoveBonding begin failed\n");
return BLUETOOTH_ERROR_INTERNAL;
_bluetooth_internal_convert_addr_string_to_addr_type(&dev->device_address,
address);
- strncpy(dev->device_name.name, name, strlen(name));
- dev->device_name.name[strlen(name)] = '\0';
+ g_strlcpy(dev->device_name.name, name,
+ BLUETOOTH_DEVICE_NAME_LENGTH_MAX+1);
+
dev->rssi = rssi;
dev->trust = trust;
dev->paired = paired;
***********************************************************************/
static int __bt_hdp_internal_create_application(unsigned int data_type,
bool role,
- bt_hdp_qos_type_t channel_type);
+ bt_hdp_qos_type_t channel_type,
+ char **app_handle);
static DBusHandlerResult __bt_hdp_internal_event_filter(DBusConnection *sys_conn,
DBusMessage *msg,
static hdp_app_list_t *__bt_hdp_internal_gslist_find_app_handler(void *app_handle);
-static hdp_app_list_t *__bt_hdp_internal_gslist_find_using_fd(int fd);
+static hdp_obj_info_t *__bt_hdp_internal_gslist_obj_find_using_fd(int fd);
-static hdp_app_list_t *__bt_hdp_internal_gslist_find_using_obj_channel(
- const char *obj_channel_path);
+static hdp_obj_info_t *__bt_hdp_internal_gslist_obj_find_using_path(const char *obj_channel_path);
/*Global Variables*/
static DBusConnection *g_hdp_dus_conn;
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_hdp_qos_type_t channel_type,
+ char **app_handle)
{
DBG("+\n");
int result = BLUETOOTH_ERROR_NONE;
}
result = __bt_hdp_internal_create_application(data_type, role,
- channel_type);
+ channel_type, app_handle);
- return BLUETOOTH_ERROR_NONE;
+ return result;
}
-
-static gboolean __bt_hdp_internal_create_application_cb(gpointer data)
+static void __bt_hdp_obj_info_free(hdp_obj_info_t *info)
{
- DBG(" +\n");
- hdp_app_list_t *list = (hdp_app_list_t *)data;
- bt_hdp_activate_t act_cfm;
- act_cfm.app_handle = list->app_handle;
-
- _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_ACTIVATED,
- BLUETOOTH_ERROR_NONE, &act_cfm);
- DBG(" -\n");
- return FALSE;
+ if (info) {
+ close(info->fd);
+ g_free(info->obj_channel_path);
+ g_free(info);
+ }
}
+
static int __bt_hdp_internal_create_application(unsigned int data_type,
bool role,
- bt_hdp_qos_type_t channel_type)
+ bt_hdp_qos_type_t channel_type,
+ char **app_handle)
{
DBG(" +\n");
DBusMessage *msg, *reply;
bt_internal_info = _bluetooth_internal_get_information();
- msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME, "/org/bluez",
BLUEZ_HDP_MANAGER_INTERFACE,
"CreateApplication");
return ret;
}
- hdp_app_list_t *list = malloc(sizeof(hdp_app_list_t));
- if (NULL == list) {
- DBG("Malloc list failed");
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- }
-
+ hdp_app_list_t *list = g_new0(hdp_app_list_t, 1);
list->app_handle = (void *)g_strdup(app_path);
-
- list->obj_channel_path = NULL;
-
- list->fd = -1;
+ *app_handle = list->app_handle;
g_app_list = g_slist_append(g_app_list, list);
-
- g_idle_add(__bt_hdp_internal_create_application_cb, (gpointer)list);
-
return BLUETOOTH_ERROR_NONE;
}
char address[BT_ADDRESS_STRING_SIZE] = { 0, };
bluetooth_device_address_t device_addr = { {0} };
bt_hdp_disconnected_t dis_ind;
+ hdp_obj_info_t *info;
DBG("Path = %s\n", path);
DBG("Channel Deleted, Path = %s\n", obj_channel_path);
+ info = __bt_hdp_internal_gslist_obj_find_using_path(obj_channel_path);
+ if (!info) {
+ DBG("No obj info for ob_channel_path [%s]\n", obj_channel_path);
+ return;
+ }
+
/*Since bluetoothd is not sending the ChannelDeleted signal */
_bluetooth_internal_device_path_to_address(path, address);
_bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
address);
- hdp_app_list_t *list = __bt_hdp_internal_gslist_find_using_obj_channel(
- obj_channel_path);
- if (NULL == list) {
- DBG("** Could not locate the list for ob_channel_path %s****\n",
- obj_channel_path);
- } else {
-
- if (list->fd == -1) {
- DBG("******* Warning! FD already deleted******\n");
- }
+ dis_ind.channel_id = info->fd;
+ dis_ind.device_address = device_addr;
- dis_ind.channel_id = list->fd;
- dis_ind.device_address = device_addr;
+ _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DISCONNECTED,
+ BLUETOOTH_ERROR_NONE, &dis_ind);
- _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DISCONNECTED,
- BLUETOOTH_ERROR_NONE, &dis_ind);
-
- close(list->fd);
- list->fd = -1;
- g_free(list->obj_channel_path);
- list->obj_channel_path = NULL;
-
- DBG(" Removed fd and obj_channel_path from the list\n");
- }
+ DBG(" Removed connection from list\n");
- DBG("-*************\n\n");
+ __bt_hdp_obj_info_free(info);
}
bt_info_t *bt_internal_info = NULL;
bt_hdp_connected_t conn_ind;
DBusError err;
- int fdd = -1;
+ int fd;
bt_internal_info = _bluetooth_internal_get_information();
- msg = dbus_message_new_method_call("org.bluez", path,
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME, path,
BLUEZ_HDP_CHANNEL_INTERFACE,
"Acquire");
if (!msg) {
return BLUETOOTH_ERROR_INTERNAL;
}
- if (!dbus_message_get_args(reply, &err, DBUS_TYPE_UNIX_FD, &fdd,
+ if (!dbus_message_get_args(reply, &err, DBUS_TYPE_UNIX_FD, &fd,
DBUS_TYPE_INVALID)) {
DBG(" HDP:dbus Can't get reply arguments");
dbus_message_unref(reply);
- DBG("File Descriptor = %d, Dev_path = %s \n", fdd, path);
+ DBG("File Descriptor = %d, Dev_path = %s \n", fd, path);
- msg = dbus_message_new_method_call("org.bluez", path,
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME, path,
BLUEZ_HDP_CHANNEL_INTERFACE, "GetProperties");
if (!msg) {
DBG(" HDP:dbus Can't allocate new method call");
goto error;
}
- list->obj_channel_path = g_strdup(path);
+ hdp_obj_info_t *info = g_new0(hdp_obj_info_t, 1);
+ info->fd = fd;
+ info->obj_channel_path = g_strdup(path);
+ list->obj_info = g_slist_append(list->obj_info, info);
- __bt_hdp_internal_watch_fd(fdd, list->obj_channel_path);
+ __bt_hdp_internal_watch_fd(fd, info->obj_channel_path);
_bluetooth_internal_device_path_to_address(path, address);
conn_ind.app_handle = app_handle;
- conn_ind.channel_id = fdd;
+ conn_ind.channel_id = fd;
conn_ind.device_address = device_addr;
DBG("Going to give callback\n");
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_CONNECTED,
- BLUETOOTH_ERROR_NONE, &conn_ind);
+ BLUETOOTH_ERROR_NONE, &conn_ind);
dbus_message_unref(reply);
- if (list->fd != -1) {
- DBG("Warning! FD already updated(%d).Duplication!\n", list->fd);
- }
-
- list->fd = fdd;
-
DBG("Updated fd in the list*\n");
DBG("-\n");
DBG("-\n");
}
+
+static void __bt_hdp_internal_handle_disconnect_cb(int sk, const char *path)
+{
+ DBG("******** Socket Error ******\n\n");
+ char address[BT_ADDRESS_STRING_SIZE] = { 0, };
+ bluetooth_device_address_t device_addr = { {0} };
+ bt_hdp_disconnected_t dis_ind;
+ hdp_obj_info_t *info;
+
+ info = __bt_hdp_internal_gslist_obj_find_using_path(path);
+ if (!info) {
+ DBG("No obj info for ob_channel_path [%s]\n", path);
+ return;
+ }
+
+ /*Since bluetoothd is not sending the ChannelDeleted signal */
+ _bluetooth_internal_device_path_to_address(path, address);
+
+ _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
+ address);
+
+ dis_ind.channel_id = sk;
+ dis_ind.device_address = device_addr;
+
+ _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DISCONNECTED,
+ BLUETOOTH_ERROR_NONE, &dis_ind);
+
+ DBG(" Removed connection from list\n");
+
+ __bt_hdp_obj_info_free(info);
+}
+
static gboolean __bt_hdp_internal_data_received(GIOChannel *gio,
GIOCondition cond, gpointer data)
{
if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
DBG("GIOCondition %d.............path = %s\n", cond, path);
- /* We should simply return from here. Proper disconnection
- * happens during ChannelDeleted signal.
- */
+ __bt_hdp_internal_handle_disconnect_cb(sk, path);
return FALSE;
}
data_ind.size = act_read;
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DATA_RECEIVED,
- BLUETOOTH_ERROR_NONE, &data_ind);
+ BLUETOOTH_ERROR_NONE, &data_ind);
return TRUE;
return NULL;
}
-static hdp_app_list_t *__bt_hdp_internal_gslist_find_using_fd(int fd)
+static hdp_obj_info_t *__bt_hdp_internal_gslist_obj_find_using_fd(int fd)
{
GSList *l;
+ GSList *iter;
DBG("List length = %d\n", g_slist_length(g_app_list));
for (l = g_app_list; l != NULL; l = l->next) {
hdp_app_list_t *list = l->data;
+ if (!list)
+ return NULL;
- if (list) {
- if (fd == list->fd)
- return list;
+ for (iter = list->obj_info; iter != NULL; iter = iter->next) {
+ hdp_obj_info_t *info = iter->data;
+ if (!info)
+ return NULL;
+
+ if (fd == info->fd)
+ return info;
}
}
return NULL;
}
-static hdp_app_list_t *__bt_hdp_internal_gslist_find_using_obj_channel(
- const char *obj_channel_path)
+static hdp_obj_info_t *__bt_hdp_internal_gslist_obj_find_using_path(const char *obj_channel_path)
{
GSList *l;
+ GSList *iter;
+ hdp_obj_info_t *info = NULL;
+
DBG("List length = %d\n", g_slist_length(g_app_list));
for (l = g_app_list; l != NULL; l = l->next) {
hdp_app_list_t *list = l->data;
- if (list) {
- if (0 == g_strcmp0((char *)list->obj_channel_path,
- obj_channel_path))
- return list;
+ if (!list)
+ return NULL;
+
+ for (iter = list->obj_info; iter != NULL; iter = iter->next) {
+ info = iter->data;
+ if (!info)
+ return NULL;
+
+ if (0 == g_strcmp0(info->obj_channel_path, obj_channel_path)) {
+ list->obj_info = g_slist_remove(list->obj_info, info);
+ return info;
+ }
}
}
return NULL;
static gboolean __bt_hdp_internal_destroy_application_cb(gpointer data)
{
DBG(" +\n");
- bt_hdp_deactivate_t deact_cfm;
+ const char *app_handle;
hdp_app_list_t *list = NULL;
- deact_cfm.app_handle = (const char *)data;
- _bluetooth_internal_event_cb(BLUETOOTH_EVENT_HDP_DEACTIVATED,
- BLUETOOTH_ERROR_NONE, &deact_cfm);
+ app_handle = (const char *)data;
- list = __bt_hdp_internal_gslist_find_app_handler((void *)deact_cfm.app_handle);
+ list = __bt_hdp_internal_gslist_find_app_handler((void *)app_handle);
if (NULL == list) {
- DBG("***** Could not locate the list for %s*****\n",
- deact_cfm.app_handle);
+ DBG("**** list not found for %s ******\n", app_handle);
return FALSE;
}
g_app_list = g_slist_remove(g_app_list, list);
- if (list != NULL) {
- g_free(list->app_handle);
- g_free(list->obj_channel_path);
- g_free(list);
- }
+ g_free(list->app_handle);
+ g_slist_foreach(list->obj_info, (GFunc)__bt_hdp_obj_info_free, NULL);
+ g_free(list);
DBG("List length = %d\n", g_slist_length(g_app_list));
static int __bt_hdp_internal_destroy_application(const char *app_handle)
{
-
DBusMessage *msg, *reply;
DBusError err;
bt_info_t *bt_internal_info = NULL;
bt_internal_info = _bluetooth_internal_get_information();
- msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
+ msg = dbus_message_new_method_call(BLUEZ_SERVICE_NAME, "/org/bluez",
BLUEZ_HDP_MANAGER_INTERFACE, "DestroyApplication");
if (!msg) {
reply = dbus_connection_send_with_reply_and_block(
dbus_g_connection_get_connection(bt_internal_info->conn),
msg, -1, &err);
-
dbus_message_unref(msg);
if (!reply) {
DBG(" HDP:dbus Can't Destroy application");
DBG("%s", err.message);
dbus_error_free(&err);
}
- DBG(" 5\n");
+
return BLUETOOTH_ERROR_INTERNAL;
}
return BLUETOOTH_ERROR_NONE;
}
+
+static void __bt_hdp_connect_request_cb(DBusGProxy *hdp_proxy, DBusGProxyCall *call,
+ gpointer user_data)
+{
+ GError *g_error = NULL;
+ char *obj_connect_path = NULL;
+ DBusGConnection *conn = NULL;
+
+ conn = (DBusGConnection *) user_data;
+
+ dbus_g_proxy_end_call(hdp_proxy, call, &g_error,
+ DBUS_TYPE_G_OBJECT_PATH, &obj_connect_path, G_TYPE_INVALID);
+
+ g_object_unref(hdp_proxy);
+ dbus_g_connection_unref(conn);
+
+ if (g_error != NULL) {
+ DBG("HDP connection Dbus Call Error: %s\n", g_error->message);
+ g_error_free(g_error);
+ } else {
+ DBG("Obj Path returned = %s\n", obj_connect_path);
+ }
+}
+
+
BT_EXPORT_API int bluetooth_hdp_connect(const char *app_handle,
bt_hdp_qos_type_t channel_type,
const bluetooth_device_address_t *device_address)
DBG("path %s\n", dev_path);
- hdp_proxy = dbus_g_proxy_new_for_name(conn, "org.bluez", dev_path,
+ hdp_proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME, dev_path,
BLUEZ_HDP_DEVICE_INTERFACE);
if (hdp_proxy == NULL) {
}
DBG("app path %s\n", app_handle);
-
- if (!dbus_g_proxy_call(hdp_proxy, "CreateChannel", NULL,
- DBUS_TYPE_G_OBJECT_PATH, app_handle, G_TYPE_STRING,
- role, G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH,
- &obj_connect_path, G_TYPE_INVALID)) {
-
- DBG("HDP client connection Dbus Call Error");
-
+ if (!dbus_g_proxy_begin_call(hdp_proxy, "CreateChannel",
+ (DBusGProxyCallNotify) __bt_hdp_connect_request_cb,
+ conn, /*user_data*/
+ NULL, /*destroy*/
+ DBUS_TYPE_G_OBJECT_PATH, app_handle,
+ G_TYPE_STRING, role,
+ G_TYPE_INVALID)) {
+ DBG("HDP connection Dbus Call Error");
g_free(dev_path);
-
g_object_unref(hdp_proxy);
-
dbus_g_connection_unref(conn);
return BLUETOOTH_ERROR_INTERNAL;
}
- DBG("Obj Path returned = %s\n", obj_connect_path);
-
g_free(dev_path);
+ return BLUETOOTH_ERROR_NONE;
+}
- g_object_unref(hdp_proxy);
+static void __bt_hdp_disconnect_request_cb(DBusGProxy *hdp_proxy, DBusGProxyCall *call,
+ gpointer user_data)
+{
+ GError *g_error = NULL;
+ DBusGConnection *conn = NULL;
+
+ conn = (DBusGConnection *) user_data;
+
+ dbus_g_proxy_end_call(hdp_proxy, call, &g_error, G_TYPE_INVALID);
+
+ g_object_unref(hdp_proxy);
dbus_g_connection_unref(conn);
- return BLUETOOTH_ERROR_NONE;
+ if (g_error != NULL) {
+ DBG("HDP disconnection Dbus Call Error: %s\n", g_error->message);
+ g_error_free(g_error);
+ } else {
+ DBG("HDP disconnection Dbus Call is done\n");
+ }
}
BT_EXPORT_API int bluetooth_hdp_disconnect(unsigned int channel_id,
return BLUETOOTH_ERROR_INVALID_PARAM;
}
- hdp_app_list_t *list = __bt_hdp_internal_gslist_find_using_fd(channel_id);
- if (NULL == list) {
+ hdp_obj_info_t *info = __bt_hdp_internal_gslist_obj_find_using_fd(channel_id);
+ if (NULL == info) {
DBG("*** Could not locate the list for %d*****\n", channel_id);
return BLUETOOTH_ERROR_INVALID_PARAM;
}
DBG("path %s\n", dev_path);
- hdp_proxy = dbus_g_proxy_new_for_name(conn, "org.bluez", dev_path,
+ hdp_proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME, dev_path,
BLUEZ_HDP_DEVICE_INTERFACE);
if (hdp_proxy == NULL) {
return BLUETOOTH_ERROR_NOT_PAIRED;
}
- if (!dbus_g_proxy_call(hdp_proxy, "DestroyChannel", NULL,
- DBUS_TYPE_G_OBJECT_PATH, list->obj_channel_path,
- G_TYPE_INVALID, G_TYPE_INVALID)) {
- DBG("HDP client connection Dbus Call Error");
+ if (!dbus_g_proxy_begin_call(hdp_proxy, "DestroyChannel",
+ (DBusGProxyCallNotify) __bt_hdp_disconnect_request_cb,
+ conn, /*user_data*/
+ NULL, /*destroy*/
+ DBUS_TYPE_G_OBJECT_PATH, info->obj_channel_path,
+ G_TYPE_INVALID)) {
+ DBG("HDP connection Dbus Call Error");
g_free(dev_path);
g_object_unref(hdp_proxy);
dbus_g_connection_unref(conn);
return BLUETOOTH_ERROR_INTERNAL;
}
- DBG("Destroyed Obj Path = %s\n", list->obj_channel_path);
-
g_free(dev_path);
- g_object_unref(hdp_proxy);
-
- dbus_g_connection_unref(conn);
-
return BLUETOOTH_ERROR_NONE;
}
#define BLUEZ_HDP_CHANNEL_INTERFACE "org.bluez.HealthChannel"
typedef struct {
- void *app_handle;
- void *obj_channel_path;
+ char *obj_channel_path;
int fd;
+} hdp_obj_info_t;
+
+typedef struct {
+ void *app_handle;
+ GSList *obj_info;
} hdp_app_list_t;
return HID_ERROR_NOT_ENABLED;
}
- adapter_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_NAME,
- adapter_path, BLUEZ_ADAPTER_NAME);
+ adapter_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_SERVICE_NAME,
+ adapter_path, BLUEZ_ADAPTER_INTERFACE);
if (adapter_proxy == NULL) {
DBG("dbus_g_proxy_new_for_name() failed\n");
return HID_ERROR_NOT_PAIRED;
}
- hid_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_NAME,
+ hid_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_SERVICE_NAME,
hid_dev_path, BLUEZ_INPUT_NAME);
if (hid_proxy == NULL) {
return HID_ERROR_NOT_ENABLED;
}
- adapter_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_NAME,
- adapter_path, BLUEZ_ADAPTER_NAME);
+ adapter_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_SERVICE_NAME,
+ adapter_path, BLUEZ_ADAPTER_INTERFACE);
if (adapter_proxy == NULL) {
DBG("dbus_g_proxy_new_for_name() failed\n");
return HID_ERROR_NOT_PAIRED;
}
- hid_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_NAME,
+ hid_proxy = dbus_g_proxy_new_for_name(bt_hid_info.conn, BLUEZ_SERVICE_NAME,
hid_dev_path, BLUEZ_INPUT_NAME);
if (hid_proxy == NULL) {
#define HID_ERROR_NOT_ENABLED ((int)HID_ERROR_BASE - 0x05)
#define HID_ERROR_CONNECTION_FAILED ((int)HID_ERROR_BASE - 0x06)
-/**
- * Bluetooth event type
- */
-typedef enum {
- BLUETOOTH_HID_CONNECTED,
- BLUETOOTH_HID_DISCONNECTED
-} hid_event_t;
-
typedef struct {
int event;
int result;
* Static Functions declaration *
***********************************************************************/
-static void __bluetooth_network_activate_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
- gpointer user_data);
-static void __bluetooth_network_deactivate_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
- gpointer user_data);
static void __bluetooth_network_connect_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
gpointer user_data);
static void __bluetooth_network_disconnect_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
GError *err = NULL;
DBusGConnection *conn = NULL;
DBusGProxy *proxy_net_server = NULL;
+ int ret = BLUETOOTH_ERROR_NONE;
char default_adapter_path[BT_ADAPTER_OBJECT_PATH_MAX + 1] = { 0 };
conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
}
/* If the adapter path is wrong, we can think the BT is not enabled. */
- if (_bluetooth_internal_get_adapter_path(conn, default_adapter_path) < 0) {
+ if (_bluetooth_internal_get_adapter_path(conn,
+ default_adapter_path) < 0) {
DBG("Could not get adapter path\n");
dbus_g_connection_unref(conn);
return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
}
- proxy_net_server = dbus_g_proxy_new_for_name(conn, "org.bluez",
- default_adapter_path, BLUEZ_NET_SERVER_PATH);
+ proxy_net_server = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
+ default_adapter_path, BLUEZ_NET_SERVER_PATH);
if (proxy_net_server == NULL) {
DBG("Failed to get the network server proxy\n");
return BLUETOOTH_ERROR_INTERNAL;
}
- if (!dbus_g_proxy_begin_call(proxy_net_server, "Register",
- (DBusGProxyCallNotify) __bluetooth_network_activate_request_cb,
- conn,/*user data*/
- NULL, /*destroy*/
- G_TYPE_STRING,
- NAP_UUID_NAME,/*first_arg_type*/
- G_TYPE_STRING,
- NET_BRIDGE_INTERFACE,/*second_arg_type*/
+ if (!dbus_g_proxy_call(proxy_net_server, "Register", &err,
+ G_TYPE_STRING, NAP_UUID_NAME, /*first_arg */
+ G_TYPE_STRING, NET_BRIDGE_INTERFACE,/*second_arg */
G_TYPE_INVALID)) {
- DBG("Network server register Dbus Call Error");
- g_object_unref(proxy_net_server);
- dbus_g_connection_unref(conn);
- return BLUETOOTH_ERROR_INTERNAL;
+ DBG("Network server register Error: %s\n", err->message);
+ g_error_free(err);
+ ret = BLUETOOTH_ERROR_INTERNAL;
}
+ g_object_unref(proxy_net_server);
+ dbus_g_connection_unref(conn);
+
DBG("-\n");
- return BLUETOOTH_ERROR_NONE;
+ return ret;
}
BT_EXPORT_API int bluetooth_network_deactivate_server(void)
GError *err = NULL;
DBusGConnection *conn = NULL;
DBusGProxy *proxy_net_server = NULL;
+ int ret = BLUETOOTH_ERROR_NONE;
char default_adapter_path[BT_ADAPTER_OBJECT_PATH_MAX + 1] = { 0 };
conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
}
/* If the adapter path is wrong, we can think the BT is not enabled. */
- if (_bluetooth_internal_get_adapter_path(conn, default_adapter_path) < 0) {
+ if (_bluetooth_internal_get_adapter_path(conn,
+ default_adapter_path) < 0) {
DBG("Could not get adapter path\n");
dbus_g_connection_unref(conn);
return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
}
- proxy_net_server = dbus_g_proxy_new_for_name(conn, "org.bluez",
- default_adapter_path, BLUEZ_NET_SERVER_PATH);
+ proxy_net_server = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
+ default_adapter_path, BLUEZ_NET_SERVER_PATH);
if (proxy_net_server == NULL) {
DBG("Failed to get the network server proxy\n");
return BLUETOOTH_ERROR_INTERNAL;
}
- if (!dbus_g_proxy_begin_call(proxy_net_server, "Unregister",
- (DBusGProxyCallNotify) __bluetooth_network_deactivate_request_cb,
- conn, /*user_data*/
- NULL, /*destroy*/
- G_TYPE_STRING, NAP_UUID_NAME, /*first_arg_type*/
- G_TYPE_INVALID)) {
- DBG("Network server deregister Dbus Call Error");
- g_object_unref(proxy_net_server);
- dbus_g_connection_unref(conn);
- return BLUETOOTH_ERROR_INTERNAL;
- }
-
- DBG("-\n");
-
- return BLUETOOTH_ERROR_NONE;
-}
-
-static void __bluetooth_network_activate_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
- gpointer user_data)
-{
- GError *g_error = NULL;
- int result = BLUETOOTH_ERROR_NONE;
- DBusGConnection *conn = NULL;
-
- conn = (DBusGConnection *) user_data;
-
- dbus_g_proxy_end_call(proxy, call, &g_error, G_TYPE_INVALID);
-
- g_object_unref(proxy);
- dbus_g_connection_unref(conn);
-
- if (g_error != NULL) {
- DBG("Network server register Dbus Call Error: %s\n", g_error->message);
- g_error_free(g_error);
- result = BLUETOOTH_ERROR_INTERNAL;
- } else {
- DBG("Network server register Dbus Call is done\n");
+ if (!dbus_g_proxy_call(proxy_net_server, "Unregister", &err,
+ G_TYPE_STRING, NAP_UUID_NAME, /*first_arg */
+ G_TYPE_INVALID)) {
+ DBG("Network server unregister Error: %s\n", err->message);
+ g_error_free(err);
+ ret = BLUETOOTH_ERROR_INTERNAL;
}
- _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED,
- result, NULL);
-
-}
-
-static void __bluetooth_network_deactivate_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
- gpointer user_data)
-{
- GError *g_error = NULL;
- int result = BLUETOOTH_ERROR_NONE;
- DBusGConnection *conn = NULL;
-
- conn = (DBusGConnection *) user_data;
-
- dbus_g_proxy_end_call(proxy, call, &g_error, G_TYPE_INVALID);
-
- g_object_unref(proxy);
+ g_object_unref(proxy_net_server);
dbus_g_connection_unref(conn);
- if (g_error != NULL) {
- DBG("Network server unregister Dbus Call Error: %s\n", g_error->message);
- g_error_free(g_error);
- result = BLUETOOTH_ERROR_INTERNAL;
- } else {
- DBG("Network server unregister Dbus Call is done\n");
- }
-
- _bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED,
- result, NULL);
+ DBG("-\n");
+ return ret;
}
void _bluetooth_network_server_add_signal(void)
/* Add the network server signal */
bt_internal_info->network_server_proxy =
- dbus_g_proxy_new_for_name(bt_internal_info->conn, "org.bluez",
+ dbus_g_proxy_new_for_name(bt_internal_info->conn, BLUEZ_SERVICE_NAME,
bt_internal_info->adapter_path, BLUEZ_NET_SERVER_PATH);
dbus_g_proxy_add_signal(bt_internal_info->network_server_proxy, "PeerConnected",
g_strdelimit(path, ":", '_');
DBG("path %s\n", path);
- proxy_net_client = dbus_g_proxy_new_for_name(conn, "org.bluez",
+ proxy_net_client = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
path, BLUEZ_NET_CLIENT_PATH);
if (proxy_net_client == NULL) {
g_strdelimit(path, ":", '_');
DBG("path %s\n", path);
- proxy_net_client = dbus_g_proxy_new_for_name(conn, "org.bluez",
+ proxy_net_client = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
path, BLUEZ_NET_CLIENT_PATH);
if (proxy_net_client == NULL) {
#include <string.h>
#include <unistd.h>
#include <glib.h>
+#include <dirent.h>
#include <sys/time.h>
#include <dbus/dbus-glib.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <vconf.h>
#include "bluetooth-obex-server-api.h"
#include "obex-agent.h"
+#define BT_AGENT_SIGNAL_OBEX_AUTHORIZE "ObexAuthorize"
+
static GSList *transfers = NULL;
char *g_dst_path = NULL;
obex_server_info_t g_obex_server_info;
+gboolean obex_connected;
+gboolean auto_authorize;
static gboolean __bt_authorize_callback(DBusGMethodInvocation *context,
const char *path,
return;
}
-BT_EXPORT_API int bluetooth_obex_server_init(char *dst_path)
+/* To support the BOT */
+static DBusHandlerResult __obex_authorize_event_filter(DBusConnection *sys_conn,
+ DBusMessage *msg, void *data)
+{
+ DBG("+");
+
+ char *member;
+ const char *path = dbus_message_get_path(msg);
+ const char *addr = NULL;
+ const char *name = NULL;
+ bluetooth_device_address_t device_addr = { {0} };
+ int event;
+
+ if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (path == NULL || strcmp(path, "/") == 0)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ member = (char *)dbus_message_get_member(msg);
+ DBG("member (%s)\n", member);
+
+ if (dbus_message_is_signal(msg, BT_AGENT_INTERFACE,
+ BT_AGENT_SIGNAL_OBEX_AUTHORIZE)) {
+ dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_STRING, &addr,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID);
+ DBG("Obex Authorize request [%s], [%s]", addr, name);
+
+ if (addr == NULL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ event = BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE;
+
+ _bluetooth_internal_convert_addr_string_to_addr_type(
+ &device_addr, addr);
+
+ _bluetooth_internal_event_cb(event,
+ BLUETOOTH_ERROR_NONE, &device_addr);
+ } else {
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ DBG("-");
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+/* To support the BOT */
+static int __register_agent_authorize_signal(
+ obex_server_info_t *obex_server_info)
+{
+ DBG("+");
+
+ DBusGConnection *conn = NULL;
+ DBusConnection *dbus_connection = NULL;
+ DBusError dbus_error;
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+
+ if (conn == NULL) {
+ DBG("conn is NULL\n");
+ return BLUETOOTH_ERROR_NO_RESOURCES;
+ }
+
+ dbus_connection = dbus_g_connection_get_connection(conn);
+
+ /* Add the filter for authorize functions */
+ dbus_error_init(&dbus_error);
+ dbus_connection_add_filter(dbus_connection,
+ __obex_authorize_event_filter,
+ NULL, NULL);
+
+ dbus_bus_add_match(dbus_connection,
+ "type=signal,interface=" BT_AGENT_INTERFACE
+ ",member=ObexAuthorize", &dbus_error);
+ if (dbus_error_is_set(&dbus_error)) {
+ ERR("Fail to add dbus filter signal\n");
+ dbus_error_free(&dbus_error);
+ dbus_connection_remove_filter(dbus_connection,
+ __obex_authorize_event_filter,
+ NULL);
+ dbus_g_connection_unref(conn);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (vconf_set_int(BT_MEMORY_OBEX_NO_AGENT, 1) != 0) {
+ DBG("Set vconf failed");
+ dbus_connection_remove_filter(dbus_connection,
+ __obex_authorize_event_filter,
+ NULL);
+ dbus_g_connection_unref(conn);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ obex_server_info->system_bus = conn;
+
+ DBG("-");
+ return BLUETOOTH_ERROR_NONE;
+}
+
+/* To support the BOT */
+static void __unregister_agent_authorize_signal(
+ obex_server_info_t *obex_server_info)
+{
+ DBG("+");
+
+ DBusConnection *dbus_connection = NULL;
+
+ if (obex_server_info == NULL) {
+ DBG("info is NULL");
+ return;
+ }
+
+ if (obex_server_info->system_bus == NULL) {
+ DBG("connection is NULL");
+ return;
+ }
+
+ dbus_connection = dbus_g_connection_get_connection(
+ obex_server_info->system_bus);
+
+ dbus_connection_remove_filter(dbus_connection,
+ __obex_authorize_event_filter,
+ NULL);
+
+ dbus_g_connection_unref(obex_server_info->system_bus);
+ obex_server_info->system_bus = NULL;
+
+ if (vconf_set_int(BT_MEMORY_OBEX_NO_AGENT, 0) != 0)
+ DBG("Set vconf failed");
+
+ DBG("-");
+}
+
+BT_EXPORT_API int bluetooth_obex_server_init(const char *dst_path)
{
DBG("+\n");
if (ret != BLUETOOTH_ERROR_NONE) {
g_free(g_dst_path);
dbus_g_connection_unref(conn);
+ g_obex_server_info.bus = NULL;
g_dst_path = NULL;
}
+ if (vconf_set_int(BT_MEMORY_OBEX_NO_AGENT, 0) != 0)
+ DBG("Set vconf failed");
+
DBG("- \n");
return ret;
return BLUETOOTH_ERROR_NONE;
}
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_obex_server_init_without_agent(const char *dst_path)
+{
+ DBG("+\n");
+
+ int ret = BLUETOOTH_ERROR_NONE;
+ DBusGConnection *conn = NULL;
+
+ _bluetooth_internal_session_init();
+
+ if (FALSE == _bluetooth_internal_is_adapter_enabled()) {
+ DBG("Adapter not enabled");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ if (g_obex_server_info.obex_server_agent) {
+ DBG("Agent already registered");
+ return BLUETOOTH_ERROR_AGENT_ALREADY_EXIST;
+ }
+
+ if (NULL == dst_path) {
+ DBG("Invalid Param");
+ 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_obex_server_info.bus = NULL;
+ g_dst_path = NULL;
+ } else {
+ ret = __register_agent_authorize_signal(&g_obex_server_info);
+ }
+
+ DBG("- \n");
+
+ return ret;
+}
+
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_obex_server_deinit_without_agent(void)
+{
+ DBG("+\n");
+
+ _bluetooth_internal_session_init();
+
+ if (FALSE == _bluetooth_internal_is_adapter_enabled()) {
+ DBG("Adapter not enabled");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ if (NULL == g_obex_server_info.obex_server_agent) {
+ DBG("Agent not registered");
+ return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST;
+ }
+
+ __bt_obex_agent_unregister(&g_obex_server_info);
+
+ __unregister_agent_authorize_signal(&g_obex_server_info);
+
+ g_free(g_dst_path);
+ g_dst_path = NULL;
+
+ DBG("- \n");
+ return BLUETOOTH_ERROR_NONE;
+}
+
BT_EXPORT_API gboolean bluetooth_obex_server_is_activated(void)
{
gboolean exist = FALSE;
DBusGConnection *conn = NULL;
DBusGProxy *obex_proxy = NULL;
GError *error = NULL;
+ int value = 0;
DBG("+");
+ if (vconf_get_bool(BT_VCONF_OPP_SERVER_INIT, &value) == 0) {
+ if (value == TRUE) {
+ /* Nativate Obex server is activated */
+ return FALSE;
+ }
+ }
+
conn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
if (conn == NULL)
return FALSE;
g_error_free(error);
}
+ dbus_g_proxy_call(obex_proxy, "UnregisterAgent", NULL,
+ DBUS_TYPE_G_OBJECT_PATH, BT_INVALID_PATH,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
g_object_unref(obex_proxy);
dbus_g_connection_unref(conn);
return exist;
}
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_obex_server_accept_connection(void)
+{
+ DBG("+");
+
+ int ret = BLUETOOTH_ERROR_NONE;
+ unsigned long block_time = 0;
+ DBusGConnection *conn = NULL;
+ DBusGProxy *agent_proxy = NULL;
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+
+ if (conn == NULL) {
+ DBG("conn is NULL\n");
+ return BLUETOOTH_ERROR_NO_RESOURCES;
+ }
+
+ agent_proxy = dbus_g_proxy_new_for_name(conn,
+ "org.bluez.frwk_agent",
+ "/org/bluez/agent/frwk_agent",
+ "org.bluez.Agent");
+
+ if (agent_proxy == NULL) {
+ DBG("agent proxy is NULL");
+ dbus_g_connection_unref(conn);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (!dbus_g_proxy_call(agent_proxy, "ReplyAuthorize", NULL,
+ G_TYPE_UINT, BT_ACCEPT,
+ G_TYPE_INVALID, G_TYPE_INVALID)) {
+ DBG("Fail to ReplyAuthorize");
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ goto done;
+ }
+
+ obex_connected = FALSE;
+ auto_authorize = TRUE;
+
+ /* Block until recieve the event (Requirement from BADA) */
+ while (obex_connected == FALSE) {
+ g_main_context_iteration(NULL, TRUE);
+ usleep(SLEEP_TIME); /* Sleep 50ms */
+ block_time += SLEEP_TIME;
+
+ if (block_time >= BLOCK_MAX_TIMEOUT)
+ return BLUETOOTH_ERROR_TIMEOUT;
+ }
+
+ obex_connected = FALSE;
+ auto_authorize = FALSE;
+
+done:
+ g_object_unref(agent_proxy);
+ dbus_g_connection_unref(conn);
+
+ DBG("-");
+
+ return ret;
+}
+
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_obex_server_reject_connection(void)
+{
+ DBG("+");
+
+ int ret = BLUETOOTH_ERROR_NONE;
+ DBusGConnection *conn = NULL;
+ DBusGProxy *agent_proxy = NULL;
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+
+ if (conn == NULL) {
+ DBG("conn is NULL\n");
+ return BLUETOOTH_ERROR_NO_RESOURCES;
+ }
+
+ agent_proxy = dbus_g_proxy_new_for_name(conn,
+ "org.bluez.frwk_agent",
+ "/org/bluez/agent/frwk_agent",
+ "org.bluez.Agent");
+
+ if (agent_proxy == NULL) {
+ DBG("agent proxy is NULL");
+ dbus_g_connection_unref(conn);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (!dbus_g_proxy_call(agent_proxy, "ReplyAuthorize", NULL,
+ G_TYPE_UINT, BT_REJECT,
+ G_TYPE_INVALID, G_TYPE_INVALID)) {
+ DBG("Fail to ReplyAuthorize");
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_object_unref(agent_proxy);
+ dbus_g_connection_unref(conn);
+
+ DBG("-");
+ return ret;
+}
+
static transfer_info_t *_bt_find_transfer(const char *transfer_path)
{
GSList *l;
}
-BT_EXPORT_API int bluetooth_obex_server_accept_authorize(char *filename)
+BT_EXPORT_API int bluetooth_obex_server_accept_authorize(const char *filename)
{
DBG("+\n");
&g_obex_server_info);
}
-BT_EXPORT_API int bluetooth_obex_server_set_destination_path(char *dst_path)
+BT_EXPORT_API int bluetooth_obex_server_set_destination_path(const char *dst_path)
{
DBG("+\n");
+ DIR *dp = NULL;
+
_bluetooth_internal_session_init();
- if (FALSE == _bluetooth_internal_is_adapter_enabled()) {
+ if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
DBG("Adapter not enabled");
return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
}
- if (NULL == g_obex_server_info.obex_server_agent) {
+ if (g_obex_server_info.obex_server_agent == NULL) {
DBG("Agent not registered");
return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST;
}
- if (NULL == dst_path) {
+ if (dst_path == NULL) {
DBG("Invalid Param");
return BLUETOOTH_ERROR_INVALID_PARAM;
}
+ dp = opendir(dst_path);
+
+ if (dp == NULL) {
+ DBG("The directory does not exist");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ closedir(dp);
+
g_free(g_dst_path);
g_dst_path = g_strdup(dst_path);
return BLUETOOTH_ERROR_NONE;
}
-BT_EXPORT_API int bluetooth_obex_server_set_root(char *root)
+BT_EXPORT_API int bluetooth_obex_server_set_root(const char *root)
{
GError *error = NULL;
GValue folder = { 0 };
+ DIR *dp = NULL;
obex_server_info_t *obex_server_info = &g_obex_server_info;
DBG("+\n");
_bluetooth_internal_session_init();
- if (FALSE == _bluetooth_internal_is_adapter_enabled()) {
+ if (_bluetooth_internal_is_adapter_enabled() == FALSE) {
DBG("Adapter not enabled");
return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
}
- if (NULL == obex_server_info->obex_server_agent) {
+ if (obex_server_info->obex_server_agent == NULL) {
DBG("Agent not registered");
return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST;
}
return BLUETOOTH_ERROR_INVALID_PARAM;
}
+ dp = opendir(root);
+
+ if (dp == NULL) {
+ DBG("The directory does not exist");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ closedir(dp);
+
DBG("Set Root Foler: %s", root);
g_value_init(&folder, G_TYPE_STRING);
return BLUETOOTH_ERROR_NONE;
}
+BT_EXPORT_API int bluetooth_obex_server_cancel_all_transfers(void)
+{
+ obex_server_info_t *obex_server_info = &g_obex_server_info;
+ GSList *l;
+
+ DBG("+\n");
+
+ _bluetooth_internal_session_init();
+
+ if (FALSE == _bluetooth_internal_is_adapter_enabled()) {
+ DBG("Adapter not enabled");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ if (NULL == obex_server_info->obex_server_agent) {
+ DBG("Agent not registered");
+ return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST;
+ }
+
+ if (obex_server_info->obex_proxy == NULL) {
+ DBG("obex_proxy is NULL \n");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ for (l = transfers; l != NULL; l = l->next) {
+ transfer_info_t *transfer = l->data;
+
+ if (transfer && transfer->transfer_proxy) {
+ dbus_g_proxy_call_no_reply(transfer->transfer_proxy,
+ "Cancel", G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ }
+ }
+
+ DBG("+\n");
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
static char *__bt_get_remote_device_name(const char *bdaddress)
{
GError *error = NULL;
char *device_path = NULL;
char *name = NULL;
- DBusGProxy *device = NULL;
GHashTable *hash = NULL;
GValue *value;
DBusGProxy *device_proxy = NULL;
auth_info.filename = obex_server_info->filename;
auth_info.length = length;
+ if (auto_authorize == TRUE) {
+ /* No need to send the event */
+ bluetooth_obex_server_accept_authorize(obex_server_info->filename);
+ return TRUE;
+ }
+
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE,
BLUETOOTH_ERROR_NONE, &auth_info);
transfer_info->path = g_strdup(transfer_path);
}
+ if (auto_authorize == TRUE) {
+ /* Unblock the connection accept function */
+ obex_connected = TRUE;
+ auto_authorize = FALSE;
+ }
+
transfers = g_slist_append(transfers, transfer_info);
app_transfer_info.filename = transfer_info->filename;
g_object_unref(obex_server_info->obex_server_agent);
obex_server_info->obex_server_agent = NULL;
}
-
-
#define FILE_PATH_LEN (4096 + 10)
+#define BT_VCONF_OPP_SERVER_INIT "memory/private/bluetooth-share/opp_server_init"
+
#define OBEX_SERVER_SERVICE "org.openobex"
#define OBEX_SERVER_MANAGER "org.openobex.Manager"
#define BT_OBEX_SERVICE_INTERFACE "org.openobex.Agent"
typedef struct {
DBusGConnection *bus;
+ DBusGConnection *system_bus;
void *obex_server_agent;
DBusGProxy *obex_proxy;
DBusGMethodInvocation *reply_context;
char *filename;
char *transfer_path;
char *device_name;
- int file_size;
+ int file_size;
} obex_server_info_t;
typedef enum {
*
*/
-#include "bluetooth-api-common.h"
-#include "bluetooth-opc-api.h"
-
-#include "obex-agent.h"
-#include <sys/time.h>
#include <dbus/dbus-glib.h>
#include <unistd.h>
#include <fcntl.h>
+#include "bluetooth-api-common.h"
+#include "bluetooth-opc-api.h"
+#include "obex-agent.h"
+
static ObexAgent *opc_obex_agent = NULL;
static DBusGProxy *client_proxy = NULL;
+static DBusGProxyCall *call_proxy = NULL;
static DBusGProxy *current_transfer = NULL;
static gboolean cancel_sending_files = FALSE;
char address[BT_BD_ADDR_MAX_LEN] = { 0 };
char agent_path[100] = {0};
- if (remote_address == NULL || file_name_array == NULL)
+ if ((NULL == remote_address) || (NULL == file_name_array)) {
+ DBG("Invalid Param\n");
return BLUETOOTH_ERROR_INVALID_PARAM;
-
+ }
_bluetooth_internal_session_init();
if (FALSE == _bluetooth_internal_is_adapter_enabled()) {
return BLUETOOTH_ERROR_IN_PROGRESS;
}
- if ((NULL == remote_address) || (NULL == file_name_array)) {
- DBG("Invalid Param\n");
- return BLUETOOTH_ERROR_INVALID_PARAM;
- }
-
snprintf(agent_path, sizeof(agent_path), OBEX_CLIENT_AGENT_PATH,
getpid(), g_counter++);
}
hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, (GDestroyNotify) __bt_value_free);
+ NULL, (GDestroyNotify)__bt_value_free);
_bluetooth_internal_print_bluetooth_device_address_t(remote_address);
cancel_sending_files = FALSE;
- if (!dbus_g_proxy_begin_call(client_proxy, "SendFiles",
+ call_proxy = dbus_g_proxy_begin_call(client_proxy, "SendFiles",
__bt_send_files_cb, NULL, NULL,
dbus_g_type_get_map("GHashTable", G_TYPE_STRING,
G_TYPE_VALUE), hash,
G_TYPE_STRV, file_name_array,
DBUS_TYPE_G_OBJECT_PATH, agent_path,
- G_TYPE_INVALID)) {
- DBG("SendFiles failed \n");
- g_object_unref(opc_obex_agent);
- opc_obex_agent = NULL;
- return BLUETOOTH_ERROR_INTERNAL;
+ G_TYPE_INVALID);
+ if (call_proxy == NULL) {
+ DBG("SendFiles failed \n");
+ g_object_unref(opc_obex_agent);
+ opc_obex_agent = NULL;
+ g_hash_table_destroy(hash);
+ return BLUETOOTH_ERROR_INTERNAL;
}
+ g_free(opc_current_transfer.address);
+ opc_current_transfer.address = g_strdup(address);
+
+ g_hash_table_destroy(hash);
+
DBG("- \n");
return BLUETOOTH_ERROR_NONE;
}
+static gboolean cancel_connect_cb(gpointer data)
+{
+ bluetooth_device_address_t device_addr = { {0} };
+ DBG("+");
+
+ _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
+ opc_current_transfer.address);
+
+ _bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_CONNECTED,
+ BLUETOOTH_ERROR_CANCEL_BY_USER, &device_addr);
+
+ g_object_unref(opc_obex_agent);
+ opc_obex_agent = NULL;
+
+ g_free(opc_current_transfer.address);
+ opc_current_transfer.address = NULL;
+
+ DBG("-");
+ return FALSE;
+}
+
BT_EXPORT_API int bluetooth_opc_cancel_push(void)
{
DBG("+");
cancel_sending_files = TRUE;
- if (current_transfer)
- dbus_g_proxy_call_no_reply(current_transfer, "Cancel", G_TYPE_INVALID,
- G_TYPE_INVALID);
+ if (current_transfer) {
+ dbus_g_proxy_call_no_reply(current_transfer, "Cancel",
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ } else {
+ if (call_proxy) {
+ dbus_g_proxy_cancel_call(client_proxy, call_proxy);
+ call_proxy = NULL;
+
+ g_idle_add(cancel_connect_cb, NULL);
+ }
+ }
DBG("-");
return BLUETOOTH_ERROR_NONE;
void *user_data)
{
GError *error = NULL;
+ bluetooth_device_address_t device_addr = { {0} };
int result = BLUETOOTH_ERROR_NONE;
DBG("+");
+ _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
+ opc_current_transfer.address);
+
if (dbus_g_proxy_end_call(proxy, call, &error,
- G_TYPE_INVALID) == FALSE) {
+ G_TYPE_INVALID) == FALSE) {
DBG("%s", error->message);
g_error_free(error);
- result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
- }
-
- if (TRUE == cancel_sending_files)
- result = BLUETOOTH_ERROR_CANCEL_BY_USER;
-
- if (result != BLUETOOTH_ERROR_NONE) {
g_object_unref(opc_obex_agent);
opc_obex_agent = NULL;
+
+ g_free(opc_current_transfer.address);
+ opc_current_transfer.address = NULL;
+
+ result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
}
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_CONNECTED,
- result, NULL);
+ result, &device_addr);
+
+ call_proxy = NULL;
+
DBG("-");
}
gpointer user_data)
{
gdouble percentage_progress = 0;
- int percentage_int = 0;
+ bt_opc_transfer_info_t info;
DBG("+");
DBG("transferred:[%ld] \n", transferred);
else
percentage_progress = 0;
- percentage_int = percentage_progress;
+ info.filename = opc_current_transfer.name;
+ info.size = opc_current_transfer.size;
+ info.percentage = percentage_progress;
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,
- BLUETOOTH_ERROR_NONE, &percentage_int);
+ BLUETOOTH_ERROR_NONE, &info);
DBG("-");
{
g_assert(current_transfer == NULL);
bt_opc_transfer_info_t info;
+ bluetooth_device_address_t device_addr = { {0} };
GHashTable *hash = NULL;
GError *error;
error = __bt_opc_agent_error(BT_OBEX_AGENT_ERROR_CANCEL, "CancelledByUser");
dbus_g_method_return_error(context, error);
g_error_free(error);
+
+ _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
+ opc_current_transfer.address);
+
g_object_unref(opc_obex_agent);
opc_obex_agent = NULL;
+
+ g_free(opc_current_transfer.address);
+ opc_current_transfer.address = NULL;
+
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
- BLUETOOTH_ERROR_CANCEL_BY_USER, NULL);
+ BLUETOOTH_ERROR_CANCEL_BY_USER, &device_addr);
+
return TRUE;
} else {
dbus_g_method_return(context, "");
{
DBG("+");
+ bluetooth_device_address_t device_addr = { {0} };
+
dbus_g_method_return(context);
if (current_transfer) {
current_transfer = NULL;
}
- g_object_unref(opc_obex_agent);
+ _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
+ opc_current_transfer.address);
+
+ /*
+ here opc_obex_agent is just assigned to NULL, since it is being freed at
+ obex_agent_release()
+ */
opc_obex_agent = NULL;
+ g_free(opc_current_transfer.address);
+ opc_current_transfer.address = NULL;
+
/*release */
__bt_free_obexd_transfer_hierarchy(&opc_current_transfer);
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
- BLUETOOTH_ERROR_NONE, NULL);
+ BLUETOOTH_ERROR_NONE, &device_addr);
DBG("-");
return TRUE;
{
int result = BLUETOOTH_ERROR_NONE;
bt_opc_transfer_info_t info;
+ bluetooth_device_address_t device_addr = { {0} };
DBG("+ \n");
DBG("message:[%s] \n", message);
if (TRUE == cancel_sending_files) {
/* User cancelled or Remote device is switched off / memory full*/
+
+ _bluetooth_internal_convert_addr_string_to_addr_type(&device_addr,
+ opc_current_transfer.address);
+
g_object_unref(opc_obex_agent);
opc_obex_agent = NULL;
+ g_free(opc_current_transfer.address);
+ opc_current_transfer.address = NULL;
+
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_OPC_DISCONNECTED,
- result, NULL);
+ result, &device_addr);
}
DBG("- \n");
char *name;
char *file_name;
gint64 size;
+ gchar *address;
};
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
-#include <sys/ioctl.h>
#include <sys/un.h>
#include <errno.h>
-#include <sys/stat.h>
+#include <vconf.h>
#include "bluetooth-rfcomm-api.h"
#include <termios.h>
-#define BLUEZ_SERVICE_NAME "org.bluez"
#define BLUEZ_SERIAL_CLIENT_INTERFACE "org.bluez.Serial"
-#define BLUEZ_MANAGER_OBJ_PATH "/"
-#define BLUEZ_MANAGER_INTERFACE "org.bluez.Manager"
-
#define BLUEZ_SERIAL_MANAGER_INTERFACE "org.bluez.SerialProxyManager"
#define BLUEZ_SERIAL_PROXY_INTERFACE "org.bluez.SerialProxy"
#define RFCOMM_DEV_PATH "/dev/rfcomm"
#define RFCOMM_SER_DEV_PATH "x00/bluez/rfcomm"
+#define BT_AGENT_SIGNAL_AUTHORIZE "Authorize"
+
+gboolean rfcomm_connected;
+int connected_fd;
+int requested_server_fd;
static DBusConnection *connection = NULL;
static gboolean __rfcomm_server_connected_cb(GIOChannel *chan, GIOCondition cond, gpointer data);
static int __bluetooth_internal_set_non_blocking_tty(int sk);
+/* To support the BOT */
+static void __unregister_agent_authorize_signal(DBusGConnection *conn, void *user_data);
+
/*Get the free index channel for server */
static int __bluetooth_rfcomm_internal_server_get_free_index(void)
{
}
/*Get the index channel from server socket */
+static int __bluetooth_rfcomm_internal_server_get_index_from_client_socket(int client_fd)
+{
+ int ind = -1;
+ int i = 0;
+ for (; i < RFCOMM_MAX_CONN; i++) {
+ if (rfcomm_server[i].client_sock_fd == client_fd) {
+ ind = i;
+ break;
+ }
+ }
+ DBG("Index from fd %d is index(%d)\n", client_fd, ind);
+ return ind;
+}
+
+
+/*Get the index channel from server socket */
static int __bluetooth_rfcomm_internal_server_get_index_from_socket(int fd)
{
DBG("+ + + + + + + + \n");
return -1;
}
+ dbus_message_unref(reply);
+
disconnection_ind.socket_fd = rfcomm_server[index].client_sock_fd;
disconnection_ind.device_addr = rfcomm_server[index].device_addr;
+ disconnection_ind.uuid = g_strdup(rfcomm_server[index].uuid);
+ disconnection_ind.device_role = RFCOMM_ROLE_SERVER;
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
BLUETOOTH_ERROR_NONE, &disconnection_ind);
+ g_free(disconnection_ind.uuid);
if (rfcomm_server[index].client_sock_fd != -1) {
g_source_remove(rfcomm_server[index].client_event_src_id);
DBG(" g_source_remove \n");
if (rfcomm_server[index].is_listen)
g_source_remove(rfcomm_server[index].server_event_src_id);
+
+ if (rfcomm_server[index].sys_conn) {
+ __unregister_agent_authorize_signal(
+ rfcomm_server[index].sys_conn,
+ &rfcomm_server[index].server_sock_fd);
+
+ dbus_g_connection_unref(rfcomm_server[index].sys_conn);
+ rfcomm_server[index].sys_conn = NULL;
+ }
+
close(rfcomm_server[index].server_sock_fd);
rfcomm_server[index].server_sock_fd = -1;
rfcomm_server[index].is_listen = FALSE;
DBG("+\n");
bluetooth_rfcomm_disconnection_t disconnection_ind;
+ memset(&disconnection_ind, 0x00,
+ sizeof(bluetooth_rfcomm_disconnection_t));
+
__bluetooth_rfcomm_internal_disconnect(index);
disconnection_ind.socket_fd = rfcomm_client[index].sock_fd;
disconnection_ind.device_addr = rfcomm_client[index].device_addr;
+ disconnection_ind.device_role = RFCOMM_ROLE_CLIENT;
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
BLUETOOTH_ERROR_NONE, &disconnection_ind);
}
- if(__bluetooth_internal_set_non_blocking_tty(client_sock) < 0) {
+ if (__bluetooth_internal_set_non_blocking_tty(client_sock) < 0) {
/* Even if setting the tty fails we will continue */
DBG("Warning!!Setting the tty properties failed(%d)\n", client_sock);
}
rfcomm_server[index].client_io_channel = g_io_channel_unix_new(client_sock);
+ g_io_channel_set_encoding(rfcomm_server[index].client_io_channel, NULL, NULL);
+ g_io_channel_set_flags(rfcomm_server[index].client_io_channel,
+ G_IO_FLAG_NONBLOCK, NULL);
+
g_io_channel_set_close_on_unref(rfcomm_server[index].client_io_channel, TRUE);
rfcomm_server[index].client_event_src_id =
if (msg == NULL) {
DBG("dbus method call is not allocated.");
- return -1;
+ return FALSE;
}
dbus_error_init(&error);
ERR("%s\n", error.message);
dbus_error_free(&error);
}
- return -1;
+ return FALSE;
}
dbus_message_iter_init(reply, &reply_iter);
if (dbus_message_iter_get_arg_type(&reply_iter) != DBUS_TYPE_ARRAY) {
ERR("Can't get reply arguments - DBUS_TYPE_ARRAY\n");
- dbus_message_unref(reply);
- return -1;
+ goto done;
}
dbus_message_iter_recurse(&reply_iter, &reply_iter_entry);
DBG("Value bool = %d", value);
+ if (value == FALSE)
+ goto done;
+
/*Parsing the address */
- if (value == TRUE) {
- dbus_message_iter_next(&reply_iter_entry);
- dbus_message_iter_recurse(&reply_iter_entry, &dict_entry);
- dbus_message_iter_get_basic(&dict_entry, &property); /*get key
- value*/
- DBG("String received...... = %s\n", property);
-
- if (g_strcmp0("address", property) == 0) {
- if (!dbus_message_iter_next(&dict_entry)) {
- DBG("Failed getting next dict entry\n");
- return -1;
- }
-
- if (dbus_message_iter_get_arg_type(&dict_entry) !=
- DBUS_TYPE_VARIANT) {
- DBG("Failed get arg type varient\n");
- return -1;
- }
- /*Getting the value of the varient*/
- dbus_message_iter_recurse(&dict_entry,
- &dict_entry_val);
-
- if (dbus_message_iter_get_arg_type(&dict_entry_val)
- != DBUS_TYPE_STRING) {
- DBG("Failed get arg type string\n");
- return -1;
- }
- /*get value string address*/
- dbus_message_iter_get_basic(&dict_entry_val, &property);
-
- DBG("String received >>> = %s\n", property);
- _bluetooth_internal_convert_addr_string_to_addr_type(
- &rfcomm_server[index].device_addr, property);
+ dbus_message_iter_next(&reply_iter_entry);
+ dbus_message_iter_recurse(&reply_iter_entry, &dict_entry);
+ dbus_message_iter_get_basic(&dict_entry, &property);
+ DBG("String received...... = %s\n", property);
+
+ if (g_strcmp0("address", property) == 0) {
+ if (!dbus_message_iter_next(&dict_entry)) {
+ DBG("Failed getting next dict entry\n");
+ goto done;
+ }
+ if (dbus_message_iter_get_arg_type(&dict_entry) !=
+ DBUS_TYPE_VARIANT) {
+ DBG("Failed get arg type varient\n");
+ goto done;
}
+ /*Getting the value of the varient*/
+ dbus_message_iter_recurse(&dict_entry,
+ &dict_entry_val);
+
+ if (dbus_message_iter_get_arg_type(&dict_entry_val) !=
+ DBUS_TYPE_STRING) {
+ DBG("Failed get arg type string\n");
+ goto done;
+ }
+ /*get value string address*/
+ dbus_message_iter_get_basic(&dict_entry_val, &property);
- } else
- return -1;
+ DBG("String received >>> = %s\n", property);
+ _bluetooth_internal_convert_addr_string_to_addr_type(
+ &rfcomm_server[index].device_addr, property);
+
+ }
}
dbus_message_iter_next(&reply_iter_entry);
}
+ dbus_message_unref(reply);
+
bluetooth_rfcomm_connection_t con_ind;
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;
+ con_ind.uuid = g_strdup(rfcomm_server[index].uuid);
+
+ /* Unblock the connection accept function */
+ connected_fd = rfcomm_server[index].client_sock_fd;
+ rfcomm_connected = TRUE;
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_CONNECTED,
BLUETOOTH_ERROR_NONE, &con_ind);
+
+ g_free(con_ind.uuid);
+
DBG("-\n");
return TRUE;
+done:
+ dbus_message_unref(reply);
+ return FALSE;
}
/*Internal: data indication*/
memset(buf, 0, sizeof(buf));
- if (g_io_channel_read(chan, buf, sizeof(buf), &len) != G_IO_ERROR_NONE) {
+ if (g_io_channel_read_chars(chan, buf, sizeof(buf), &len, NULL) == G_IO_STATUS_ERROR) {
DBG("IO Channel read error server");
__rfcomm_internal_terminate_server(rfcomm_server_info);
return FALSE;
}
- if (g_io_channel_read(chan, buf, sizeof(buf), &len) != G_IO_ERROR_NONE) {
+ if (g_io_channel_read_chars(chan, buf, sizeof(buf), &len, NULL) == G_IO_STATUS_ERROR) {
DBG("IO Channel read error client");
__rfcomm_internal_terminate_client(index);
DBG("%s\n", error.message);
dbus_error_free(&error);
}
+ dbus_message_unref(reply);
return -1;
}
DBG("%s\n", error.message);
dbus_error_free(&error);
}
+ dbus_message_unref(reply);
return -1;
}
conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ if (conn == NULL) {
+ dbus_message_unref(msg);
return FALSE;
+ }
dbus_error_init(&error);
if (dbus_message_iter_get_arg_type(&reply_iter) != DBUS_TYPE_ARRAY) {
ERR("Can't get reply arguments - DBUS_TYPE_ARRAY\n");
- dbus_message_unref(reply);
- dbus_connection_unref(conn);
- return FALSE;
+ goto done;
}
dbus_message_iter_recurse(&reply_iter, &reply_iter_entry);
DBG("uuid = %s", value);
- if (g_strcasecmp(uuid, value) == 0) {
+ if (g_ascii_strcasecmp(uuid, value) == 0) {
dbus_message_unref(reply);
dbus_connection_unref(conn);
return TRUE;
dbus_message_iter_next(&reply_iter_entry);
}
-
+done:
dbus_message_unref(reply);
dbus_connection_unref(conn);
DBG("%s\n", error.message);
dbus_error_free(&error);
}
+ dbus_message_unref(reply);
return BLUETOOTH_ERROR_INTERNAL;
}
close(sk);
return BLUETOOTH_ERROR_INTERNAL;
}
- else
- return sk;
+
+ DBG("Set the uuid");
+ rfcomm_server[index].uuid = g_strdup(uuid);
+ return sk;
}
BT_EXPORT_API gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
/*Get all proxies */
if (__get_rfcomm_proxy_list(&proxy_list, &len) < 0) {
DBG("Fail to RFCOMM List Proxy\n");
- return TRUE;
+ return FALSE;
}
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;
}
- return TRUE;
+ return FALSE;
}
return BLUETOOTH_ERROR_CONNECTION_ERROR;
}
+ if (vconf_set_str(BT_MEMORY_RFCOMM_UUID, "") != 0)
+ DBG("\vconf set failed..");
+
rfcomm_server[index].server_io_channel = g_io_channel_unix_new(socket_fd);
g_io_channel_set_close_on_unref(rfcomm_server[index].server_io_channel, TRUE);
+ g_io_channel_set_encoding(rfcomm_server[index].server_io_channel, NULL, NULL);
+ g_io_channel_set_flags(rfcomm_server[index].server_io_channel,
+ G_IO_FLAG_NONBLOCK, NULL);
+
rfcomm_server[index].server_event_src_id =
g_io_add_watch(rfcomm_server[index].server_io_channel,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, __rfcomm_server_connected_cb,
}
+/* To support the BOT */
+static DBusHandlerResult __rfcomm_authorize_event_filter(DBusConnection *sys_conn,
+ DBusMessage *msg, void *data)
+{
+ const char *path = dbus_message_get_path(msg);
+ bluetooth_rfcomm_connection_request_t req_ind = { 0 };
+ const char *addr = NULL;
+ const char *name = NULL;
+ int socket_fd = *((int *)data);
+
+ if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (path == NULL || strcmp(path, "/") == 0)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (dbus_message_is_signal(msg, BT_AGENT_INTERFACE, BT_AGENT_SIGNAL_AUTHORIZE)) {
+ dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_STRING, &addr,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID);
+ DBG("Rfcomm Authorize request [%s], [%s]", addr, name);
+
+ if (addr == NULL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ DBG("socket_fd: %d", socket_fd);
+
+ req_ind.socket_fd = socket_fd;
+ requested_server_fd = socket_fd;
+ _bluetooth_internal_convert_addr_string_to_addr_type(&req_ind.device_addr, addr);
+ _bluetooth_internal_print_bluetooth_device_address_t(&req_ind.device_addr);
+
+ _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
+ BLUETOOTH_ERROR_NONE, &req_ind);
+
+ } else {
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+/* To support the BOT */
+DBusGConnection *__register_agent_authorize_signal(void *user_data)
+{
+ DBG("+\n");
+ DBusGConnection *conn = NULL;
+ DBusConnection *dbus_connection = NULL;
+ GError *err = NULL;
+ DBusError dbus_error;
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (!conn) {
+ DBG(" DBUS get failed\n");
+ g_error_free(err);
+ return NULL;
+ }
+
+ dbus_connection = dbus_g_connection_get_connection(conn);
+
+ /* Add the filter for network client functions */
+ dbus_error_init(&dbus_error);
+ dbus_connection_add_filter(dbus_connection,
+ __rfcomm_authorize_event_filter,
+ user_data, NULL);
+ dbus_bus_add_match(dbus_connection,
+ "type=signal,interface=" BT_AGENT_INTERFACE
+ ",member=Authorize", &dbus_error);
+ if (dbus_error_is_set(&dbus_error)) {
+ ERR("Fail to add dbus filter signal\n");
+ dbus_error_free(&dbus_error);
+ }
+
+ DBG("-\n");
+ return conn;
+}
+
+/* To support the BOT */
+static void __unregister_agent_authorize_signal(DBusGConnection *conn, void *user_data)
+{
+ DBG("+");
+
+ DBusConnection *dbus_connection = NULL;
+
+ if (conn == NULL) {
+ DBG("conn is NULL");
+ return;
+ }
+
+ dbus_connection = dbus_g_connection_get_connection(conn);
+
+ dbus_connection_remove_filter(dbus_connection,
+ __rfcomm_authorize_event_filter,
+ user_data);
+
+ if (vconf_set_str(BT_MEMORY_RFCOMM_UUID, "") != 0 )
+ DBG("\vconf set failed..");
+
+ DBG("-");
+}
+
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection)
+{
+ DBG("+\n");
+ int is_success;
+ int index;
+ static char *default_adapter_obj_path = NULL;
+
+ if (socket_fd <= 0) {
+ DBG("\nInvalid fd..");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ if (__get_default_adapter_path(&default_adapter_obj_path) < 0) {
+ DBG("Fail to get default hci adapter path\n");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ index = __bluetooth_rfcomm_internal_server_get_index_from_socket(socket_fd);
+ if (index < 0) {
+ DBG("Invalid index %d", index);
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ rfcomm_server[index].sys_conn = __register_agent_authorize_signal(
+ &rfcomm_server[index].server_sock_fd);
+
+ if (rfcomm_server[index].sys_conn == NULL) {
+ DBG("Fail to get the dbus connection");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ /* Store the uuid info to vconf */
+ if (rfcomm_server[index].uuid) {
+ DBG("Set vconf: %s", rfcomm_server[index].uuid);
+
+ if (vconf_set_str(BT_MEMORY_RFCOMM_UUID,
+ rfcomm_server[index].uuid) != 0)
+ DBG("\vconf set failed..");
+ }
+
+ is_success = listen(socket_fd, max_pending_connection);
+
+ if (is_success == 0)
+ rfcomm_server[index].is_listen = TRUE;
+ else {
+ rfcomm_server[index].is_listen = FALSE;
+ DBG("\nListen failed..");
+ return BLUETOOTH_ERROR_CONNECTION_ERROR;
+ }
+
+ rfcomm_server[index].server_io_channel = g_io_channel_unix_new(socket_fd);
+ g_io_channel_set_close_on_unref(rfcomm_server[index].server_io_channel, TRUE);
+
+ g_io_channel_set_flags(rfcomm_server[index].server_io_channel,
+ G_IO_FLAG_NONBLOCK, NULL);
+
+ rfcomm_server[index].server_event_src_id =
+ g_io_add_watch(rfcomm_server[index].server_io_channel,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, __rfcomm_server_connected_cb,
+ &rfcomm_server[index]);
+ g_io_channel_unref(rfcomm_server[index].server_io_channel);
+
+ DBG(" -\n is success = %d\n", is_success);
+ return is_success;
+}
+
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_rfcomm_accept_connection(int server_fd, int *client_fd)
+{
+ DBG("+");
+
+ int ret = BLUETOOTH_ERROR_NONE;
+ unsigned long block_time = 0;
+ DBusGConnection *conn = NULL;
+ DBusGProxy *agent_proxy = NULL;
+
+ if (server_fd != requested_server_fd) {
+ DBG("Not requested fd");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ requested_server_fd = 0;
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+
+ if (conn == NULL) {
+ DBG("conn is NULL\n");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ agent_proxy = dbus_g_proxy_new_for_name(conn,
+ "org.bluez.frwk_agent",
+ "/org/bluez/agent/frwk_agent",
+ "org.bluez.Agent");
+
+ if (agent_proxy == NULL) {
+ DBG("agent proxy is NULL");
+ dbus_g_connection_unref(conn);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ rfcomm_connected = FALSE;
+ connected_fd = 0;
+
+ if (!dbus_g_proxy_call(agent_proxy, "ReplyAuthorize", NULL,
+ G_TYPE_UINT, BT_ACCEPT,
+ G_TYPE_INVALID, G_TYPE_INVALID)) {
+ DBG("Fail to ReplyAuthorize");
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ goto done;
+ }
+
+ /* Block until recieve the event (Requirement from BADA) */
+ while (rfcomm_connected == FALSE) {
+ g_main_context_iteration(NULL, TRUE);
+ usleep(SLEEP_TIME); /* Sleep 50ms */
+ block_time += SLEEP_TIME;
+
+ if (block_time >= BLOCK_MAX_TIMEOUT)
+ return BLUETOOTH_ERROR_TIMEOUT;
+ }
+
+ *client_fd = connected_fd;
+ rfcomm_connected = FALSE;
+
+ DBG("-");
+ return BLUETOOTH_ERROR_NONE;
+
+done:
+ g_object_unref(agent_proxy);
+ dbus_g_connection_unref(conn);
+
+ DBG("-");
+
+ return ret;
+}
+
+/* To support the BOT */
+BT_EXPORT_API int bluetooth_rfcomm_reject_connection(int server_fd)
+{
+ DBG("+");
+
+ int ret = BLUETOOTH_ERROR_NONE;
+ DBusGConnection *conn = NULL;
+ DBusGProxy *agent_proxy = NULL;
+
+ if (server_fd != requested_server_fd) {
+ DBG("Not requested fd");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ requested_server_fd = 0;
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+
+ if (conn == NULL) {
+ DBG("conn is NULL\n");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ agent_proxy = dbus_g_proxy_new_for_name(conn,
+ "org.bluez.frwk_agent",
+ "/org/bluez/agent/frwk_agent",
+ "org.bluez.Agent");
+
+ if (agent_proxy == NULL) {
+ DBG("agent proxy is NULL");
+ dbus_g_connection_unref(conn);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (!dbus_g_proxy_call(agent_proxy, "ReplyAuthorize", NULL,
+ G_TYPE_UINT, BT_REJECT,
+ G_TYPE_INVALID, G_TYPE_INVALID)) {
+ DBG("Fail to ReplyAuthorize");
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_object_unref(agent_proxy);
+ dbus_g_connection_unref(conn);
+
+ DBG("-");
+ return ret;
+}
+
/*
* SLP 2.0 Bluetooth RFCOMM API
- * bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
+ * bluetooth_rfcomm_remove_socket(int socket_fd)
*
*/
-BT_EXPORT_API int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
+BT_EXPORT_API int bluetooth_rfcomm_remove_socket(int socket_fd)
{
DBG("+\n");
DBusMessage *msg, *reply;
return BLUETOOTH_ERROR_INTERNAL;
}
+ dbus_message_unref(reply);
+
if (rfcomm_server[index].client_sock_fd) {
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;
+ disconnection_ind.device_role = RFCOMM_ROLE_SERVER;
+ disconnection_ind.uuid = g_strdup(rfcomm_server[index].uuid);
+
_bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
BLUETOOTH_ERROR_NONE, &disconnection_ind);
+ g_free(disconnection_ind.uuid);
+
g_source_remove(rfcomm_server[index].client_event_src_id);
close(rfcomm_server[index].client_sock_fd);
rfcomm_server[index].client_sock_fd = -1;
if (rfcomm_server[index].is_listen)
g_source_remove(rfcomm_server[index].server_event_src_id);
+ if (rfcomm_server[index].sys_conn) {
+ __unregister_agent_authorize_signal(
+ rfcomm_server[index].sys_conn,
+ &rfcomm_server[index].server_sock_fd);
+
+ dbus_g_connection_unref(rfcomm_server[index].sys_conn);
+ rfcomm_server[index].sys_conn = NULL;
+ }
+
close(rfcomm_server[index].server_sock_fd);
rfcomm_server[index].server_sock_fd = -1;
g_free(rfcomm_server[index].uds_name);
rfcomm_server[index].uds_name = NULL;
+ g_free(rfcomm_server[index].uuid);
+ rfcomm_server[index].uuid = NULL;
+
/*Resetting the connection */
rfcomm_server[index].id = 0;
return BLUETOOTH_ERROR_NONE;
}
+BT_EXPORT_API int bluetooth_rfcomm_server_disconnect(int socket_fd)
+{
+ DBG("+\n");
+
+ bluetooth_rfcomm_disconnection_t disconnection_ind;
+ static char *default_adapter_obj_path = NULL;
+ bt_info_t *bt_internal_info = NULL;
+ int index = 0;
+ int ret = BLUETOOTH_ERROR_NONE;
+
+ if (socket_fd <= 0)
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+
+ if (__get_default_adapter_path(&default_adapter_obj_path) < 0) {
+ DBG("Fail to get default hci adapter path\n");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ bt_internal_info = _bluetooth_internal_get_information();
+
+ index = __bluetooth_rfcomm_internal_server_get_index_from_client_socket(socket_fd);
+ if (index < 0) {
+ DBG("Invalid index %d for socket %d\n", index, socket_fd);
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ disconnection_ind.socket_fd = rfcomm_server[index].client_sock_fd;
+ disconnection_ind.device_addr = rfcomm_server[index].device_addr;
+ disconnection_ind.device_role = RFCOMM_ROLE_SERVER;
+ disconnection_ind.uuid = g_strdup(rfcomm_server[index].uuid);
+ _bluetooth_internal_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
+ BLUETOOTH_ERROR_NONE, &disconnection_ind);
+
+ g_free(disconnection_ind.uuid);
+
+ g_source_remove(rfcomm_server[index].client_event_src_id);
+ close(rfcomm_server[index].client_sock_fd);
+ rfcomm_server[index].client_sock_fd = -1;
+
+ DBG("-\n");
+
+ return ret;
+
+}
+
+
/* Asynchrous implementation */
static void __rfcomm_client_connected_cb(DBusGProxy *proxy, DBusGProxyCall *call,
gpointer user_data)
G_TYPE_STRING, &rfcomm_device_node, G_TYPE_INVALID);
g_object_unref(proxy);
+ bt_internal_info->rfcomm_proxy = NULL;
if (err != NULL) {
DBG("Error occured in connecting port [%s]", err->message);
DBG("\n/dev/rfcomm fd = %d\n", dev_node_fd);
- if(__bluetooth_internal_set_non_blocking_tty(dev_node_fd) < 0) {
+ if (__bluetooth_internal_set_non_blocking_tty(dev_node_fd) < 0) {
DBG("\nWarning! Unable to set the tty /dev/rfcomm fd = %d\n",
dev_node_fd);
/* Even if setting the tty fails we will continue */
memcpy(&rfcomm_client[index].device_addr, remote_address, BLUETOOTH_ADDRESS_LENGTH);
rfcomm_client[index].io_channel = g_io_channel_unix_new(dev_node_fd);
-
g_io_channel_set_close_on_unref(rfcomm_client[index].io_channel, TRUE);
+ g_io_channel_set_flags(rfcomm_client[index].io_channel,
+ G_IO_FLAG_NONBLOCK, NULL);
+
rfcomm_client[index].event_src_id =
g_io_add_watch(rfcomm_client[index].io_channel,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
__rfcomm_client_data_received_cb, &rfcomm_client[index]);
done:
+ memset(&con_ind, 0x00, sizeof(bluetooth_rfcomm_connection_t));
+ memcpy(&con_ind.device_addr, remote_address, BLUETOOTH_ADDRESS_LENGTH);
if (result == BLUETOOTH_ERROR_NONE) {
con_ind.socket_fd = rfcomm_client[index].sock_fd;
- con_ind.device_addr = rfcomm_client[index].device_addr;
} else {
con_ind.socket_fd = -1;
- memcpy(&con_ind.device_addr, remote_address, BLUETOOTH_ADDRESS_LENGTH);
/* We are freeing dev_node in error case only. Success case
* will be handled during disconnection */
}
con_ind.device_role = RFCOMM_ROLE_CLIENT;
+ con_ind.uuid = bt_internal_info->connecting_uuid;
bt_event.event = BLUETOOTH_EVENT_RFCOMM_CONNECTED;
bt_event.result = result;
bt_event.param_data = (void *)&con_ind;
bt_internal_info->bt_cb_ptr(bt_event.event, &bt_event, bt_internal_info->user_data);
}
+ g_free(bt_internal_info->connecting_uuid);
+ bt_internal_info->connecting_uuid = NULL;
+
free(remote_address);
DBG("-\n");
}
-DBusGProxy *proxy_rfcomm_client = NULL;
-
BT_EXPORT_API int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
const char *remote_uuid)
{
gchar *address_up;
gchar *remote_device_path;
char str_addr[20];
+ DBusGProxy *proxy = NULL;
bluetooth_device_address_t *remote_address;
GError *err = NULL;
DBusGConnection *conn;
+ bt_info_t *bt_internal_info = NULL;
static char *default_adapter_obj_path = NULL;
memset(str_addr, 0, 20);
return BLUETOOTH_ERROR_CONNECTION_ERROR;
}
- proxy_rfcomm_client = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
+ proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
remote_device_path,
BLUEZ_SERIAL_CLIENT_INTERFACE);
g_free(remote_device_path);
- if (proxy_rfcomm_client == NULL) {
+ if (proxy == NULL) {
DBG("Failed to get the rfcomm proxy\n");
return BLUETOOTH_ERROR_NOT_PAIRED;
}
remote_address->addr[1], remote_address->addr[2], remote_address->addr[3],
remote_address->addr[4], remote_address->addr[5]);
- if (!dbus_g_proxy_begin_call(proxy_rfcomm_client, "Connect",
+ bt_internal_info = _bluetooth_internal_get_information();
+
+ bt_internal_info->connecting_uuid = g_strdup(remote_uuid);
+
+ bt_internal_info->rfcomm_proxy = proxy;
+
+ if (!dbus_g_proxy_begin_call(proxy, "Connect",
(DBusGProxyCallNotify)__rfcomm_client_connected_cb,
(gpointer)remote_address, /*user_data*/
NULL, /*destroy*/
G_TYPE_INVALID)) {
DBG("Network server register Dbus Call Error");
free(remote_address);
+ g_free(bt_internal_info->connecting_uuid);
+ g_object_unref(proxy);
+ bt_internal_info->connecting_uuid = NULL;
+ bt_internal_info->rfcomm_proxy = NULL;
return BLUETOOTH_ERROR_INTERNAL;
}
}
+static int __bluetooth_cancel_connecting(DBusGProxy *proxy)
+{
+
+ DBG("+\n");
+
+ bt_info_t *bt_internal_info = NULL;
+ GError *error = NULL;
+
+ bt_internal_info = _bluetooth_internal_get_information();
+
+ if (bt_internal_info->connecting_uuid == NULL) {
+ DBG("uuid is NULL");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ if (!dbus_g_proxy_call(proxy,
+ "Disconnect",
+ &error,
+ G_TYPE_STRING, bt_internal_info->connecting_uuid,
+ G_TYPE_INVALID, G_TYPE_INVALID)) {
+ DBG("Disconnect Dbus Call Error, %s", error->message);
+ g_error_free(error);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_free(bt_internal_info->connecting_uuid);
+ bt_internal_info->connecting_uuid = NULL;
+
+ DBG("-\n");
+ return BLUETOOTH_ERROR_NONE;
+}
+
+
BT_EXPORT_API int bluetooth_rfcomm_disconnect(int socket_fd)
{
DBG("+\n");
static char *default_adapter_obj_path = NULL;
+ bt_info_t *bt_internal_info = NULL;
int index = 0;
+ int ret = BLUETOOTH_ERROR_NONE;
if (__get_default_adapter_path(&default_adapter_obj_path) < 0) {
DBG("Fail to get default hci adapter path\n");
return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
}
+ bt_internal_info = _bluetooth_internal_get_information();
+
+ if (socket_fd <= 0) {
+ /* Cancel connecting request */
+ if (bt_internal_info->rfcomm_proxy == NULL) {
+ DBG("No connecting request");
+ return BLUETOOTH_ERROR_NOT_IN_OPERATION;
+ }
+
+ if (__bluetooth_cancel_connecting(
+ bt_internal_info->rfcomm_proxy) !=
+ BLUETOOTH_ERROR_NONE) {
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_object_unref(bt_internal_info->rfcomm_proxy);
+ bt_internal_info->rfcomm_proxy = NULL;
+ return BLUETOOTH_ERROR_NONE;
+ }
+
index = __bluetooth_rfcomm_internal_client_get_index_from_socket(socket_fd);
if (index < 0) {
DBG("Invalid index %d for socket %d\n", index, socket_fd);
- return BLUETOOTH_ERROR_INVALID_PARAM;
+
+ /* Try to disconnect server socket */
+ return bluetooth_rfcomm_server_disconnect(socket_fd);
}
if (!(socket_fd && (socket_fd == rfcomm_client[index].sock_fd)) ||
return BLUETOOTH_ERROR_INVALID_PARAM;
}
- __bluetooth_rfcomm_internal_disconnect(index);
-
- g_source_remove(rfcomm_client[index].event_src_id);
- close(rfcomm_client[index].sock_fd);
- rfcomm_client[index].sock_fd = -1;
+ ret = __bluetooth_rfcomm_internal_disconnect(index);
- if (rfcomm_client[index].dev_node_name != NULL)
- g_free(rfcomm_client[index].dev_node_name);
- rfcomm_client[index].dev_node_name = NULL;
+ if (ret == BLUETOOTH_ERROR_NONE)
+ __rfcomm_internal_terminate_client(index);
- rfcomm_client[index].id = -1;
DBG("-\n");
- return BLUETOOTH_ERROR_NONE;
+ return ret;
}
DBG("write failed..\n");
return BLUETOOTH_ERROR_NOT_IN_OPERATION;
}
+
+ /* Synchronize the sending buffer */
+ sync();
+ fsync(fd);
+
wbytes += written;
}
if (object_path == NULL)
return FALSE;
- proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_NAME, object_path,
+ proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME, object_path,
BLUEZ_SERIAL_CLIENT_INTERFACE);
if (proxy == NULL)
goto done;
}
- adapter = dbus_g_proxy_new_for_name(conn, BLUEZ_NAME,
- adapter_path, BLUEZ_ADAPTER_NAME);
+ adapter = dbus_g_proxy_new_for_name(conn, BLUEZ_SERVICE_NAME,
+ adapter_path, BLUEZ_ADAPTER_INTERFACE);
g_free(adapter_path);
return 0;
}
-
gboolean is_listen; /*server listen*/
char *uds_name; /*proxy name*/
char *file_name; /*device name*/
+ char *uuid; /*uuid*/
int client_sock_fd;
bluetooth_device_address_t device_addr;
GIOChannel *client_io_channel;
guint client_event_src_id;
+ DBusGConnection *sys_conn;
} rfcomm_server_t;
static rfcomm_server_t rfcomm_server[RFCOMM_MAX_CONN];
GHashTable *hash;
GValue *value = { 0 };
int result = BLUETOOTH_ERROR_NONE;
- bluetooth_event_param_t bt_event = { 0, };
- bt_info_t *bt_internal_info = NULL;
DBG("+\n");
g_strfreev(array_list);
done:
-
+
if (0 > ret) {
result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
device_uuids.service_index = 0x00;
return;
}
-static int __bluetooth_internal_parse_sdp_xml(const char *buf_name, int size,
- bt_sdp_info_t *xml_parsed_sdp);
-
-static gboolean __bluetooth_internal_get_service_rec_handle_from_node(xmlNodePtr xml_node,
- unsigned int *record_handle);
-static gboolean __bluetooth_internal_get_service_class_id_list_from_node(xmlNodePtr xml_node,
- bt_sdp_info_t *sdp_info);
-
-static gboolean __bluetooth_internal_get_service_class_id_list_from_node(xmlNodePtr xml_node,
- bt_sdp_info_t *sdp_info)
-{
- xmlNodePtr local_node;
- xmlAttr *uuid_attr;
- xmlNodePtr uuid_node;
-
- if (xml_node == NULL || sdp_info == NULL)
- return FALSE;
-
- local_node = xml_node->next;
-
- while (local_node) {
- if (!strcmp((char *)local_node->name, "sequence")) {
- DBG("\t\t %s\n", local_node->name);
- uuid_node = local_node->xmlChildrenNode;
- uuid_node = uuid_node->next;
-
- if (uuid_node) {
- uuid_attr = uuid_node->properties;
- DBG("\t\t\t%s, %s\n", uuid_node->name,
- uuid_attr->children->content);
-
- if (sdp_info->service_index < BLUETOOTH_MAX_SERVICES_FOR_DEVICE) {
- DBG("sdp_info->service_index %d", sdp_info->service_index);
- g_strlcpy(sdp_info->uuids[sdp_info->service_index],
- (const gchar *)uuid_attr->children->content,
- BLUETOOTH_UUID_STRING_MAX);
-
- sdp_info->service_list_array[sdp_info->service_index] =
- strtol((char *)uuid_attr->children->content,
- NULL, 0);
- sdp_info->service_index++;
- } else {
- DBG("service index(%d) is more than"
- "BLUETOOTH_MAX_SERVICES_FOR_DEVICE",
- sdp_info->service_index);
- }
-
- }
- }
- local_node = local_node->next;
- }
- return TRUE;
-}
-
-static gboolean __bluetooth_internal_get_service_rec_handle_from_node(xmlNodePtr xml_node,
- unsigned int *record_handle) {
- xmlNodePtr local_node;
- xmlAttr *local_attr;
-
- if (xml_node == NULL || record_handle == NULL)
- return FALSE;
-
- local_node = xml_node->next;
-
- if (local_node) {
- if (!strcmp((char *)local_node->name, "uint32")) {
- local_attr = local_node->properties;
- DBG("\t\t%s, %s\n", local_node->name, local_attr->children->content);
- *record_handle = strtol((char *)local_attr->children->content, NULL, 0);
- }
- }
- return TRUE;
-}
-
-static int __bluetooth_internal_parse_xml_parse_record(xmlNodePtr cur,
- bt_sdp_info_t *xml_parsed_sdp_data)
-{
- xmlNodePtr icur;
-
- icur = cur;
- icur = icur->xmlChildrenNode;
- xmlAttr *attr = NULL;
-
- unsigned int attribute_value = 0;
- unsigned int record_handle = 0;
-
- while (icur) {
- attr = icur->properties;
-
- if (strcmp((char *)icur->name, "attribute")) {
- icur = icur->next;
- continue;
- }
-
- DBG("%s\n", icur->name);
- while (attr) {
- if (strcmp((char *)attr->name, "id")) {
- attr = attr->next;
- continue;
- }
- DBG("\t%s, %s\n", attr->name, attr->children->content);
- attribute_value = strtol((char *)attr->children->content, NULL, 0);
-
- switch (attribute_value) {
- case SERVICE_RECORD_HANDLE:
- DBG("\tSERVICE_RECORD_HANDLE:\n");
- __bluetooth_internal_get_service_rec_handle_from_node
- (icur->xmlChildrenNode, &record_handle);
- DBG("\tRecord Handle 0x%04x \n", record_handle);
- break;
-
- case SERVICE_CLASS_ID_LIST:
- DBG("\tSERVICE_CLASS_ID_LIST:\n");
- __bluetooth_internal_get_service_class_id_list_from_node
- (icur->xmlChildrenNode, xml_parsed_sdp_data);
- break;
-
- case PROTOCOL_DESCRIPOTR_LIST:
- break;
-
- case BLUETOOTH_PROFILE_DESCRIPTOR_LIST:
- break;
-
- default:
- break;
-
- }
- attr = attr->next;
- }
- icur = icur->next;
- }
- return TRUE;
-}
-
-static int __bluetooth_internal_parse_sdp_xml(const char *buf_name, int size,
- bt_sdp_info_t *xml_parsed_sdp)
-{
- xmlDocPtr doc;
- xmlNodePtr first;
- xmlNodePtr base;
- xmlInitParser();
-
- char *check = NULL;
-
- DBG("+\n");
-
- /*Below check is done for proper parsing of BPP service UUID, in case of BPP '&' gets
- appended to text value parameter of service list, when '&' containing data is passed
- to function "xmlParseMemory()" parse error occurs. so '&' is replaced with blank space ' '*/
- if (buf_name != NULL) {
- check = strchr(buf_name, '&');
- if (check != NULL) {
- *check = ' ';
- }
- }
-
- if (size != 0) {
- doc = xmlParseMemory(buf_name, size);
- } else
- return -1;
-
- if (doc == NULL) {
- DBG("Document not parsed successfully.\n");
- return -1;
- }
-
- DBG("Document parsed successfully.\n");
-
- first = xmlDocGetRootElement(doc);
-
- if (first == NULL) {
- DBG("Root element = NULL \n");
- xmlFreeDoc(doc);
- return -1;
- }
-
- base = first;
- if (base == NULL) {
- DBG("empty document\n");
- xmlFreeDoc(doc);
-
- xmlCleanupParser();
- return -1;
- } else {
- DBG("Root - %s\n", first->name);
- }
- while (base != NULL) {
- DBG(" Main While %s\n", base->name);
-
- __bluetooth_internal_parse_xml_parse_record(base, xml_parsed_sdp);
- base = base->next;
-
- }
-
- xmlFreeDoc(doc);
-
- xmlCleanupParser();
- DBG("-\n");
-
- return 0;
-}
-
static void __bluetooth_internal_discover_services_cb(DBusGProxy *proxy, DBusGProxyCall *call,
gpointer user_data)
{
result = BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR;
sdp_data.service_index = 0;
} else if (sdp_data.service_index == 0) {
- /*This is for some carkit, printer.*/
+ /*This is for some carkit, printer.*/
__bluetooth_internal_request_search_supported_services(
&bt_info_for_searching_support_service->remote_device_addr);
return;
Name: bluetooth-frwk
Summary: Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
-Version: 0.1.56
+Version: 0.1.80
Release: 1
Group: TO_BE/FILLED_IN
-License: Apache-2.0
+License: TO BE FILLED IN
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(syspopup-caller)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(libxml-2.0)
-BuildRequires: pkgconfig(bluez)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(utilX)
-BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(msg-service)
BuildRequires: pkgconfig(email-service)
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(appsvc)
BuildRequires: cmake
Requires(post): /sbin/ldconfig
%package devel
-Summary: Bluetooth framework for BlueZ
+Summary: Bluetooth framework for BlueZ and Obexd
Group: TO_BE/FILLED
Requires: %{name} = %{version}-%{release}
%description devel
-This package is development files for Bluetooth framework based on BlueZ stack.
+This package is development files for Bluetooth framework based on BlueZ and Obexd stack.
This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
make
%install
+rm -rf %{buildroot}
%make_install
-%post
-/sbin/ldconfig
-# Set vconf values with -g/-u options
-# 0 is root user id
-vconftool set -t bool memory/bluetooth/allow "0" -u 0
-
-%postun -p /sbin/ldconfig
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/
+ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-agent %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-agent
+ln -s %{_sysconfdir}/rc.d/init.d/bluetooth-frwk-agent %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-agent
-%post agent
+%post
+vconftool set -t int db/bluetooth/status "0" -g 6520
+vconftool set -t int memory/private/libbluetooth-frwk-0/obex_no_agent "0" -g 6520 -i
+vconftool set -t string memory/private/libbluetooth-frwk-0/uuid "" -g 6520 -i
+vconftool set -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
-ln -s ../init.d/bluetooth-frwk-agent /etc/rc.d/rc3.d/S80bluetooth-frwk-agent
-ln -s ../init.d/bluetooth-frwk-agent /etc/rc.d/rc5.d/S80bluetooth-frwk-agent
+%postun -p /sbin/ldconfig
%files
-/usr/lib/*.so.*
+%defattr(-, root, root)
+%{_libdir}/libbluetooth-api.so.*
+%{_libdir}/libbluetooth-media-control.so.*
+%{_libdir}/libbluetooth-telephony.so.*
%files devel
-/usr/lib/*.so
-/usr/include/*
-/usr/lib/pkgconfig/*
+%defattr(-, root, root)
+%{_includedir}/bluetooth-media-control/bluetooth-media-control.h
+%{_includedir}/bluetooth-api/bluetooth-hid-api.h
+%{_includedir}/bluetooth-api/bluetooth-audio-api.h
+%{_includedir}/bluetooth-api/bluetooth-control-api.h
+%{_includedir}/bluetooth-api/bluetooth-api.h
+%{_includedir}/bluetooth-telephony/bluetooth-telephony-api.h
+%{_libdir}/pkgconfig/bluetooth-media-control.pc
+%{_libdir}/pkgconfig/bluetooth-api.pc
+%{_libdir}/pkgconfig/bluetooth-telephony.pc
+%{_libdir}/libbluetooth-api.so
+%{_libdir}/libbluetooth-media-control.so
+%{_libdir}/libbluetooth-telephony.so
+
%files agent
-/usr/bin/bluetooth-agent
-/usr/bin/bluetooth-pb-agent
-/etc/*
-#/usr/share/process-info/bluetooth-agent.ini
-/usr/share/dbus-1/services/org.bluez.frwk_agent.service
-/usr/share/dbus-1/services/org.bluez.pb_agent.service
-/usr/bin/bluetooth-map-agent
-/usr/share/dbus-1/services/org.bluez.map_agent.service
+%defattr(-, root, root)
+%{_sysconfdir}/rc.d/init.d/bluetooth-frwk-agent
+%{_sysconfdir}/rc.d/rc3.d/S80bluetooth-frwk-agent
+%{_sysconfdir}/rc.d/rc5.d/S80bluetooth-frwk-agent
+%{_datadir}/dbus-1/services/org.bluez.pb_agent.service
+%{_datadir}/dbus-1/services/org.bluez.frwk_agent.service
+%{_datadir}/dbus-1/services/org.bluez.map_agent.service
+%{_datadir}/dbus-1/services/org.bluez.hfp_agent.service
+%{_bindir}/bluetooth-agent
+%{_bindir}/bluetooth-map-agent
+%{_bindir}/bluetooth-pb-agent
+%{_bindir}/bluetooth-hfp-agent
+