BLE Examples generic discover

From Technologic Systems Manuals

This simple script will scan for and print any nearby BLE devices that are detected by the BLE module on the unit.

1 Prerequisites

  • The Bluetooth device must already be set up via the device's manual's instructions (without the use of the hciconfig command!) and bluetoothd started via system as noted above.
  • Be running as root user or a user with proper permissions.

2 Running

The example can be started with:

root@tsimx28:~# bluetoothctl power on
Changing power on succeeded
root@tsimx28:~# /usr/local/lib/bluez/test/test-discovery 
    AddressType = public
    Name = ABC123
    Paired = 0
    ServicesResolved = 0
    Adapter = /org/bluez/hci0
    LegacyPairing = 0
    TxPower = 6
    Alias = ABC123
    Connected = 0
    UUIDs = ...
    RSSI = -48
    Trusted = 0
    Blocked = 0

The example will continue to run and print newly discovered devices until Ctrl+c is pressed on the terminal.