#include <vconf.h>
#include <bundle_internal.h>
-#include <tethering.h>
-
#include "bt-internal-types.h"
#include "bt-service-common.h"
#include "bt-service-agent.h"
extern guint nap_connected_device_count;
-static char *passkey_watcher = NULL;
+static char *passkey_watcher;
#define G_VARIANT_UNREF(variant) \
g_variant_unref(variant); \
return _bt_is_headset_type_connected(BT_AUDIO_A2DP, NULL);
}
+static gboolean __bt_agent_is_hid_device_connectable(void)
+{
+ GDBusProxy *proxy = NULL;
+ GVariant *reply = NULL;
+ GError *err = NULL;
+ gboolean connectable = FALSE;
+
+ proxy = _bt_gdbus_get_hid_agent_proxy();
+ retv_if(proxy == NULL, FALSE);
+
+ reply = g_dbus_proxy_call_sync(proxy, "IsHidConnectable", NULL,
+ G_DBUS_CALL_FLAGS_NONE, 2000, NULL, &err);
+ if (reply == NULL) {
+ BT_ERR("Error returned in method call");
+ if (err != NULL) {
+ BT_ERR("Error message = %s", err->message);
+ g_error_free(err);
+ }
+ connectable = FALSE;
+ } else {
+ g_variant_get(reply, "(b)", &connectable);
+ g_variant_unref(reply);
+ }
+ g_object_unref(proxy);
+
+ BT_INFO("HID Device is %s",
+ connectable ? "Connectable" : "Non-connectable");
+
+ return connectable;
+}
+
static gboolean __authorize_request(GapAgentPrivate *agent, GDBusProxy *device,
const char *uuid)
{
GVariant *reply = NULL;
GVariant *reply_temp = NULL;
GVariant *tmp_value;
- bool enabled;
int result = BLUETOOTH_ERROR_NONE;
int request_type = BT_AGENT_EVENT_AUTHORIZE_REQUEST;
- tethering_h tethering = NULL;
BT_DBG("+");
}
/* Check completed */
+ if (!strcasecmp(uuid, HID_UUID)) {
+ gboolean is_connectable = __bt_agent_is_hid_device_connectable();
+ BT_DBG("Automatically %s authorization for HID",
+ is_connectable ? "accept" : "reject");
+ if (is_connectable == TRUE)
+ gap_agent_reply_authorize(agent, GAP_AGENT_ACCEPT, NULL);
+ else
+ gap_agent_reply_authorize(agent, GAP_AGENT_REJECT, NULL);
+ goto done;
+ }
+
if (!strcasecmp(uuid, HFP_AUDIO_GATEWAY_UUID) ||
!strcasecmp(uuid, HSP_AUDIO_GATEWAY_UUID) ||
!strcasecmp(uuid, HFP_HS_UUID) ||
!strcasecmp(uuid, HSP_HS_UUID) ||
!strcasecmp(uuid, A2DP_UUID) ||
- !strcasecmp(uuid, HID_UUID) ||
!strcasecmp(uuid, HID_DEVICE_UUID) ||
!strcasecmp(uuid, SAP_UUID_OLD) ||
!strcasecmp(uuid, SAP_UUID_NEW) ||
BT_ERR("Max connection exceeded");
goto fail;
}
- int ret;
- ret = tethering_create(&tethering);
-
- if (ret != TETHERING_ERROR_NONE) {
- BT_ERR("Fail to create tethering: %d", ret);
- goto fail;
- }
-
- enabled = tethering_is_enabled(tethering, TETHERING_TYPE_BT);
- ret = tethering_destroy(tethering);
-
- if (ret != TETHERING_ERROR_NONE)
- BT_ERR("Fail to create tethering: %d", ret);
-
- if (enabled != true) {
- BT_ERR("BT tethering is not enabled");
- goto fail;
+ if (headed_plugin_info->plugin_headed_enabled) {
+ if (headed_plugin_info->headed_plugin->bt_is_tethering_enabled() == false) {
+ BT_ERR("BT tethering is not enabled");
+ goto fail;
+ }
}
}