Are BLE-enabled devices discoverable by default?

自作多情 提交于 2021-02-08 10:13:06

问题


I am looking to do something similar to this question, based on the answer it suggests that devices are only discoverable if they are emitting packets of information.

What I would like to understand is, do devices like mobile phones (iOS/Android) send these discoverable packets by default? Or would they need to be configured (e.g. via an app) to explicitly advertise themselves or some bits of data?


回答1:


No, they are not discoverable by default.

Vol 3 of the Bluetooth 4.x spec defines two discoverable modes:

  • 9.2.3 - Limited Discoverable Mode

The limited discoverable mode is typically used when a user performs a specific action to make the device discoverable for a limited period of time.

  • 9.2.4 - General Discoverable Mode

The general discoverable mode is typically used when the device is intending to be discoverable for a long period of time.

A good BLE design will be to have the device dormant indefinitely to conserve battery power until some action is required. It is entirely up to the designer to decide when to advertise, for how long, and at what interval. You can have it button activated or active immediately from boot.

However, if your device has no user interface and no way of being manually activated (such as a broadcasting sensor node) then it would seem that you have no choice but to use General Discoverable Mode, and advertise continuously. You will have to choose an advertising interval which is the best compromise between conserving power and being discoverable.

It is also possible to have recurring windows of Limited Discoverable Mode.

The Laird module I'm using has this in an app note:

Because BLE is designed to save power, the device is typically dormant until action is required.

I have also found this quote:

A large number of BLE products sleep most of the time, waking up only to advertise and connect when needed. This means advertisements have a big impact on power consumption.

And to answer the 2nd part of your question, If a device isn't advertising, it's impossible for any Central to connect to it.

Now, with all that said. A lot of devices do advertise all the time from the moment the batteries are installed. As an example, devices compatible with Apple iBeacon will advertise continuously at 100ms interval until the batteries die. An interesting introduction to the topic of advertising interval vs battery life is given here.




回答2:


This strongly depends on the nature of the device.

Mobile phones, Tables

First of all not all mobile phones can advertise at all. Newer ones can. For example, Android 5.0 got the ability to advertise. Earlier versions could be only central or observer.
Those that can advertise don't advertise by default. Advertising has to be enabled from an app.

Beacons

Beacons, on the other hand advertise by default. They advertise all the time. Broadcasting advertisement is all they do.



来源:https://stackoverflow.com/questions/34519357/are-ble-enabled-devices-discoverable-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!