[gnome-bluetooth/wip/hadess/cleanups: 2/4] lib: Detect Bluetooth LE audio devices




commit 6d4a8a160c659bee230f58dac5518b62f7f61292
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 2 12:39:25 2021 +0100

    lib: Detect Bluetooth LE audio devices
    
    Detect them from their appearance, which we then translate to icons.

 lib/bluetooth-utils.c | 12 ++++++++++++
 lib/meson.build       |  1 +
 2 files changed, 13 insertions(+)
---
diff --git a/lib/bluetooth-utils.c b/lib/bluetooth-utils.c
index 669882f5..ed39c3b1 100644
--- a/lib/bluetooth-utils.c
+++ b/lib/bluetooth-utils.c
@@ -255,6 +255,18 @@ bluetooth_appearance_to_type (guint16 appearance)
                        return BLUETOOTH_TYPE_SCANNER;
                }
                break;
+       case 0x25: /* Audio */
+               switch (appearance & 0x3f) {
+               case 0x01:
+               case 0x02:
+               case 0x04:
+                       return BLUETOOTH_TYPE_HEADSET;
+               case 0x03:
+                       return BLUETOOTH_TYPE_HEADPHONES;
+               default:
+                       return BLUETOOTH_TYPE_OTHER_AUDIO;
+               }
+               break;
        }
 
        return 0;
diff --git a/lib/meson.build b/lib/meson.build
index e27df61b..884fa734 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -136,6 +136,7 @@ if enable_gir
       'bluetooth-device.h',
       'bluetooth-client-private.h',
       'bluetooth-agent.h',
+      'bluetooth-utils.h',
       ],
     nsversion: gnomebt_api_version,
     namespace: 'GnomeBluetoothPriv',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]