update local gatt characteristic value using bluetoothctl - linux

I have set up a gatt Server on an raspberry pi using bluetoothctl and BlueZ 5.50 (according to this thread: BlueZ: How to set up a GATT server from the command line)
I can connect to the gatt server from an other machine and also read the given value. Now I want to try notify.
The subscription works fine, but how do I update the value on the local gatt server? I can't use select-attribute because my local services an characteristics do not show up in the list that appears when using autocomplete.
Would be nice if someone can help me with this problem.

I too faced the same prob and i found solution for the same.
i am using bluez5.49. whenever notify was enabled in client, notify_io will be created and pipe will be established.
so if you write data in pipe fd, then it will be notified to client.

Related

How to allow only 1 connection to BlueZ GATT server at any given moment?

I'm working on Bluetooth on the embedded Linux. I'm using BlueZ and D-Bus. I have a server taken from the example https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server.
I have the app such as nRF installed in 2 iPhones. I'm able to connect to my Linux Bluetooth server at the same time. I'm able to modify the characteristic from either of the iPhone app. But this is a problem because we don't want it. We'd like to have only 1 phone connected to the Linux device. That way, the same characteristic won't be modified by more than 1 phone app at the same time.
Is there a way to allow only 1 connection to the Linux Bluetooth GATT server at any given time?
Thanks.
Yes, the way to do this is to disable/stop advertisements on your Linux device as soon as a connection is established. This way, upon a connection, your Linux device will no longer be advertising and remote devices will no longer be able to connect to it.

beaglebone black wireless bluetooth AVRCP

I am working on a project with the beagle bone black wireless, where I need to be able to send music control commands to a phone. Note, I don't want to stream music to my beaglebone. I have spent about a week looking online, and found very little about this.
The OS for the beaglebone is Debian Jessie. I can get things like hci0tool, Bluetoothctl, hciconfig to work. I can detect and pair to a device. It seems though that my connection only lasts for the pairing process, and fails every time afterwards.
My current process is executing:
sudo su
bluetoothctl
power on
agent on
default-agent
scan on
I get the mac address
scan off
pair <MAC Address>
trust <MAC Address>
connect <MAC Address>
As of now pairing and trust succeed, though the connection ends after pairing finishes. And I have no idea of where to start for sending a command to a phone.
Connect call on Device1 interface will tries to connect all the profiles supported between the device and adapter. This happens by negotiating or exchanging the supported profiles.
Connection may not be possible when Adapter doesn't support the minimal requirement of profiles which is needed by the Device. In this case, you may need A2DP provider in adapter end to get connection successful. Yes, this is contradictory to this statement.
If you don't want to connect with all the profiles between Device and Adapter, then you can use ConnectProfile method in Device1 interface.
But bluetoothctl doesn't provide commands to achieve neither ConnectProfile nor you AVRCP commands.
You need to use D-Bus calls to get the communication with Bluetoothd. If your application is command line/shell based, you can use dbus-send/gdbus commands to address the D-Bus interface.
Although bluez-tools implements media control AVRCP commands, it doesn't provide any utility which uses it. Either you can compile bluez-tools as library and develop application using the media control API or use dbus-send/gdbus.
I have started with some samples using GDBUS, but not yet for AVRCP controls. See here : https://gist.github.com/parthitce
and Documentation here: https://www.linumiz.com/category/blog/

BLE GAP Profle through GATT on Linux

I am working on BLE using BlueZ-4.101 stack,i have been able to port all the necessary binaries,and able to connect two devices.
I am creating connection using command:
gatttool -i hci0 -b -I
connect
i.e opening the interactive mode and connect through it.
When I try to discover primary services of the other connected device , it shows
Discover all primary services failed: A timeout Occured
Where I am going wrong ,can anyone point out ? How can we check primary services of our own device ?
Actually Device Information Service has to be implemented with this stack,can anyone list out the steps on this?
You can try pairing to the remote device before connecting to it through gatttool.
For pairing you can use simple-agent or bt-device utilities.
To implement the DIS, you can look how the GATT and GAP are implemented, similar way you can add the attributes and handles for the DIS characteristics.
I hope it will be helpful.

communication between bluetooth module and remote Human interface device

I have been using bluetooth module BC 417 of company "NOVA".
I have kept all UART setting as suggested by datasheet.
i.e. buad rate=9600, parity=none, stop bit=1
My connection is getting established with nokia 5130 bluetooth, but as soon as m going to send something from UART connection is disabled.
Whenever i go to connect this module to android phone's bluetooth, connection does not take place.
For making connection i am using this command BC:CS=<address of bluetooth>
So i have following question:-
Is there any another setting is required in hyper terminal?
Is there any firmware is available for nova comm control interface module version 1.2?
Sorry, I only have enough reputation to answer and not just comment. You might want to try making sure that hardware flow control is switched on. It's a little difficult to know for sure as details of your set-up are so sketchy. Are you connecting this to an embedded micro and then trying to connect to a phone? What are you connecting hyper terminal to? Another phone or this Nova module?

Bluetooth connection close itself right after start

my problem is the connection with a Bluetooth device. I have a Netbook with an integrated bluetooth device. I want to connect my netbook with an OBD-II interface and write a software to read out the stats of my car. To test the connection, I started by adding the OBD device via the bluetooth menu. The manager connects to the interface and it wants me to wait while the configurations are taking place. This state lasts "forever". After 60-Minutes of waiting, I closed the window. However, the device is shown in the list of available devices. Because I'm not able to switch the button to initiate the connection, I thought about using minicom (the OBD-II interface uses SPP for communicating).
As far as I did understand, I need an initiated connection with a bluetooth device and with it a virtual serial port to connect to with minicom. After reading some postings, I found out that the hcitool should be able to create the bluetooth session. With this I was able to connect to the device and the "connected" button turned on. Unfortunately it switches back after 2 secs.
hcitool scan is able to find the device
hcitool cc 00:11:22:33:44:55 is able to connect for the already mentioned 2 secs
hcitool con list the connection if it's called within 2 sec after initiating
I also tried to connect via a Windows PC using putty. Windows connected with the device without a problem and after that, I was able to send requests and get the appropriate answers. So it seems like the interface is working correctly.
I'm using Fedora 17 with gnome3. If you need any output or more information, please let me know.
Thanks in advance

Resources