#include <aul.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus.h>
-
#include <bundle.h>
-#if 0
#include <eventsystem.h>
-#endif
#include <bundle_internal.h>
#include "alarm.h"
visible_timer.timeout = timeout;
- if (timeout <= 0)
- return BLUETOOTH_ERROR_NONE;
-
#ifndef TIZEN_WEARABLE
if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
BT_ERR("Set vconf failed");
#endif
+ if (timeout <= 0)
+ return BLUETOOTH_ERROR_NONE;
+
if (!visible_timer.alarm_init) {
/* Set Alarm timer to switch off BT */
result = alarmmgr_init("bt-service");
if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
BT_ERR("Set vconf failed");
}
+ } else {
+ if (_bt_set_discoverable_mode(
+ BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE,
+ timeout) != BLUETOOTH_ERROR_NONE) {
+ BT_ERR("Set connectable mode failed");
+ }
}
}
#endif
ret_pm_ignore = vconf_get_int(VCONFKEY_PM_KEY_IGNORE, &pm_ignore_mode);
/* Update the vconf BT status in normal Deactivation case only */
-
-#if 0
if (ret == 0 && power_off_status == VCONFKEY_SYSMAN_POWER_OFF_NONE &&
ret_pm_ignore == 0 && pm_ignore_mode != VCONFKEY_PM_KEY_LOCK) {
-#endif
+
BT_DBG("Update vconf for BT normal Deactivation");
if (result == BLUETOOTH_ERROR_TIMEOUT)
/* Update Bluetooth Status to notify other modules */
if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_OFF) != 0)
BT_ERR("Set vconf failed");
-#if 0
+
if (_bt_eventsystem_set_value(SYS_EVENT_BT_STATE, EVT_KEY_BT_STATE,
EVT_VAL_BT_OFF) != ES_R_OK)
BT_ERR("Fail to set value");
-#endif
-//
+ }
if (vconf_set_int(VCONFKEY_BT_DEVICE, VCONFKEY_BT_DEVICE_NONE) != 0)
BT_ERR("Set vconf failed\n");
if (vconf_set_int(VCONFKEY_BT_LE_STATUS, VCONFKEY_BT_LE_STATUS_ON) != 0)
BT_ERR("Set vconf failed\n");
-#if 0
if (_bt_eventsystem_set_value(SYS_EVENT_BT_STATE, EVT_KEY_BT_LE_STATE,
EVT_VAL_BT_LE_ON) != ES_R_OK)
BT_ERR("Fail to set value");
-#endif
/* Send enabled event to API */
/*
/* Update Bluetooth Status to notify other modules */
BT_DBG("Update vconf for BT LE normal Deactivation");
-
if (vconf_set_int(VCONFKEY_BT_LE_STATUS, VCONFKEY_BT_LE_STATUS_OFF) != 0)
BT_ERR("Set vconf failed\n");
_bt_adapter_set_le_status(BT_LE_DEACTIVATED);
-#if 0
+
if (_bt_eventsystem_set_value(SYS_EVENT_BT_STATE, EVT_KEY_BT_LE_STATE,
EVT_VAL_BT_LE_OFF) != ES_R_OK)
BT_ERR("Fail to set value");
-#endif
- if (_bt_adapter_get_status() != BT_DEACTIVATED) {
- /* Send disabled event */
- _bt_send_event(BT_LE_ADAPTER_EVENT, BLUETOOTH_EVENT_LE_DISABLED,
- g_variant_new_int32(result));
- }
+ /* Send disabled event */
+ _bt_send_event(BT_LE_ADAPTER_EVENT, BLUETOOTH_EVENT_LE_DISABLED,
+ g_variant_new_int32(result));
}
void *_bt_get_adapter_agent(void)
if (ret < 0)
BT_ERR("Unable to register key handler");
- if (le_status == BT_LE_ACTIVATING) {
+ if (le_status == BT_LE_ACTIVATING ||
+ status == BT_ACTIVATING) {
__bt_set_le_enabled();
_bt_adapter_set_le_status(BT_LE_ACTIVATED);
}
+
if (status == BT_ACTIVATING) {
__bt_set_enabled();
_bt_adapter_set_status(BT_ACTIVATED);
#endif
_bt_service_register_vconf_handler();
-#if 0
+
/* eventsystem */
if (eventsystem_register_event(SYS_EVENT_BT_STATE, &status_reg_id,
(eventsystem_handler)__bt_state_event_handler, NULL) != ES_R_OK) {
BT_ERR("Fail to register system event");
}
-#endif
}
void _bt_handle_adapter_removed(void)
adapter_agent = NULL;
_bt_reliable_terminate_service(NULL);
-#if 0
+
if (eventsystem_unregister_event(status_reg_id) != ES_R_OK) {
BT_ERR("Fail to unregister system event");
}
-#endif
}
}
g_variant_unref(result);
-
_bt_set_disabled(BLUETOOTH_ERROR_TIMEOUT);
_bt_terminate_service(NULL);
}
g_variant_unref(result);
-
_bt_adapter_set_le_status(BT_LE_DEACTIVATED);
_bt_set_le_disabled(BLUETOOTH_ERROR_TIMEOUT);
return;
}
-static gboolean __bt_adapter_enabled_cb(gpointer user_data)
-{
- BT_DBG("+");
-
- __bt_set_enabled();
- _bt_adapter_set_status(BT_ACTIVATED);
-
- return FALSE;
-}
-
-
int _bt_enable_adapter(void)
{
GDBusProxy *proxy;
return BLUETOOTH_ERROR_INTERNAL;
}
g_variant_unref(result);
-
if (le_status == BT_LE_ACTIVATED) {
__bt_set_enabled();
} else {
}
g_variant_unref(result);
-
return BLUETOOTH_ERROR_NONE;
}
}
g_variant_unref(result);
-
_bt_set_le_disabled(BLUETOOTH_ERROR_NONE);
BT_DBG("le status : %d", _bt_adapter_get_le_status());
BT_DBG("-");
int ret = BLUETOOTH_ERROR_NONE;
GVariant *result;
GVariant *value;
- GVariantIter *iter;
+ GVariantIter *iter = NULL;
gchar *uuid;
BT_DBG("+");
g_variant_get(result, "(v)", &value);
g_variant_get(value, "as", &iter);
-
- if (iter == NULL) {
+ if(iter == NULL) {
BT_ERR("Failed to get UUIDs(%s)",service_uuid);
*used = FALSE;
g_variant_unref(result);
g_clear_error(&error);
} else
BT_ERR("Failed to get Discoverable property");
- return FALSE;
+ return BLUETOOTH_ERROR_INTERNAL;
}
g_variant_get(result, "(v)", &temp);
return BLUETOOTH_ERROR_NONE;
}
-
-int _bt_get_enable_timer_id(void)
-{
- return timer_id;
-}