add setLteFrequency method
authorStricted <info@stricted.net>
Thu, 12 Jan 2017 04:49:16 +0000 (05:49 +0100)
committerStricted <info@stricted.net>
Thu, 12 Jan 2017 04:49:16 +0000 (05:49 +0100)
SpeedportHybridControl.Implementations/Enum/Band.cs [new file with mode: 0644]
SpeedportHybridControl.Implementations/util.cs

diff --git a/SpeedportHybridControl.Implementations/Enum/Band.cs b/SpeedportHybridControl.Implementations/Enum/Band.cs
new file mode 100644 (file)
index 0000000..a18fe43
--- /dev/null
@@ -0,0 +1,10 @@
+namespace SpeedportHybridControl.Implementations.Enum
+{
+       public enum Band
+       {
+
+               LTE800 = (1 << 1),
+               LTE1800 = (1 << 2),
+               LTE2600 = (1 << 3)
+       }
+}
index 4c807bbcae054159f6a20a4500d2a0a9cbcac13d..39259fdcd73f339651d273e7cd13381bac238db6 100644 (file)
@@ -1,5 +1,6 @@
 using Microsoft.Win32;
 using Newtonsoft.Json.Linq;
+using SpeedportHybridControl.Implementations.Enum;
 using System;
 using System.Linq;
 using System.Net;
@@ -271,9 +272,9 @@ namespace SpeedportHybridControl.Implementations
                        return false;
                }
 
-               public static void sendCommandToLteModul (string Command)
+               public static void sendCommandToLteModul(string Command)
                {
-                       if (checkLteModul().Equals(true))
+                       if (checkLteModul().Equals(true) && Command.IsNullOrEmpty().Equals(false))
                        {
                                try
                                {
@@ -291,5 +292,53 @@ namespace SpeedportHybridControl.Implementations
                                }
                        }
                }
+
+               public static void setLteFrequency (Band band)
+               {
+                       /**
+                        * pissible lte frequency band commands:
+                        * 
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,80000,,  # 800
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,4,,      # 1800
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,40,,     # 2600
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,80044,,  # 800 | 1800 | 2600
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,80004,,  # 800 | 1800
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,80040,,  # 800 | 2600
+                        * AT^SYSCFGEX="03",3FFFFFFF,3,1,44,,     # 1800 | 2600
+                        */
+
+                       string Command = string.Empty;
+
+                       if ((band & Band.LTE800) == Band.LTE800)
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,80000,,";
+                       }
+                       else if ((band & Band.LTE1800) == Band.LTE1800)
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,4,,";
+                       }
+                       else if ((band & Band.LTE2600) == Band.LTE2600)
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,40,,";
+                       }
+                       else if ((band & (Band.LTE800 | Band.LTE1800 | Band.LTE2600)) == (Band.LTE800 | Band.LTE1800 | Band.LTE2600))
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,80044,,";
+                       }
+                       else if ((band & (Band.LTE800 | Band.LTE1800)) == (Band.LTE800 | Band.LTE1800))
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,80004,,";
+                       }
+                       else if ((band & (Band.LTE800 | Band.LTE2600)) == (Band.LTE800 | Band.LTE2600))
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,80040,,";
+                       }
+                       else if ((band & (Band.LTE1800 | Band.LTE2600)) == (Band.LTE1800 | Band.LTE2600))
+                       {
+                               Command = "AT^SYSCFGEX=\"03\",3FFFFFFF,3,1,44,,";
+                       }
+
+                       sendCommandToLteModul(Command);
+               }
     }
 }