From e8057c7c40ffeb34a8d4aaae7d8c55041a5a29a2 Mon Sep 17 00:00:00 2001 From: Stricted Date: Thu, 12 Jan 2017 05:49:16 +0100 Subject: [PATCH] add setLteFrequency method --- .../Enum/Band.cs | 10 ++++ .../util.cs | 53 ++++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 SpeedportHybridControl.Implementations/Enum/Band.cs diff --git a/SpeedportHybridControl.Implementations/Enum/Band.cs b/SpeedportHybridControl.Implementations/Enum/Band.cs new file mode 100644 index 0000000..a18fe43 --- /dev/null +++ b/SpeedportHybridControl.Implementations/Enum/Band.cs @@ -0,0 +1,10 @@ +namespace SpeedportHybridControl.Implementations.Enum +{ + public enum Band + { + + LTE800 = (1 << 1), + LTE1800 = (1 << 2), + LTE2600 = (1 << 3) + } +} diff --git a/SpeedportHybridControl.Implementations/util.cs b/SpeedportHybridControl.Implementations/util.cs index 4c807bb..39259fd 100644 --- a/SpeedportHybridControl.Implementations/util.cs +++ b/SpeedportHybridControl.Implementations/util.cs @@ -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); + } } } -- 2.20.1