Я пытаюсь наладить связь между устройством Android и устройством Linux через Bluetooth. После регистрации профиля в bluez через DBUS с помощью этого кода:
bus = dbus.SystemBus()
bluezObj = bus.get_object(BUS_NAME, "/org/bluez")
profilePath = "/test/profile"
profile = Profile(bus, profilePath)
profileManager = dbus.Interface(bluezObj, "org.bluez.ProfileManager1")
profileManager.RegisterProfile(profile, uuid, dbus.Dictionary({
"name": "EntireData Hardware Interface",
"Service": uuid,
"Role": "server"
}, signature="sv"))
loop = GLib.MainLoop()
loop.run()
После этого я могу увидеть uuid профиля, запустив bluetoothctl
и введя show
:
[bluetooth]# show
Controller B8:27:EB:6C:B7:E5
Class: 0x000100
Modalias: usb:v1D6Bp0246d052B
...
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (94f39d29-7d6d-437d-973b-fba39e49d4ee)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
Однако при попытке запросить UUID с устройства Android отображаются не все из них:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
final Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
for(BluetoothDevice device : pairedDevices) {
ParcelUuid[] uuids = device.getUuids();
for(ParcelUuid uuid : uuids) {
Log.d(TAG, "Found UUID: "+uuid);
}
}
В логах показывает только это:
Found UUID: 0000110e-0000-1000-8000-00805f9b34fb
Found UUID: 00000000-0000-1000-8000-00805f9b34fb
Found UUID: eed4499e-a3fb-3b97-7d43-6d7d299df394
Но не показывает пользовательский, который я добавил, и ошибки, если я пытаюсь подключиться к нему. Как подключиться к пользовательскому профилю/сервису?