LEAdvertisingManager1 is missing from DBus.ObjectManager.GetManagedObjects

I run tests with my home computer running Ubuntu and Python 2.7 in the hope that the Raspberry Pi 3 advertises the use of BLE with user services and features. I installed Bluez version 5.42 (using the recommended method) on both devices, as well as on dbus-python. My computer and Raspberry Pi can advertise using the command hci0 lescan 0, but I would like to advertise the bluez example scripts, example-gatt-client.py and example-advertisement.py found here , since I want to use my own custom characteristics.

Home computer - kernel version 4.4.0-31 general

I can create custom features and ads by running example-gatt-server.py and example-advertise.py without any problems on my home computer. The only thing I had was that I needed to turn on the Bluez experiment mode by adding --experimentalto the bluetooth.service file located at /lib/systemd/system/bluetooth.service. In addition, installing the dbus-python library was a bit painful since I had to install it myself and install it for Python2.

The script commercial is looking for a specific advertising interface called "org.bluez.LEAdvertisingManager1". The gatt-server.py script is looking for "org.bluez.GattManager1". I can check if this interface exists by running the following command:

dbus-send --system --dest=org.bluez --print-reply / org.freedesktop.DBus.ObjectManager.GetManagedObjects

These interfaces are found and work fine on my home computer. Scripts run without problems.

Pi - 4.4.38-v7 +

bluez advert.py:

LEAdvertisingManager1 .

"statusctl status bluetooth", , , LEAdvertistingManager1 .

dbus-send --system --dest=org.bluez --print-reply / org.freedesktop.DBus.ObjectManager.GetManagedObjects

gatt-server.py script , , "org.bluez.GattManager1" . ?

, , , ​​ >= 4.1.

+4
2

! bluez , bluez Pi. bluez raspbian.

sudo apt-get update 
sudo apt-get upgrade 
mkdir bluez 
cd bluez 
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.43.tar.xz 
tar xvf bluez-5.43.tar.xz 
cd bluez-5.43/ 
sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev 
./configure 
sudo make 
sudo make install

. Bluez v5.23, .

cd
sudo nano /lib/systemd/system/bluetooth.service

- "ExecStart =/usr/local/libexec/bluetooth/bluetoothd"

ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental

bluetooth

sudo systemctl daemon-reload 
sudo systemctl restart bluetooth

, :

sudo hciconfig hci0 up
sudo hciconfig hcio leadv 0

Pi3 "raspberrypi", BLE ( LiteBlue iOS), .

, LEAdvertisingManager1,

dbus-send --system --dest=org.bluez --print-reply / org.freedesktop.DBus.ObjectManager.GetManagedObjects

, . . , , .

cd bluez/bluez-5.43/tests

dbus-python :

sudo apt-get install python-dev libdbus-1-dev libdbus-glib-1-dev 
sudo apt-get install python-pip 
sudo apt-get install --reinstall python-gi
sudo python2.7 -m pip install dbus-python

- script python2.7 ( ), -

import gobject

from gi.repository import GObject as gobject

, example-gatt-, .

, iPhone Pi3 . bluetooth.

sudo systemctl daemon-reload 
sudo systemctl restart bluetooth

!

+9

Bluetoothctl Bluez, Bluetoothd 5.23, . , pi-bluetooth 5.23 . Blueoothd ? , . 5.23.

pi @raspberrypi: ~/bluez-5.37 $bluetoothd -v 5,23 pi @raspberrypi: ~/bluez-5.37 $bluetoothctl -v 5,37

+1

Source: https://habr.com/ru/post/1665037/


All Articles