BLE Scanner Library is a tool to monitor BLE device advertisements and gain access to BLE characteristics. Most useful of these is the device name. BLE devices have either a short or a long name assigned, and they can be identified in the scan lists with those names.
Below images show how a BLE scan displays the device names and MAC addresses in an Android BLE Scanner App, as well as device names in the Android BLE Settings internal scan.
To make the library use easier to understand, we have provided a BLE Scanner Demo program in the Network Examples.
There is also an enhanced version of that example below, where all the library fields are used.
ble-scanner/
This block is used to detect BLE advertisements. When a scan is detected, variable will be populated with all the relevant BLE information. All the other blocks in the library extract parts of the BLE information from the contents of this variable.
RSSI stands for Received Signal Strength Indicator. It is the strength of the beacon's signal as seen on the receiving device, e.g. a smartphone. The signal strength depends on distance and Broadcasting Power value. At maximum Broadcasting Power (+4 dBm) the RSSI ranges from -26 (a few inches) to -100 (40-50 m distance).
This information can be used to calculate the distance of the broadcasting device from the detecting device. An example of that can be seen in the picture at the top of this section, where the BLE Scanner App displays actual distances of the detected devices.
A Bluetooth address, sometimes referred to as a Bluetooth MAC address, is a 48-bit value that uniquely identifies a Bluetooth device.
A Public Device Address is a globally unique 48-bit identifier, which consists of two fields:
The 24 most significant bits are called the Organizational Unique Identifier, and its purpose is to identify each company. It is administered by the IEEE Registration Authority.
The 24 least significant bits are assigned by the company, and they serve the purpose of identifying each device.
There are two main types of Bluetooth addresses: public and random addresses.
A Bluetooth Public address is a global fixed address that must be registered with the IEEE. This address never changes and is guaranteed to be unique for a Bluetooth device.
Random addresses are more popular than Public addresses since they do not require registration with the IEEE. A Random address is an identifier that’s either:
Random Static Address
This specific type of Bluetooth address serves as a popular alternative to Public addresses since there are no fees involved with using it.
Random Static Addresses can be used in one of two ways:
A Random Device Address is a privacy feature of the BLE protocol, and it helps to prevent tracking of a device.
Since it would be quite difficult for a user to identify a device using only its BLE Address, BLE provides the Device Name property, which is a human-friendly name used to tag a device.
BLE specifications define device name as a 20 byte field. However due to packet length limitations, often a shorter name might need to be used.
There are two name types for BLE:
This block is used internally to scan the BLE packet to see if it contains a name of desired type.
This program is based on the example program provided in the File/Open/Examples/Network/BLE Scanner Demo. It has been enhanced to display all the information found in the advertising packet, as well as a list of all detected devices at the end.
Download Link: BLEScanner Demo Enhanced