Hi,all. i faced a problem:when i take my phone far away from my device,link-lost severce can work,but turn bluetooth switch off on my phone directly,my device can't alarm.What's wrong? Can someone help me?
Hi,all. i faced a problem:when i take my phone far away from my device,link-lost severce can work,but turn bluetooth switch off on my phone directly,my device can't alarm.What's wrong? Can someone help me?
Hi, I had to edit my previous answer because i misunderstood the question the first time.
I am guessing that the link-loss is due to peer out of range or non responsive in that case you will get
p_ble_evt->evt.gap_evt.params.disconnected.reason = BLE_HCI_CONNECTION_TIMEOUT (0x08)
if it is proper disconnect then
p_ble_evt->evt.gap_evt.params.disconnected.reason = BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION(0x13)
Thanks ,Aryan!There is a new problem:When i turned off bluetooth switch on my phone directly,my device alarmed on ios platform and not alarmed on android.Can you help me?
what do you man by alamed on and not alaramed on?
Under the same condition,my device's behavior is deffernce.it can alarm on ios platform,can't alarm on android platform.Thanks again.
that probably just means that iOS and android do something different when you turn off bluetooth. If android closes down the connections before it shuts the bluetooth chip down then you won't see a link loss, you'll see a disconnection, if iOS just turns the bluetooth chip off, then the link will time out and you'll see the link loss.
Put a packet sniffer on to see what's happening.