[gnome-bluetooth/wip/hadess/add-midi-uuid: 1/2] lib: Add MIDI to the UUID to string helper




commit 03913496bc7b36ecf70fdf864b4216025deda53c
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 10 11:24:28 2022 +0100

    lib: Add MIDI to the UUID to string helper

 lib/bluetooth-utils.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/lib/bluetooth-utils.c b/lib/bluetooth-utils.c
index 4a208c58..d2bfe4e3 100644
--- a/lib/bluetooth-utils.c
+++ b/lib/bluetooth-utils.c
@@ -390,6 +390,24 @@ uuid16_to_string (guint uuid16, const char *uuid)
        }
 }
 
+static const char *
+uuid128_to_string (const char *uuid)
+{
+       struct {
+               const char *uuid;
+               const char *str;
+       } uuids128[] = {
+               { "03B80E5A-EDE8-4B33-A751-6CE34EC4C700", "MIDI" },
+       };
+       guint i;
+
+       for (i = 0; i < G_N_ELEMENTS (uuids128); i++) {
+               if (g_str_equal (uuids128[i].uuid, uuid))
+                       return uuids128[i].str;
+       }
+       return NULL;
+}
+
 /**
  * bluetooth_uuid_to_string:
  * @uuid: a string representing a Bluetooth UUID
@@ -405,6 +423,9 @@ bluetooth_uuid_to_string (const char *uuid)
        guint uuid16;
        gboolean is_custom = FALSE;
 
+       ret = uuid128_to_string (uuid);
+       if (ret)
+               return ret;
        if (g_str_has_suffix (uuid, "-0000-1000-8000-0002ee000002") != FALSE)
                is_custom = TRUE;
 


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