Raspberry Pi3 BLE only accepts a single connection - bluetooth-lowenergy

I have created a BLE peripheral that exposes a GATT service. It uses BlueZ 5.50, but it seems that only one device can connect to the GATT service. When the device is connected, then other devices can't see it anymore. It's not showing up in a scan anymore and if it was already scanned, then I can't connect to it anymore.
It seems to be a limitation or configuration issue in BlueZ, because when using the Paypal GATT library it can handle multiple connections. As far as I know, the RPi3 BLE chip should be able to handle up to 10 connections.
Does anyone know if this can be done using BlueZ?

The Paypal GATT library directly connects to the HCI device and bypasses most of the kernel stuff. BlueZ depends on kernel drivers and user-space applications and is capable if the driver reports that the controller allows multiple connections. You need a decent BLE controller and a recent kernel to make it work.
More information can be found in https://github.com/bluez/bluez/issues/12.

Related

Re-enable Bluez advertising after connection, through d-bus interface

I have a BLE Gatt server, which is setup using the d-bus bluez interface (version 5.54).
Advertising is working using org.bluez.LEAdvertisingManager1 and can be viewed using a BLE scanner Android app.
Making a connection to the server stops the device from advertising, and it is no longer visible on a BLE scanner.
Disconnecting doesn't start advertising again.
I've seen the same issue described here, with a solution using hcitool commands.
Is there a way to re-enable advertising using the d-bus interface only?

How can I use mqtt to connect hono to ditto?

Is it possible to use mqtt to send data from a device (arduino in my case) to hono and then send these data to ditto via mqtt?
in my case I have arduino that send a value via mqtt to hono, but now i need the data to be received by ditto.
For the moment i have only arduino that sends data to hono via mqtt.
Eclipse Ditto can either consume messages directly from an MQTT broker using MQTT 3.1.1 or MQTT 5:
https://www.eclipse.org/ditto/connectivity-protocol-bindings-mqtt.html
https://www.eclipse.org/ditto/connectivity-protocol-bindings-mqtt5.html
Or, utilising Eclipse Hono as device connectivity layer, consume messages via Apache Kafka or AMQP 1.0 (which Hono uses for "northbound" applications ingesting telemetry data).
If you need Eclipse Hono, I suggest to have a look at the "Cloud 2 Edge" package in the Eclipse IoT Packages project which already automatically sets up and configures both Eclipse Hono and Eclipse Ditto to work with each other:
https://www.eclipse.org/packages/packages/cloud2edge/
If you only need to send data via MQTT, I would suggest to use an MQTT broker (like Eclipse Mosquitto) as this simplifies the setup a lot.
If you have requirements towards supporting multiple IoT protocols or massive scalability requirements, Eclipse Hono is a good choice.

BLE device not disconnecting

I am working with BLE devices. and using nrf controller with bluez 5.4 code.
I am customizing gatttool source code so that multiple devices can connect and disconnect.
My focus part for now is how to disconnect ble device using gatttool apis.
I had found one solution in code that we can use:
g_io_channel_shutdown();
g_io_channel_unref();
These 2 APIs are use to disconnect ble device.
I am using nrf connect application in my mobile to connect generate dummy ble device so that I can perform operations.
When I use this for disconnecting device any other formalities are needed in between or only these APIs are ok?
I am not able to disconnect using these APIs.Some time it is give effect and some time it is not working.
If any one have idea abut this please respond.
Thanks in advance.
Do you mean Bluez 5.4 or Bluez 5.40? Either way, they are quite old releases.
gatttool is one of the BlueZ tools that has been deprecated in BlueZ.
Ideally you would be using the BlueZ DBus API to interact with BlueZ.
Not sure if you are creating a GATT Server (peripheral device) or GATT client (Central Device) but there are examples of both in the BlueZ source:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-client
These examples are in Python, but most languages have DBus libraries to help access the API which are documented at:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt

Is running HM10 on a soft-serial enable the Low Energy charecteristics ? If so, how can the UUIDs and GATT profiles be tweaked in this case ?

I've been tinkering with the HM-10 board for a few weeks now, trying to push data from phone to module and vice-versa. The ultimate goal was to enable the BLE mode and tweak with the characteristics and GATT profiles. I'm pretty new to this domain so can anyone help me out ?
And is there any way we can interface the HM-10 with the hardware rx-tx channel instead of soft-serial ?
Your question is still not very clear, but i think you mean sending AT-commands over BLE-radio.
To make this possible you have to change the MODE using serial connection.
In standard mode the device can only be configured over the serial connection (pins RXD and TXD) using AT commands.
AT+MODE0: It only accepts AT-commands over the serial connection (RXD/TXD)
until a central device connects to the module.
AT+MODE1: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE and manipulate some PIO pins on
the device.
AT+MODE2: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE.
To test it just send a string to hm-10 as "AT\r\n" and it will respond with OK.
Update:
You cannot change the services and characteristics with AT-commands.
There are a lot of other things you can change,like advertising, setup a beacon and change a lot of settings.
For a full list of AT commands and more see the official data sheet:
http://www.jnhuamao.cn/bluetooth41_en.zip

BLE disconnects after BT pairing failed

Linux Raspbian Jessie Lite, Bluez 5.40.
I have a GATT server and my own agent for incoming "standard" bluetooth connections (i.e. A2DP).
I can successfully "connect" to the GATT server, but if the user doesn't accept the pairing confirmation (from the BT) I receive this error:
qt.bluetooth.bluez: Failed to create pairing "org.freedesktop.DBus.Error.NoReply"
as expected, but after a couple of seconds also the BLE connection will drop.
I wonder if it's the correct behavior. I thought the BLE and BT connections are indipendent each other.
If you are using two Bluetooth smart ready device(BR/EDR/LE), then the BLE connection would be over BR/EDR, so it is make sense that your BLE also disconnected.

Resources