#include <gio/gio.h>
#include <dlog.h>
#include <string.h>
-#include <syspopup_caller.h>
#include <vconf.h>
#include <bundle_internal.h>
#include "bt-service-network.h"
#include "bt-service-adapter.h"
#include "bt-service-gap-agent.h"
+#include "bt-service-pbap.h"
#define BT_SYSPOPUP_IPC_RESPONSE_OBJECT "/org/projectx/bt_syspopup_res"
#define BT_SYSPOPUP_INTERFACE "User.Bluetooth.syspopup"
BT_DBG("-");
} */
-#ifdef TIZEN_PROFILE_WEARABLE
-static gboolean __bt_syspopup_timer_cb(gpointer user_data)
-{
- int ret;
- bundle *b;
- retv_if(user_data == NULL, FALSE);
-
- b = (bundle *)user_data;
-
- ret = syspopup_launch("bt-syspopup", b);
- if (ret < 0) {
- BT_ERR("Sorry!! Cannot launch popup return = %d, Retrying...", ret);
- } else {
- BT_DBG("Hurray!!! Finally Popup launched");
- bundle_free(b);
- }
- return (ret < 0) ? TRUE : FALSE;
-}
-
-static gboolean __bt_launch_unable_to_pairing_syspopup(int result)
-{
- BT_DBG("+");
- int ret = 0;
- bundle *b = NULL;
- GDBusConnection *conn;
-
- conn = _bt_gdbus_get_system_gconn();
- if (conn == NULL)
- return FALSE;
-
- b = bundle_create();
- if (b == NULL)
- return FALSE;
-
- bundle_add(b, "event-type", "unable-to-pairing");
-
- if (result == BLUETOOTH_ERROR_TIMEOUT)
- bundle_add(b, "error", "timeout");
- else if (result == BLUETOOTH_ERROR_AUTHENTICATION_FAILED)
- bundle_add(b, "error", "authfailed");
- else
- bundle_add(b, "error", "error");
-
- ret = syspopup_launch("bt-syspopup", b);
- if (0 > ret) {
- BT_ERR("Popup launch failed...retry %d \n", ret);
- g_timeout_add(200, (GSourceFunc) __bt_syspopup_timer_cb,
- b);
- } else {
- bundle_free(b);
- }
-
- BT_DBG("-");
- return TRUE;
-}
-#endif
-
gboolean _bt_is_device_creating(void)
{
return is_device_creating;
ret_if(value == NULL);
ret_if(info == NULL);
- info->uuid_count = g_variant_get_size(value);
- info->uuids = g_variant_dup_strv(value, &info->uuid_count);
+ gsize uuid_count = 0;
+
+ info->uuids = g_variant_dup_strv(value, &uuid_count);
+ info->uuid_count = (unsigned int)uuid_count;
+
+ BT_DBG("uuid count : %d", uuid_count);
}
bt_remote_dev_info_t *_bt_get_remote_device_info(char *address)
}
buffer = g_malloc0(sizeof(char) * size);
- /* Fix : NULL_RETURNS */
- if (buffer == NULL) {
- BT_ERR("Memory allocation error\n");
- fclose(fp);
- return FALSE;
- }
result = fread((char *)buffer, 1, size, fp);
fclose(fp);
if (result != size) {
GVariant *param;
/* Terminate ALL system popup */
- syspopup_destroy_all();
+ if (headed_plugin_info->plugin_headed_enabled)
+ headed_plugin_info->headed_plugin->bt_destroy_popup_all();
reply = g_dbus_proxy_call_finish(proxy, res, &err);
if (reply)
result == BLUETOOTH_ERROR_AUTHENTICATION_FAILED ||
result == BLUETOOTH_ERROR_TIMEOUT ||
result == BLUETOOTH_ERROR_HOST_DOWN) {
-#ifdef TIZEN_PROFILE_WEARABLE
- int is_sw_running = 0;
+ if (TIZEN_PROFILE_WEARABLE) {
+ int is_sw_running = 0;
- if (vconf_get_int(VCONFKEY_SETUP_WIZARD_STATE, &is_sw_running))
- BT_ERR("vconf_get_int for setup wizard state failed");
+ if (vconf_get_int(VCONFKEY_SETUP_WIZARD_STATE, &is_sw_running))
+ BT_ERR("vconf_get_int for setup wizard state failed");
- if (!is_sw_running)
- __bt_launch_unable_to_pairing_syspopup(result);
- else
- BT_ERR("Unable to pair");
-#endif
+ if (!is_sw_running) {
+ if (headed_plugin_info->plugin_headed_enabled)
+ headed_plugin_info->headed_plugin->bt_launch_unable_to_pairing_syspopup(result);
+ } else {
+ BT_ERR("Unable to pair");
+ }
+ }
bonding_info->result = result;
}
/* allocate user data so that it can be retrieved in callback */
unbonding_info = g_malloc0(sizeof(bt_funcion_data_t));
- /* Fix : NULL_RETURNS */
- if (unbonding_info == NULL) {
- BT_ERR("Memory not allocated !");
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- }
-
unbonding_info->addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
unbonding_info->req_id = request_id;
{
char *object_path = NULL;
char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+ char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 };
GDBusProxy *device_proxy = NULL;
GDBusProxy *adapter_proxy = NULL;
GDBusConnection *conn;
retv_if(device_address == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
retv_if(is_connected == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+ _bt_convert_addr_type_to_string(address, device_address->addr);
+ _bt_convert_addr_string_to_secure_string(secure_address, address);
+
*is_connected = FALSE;
- BT_DBG("connection_type: %d", connection_type);
+ BT_DBG("%s connection_type: 0x%02x", secure_address, connection_type);
+
if (connection_type == BLUETOOTH_RFCOMM_SERVICE)
return _bt_rfcomm_is_device_connected(device_address,
is_connected);
} else {
uuid = _bt_get_profile_uuid128(connection_type);
if (uuid == NULL) {
- BT_ERR("uuid is NULL");
+ BT_ERR("connection_type: %d, uuid is NULL", connection_type);
return BLUETOOTH_ERROR_INTERNAL;
}
-
- BT_DBG("uuid: %s", uuid);
+ BT_DBG("uuid %s [%s]", uuid, _bt_convert_uuid_to_string(uuid));
object_path = _bt_get_device_object_path(address);
- retv_if(object_path == NULL, BLUETOOTH_ERROR_NOT_PAIRED);
- BT_DBG("object_path: %s", object_path);
+ if (!object_path) {
+ BT_ERR("object_path is NULL");
+ g_free(uuid);
+ return BLUETOOTH_ERROR_NOT_PAIRED;
+ }
+
device_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
NULL, BT_BLUEZ_NAME,
object_path, BT_DEVICE_INTERFACE, NULL, NULL);
gboolean auto_connect)
{
char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+ char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 };
gchar *device_path = NULL;
GDBusProxy *device_proxy = NULL;
GDBusConnection *conn;
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- if (func_data == NULL) {
- BT_ERR("Unable to allocate memory for address");
- ret = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(device_address);
if (func_data->address == NULL) {
BT_ERR("Unable to allocate memory for address");
goto fail;
}
+ _bt_convert_addr_string_to_secure_string(secure_address, device_address);
+ BT_INFO("Connect LE [%s]", secure_address);
+
func_data->req_id = req_id;
g_dbus_proxy_call(device_proxy, "ConnectLE",
fail:
if (device_proxy)
g_object_unref(device_proxy);
- if (func_data) {
- g_free(func_data->address);
- g_free(func_data);
- }
+
+ g_free(func_data->address);
+ g_free(func_data);
+
return ret;
}
const bluetooth_device_address_t *bd_addr)
{
char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+ char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 };
gchar *device_path;
GDBusProxy *device_proxy;
GDBusConnection *conn;
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- if (func_data == NULL) {
- BT_ERR("Unable to allocate memory for address");
- ret = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(device_address);
if (func_data->address == NULL) {
BT_ERR("Unable to allocate memory for address");
goto fail;
}
+ _bt_convert_addr_string_to_secure_string(secure_address, device_address);
+ BT_INFO("Disconnect LE [%s]", secure_address);
+
func_data->req_id = req_id;
g_dbus_proxy_call(device_proxy, "DisconnectLE",
fail:
if (device_proxy)
g_object_unref(device_proxy);
- if (func_data) {
- g_free(func_data->address);
- g_free(func_data);
- }
+
+ g_free(func_data->address);
+ g_free(func_data);
+
return ret;
}
g_object_unref(device_proxy);
return BLUETOOTH_ERROR_INTERNAL;
}
-
g_object_unref(device_proxy);
+ /* IPSP daemon launch */
+ GDBusProxy *ipsp_proxy;
+
+ ipsp_proxy = _bt_get_ipsp_proxy();
+ retv_if(ipsp_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ g_dbus_proxy_call(ipsp_proxy, "EnableIpsp",
+ NULL, G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, NULL, NULL);
+
return ret;
}
g_free(device_path);
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- if (device_path == NULL) {
- BT_DBG("device_path NULL");
- ret = BLUETOOTH_ERROR_INTERNAL;
- goto fail;
- }
-
att_mtu_req_info = g_malloc0(sizeof(bt_funcion_data_t));
att_mtu_req_info->addr = (char *)g_strdup(address);
att_mtu_req_info->req_id = request_id;
NULL,
(GAsyncReadyCallback)__bt_request_att_mtu_device_cb,
NULL);
-fail:
+
return ret;
}