Home Android to Linux Bluetooth not finding all UUIDs
Reply: 0

Android to Linux Bluetooth not finding all UUIDs

user2175 Published in July 17, 2018, 11:26 pm

I'm trying to get communications working between an Android device and a Linux device over Bluetooth. After registering a profile with bluez over DBUS using this code:

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()

After this, I can see the uuid of the profile by running bluetoothctl and entering 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)

However trying to query the UUIDs from the Android device, not all of them are displayed:

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);

Only shows this in the logs:

Found UUID: 0000110e-0000-1000-8000-00805f9b34fb
Found UUID: 00000000-0000-1000-8000-00805f9b34fb
Found UUID: eed4499e-a3fb-3b97-7d43-6d7d299df394

But doesn't show the custom one that I added, and errors if I try to connect to it. How do I connect to the custom profile/service?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.264869 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO