[NM] [PATCH] core: add settings for 4G (LTE) network modes



NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G and NM_SETTING_GSM_NETWORK_TYPE_4G added.

I am unsure about the deprecated modes, which ones will be best to use.

--
Maris

>From 1e6a19982b21f54f21ea9521ac3a3cb0900c4982 Mon Sep 17 00:00:00 2001
From: "Marius B. Kotsbak" <marius kotsbak com>
Date: Sat, 8 Sep 2012 15:37:46 +0200
Subject: [PATCH] core: add settings for 4G (LTE) network modes

NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G and NM_SETTING_GSM_NETWORK_TYPE_4G added.
---
 libnm-util/nm-setting-gsm.c      |    6 +++---
 libnm-util/nm-setting-gsm.h      |    8 +++++++-
 src/modem-manager/nm-modem-gsm.c |   12 +++++++++++-
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c
index 2264d00..98ec27a 100644
--- a/libnm-util/nm-setting-gsm.c
+++ b/libnm-util/nm-setting-gsm.c
@@ -658,10 +658,10 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
 					    "Network preference to force the device to only use "
 					    "specific network technologies.  The permitted values "
 					    "are: -1: any, 0: 3G only, 1: GPRS/EDGE only, "
-					    "2: prefer 3G, and 3: prefer 2G.  Note that not all "
-					    "devices allow network preference control.",
+					    "2: prefer 3G, 3: prefer 2G, 4: prefer 4G/LTE, 5: 4G/LTE only. "
+					    "Note that not all devices allow network preference control.",
 					    NM_SETTING_GSM_NETWORK_TYPE_ANY,
-					    NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE,
+					    NM_SETTING_GSM_NETWORK_TYPE_4G,
 					    NM_SETTING_GSM_NETWORK_TYPE_ANY,
 					    G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
 
diff --git a/libnm-util/nm-setting-gsm.h b/libnm-util/nm-setting-gsm.h
index 12114e3..2303f76 100644
--- a/libnm-util/nm-setting-gsm.h
+++ b/libnm-util/nm-setting-gsm.h
@@ -81,6 +81,10 @@ GQuark nm_setting_gsm_error_quark (void);
  * preferred but 2G-type technologies may be used as a fallback
  * @NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE: 2G-type technologies are
  * preferred but 3G-type technologies may be used as a fallback
+ * @NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G: 4G/LTE-type technologies are
+ * preferred but 3G/2/-type technologies may be used as a fallback
+ * @NM_SETTING_GSM_NETWORK_TYPE_4G: only 4G/LTE type
+ * technologies may be used
  *
  * #NMSettingGsmNetworkType values indicate the allowed access technologies
  * the device may use when connecting to this network.
@@ -90,7 +94,9 @@ typedef enum {
 	NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA = 0,
 	NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE = 1,
 	NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA = 2,
-	NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE = 3
+	NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE = 3,
+	NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G = 4,
+	NM_SETTING_GSM_NETWORK_TYPE_4G = 5
 } NMSettingGsmNetworkType;
 
 /**
diff --git a/src/modem-manager/nm-modem-gsm.c b/src/modem-manager/nm-modem-gsm.c
index c0a8f2e..7ff615e 100644
--- a/src/modem-manager/nm-modem-gsm.c
+++ b/src/modem-manager/nm-modem-gsm.c
@@ -58,8 +58,10 @@ typedef enum {
     MM_MODEM_GSM_ALLOWED_MODE_3G_PREFERRED = 2,
     MM_MODEM_GSM_ALLOWED_MODE_2G_ONLY      = 3,
     MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY      = 4,
+    MM_MODEM_GSM_ALLOWED_MODE_4G_PREFERRED = 5,
+    MM_MODEM_GSM_ALLOWED_MODE_4G_ONLY      = 6,
 
-    MM_MODEM_GSM_ALLOWED_MODE_LAST = MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY
+    MM_MODEM_GSM_ALLOWED_MODE_LAST = MM_MODEM_GSM_ALLOWED_MODE_4G_ONLY
 } MMModemGsmAllowedMode;
 
 typedef enum {
@@ -389,6 +391,14 @@ create_connect_properties (NMConnection *connection)
 		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_2G_PREFERRED);
 		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_2G_PREFERRED);
 		break;
+	case NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_4G_PREFERRED);
+		break;
+	case NM_SETTING_GSM_NETWORK_TYPE_4G:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_4G_ONLY);
+		break;
 	default:
 		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY);
 		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_ANY);
-- 
1.7.10.4



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