BSG-001 manual passed failed not run e2e core

22 passed 0 failed 0 not run 9 e2e 13 core

Discovering a BSG-001

Turn on the device and run bsg-001 discover to find it nearby. Discovery only listens for advertisements: it does not pair, bond, authenticate, encrypt, or connect.

Finding a device

A BSG-001 is recognised by an advertised name beginning with BLE_Gamma. Other Bluetooth devices in range are left out.

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma:1234-55

Here is the terminal session:

$ bsg-001 discover
AA:BB:CC:DD:EE:01	BLE_Gamma:1234	-55 dBm

Each line shows the address, the advertised name, and the signal strength in dBm, separated by tab characters. The address is what the other commands take to select the device. Each device has its own address, which never changes, so it can be kept and used again.

Seeing devices as they arrive

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma:1234-55

The device is printed and flushed before the scan ends, and a repeated advertisement does not print it again. You can stop the scan with Ctrl-C once you have the information you need.

When the output is no longer read

When the program reading the output stops reading, as head -n 1 does, the scan stops too.

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma:1234-55
AA:BB:CC:DD:EE:02BLE_Gamma:5678-60
AA:BB:CC:DD:EE:03BLE_Gamma:9ABC-65

If the reader stops after the first line, the scan ends at the next device it hears.

When no device is found

No Bluetooth device is advertising nearby. Here is the terminal session:

$ bsg-001 discover
No BSG-001 devices found.

Nothing is printed on standard output.

A BSG-001 that is connected to another client stops advertising, so it cannot be found until that client disconnects.

Scanning for longer

A BSG-001 advertises seldom: several seconds can pass before it is heard, and sometimes more than fifteen. So the scan lasts 20 seconds unless --timeout gives another duration in seconds.

Without --timeout, the scan lasts "20" seconds.

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma:1234-80

Here is the terminal session:

$ bsg-001 discover --timeout 30
AA:BB:CC:DD:EE:01	BLE_Gamma:1234	-80 dBm

Edge cases

Which names are recognised

Only the BLE_Gamma prefix counts: the label after it is set by the user and can be anything. A device without an advertised name is left out.

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma-50
AA:BB:CC:DD:EE:02BLE_Gamma:1234-51
AA:BB:CC:DD:EE:03BLE_GammaX-52
AA:BB:CC:DD:EE:04Headphones-53
AA:BB:CC:DD:EE:07DfuTarg-56
AA:BB:CC:DD:EE:05BSG-001-54
AA:BB:CC:DD:EE:06-55

Here is the terminal session:

$ bsg-001 discover
AA:BB:CC:DD:EE:01	BLE_Gamma	-50 dBm
AA:BB:CC:DD:EE:02	BLE_Gamma:1234	-51 dBm
AA:BB:CC:DD:EE:03	BLE_GammaX	-52 dBm

In firmware-update mode a BSG-001 advertises as DfuTarg. That is Nordic's generic bootloader name, so it cannot tell a BSG-001 from other Nordic devices and is not listed.

Unreliable advertisements

Advertised names and signal strengths come from any device in range, so they may be invalid. An invalid name or signal strength is treated as missing, and the scan carries on. A blank name cannot identify a BSG-001, and an out-of-range or absent signal strength is shown as unavailable.

In these tables, control characters in a name are written as Unicode control pictures, such as ␊ for a newline, ␡ for delete, and ␠ for a space.

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma:1234127
AA:BB:CC:DD:EE:02BLE_Gamma:5678
AA:BB:CC:DD:EE:03␠-60

Here is the terminal session:

$ bsg-001 discover
AA:BB:CC:DD:EE:01	BLE_Gamma:1234	RSSI unavailable
AA:BB:CC:DD:EE:02	BLE_Gamma:5678	RSSI unavailable
Names containing control characters

The label after BLE_Gamma: can be malformed and contain control characters. They are shown as backslash escapes, so each device stays on one line. A backslash becomes \\, a newline \n, a carriage return \r, and a tab \t. Any other control character, such as delete, becomes \x followed by two lowercase hexadecimal digits.

These Bluetooth devices are advertising nearby:

addressnameRSSI
AA:BB:CC:DD:EE:01BLE_Gamma:␊A␡B-55

Here is the terminal session:

$ bsg-001 discover
AA:BB:CC:DD:EE:01	BLE_Gamma:\nA\x7fB	-55 dBm
A device without an address

macOS does not tell the tool the address of a device: every device has an address made only of zeros there. Such an address cannot select a device, so the device is left out.

These Bluetooth devices are advertising nearby:

addressnameRSSI
00:00:00:00:00:00BLE_Gamma:1234-55
AA:BB:CC:DD:EE:02BLE_Gamma:5678-60

Here is the terminal session:

$ bsg-001 discover
AA:BB:CC:DD:EE:02	BLE_Gamma:5678	-60 dBm
A device the computer remembers from an earlier scan

The computer can remember the devices it has seen before, and report them as found at the start of every scan. A remembered device may be switched off or out of range, so being found is not enough to list it. It counts as seen only once an advertisement from it arrives during the scan. A device the computer did not remember is seen as soon as it is found. The same rule applies when a command looks for the device at its address before connecting.

Whether a device is seen depends on whether it was remembered and on what is reported during the scan.

rememberedreported during the scanseen
yesfoundno
yesfound, advertisementyes
yesadvertisementyes
nofoundyes
noadvertisementyes
nonothingno
Scan durations

The scan duration is a finite number of seconds, at least 0.1.

The tool checks each timeout and gives its verdict before scanning.

timeoutverdict
0.1valid
5valid
0.05invalid
0invalid
-1invalid
infinvalid
naninvalid

Good to know