[gnome-control-center] panels: wwan: Add WWAN 5G connection support



commit 83278d27248bc7c9b24b780c8f9b5aba6537f75b
Author: Dirk Su <dirk su canonical com>
Date:   Mon Aug 1 20:06:51 2022 +0000

    panels: wwan: Add WWAN 5G connection support

 panels/wwan/cc-wwan-device.c      | 88 +++++++++++++++++++++++++++++++++++++++
 panels/wwan/cc-wwan-mode-dialog.c |  5 +++
 2 files changed, 93 insertions(+)
---
diff --git a/panels/wwan/cc-wwan-device.c b/panels/wwan/cc-wwan-device.c
index 2538d199b..a77715b32 100644
--- a/panels/wwan/cc-wwan-device.c
+++ b/panels/wwan/cc-wwan-device.c
@@ -993,9 +993,28 @@ cc_wwan_device_get_string_from_mode (CcWwanDevice *self,
   if (allowed == MM_MODEM_MODE_4G)
     return g_strdup (_("4G Only"));
 
+  if (allowed == MM_MODEM_MODE_5G)
+    return g_strdup (_("5G Only"));
+
   str = g_string_sized_new (10);
 
   if (allowed & MM_MODEM_MODE_2G &&
+      allowed & MM_MODEM_MODE_3G &&
+      allowed & MM_MODEM_MODE_4G &&
+      allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("2G, 3G, 4G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_4G)
+        g_string_append (str, _("2G, 3G, 4G (Preferred), 5G"));
+      else if (preferred & MM_MODEM_MODE_3G)
+        g_string_append (str, _("2G, 3G (Preferred), 4G, 5G"));
+      else if (preferred & MM_MODEM_MODE_2G)
+        g_string_append (str, _("2G (Preferred), 3G, 4G, 5G"));
+      else
+        g_string_append (str, _("2G, 3G, 4G, 5G"));
+    }
+  else if (allowed & MM_MODEM_MODE_2G &&
       allowed & MM_MODEM_MODE_3G &&
       allowed & MM_MODEM_MODE_4G)
     {
@@ -1008,6 +1027,45 @@ cc_wwan_device_get_string_from_mode (CcWwanDevice *self,
       else
         g_string_append (str, _("2G, 3G, 4G"));
     }
+  else if (allowed & MM_MODEM_MODE_3G &&
+      allowed & MM_MODEM_MODE_4G &&
+      allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("3G, 4G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_4G)
+        g_string_append (str, _("3G, 4G (Preferred), 5G"));
+      else if (preferred & MM_MODEM_MODE_2G)
+        g_string_append (str, _("3G (Preferred), 4G, 5G"));
+      else
+        g_string_append (str, _("3G, 4G, 5G"));
+    }
+  else if (allowed & MM_MODEM_MODE_2G &&
+      allowed & MM_MODEM_MODE_4G &&
+      allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("2G, 4G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_4G)
+        g_string_append (str, _("2G, 4G (Preferred), 5G"));
+      else if (preferred & MM_MODEM_MODE_2G)
+        g_string_append (str, _("2G (Preferred), 4G, 5G"));
+      else
+        g_string_append (str, _("2G, 4G, 5G"));
+    }
+  else if (allowed & MM_MODEM_MODE_2G &&
+      allowed & MM_MODEM_MODE_3G &&
+      allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("2G, 3G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_3G)
+        g_string_append (str, _("2G, 3G (Preferred), 5G"));
+      else if (preferred & MM_MODEM_MODE_2G)
+        g_string_append (str, _("2G (Preferred), 3G, 5G"));
+      else
+        g_string_append (str, _("2G, 3G, 5G"));
+    }
   else if (allowed & MM_MODEM_MODE_3G &&
            allowed & MM_MODEM_MODE_4G)
     {
@@ -1038,6 +1096,36 @@ cc_wwan_device_get_string_from_mode (CcWwanDevice *self,
       else
         g_string_append (str, _("2G, 3G"));
     }
+  else if (allowed & MM_MODEM_MODE_2G &&
+           allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("2G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_2G)
+        g_string_append (str, _("2G (Preferred), 5G"));
+      else
+        g_string_append (str, _("2G, 5G"));
+    }
+  else if (allowed & MM_MODEM_MODE_3G &&
+           allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("3G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_3G)
+        g_string_append (str, _("3G (Preferred), 5G"));
+      else
+        g_string_append (str, _("3G, 5G"));
+    }
+  else if (allowed & MM_MODEM_MODE_4G &&
+           allowed & MM_MODEM_MODE_5G)
+    {
+      if (preferred & MM_MODEM_MODE_5G)
+        g_string_append (str, _("4G, 5G (Preferred)"));
+      else if (preferred & MM_MODEM_MODE_4G)
+        g_string_append (str, _("4G (Preferred), 5G"));
+      else
+        g_string_append (str, _("4G, 5G"));
+    }
 
   if (!str->len)
     g_string_append (str, C_("Network mode", "Unknown"));
diff --git a/panels/wwan/cc-wwan-mode-dialog.c b/panels/wwan/cc-wwan-mode-dialog.c
index 88067ff2b..dd5a4a169 100644
--- a/panels/wwan/cc-wwan-mode-dialog.c
+++ b/panels/wwan/cc-wwan-mode-dialog.c
@@ -167,12 +167,17 @@ cc_wwan_mode_dialog_update (CcWwanModeDialog *self)
 {
   MMModemMode allowed;
   MMModemMode modes[][2] = {
+    {MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G, MM_MODEM_MODE_5G},
+    {MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G, 0},
+    {MM_MODEM_MODE_3G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G, MM_MODEM_MODE_5G},
+    {MM_MODEM_MODE_3G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G, 0},
     {MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G, MM_MODEM_MODE_4G},
     {MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G, 0},
     {MM_MODEM_MODE_3G | MM_MODEM_MODE_4G, MM_MODEM_MODE_4G},
     {MM_MODEM_MODE_3G | MM_MODEM_MODE_4G, 0},
     {MM_MODEM_MODE_2G | MM_MODEM_MODE_3G, MM_MODEM_MODE_3G},
     {MM_MODEM_MODE_2G | MM_MODEM_MODE_3G, 0},
+    {MM_MODEM_MODE_5G, 0},
     {MM_MODEM_MODE_4G, 0},
     {MM_MODEM_MODE_3G, 0},
     {MM_MODEM_MODE_2G, 0},


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