I like to use a RaspberryPi to act as HeartRate Sensor and transmit these data via BLTH to other Health/Sport-Apps.
Finally all is working fine with python and bluez I'm able to create a BLTH GATT Server and advertise HR-Data via Service 0x180d.
The last problem is I'm not able to change the Appearance of the BLTH in Generic Access (0x1800). Apprearance is to find here with UUID: 0x2A01.
I tryed to do this the manual way via bluetoothctl:
menu advertise
appearance 833 (for HeartRate)
appearance on
back
advertise on
This will fail with: Failed to register advertisement: org.bluez.Error.Failed
nevermind to which value i change the apperance (also if the value is well known and accepted) it fail the advertisement.
If i switch appearance off it will start advertisment.
Any hint, what do to or what I just missed?
I already updated bluez from 5.50 to 5.54
also used bluez in experimental mode
and using newest raspian os with all updates
Many thanks for help
These are the steps that I used on my Raspberry Pi:
pi#raspberrypi:~ $ bluetoothctl
[bluetooth]# menu advertise
[bluetooth]# clear
[bluetooth]# uuids 0x180D
[bluetooth]# appearance 833
[bluetooth]# name heart_test
[bluetooth]# discoverable on
[bluetooth]# back
[bluetooth]# advertise on
[CHG] Controller 00:02:5B:03:44:07 SupportedInstances: 0x04
[CHG] Controller 00:02:5B:03:44:07 ActiveInstances: 0x01
Advertising object registered
UUID: Heart Rate(0x180D)
Tx Power: off
LocalName: heart_test
Appearance: Heart Rate Belt (0x0341)
Discoverable: on
[bluetooth]#
And it gave me this on me this in the nRF app when I scanned for it:
Related
I'm using bluetoothctl 5.53 to scan for BLE advertisement. Initially, I tried bluetoothctl scan on but I'm not seeing the device advertising. I scanned with the nRfConnect app and was able to verify that the device is indeed advertising. Just not seeing it with the bluetoothctl.
After some searches, I found the following setting allows me to discover the advertising BLE device:
$bluetoothctl
[bluetooth]# menu scan
[bluetooth]# transport le
[bluetooth]# scan on
After looking through the bluez documentation, I saw this and it suggested the default bluetoothctl should be able to discover BLE devices:
string Transport (Default "auto")
Transport parameter determines the type of
scan.
Possible values:
"auto" - interleaved scan
"bredr" - BR/EDR inquiry
"le" - LE scan only
If "le" or "bredr" Transport is requested,
and the controller doesn't support it,
org.bluez.Error.Failed error will be returned.
If "auto" transport is requested, scan will use
LE, BREDR, or both, depending on what's
currently enabled on the controller.
Doc here: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt#n95
However, this StackOverflow post suggests that the default filter might blocking me from seeing a lot of advertising devices: How to use bluetoothctl like hcitool lescan to report repeated proximity beacons
I also ran this to clear the filter setting, but I'm still not seeing any BLE devices
$bluetoothctl
[bluetooth]# menu scan
[bluetooth]# clear
[bluetooth]# back
[bluetooth]# scan on
So my question is:
why am I not seeing BLE device advertising with just bluetoothctl scan on?
is there a way to set the transport le permanently? So that everytime I do bluetoothctl scan on it looks for BLE devices?
I am trying to pair device using bash script. I want to do it automatically without prompting user to enter PIN.
I tried this over stdin:
echo 1234 |bluetoothctl pair XX:XX:XX:XX:XX:XX
And this as parameter:
bluetoothctl pair XX:XX:XX:XX:XX:XX 1234
But nothing worked.
I need to provide pin because i am trying to pair with HC-05 module.
Or is there some alternative to bluetoothctl on raspberry pi OS, that can do what I want?
You can try to overcome this by changing the IO capability on your device so that you don't even get a prompt in the first place. You have two options when launching bluetoothctl:-
bluetoothctl --agent DisplayOnly
bluetoothctl --agent NoInputNoOutput
This will make it so that when pairing, the remote device will know that you don't even have the capability to do any inputting on your device, and therefore the prompt will switch to the remote device or to JustWorks pairing if the other device has no input capability as well.
Have a look at the links below for more information:-
Raspberry BLE encryption/pairing
Linux command line how to accept pairing without pin
BLE pairing the Raspberry Pi 3B model
Bluetoothctl set passkey
Automatically accept Bluetooth pairings
I have an embedded Linux board running a Yocto Linux image containing BlueZ.
I want to activate the HCI bluetooth device advertising mode and disable the pairing security.
I want to scan for the device with my smartphone and connect directly without security PI, just like any Audio device (JBL, ...).
I tried many methods using (bluetoothctl and other tools) but without success.
Is there a way to achieve this?
Thanks in advance,
Talel
Set IOCapability of your device to NoInputNoOutput then pairing will happen but it won't ask for any confirmation similar to BT headsets.
bluetoothctl command line tool has option to set IOCapability. Set capability and check.
$bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent NoInputNoOutput
Agent registered
I have done pairing of Intel Edison with HC-05 but whenever I try to connect Edison with HC-05 I got this.
[bluetooth]# connect xx:xx:xx:xx:xx:xx
Attempting to connect to xx:xx:xx:xx:xx
[CHG] Device xx:xx:xx:xx:xx Connected: Yes
Failed to connect: org.bluez.ErrorNotAvailable
[CHG] Device xx:xx:xx:xx:xx Connected: No
[bluetooth]#
How to establish a stable connection?
It seems that new Edison firmware has some bluetooth problems. I could not establish a connection using bluetooth. I even used Andorid apps such as "Bluetooth spp pro" but no luck with that one either.
Eventually, I used an older version of firmware and this time, surprisingly, it worked but it took me two days to figure it out!
So, for now, the thing you can do is installing (flashing) an older version of the firmware and using that. However, I think it is not possible to do that using that wizard thing and you should do it manually.
I am using BeagleBone Black and Bluetooth USB dongle V4.0. My dongle is detecting iBeacons with no problems but is there any way to detect mobile phones with bluetooth on. I am using NodeJs and Noble package.
So when I use hcitool lescan it's not finding mobile phone either but with hcitool there is option scan. When I call hcitool scan in terminal I get my mobile as result. Is there any NodeJs package that wraps this option. I have no need to connect to mobile device, I just need to discover it's presence, and see it's MAC address.
If you can see your device with "hcitool scan" and not with "hcitool lescan" it means your phone(or BT stack you use in phone) don't support BLE protocol. Not all BT devices are BLE capable.