November-7th-2017, 08:44 AM
Hi Armin,
I started with the netpi-raspbian image. I shared the file /var/run/dbus/system_bus_socket and use the host network in the container and started the container in privileged mode so I can connect to the bluetoothd running on the host via dbus.
Then I built the bluez-5.41 from source to match the bluez version with the one of bluetoothd running on the host.
> cd bluez_source_dir
> ./configure
> ./make
There should be a file called bluez_sorce_dir/client/bluetoothctl which also uses the bluez dbus-API as I want to used from my own application. You have to start it as root.
After powering on the bluetooth adapter
> [bluetooth]# power on
scanning for bluetooth devices
> [bluetooth]# scan on
> [NEW] Device B0:91:22:68:27:01 Name: XXX
and connecting to a bluetooth device
> [bluetooth]# connect B0:91:22:68:27:01
there should appear a list of GATT characteristics depending on the bluetooth device.
Something like this:
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d271100-f0d4-469d-afd3-605a6ebbdb13
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d27fa01-f0d4-469d-afd3-605a6ebbdb13
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d27fa60-f0d4-469d-afd3-605a6ebbdb13
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d27ffc0-f0d4-469d-afd3-605a6ebbdb13
[NEW] Service /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010 Vendor specific (Primary)
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0011 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0013 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0015 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0017 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0019 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char001b Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char001d Vendor specific
...
You can test with a fitness-tracker or another bluetooth peripheral using GATT. Or you could use an android phone. To start a GATT server and start advertising you can use the nRF Connect for Mobile app.
With bluez-5.41 the GATT-DBUS API is still experimental and the Characteristics are not discovered because you have to compile and run the bluetoothd with experimental features enabled. I expect it to work with bluez version >= 5.43 since this feature is no longer experimental from this point. I would prefer version 5.47 because the release notes state some fixes for GATT until there.
Regards
Thomas
I started with the netpi-raspbian image. I shared the file /var/run/dbus/system_bus_socket and use the host network in the container and started the container in privileged mode so I can connect to the bluetoothd running on the host via dbus.
Then I built the bluez-5.41 from source to match the bluez version with the one of bluetoothd running on the host.
> cd bluez_source_dir
> ./configure
> ./make
There should be a file called bluez_sorce_dir/client/bluetoothctl which also uses the bluez dbus-API as I want to used from my own application. You have to start it as root.
After powering on the bluetooth adapter
> [bluetooth]# power on
scanning for bluetooth devices
> [bluetooth]# scan on
> [NEW] Device B0:91:22:68:27:01 Name: XXX
and connecting to a bluetooth device
> [bluetooth]# connect B0:91:22:68:27:01
there should appear a list of GATT characteristics depending on the bluetooth device.
Something like this:
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d271100-f0d4-469d-afd3-605a6ebbdb13
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d27fa01-f0d4-469d-afd3-605a6ebbdb13
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d27fa60-f0d4-469d-afd3-605a6ebbdb13
[CHG] Device 5C:31:3E:71:0C:E7 UUIDs: 0d27ffc0-f0d4-469d-afd3-605a6ebbdb13
[NEW] Service /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010 Vendor specific (Primary)
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0011 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0013 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0015 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0017 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char0019 Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char001b Vendor specific
[NEW] Characteristic /org/bluez/hci0/dev_5C_31_3E_71_0C_E7/service0010/char001d Vendor specific
...
You can test with a fitness-tracker or another bluetooth peripheral using GATT. Or you could use an android phone. To start a GATT server and start advertising you can use the nRF Connect for Mobile app.
With bluez-5.41 the GATT-DBUS API is still experimental and the Characteristics are not discovered because you have to compile and run the bluetoothd with experimental features enabled. I expect it to work with bluez version >= 5.43 since this feature is no longer experimental from this point. I would prefer version 5.47 because the release notes state some fixes for GATT until there.
Regards
Thomas