[Problem] There are some logic error regarding Discoverable property
changed event.
1. When limited discoverable mode is not allowed and general
discoverable is set, general discoverable is requested again.
2. When limited discoverable mode and discoverable mode are both not
allowed, it tries to set general discoverable mode.
3. DiscoverableTimeout property is not updated.
[Cause & Measure] 1. Check current discoverable mode and only if it is
in limited discoverable mode and limited discoverable mode is not
allowed, set to general discoverable mode.
2. After handling discoverable mode policy, don't check limited
discoverable mode policy.
3. Use proper type to set DiscoverableTimeout property.
[Checking Method] Code review
Change-Id: I3246ab7019c5415e799e448ce4115103211f4e6c
if (discoverable == FALSE) {
if (_bt_get_discoverable_timeout_property() > 0) {
if (discoverable == FALSE) {
if (_bt_get_discoverable_timeout_property() > 0) {
+ unsigned int time = 0;
+
adapter_proxy = _bt_get_adapter_properties_proxy();
if (adapter_proxy == NULL)
continue;
adapter_proxy = _bt_get_adapter_properties_proxy();
if (adapter_proxy == NULL)
continue;
ret = g_dbus_proxy_call_sync(adapter_proxy, "Set",
g_variant_new("(ssv)", BT_ADAPTER_INTERFACE,
"DiscoverableTimeout",
ret = g_dbus_proxy_call_sync(adapter_proxy, "Set",
g_variant_new("(ssv)", BT_ADAPTER_INTERFACE,
"DiscoverableTimeout",
- g_variant_new("i", time)),
+ g_variant_new("u", time)),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT, NULL,
&err);
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT, NULL,
&err);
- BT_ERR("StopLEDiscovery Failed: %s", err->message);
- g_error_free(err);
+ BT_ERR("Set DiscoverableTimeout Failed: %s", err->message);
+ g_clear_error(&err);
}
if (ret)
g_variant_unref(ret);
}
if (ret)
g_variant_unref(ret);
mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
/* Send event to application */
mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
/* Send event to application */
- BT_INFO("[Connectable]");
+ BT_INFO("[Non Discoverable]");
param = g_variant_new("(in)", result, mode);
_bt_send_event(BT_ADAPTER_EVENT,
BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
param = g_variant_new("(in)", result, mode);
_bt_send_event(BT_ADAPTER_EVENT,
BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
/* Send event to application */
BT_INFO("[Limited Discoverable (Timeout %u secs)]",
/* Send event to application */
BT_INFO("[Limited Discoverable (Timeout %u secs)]",
- _bt_get_discoverable_timeout_property());
+ _bt_get_discoverable_timeout_property());
param = g_variant_new("(in)", result, mode);
_bt_send_event(BT_ADAPTER_EVENT,
param = g_variant_new("(in)", result, mode);
_bt_send_event(BT_ADAPTER_EVENT,
- BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
- param);
+ BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
+ param);
} else if (strcasecmp(property, "Powered") == 0) {
/* TODO: Need to check this operation!! */
gboolean powered = FALSE;
} else if (strcasecmp(property, "Powered") == 0) {
/* TODO: Need to check this operation!! */
gboolean powered = FALSE;