adv_monitor: Mark the device as lost on device_lost_timeout
authorManish Mandlik <mmandlik@google.com>
Wed, 22 Sep 2021 01:13:23 +0000 (18:13 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:37 +0000 (19:08 +0530)
Mark the device as lost on device_lost_timeout so that it can be found
again next time.

Verified this by adding a monitor using bluetoothctl and confirming that
the DeviceLost event is getting triggered when bt peer stops advertising
and DeviceFound event gets triggered again when the bt peer restarts the
advertising.

Reviewed-by: Yun-Hao Chung <howardchung@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/adv_monitor.c

index 4cd3627ce83dfac610432be6869a0f3c6e78d12e..925992d5ef7cb28117d71d39c94b087c47a2a38a 100644 (file)
@@ -1891,7 +1891,9 @@ static bool handle_device_lost_timeout(gpointer user_data)
        g_dbus_proxy_method_call(monitor->proxy, "DeviceLost",
                                 report_device_state_setup,
                                 NULL, dev->device, NULL);
+
        dev->lost_timer = 0;
+       dev->found = false;
 
        return FALSE;
 }