using System.Security.Cryptography;
using System.Text;
-namespace SpeedportHybridControl.Implementations {
- public static class Cryptography {
- private static string KEY = "8E16A57381AFDA47856682CEBE85DCF5982F59321AE28B2822C1C9E1FC481C50";
- private static string IV = "7CD37E78623793D4C4BB81DB73B08522";
+namespace SpeedportHybridControl.Implementations
+{
+ public static class Cryptography
+ {
+ private static string KEY = "8E16A57381AFDA47856682CEBE85DCF5982F59321AE28B2822C1C9E1FC481C50";
+ private static string IV = "7CD37E78623793D4C4BB81DB73B08522";
- public static string Encrypt (string clearText) {
- byte[] clearBytes = Encoding.Unicode.GetBytes(clearText);
- string result;
- using (Aes encryptor = Aes.Create()) {
- if (Object.Equals(encryptor, null)) {
- result = null;
- return result;
- }
+ public static string Encrypt(string clearText)
+ {
+ byte[] clearBytes = Encoding.Unicode.GetBytes(clearText);
+ string result;
+ using (Aes encryptor = Aes.Create())
+ {
+ if (Object.Equals(encryptor, null))
+ {
+ result = null;
+ return result;
+ }
- encryptor.KeySize = 256;
- encryptor.BlockSize = 128;
- encryptor.Mode = CipherMode.CBC;
- encryptor.Padding = PaddingMode.PKCS7;
- encryptor.Key = util.HexToByte(KEY);
- encryptor.IV = util.HexToByte(IV);
+ encryptor.KeySize = 256;
+ encryptor.BlockSize = 128;
+ encryptor.Mode = CipherMode.CBC;
+ encryptor.Padding = PaddingMode.PKCS7;
+ encryptor.Key = util.HexToByte(KEY);
+ encryptor.IV = util.HexToByte(IV);
- using (MemoryStream ms = new MemoryStream()) {
- using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write)) {
- cs.Write(clearBytes, 0, clearBytes.Length);
- cs.Close();
- }
- clearText = Convert.ToBase64String(ms.ToArray());
- }
- }
- result = clearText;
- return result;
- }
+ using (MemoryStream ms = new MemoryStream())
+ {
+ using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write))
+ {
+ cs.Write(clearBytes, 0, clearBytes.Length);
+ cs.Close();
+ }
+ clearText = Convert.ToBase64String(ms.ToArray());
+ }
+ }
+ result = clearText;
+ return result;
+ }
- public static string Decrypt (string cipherText) {
- byte[] cipherBytes = Convert.FromBase64String(cipherText);
- string result;
- using (Aes encryptor = Aes.Create()) {
- if (Object.Equals(encryptor, null)) {
- result = null;
- return result;
- }
+ public static string Decrypt(string cipherText)
+ {
+ byte[] cipherBytes = Convert.FromBase64String(cipherText);
+ string result;
+ using (Aes encryptor = Aes.Create())
+ {
+ if (Object.Equals(encryptor, null))
+ {
+ result = null;
+ return result;
+ }
- encryptor.KeySize = 256;
- encryptor.BlockSize = 128;
- encryptor.Mode = CipherMode.CBC;
- encryptor.Padding = PaddingMode.PKCS7;
- encryptor.Key = util.HexToByte(KEY);
- encryptor.IV = util.HexToByte(IV);
-
- using (MemoryStream ms = new MemoryStream()) {
- using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write)) {
- cs.Write(cipherBytes, 0, cipherBytes.Length);
- cs.Close();
- }
- cipherText = Encoding.Unicode.GetString(ms.ToArray());
- }
- }
- result = cipherText;
- return result;
- }
- }
+ encryptor.KeySize = 256;
+ encryptor.BlockSize = 128;
+ encryptor.Mode = CipherMode.CBC;
+ encryptor.Padding = PaddingMode.PKCS7;
+ encryptor.Key = util.HexToByte(KEY);
+ encryptor.IV = util.HexToByte(IV);
+
+ using (MemoryStream ms = new MemoryStream())
+ {
+ using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write))
+ {
+ cs.Write(cipherBytes, 0, cipherBytes.Length);
+ cs.Close();
+ }
+ cipherText = Encoding.Unicode.GetString(ms.ToArray());
+ }
+ }
+ result = cipherText;
+ return result;
+ }
+ }
}
using System;
using System.Windows.Input;
-namespace SpeedportHybridControl.Implementations {
- public class DelegateCommand : ICommand {
- private Action _executeMethod;
+namespace SpeedportHybridControl.Implementations
+{
+ public class DelegateCommand : ICommand
+ {
+ private Action _executeMethod;
- public DelegateCommand (Action executeMethod) {
- _executeMethod = executeMethod;
- }
+ public DelegateCommand(Action executeMethod)
+ {
+ _executeMethod = executeMethod;
+ }
- public bool CanExecute (object parameter = null) {
- return true;
- }
+ public bool CanExecute(object parameter = null)
+ {
+ return true;
+ }
- public event EventHandler CanExecuteChanged;
+ public event EventHandler CanExecuteChanged;
- public void Execute (object parameter = null) {
- _executeMethod.Invoke();
- }
- }
+ public void Execute(object parameter = null)
+ {
+ _executeMethod.Invoke();
+ }
+ }
}
using System.Threading;
using System.IO;
-namespace SpeedportHybridControl.Implementations {
- public class LogManager {
- public static void WriteToLog (string value) {
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
+namespace SpeedportHybridControl.Implementations
+{
+ public class LogManager
+ {
+ public static void WriteToLog(string value)
+ {
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
- Console.WriteLine(string.Concat("[", time.ToString(format), "]: ", value));
- new Thread(() => {
- try {
- StreamWriter file = new StreamWriter("ErrorLog.txt", true);
- file.WriteLine(string.Concat("[", time.ToString(format), "]: ", value));
- file.Close();
- }
- catch (Exception ex) {
- // nothing
- Console.WriteLine(ex.Message);
- }
- }).Start();
- }
- }
+ Console.WriteLine(string.Concat("[", time.ToString(format), "]: ", value));
+ new Thread(() => {
+ try
+ {
+ StreamWriter file = new StreamWriter("ErrorLog.txt", true);
+ file.WriteLine(string.Concat("[", time.ToString(format), "]: ", value));
+ file.Close();
+ }
+ catch (Exception ex)
+ {
+ // nothing
+ Console.WriteLine(ex.Message);
+ }
+ }).Start();
+ }
+ }
}
using System.Windows.Controls;
using System.Windows.Data;
-namespace SpeedportHybridControl.Implementations {
-
- // http://blog.functionalfun.net/2008/06/wpf-passwordbox-and-data-binding.html
- public static class PasswordHelper {
- public static readonly DependencyProperty BoundPassword =
- DependencyProperty.RegisterAttached("BoundPassword", typeof(string), typeof(PasswordHelper), new PropertyMetadata(string.Empty, OnBoundPasswordChanged));
-
- public static readonly DependencyProperty BindPassword = DependencyProperty.RegisterAttached(
- "BindPassword", typeof(bool), typeof(PasswordHelper), new PropertyMetadata(false, OnBindPasswordChanged));
-
- private static readonly DependencyProperty UpdatingPassword =
- DependencyProperty.RegisterAttached("UpdatingPassword", typeof(bool), typeof(PasswordHelper), new PropertyMetadata(false));
-
- private static void OnBoundPasswordChanged (DependencyObject d, DependencyPropertyChangedEventArgs e) {
- PasswordBox box = d as PasswordBox;
-
- // only handle this event when the property is attached to a PasswordBox
- // and when the BindPassword attached property has been set to true
- if (d == null || !GetBindPassword(d)) {
- return;
- }
-
- // avoid recursive updating by ignoring the box's changed event
- box.PasswordChanged -= HandlePasswordChanged;
-
- string newPassword = (string)e.NewValue;
-
- if (!GetUpdatingPassword(box)) {
- box.Password = newPassword;
- }
-
- box.PasswordChanged += HandlePasswordChanged;
- }
-
- private static void OnBindPasswordChanged (DependencyObject dp, DependencyPropertyChangedEventArgs e) {
- // when the BindPassword attached property is set on a PasswordBox,
- // start listening to its PasswordChanged event
-
- PasswordBox box = dp as PasswordBox;
-
- if (box == null) {
- return;
- }
-
- bool wasBound = (bool)(e.OldValue);
- bool needToBind = (bool)(e.NewValue);
-
- if (wasBound) {
- box.PasswordChanged -= HandlePasswordChanged;
- }
-
- if (needToBind) {
- box.PasswordChanged += HandlePasswordChanged;
- }
- }
-
- private static void HandlePasswordChanged (object sender, RoutedEventArgs e) {
- PasswordBox box = sender as PasswordBox;
-
- // set a flag to indicate that we're updating the password
- SetUpdatingPassword(box, true);
- // push the new password into the BoundPassword property
- SetBoundPassword(box, box.Password);
- SetUpdatingPassword(box, false);
- }
-
- public static void SetBindPassword (DependencyObject dp, bool value) {
- dp.SetValue(BindPassword, value);
- }
-
- public static bool GetBindPassword (DependencyObject dp) {
- return (bool)dp.GetValue(BindPassword);
- }
-
- public static string GetBoundPassword (DependencyObject dp) {
- return (string)dp.GetValue(BoundPassword);
- }
-
- public static void SetBoundPassword (DependencyObject dp, string value) {
- dp.SetValue(BoundPassword, value);
- }
-
- private static bool GetUpdatingPassword (DependencyObject dp) {
- return (bool)dp.GetValue(UpdatingPassword);
- }
-
- private static void SetUpdatingPassword (DependencyObject dp, bool value) {
- dp.SetValue(UpdatingPassword, value);
- }
- }
+namespace SpeedportHybridControl.Implementations
+{
+
+ // http://blog.functionalfun.net/2008/06/wpf-passwordbox-and-data-binding.html
+ public static class PasswordHelper
+ {
+ public static readonly DependencyProperty BoundPassword =
+ DependencyProperty.RegisterAttached("BoundPassword", typeof(string), typeof(PasswordHelper), new PropertyMetadata(string.Empty, OnBoundPasswordChanged));
+
+ public static readonly DependencyProperty BindPassword = DependencyProperty.RegisterAttached(
+ "BindPassword", typeof(bool), typeof(PasswordHelper), new PropertyMetadata(false, OnBindPasswordChanged));
+
+ private static readonly DependencyProperty UpdatingPassword =
+ DependencyProperty.RegisterAttached("UpdatingPassword", typeof(bool), typeof(PasswordHelper), new PropertyMetadata(false));
+
+ private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ PasswordBox box = d as PasswordBox;
+
+ // only handle this event when the property is attached to a PasswordBox
+ // and when the BindPassword attached property has been set to true
+ if (d == null || !GetBindPassword(d))
+ {
+ return;
+ }
+
+ // avoid recursive updating by ignoring the box's changed event
+ box.PasswordChanged -= HandlePasswordChanged;
+
+ string newPassword = (string)e.NewValue;
+
+ if (!GetUpdatingPassword(box))
+ {
+ box.Password = newPassword;
+ }
+
+ box.PasswordChanged += HandlePasswordChanged;
+ }
+
+ private static void OnBindPasswordChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
+ {
+ // when the BindPassword attached property is set on a PasswordBox,
+ // start listening to its PasswordChanged event
+
+ PasswordBox box = dp as PasswordBox;
+
+ if (box == null)
+ {
+ return;
+ }
+
+ bool wasBound = (bool)(e.OldValue);
+ bool needToBind = (bool)(e.NewValue);
+
+ if (wasBound)
+ {
+ box.PasswordChanged -= HandlePasswordChanged;
+ }
+
+ if (needToBind)
+ {
+ box.PasswordChanged += HandlePasswordChanged;
+ }
+ }
+
+ private static void HandlePasswordChanged(object sender, RoutedEventArgs e)
+ {
+ PasswordBox box = sender as PasswordBox;
+
+ // set a flag to indicate that we're updating the password
+ SetUpdatingPassword(box, true);
+ // push the new password into the BoundPassword property
+ SetBoundPassword(box, box.Password);
+ SetUpdatingPassword(box, false);
+ }
+
+ public static void SetBindPassword(DependencyObject dp, bool value)
+ {
+ dp.SetValue(BindPassword, value);
+ }
+
+ public static bool GetBindPassword(DependencyObject dp)
+ {
+ return (bool)dp.GetValue(BindPassword);
+ }
+
+ public static string GetBoundPassword(DependencyObject dp)
+ {
+ return (string)dp.GetValue(BoundPassword);
+ }
+
+ public static void SetBoundPassword(DependencyObject dp, string value)
+ {
+ dp.SetValue(BoundPassword, value);
+ }
+
+ private static bool GetUpdatingPassword(DependencyObject dp)
+ {
+ return (bool)dp.GetValue(UpdatingPassword);
+ }
+
+ private static void SetUpdatingPassword(DependencyObject dp, bool value)
+ {
+ dp.SetValue(UpdatingPassword, value);
+ }
+ }
}
using System.Text;
using System.Xml;
-namespace SpeedportHybridControl.Implementations {
- public class Settings {
- public static SettingsModel load () {
- SettingsModel result = new SettingsModel();
- try {
- if (File.Exists("settings.xml").Equals(true)) {
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.Load("settings.xml");
- result = new SettingsModel {
- ip = xmlDocument.DocumentElement["ip"].InnerText,
- password = Cryptography.Decrypt(xmlDocument.DocumentElement["password"].InnerText)
- };
- }
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
+namespace SpeedportHybridControl.Implementations
+{
+ public class Settings
+ {
+ public static SettingsModel load()
+ {
+ SettingsModel result = new SettingsModel();
+ try
+ {
+ if (File.Exists("settings.xml").Equals(true))
+ {
+ XmlDocument xmlDocument = new XmlDocument();
+ xmlDocument.Load("settings.xml");
+ result = new SettingsModel
+ {
+ ip = xmlDocument.DocumentElement["ip"].InnerText,
+ password = Cryptography.Decrypt(xmlDocument.DocumentElement["password"].InnerText)
+ };
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
- return result;
- }
+ return result;
+ }
- public static bool save(SettingsModel settings) {
- bool result;
- try {
- using (XmlTextWriter xmlTextWriter = new XmlTextWriter("settings.xml", Encoding.UTF8)) {
- xmlTextWriter.Formatting = Formatting.Indented;
- xmlTextWriter.Indentation = 4;
- xmlTextWriter.WriteStartDocument();
- xmlTextWriter.WriteStartElement("settings");
- xmlTextWriter.WriteElementString("ip", settings.ip);
- xmlTextWriter.WriteElementString("password", Cryptography.Encrypt(settings.password));
- xmlTextWriter.WriteEndElement();
- xmlTextWriter.WriteEndDocument();
- }
- result = true;
- }
- catch (Exception exception) {
- LogManager.WriteToLog(exception.Message);
+ public static bool save(SettingsModel settings)
+ {
+ bool result;
+ try
+ {
+ using (XmlTextWriter xmlTextWriter = new XmlTextWriter("settings.xml", Encoding.UTF8))
+ {
+ xmlTextWriter.Formatting = Formatting.Indented;
+ xmlTextWriter.Indentation = 4;
+ xmlTextWriter.WriteStartDocument();
+ xmlTextWriter.WriteStartElement("settings");
+ xmlTextWriter.WriteElementString("ip", settings.ip);
+ xmlTextWriter.WriteElementString("password", Cryptography.Encrypt(settings.password));
+ xmlTextWriter.WriteEndElement();
+ xmlTextWriter.WriteEndDocument();
+ }
+ result = true;
+ }
+ catch (Exception exception)
+ {
+ LogManager.WriteToLog(exception.Message);
- result = false;
- }
- return result;
- }
- }
+ result = false;
+ }
+ return result;
+ }
+ }
- public class SettingsModel {
- private string _password;
- private string _ip;
+ public class SettingsModel
+ {
+ private string _password;
+ private string _ip;
- public string password {
- get { return _password; }
- set {
- if (_password == value)
- return;
-
- _password = value;
- }
- }
+ public string password
+ {
+ get { return _password; }
+ set
+ {
+ if (_password == value)
+ return;
- public string ip {
- get { return _ip; }
- set {
- if (_ip == value)
- return;
+ _password = value;
+ }
+ }
- _ip = value;
- }
- }
+ public string ip
+ {
+ get { return _ip; }
+ set
+ {
+ if (_ip == value)
+ return;
- public SettingsModel () {
- }
- }
+ _ip = value;
+ }
+ }
+
+ public SettingsModel()
+ {
+ }
+ }
}
using System.Threading;
-namespace SpeedportHybridControl.Implementations {
- public abstract class SingletonFactory<T> where T : SingletonFactory<T>, new() {
- private static T _instance;
+namespace SpeedportHybridControl.Implementations
+{
+ public abstract class SingletonFactory<T> where T : SingletonFactory<T>, new()
+ {
+ private static T _instance;
- public static T getInstance () {
- if (_instance == null)
- Interlocked.CompareExchange(ref _instance, new T(), null);
+ public static T getInstance()
+ {
+ if (_instance == null)
+ Interlocked.CompareExchange(ref _instance, new T(), null);
- return _instance;
- }
- }
+ return _instance;
+ }
+ }
}
using Noesis.Javascript;
-namespace SpeedportHybridControl.Implementations {
- public class sjcl {
- private string jssjcl;
- public sjcl () {
- jssjcl = string.Concat(
- // embedded sjcl
- "\"use strict\";function q(a){throw a;}var s=void 0,u=!1;var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return\"CORRUPT: \"+this.message};this.message=a},invalid:function(a){this.toString=function(){return\"INVALID: \"+this.message};this.message=a},bug:function(a){this.toString=function(){return\"BUG: \"+this.message};this.message=a},notReady:function(a){this.toString=function(){return\"NOT READY: \"+this.message};this.message=a}}};",
- "\"undefined\"!==typeof module&&module.exports&&(module.exports=sjcl);\"function\"===typeof define&&define([],function(){return sjcl});",
- "sjcl.cipher.aes=function(a){this.k[0][0][0]||this.D();var b,c,d,e,f=this.k[0][4],g=this.k[1];b=a.length;var h=1;4!==b&&(6!==b&&8!==b)&&q(new sjcl.exception.invalid(\"invalid aes key size\"));this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^g[3][f[c&255]]};",
- "sjcl.cipher.aes.prototype={encrypt:function(a){return w(this,a,0)},decrypt:function(a){return w(this,a,1)},k:[[[],[],[],[],[]],[[],[],[],[],[]]],D:function(){var a=this.k[0],b=this.k[1],c=a[4],d=b[4],e,f,g,h=[],l=[],k,n,m,p;for(e=0;0x100>e;e++)l[(h[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=k||1,g=l[g]||1){m=g^g<<1^g<<2^g<<3^g<<4;m=m>>8^m&255^99;c[f]=m;d[m]=f;n=h[e=h[k=h[f]]];p=0x1010101*n^0x10001*e^0x101*k^0x1010100*f;n=0x101*h[m]^0x1010100*m;for(e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][m]=p=p<<24^p>>>8}for(e=0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};",
- "function w(a,b,c){4!==b.length&&q(new sjcl.exception.invalid(\"invalid aes block size\"));var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,l,k,n=d.length/4-2,m,p=4,t=[0,0,0,0];h=a.k[c];a=h[0];var r=h[1],v=h[2],y=h[3],z=h[4];for(m=0;m<n;m++)h=a[e>>>24]^r[f>>16&255]^v[g>>8&255]^y[b&255]^d[p],l=a[f>>>24]^r[g>>16&255]^v[b>>8&255]^y[e&255]^d[p+1],k=a[g>>>24]^r[b>>16&255]^v[e>>8&255]^y[f&255]^d[p+2],b=a[b>>>24]^r[e>>16&255]^v[f>>8&255]^y[g&255]^d[p+3],p+=4,e=h,f=l,g=k;for(m=0;4>",
- "m;m++)t[c?3&-m:m]=z[e>>>24]<<24^z[f>>16&255]<<16^z[g>>8&255]<<8^z[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h;return t}",
- "sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.P(a.slice(b/32),32-(b&31)).slice(1);return c===s?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.P(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===",
- "b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b&=31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return u;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===",
- "c},P:function(a,b,c,d){var e;e=0;for(d===s&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1));return d},l:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};",
- "sjcl.codec.utf8String={fromBits:function(a){var b=\"\",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>24),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};",
- "sjcl.codec.hex={fromBits:function(a){var b=\"\",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\\s|0x/g,\"\");d=a.length;a+=\"00000000\";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};",
- "sjcl.codec.base64={J:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",fromBits:function(a,b,c){var d=\"\",e=0,f=sjcl.codec.base64.J,g=0,h=sjcl.bitArray.bitLength(a);c&&(f=f.substr(0,62)+\"-_\");for(c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;d.length&3&&!b;)d+=\"=\";return d},toBits:function(a,b){a=a.replace(/\\s|=/g,\"\");var c=[],d,e=0,f=sjcl.codec.base64.J,g=0,h;b&&(f=f.substr(0,62)+\"-_\");for(d=0;d<a.length;d++)h=f.indexOf(a.charAt(d)),",
- "0>h&&q(new sjcl.exception.invalid(\"this isn't base64!\")),26<e?(e-=26,c.push(g^h>>>e),g=h<<32-e):(e+=6,g^=h<<32-e);e&56&&c.push(sjcl.bitArray.partial(e&56,g,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.b[0]||this.D();a?(this.r=a.r.slice(0),this.o=a.o.slice(0),this.h=a.h):this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()};",
- "sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.r=this.N.slice(0);this.o=[];this.h=0;return this},update:function(a){\"string\"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.o=sjcl.bitArray.concat(this.o,a);b=this.h;a=this.h=b+sjcl.bitArray.bitLength(a);for(b=512+b&-512;b<=a;b+=512)x(this,c.splice(0,16));return this},finalize:function(){var a,b=this.o,c=this.r,b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.h/",
- "4294967296));for(b.push(this.h|0);b.length;)x(this,b.splice(0,16));this.reset();return c},N:[],b:[],D:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}var b=0,c=2,d;a:for(;64>b;c++){for(d=2;d*d<=c;d++)if(0===c%d)continue a;8>b&&(this.N[b]=a(Math.pow(c,0.5)));this.b[b]=a(Math.pow(c,1/3));b++}}};",
- "function x(a,b){var c,d,e,f=b.slice(0),g=a.r,h=a.b,l=g[0],k=g[1],n=g[2],m=g[3],p=g[4],t=g[5],r=g[6],v=g[7];for(c=0;64>c;c++)16>c?d=f[c]:(d=f[c+1&15],e=f[c+14&15],d=f[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+f[c&15]+f[c+9&15]|0),d=d+v+(p>>>6^p>>>11^p>>>25^p<<26^p<<21^p<<7)+(r^p&(t^r))+h[c],v=r,r=t,t=p,p=m+d|0,m=n,n=k,k=l,l=d+(k&n^m&(k^n))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;g[0]=g[0]+l|0;g[1]=g[1]+k|0;g[2]=g[2]+n|0;g[3]=g[3]+m|0;g[4]=g[4]+p|0;g[5]=g[5]+t|0;g[6]=g[6]+r|0;g[7]=g[7]+v|0}",
- "sjcl.mode.ccm={name:\"ccm\",encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,l=h.bitLength(c)/8,k=h.bitLength(g)/8;e=e||64;d=d||[];7>l&&q(new sjcl.exception.invalid(\"ccm: iv must be at least 7 bytes\"));for(f=2;4>f&&k>>>8*f;f++);f<15-l&&(f=15-l);c=h.clamp(c,8*(15-f));b=sjcl.mode.ccm.L(a,b,c,d,e,f);g=sjcl.mode.ccm.p(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),l=f.clamp(b,h-e),k=f.bitSlice(b,",
- "h-e),h=(h-e)/8;7>g&&q(new sjcl.exception.invalid(\"ccm: iv must be at least 7 bytes\"));for(b=2;4>b&&h>>>8*b;b++);b<15-g&&(b=15-g);c=f.clamp(c,8*(15-b));l=sjcl.mode.ccm.p(a,l,c,k,e,b);a=sjcl.mode.ccm.L(a,l.data,c,d,e,b);f.equal(l.tag,a)||q(new sjcl.exception.corrupt(\"ccm: tag doesn't match\"));return l.data},L:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,l=h.l;e/=8;(e%2||4>e||16<e)&&q(new sjcl.exception.invalid(\"ccm: invalid tag length\"));(0xffffffff<d.length||0xffffffff<b.length)&&q(new sjcl.exception.bug(\"ccm: can't deal with 4GiB or more data\"));",
- "f=[h.partial(8,(d.length?64:0)|e-2<<2|f-1)];f=h.concat(f,c);f[3]|=h.bitLength(b)/8;f=a.encrypt(f);if(d.length){c=h.bitLength(d)/8;65279>=c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c]));g=h.concat(g,d);for(d=0;d<g.length;d+=4)f=a.encrypt(l(f,g.slice(d,d+4).concat([0,0,0])))}for(d=0;d<b.length;d+=4)f=a.encrypt(l(f,b.slice(d,d+4).concat([0,0,0])));return h.clamp(f,8*e)},p:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.l;var l=b.length,k=h.bitLength(b);c=h.concat([h.partial(8,",
- "f-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!l)return{tag:d,data:[]};for(g=0;g<l;g+=4)c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,k)}}};",
- "sjcl.mode.ocb2={name:\"ocb2\",encrypt:function(a,b,c,d,e,f){128!==sjcl.bitArray.bitLength(c)&&q(new sjcl.exception.invalid(\"ocb iv must be 128 bits\"));var g,h=sjcl.mode.ocb2.H,l=sjcl.bitArray,k=l.l,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4)m=b.slice(g,g+4),n=k(n,m),p=p.concat(k(c,a.encrypt(k(c,m)))),c=h(c);m=b.slice(g);b=l.bitLength(m);g=a.encrypt(k(c,[0,0,0,b]));m=l.clamp(k(m.concat([0,0,0]),g),b);n=k(n,k(m.concat([0,0,0]),g));n=a.encrypt(k(n,k(c,h(c))));d.length&&",
- "(n=k(n,f?d:sjcl.mode.ocb2.pmac(a,d)));return p.concat(l.concat(m,l.clamp(n,e)))},decrypt:function(a,b,c,d,e,f){128!==sjcl.bitArray.bitLength(c)&&q(new sjcl.exception.invalid(\"ocb iv must be 128 bits\"));e=e||64;var g=sjcl.mode.ocb2.H,h=sjcl.bitArray,l=h.l,k=[0,0,0,0],n=g(a.encrypt(c)),m,p,t=sjcl.bitArray.bitLength(b)-e,r=[];d=d||[];for(c=0;c+4<t/32;c+=4)m=l(n,a.decrypt(l(n,b.slice(c,c+4)))),k=l(k,m),r=r.concat(m),n=g(n);p=t-32*c;m=a.encrypt(l(n,[0,0,0,p]));m=l(m,h.clamp(b.slice(c),p).concat([0,0,0]));",
- "k=l(k,m);k=a.encrypt(l(k,l(n,g(n))));d.length&&(k=l(k,f?d:sjcl.mode.ocb2.pmac(a,d)));h.equal(h.clamp(k,e),h.bitSlice(b,t))||q(new sjcl.exception.corrupt(\"ocb: tag doesn't match\"));return r.concat(h.clamp(m,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.H,e=sjcl.bitArray,f=e.l,g=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),g=f(g,a.encrypt(f(h,b.slice(c,c+4))));c=b.slice(c);128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));g=f(g,c);return a.encrypt(f(d(f(h,",
- "d(h))),g))},H:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}};",
- "sjcl.mode.gcm={name:\"gcm\",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.p(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.p(u,a,f,d,c,e);g.equal(a.tag,b)||q(new sjcl.exception.corrupt(\"gcm: tag doesn't match\"));return a.data},Z:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.l;e=[0,0,0,0];f=b.slice(0);",
- "for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f));g=0!==(f[3]&1);for(d=3;0<d;d--)f[d]=f[d]>>>1|(f[d-1]&1)<<31;f[0]>>>=1;g&&(f[0]^=-0x1f000000)}return e},g:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d<e;d+=4)b[0]^=0xffffffff&c[d],b[1]^=0xffffffff&c[d+1],b[2]^=0xffffffff&c[d+2],b[3]^=0xffffffff&c[d+3],b=sjcl.mode.gcm.Z(b,a);return b},p:function(a,b,c,d,e,f){var g,h,l,k,n,m,p,t,r=sjcl.bitArray;m=c.length;p=r.bitLength(c);t=r.bitLength(d);h=r.bitLength(e);g=b.encrypt([0,",
- "0,0,0]);96===h?(e=e.slice(0),e=r.concat(e,[1])):(e=sjcl.mode.gcm.g(g,[0,0,0,0],e),e=sjcl.mode.gcm.g(g,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff]));h=sjcl.mode.gcm.g(g,[0,0,0,0],d);n=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.g(g,h,c));for(k=0;k<m;k+=4)n[3]++,l=b.encrypt(n),c[k]^=l[0],c[k+1]^=l[1],c[k+2]^=l[2],c[k+3]^=l[3];c=r.clamp(c,p);a&&(d=sjcl.mode.gcm.g(g,h,c));a=[Math.floor(t/0x100000000),t&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.g(g,d,a);l=b.encrypt(e);d[0]^=l[0];",
- "d[1]^=l[1];d[2]^=l[2];d[3]^=l[3];return{tag:r.bitSlice(d,0,f),data:c}}};sjcl.misc.hmac=function(a,b){this.M=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.n=[new b,new b];a.length>e&&(a=b.hash(a));for(d=0;d<e;d++)c[0][d]=a[d]^909522486,c[1][d]=a[d]^1549556828;this.n[0].update(c[0]);this.n[1].update(c[1]);this.G=new b(this.n[0])};",
- "sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){this.Q&&q(new sjcl.exception.invalid(\"encrypt on already updated hmac called!\"));this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.G=new this.M(this.n[0]);this.Q=u};sjcl.misc.hmac.prototype.update=function(a){this.Q=!0;this.G.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.G.finalize(),a=(new this.M(this.n[1])).update(a).finalize();this.reset();return a};",
- "sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E3;(0>d||0>c)&&q(sjcl.exception.invalid(\"invalid params to pbkdf2\"));\"string\"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));\"string\"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,l,k=[],n=sjcl.bitArray;for(l=1;32*k.length<(d||1);l++){e=f=a.encrypt(n.concat(b,[l]));for(g=1;g<c;g++){f=a.encrypt(f);for(h=0;h<f.length;h++)e[h]^=f[h]}k=k.concat(e)}d&&(k=n.clamp(k,d));return k};",
- "sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.i=[0];this.F=0;this.s={};this.C=0;this.K={};this.O=this.d=this.j=this.W=0;this.b=[0,0,0,0,0,0,0,0];this.f=[0,0,0,0];this.A=s;this.B=a;this.q=u;this.w={progress:{},seeded:{}};this.m=this.V=0;this.t=1;this.u=2;this.S=0x10000;this.I=[0,48,64,96,128,192,0x100,384,512,768,1024];this.T=3E4;this.R=80};",
- "sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;d===this.m&&q(new sjcl.exception.notReady(\"generator isn't seeded\"));if(d&this.u){d=!(d&this.t);e=[];var f=0,g;this.O=e[0]=(new Date).valueOf()+this.T;for(g=0;16>g;g++)e.push(0x100000000*Math.random()|0);for(g=0;g<this.c.length&&!(e=e.concat(this.c[g].finalize()),f+=this.i[g],this.i[g]=0,!d&&this.F&1<<g);g++);this.F>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.i.push(0));this.d-=f;f>this.j&&(this.j=f);this.F++;",
- "this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.A=new sjcl.cipher.aes(this.b);for(d=0;4>d&&!(this.f[d]=this.f[d]+1|0,this.f[d]);d++);}for(d=0;d<a;d+=4)0===(d+1)%this.S&&A(this),e=B(this),c.push(e[0],e[1],e[2],e[3]);A(this);return c.slice(0,a)},setDefaultParanoia:function(a,b){0===a&&\"Setting paranoia=0 will ruin your security; use it only for testing\"!==b&&q(\"Setting paranoia=0 will ruin your security; use it only for testing\");this.B=a},addEntropy:function(a,b,c){c=c||\"user\";var d,e,f=(new Date).valueOf(),",
- "g=this.s[c],h=this.isReady(),l=0;d=this.K[c];d===s&&(d=this.K[c]=this.W++);g===s&&(g=this.s[c]=0);this.s[c]=(this.s[c]+1)%this.c.length;switch(typeof a){case \"number\":b===s&&(b=1);this.c[g].update([d,this.C++,1,b,f,1,a|0]);break;case \"object\":c=Object.prototype.toString.call(a);if(\"[object Uint32Array]\"===c){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else{\"[object Array]\"!==c&&(l=1);for(c=0;c<a.length&&!l;c++)\"number\"!==typeof a[c]&&(l=1)}if(!l){if(b===s)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,",
- "e>>>=1;this.c[g].update([d,this.C++,2,b,f,a.length].concat(a))}break;case \"string\":b===s&&(b=a.length);this.c[g].update([d,this.C++,3,b,f,a.length]);this.c[g].update(a);break;default:l=1}l&&q(new sjcl.exception.bug(\"random: addEntropy only supports number, array of numbers or string\"));this.i[g]+=b;this.d+=b;h===this.m&&(this.isReady()!==this.m&&C(\"seeded\",Math.max(this.j,this.d)),C(\"progress\",this.getProgress()))},isReady:function(a){a=this.I[a!==s?a:this.B];return this.j&&this.j>=a?this.i[0]>this.R&&",
- "(new Date).valueOf()>this.O?this.u|this.t:this.t:this.d>=a?this.u|this.m:this.m},getProgress:function(a){a=this.I[a?a:this.B];return this.j>=a?1:this.d>a?1:this.d/a},startCollectors:function(){this.q||(this.a={loadTimeCollector:D(this,this.aa),mouseCollector:D(this,this.ba),keyboardCollector:D(this,this.$),accelerometerCollector:D(this,this.U),touchCollector:D(this,this.da)},window.addEventListener?(window.addEventListener(\"load\",this.a.loadTimeCollector,u),window.addEventListener(\"mousemove\",this.a.mouseCollector,",
- "u),window.addEventListener(\"keypress\",this.a.keyboardCollector,u),window.addEventListener(\"devicemotion\",this.a.accelerometerCollector,u),window.addEventListener(\"touchmove\",this.a.touchCollector,u)):document.attachEvent?(document.attachEvent(\"onload\",this.a.loadTimeCollector),document.attachEvent(\"onmousemove\",this.a.mouseCollector),document.attachEvent(\"keypress\",this.a.keyboardCollector)):q(new sjcl.exception.bug(\"can't attach event\")),this.q=!0)},stopCollectors:function(){this.q&&(window.removeEventListener?",
- "(window.removeEventListener(\"load\",this.a.loadTimeCollector,u),window.removeEventListener(\"mousemove\",this.a.mouseCollector,u),window.removeEventListener(\"keypress\",this.a.keyboardCollector,u),window.removeEventListener(\"devicemotion\",this.a.accelerometerCollector,u),window.removeEventListener(\"touchmove\",this.a.touchCollector,u)):document.detachEvent&&(document.detachEvent(\"onload\",this.a.loadTimeCollector),document.detachEvent(\"onmousemove\",this.a.mouseCollector),document.detachEvent(\"keypress\",",
- "this.a.keyboardCollector)),this.q=u)},addEventListener:function(a,b){this.w[a][this.V++]=b},removeEventListener:function(a,b){var c,d,e=this.w[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},$:function(){E(1)},ba:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&sjcl.random.addEntropy([b,c],2,\"mouse\");E(0)},da:function(a){a=a.touches[0]||a.changedTouches[0];sjcl.random.addEntropy([a.pageX||",
- "a.clientX,a.pageY||a.clientY],1,\"touch\");E(0)},aa:function(){E(2)},U:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;\"number\"===typeof b&&sjcl.random.addEntropy(b,1,\"accelerometer\")}a&&sjcl.random.addEntropy(a,2,\"accelerometer\");E(0)}};function C(a,b){var c,d=sjcl.random.w[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}",
- "function E(a){\"undefined\"!==typeof window&&window.performance&&\"function\"===typeof window.performance.now?sjcl.random.addEntropy(window.performance.now(),a,\"loadtime\"):sjcl.random.addEntropy((new Date).valueOf(),a,\"loadtime\")}function A(a){a.b=B(a).concat(B(a));a.A=new sjcl.cipher.aes(a.b)}function B(a){for(var b=0;4>b&&!(a.f[b]=a.f[b]+1|0,a.f[b]);b++);return a.A.encrypt(a.f)}function D(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);",
- "a:try{var F,G,H,I;if(I=\"undefined\"!==typeof module){var J;if(J=module.exports){var K;try{K=require(\"crypto\")}catch(L){K=null}J=(G=K)&&G.randomBytes}I=J}if(I)F=G.randomBytes(128),F=new Uint32Array((new Uint8Array(F)).buffer),sjcl.random.addEntropy(F,1024,\"crypto['randomBytes']\");else if(\"undefined\"!==typeof window&&\"undefined\"!==typeof Uint32Array){H=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(H);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(H);",
- "else break a;sjcl.random.addEntropy(H,1024,\"crypto['getRandomValues']\")}}catch(M){\"undefined\"!==typeof window&&window.console&&(console.log(\"There was an error collecting entropy from the browser:\"),console.log(M))}",
- "sjcl.json={defaults:{v:1,iter:1E3,ks:128,ts:64,mode:\"ccm\",adata:\"\",cipher:\"aes\"},Y:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.e({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.e(f,c);c=f.adata;\"string\"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt));\"string\"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv));(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||\"string\"===typeof a&&100>=f.iter||64!==f.ts&&96!==f.ts&&128!==f.ts||128!==f.ks&&192!==f.ks&&0x100!==f.ks||2>f.iv.length||4<",
- "f.iv.length)&&q(new sjcl.exception.invalid(\"json encrypt: invalid parameters\"));\"string\"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,f),a=g.key.slice(0,f.ks/32),f.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.publicKey&&(g=a.kem(),f.kemtag=g.tag,a=g.key.slice(0,f.ks/32));\"string\"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));\"string\"===typeof c&&(f.adata=c=sjcl.codec.utf8String.toBits(c));g=new sjcl.cipher[f.cipher](a);e.e(d,f);d.key=a;f.ct=sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return f},",
- "encrypt:function(a,b,c,d){var e=sjcl.json,f=e.Y.apply(e,arguments);return e.encode(f)},X:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.e(e.e(e.e({},e.defaults),b),c,!0);var f,g;f=b.adata;\"string\"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt));\"string\"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv));(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||\"string\"===typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)&&",
- "q(new sjcl.exception.invalid(\"json decrypt: invalid parameters\"));\"string\"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,b),a=g.key.slice(0,b.ks/32),b.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.secretKey&&(a=a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));\"string\"===typeof f&&(f=sjcl.codec.utf8String.toBits(f));g=new sjcl.cipher[b.cipher](a);f=sjcl.mode[b.mode].decrypt(g,b.ct,b.iv,f,b.ts);e.e(d,b);d.key=a;return 1===c.raw?f:sjcl.codec.utf8String.fromBits(f)},decrypt:function(a,b,",
- "c,d){var e=sjcl.json;return e.X(a,e.decode(b),c,d)},encode:function(a){var b,c=\"{\",d=\"\";for(b in a)if(a.hasOwnProperty(b))switch(b.match(/^[a-z0-9]+$/i)||q(new sjcl.exception.invalid(\"json encode: invalid property name\")),c+=d+'\"'+b+'\":',d=\",\",typeof a[b]){case \"number\":case \"boolean\":c+=a[b];break;case \"string\":c+='\"'+escape(a[b])+'\"';break;case \"object\":c+='\"'+sjcl.codec.base64.fromBits(a[b],0)+'\"';break;default:q(new sjcl.exception.bug(\"json encode: unsupported type\"))}return c+\"}\"},decode:function(a){a=",
- "a.replace(/\\s/g,\"\");a.match(/^\\{.*\\}$/)||q(new sjcl.exception.invalid(\"json decode: this isn't json!\"));a=a.replace(/^\\{|\\}$/g,\"\").split(/,/);var b={},c,d;for(c=0;c<a.length;c++)(d=a[c].match(/^\\s*(?:([\"']?)([a-z][a-z0-9]*)\\1)\\s*:\\s*(?:(-?\\d+)|\"([a-z0-9+\\/%*_.@=\\-]*)\"|(true|false))$/i))||q(new sjcl.exception.invalid(\"json decode: this isn't json!\")),d[3]?b[d[2]]=parseInt(d[3],10):d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):d[5]&&(b[d[2]]=\"true\"===",
- "d[5]);return b},e:function(a,b,c){a===s&&(a={});if(b===s)return a;for(var d in b)b.hasOwnProperty(d)&&(c&&(a[d]!==s&&a[d]!==b[d])&&q(new sjcl.exception.invalid(\"required parameter overridden\")),a[d]=b[d]);return a},fa:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&a[d]!==b[d]&&(c[d]=a[d]);return c},ea:function(a,b){var c={},d;for(d=0;d<b.length;d++)a[b[d]]!==s&&(c[b[d]]=a[b[d]]);return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.ca={};",
- "sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.ca,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=b.salt===s?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};");
- }
+namespace SpeedportHybridControl.Implementations
+{
+ public class sjcl
+ {
+ private string jssjcl;
+ public sjcl()
+ {
+ jssjcl = string.Concat(
+ // embedded sjcl
+ "\"use strict\";function q(a){throw a;}var s=void 0,u=!1;var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return\"CORRUPT: \"+this.message};this.message=a},invalid:function(a){this.toString=function(){return\"INVALID: \"+this.message};this.message=a},bug:function(a){this.toString=function(){return\"BUG: \"+this.message};this.message=a},notReady:function(a){this.toString=function(){return\"NOT READY: \"+this.message};this.message=a}}};",
+ "\"undefined\"!==typeof module&&module.exports&&(module.exports=sjcl);\"function\"===typeof define&&define([],function(){return sjcl});",
+ "sjcl.cipher.aes=function(a){this.k[0][0][0]||this.D();var b,c,d,e,f=this.k[0][4],g=this.k[1];b=a.length;var h=1;4!==b&&(6!==b&&8!==b)&&q(new sjcl.exception.invalid(\"invalid aes key size\"));this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^g[3][f[c&255]]};",
+ "sjcl.cipher.aes.prototype={encrypt:function(a){return w(this,a,0)},decrypt:function(a){return w(this,a,1)},k:[[[],[],[],[],[]],[[],[],[],[],[]]],D:function(){var a=this.k[0],b=this.k[1],c=a[4],d=b[4],e,f,g,h=[],l=[],k,n,m,p;for(e=0;0x100>e;e++)l[(h[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=k||1,g=l[g]||1){m=g^g<<1^g<<2^g<<3^g<<4;m=m>>8^m&255^99;c[f]=m;d[m]=f;n=h[e=h[k=h[f]]];p=0x1010101*n^0x10001*e^0x101*k^0x1010100*f;n=0x101*h[m]^0x1010100*m;for(e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][m]=p=p<<24^p>>>8}for(e=0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};",
+ "function w(a,b,c){4!==b.length&&q(new sjcl.exception.invalid(\"invalid aes block size\"));var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,l,k,n=d.length/4-2,m,p=4,t=[0,0,0,0];h=a.k[c];a=h[0];var r=h[1],v=h[2],y=h[3],z=h[4];for(m=0;m<n;m++)h=a[e>>>24]^r[f>>16&255]^v[g>>8&255]^y[b&255]^d[p],l=a[f>>>24]^r[g>>16&255]^v[b>>8&255]^y[e&255]^d[p+1],k=a[g>>>24]^r[b>>16&255]^v[e>>8&255]^y[f&255]^d[p+2],b=a[b>>>24]^r[e>>16&255]^v[f>>8&255]^y[g&255]^d[p+3],p+=4,e=h,f=l,g=k;for(m=0;4>",
+ "m;m++)t[c?3&-m:m]=z[e>>>24]<<24^z[f>>16&255]<<16^z[g>>8&255]<<8^z[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h;return t}",
+ "sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.P(a.slice(b/32),32-(b&31)).slice(1);return c===s?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.P(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===",
+ "b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b&=31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return u;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===",
+ "c},P:function(a,b,c,d){var e;e=0;for(d===s&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1));return d},l:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};",
+ "sjcl.codec.utf8String={fromBits:function(a){var b=\"\",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>24),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};",
+ "sjcl.codec.hex={fromBits:function(a){var b=\"\",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\\s|0x/g,\"\");d=a.length;a+=\"00000000\";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};",
+ "sjcl.codec.base64={J:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",fromBits:function(a,b,c){var d=\"\",e=0,f=sjcl.codec.base64.J,g=0,h=sjcl.bitArray.bitLength(a);c&&(f=f.substr(0,62)+\"-_\");for(c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;d.length&3&&!b;)d+=\"=\";return d},toBits:function(a,b){a=a.replace(/\\s|=/g,\"\");var c=[],d,e=0,f=sjcl.codec.base64.J,g=0,h;b&&(f=f.substr(0,62)+\"-_\");for(d=0;d<a.length;d++)h=f.indexOf(a.charAt(d)),",
+ "0>h&&q(new sjcl.exception.invalid(\"this isn't base64!\")),26<e?(e-=26,c.push(g^h>>>e),g=h<<32-e):(e+=6,g^=h<<32-e);e&56&&c.push(sjcl.bitArray.partial(e&56,g,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.b[0]||this.D();a?(this.r=a.r.slice(0),this.o=a.o.slice(0),this.h=a.h):this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()};",
+ "sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.r=this.N.slice(0);this.o=[];this.h=0;return this},update:function(a){\"string\"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.o=sjcl.bitArray.concat(this.o,a);b=this.h;a=this.h=b+sjcl.bitArray.bitLength(a);for(b=512+b&-512;b<=a;b+=512)x(this,c.splice(0,16));return this},finalize:function(){var a,b=this.o,c=this.r,b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.h/",
+ "4294967296));for(b.push(this.h|0);b.length;)x(this,b.splice(0,16));this.reset();return c},N:[],b:[],D:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}var b=0,c=2,d;a:for(;64>b;c++){for(d=2;d*d<=c;d++)if(0===c%d)continue a;8>b&&(this.N[b]=a(Math.pow(c,0.5)));this.b[b]=a(Math.pow(c,1/3));b++}}};",
+ "function x(a,b){var c,d,e,f=b.slice(0),g=a.r,h=a.b,l=g[0],k=g[1],n=g[2],m=g[3],p=g[4],t=g[5],r=g[6],v=g[7];for(c=0;64>c;c++)16>c?d=f[c]:(d=f[c+1&15],e=f[c+14&15],d=f[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+f[c&15]+f[c+9&15]|0),d=d+v+(p>>>6^p>>>11^p>>>25^p<<26^p<<21^p<<7)+(r^p&(t^r))+h[c],v=r,r=t,t=p,p=m+d|0,m=n,n=k,k=l,l=d+(k&n^m&(k^n))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;g[0]=g[0]+l|0;g[1]=g[1]+k|0;g[2]=g[2]+n|0;g[3]=g[3]+m|0;g[4]=g[4]+p|0;g[5]=g[5]+t|0;g[6]=g[6]+r|0;g[7]=g[7]+v|0}",
+ "sjcl.mode.ccm={name:\"ccm\",encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,l=h.bitLength(c)/8,k=h.bitLength(g)/8;e=e||64;d=d||[];7>l&&q(new sjcl.exception.invalid(\"ccm: iv must be at least 7 bytes\"));for(f=2;4>f&&k>>>8*f;f++);f<15-l&&(f=15-l);c=h.clamp(c,8*(15-f));b=sjcl.mode.ccm.L(a,b,c,d,e,f);g=sjcl.mode.ccm.p(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),l=f.clamp(b,h-e),k=f.bitSlice(b,",
+ "h-e),h=(h-e)/8;7>g&&q(new sjcl.exception.invalid(\"ccm: iv must be at least 7 bytes\"));for(b=2;4>b&&h>>>8*b;b++);b<15-g&&(b=15-g);c=f.clamp(c,8*(15-b));l=sjcl.mode.ccm.p(a,l,c,k,e,b);a=sjcl.mode.ccm.L(a,l.data,c,d,e,b);f.equal(l.tag,a)||q(new sjcl.exception.corrupt(\"ccm: tag doesn't match\"));return l.data},L:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,l=h.l;e/=8;(e%2||4>e||16<e)&&q(new sjcl.exception.invalid(\"ccm: invalid tag length\"));(0xffffffff<d.length||0xffffffff<b.length)&&q(new sjcl.exception.bug(\"ccm: can't deal with 4GiB or more data\"));",
+ "f=[h.partial(8,(d.length?64:0)|e-2<<2|f-1)];f=h.concat(f,c);f[3]|=h.bitLength(b)/8;f=a.encrypt(f);if(d.length){c=h.bitLength(d)/8;65279>=c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c]));g=h.concat(g,d);for(d=0;d<g.length;d+=4)f=a.encrypt(l(f,g.slice(d,d+4).concat([0,0,0])))}for(d=0;d<b.length;d+=4)f=a.encrypt(l(f,b.slice(d,d+4).concat([0,0,0])));return h.clamp(f,8*e)},p:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.l;var l=b.length,k=h.bitLength(b);c=h.concat([h.partial(8,",
+ "f-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!l)return{tag:d,data:[]};for(g=0;g<l;g+=4)c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,k)}}};",
+ "sjcl.mode.ocb2={name:\"ocb2\",encrypt:function(a,b,c,d,e,f){128!==sjcl.bitArray.bitLength(c)&&q(new sjcl.exception.invalid(\"ocb iv must be 128 bits\"));var g,h=sjcl.mode.ocb2.H,l=sjcl.bitArray,k=l.l,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4)m=b.slice(g,g+4),n=k(n,m),p=p.concat(k(c,a.encrypt(k(c,m)))),c=h(c);m=b.slice(g);b=l.bitLength(m);g=a.encrypt(k(c,[0,0,0,b]));m=l.clamp(k(m.concat([0,0,0]),g),b);n=k(n,k(m.concat([0,0,0]),g));n=a.encrypt(k(n,k(c,h(c))));d.length&&",
+ "(n=k(n,f?d:sjcl.mode.ocb2.pmac(a,d)));return p.concat(l.concat(m,l.clamp(n,e)))},decrypt:function(a,b,c,d,e,f){128!==sjcl.bitArray.bitLength(c)&&q(new sjcl.exception.invalid(\"ocb iv must be 128 bits\"));e=e||64;var g=sjcl.mode.ocb2.H,h=sjcl.bitArray,l=h.l,k=[0,0,0,0],n=g(a.encrypt(c)),m,p,t=sjcl.bitArray.bitLength(b)-e,r=[];d=d||[];for(c=0;c+4<t/32;c+=4)m=l(n,a.decrypt(l(n,b.slice(c,c+4)))),k=l(k,m),r=r.concat(m),n=g(n);p=t-32*c;m=a.encrypt(l(n,[0,0,0,p]));m=l(m,h.clamp(b.slice(c),p).concat([0,0,0]));",
+ "k=l(k,m);k=a.encrypt(l(k,l(n,g(n))));d.length&&(k=l(k,f?d:sjcl.mode.ocb2.pmac(a,d)));h.equal(h.clamp(k,e),h.bitSlice(b,t))||q(new sjcl.exception.corrupt(\"ocb: tag doesn't match\"));return r.concat(h.clamp(m,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.H,e=sjcl.bitArray,f=e.l,g=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),g=f(g,a.encrypt(f(h,b.slice(c,c+4))));c=b.slice(c);128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));g=f(g,c);return a.encrypt(f(d(f(h,",
+ "d(h))),g))},H:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}};",
+ "sjcl.mode.gcm={name:\"gcm\",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.p(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.p(u,a,f,d,c,e);g.equal(a.tag,b)||q(new sjcl.exception.corrupt(\"gcm: tag doesn't match\"));return a.data},Z:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.l;e=[0,0,0,0];f=b.slice(0);",
+ "for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f));g=0!==(f[3]&1);for(d=3;0<d;d--)f[d]=f[d]>>>1|(f[d-1]&1)<<31;f[0]>>>=1;g&&(f[0]^=-0x1f000000)}return e},g:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d<e;d+=4)b[0]^=0xffffffff&c[d],b[1]^=0xffffffff&c[d+1],b[2]^=0xffffffff&c[d+2],b[3]^=0xffffffff&c[d+3],b=sjcl.mode.gcm.Z(b,a);return b},p:function(a,b,c,d,e,f){var g,h,l,k,n,m,p,t,r=sjcl.bitArray;m=c.length;p=r.bitLength(c);t=r.bitLength(d);h=r.bitLength(e);g=b.encrypt([0,",
+ "0,0,0]);96===h?(e=e.slice(0),e=r.concat(e,[1])):(e=sjcl.mode.gcm.g(g,[0,0,0,0],e),e=sjcl.mode.gcm.g(g,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff]));h=sjcl.mode.gcm.g(g,[0,0,0,0],d);n=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.g(g,h,c));for(k=0;k<m;k+=4)n[3]++,l=b.encrypt(n),c[k]^=l[0],c[k+1]^=l[1],c[k+2]^=l[2],c[k+3]^=l[3];c=r.clamp(c,p);a&&(d=sjcl.mode.gcm.g(g,h,c));a=[Math.floor(t/0x100000000),t&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.g(g,d,a);l=b.encrypt(e);d[0]^=l[0];",
+ "d[1]^=l[1];d[2]^=l[2];d[3]^=l[3];return{tag:r.bitSlice(d,0,f),data:c}}};sjcl.misc.hmac=function(a,b){this.M=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.n=[new b,new b];a.length>e&&(a=b.hash(a));for(d=0;d<e;d++)c[0][d]=a[d]^909522486,c[1][d]=a[d]^1549556828;this.n[0].update(c[0]);this.n[1].update(c[1]);this.G=new b(this.n[0])};",
+ "sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){this.Q&&q(new sjcl.exception.invalid(\"encrypt on already updated hmac called!\"));this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.G=new this.M(this.n[0]);this.Q=u};sjcl.misc.hmac.prototype.update=function(a){this.Q=!0;this.G.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.G.finalize(),a=(new this.M(this.n[1])).update(a).finalize();this.reset();return a};",
+ "sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E3;(0>d||0>c)&&q(sjcl.exception.invalid(\"invalid params to pbkdf2\"));\"string\"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));\"string\"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,l,k=[],n=sjcl.bitArray;for(l=1;32*k.length<(d||1);l++){e=f=a.encrypt(n.concat(b,[l]));for(g=1;g<c;g++){f=a.encrypt(f);for(h=0;h<f.length;h++)e[h]^=f[h]}k=k.concat(e)}d&&(k=n.clamp(k,d));return k};",
+ "sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.i=[0];this.F=0;this.s={};this.C=0;this.K={};this.O=this.d=this.j=this.W=0;this.b=[0,0,0,0,0,0,0,0];this.f=[0,0,0,0];this.A=s;this.B=a;this.q=u;this.w={progress:{},seeded:{}};this.m=this.V=0;this.t=1;this.u=2;this.S=0x10000;this.I=[0,48,64,96,128,192,0x100,384,512,768,1024];this.T=3E4;this.R=80};",
+ "sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;d===this.m&&q(new sjcl.exception.notReady(\"generator isn't seeded\"));if(d&this.u){d=!(d&this.t);e=[];var f=0,g;this.O=e[0]=(new Date).valueOf()+this.T;for(g=0;16>g;g++)e.push(0x100000000*Math.random()|0);for(g=0;g<this.c.length&&!(e=e.concat(this.c[g].finalize()),f+=this.i[g],this.i[g]=0,!d&&this.F&1<<g);g++);this.F>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.i.push(0));this.d-=f;f>this.j&&(this.j=f);this.F++;",
+ "this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.A=new sjcl.cipher.aes(this.b);for(d=0;4>d&&!(this.f[d]=this.f[d]+1|0,this.f[d]);d++);}for(d=0;d<a;d+=4)0===(d+1)%this.S&&A(this),e=B(this),c.push(e[0],e[1],e[2],e[3]);A(this);return c.slice(0,a)},setDefaultParanoia:function(a,b){0===a&&\"Setting paranoia=0 will ruin your security; use it only for testing\"!==b&&q(\"Setting paranoia=0 will ruin your security; use it only for testing\");this.B=a},addEntropy:function(a,b,c){c=c||\"user\";var d,e,f=(new Date).valueOf(),",
+ "g=this.s[c],h=this.isReady(),l=0;d=this.K[c];d===s&&(d=this.K[c]=this.W++);g===s&&(g=this.s[c]=0);this.s[c]=(this.s[c]+1)%this.c.length;switch(typeof a){case \"number\":b===s&&(b=1);this.c[g].update([d,this.C++,1,b,f,1,a|0]);break;case \"object\":c=Object.prototype.toString.call(a);if(\"[object Uint32Array]\"===c){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else{\"[object Array]\"!==c&&(l=1);for(c=0;c<a.length&&!l;c++)\"number\"!==typeof a[c]&&(l=1)}if(!l){if(b===s)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,",
+ "e>>>=1;this.c[g].update([d,this.C++,2,b,f,a.length].concat(a))}break;case \"string\":b===s&&(b=a.length);this.c[g].update([d,this.C++,3,b,f,a.length]);this.c[g].update(a);break;default:l=1}l&&q(new sjcl.exception.bug(\"random: addEntropy only supports number, array of numbers or string\"));this.i[g]+=b;this.d+=b;h===this.m&&(this.isReady()!==this.m&&C(\"seeded\",Math.max(this.j,this.d)),C(\"progress\",this.getProgress()))},isReady:function(a){a=this.I[a!==s?a:this.B];return this.j&&this.j>=a?this.i[0]>this.R&&",
+ "(new Date).valueOf()>this.O?this.u|this.t:this.t:this.d>=a?this.u|this.m:this.m},getProgress:function(a){a=this.I[a?a:this.B];return this.j>=a?1:this.d>a?1:this.d/a},startCollectors:function(){this.q||(this.a={loadTimeCollector:D(this,this.aa),mouseCollector:D(this,this.ba),keyboardCollector:D(this,this.$),accelerometerCollector:D(this,this.U),touchCollector:D(this,this.da)},window.addEventListener?(window.addEventListener(\"load\",this.a.loadTimeCollector,u),window.addEventListener(\"mousemove\",this.a.mouseCollector,",
+ "u),window.addEventListener(\"keypress\",this.a.keyboardCollector,u),window.addEventListener(\"devicemotion\",this.a.accelerometerCollector,u),window.addEventListener(\"touchmove\",this.a.touchCollector,u)):document.attachEvent?(document.attachEvent(\"onload\",this.a.loadTimeCollector),document.attachEvent(\"onmousemove\",this.a.mouseCollector),document.attachEvent(\"keypress\",this.a.keyboardCollector)):q(new sjcl.exception.bug(\"can't attach event\")),this.q=!0)},stopCollectors:function(){this.q&&(window.removeEventListener?",
+ "(window.removeEventListener(\"load\",this.a.loadTimeCollector,u),window.removeEventListener(\"mousemove\",this.a.mouseCollector,u),window.removeEventListener(\"keypress\",this.a.keyboardCollector,u),window.removeEventListener(\"devicemotion\",this.a.accelerometerCollector,u),window.removeEventListener(\"touchmove\",this.a.touchCollector,u)):document.detachEvent&&(document.detachEvent(\"onload\",this.a.loadTimeCollector),document.detachEvent(\"onmousemove\",this.a.mouseCollector),document.detachEvent(\"keypress\",",
+ "this.a.keyboardCollector)),this.q=u)},addEventListener:function(a,b){this.w[a][this.V++]=b},removeEventListener:function(a,b){var c,d,e=this.w[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},$:function(){E(1)},ba:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&sjcl.random.addEntropy([b,c],2,\"mouse\");E(0)},da:function(a){a=a.touches[0]||a.changedTouches[0];sjcl.random.addEntropy([a.pageX||",
+ "a.clientX,a.pageY||a.clientY],1,\"touch\");E(0)},aa:function(){E(2)},U:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;\"number\"===typeof b&&sjcl.random.addEntropy(b,1,\"accelerometer\")}a&&sjcl.random.addEntropy(a,2,\"accelerometer\");E(0)}};function C(a,b){var c,d=sjcl.random.w[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}",
+ "function E(a){\"undefined\"!==typeof window&&window.performance&&\"function\"===typeof window.performance.now?sjcl.random.addEntropy(window.performance.now(),a,\"loadtime\"):sjcl.random.addEntropy((new Date).valueOf(),a,\"loadtime\")}function A(a){a.b=B(a).concat(B(a));a.A=new sjcl.cipher.aes(a.b)}function B(a){for(var b=0;4>b&&!(a.f[b]=a.f[b]+1|0,a.f[b]);b++);return a.A.encrypt(a.f)}function D(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);",
+ "a:try{var F,G,H,I;if(I=\"undefined\"!==typeof module){var J;if(J=module.exports){var K;try{K=require(\"crypto\")}catch(L){K=null}J=(G=K)&&G.randomBytes}I=J}if(I)F=G.randomBytes(128),F=new Uint32Array((new Uint8Array(F)).buffer),sjcl.random.addEntropy(F,1024,\"crypto['randomBytes']\");else if(\"undefined\"!==typeof window&&\"undefined\"!==typeof Uint32Array){H=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(H);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(H);",
+ "else break a;sjcl.random.addEntropy(H,1024,\"crypto['getRandomValues']\")}}catch(M){\"undefined\"!==typeof window&&window.console&&(console.log(\"There was an error collecting entropy from the browser:\"),console.log(M))}",
+ "sjcl.json={defaults:{v:1,iter:1E3,ks:128,ts:64,mode:\"ccm\",adata:\"\",cipher:\"aes\"},Y:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.e({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.e(f,c);c=f.adata;\"string\"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt));\"string\"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv));(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||\"string\"===typeof a&&100>=f.iter||64!==f.ts&&96!==f.ts&&128!==f.ts||128!==f.ks&&192!==f.ks&&0x100!==f.ks||2>f.iv.length||4<",
+ "f.iv.length)&&q(new sjcl.exception.invalid(\"json encrypt: invalid parameters\"));\"string\"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,f),a=g.key.slice(0,f.ks/32),f.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.publicKey&&(g=a.kem(),f.kemtag=g.tag,a=g.key.slice(0,f.ks/32));\"string\"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));\"string\"===typeof c&&(f.adata=c=sjcl.codec.utf8String.toBits(c));g=new sjcl.cipher[f.cipher](a);e.e(d,f);d.key=a;f.ct=sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return f},",
+ "encrypt:function(a,b,c,d){var e=sjcl.json,f=e.Y.apply(e,arguments);return e.encode(f)},X:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.e(e.e(e.e({},e.defaults),b),c,!0);var f,g;f=b.adata;\"string\"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt));\"string\"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv));(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||\"string\"===typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)&&",
+ "q(new sjcl.exception.invalid(\"json decrypt: invalid parameters\"));\"string\"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,b),a=g.key.slice(0,b.ks/32),b.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.secretKey&&(a=a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));\"string\"===typeof f&&(f=sjcl.codec.utf8String.toBits(f));g=new sjcl.cipher[b.cipher](a);f=sjcl.mode[b.mode].decrypt(g,b.ct,b.iv,f,b.ts);e.e(d,b);d.key=a;return 1===c.raw?f:sjcl.codec.utf8String.fromBits(f)},decrypt:function(a,b,",
+ "c,d){var e=sjcl.json;return e.X(a,e.decode(b),c,d)},encode:function(a){var b,c=\"{\",d=\"\";for(b in a)if(a.hasOwnProperty(b))switch(b.match(/^[a-z0-9]+$/i)||q(new sjcl.exception.invalid(\"json encode: invalid property name\")),c+=d+'\"'+b+'\":',d=\",\",typeof a[b]){case \"number\":case \"boolean\":c+=a[b];break;case \"string\":c+='\"'+escape(a[b])+'\"';break;case \"object\":c+='\"'+sjcl.codec.base64.fromBits(a[b],0)+'\"';break;default:q(new sjcl.exception.bug(\"json encode: unsupported type\"))}return c+\"}\"},decode:function(a){a=",
+ "a.replace(/\\s/g,\"\");a.match(/^\\{.*\\}$/)||q(new sjcl.exception.invalid(\"json decode: this isn't json!\"));a=a.replace(/^\\{|\\}$/g,\"\").split(/,/);var b={},c,d;for(c=0;c<a.length;c++)(d=a[c].match(/^\\s*(?:([\"']?)([a-z][a-z0-9]*)\\1)\\s*:\\s*(?:(-?\\d+)|\"([a-z0-9+\\/%*_.@=\\-]*)\"|(true|false))$/i))||q(new sjcl.exception.invalid(\"json decode: this isn't json!\")),d[3]?b[d[2]]=parseInt(d[3],10):d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):d[5]&&(b[d[2]]=\"true\"===",
+ "d[5]);return b},e:function(a,b,c){a===s&&(a={});if(b===s)return a;for(var d in b)b.hasOwnProperty(d)&&(c&&(a[d]!==s&&a[d]!==b[d])&&q(new sjcl.exception.invalid(\"required parameter overridden\")),a[d]=b[d]);return a},fa:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&a[d]!==b[d]&&(c[d]=a[d]);return c},ea:function(a,b){var c={},d;for(d=0;d<b.length;d++)a[b[d]]!==s&&(c[b[d]]=a[b[d]]);return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.ca={};",
+ "sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.ca,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=b.salt===s?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};");
+ }
- public string decrypt (string dKey, string data, string iv, string adata) {
- JavascriptContext context = new JavascriptContext();
+ public string decrypt(string dKey, string data, string iv, string adata)
+ {
+ JavascriptContext context = new JavascriptContext();
- context.SetParameter("derivedk", dKey);
- context.SetParameter("data", data);
- context.SetParameter("iv", iv);
- context.SetParameter("adata", adata);
+ context.SetParameter("derivedk", dKey);
+ context.SetParameter("data", data);
+ context.SetParameter("iv", iv);
+ context.SetParameter("adata", adata);
- string js = string.Concat(jssjcl,
- "var c = new sjcl.cipher.aes(sjcl.codec.hex.toBits(derivedk));",
- "var pt = sjcl.mode.ccm.decrypt(c, sjcl.codec.hex.toBits(data), sjcl.codec.hex.toBits(iv), sjcl.codec.hex.toBits(adata));",
- "pt = sjcl.codec.utf8String.fromBits(pt);");
+ string js = string.Concat(jssjcl,
+ "var c = new sjcl.cipher.aes(sjcl.codec.hex.toBits(derivedk));",
+ "var pt = sjcl.mode.ccm.decrypt(c, sjcl.codec.hex.toBits(data), sjcl.codec.hex.toBits(iv), sjcl.codec.hex.toBits(adata));",
+ "pt = sjcl.codec.utf8String.fromBits(pt);");
- context.Run(js);
- string response = context.GetParameter("pt") as string;
- context.TerminateExecution();
- context.Dispose();
- context = null;
- js = null;
+ context.Run(js);
+ string response = context.GetParameter("pt") as string;
+ context.TerminateExecution();
+ context.Dispose();
+ context = null;
+ js = null;
- return response;
- }
+ return response;
+ }
- public string encrypt (string dKey, string data, string iv, string adata) {
- JavascriptContext context = new JavascriptContext();
+ public string encrypt(string dKey, string data, string iv, string adata)
+ {
+ JavascriptContext context = new JavascriptContext();
- context.SetParameter("derivedk", dKey);
- context.SetParameter("data", data);
- context.SetParameter("iv", iv);
- context.SetParameter("adata", adata);
+ context.SetParameter("derivedk", dKey);
+ context.SetParameter("data", data);
+ context.SetParameter("iv", iv);
+ context.SetParameter("adata", adata);
- string js = string.Concat(jssjcl,
- "var c = new sjcl.cipher.aes(sjcl.codec.hex.toBits(derivedk));",
- "var ct = sjcl.mode.ccm.encrypt(c, sjcl.codec.utf8String.toBits(data), sjcl.codec.hex.toBits(iv), sjcl.codec.hex.toBits(adata));",
- "ct = sjcl.codec.hex.fromBits(ct);");
+ string js = string.Concat(jssjcl,
+ "var c = new sjcl.cipher.aes(sjcl.codec.hex.toBits(derivedk));",
+ "var ct = sjcl.mode.ccm.encrypt(c, sjcl.codec.utf8String.toBits(data), sjcl.codec.hex.toBits(iv), sjcl.codec.hex.toBits(adata));",
+ "ct = sjcl.codec.hex.fromBits(ct);");
- context.Run(js);
+ context.Run(js);
- string response = context.GetParameter("ct") as string;
- context.TerminateExecution();
- context.Dispose();
- context = null;
- js = null;
+ string response = context.GetParameter("ct") as string;
+ context.TerminateExecution();
+ context.Dispose();
+ context = null;
+ js = null;
- return response;
- }
- }
+ return response;
+ }
+ }
}
using System.Windows.Media;
using System.Xml;
-namespace SpeedportHybridControl.Implementations {
- public static class util {
- public static byte[] HexToByte (string hex) {
- return Enumerable.Range(0, hex.Length).Where(x => x % 2 == 0).Select(x => Convert.ToByte(hex.Substring(x, 2), 16)).ToArray();
- }
-
- /**
+namespace SpeedportHybridControl.Implementations
+{
+ public static class util
+ {
+ public static byte[] HexToByte(string hex)
+ {
+ return Enumerable.Range(0, hex.Length).Where(x => x % 2 == 0).Select(x => Convert.ToByte(hex.Substring(x, 2), 16)).ToArray();
+ }
+
+ /**
* get sha256
*
* @param string password
* @return string
*/
- public static string sha256 (this string password) {
- SHA256Managed crypt = new SHA256Managed();
- string hash = BitConverter.ToString(crypt.ComputeHash(Encoding.ASCII.GetBytes(password), 0, Encoding.ASCII.GetByteCount(password)));
- crypt = null;
- return hash.Replace("-", "").ToLower();
- }
-
- /**
+ public static string sha256(this string password)
+ {
+ SHA256Managed crypt = new SHA256Managed();
+ string hash = BitConverter.ToString(crypt.ComputeHash(Encoding.ASCII.GetBytes(password), 0, Encoding.ASCII.GetByteCount(password)));
+ crypt = null;
+ return hash.Replace("-", "").ToLower();
+ }
+
+ /**
* get pbkdf2
*
* @param string password
* @param int length
* @return string
*/
- public static string pbkdf2 (this string password, string salt, int iterations = 1000, int length = 16) {
- Rfc2898DeriveBytes hash = new Rfc2898DeriveBytes(password, Encoding.UTF8.GetBytes(salt), iterations);
- string derivedk = BitConverter.ToString(hash.GetBytes(length));
- hash = null;
- return derivedk.Replace("-", "").ToLower(); ;
- }
-
- /**
+ public static string pbkdf2(this string password, string salt, int iterations = 1000, int length = 16)
+ {
+ Rfc2898DeriveBytes hash = new Rfc2898DeriveBytes(password, Encoding.UTF8.GetBytes(salt), iterations);
+ string derivedk = BitConverter.ToString(hash.GetBytes(length));
+ hash = null;
+ return derivedk.Replace("-", "").ToLower(); ;
+ }
+
+ /**
* get specific value from JToken
*
* @param JToken jArray
* @param string varid
* @return string
*/
- public static string getVar (this JToken jArray, string varid) {
- foreach (JToken jToken in jArray) {
- JToken jVarid = jToken["varid"];
- if (jVarid.ToString().Equals(varid)) {
- jVarid = null;
- jArray = null;
- varid = null;
- return jToken["varvalue"].ToString();
- }
-
- jVarid = null;
- }
-
- jArray = null;
- varid = null;
-
- return string.Empty;
- }
-
- /**
+ public static string getVar(this JToken jArray, string varid)
+ {
+ foreach (JToken jToken in jArray)
+ {
+ JToken jVarid = jToken["varid"];
+ if (jVarid.ToString().Equals(varid))
+ {
+ jVarid = null;
+ jArray = null;
+ varid = null;
+ return jToken["varvalue"].ToString();
+ }
+
+ jVarid = null;
+ }
+
+ jArray = null;
+ varid = null;
+
+ return string.Empty;
+ }
+
+ /**
* check if string is empty or null
*
* @param string value
* @return bool
*/
- public static bool IsNullOrEmpty (this string value) {
- return string.IsNullOrEmpty(value);
- }
+ public static bool IsNullOrEmpty(this string value)
+ {
+ return string.IsNullOrEmpty(value);
+ }
- /**
+ /**
* convert string to int
*
* @param string value
* @return int
*/
- public static int ToInt (this string value) {
- int b = 0;
- int.TryParse(value, out b);
+ public static int ToInt(this string value)
+ {
+ int b = 0;
+ int.TryParse(value, out b);
- return b;
- }
+ return b;
+ }
- /**
+ /**
* calculate the background color for rsrp
* see http://www.lte-anbieter.info/technik/rsrp.php
*
* @param int rsrp
* @return Brush
*/
- public static Brush getRSRPColor (int rsrp) {
- if (rsrp >= -65) {
- return Brushes.DarkGreen;
- }
- else if (rsrp <= -66 && rsrp >= -83) {
- return Brushes.Green;
- }
- else if (rsrp <= -84 && rsrp >= -95) {
-
- return Brushes.Yellow;
- }
- else if (rsrp <= -96 && rsrp >= -105) {
- return Brushes.Orange;
- }
- else if (rsrp <= -106 && rsrp >= -125) {
- return Brushes.Red;
- }
- else if (rsrp >= -126) {
- return Brushes.DarkRed;
- }
-
- return Brushes.Transparent;
- }
-
- /**
+ public static Brush getRSRPColor(int rsrp)
+ {
+ if (rsrp >= -65)
+ {
+ return Brushes.DarkGreen;
+ }
+ else if (rsrp <= -66 && rsrp >= -83)
+ {
+ return Brushes.Green;
+ }
+ else if (rsrp <= -84 && rsrp >= -95)
+ {
+
+ return Brushes.Yellow;
+ }
+ else if (rsrp <= -96 && rsrp >= -105)
+ {
+ return Brushes.Orange;
+ }
+ else if (rsrp <= -106 && rsrp >= -125)
+ {
+ return Brushes.Red;
+ }
+ else if (rsrp >= -126)
+ {
+ return Brushes.DarkRed;
+ }
+
+ return Brushes.Transparent;
+ }
+
+ /**
* calculate the background color for rsrq
* see http://www.lte-anbieter.info/technik/rsrq.php
*
* @param int rsrp
* @return Brush
*/
- public static Brush getRSRQColor (int rsrq) {
- if (rsrq >= -3) {
- return Brushes.DarkGreen;
- }
- else if (rsrq <= -4 && rsrq >= -6) {
- return Brushes.Green;
- }
- else if (rsrq <= -7 && rsrq >= -8) {
- return Brushes.Yellow;
- }
- else if (rsrq <= -9 && rsrq >= -11) {
- return Brushes.Orange;
- }
- else if (rsrq <= -12 && rsrq >= -15) {
- return Brushes.Red;
- }
- else if (rsrq <= -16 && rsrq >= -20) {
- return Brushes.DarkRed;
- }
-
- return Brushes.Transparent;
- }
-
- /**
+ public static Brush getRSRQColor(int rsrq)
+ {
+ if (rsrq >= -3)
+ {
+ return Brushes.DarkGreen;
+ }
+ else if (rsrq <= -4 && rsrq >= -6)
+ {
+ return Brushes.Green;
+ }
+ else if (rsrq <= -7 && rsrq >= -8)
+ {
+ return Brushes.Yellow;
+ }
+ else if (rsrq <= -9 && rsrq >= -11)
+ {
+ return Brushes.Orange;
+ }
+ else if (rsrq <= -12 && rsrq >= -15)
+ {
+ return Brushes.Red;
+ }
+ else if (rsrq <= -16 && rsrq >= -20)
+ {
+ return Brushes.DarkRed;
+ }
+
+ return Brushes.Transparent;
+ }
+
+ /**
* check for update
*/
- public static bool checkUpdate (string currentVersion) {
- try {
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.Load("https://stricted.net/version.xml");
-
- string version = xmlDocument.DocumentElement["version"].InnerText;
- if (currentVersion.Equals(version).Equals(false)) {
- return true;
- }
- }
- catch (Exception ex) {
- Console.WriteLine(ex.Message);
- }
-
- return false;
- }
-
- public static bool checkInstalled (string c_name) {
- string displayName = string.Empty;
-
- string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
- RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
- if (key != null) {
- foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName))) {
- displayName = subkey.GetValue("DisplayName") as string;
-
- if (string.IsNullOrWhiteSpace(displayName).Equals(false) && displayName.Equals(c_name)) {
- return true;
- }
- }
- key.Close();
- }
-
- registryKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
- key = Registry.LocalMachine.OpenSubKey(registryKey);
- if (key != null) {
- foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName))) {
- displayName = subkey.GetValue("DisplayName") as string;
-
- if (string.IsNullOrWhiteSpace(displayName).Equals(false) && displayName.Equals(c_name)) {
- return true;
- }
- }
- key.Close();
- }
-
- return false;
- }
- }
+ public static bool checkUpdate(string currentVersion)
+ {
+ try
+ {
+ XmlDocument xmlDocument = new XmlDocument();
+ xmlDocument.Load("https://stricted.net/version.xml");
+
+ string version = xmlDocument.DocumentElement["version"].InnerText;
+ if (currentVersion.Equals(version).Equals(false))
+ {
+ return true;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ }
+
+ return false;
+ }
+
+ public static bool checkInstalled(string c_name)
+ {
+ string displayName = string.Empty;
+
+ string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
+ RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
+ if (key != null)
+ {
+ foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName)))
+ {
+ displayName = subkey.GetValue("DisplayName") as string;
+
+ if (string.IsNullOrWhiteSpace(displayName).Equals(false) && displayName.Equals(c_name))
+ {
+ return true;
+ }
+ }
+ key.Close();
+ }
+
+ registryKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
+ key = Registry.LocalMachine.OpenSubKey(registryKey);
+ if (key != null)
+ {
+ foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName)))
+ {
+ displayName = subkey.GetValue("DisplayName") as string;
+
+ if (string.IsNullOrWhiteSpace(displayName).Equals(false) && displayName.Equals(c_name))
+ {
+ return true;
+ }
+ }
+ key.Close();
+ }
+
+ return false;
+ }
+ }
}
using System.Windows;
-namespace SpeedportHybridControl {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application {
- }
+namespace SpeedportHybridControl
+{
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+ public partial class App : Application
+ {
+ }
}
using SpeedportHybridControl.PageModel;
using SpeedportHybridControl.Implementations;
-namespace SpeedportHybridControl.Data {
- public class SpeedportHybrid {
- public SpeedportHybrid() { }
-
- public static void initOverview () {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- OverviewPageModel overview = Application.Current.FindResource("OverviewPageModel") as OverviewPageModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/Overview.json");
- if (response.IsNullOrEmpty())
- return;
-
- JToken jArray = JToken.Parse(response);
- response = null;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
-
- string onlinestatus = jArray.getVar("onlinestatus");
- if (onlinestatus.Equals("offline")) {
- overview.onlinestatus = "DSL-Verbindung getrennt";
- }
- else if (onlinestatus.Equals("disabled")) {
- overview.onlinestatus = "DSL-Verbindung gesperrt";
- }
- else if (onlinestatus.Equals("online")) {
- overview.onlinestatus = "DSL-Verbindung aktiv";
- }
- else if (onlinestatus.Equals("fail")) {
- overview.onlinestatus = "DSL-Verbindung getrennt";
- }
- else {
- overview.onlinestatus = "DSL-Verbindung nicht eingerichtet";
- }
-
- if (jArray.getVar("dsl_link_status").Equals("online")) {
- overview.dsl_link_status = "DSL-Link synchron";
- }
- else {
- overview.dsl_link_status = "DSL-Link nicht synchron";
- }
-
- overview.lte_image = string.Concat("../assets/lte", jArray.getVar("lte_signal"), ".png");
-
- if (onlinestatus.Equals("online") || jArray.getVar("gre_status").Equals("1")) {
- bool chk = true;
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addipnumber")) {
- if (jToken["varvalue"].getVar("number_status").Equals("ok").Equals(false)) {
- chk = false;
- }
- }
-
- varid = null;
- }
-
- if (chk.Equals(true)) {
- overview.number_status = "Internet Telefonie aktiv";
- }
- else {
- overview.number_status = "Internet Telefonie aus";
- }
- }
- else {
- overview.number_status = "Telefonie nicht nutzbar";
- }
-
- if (jArray.getVar("use_dect").Equals("0")) {
- overview.use_dect = "DECT-Basisstation aus";
- }
- else {
- overview.use_dect = "DECT-Basisstation an";
- }
-
- int c = 0;
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("adddect")) {
- c++;
- }
-
- varid = null;
- }
-
- if (c.Equals(1)) {
- overview.dect_devices = "1 angemeldetes Schnurlostelefon";
- }
- else {
- overview.dect_devices = string.Concat(c.ToString(), " angemeldete Schnurlostelefone");
- }
-
- int wc = 0;
- if (jArray.getVar("use_wlan").Equals("1")) {
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addmdevice")) {
- if (jToken["varvalue"].getVar("mdevice_type").Equals("1") && jToken["varvalue"].getVar("mdevice_connected").Equals("1")) {
- wc++;
- }
- }
-
- varid = null;
- }
- }
-
- if (jArray.getVar("use_wlan_5ghz").Equals("1")) {
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addmdevice")) {
- if (jToken["varvalue"].getVar("mdevice_type").Equals("2") && jToken["varvalue"].getVar("mdevice_connected").Equals("1")) {
- wc++;
- }
- }
-
- varid = null;
- }
- }
-
- int lc = 0;
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addmdevice")) {
- if (jToken["varvalue"].getVar("mdevice_type").Equals("0") && jToken["varvalue"].getVar("mdevice_connected").Equals("1")) {
- lc++;
- }
- }
-
- varid = null;
- }
-
- int uc = 0;
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addotherdevice")) {
- if (jToken["varvalue"].getVar("nas_device_connection").Equals("USB")) {
- uc++;
- }
- }
-
- varid = null;
- }
-
- overview.devices = string.Concat(wc.ToString(), " an WLAN, ", lc.ToString(), " an LAN, ", uc.ToString(), " an USB");
-
- if (jArray.getVar("use_wlan").Equals("1")) {
- overview.use_wlan = "2,4-GHz-Frequenzband an";
- }
- else {
- overview.use_wlan = "2,4-GHz-Frequenzband aus";
- }
-
- if (jArray.getVar("use_wlan_5ghz").Equals("1")) {
- overview.use_wlan_5ghz = "5-GHz-Frequenzband an";
- }
- else {
- overview.use_wlan_5ghz = "5-GHz-Frequenzband aus";
- }
-
- if (jArray.getVar("wlan_enc").Equals("0")) {
- overview.wlan_enc = "WLAN unverschlüsselt";
- }
- else {
- overview.wlan_enc = "WLAN verschlüsselt";
- }
-
- if (jArray.getVar("wlan_power").Equals("0")) {
- overview.wlan_power = "Sendeleistung hoch";
- }
- else if (jArray.getVar("wlan_power").Equals("1")) {
- overview.wlan_power = "Sendeleistung mittel";
- }
- else {
- overview.wlan_power = "Sendeleistung niedrig";
- }
-
- int ec = 0;
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addotherdevice")) {
- if (jToken["varvalue"].getVar("nas_device_type").Equals("NAS")) {
- ec++;
- }
- }
-
- varid = null;
- }
-
- if (ec.Equals(1)) {
- overview.external_devices = "1 externer Datenträger verfügbar";
- }
- else {
- overview.external_devices = string.Concat(ec.ToString(), " externe Datenträger verfügbar");
- }
-
- if (jArray.getVar("nas_sync_active").Equals("true")) {
- overview.nas_sync_active = "Ordner synchronisieren an";
- }
- else {
- overview.nas_sync_active = "Ordner synchronisieren aus";
- }
-
- if (jArray.getVar("nas_backup_active").Equals("true")) {
- overview.nas_backup_active = "Daten sichern an";
- }
- else {
- overview.nas_backup_active = "Daten sichern aus";
- }
-
- if (jArray.getVar("mc_password").IsNullOrEmpty()) {
- overview.mc_state = "Verbindung mit Mediencenter nicht eingerichtet";
- }
- else {
- if (jArray.getVar("mc_allow_connect").Equals("0")) {
- overview.mc_state = "Verbindung mit Mediencenter nicht erlaubt";
- }
- else {
- if (jArray.getVar("mc_login_success").Equals("1")) {
- overview.mc_state = "Verbindung mit Mediencenter eingerichtet";
- }
- else {
- overview.mc_state = "Verbindung mit Mediencenter fehlgeschlagen";
- }
- }
- }
-
- // overview.days_online = ""; // TODO
-
- overview.datetime = time.ToString(format);
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initTR181 () {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- TR181PageModel tr181 = Application.Current.FindResource("TR181PageModel") as TR181PageModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_tr181.json");
- if (response.IsNullOrEmpty())
- return;
-
- TR181PageModel obj = JsonConvert.DeserializeObject<TR181PageModel>(response);
- response = null;
-
- tr181.enable1 = obj.enable1;
- tr181.status1 = obj.status1;
- tr181.mode = obj.mode;
- tr181.servername = obj.servername;
- tr181.severip = obj.severip;
- tr181.bw = obj.bw;
- tr181.errorinfo = obj.errorinfo;
- tr181.hellostatus = obj.hellostatus;
- tr181.QueueSkbTimeOut = obj.QueueSkbTimeOut;
-
- response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_tunnel.json");
-
- obj = JsonConvert.DeserializeObject<TR181PageModel>(response);
- response = null;
-
- tr181.lte_tunnel = obj.lte_tunnel;
- tr181.dsl_tunnel = obj.dsl_tunnel;
- tr181.bonding = obj.bonding;
-
- response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_client.json");
- bonding_client obj2 = JsonConvert.DeserializeObject<bonding_client>(response);
-
- tr181.bypass_up_bw = obj2.hybrid_show[4].bypass_up_bw;
- tr181.bypass_dw_bw = obj2.hybrid_show[4].bypass_dw_bw;
- tr181.bypass_up_rb = obj2.hybrid_show[4].bypass_up_rb;
- tr181.bypass_dw_rb = obj2.hybrid_show[4].bypass_dw_rb;
- tr181.bypass_check = obj2.hybrid_show[4].bypass_check;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- tr181.datetime = time.ToString(format);
-
- obj = null;
- obj2 = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initLTE () {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/lteinfo.json");
- if (response.IsNullOrEmpty())
- return;
-
- LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
- response = null;
-
- lte.imei = obj.imei;
- lte.imsi = obj.imsi;
- lte.device_status = obj.device_status;
- lte.card_status = obj.card_status;
- lte.antenna_mode = obj.antenna_mode;
-
- if (obj.antenna_mode.Equals("Antennal set to internal")) {
- lte.antenna_mode2 = "Inner";
- }
- else if (obj.antenna_mode.Equals("Antennal set to external")) {
- lte.antenna_mode2 = "Outer";
- }
- else {
- lte.antenna_mode2 = "Auto";
- }
-
- lte.phycellid = obj.phycellid;
- lte.cellid = obj.cellid;
- lte.rsrp = obj.rsrp;
- lte.rsrp_bg = util.getRSRPColor(obj.rsrp.ToInt());
- lte.rsrq = obj.rsrq;
- lte.rsrq_bg = util.getRSRQColor(obj.rsrq.ToInt());
- lte.service_status = obj.service_status;
- lte.tac = obj.tac;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- lte.datetime = time.ToString(format);
-
- initSyslog(true);
-
- obj = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initLtePopup () {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- ltepopupModel lte = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/lteinfo.json");
- if (response.IsNullOrEmpty())
- return;
-
- LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
- response = null;
-
- lte.phycellid = obj.phycellid;
- lte.cellid = obj.cellid;
- lte.rsrp = obj.rsrp;
- lte.rsrp_bg = util.getRSRPColor(obj.rsrp.ToInt());
- lte.rsrq = obj.rsrq;
- lte.rsrq_bg = util.getRSRQColor(obj.rsrq.ToInt());
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- lte.datetime = time.ToString(format);
-
- obj = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initDSL () {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- DslPageModel dsl = Application.Current.FindResource("DslPageModel") as DslPageModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/dsl.json");
- if (response.IsNullOrEmpty())
- return;
-
- try {
- DslPageModel obj = JsonConvert.DeserializeObject<DslPageModel>(response);
-
- double difference = Math.Ceiling((DateTime.Now - SpeedportHybridAPI.getInstance().getLastReboot()).TotalSeconds) / 60;
-
- obj.Line.uCRCsec = Math.Ceiling(obj.Line.uCRC / difference);
- obj.Line.dCRCsec = Math.Ceiling(obj.Line.dCRC / difference);
-
- obj.Line.uHECsec = Math.Ceiling(obj.Line.uHEC / difference);
- obj.Line.dHECsec = Math.Ceiling(obj.Line.dHEC / difference);
-
- obj.Line.uFECsec = Math.Ceiling(obj.Line.uFEC / difference);
- obj.Line.dFECsec = Math.Ceiling(obj.Line.dFEC / difference);
-
- dsl.Connection = obj.Connection;
- dsl.Line = obj.Line;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- dsl.datetime = time.ToString(format);
-
- obj = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- public static void initStatus() {
- try {
- StatusPageModel status = Application.Current.FindResource("StatusPageModel") as StatusPageModel;
- string response = SpeedportHybridAPI.getInstance().sendRequest("data/status.json");
- if (response.IsNullOrEmpty())
- return;
-
- JToken jArray = JToken.Parse(response);
- response = null;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- string ltesignal = jArray.getVar("lte_signal");
-
- status.device_name = jArray.getVar("device_name");
-
- if (jArray.getVar("use_lte").Equals("0")) {
- status.lte_status = "Deaktiviert";
- }
- else {
- if (jArray.getVar("lte_status").Equals("10") || jArray.getVar("lte_status").Equals("11")) {
- status.lte_status = "Aktiv";
- }
- else {
- status.lte_status = "Nicht aktiv";
- }
- }
-
- status.lte_signal = string.Concat(ltesignal.ToInt() * 20, " %");
- status.lte_image = string.Concat("../assets/lte", ltesignal, ".png");
- status.datetime = time.ToString(format);
- status.imei = jArray.getVar("imei");
-
- if (jArray.getVar("dsl_link_status").Equals("online")) {
- status.dsl_link_status = "Synchron";
- }
- else {
- status.dsl_link_status = "Nicht synchron"; // check size
- }
-
- if (jArray.getVar("status").Equals("online")) {
- status.status = "Aktiv";
- }
- else {
- status.status = "Getrennt";
- }
-
- status.dsl_downstream = string.Concat(jArray.getVar("dsl_downstream"), " kBit/s");
- status.dsl_upstream = string.Concat(jArray.getVar("dsl_upstream"), " kBit/s");
-
- List<StatusPhoneList> statusPhoneList = new List<StatusPhoneList>();
- status.addphonenumber = null;
-
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addphonenumber")) {
- string pnumber = jToken["varvalue"].getVar("phone_number");
- string pstatus = string.Empty;
- if (jToken["varvalue"].getVar("status").Equals("ok")) {
- pstatus = "Aktiv";
- }
- else {
- pstatus = "Nicht aktiv";
- }
-
- statusPhoneList.Add(new StatusPhoneList() { number = pnumber, status = pstatus });
- }
- }
-
- status.addphonenumber = statusPhoneList;
-
- if (jArray.getVar("use_dect").Equals("0")) {
- status.use_dect = "Nicht aktiv";
- }
- else {
- status.use_dect = "Aktiv";
- }
-
- int c = 0;
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("adddect")) {
- c++;
- }
- }
-
- status.dect_devices = c.ToString();
-
- status.wlan_ssid = jArray.getVar("wlan_ssid");
- status.wlan_5ghz_ssid = jArray.getVar("wlan_5ghz_ssid");
-
- if (jArray.getVar("use_wlan").Equals("0")) {
- status.use_wlan = "Aus";
- }
- else {
- status.use_wlan = "Eingeschaltet";
- }
-
- if (jArray.getVar("use_wlan_5ghz").Equals("0")) {
- status.use_wlan_5ghz = "Aus";
- }
- else {
- status.use_wlan_5ghz = "Eingeschaltet";
- }
-
- status.wlan_devices = jArray.getVar("wlan_devices");
- status.wlan_5ghz_devices = jArray.getVar("wlan_5ghz_devices");
- if (jArray.getVar("lan1_device").Equals("1")) {
- status.lan1_device = "../assets/check.png";
- }
- else {
- status.lan1_device = "../assets/x.png";
- }
-
- if (jArray.getVar("lan2_device").Equals("1")) {
- status.lan2_device = "../assets/check.png";
- }
- else {
- status.lan2_device = "../assets/x.png";
- }
-
- if (jArray.getVar("lan3_device").Equals("1")) {
- status.lan3_device = "../assets/check.png";
- }
- else {
- status.lan3_device = "../assets/x.png";
- }
-
- if (jArray.getVar("lan4_device").Equals("1")) {
- status.lan4_device = "../assets/check.png";
- }
- else {
- status.lan4_device = "../assets/x.png";
- }
-
- if (jArray.getVar("hsfon_status").Equals("2")) {
- status.hsfon_status = "Aktiv";
- }
- else {
- status.hsfon_status = "Aus";
- }
-
- status.firmware_version = jArray.getVar("firmware_version");
- status.serial_number = jArray.getVar("serial_number");
-
-
- double difference = (DateTime.Now - SpeedportHybridAPI.getInstance().getLastReboot()).TotalSeconds;
- TimeSpan uptime = TimeSpan.FromSeconds(difference);
- status.uptime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds);
-
- jArray = null;
- statusPhoneList = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initSyslog (bool isLTE = false) {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- SyslogPageModel syslog = Application.Current.FindResource("SyslogPageModel") as SyslogPageModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/SystemMessages.json");
- if (response.IsNullOrEmpty())
- return;
-
- JToken jArray = JToken.Parse(response);
- response = null;
-
- List<SyslogList> syslogList = new List<SyslogList>();
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addmessage")) {
- var a = jToken["varvalue"];
- var stamp = a[1]["varvalue"];
- var msg = a[2]["varvalue"];
-
- // login
- if (msg.ToString().Contains("(G101)").Equals(true))
- continue;
-
- // logout
- if (msg.ToString().Contains("(G102)").Equals(true))
- continue;
-
- // session timeout
- if (msg.ToString().Contains("(G103)").Equals(true))
- continue;
-
- // dnsv6 error
- if (msg.ToString().Contains("(P008)").Equals(true))
- continue;
-
- // Funkzellen Info
- if (msg.ToString().Contains("(LT004)") && isLTE.Equals(true)) {
- LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
-
- string[] parts = msg.ToString().Split(',');
- string frequenz = parts[2];
-
- if (frequenz.Equals("20")) {
- frequenz = "800 MHz";
- }
- else if (frequenz.Equals("3")) {
- frequenz = "1800 MHz";
- }
- else if (frequenz.Equals("7")) {
- frequenz = "2600 MHz";
- }
-
- lte.frequenz = frequenz;
-
- varid = null;
- jArray = null;
- a = null;
- stamp = null;
- msg = null;
- syslogList = null;
- return;
- }
-
- syslogList.Add(new SyslogList() { timestamp = stamp.ToString(), message = msg.ToString() });
-
- a = null;
- stamp = null;
- msg = null;
- }
- varid = null;
- }
-
- syslog.syslogList = syslogList;
- syslogList = null;
- jArray = null;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- syslog.datetime = time.ToString(format);
-
- syslog = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initPhone() {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- PhonePageModel phone = Application.Current.FindResource("PhonePageModel") as PhonePageModel;
-
- List<PhoneCallList> missedCalls = new List<PhoneCallList>();
- List<PhoneCallList> takenCalls = new List<PhoneCallList>();
- List<PhoneCallList> dialedCalls = new List<PhoneCallList>();
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/PhoneCalls.json");
- if (response.IsNullOrEmpty())
- return;
-
- JToken jArray = JToken.Parse(response);
- response = null;
-
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addmissedcalls")) {
- JToken a = jToken["varvalue"];
- int _id = a[0]["varvalue"].ToString().ToInt();
- string _date = a[1]["varvalue"].ToString();
- string _time = a[2]["varvalue"].ToString();
- string _who = a[3]["varvalue"].ToString();
-
- missedCalls.Add(new PhoneCallList() { id = _id, date = _date, time = _time, who = _who });
- a = null;
- _id = 0;
- _date = null;
- _time = null;
- _who = null;
- }
- else if (varid.ToString().Equals("addtakencalls")) {
- JToken a = jToken["varvalue"];
- int _id = a[0]["varvalue"].ToString().ToInt();
- string _date = a[1]["varvalue"].ToString();
- string _time = a[2]["varvalue"].ToString();
- string _who = a[3]["varvalue"].ToString();
- string _duration = a[4]["varvalue"].ToString();
-
- takenCalls.Add(new PhoneCallList() { id = _id, date = _date, time = _time, who = _who, duration = _duration });
- a = null;
- _id = 0;
- _date = null;
- _time = null;
- _who = null;
- _duration = null;
- }
- else if (varid.ToString().Equals("adddialedcalls")) {
- JToken a = jToken["varvalue"];
- int _id = a[0]["varvalue"].ToString().ToInt();
- string _date = a[1]["varvalue"].ToString();
- string _time = a[2]["varvalue"].ToString();
- string _who = a[3]["varvalue"].ToString();
- string _duration = a[4]["varvalue"].ToString();
-
- dialedCalls.Add(new PhoneCallList() { id = _id, date = _date, time = _time, who = _who, duration = _duration });
- a = null;
- _id = 0;
- _date = null;
- _time = null;
- _who = null;
- _duration = null;
- }
-
- varid = null;
- }
-
- // sort calls
- missedCalls.Sort((x, y) => y.id.CompareTo(x.id));
- takenCalls.Sort((x, y) => y.id.CompareTo(x.id));
- dialedCalls.Sort((x, y) => y.id.CompareTo(x.id));
-
- missedCalls.OrderBy(x => x.time).ThenBy(x => x.date);
-
- phone.missedCalls = missedCalls;
- phone.takenCalls = takenCalls;
- phone.dialedCalls = dialedCalls;
-
- missedCalls = null;
- takenCalls = null;
- dialedCalls = null;
- jArray = null;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- phone.datetime = time.ToString(format);
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initLan () {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- LanPageModel deviceData = Application.Current.FindResource("LanPageModel") as LanPageModel;
-
- List<DeviceList> deviceList = new List<DeviceList>();
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/LAN.json");
- if (response.IsNullOrEmpty())
- return;
-
- JToken jArray = JToken.Parse(response);
- response = null;
-
- string ipv6_prefix = jArray.getVar("lan_ip_v6_prefix");
- string ipv6_range = jArray.getVar("lan_ip_v6_range");
-
- foreach (JToken jToken in jArray) {
- JToken varid = jToken["varid"];
- if (varid.ToString().Equals("addmdevice")) {
- int id = jToken["varvalue"].getVar("id").ToInt();
- string name = jToken["varvalue"].getVar("mdevice_name");
- string mac = jToken["varvalue"].getVar("mdevice_mac");
- int type = jToken["varvalue"].getVar("mdevice_type").ToInt(); // 0 = lan, 1/2 = wlan
- int connected = jToken["varvalue"].getVar("mdevice_connected").ToInt();
- string ipv4 = jToken["varvalue"].getVar("mdevice_ipv4");
- string ipv6 = jToken["varvalue"].getVar("mdevice_ipv6");
- int mstatic = jToken["varvalue"].getVar("mdevice_static").ToInt();
-
- ipv6 = string.Concat(ipv6_prefix, ipv6_range, ":", ipv6);
-
- deviceList.Add(new DeviceList() { id = id, name = name, mac = mac, type = type, connected = connected, ipv4 = ipv4, ipv6 = ipv6, mstatic = mstatic });
-
- id = 0;
- name = null;
- mac = null;
- type = 0;
- connected = 0;
- ipv4 = null;
- ipv6 = null;
- mstatic = 0;
- }
-
- varid = null;
- }
-
- deviceData.deviceList = deviceList;
-
- jArray = null;
- ipv6_prefix = null;
- ipv6_range = null;
- deviceList = null;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- deviceData.datetime = time.ToString(format);
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
-
- public static void initInterface () {
- try {
- if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
- return;
-
- InterfacePageModel IPM = Application.Current.FindResource("InterfacePageModel") as InterfacePageModel;
-
- string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/interfaces.json");
- if (response.IsNullOrEmpty())
- return;
-
- JToken jArray = JToken.Parse(response);
- response = null;
-
- List<InterfaceList> interfaceList = new List<InterfaceList>();
- foreach (JToken jToken in jArray.SelectToken("line_status")) {
- string ifc = jToken.SelectToken("interface").ToString();
- string mtu = jToken.SelectToken("MTU").ToString();
- string tx_packets = jToken.SelectToken("tx_packets").ToString();
- string tx_errors = jToken.SelectToken("tx_errors").ToString();
- string rx_packets = jToken.SelectToken("rx_packets").ToString();
- string rx_errors = jToken.SelectToken("rx_errors").ToString();
- string collisions = jToken.SelectToken("collisions").ToString();
-
- interfaceList.Add(new InterfaceList() { ifc = ifc, mtu = mtu, tx_packets = tx_packets, tx_errors = tx_errors, rx_packets = rx_packets, rx_errors = rx_errors, collisions = collisions });
- }
-
- IPM.interfaceList = interfaceList;
-
- interfaceList = null;
- jArray = null;
-
- DateTime time = DateTime.Now;
- string format = "dd.MM.yyyy HH:mm:ss";
- IPM.datetime = time.ToString(format);
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- }
- }
+namespace SpeedportHybridControl.Data
+{
+ public class SpeedportHybrid
+ {
+ public SpeedportHybrid() { }
+
+ public static void initOverview()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ OverviewPageModel overview = Application.Current.FindResource("OverviewPageModel") as OverviewPageModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/Overview.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+
+ string onlinestatus = jArray.getVar("onlinestatus");
+ if (onlinestatus.Equals("offline"))
+ {
+ overview.onlinestatus = "DSL-Verbindung getrennt";
+ }
+ else if (onlinestatus.Equals("disabled"))
+ {
+ overview.onlinestatus = "DSL-Verbindung gesperrt";
+ }
+ else if (onlinestatus.Equals("online"))
+ {
+ overview.onlinestatus = "DSL-Verbindung aktiv";
+ }
+ else if (onlinestatus.Equals("fail"))
+ {
+ overview.onlinestatus = "DSL-Verbindung getrennt";
+ }
+ else {
+ overview.onlinestatus = "DSL-Verbindung nicht eingerichtet";
+ }
+
+ if (jArray.getVar("dsl_link_status").Equals("online"))
+ {
+ overview.dsl_link_status = "DSL-Link synchron";
+ }
+ else {
+ overview.dsl_link_status = "DSL-Link nicht synchron";
+ }
+
+ overview.lte_image = string.Concat("../assets/lte", jArray.getVar("lte_signal"), ".png");
+
+ if (onlinestatus.Equals("online") || jArray.getVar("gre_status").Equals("1"))
+ {
+ bool chk = true;
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addipnumber"))
+ {
+ if (jToken["varvalue"].getVar("number_status").Equals("ok").Equals(false))
+ {
+ chk = false;
+ }
+ }
+
+ varid = null;
+ }
+
+ if (chk.Equals(true))
+ {
+ overview.number_status = "Internet Telefonie aktiv";
+ }
+ else {
+ overview.number_status = "Internet Telefonie aus";
+ }
+ }
+ else {
+ overview.number_status = "Telefonie nicht nutzbar";
+ }
+
+ if (jArray.getVar("use_dect").Equals("0"))
+ {
+ overview.use_dect = "DECT-Basisstation aus";
+ }
+ else {
+ overview.use_dect = "DECT-Basisstation an";
+ }
+
+ int c = 0;
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("adddect"))
+ {
+ c++;
+ }
+
+ varid = null;
+ }
+
+ if (c.Equals(1))
+ {
+ overview.dect_devices = "1 angemeldetes Schnurlostelefon";
+ }
+ else {
+ overview.dect_devices = string.Concat(c.ToString(), " angemeldete Schnurlostelefone");
+ }
+
+ int wc = 0;
+ if (jArray.getVar("use_wlan").Equals("1"))
+ {
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addmdevice"))
+ {
+ if (jToken["varvalue"].getVar("mdevice_type").Equals("1") && jToken["varvalue"].getVar("mdevice_connected").Equals("1"))
+ {
+ wc++;
+ }
+ }
+
+ varid = null;
+ }
+ }
+
+ if (jArray.getVar("use_wlan_5ghz").Equals("1"))
+ {
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addmdevice"))
+ {
+ if (jToken["varvalue"].getVar("mdevice_type").Equals("2") && jToken["varvalue"].getVar("mdevice_connected").Equals("1"))
+ {
+ wc++;
+ }
+ }
+
+ varid = null;
+ }
+ }
+
+ int lc = 0;
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addmdevice"))
+ {
+ if (jToken["varvalue"].getVar("mdevice_type").Equals("0") && jToken["varvalue"].getVar("mdevice_connected").Equals("1"))
+ {
+ lc++;
+ }
+ }
+
+ varid = null;
+ }
+
+ int uc = 0;
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addotherdevice"))
+ {
+ if (jToken["varvalue"].getVar("nas_device_connection").Equals("USB"))
+ {
+ uc++;
+ }
+ }
+
+ varid = null;
+ }
+
+ overview.devices = string.Concat(wc.ToString(), " an WLAN, ", lc.ToString(), " an LAN, ", uc.ToString(), " an USB");
+
+ if (jArray.getVar("use_wlan").Equals("1"))
+ {
+ overview.use_wlan = "2,4-GHz-Frequenzband an";
+ }
+ else {
+ overview.use_wlan = "2,4-GHz-Frequenzband aus";
+ }
+
+ if (jArray.getVar("use_wlan_5ghz").Equals("1"))
+ {
+ overview.use_wlan_5ghz = "5-GHz-Frequenzband an";
+ }
+ else {
+ overview.use_wlan_5ghz = "5-GHz-Frequenzband aus";
+ }
+
+ if (jArray.getVar("wlan_enc").Equals("0"))
+ {
+ overview.wlan_enc = "WLAN unverschlüsselt";
+ }
+ else {
+ overview.wlan_enc = "WLAN verschlüsselt";
+ }
+
+ if (jArray.getVar("wlan_power").Equals("0"))
+ {
+ overview.wlan_power = "Sendeleistung hoch";
+ }
+ else if (jArray.getVar("wlan_power").Equals("1"))
+ {
+ overview.wlan_power = "Sendeleistung mittel";
+ }
+ else {
+ overview.wlan_power = "Sendeleistung niedrig";
+ }
+
+ int ec = 0;
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addotherdevice"))
+ {
+ if (jToken["varvalue"].getVar("nas_device_type").Equals("NAS"))
+ {
+ ec++;
+ }
+ }
+
+ varid = null;
+ }
+
+ if (ec.Equals(1))
+ {
+ overview.external_devices = "1 externer Datenträger verfügbar";
+ }
+ else {
+ overview.external_devices = string.Concat(ec.ToString(), " externe Datenträger verfügbar");
+ }
+
+ if (jArray.getVar("nas_sync_active").Equals("true"))
+ {
+ overview.nas_sync_active = "Ordner synchronisieren an";
+ }
+ else {
+ overview.nas_sync_active = "Ordner synchronisieren aus";
+ }
+
+ if (jArray.getVar("nas_backup_active").Equals("true"))
+ {
+ overview.nas_backup_active = "Daten sichern an";
+ }
+ else {
+ overview.nas_backup_active = "Daten sichern aus";
+ }
+
+ if (jArray.getVar("mc_password").IsNullOrEmpty())
+ {
+ overview.mc_state = "Verbindung mit Mediencenter nicht eingerichtet";
+ }
+ else {
+ if (jArray.getVar("mc_allow_connect").Equals("0"))
+ {
+ overview.mc_state = "Verbindung mit Mediencenter nicht erlaubt";
+ }
+ else {
+ if (jArray.getVar("mc_login_success").Equals("1"))
+ {
+ overview.mc_state = "Verbindung mit Mediencenter eingerichtet";
+ }
+ else {
+ overview.mc_state = "Verbindung mit Mediencenter fehlgeschlagen";
+ }
+ }
+ }
+
+ // overview.days_online = ""; // TODO
+
+ overview.datetime = time.ToString(format);
+
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initTR181()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ TR181PageModel tr181 = Application.Current.FindResource("TR181PageModel") as TR181PageModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_tr181.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ TR181PageModel obj = JsonConvert.DeserializeObject<TR181PageModel>(response);
+ response = null;
+
+ tr181.enable1 = obj.enable1;
+ tr181.status1 = obj.status1;
+ tr181.mode = obj.mode;
+ tr181.servername = obj.servername;
+ tr181.severip = obj.severip;
+ tr181.bw = obj.bw;
+ tr181.errorinfo = obj.errorinfo;
+ tr181.hellostatus = obj.hellostatus;
+ tr181.QueueSkbTimeOut = obj.QueueSkbTimeOut;
+
+ response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_tunnel.json");
+
+ obj = JsonConvert.DeserializeObject<TR181PageModel>(response);
+ response = null;
+
+ tr181.lte_tunnel = obj.lte_tunnel;
+ tr181.dsl_tunnel = obj.dsl_tunnel;
+ tr181.bonding = obj.bonding;
+
+ response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_client.json");
+ bonding_client obj2 = JsonConvert.DeserializeObject<bonding_client>(response);
+
+ tr181.bypass_up_bw = obj2.hybrid_show[4].bypass_up_bw;
+ tr181.bypass_dw_bw = obj2.hybrid_show[4].bypass_dw_bw;
+ tr181.bypass_up_rb = obj2.hybrid_show[4].bypass_up_rb;
+ tr181.bypass_dw_rb = obj2.hybrid_show[4].bypass_dw_rb;
+ tr181.bypass_check = obj2.hybrid_show[4].bypass_check;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ tr181.datetime = time.ToString(format);
+
+ obj = null;
+ obj2 = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initLTE()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/lteinfo.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
+ response = null;
+
+ lte.imei = obj.imei;
+ lte.imsi = obj.imsi;
+ lte.device_status = obj.device_status;
+ lte.card_status = obj.card_status;
+ lte.antenna_mode = obj.antenna_mode;
+
+ if (obj.antenna_mode.Equals("Antennal set to internal"))
+ {
+ lte.antenna_mode2 = "Inner";
+ }
+ else if (obj.antenna_mode.Equals("Antennal set to external"))
+ {
+ lte.antenna_mode2 = "Outer";
+ }
+ else {
+ lte.antenna_mode2 = "Auto";
+ }
+
+ lte.phycellid = obj.phycellid;
+ lte.cellid = obj.cellid;
+ lte.rsrp = obj.rsrp;
+ lte.rsrp_bg = util.getRSRPColor(obj.rsrp.ToInt());
+ lte.rsrq = obj.rsrq;
+ lte.rsrq_bg = util.getRSRQColor(obj.rsrq.ToInt());
+ lte.service_status = obj.service_status;
+ lte.tac = obj.tac;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ lte.datetime = time.ToString(format);
+
+ initSyslog(true);
+
+ obj = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initLtePopup()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ ltepopupModel lte = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/lteinfo.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
+ response = null;
+
+ lte.phycellid = obj.phycellid;
+ lte.cellid = obj.cellid;
+ lte.rsrp = obj.rsrp;
+ lte.rsrp_bg = util.getRSRPColor(obj.rsrp.ToInt());
+ lte.rsrq = obj.rsrq;
+ lte.rsrq_bg = util.getRSRQColor(obj.rsrq.ToInt());
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ lte.datetime = time.ToString(format);
+
+ obj = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initDSL()
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ DslPageModel dsl = Application.Current.FindResource("DslPageModel") as DslPageModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/dsl.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ try
+ {
+ DslPageModel obj = JsonConvert.DeserializeObject<DslPageModel>(response);
+
+ double difference = Math.Ceiling((DateTime.Now - SpeedportHybridAPI.getInstance().getLastReboot()).TotalSeconds) / 60;
+
+ obj.Line.uCRCsec = Math.Ceiling(obj.Line.uCRC / difference);
+ obj.Line.dCRCsec = Math.Ceiling(obj.Line.dCRC / difference);
+
+ obj.Line.uHECsec = Math.Ceiling(obj.Line.uHEC / difference);
+ obj.Line.dHECsec = Math.Ceiling(obj.Line.dHEC / difference);
+
+ obj.Line.uFECsec = Math.Ceiling(obj.Line.uFEC / difference);
+ obj.Line.dFECsec = Math.Ceiling(obj.Line.dFEC / difference);
+
+ dsl.Connection = obj.Connection;
+ dsl.Line = obj.Line;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ dsl.datetime = time.ToString(format);
+
+ obj = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ public static void initStatus()
+ {
+ try
+ {
+ StatusPageModel status = Application.Current.FindResource("StatusPageModel") as StatusPageModel;
+ string response = SpeedportHybridAPI.getInstance().sendRequest("data/status.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ string ltesignal = jArray.getVar("lte_signal");
+
+ status.device_name = jArray.getVar("device_name");
+
+ if (jArray.getVar("use_lte").Equals("0"))
+ {
+ status.lte_status = "Deaktiviert";
+ }
+ else {
+ if (jArray.getVar("lte_status").Equals("10") || jArray.getVar("lte_status").Equals("11"))
+ {
+ status.lte_status = "Aktiv";
+ }
+ else {
+ status.lte_status = "Nicht aktiv";
+ }
+ }
+
+ status.lte_signal = string.Concat(ltesignal.ToInt() * 20, " %");
+ status.lte_image = string.Concat("../assets/lte", ltesignal, ".png");
+ status.datetime = time.ToString(format);
+ status.imei = jArray.getVar("imei");
+
+ if (jArray.getVar("dsl_link_status").Equals("online"))
+ {
+ status.dsl_link_status = "Synchron";
+ }
+ else {
+ status.dsl_link_status = "Nicht synchron"; // check size
+ }
+
+ if (jArray.getVar("status").Equals("online"))
+ {
+ status.status = "Aktiv";
+ }
+ else {
+ status.status = "Getrennt";
+ }
+
+ status.dsl_downstream = string.Concat(jArray.getVar("dsl_downstream"), " kBit/s");
+ status.dsl_upstream = string.Concat(jArray.getVar("dsl_upstream"), " kBit/s");
+
+ List<StatusPhoneList> statusPhoneList = new List<StatusPhoneList>();
+ status.addphonenumber = null;
+
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addphonenumber"))
+ {
+ string pnumber = jToken["varvalue"].getVar("phone_number");
+ string pstatus = string.Empty;
+ if (jToken["varvalue"].getVar("status").Equals("ok"))
+ {
+ pstatus = "Aktiv";
+ }
+ else {
+ pstatus = "Nicht aktiv";
+ }
+
+ statusPhoneList.Add(new StatusPhoneList() { number = pnumber, status = pstatus });
+ }
+ }
+
+ status.addphonenumber = statusPhoneList;
+
+ if (jArray.getVar("use_dect").Equals("0"))
+ {
+ status.use_dect = "Nicht aktiv";
+ }
+ else {
+ status.use_dect = "Aktiv";
+ }
+
+ int c = 0;
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("adddect"))
+ {
+ c++;
+ }
+ }
+
+ status.dect_devices = c.ToString();
+
+ status.wlan_ssid = jArray.getVar("wlan_ssid");
+ status.wlan_5ghz_ssid = jArray.getVar("wlan_5ghz_ssid");
+
+ if (jArray.getVar("use_wlan").Equals("0"))
+ {
+ status.use_wlan = "Aus";
+ }
+ else {
+ status.use_wlan = "Eingeschaltet";
+ }
+
+ if (jArray.getVar("use_wlan_5ghz").Equals("0"))
+ {
+ status.use_wlan_5ghz = "Aus";
+ }
+ else {
+ status.use_wlan_5ghz = "Eingeschaltet";
+ }
+
+ status.wlan_devices = jArray.getVar("wlan_devices");
+ status.wlan_5ghz_devices = jArray.getVar("wlan_5ghz_devices");
+ if (jArray.getVar("lan1_device").Equals("1"))
+ {
+ status.lan1_device = "../assets/check.png";
+ }
+ else {
+ status.lan1_device = "../assets/x.png";
+ }
+
+ if (jArray.getVar("lan2_device").Equals("1"))
+ {
+ status.lan2_device = "../assets/check.png";
+ }
+ else {
+ status.lan2_device = "../assets/x.png";
+ }
+
+ if (jArray.getVar("lan3_device").Equals("1"))
+ {
+ status.lan3_device = "../assets/check.png";
+ }
+ else {
+ status.lan3_device = "../assets/x.png";
+ }
+
+ if (jArray.getVar("lan4_device").Equals("1"))
+ {
+ status.lan4_device = "../assets/check.png";
+ }
+ else {
+ status.lan4_device = "../assets/x.png";
+ }
+
+ if (jArray.getVar("hsfon_status").Equals("2"))
+ {
+ status.hsfon_status = "Aktiv";
+ }
+ else {
+ status.hsfon_status = "Aus";
+ }
+
+ status.firmware_version = jArray.getVar("firmware_version");
+ status.serial_number = jArray.getVar("serial_number");
+
+
+ double difference = (DateTime.Now - SpeedportHybridAPI.getInstance().getLastReboot()).TotalSeconds;
+ TimeSpan uptime = TimeSpan.FromSeconds(difference);
+ status.uptime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds);
+
+ jArray = null;
+ statusPhoneList = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initSyslog(bool isLTE = false)
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ SyslogPageModel syslog = Application.Current.FindResource("SyslogPageModel") as SyslogPageModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/SystemMessages.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ List<SyslogList> syslogList = new List<SyslogList>();
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addmessage"))
+ {
+ var a = jToken["varvalue"];
+ var stamp = a[1]["varvalue"];
+ var msg = a[2]["varvalue"];
+
+ // login
+ if (msg.ToString().Contains("(G101)").Equals(true))
+ continue;
+
+ // logout
+ if (msg.ToString().Contains("(G102)").Equals(true))
+ continue;
+
+ // session timeout
+ if (msg.ToString().Contains("(G103)").Equals(true))
+ continue;
+
+ // dnsv6 error
+ if (msg.ToString().Contains("(P008)").Equals(true))
+ continue;
+
+ // Funkzellen Info
+ if (msg.ToString().Contains("(LT004)") && isLTE.Equals(true))
+ {
+ LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
+
+ string[] parts = msg.ToString().Split(',');
+ string frequenz = parts[2];
+
+ if (frequenz.Equals("20"))
+ {
+ frequenz = "800 MHz";
+ }
+ else if (frequenz.Equals("3"))
+ {
+ frequenz = "1800 MHz";
+ }
+ else if (frequenz.Equals("7"))
+ {
+ frequenz = "2600 MHz";
+ }
+
+ lte.frequenz = frequenz;
+
+ varid = null;
+ jArray = null;
+ a = null;
+ stamp = null;
+ msg = null;
+ syslogList = null;
+ return;
+ }
+
+ syslogList.Add(new SyslogList() { timestamp = stamp.ToString(), message = msg.ToString() });
+
+ a = null;
+ stamp = null;
+ msg = null;
+ }
+ varid = null;
+ }
+
+ syslog.syslogList = syslogList;
+ syslogList = null;
+ jArray = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ syslog.datetime = time.ToString(format);
+
+ syslog = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initPhone()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ PhonePageModel phone = Application.Current.FindResource("PhonePageModel") as PhonePageModel;
+
+ List<PhoneCallList> missedCalls = new List<PhoneCallList>();
+ List<PhoneCallList> takenCalls = new List<PhoneCallList>();
+ List<PhoneCallList> dialedCalls = new List<PhoneCallList>();
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/PhoneCalls.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addmissedcalls"))
+ {
+ JToken a = jToken["varvalue"];
+ int _id = a[0]["varvalue"].ToString().ToInt();
+ string _date = a[1]["varvalue"].ToString();
+ string _time = a[2]["varvalue"].ToString();
+ string _who = a[3]["varvalue"].ToString();
+
+ missedCalls.Add(new PhoneCallList() { id = _id, date = _date, time = _time, who = _who });
+ a = null;
+ _id = 0;
+ _date = null;
+ _time = null;
+ _who = null;
+ }
+ else if (varid.ToString().Equals("addtakencalls"))
+ {
+ JToken a = jToken["varvalue"];
+ int _id = a[0]["varvalue"].ToString().ToInt();
+ string _date = a[1]["varvalue"].ToString();
+ string _time = a[2]["varvalue"].ToString();
+ string _who = a[3]["varvalue"].ToString();
+ string _duration = a[4]["varvalue"].ToString();
+
+ takenCalls.Add(new PhoneCallList() { id = _id, date = _date, time = _time, who = _who, duration = _duration });
+ a = null;
+ _id = 0;
+ _date = null;
+ _time = null;
+ _who = null;
+ _duration = null;
+ }
+ else if (varid.ToString().Equals("adddialedcalls"))
+ {
+ JToken a = jToken["varvalue"];
+ int _id = a[0]["varvalue"].ToString().ToInt();
+ string _date = a[1]["varvalue"].ToString();
+ string _time = a[2]["varvalue"].ToString();
+ string _who = a[3]["varvalue"].ToString();
+ string _duration = a[4]["varvalue"].ToString();
+
+ dialedCalls.Add(new PhoneCallList() { id = _id, date = _date, time = _time, who = _who, duration = _duration });
+ a = null;
+ _id = 0;
+ _date = null;
+ _time = null;
+ _who = null;
+ _duration = null;
+ }
+
+ varid = null;
+ }
+
+ // sort calls
+ missedCalls.Sort((x, y) => y.id.CompareTo(x.id));
+ takenCalls.Sort((x, y) => y.id.CompareTo(x.id));
+ dialedCalls.Sort((x, y) => y.id.CompareTo(x.id));
+
+ missedCalls.OrderBy(x => x.time).ThenBy(x => x.date);
+
+ phone.missedCalls = missedCalls;
+ phone.takenCalls = takenCalls;
+ phone.dialedCalls = dialedCalls;
+
+ missedCalls = null;
+ takenCalls = null;
+ dialedCalls = null;
+ jArray = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ phone.datetime = time.ToString(format);
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initLan()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ LanPageModel deviceData = Application.Current.FindResource("LanPageModel") as LanPageModel;
+
+ List<DeviceList> deviceList = new List<DeviceList>();
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/LAN.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ string ipv6_prefix = jArray.getVar("lan_ip_v6_prefix");
+ string ipv6_range = jArray.getVar("lan_ip_v6_range");
+
+ foreach (JToken jToken in jArray)
+ {
+ JToken varid = jToken["varid"];
+ if (varid.ToString().Equals("addmdevice"))
+ {
+ int id = jToken["varvalue"].getVar("id").ToInt();
+ string name = jToken["varvalue"].getVar("mdevice_name");
+ string mac = jToken["varvalue"].getVar("mdevice_mac");
+ int type = jToken["varvalue"].getVar("mdevice_type").ToInt(); // 0 = lan, 1/2 = wlan
+ int connected = jToken["varvalue"].getVar("mdevice_connected").ToInt();
+ string ipv4 = jToken["varvalue"].getVar("mdevice_ipv4");
+ string ipv6 = jToken["varvalue"].getVar("mdevice_ipv6");
+ int mstatic = jToken["varvalue"].getVar("mdevice_static").ToInt();
+
+ ipv6 = string.Concat(ipv6_prefix, ipv6_range, ":", ipv6);
+
+ deviceList.Add(new DeviceList() { id = id, name = name, mac = mac, type = type, connected = connected, ipv4 = ipv4, ipv6 = ipv6, mstatic = mstatic });
+
+ id = 0;
+ name = null;
+ mac = null;
+ type = 0;
+ connected = 0;
+ ipv4 = null;
+ ipv6 = null;
+ mstatic = 0;
+ }
+
+ varid = null;
+ }
+
+ deviceData.deviceList = deviceList;
+
+ jArray = null;
+ ipv6_prefix = null;
+ ipv6_range = null;
+ deviceList = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ deviceData.datetime = time.ToString(format);
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+
+ public static void initInterface()
+ {
+ try
+ {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ InterfacePageModel IPM = Application.Current.FindResource("InterfacePageModel") as InterfacePageModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/interfaces.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ List<InterfaceList> interfaceList = new List<InterfaceList>();
+ foreach (JToken jToken in jArray.SelectToken("line_status"))
+ {
+ string ifc = jToken.SelectToken("interface").ToString();
+ string mtu = jToken.SelectToken("MTU").ToString();
+ string tx_packets = jToken.SelectToken("tx_packets").ToString();
+ string tx_errors = jToken.SelectToken("tx_errors").ToString();
+ string rx_packets = jToken.SelectToken("rx_packets").ToString();
+ string rx_errors = jToken.SelectToken("rx_errors").ToString();
+ string collisions = jToken.SelectToken("collisions").ToString();
+
+ interfaceList.Add(new InterfaceList() { ifc = ifc, mtu = mtu, tx_packets = tx_packets, tx_errors = tx_errors, rx_packets = rx_packets, rx_errors = rx_errors, collisions = collisions });
+ }
+
+ IPM.interfaceList = interfaceList;
+
+ interfaceList = null;
+ jArray = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ IPM.datetime = time.ToString(format);
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
+ }
}
using Newtonsoft.Json;
using SpeedportHybridControl.PageModel;
-namespace SpeedportHybridControl.Data {
- public class SpeedportHybridAPI : SingletonFactory<SpeedportHybridAPI> {
- public string _ip = "speedport.ip";
- private DateTime _lastReboot = DateTime.MinValue;
- private bool _checkIsActive = false;
- public string _password;
- public string _challenge;
- public string _hash;
- public string _derivedk;
- public CookieContainer _cookie = new CookieContainer();
-
- public string ip {
- get { return _ip; }
- set { _ip = value; }
- }
-
- /**
+namespace SpeedportHybridControl.Data
+{
+ public class SpeedportHybridAPI : SingletonFactory<SpeedportHybridAPI>
+ {
+ public string _ip = "speedport.ip";
+ private DateTime _lastReboot = DateTime.MinValue;
+ private bool _checkIsActive = false;
+ public string _password;
+ public string _challenge;
+ public string _hash;
+ public string _derivedk;
+ public CookieContainer _cookie = new CookieContainer();
+
+ public string ip
+ {
+ get { return _ip; }
+ set { _ip = value; }
+ }
+
+ /**
* Requests the password-challenge from the router.
*
* @return string
*/
- public string getChallenge () {
- string response = sendRequest("data/Login.json", "csrf_token=nulltoken&showpw=0&challengev=null");
- if (response.IsNullOrEmpty())
- return string.Empty;
-
- string challenge = string.Empty;
- try {
- JToken jArray = JToken.Parse(response);
-
- challenge = jArray.getVar("challengev");
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
-
- return challenge;
- }
-
- /**
+ public string getChallenge()
+ {
+ string response = sendRequest("data/Login.json", "csrf_token=nulltoken&showpw=0&challengev=null");
+ if (response.IsNullOrEmpty())
+ return string.Empty;
+
+ string challenge = string.Empty;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+
+ challenge = jArray.getVar("challengev");
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+
+ return challenge;
+ }
+
+ /**
* calculate the derivedk
*
* @param string $password
* @return string
*/
- public string getDerviedk () {
- return _password.sha256().pbkdf2(_challenge.Substring(0, 16));
- }
+ public string getDerviedk()
+ {
+ return _password.sha256().pbkdf2(_challenge.Substring(0, 16));
+ }
- /**
+ /**
* login into the router with the given password
*
* @param string $password
* @return bool
*/
- public bool login (string password) {
- if (password.IsNullOrEmpty()) {
- return false;
- }
-
- _cookie = new CookieContainer();
-
- _password = password;
- _challenge = getChallenge();
- _hash = string.Concat(_challenge, ":", password).sha256();
-
- string response = sendRequest("data/Login.json", string.Concat("csrf_token=nulltoken&showpw=0&password=", _hash));
- if (response.IsNullOrEmpty())
- return false;
-
- _cookie.Add(new Cookie("challengev", _challenge) { Domain = "speedport.ip" });
-
- bool login = false;
- try {
- JToken jArray = JToken.Parse(response);
- if (jArray.getVar("login").Equals("success")) {
- if (isLoggedin().Equals(false)) {
- login = false;
- }
- else {
- login = true;
- _derivedk = getDerviedk();
- _lastReboot = getLastReboot();
+ public bool login(string password)
+ {
+ if (password.IsNullOrEmpty())
+ {
+ return false;
+ }
+
+ _cookie = new CookieContainer();
+
+ _password = password;
+ _challenge = getChallenge();
+ _hash = string.Concat(_challenge, ":", password).sha256();
+
+ string response = sendRequest("data/Login.json", string.Concat("csrf_token=nulltoken&showpw=0&password=", _hash));
+ if (response.IsNullOrEmpty())
+ return false;
+
+ _cookie.Add(new Cookie("challengev", _challenge) { Domain = "speedport.ip" });
+
+ bool login = false;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+ if (jArray.getVar("login").Equals("success"))
+ {
+ if (isLoggedin().Equals(false))
+ {
+ login = false;
+ }
+ else {
+ login = true;
+ _derivedk = getDerviedk();
+ _lastReboot = getLastReboot();
}
- }
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
-
- return login;
- }
-
- /**
+ }
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+
+ return login;
+ }
+
+ /**
* logout
*
* @return bool
*/
- public bool logout () {
- string response = sendRequest("data/Login.json", string.Concat("csrf_token=", getToken(), "&logout=byby"));
- if (response.IsNullOrEmpty())
- return false;
-
- bool logout = false;
- try {
- JToken jArray = JToken.Parse(response);
- if (jArray.getVar("status").Equals("ok")) {
- if (isLoggedin().Equals(true)) {
- logout = false;
- }
- else {
- logout = true;
- _password = "";
- _challenge = "";
- _cookie = new CookieContainer();
- _lastReboot = DateTime.MinValue;
- _hash = "";
- _derivedk = "";
- }
- }
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
-
- return logout;
- }
-
- /**
+ public bool logout()
+ {
+ string response = sendRequest("data/Login.json", string.Concat("csrf_token=", getToken(), "&logout=byby"));
+ if (response.IsNullOrEmpty())
+ return false;
+
+ bool logout = false;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ if (isLoggedin().Equals(true))
+ {
+ logout = false;
+ }
+ else {
+ logout = true;
+ _password = "";
+ _challenge = "";
+ _cookie = new CookieContainer();
+ _lastReboot = DateTime.MinValue;
+ _hash = "";
+ _derivedk = "";
+ }
+ }
+
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+
+ return logout;
+ }
+
+ /**
* check if we are logged in
*
* @return bool
*/
- public bool checkLogin () {
- if (_checkIsActive.Equals(false)) {
- _checkIsActive = true;
- if (isLoggedin().Equals(false)) {
- Console.WriteLine("Session expired, try to relogin");
-
- Thread.Sleep(400);
-
- if (login(_password).Equals(false)) {
- // should we try to relogin? login(_password);...
- new Thread(() => { LogManager.WriteToLog("Session expired."); }).Start();
- _password = "";
- _challenge = "";
- _cookie = new CookieContainer();
- _lastReboot = DateTime.MinValue;
- _hash = "";
- _derivedk = "";
-
- LoginPageModel lpm = Application.Current.FindResource("LoginPageModel") as LoginPageModel;
- lpm.LoginCommand.Execute();
- MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
- mwm.SwitchToLoginPage.Execute();
-
- new Thread(() => { MessageBox.Show("Session expired.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- _checkIsActive = false;
- return false;
- }
- }
-
- _checkIsActive = false;
- }
- else {
- Console.WriteLine("check allready in progress");
- }
-
- return true;
- }
-
- /**
+ public bool checkLogin()
+ {
+ if (_checkIsActive.Equals(false))
+ {
+ _checkIsActive = true;
+ if (isLoggedin().Equals(false))
+ {
+ Console.WriteLine("Session expired, try to relogin");
+
+ Thread.Sleep(400);
+
+ if (login(_password).Equals(false))
+ {
+ // should we try to relogin? login(_password);...
+ new Thread(() => { LogManager.WriteToLog("Session expired."); }).Start();
+ _password = "";
+ _challenge = "";
+ _cookie = new CookieContainer();
+ _lastReboot = DateTime.MinValue;
+ _hash = "";
+ _derivedk = "";
+
+ LoginPageModel lpm = Application.Current.FindResource("LoginPageModel") as LoginPageModel;
+ lpm.LoginCommand.Execute();
+ MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
+ mwm.SwitchToLoginPage.Execute();
+
+ new Thread(() => { MessageBox.Show("Session expired.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ _checkIsActive = false;
+ return false;
+ }
+ }
+
+ _checkIsActive = false;
+ }
+ else {
+ Console.WriteLine("check allready in progress");
+ }
+
+ return true;
+ }
+
+ /**
* check if we are logged in
*
* @param bool ischeck
* @return bool
*/
- public bool isLoggedin () {
- string response = sendRequest("data/SecureStatus.json");
- if (response.IsNullOrEmpty())
- return false;
-
- bool login = false;
- try {
- JToken jArray = JToken.Parse(response);
-
- if (jArray.getVar("loginstate").Equals("1")/* && jArray.getVar("login").Equals("true")*/) {
- login = true;
- }
+ public bool isLoggedin()
+ {
+ string response = sendRequest("data/SecureStatus.json");
+ if (response.IsNullOrEmpty())
+ return false;
+
+ bool login = false;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+
+ if (jArray.getVar("loginstate").Equals("1")/* && jArray.getVar("login").Equals("true")*/)
+ {
+ login = true;
+ }
+
+ jArray = null;
+ }
- jArray = null;
- }
-
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
- response = null;
+ response = null;
- return login;
- }
+ return login;
+ }
- /**
+ /**
* reboot the router
*/
- public void reboot () {
- if (checkLogin().Equals(false))
- return;
-
- string response = sendRequest("data/Reboot.json", string.Concat("csrf_token=", Uri.EscapeUriString(getToken()), "&reboot_device=true"));
- if (response.IsNullOrEmpty())
- return;
- try {
- JToken jArray = JToken.Parse(response);
- if (jArray.getVar("status").Equals("ok")) {
- new Thread(() => { MessageBox.Show("Router Reboot.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- LogManager.WriteToLog("Router Reboot.");
- _password = "";
- _challenge = "";
- _cookie = new CookieContainer();
- _hash = "";
- _derivedk = "";
-
- LoginPageModel lpm = Application.Current.FindResource("LoginPageModel") as LoginPageModel;
- lpm.LoginCommand.Execute();
- MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
- mwm.SwitchToLoginPage.Execute();
- }
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- /**
+ public void reboot()
+ {
+ if (checkLogin().Equals(false))
+ return;
+
+ string response = sendRequest("data/Reboot.json", string.Concat("csrf_token=", Uri.EscapeUriString(getToken()), "&reboot_device=true"));
+ if (response.IsNullOrEmpty())
+ return;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ new Thread(() => { MessageBox.Show("Router Reboot.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ LogManager.WriteToLog("Router Reboot.");
+ _password = "";
+ _challenge = "";
+ _cookie = new CookieContainer();
+ _hash = "";
+ _derivedk = "";
+
+ LoginPageModel lpm = Application.Current.FindResource("LoginPageModel") as LoginPageModel;
+ lpm.LoginCommand.Execute();
+ MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
+ mwm.SwitchToLoginPage.Execute();
+ }
+
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ /**
* reconnect LTE
*
* @return bool
*/
- public bool reconnectLte () {
- if (checkLogin().Equals(false))
- return false;
+ public bool reconnectLte()
+ {
+ if (checkLogin().Equals(false))
+ return false;
- Thread.Sleep(400);
+ Thread.Sleep(400);
- string response = sendEnryptedRequest("data/modules.json", string.Concat("lte_reconn=1&csrf_token=", Uri.EscapeUriString(getToken())));
- if (response.IsNullOrEmpty())
- return false;
+ string response = sendEnryptedRequest("data/modules.json", string.Concat("lte_reconn=1&csrf_token=", Uri.EscapeUriString(getToken())));
+ if (response.IsNullOrEmpty())
+ return false;
- try {
- JToken jArray = JToken.Parse(response);
+ try
+ {
+ JToken jArray = JToken.Parse(response);
- response = null;
+ response = null;
- if (jArray.getVar("status").Equals("ok")) {
- jArray = null;
- return true;
- }
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ jArray = null;
+ return true;
+ }
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
- response = null;
+ response = null;
- return false;
- }
+ return false;
+ }
- /**
+ /**
* reconnect DSL
*
* @return bool
*/
- public bool reconnectDSL () {
- if (checkLogin().Equals(false))
- return false;
-
- Thread.Sleep(400);
-
- string response = sendEnryptedRequest("data/Connect.json", string.Concat("csrf_token=", Uri.EscapeUriString(getToken()), "&showpw=0&password=", _hash, "&req_connect=offline"));
- if (response.IsNullOrEmpty())
- return false;
-
- bool offline = false;
- try {
- JToken jArray = JToken.Parse(response);
-
- response = null;
-
- if (jArray.getVar("status").Equals("ok")) {
- offline = true;
- }
-
- jArray = null;
-
- if (offline.Equals(true)) {
- response = sendEnryptedRequest("data/Connect.json", string.Concat("csrf_token=", Uri.EscapeUriString(getToken()), "&showpw=0&password=", _hash, "&req_connect=online"));
- jArray = JToken.Parse(response);
- if (jArray.getVar("status").Equals("ok")) {
- jArray = null;
- return true;
- }
- }
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
+ public bool reconnectDSL()
+ {
+ if (checkLogin().Equals(false))
+ return false;
+
+ Thread.Sleep(400);
+
+ string response = sendEnryptedRequest("data/Connect.json", string.Concat("csrf_token=", Uri.EscapeUriString(getToken()), "&showpw=0&password=", _hash, "&req_connect=offline"));
+ if (response.IsNullOrEmpty())
+ return false;
+
+ bool offline = false;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+
+ response = null;
+
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ offline = true;
+ }
+
+ jArray = null;
+
+ if (offline.Equals(true))
+ {
+ response = sendEnryptedRequest("data/Connect.json", string.Concat("csrf_token=", Uri.EscapeUriString(getToken()), "&showpw=0&password=", _hash, "&req_connect=online"));
+ jArray = JToken.Parse(response);
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ jArray = null;
+ return true;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
- response = null;
+ response = null;
- return false;
- }
+ return false;
+ }
- /**
+ /**
* change dsl connection status
*
* @param string status
* @return bool
*/
- public bool changeDSLStatus (string status) {
- if (checkLogin().Equals(false))
- return false;
-
- if (status.Equals("online") || status.Equals("offline")) {
-
- string response = sendEnryptedRequest("data/Connect.json", string.Concat("req_connect=", status, "&csrf_token=", Uri.EscapeUriString(getToken())));
- if (response.IsNullOrEmpty())
- return false;
- try {
- JToken jArray = JToken.Parse(response);
-
- response = null;
-
- if (jArray.getVar("status").Equals("ok")) {
- jArray = null;
- return true;
- }
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
+ public bool changeDSLStatus(string status)
+ {
+ if (checkLogin().Equals(false))
+ return false;
+
+ if (status.Equals("online") || status.Equals("offline"))
+ {
+
+ string response = sendEnryptedRequest("data/Connect.json", string.Concat("req_connect=", status, "&csrf_token=", Uri.EscapeUriString(getToken())));
+ if (response.IsNullOrEmpty())
+ return false;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+
+ response = null;
+
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ jArray = null;
+ return true;
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
- response = null;
- }
+ response = null;
+ }
- return false;
- }
+ return false;
+ }
- /**
+ /**
* change lte connection status
*
* @param string status
* @return bool
*/
- public bool changeLTEStatus (string status) {
- if (checkLogin().Equals(false))
- return false;
-
- if (status.Equals("online") || status.Equals("offline")) {
- if (status.Equals("online"))
- status = "1";
-
- if (status.Equals("offline"))
- status = "0";
-
- string response = sendEnryptedRequest("data/Modules.json", string.Concat("use_lte=", status, "&csrf_token=", Uri.EscapeUriString(getToken())));
- if (response.IsNullOrEmpty())
- return false;
- try {
- JToken jArray = JToken.Parse(response);
-
- response = null;
-
- if (jArray.getVar("status").Equals("ok")) {
- jArray = null;
- return true;
- }
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- return false;
- }
-
- /**
+ public bool changeLTEStatus(string status)
+ {
+ if (checkLogin().Equals(false))
+ return false;
+
+ if (status.Equals("online") || status.Equals("offline"))
+ {
+ if (status.Equals("online"))
+ status = "1";
+
+ if (status.Equals("offline"))
+ status = "0";
+
+ string response = sendEnryptedRequest("data/Modules.json", string.Concat("use_lte=", status, "&csrf_token=", Uri.EscapeUriString(getToken())));
+ if (response.IsNullOrEmpty())
+ return false;
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+
+ response = null;
+
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ jArray = null;
+ return true;
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ return false;
+ }
+
+ /**
* reset the router to Factory Default
* not tested
*
* @return bool
*/
- public bool resetToFactoryDefault () {
- if (checkLogin().Equals(false))
- return false;
-
- Thread.Sleep(400);
-
- string response = sendEnryptedRequest("data/resetAllSetting.json", string.Concat("csrf_token=nulltoken&showpw=0&password=", _hash, "&reset_all=true"));
- if (response.IsNullOrEmpty())
- return false;
-
- try {
- JToken jArray = JToken.Parse(response);
- if (jArray.getVar("status").Equals("ok")) {
- return true;
- }
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
+ public bool resetToFactoryDefault()
+ {
+ if (checkLogin().Equals(false))
+ return false;
+
+ Thread.Sleep(400);
+
+ string response = sendEnryptedRequest("data/resetAllSetting.json", string.Concat("csrf_token=nulltoken&showpw=0&password=", _hash, "&reset_all=true"));
+ if (response.IsNullOrEmpty())
+ return false;
+
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ return true;
+ }
+
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
- response = null;
+ response = null;
- return false;
- }
+ return false;
+ }
- /**
+ /**
* check for firmware update
*/
- public void checkFirmware () {
- if (checkLogin().Equals(false))
- return;
-
- Thread.Sleep(400);
-
- string response = sendRequest("data/checkfirm.json");
- if (response.IsNullOrEmpty())
- return;
-
- try {
- bool fw_isActual = false;
- JToken jArray = JToken.Parse(response);
-
- if (jArray.getVar("fw_isActual").Equals("1")) {
- fw_isActual = true;
- }
-
- if (fw_isActual.Equals(true)) {
- // Die Firmware ist aktuell.
- MessageBox.Show("Die Firmware ist aktuell.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- else {
- // Es liegt eine neuere Firmware-Version vor. Möchten Sie diese Version jetzt installieren?
- MessageBox.Show("Es liegt eine neuere Firmware-Version vor.\nMöchten Sie diese Version jetzt installieren?", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning);
- }
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- /**
+ public void checkFirmware()
+ {
+ if (checkLogin().Equals(false))
+ return;
+
+ Thread.Sleep(400);
+
+ string response = sendRequest("data/checkfirm.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ try
+ {
+ bool fw_isActual = false;
+ JToken jArray = JToken.Parse(response);
+
+ if (jArray.getVar("fw_isActual").Equals("1"))
+ {
+ fw_isActual = true;
+ }
+
+ if (fw_isActual.Equals(true))
+ {
+ // Die Firmware ist aktuell.
+ MessageBox.Show("Die Firmware ist aktuell.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ else {
+ // Es liegt eine neuere Firmware-Version vor. Möchten Sie diese Version jetzt installieren?
+ MessageBox.Show("Es liegt eine neuere Firmware-Version vor.\nMöchten Sie diese Version jetzt installieren?", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ /**
* flush dns cache
*/
- public void flushDNS () {
- if (checkLogin().Equals(false))
- return;
+ public void flushDNS()
+ {
+ if (checkLogin().Equals(false))
+ return;
- Thread.Sleep(400);
+ Thread.Sleep(400);
- string response = sendEnryptedRequest("data/dns.json", "op_type=flush_dns_cache");
- if (response.IsNullOrEmpty())
- return;
+ string response = sendEnryptedRequest("data/dns.json", "op_type=flush_dns_cache");
+ if (response.IsNullOrEmpty())
+ return;
- try {
- JToken jArray = JToken.Parse(response);
+ try
+ {
+ JToken jArray = JToken.Parse(response);
- if (jArray["DCI"].Count().Equals(0)) {
- new Thread(() => { MessageBox.Show("DNS cache geleert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- else {
- new Thread(() => { MessageBox.Show("unable to flush dns cache", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- }
+ if (jArray["DCI"].Count().Equals(0))
+ {
+ new Thread(() => { MessageBox.Show("DNS cache geleert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ else {
+ new Thread(() => { MessageBox.Show("unable to flush dns cache", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ }
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
- response = null;
- }
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
- /**
+ /**
* clear the Syslog
*/
- public void clearSyslog () {
- if (checkLogin().Equals(false))
- return;
-
- Thread.Sleep(400);
-
- string response = sendEnryptedRequest("data/SystemMessages.json", string.Concat("action_clearlist=true&clear_type=0&", "csrf_token=", getToken()));
- if (response.IsNullOrEmpty())
- return;
-
- try {
- JToken jArray = JToken.Parse(response);
-
- if (jArray.getVar("status").Equals("ok")) {
- // ok
- new Thread(() => { MessageBox.Show("Syslog geleert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- else {
- // fail
- new Thread(() => { MessageBox.Show("Konnte Syslog nicht leeren.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- }
-
- jArray = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- /**
+ public void clearSyslog()
+ {
+ if (checkLogin().Equals(false))
+ return;
+
+ Thread.Sleep(400);
+
+ string response = sendEnryptedRequest("data/SystemMessages.json", string.Concat("action_clearlist=true&clear_type=0&", "csrf_token=", getToken()));
+ if (response.IsNullOrEmpty())
+ return;
+
+ try
+ {
+ JToken jArray = JToken.Parse(response);
+
+ if (jArray.getVar("status").Equals("ok"))
+ {
+ // ok
+ new Thread(() => { MessageBox.Show("Syslog geleert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ else {
+ // fail
+ new Thread(() => { MessageBox.Show("Konnte Syslog nicht leeren.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ }
+
+ jArray = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ /**
* set QueueSkbTimeOut
*
* @param string value
*/
- public void setQueueSkbTimeOut (string value) {
- if (checkLogin().Equals(false))
- return;
-
- string response = sendEnryptedRequest("data/bonding_tr181.json", string.Concat("bonding_QueueSkbTimeOut=", value));
- if (response.IsNullOrEmpty())
- return;
- try {
- TR181PageModel obj = JsonConvert.DeserializeObject<TR181PageModel>(response);
-
- if (obj.QueueSkbTimeOut.Equals(value)) {
- new Thread(() => { MessageBox.Show("QueueSkbTimeOut geändert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- else {
- new Thread(() => { MessageBox.Show("unable to change QueueSkbTimeOut", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- }
-
- obj = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- /**
+ public void setQueueSkbTimeOut(string value)
+ {
+ if (checkLogin().Equals(false))
+ return;
+
+ string response = sendEnryptedRequest("data/bonding_tr181.json", string.Concat("bonding_QueueSkbTimeOut=", value));
+ if (response.IsNullOrEmpty())
+ return;
+ try
+ {
+ TR181PageModel obj = JsonConvert.DeserializeObject<TR181PageModel>(response);
+
+ if (obj.QueueSkbTimeOut.Equals(value))
+ {
+ new Thread(() => { MessageBox.Show("QueueSkbTimeOut geändert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ else {
+ new Thread(() => { MessageBox.Show("unable to change QueueSkbTimeOut", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ }
+
+ obj = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ /**
* set Antenna Mode
*
* @param string value
*/
- public void setAntennaMode (string value) {
- if (checkLogin().Equals(false))
- return;
-
- string response = sendEnryptedRequest("data/lteinfo.json", string.Concat("mode_select=", value));
- if (response.IsNullOrEmpty())
- return;
- try {
- LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
-
- string antenna_mode;
- if (obj.antenna_mode.Equals("Antennal set to internal")) {
- antenna_mode = "Inner";
- }
- else if (obj.antenna_mode.Equals("Antennal set to external")) {
- antenna_mode = "Outer";
- }
- else {
- antenna_mode = "Auto";
- }
-
- if (antenna_mode.Equals(value)) {
- new Thread(() => { MessageBox.Show("Antennen Modus geändert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- else {
- new Thread(() => { MessageBox.Show("Antennen Modus ändern Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- }
-
- antenna_mode = null;
-
- obj = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- response = null;
- }
-
- /**
+ public void setAntennaMode(string value)
+ {
+ if (checkLogin().Equals(false))
+ return;
+
+ string response = sendEnryptedRequest("data/lteinfo.json", string.Concat("mode_select=", value));
+ if (response.IsNullOrEmpty())
+ return;
+ try
+ {
+ LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
+
+ string antenna_mode;
+ if (obj.antenna_mode.Equals("Antennal set to internal"))
+ {
+ antenna_mode = "Inner";
+ }
+ else if (obj.antenna_mode.Equals("Antennal set to external"))
+ {
+ antenna_mode = "Outer";
+ }
+ else {
+ antenna_mode = "Auto";
+ }
+
+ if (antenna_mode.Equals(value))
+ {
+ new Thread(() => { MessageBox.Show("Antennen Modus geändert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ else {
+ new Thread(() => { MessageBox.Show("Antennen Modus ändern Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ }
+
+ antenna_mode = null;
+
+ obj = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ response = null;
+ }
+
+ /**
* get Last Reboot time
*
* @return DateTime
*/
- public DateTime getLastReboot () {
- if (_lastReboot.Equals(DateTime.MinValue).Equals(false)) {
- return _lastReboot;
+ public DateTime getLastReboot()
+ {
+ if (_lastReboot.Equals(DateTime.MinValue).Equals(false))
+ {
+ return _lastReboot;
}
- string response = sendRequest("data/Reboot.json");
+ string response = sendRequest("data/Reboot.json");
- if (response.IsNullOrEmpty())
- return DateTime.Now;
+ if (response.IsNullOrEmpty())
+ return DateTime.Now;
- JToken jArray = JToken.Parse(response);
+ JToken jArray = JToken.Parse(response);
- DateTime lastReboot = DateTime.Parse(string.Concat(jArray.getVar("reboot_date"), " ", jArray.getVar("reboot_time")));
+ DateTime lastReboot = DateTime.Parse(string.Concat(jArray.getVar("reboot_date"), " ", jArray.getVar("reboot_time")));
- jArray = null;
+ jArray = null;
- return lastReboot;
- }
+ return lastReboot;
+ }
- /**
+ /**
* get the csrf token from router
*
* @return string
*/
- public string getToken () {
- string response = sendRequest("html/content/overview/index.html");
- if (response.IsNullOrEmpty())
- return string.Empty;
+ public string getToken()
+ {
+ string response = sendRequest("html/content/overview/index.html");
+ if (response.IsNullOrEmpty())
+ return string.Empty;
- string a = "csrf_token = \"";
- string b = "\";";
- string token = response.Substring((response.IndexOf(a) + a.Length), (response.IndexOf(b) - response.IndexOf(a) - a.Length));
+ string a = "csrf_token = \"";
+ string b = "\";";
+ string token = response.Substring((response.IndexOf(a) + a.Length), (response.IndexOf(b) - response.IndexOf(a) - a.Length));
- response = null;
- a = null;
- b = null;
+ response = null;
+ a = null;
+ b = null;
- Console.WriteLine("csrf_token: " + token);
- return token;
- }
+ Console.WriteLine("csrf_token: " + token);
+ return token;
+ }
- /**
+ /**
* send encrypted request to the router
*
* @param string path
* @param bool cookie
* @return string
*/
- public string sendEnryptedRequest (string path, string post = "", bool cookie = true) {
- string response = string.Empty;
-
- try {
- sjcl sjcl = new sjcl();
-
- string iv = _challenge.Substring(16, 16);
- string adata = _challenge.Substring(32, 16);
- string dKey = _derivedk;
-
-
- // TODO: check if we need this really?
- if (post.IsNullOrEmpty().Equals(false)) {
- post = sjcl.encrypt(dKey, post, iv, adata);
- }
-
-
- response = sendRequest(path, post, cookie);
- // check if the return value is hex (hex = enrypted)
- if (Regex.IsMatch(response, @"\A\b[0-9a-fA-F]+\b\Z").Equals(true)) {
- response = sjcl.decrypt(dKey, response, iv, adata);
- }
-
- post = null;
- iv = null;
- adata = null;
- dKey = null;
- sjcl = null;
-
- }
- catch (ArgumentOutOfRangeException ex) {
- LogManager.WriteToLog(ex.Message);
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- return response;
- }
-
- /**
+ public string sendEnryptedRequest(string path, string post = "", bool cookie = true)
+ {
+ string response = string.Empty;
+
+ try
+ {
+ sjcl sjcl = new sjcl();
+
+ string iv = _challenge.Substring(16, 16);
+ string adata = _challenge.Substring(32, 16);
+ string dKey = _derivedk;
+
+
+ // TODO: check if we need this really?
+ if (post.IsNullOrEmpty().Equals(false))
+ {
+ post = sjcl.encrypt(dKey, post, iv, adata);
+ }
+
+
+ response = sendRequest(path, post, cookie);
+ // check if the return value is hex (hex = enrypted)
+ if (Regex.IsMatch(response, @"\A\b[0-9a-fA-F]+\b\Z").Equals(true))
+ {
+ response = sjcl.decrypt(dKey, response, iv, adata);
+ }
+
+ post = null;
+ iv = null;
+ adata = null;
+ dKey = null;
+ sjcl = null;
+
+ }
+ catch (ArgumentOutOfRangeException ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ return response;
+ }
+
+ /**
* send request to the router
*
* @param string path
* @param bool cookie
* @return string
*/
- public string sendRequest (string path, string post = "", bool cookie = true) {
- string response = string.Empty;
- try {
- string url = string.Concat("http://", ip, "/", path, "?lang=de");
-
- HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest;
- /* set timeout to 10 seconds */
- webRequest.Timeout = 10000;
-
- if (cookie.Equals(true)) {
- webRequest.CookieContainer = _cookie;
- }
-
- if (post.IsNullOrEmpty().Equals(false)) {
- webRequest.Method = "POST";
- byte[] dataStream = Encoding.UTF8.GetBytes(post);
- webRequest.ContentLength = dataStream.Length;
- Stream newStream = webRequest.GetRequestStream();
- newStream.Write(dataStream, 0, dataStream.Length);
- newStream.Close();
- newStream.Dispose();
- newStream = null;
- dataStream = null;
- }
-
- WebResponse webResponse = webRequest.GetResponse();
- StreamReader reader = new StreamReader(webResponse.GetResponseStream());
- response = reader.ReadToEnd().ToString();
-
- webResponse.Dispose();
- reader.Dispose();
- reader = null;
- webRequest = null;
- webResponse = null;
- post = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- return response;
- }
-
- public string sendRequest2 (string path, Dictionary<string, object> files, string post = "", bool cookie = true) {
- string response = string.Empty;
-
- try {
- string url = string.Concat("http://", ip, "/", path, "?lang=de");
-
- string boundary = string.Concat("---------------------------", DateTime.Now.Ticks.ToString("x"));
- byte[] boundaryBytes = Encoding.ASCII.GetBytes(string.Concat("\r\n--", boundary, "\r\n"));
-
- HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
- request.ContentType = string.Concat("multipart/form-data; boundary=", boundary);
- request.Method = "POST";
- request.KeepAlive = true;
-
- if (cookie.Equals(true)) {
- request.CookieContainer = _cookie;
- }
-
- Stream requestStream = request.GetRequestStream();
-
- if (string.IsNullOrEmpty(post).Equals(false)) {
- byte[] dataStream = Encoding.UTF8.GetBytes(post);
- requestStream.Write(dataStream, 0, dataStream.Length);
- dataStream = null;
- }
-
- if (files != null && files.Count > 0) {
- foreach (KeyValuePair<string, object> pair in files) {
- requestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
- if (pair.Value is FormFile) {
- FormFile file = pair.Value as FormFile;
- string header = string.Concat("Content-Disposition: form-data; name=\"", pair.Key, "\"; filename=\"", file.Name, "\"\r\nContent-Type: ", file.ContentType, "\r\n\r\n");
- byte[] bytes = Encoding.UTF8.GetBytes(header);
- requestStream.Write(bytes, 0, bytes.Length);
- byte[] buffer = new byte[32768];
- int bytesRead;
- if (file.Stream == null) {
- // upload from file
- FileStream fileStream = File.OpenRead(file.FilePath);
- while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) {
- requestStream.Write(buffer, 0, bytesRead);
- }
- fileStream.Close();
- }
- else {
- // upload from given stream
- while ((bytesRead = file.Stream.Read(buffer, 0, buffer.Length)) != 0)
- requestStream.Write(buffer, 0, bytesRead);
- }
- }
- else {
- string data = string.Concat("Content-Disposition: form-data; name=\"", pair.Key, "\"\r\n\r\n", pair.Value);
- byte[] bytes = Encoding.UTF8.GetBytes(data);
- requestStream.Write(bytes, 0, bytes.Length);
- }
- }
-
- byte[] trailer = Encoding.ASCII.GetBytes(string.Concat("\r\n--", boundary, "--\r\n"));
- requestStream.Write(trailer, 0, trailer.Length);
- requestStream.Close();
-
- }
-
- WebResponse webResponse = request.GetResponse();
- Stream responseStream = webResponse.GetResponseStream();
- StreamReader reader = new StreamReader(responseStream);
- response = reader.ReadToEnd();
-
- webResponse.Dispose();
- reader.Dispose();
- reader = null;
- request = null;
- webResponse = null;
- }
- catch (Exception ex) {
- LogManager.WriteToLog(ex.Message);
- }
-
- return response;
- }
- }
-
- public class FormFile {
- public string Name { get; set; }
-
- public string ContentType { get; set; }
-
- public string FilePath { get; set; }
-
- public Stream Stream { get; set; }
- }
+ public string sendRequest(string path, string post = "", bool cookie = true)
+ {
+ string response = string.Empty;
+ try
+ {
+ string url = string.Concat("http://", ip, "/", path, "?lang=de");
+
+ HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest;
+ /* set timeout to 10 seconds */
+ webRequest.Timeout = 10000;
+
+ if (cookie.Equals(true))
+ {
+ webRequest.CookieContainer = _cookie;
+ }
+
+ if (post.IsNullOrEmpty().Equals(false))
+ {
+ webRequest.Method = "POST";
+ byte[] dataStream = Encoding.UTF8.GetBytes(post);
+ webRequest.ContentLength = dataStream.Length;
+ Stream newStream = webRequest.GetRequestStream();
+ newStream.Write(dataStream, 0, dataStream.Length);
+ newStream.Close();
+ newStream.Dispose();
+ newStream = null;
+ dataStream = null;
+ }
+
+ WebResponse webResponse = webRequest.GetResponse();
+ StreamReader reader = new StreamReader(webResponse.GetResponseStream());
+ response = reader.ReadToEnd().ToString();
+
+ webResponse.Dispose();
+ reader.Dispose();
+ reader = null;
+ webRequest = null;
+ webResponse = null;
+ post = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ return response;
+ }
+
+ public string sendRequest2(string path, Dictionary<string, object> files, string post = "", bool cookie = true)
+ {
+ string response = string.Empty;
+
+ try
+ {
+ string url = string.Concat("http://", ip, "/", path, "?lang=de");
+
+ string boundary = string.Concat("---------------------------", DateTime.Now.Ticks.ToString("x"));
+ byte[] boundaryBytes = Encoding.ASCII.GetBytes(string.Concat("\r\n--", boundary, "\r\n"));
+
+ HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
+ request.ContentType = string.Concat("multipart/form-data; boundary=", boundary);
+ request.Method = "POST";
+ request.KeepAlive = true;
+
+ if (cookie.Equals(true))
+ {
+ request.CookieContainer = _cookie;
+ }
+
+ Stream requestStream = request.GetRequestStream();
+
+ if (string.IsNullOrEmpty(post).Equals(false))
+ {
+ byte[] dataStream = Encoding.UTF8.GetBytes(post);
+ requestStream.Write(dataStream, 0, dataStream.Length);
+ dataStream = null;
+ }
+
+ if (files != null && files.Count > 0)
+ {
+ foreach (KeyValuePair<string, object> pair in files)
+ {
+ requestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
+ if (pair.Value is FormFile)
+ {
+ FormFile file = pair.Value as FormFile;
+ string header = string.Concat("Content-Disposition: form-data; name=\"", pair.Key, "\"; filename=\"", file.Name, "\"\r\nContent-Type: ", file.ContentType, "\r\n\r\n");
+ byte[] bytes = Encoding.UTF8.GetBytes(header);
+ requestStream.Write(bytes, 0, bytes.Length);
+ byte[] buffer = new byte[32768];
+ int bytesRead;
+ if (file.Stream == null)
+ {
+ // upload from file
+ FileStream fileStream = File.OpenRead(file.FilePath);
+ while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
+ {
+ requestStream.Write(buffer, 0, bytesRead);
+ }
+ fileStream.Close();
+ }
+ else {
+ // upload from given stream
+ while ((bytesRead = file.Stream.Read(buffer, 0, buffer.Length)) != 0)
+ requestStream.Write(buffer, 0, bytesRead);
+ }
+ }
+ else {
+ string data = string.Concat("Content-Disposition: form-data; name=\"", pair.Key, "\"\r\n\r\n", pair.Value);
+ byte[] bytes = Encoding.UTF8.GetBytes(data);
+ requestStream.Write(bytes, 0, bytes.Length);
+ }
+ }
+
+ byte[] trailer = Encoding.ASCII.GetBytes(string.Concat("\r\n--", boundary, "--\r\n"));
+ requestStream.Write(trailer, 0, trailer.Length);
+ requestStream.Close();
+
+ }
+
+ WebResponse webResponse = request.GetResponse();
+ Stream responseStream = webResponse.GetResponseStream();
+ StreamReader reader = new StreamReader(responseStream);
+ response = reader.ReadToEnd();
+
+ webResponse.Dispose();
+ reader.Dispose();
+ reader = null;
+ request = null;
+ webResponse = null;
+ }
+ catch (Exception ex)
+ {
+ LogManager.WriteToLog(ex.Message);
+ }
+
+ return response;
+ }
+ }
+
+ public class FormFile
+ {
+ public string Name { get; set; }
+
+ public string ContentType { get; set; }
+
+ public string FilePath { get; set; }
+
+ public Stream Stream { get; set; }
+ }
}
\ No newline at end of file
using System.Windows;
-namespace SpeedportHybridControl {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window {
- public MainWindow () {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl
+{
+ /// <summary>
+ /// Interaction logic for MainWindow.xaml
+ /// </summary>
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
}
-namespace SpeedportHybridControl.Model {
- class Connection : SuperViewModel {
- private string _dsl_operaing_mode;
- private string _path_mode;
- private string _state;
- private string _training_results;
- private string _mode_lo;
- private string _vpi_vpc;
+namespace SpeedportHybridControl.Model
+{
+ class Connection : SuperViewModel
+ {
+ private string _dsl_operaing_mode;
+ private string _path_mode;
+ private string _state;
+ private string _training_results;
+ private string _mode_lo;
+ private string _vpi_vpc;
- public string dsl_operaing_mode {
- get { return _dsl_operaing_mode; }
- set { SetProperty(ref _dsl_operaing_mode, value); }
- }
+ public string dsl_operaing_mode
+ {
+ get { return _dsl_operaing_mode; }
+ set { SetProperty(ref _dsl_operaing_mode, value); }
+ }
- public string path_mode {
- get { return _path_mode; }
- set { SetProperty(ref _path_mode, value); }
- }
+ public string path_mode
+ {
+ get { return _path_mode; }
+ set { SetProperty(ref _path_mode, value); }
+ }
- public string state {
- get { return _state; }
- set { SetProperty(ref _state, value); }
- }
+ public string state
+ {
+ get { return _state; }
+ set { SetProperty(ref _state, value); }
+ }
- public string training_results {
- get { return _training_results; }
- set { SetProperty(ref _training_results, value); }
- }
+ public string training_results
+ {
+ get { return _training_results; }
+ set { SetProperty(ref _training_results, value); }
+ }
- public string mode_lo {
- get { return _mode_lo; }
- set { SetProperty(ref _mode_lo, value); }
- }
+ public string mode_lo
+ {
+ get { return _mode_lo; }
+ set { SetProperty(ref _mode_lo, value); }
+ }
- public string vpi_vci {
- get { return _vpi_vpc; }
- set { SetProperty(ref _vpi_vpc, value); }
- }
- }
+ public string vpi_vci
+ {
+ get { return _vpi_vpc; }
+ set { SetProperty(ref _vpi_vpc, value); }
+ }
+ }
}
-namespace SpeedportHybridControl.Model {
- public class DeviceList : SuperViewModel {
- private int _id;
- private string _name;
- private string _mac;
- private int _type;
- private int _connected;
- private string _ipv4;
- private string _ipv6;
- private int _static;
-
- public int id {
- get { return _id; }
- set { SetProperty(ref _id, value); }
- }
-
- public string name {
- get { return _name; }
- set { SetProperty(ref _name, value); }
- }
-
- public string mac {
- get { return _mac; }
- set { SetProperty(ref _mac, value); }
- }
-
- public int type {
- get { return _type; }
- set { SetProperty(ref _type, value); }
- }
-
- public int connected {
- get { return _connected; }
- set { SetProperty(ref _connected, value); }
- }
-
- public string ipv4 {
- get { return _ipv4; }
- set { SetProperty(ref _ipv4, value); }
- }
-
- public string ipv6 {
- get { return _ipv6; }
- set { SetProperty(ref _ipv6, value); }
- }
-
- public int mstatic {
- get { return _static; }
- set { SetProperty(ref _static, value); }
- }
-
- public DeviceList() {
- }
- }
+namespace SpeedportHybridControl.Model
+{
+ public class DeviceList : SuperViewModel
+ {
+ private int _id;
+ private string _name;
+ private string _mac;
+ private int _type;
+ private int _connected;
+ private string _ipv4;
+ private string _ipv6;
+ private int _static;
+
+ public int id
+ {
+ get { return _id; }
+ set { SetProperty(ref _id, value); }
+ }
+
+ public string name
+ {
+ get { return _name; }
+ set { SetProperty(ref _name, value); }
+ }
+
+ public string mac
+ {
+ get { return _mac; }
+ set { SetProperty(ref _mac, value); }
+ }
+
+ public int type
+ {
+ get { return _type; }
+ set { SetProperty(ref _type, value); }
+ }
+
+ public int connected
+ {
+ get { return _connected; }
+ set { SetProperty(ref _connected, value); }
+ }
+
+ public string ipv4
+ {
+ get { return _ipv4; }
+ set { SetProperty(ref _ipv4, value); }
+ }
+
+ public string ipv6
+ {
+ get { return _ipv6; }
+ set { SetProperty(ref _ipv6, value); }
+ }
+
+ public int mstatic
+ {
+ get { return _static; }
+ set { SetProperty(ref _static, value); }
+ }
+
+ public DeviceList()
+ {
+ }
+ }
}
using System.Text;
using System.Threading.Tasks;
-namespace SpeedportHybridControl.Model {
- class InterfaceList : SuperViewModel {
- private string _ifc;
- private string _mtu;
- private string _tx_packets;
- private string _tx_errors;
- private string _rx_packets;
- private string _rx_errors;
- private string _collisions;
-
- public string ifc {
- get { return _ifc; }
- set { SetProperty(ref _ifc, value); }
- }
-
- public string mtu
- {
- get { return _mtu; }
- set { SetProperty(ref _mtu, value); }
- }
-
- public string tx_packets
- {
- get { return _tx_packets; }
- set { SetProperty(ref _tx_packets, value); }
- }
-
- public string tx_errors
- {
- get { return _tx_errors; }
- set { SetProperty(ref _tx_errors, value); }
- }
-
- public string rx_packets
- {
- get { return _rx_packets; }
- set { SetProperty(ref _rx_packets, value); }
- }
-
- public string rx_errors
- {
- get { return _rx_errors; }
- set { SetProperty(ref _rx_errors, value); }
- }
-
- public string collisions
- {
- get { return _collisions; }
- set { SetProperty(ref _collisions, value); }
- }
- }
+namespace SpeedportHybridControl.Model
+{
+ class InterfaceList : SuperViewModel
+ {
+ private string _ifc;
+ private string _mtu;
+ private string _tx_packets;
+ private string _tx_errors;
+ private string _rx_packets;
+ private string _rx_errors;
+ private string _collisions;
+
+ public string ifc
+ {
+ get { return _ifc; }
+ set { SetProperty(ref _ifc, value); }
+ }
+
+ public string mtu
+ {
+ get { return _mtu; }
+ set { SetProperty(ref _mtu, value); }
+ }
+
+ public string tx_packets
+ {
+ get { return _tx_packets; }
+ set { SetProperty(ref _tx_packets, value); }
+ }
+
+ public string tx_errors
+ {
+ get { return _tx_errors; }
+ set { SetProperty(ref _tx_errors, value); }
+ }
+
+ public string rx_packets
+ {
+ get { return _rx_packets; }
+ set { SetProperty(ref _rx_packets, value); }
+ }
+
+ public string rx_errors
+ {
+ get { return _rx_errors; }
+ set { SetProperty(ref _rx_errors, value); }
+ }
+
+ public string collisions
+ {
+ get { return _collisions; }
+ set { SetProperty(ref _collisions, value); }
+ }
+ }
}
using Microsoft.Research.DynamicDataDisplay.Common;
-namespace SpeedportHybridControl.Model {
- public class LTECollection : RingArray<LTEData> {
- private const int TOTAL_POINTS = 200;
+namespace SpeedportHybridControl.Model
+{
+ public class LTECollection : RingArray<LTEData>
+ {
+ private const int TOTAL_POINTS = 200;
- public LTECollection () : base(TOTAL_POINTS) {
- }
- }
+ public LTECollection() : base(TOTAL_POINTS)
+ {
+ }
+ }
}
using System;
-namespace SpeedportHybridControl.Model {
- public class LTEData {
- public DateTime Date { get; set; }
+namespace SpeedportHybridControl.Model
+{
+ public class LTEData
+ {
+ public DateTime Date { get; set; }
- public int Data { get; set; }
- }
+ public int Data { get; set; }
+ }
}
-namespace SpeedportHybridControl.Model {
- class Line : SuperViewModel {
- private string _uactual;
- private string _dactual;
- private string _uattainable;
- private string _dattainable;
- private string _uSNR;
- private string _dSNR;
- private string _uSignal;
- private string _dSignal;
- private string _uLine;
- private string _dLine;
- private string _uBIN;
- private string _dBIN;
- private string _uFEC_size;
- private string _dFEC_size;
- private string _uCodeword;
- private string _dCodeword;
- private string _uInterleave;
- private string _dInterleave;
- private int _uCRC;
- private int _dCRC;
- private int _uHEC;
- private int _dHEC;
- private int _uFEC;
- private int _dFEC;
-
- private double _uCRCsec;
- private double _dCRCsec;
- private double _uHECsec;
- private double _dHECsec;
- private double _uFECsec;
- private double _dFECsec;
-
- public string uactual {
- get { return _uactual; }
- set { SetProperty(ref _uactual, value); }
- }
-
- public string dactual {
- get { return _dactual; }
- set { SetProperty(ref _dactual, value); }
- }
-
- public string uattainable {
- get { return _uattainable; }
- set { SetProperty(ref _uattainable, value); }
- }
-
- public string dattainable {
- get { return _dattainable; }
- set { SetProperty(ref _dattainable, value); }
- }
-
- public string uSNR {
- get { return _uSNR; }
- set { SetProperty(ref _uSNR, value); }
- }
-
- public string dSNR {
- get { return _dSNR; }
- set { SetProperty(ref _dSNR, value); }
- }
-
- public string uSignal {
- get { return _uSignal; }
- set { SetProperty(ref _uSignal, value); }
- }
-
- public string dSignal {
- get { return _dSignal; }
- set { SetProperty(ref _dSignal, value); }
- }
-
- public string uLine {
- get { return _uLine; }
- set { SetProperty(ref _uLine, value); }
- }
-
- public string dLine {
- get { return _dLine; }
- set { SetProperty(ref _dLine, value); }
- }
-
- public string uBIN {
- get { return _uBIN; }
- set { SetProperty(ref _uBIN, value); }
- }
-
- public string dBIN {
- get { return _dBIN; }
- set { SetProperty(ref _dBIN, value); }
- }
-
- public string uFEC_size {
- get { return _uFEC_size; }
- set { SetProperty(ref _uFEC_size, value); }
- }
-
- public string dFEC_size {
- get { return _dFEC_size; }
- set { SetProperty(ref _dFEC_size, value); }
- }
-
- public string uCodeword {
- get { return _uCodeword; }
- set { SetProperty(ref _uCodeword, value); }
- }
-
- public string dCodeword {
- get { return _dCodeword; }
- set { SetProperty(ref _dCodeword, value); }
- }
-
- public string uInterleave {
- get { return _uInterleave; }
- set { SetProperty(ref _uInterleave, value); }
- }
-
- public string dInterleave {
- get { return _dInterleave; }
- set { SetProperty(ref _dInterleave, value); }
- }
-
- public int uCRC {
- get { return _uCRC; }
- set { SetProperty(ref _uCRC, value); }
- }
-
- public int dCRC {
- get { return _dCRC; }
- set { SetProperty(ref _dCRC, value); }
- }
-
- public int uHEC {
- get { return _uHEC; }
- set { SetProperty(ref _uHEC, value); }
- }
-
- public int dHEC {
- get { return _dHEC; }
- set { SetProperty(ref _dHEC, value); }
- }
-
- public int uFEC {
- get { return _uFEC; }
- set { SetProperty(ref _uFEC, value); }
- }
-
- public int dFEC {
- get { return _dFEC; }
- set { SetProperty(ref _dFEC, value); }
- }
-
- public double uCRCsec {
- get { return _uCRCsec; }
- set { SetProperty(ref _uCRCsec, value); }
- }
-
- public double dCRCsec {
- get { return _dCRCsec; }
- set { SetProperty(ref _dCRCsec, value); }
- }
-
- public double uHECsec {
- get { return _uHECsec; }
- set { SetProperty(ref _uHECsec, value); }
- }
-
- public double dHECsec {
- get { return _dHECsec; }
- set { SetProperty(ref _dHECsec, value); }
- }
-
- public double uFECsec {
- get { return _uFECsec; }
- set { SetProperty(ref _uFECsec, value); }
- }
-
- public double dFECsec {
- get { return _dFECsec; }
- set { SetProperty(ref _dFECsec, value); }
- }
- }
+namespace SpeedportHybridControl.Model
+{
+ class Line : SuperViewModel
+ {
+ private string _uactual;
+ private string _dactual;
+ private string _uattainable;
+ private string _dattainable;
+ private string _uSNR;
+ private string _dSNR;
+ private string _uSignal;
+ private string _dSignal;
+ private string _uLine;
+ private string _dLine;
+ private string _uBIN;
+ private string _dBIN;
+ private string _uFEC_size;
+ private string _dFEC_size;
+ private string _uCodeword;
+ private string _dCodeword;
+ private string _uInterleave;
+ private string _dInterleave;
+ private int _uCRC;
+ private int _dCRC;
+ private int _uHEC;
+ private int _dHEC;
+ private int _uFEC;
+ private int _dFEC;
+
+ private double _uCRCsec;
+ private double _dCRCsec;
+ private double _uHECsec;
+ private double _dHECsec;
+ private double _uFECsec;
+ private double _dFECsec;
+
+ public string uactual
+ {
+ get { return _uactual; }
+ set { SetProperty(ref _uactual, value); }
+ }
+
+ public string dactual
+ {
+ get { return _dactual; }
+ set { SetProperty(ref _dactual, value); }
+ }
+
+ public string uattainable
+ {
+ get { return _uattainable; }
+ set { SetProperty(ref _uattainable, value); }
+ }
+
+ public string dattainable
+ {
+ get { return _dattainable; }
+ set { SetProperty(ref _dattainable, value); }
+ }
+
+ public string uSNR
+ {
+ get { return _uSNR; }
+ set { SetProperty(ref _uSNR, value); }
+ }
+
+ public string dSNR
+ {
+ get { return _dSNR; }
+ set { SetProperty(ref _dSNR, value); }
+ }
+
+ public string uSignal
+ {
+ get { return _uSignal; }
+ set { SetProperty(ref _uSignal, value); }
+ }
+
+ public string dSignal
+ {
+ get { return _dSignal; }
+ set { SetProperty(ref _dSignal, value); }
+ }
+
+ public string uLine
+ {
+ get { return _uLine; }
+ set { SetProperty(ref _uLine, value); }
+ }
+
+ public string dLine
+ {
+ get { return _dLine; }
+ set { SetProperty(ref _dLine, value); }
+ }
+
+ public string uBIN
+ {
+ get { return _uBIN; }
+ set { SetProperty(ref _uBIN, value); }
+ }
+
+ public string dBIN
+ {
+ get { return _dBIN; }
+ set { SetProperty(ref _dBIN, value); }
+ }
+
+ public string uFEC_size
+ {
+ get { return _uFEC_size; }
+ set { SetProperty(ref _uFEC_size, value); }
+ }
+
+ public string dFEC_size
+ {
+ get { return _dFEC_size; }
+ set { SetProperty(ref _dFEC_size, value); }
+ }
+
+ public string uCodeword
+ {
+ get { return _uCodeword; }
+ set { SetProperty(ref _uCodeword, value); }
+ }
+
+ public string dCodeword
+ {
+ get { return _dCodeword; }
+ set { SetProperty(ref _dCodeword, value); }
+ }
+
+ public string uInterleave
+ {
+ get { return _uInterleave; }
+ set { SetProperty(ref _uInterleave, value); }
+ }
+
+ public string dInterleave
+ {
+ get { return _dInterleave; }
+ set { SetProperty(ref _dInterleave, value); }
+ }
+
+ public int uCRC
+ {
+ get { return _uCRC; }
+ set { SetProperty(ref _uCRC, value); }
+ }
+
+ public int dCRC
+ {
+ get { return _dCRC; }
+ set { SetProperty(ref _dCRC, value); }
+ }
+
+ public int uHEC
+ {
+ get { return _uHEC; }
+ set { SetProperty(ref _uHEC, value); }
+ }
+
+ public int dHEC
+ {
+ get { return _dHEC; }
+ set { SetProperty(ref _dHEC, value); }
+ }
+
+ public int uFEC
+ {
+ get { return _uFEC; }
+ set { SetProperty(ref _uFEC, value); }
+ }
+
+ public int dFEC
+ {
+ get { return _dFEC; }
+ set { SetProperty(ref _dFEC, value); }
+ }
+
+ public double uCRCsec
+ {
+ get { return _uCRCsec; }
+ set { SetProperty(ref _uCRCsec, value); }
+ }
+
+ public double dCRCsec
+ {
+ get { return _dCRCsec; }
+ set { SetProperty(ref _dCRCsec, value); }
+ }
+
+ public double uHECsec
+ {
+ get { return _uHECsec; }
+ set { SetProperty(ref _uHECsec, value); }
+ }
+
+ public double dHECsec
+ {
+ get { return _dHECsec; }
+ set { SetProperty(ref _dHECsec, value); }
+ }
+
+ public double uFECsec
+ {
+ get { return _uFECsec; }
+ set { SetProperty(ref _uFECsec, value); }
+ }
+
+ public double dFECsec
+ {
+ get { return _dFECsec; }
+ set { SetProperty(ref _dFECsec, value); }
+ }
+ }
}
-namespace SpeedportHybridControl.Model {
- public class PhoneCallList : SuperViewModel {
- private int _id;
- private string _date;
- private string _time;
- private string _who;
- private string _duration;
+namespace SpeedportHybridControl.Model
+{
+ public class PhoneCallList : SuperViewModel
+ {
+ private int _id;
+ private string _date;
+ private string _time;
+ private string _who;
+ private string _duration;
- public int id {
- get { return _id; }
- set { SetProperty(ref _id, value); }
- }
+ public int id
+ {
+ get { return _id; }
+ set { SetProperty(ref _id, value); }
+ }
- public string date {
- get { return _date; }
- set { SetProperty(ref _date, value); }
- }
+ public string date
+ {
+ get { return _date; }
+ set { SetProperty(ref _date, value); }
+ }
- public string time {
- get { return _time; }
- set { SetProperty(ref _time, value); }
- }
+ public string time
+ {
+ get { return _time; }
+ set { SetProperty(ref _time, value); }
+ }
- public string who {
- get { return _who; }
- set { SetProperty(ref _who, value); }
- }
+ public string who
+ {
+ get { return _who; }
+ set { SetProperty(ref _who, value); }
+ }
- public string duration {
- get { return _duration; }
- set { SetProperty(ref _duration, value); }
- }
+ public string duration
+ {
+ get { return _duration; }
+ set { SetProperty(ref _duration, value); }
+ }
- public override string ToString () {
- return string.Concat(date, " ", time, " ", who, " ", duration);
- }
+ public override string ToString()
+ {
+ return string.Concat(date, " ", time, " ", who, " ", duration);
+ }
- public PhoneCallList () {
- }
- }
+ public PhoneCallList()
+ {
+ }
+ }
}
-namespace SpeedportHybridControl.Model {
- class StatusPhoneList : SuperViewModel {
- private string _number;
- private string _status;
+namespace SpeedportHybridControl.Model
+{
+ class StatusPhoneList : SuperViewModel
+ {
+ private string _number;
+ private string _status;
- public string number {
- get { return _number; }
- set { SetProperty(ref _number, value); }
- }
+ public string number
+ {
+ get { return _number; }
+ set { SetProperty(ref _number, value); }
+ }
- public string status {
- get { return _status; }
- set { SetProperty(ref _status, value); }
- }
+ public string status
+ {
+ get { return _status; }
+ set { SetProperty(ref _status, value); }
+ }
- public StatusPhoneList () {
+ public StatusPhoneList()
+ {
- }
- }
+ }
+ }
}
using System.Text;
using System.Threading.Tasks;
-namespace SpeedportHybridControl.Model {
- public class SyslogList : SuperViewModel {
- private string _message;
- private string _timestamp;
- private bool _isSelected;
+namespace SpeedportHybridControl.Model
+{
+ public class SyslogList : SuperViewModel
+ {
+ private string _message;
+ private string _timestamp;
+ private bool _isSelected;
- public string message {
- get { return _message; }
- set { SetProperty(ref _message, value); }
- }
+ public string message
+ {
+ get { return _message; }
+ set { SetProperty(ref _message, value); }
+ }
- public string timestamp {
- get { return _timestamp; }
- set { SetProperty(ref _timestamp, value); }
- }
+ public string timestamp
+ {
+ get { return _timestamp; }
+ set { SetProperty(ref _timestamp, value); }
+ }
- public bool IsSelected
- {
- get { return _isSelected; }
- set { SetProperty(ref _isSelected, value); }
- }
+ public bool IsSelected
+ {
+ get { return _isSelected; }
+ set { SetProperty(ref _isSelected, value); }
+ }
- public override string ToString () {
- return string.Concat(timestamp, ": ", message);
- }
+ public override string ToString()
+ {
+ return string.Concat(timestamp, ": ", message);
+ }
- public SyslogList () {
- }
- }
+ public SyslogList()
+ {
+ }
+ }
}
using System.Collections.Generic;
-namespace SpeedportHybridControl.Model {
- class bonding_client : SuperViewModel {
- private List<user_white_list> _user_white_list;
- private List<FLI> _FLI;
- private List<Routing_table> _Routing_table;
- private List<hybrid_show> _hybrid_show;
-
- public List<user_white_list> user_white_list {
- get { return _user_white_list; }
- set { SetProperty(ref _user_white_list, value); }
- }
-
- public List<FLI> FLI {
- get { return _FLI; }
- set { SetProperty(ref _FLI, value); }
- }
-
- public List<Routing_table> Routing_table {
- get { return _Routing_table; }
- set { SetProperty(ref _Routing_table, value); }
- }
-
- public List<hybrid_show> hybrid_show {
- get { return _hybrid_show; }
- set { SetProperty(ref _hybrid_show, value); }
- }
- }
-
- class user_white_list {
- public string s_id {
- get;
- set;
- }
-
- public string s_description {
- get;
- set;
- }
-
- public string s_type {
- get;
- set;
- }
-
- public string s_enable {
- get;
- set;
- }
-
- public string s_filterentry {
- get;
- set;
- }
- }
-
- class FLI {
- public string ID {
- get;
- set;
- }
-
- public string description {
- get;
- set;
- }
-
- public string enable {
- get;
- set;
- }
-
- public string type {
- get;
- set;
- }
-
- public string filterEntry {
- get;
- set;
- }
- }
-
- class Routing_table {
- public string default_route {
- get;
- set;
- }
- }
-
- class hybrid_show {
- public string haap_addr {
- get;
- set;
- }
-
- public string t2v4_addr {
- get;
- set;
- }
-
- public string t2v6_addr {
- get;
- set;
- }
-
- public string t3v4_addr {
- get;
- set;
- }
-
- public string t3v6_addr {
- get;
- set;
- }
-
- public string tunnel_addr {
- get;
- set;
- }
-
- public string bras_pre {
- get;
- set;
- }
-
- public string haap_pre {
- get;
- set;
- }
-
- public string curpre_type {
- get;
- set;
- }
-
- public string check_hello {
- get;
- set;
- }
-
- public string hybrid_cin {
- get;
- set;
- }
-
- public string hybrid_idle_time {
- get;
- set;
- }
-
- public string hybrid_sessionid {
- get;
- set;
- }
-
- public string hybrid_magicnum {
- get;
- set;
- }
-
- public string hybrid_error_code {
- get;
- set;
- }
-
- public string dsl_state {
- get;
- set;
- }
-
- public string dsl_timeoutcnt {
- get;
- set;
- }
-
- public string dsl_intf {
- get;
- set;
- }
-
- public string dsl_local_addr {
- get;
- set;
- }
-
- public string dsl_remote_addr {
- get;
- set;
- }
-
- public string dsl_uploadbw {
- get;
- set;
- }
-
- public string dsl_downloadbw {
- get;
- set;
- }
-
- public string lte_state {
- get;
- set;
- }
-
- public string lte_timeoutcnt {
- get;
- set;
- }
-
- public string lte_intf {
- get;
- set;
- }
-
- public string lte_local_addr {
- get;
- set;
- }
-
- public string lte_remote_addr {
- get;
- set;
- }
-
- public string rtt_mode {
- get;
- set;
- }
-
- public string rtt_threshold {
- get;
- set;
- }
-
- public string rtt_violationtime {
- get;
- set;
- }
-
- public string rtt_compliancetime {
- get;
- set;
- }
-
- public string rtt_dsl {
- get;
- set;
- }
-
- public string rtt_lte {
- get;
- set;
- }
-
- public string rtt_diff {
- get;
- set;
- }
-
- public string bypass_up_bw {
- get;
- set;
- }
-
- public string bypass_dw_bw {
- get;
- set;
- }
-
- public string bypass_up_rb {
- get;
- set;
- }
-
- public string bypass_dw_rb {
- get;
- set;
- }
-
- public string bypass_up_record {
- get;
- set;
- }
-
- public string bypass_dw_record {
- get;
- set;
- }
-
- public string bypass_check {
- get;
- set;
- }
- }
+namespace SpeedportHybridControl.Model
+{
+ class bonding_client : SuperViewModel
+ {
+ private List<user_white_list> _user_white_list;
+ private List<FLI> _FLI;
+ private List<Routing_table> _Routing_table;
+ private List<hybrid_show> _hybrid_show;
+
+ public List<user_white_list> user_white_list
+ {
+ get { return _user_white_list; }
+ set { SetProperty(ref _user_white_list, value); }
+ }
+
+ public List<FLI> FLI
+ {
+ get { return _FLI; }
+ set { SetProperty(ref _FLI, value); }
+ }
+
+ public List<Routing_table> Routing_table
+ {
+ get { return _Routing_table; }
+ set { SetProperty(ref _Routing_table, value); }
+ }
+
+ public List<hybrid_show> hybrid_show
+ {
+ get { return _hybrid_show; }
+ set { SetProperty(ref _hybrid_show, value); }
+ }
+ }
+
+ class user_white_list
+ {
+ public string s_id
+ {
+ get;
+ set;
+ }
+
+ public string s_description
+ {
+ get;
+ set;
+ }
+
+ public string s_type
+ {
+ get;
+ set;
+ }
+
+ public string s_enable
+ {
+ get;
+ set;
+ }
+
+ public string s_filterentry
+ {
+ get;
+ set;
+ }
+ }
+
+ class FLI
+ {
+ public string ID
+ {
+ get;
+ set;
+ }
+
+ public string description
+ {
+ get;
+ set;
+ }
+
+ public string enable
+ {
+ get;
+ set;
+ }
+
+ public string type
+ {
+ get;
+ set;
+ }
+
+ public string filterEntry
+ {
+ get;
+ set;
+ }
+ }
+
+ class Routing_table
+ {
+ public string default_route
+ {
+ get;
+ set;
+ }
+ }
+
+ class hybrid_show
+ {
+ public string haap_addr
+ {
+ get;
+ set;
+ }
+
+ public string t2v4_addr
+ {
+ get;
+ set;
+ }
+
+ public string t2v6_addr
+ {
+ get;
+ set;
+ }
+
+ public string t3v4_addr
+ {
+ get;
+ set;
+ }
+
+ public string t3v6_addr
+ {
+ get;
+ set;
+ }
+
+ public string tunnel_addr
+ {
+ get;
+ set;
+ }
+
+ public string bras_pre
+ {
+ get;
+ set;
+ }
+
+ public string haap_pre
+ {
+ get;
+ set;
+ }
+
+ public string curpre_type
+ {
+ get;
+ set;
+ }
+
+ public string check_hello
+ {
+ get;
+ set;
+ }
+
+ public string hybrid_cin
+ {
+ get;
+ set;
+ }
+
+ public string hybrid_idle_time
+ {
+ get;
+ set;
+ }
+
+ public string hybrid_sessionid
+ {
+ get;
+ set;
+ }
+
+ public string hybrid_magicnum
+ {
+ get;
+ set;
+ }
+
+ public string hybrid_error_code
+ {
+ get;
+ set;
+ }
+
+ public string dsl_state
+ {
+ get;
+ set;
+ }
+
+ public string dsl_timeoutcnt
+ {
+ get;
+ set;
+ }
+
+ public string dsl_intf
+ {
+ get;
+ set;
+ }
+
+ public string dsl_local_addr
+ {
+ get;
+ set;
+ }
+
+ public string dsl_remote_addr
+ {
+ get;
+ set;
+ }
+
+ public string dsl_uploadbw
+ {
+ get;
+ set;
+ }
+
+ public string dsl_downloadbw
+ {
+ get;
+ set;
+ }
+
+ public string lte_state
+ {
+ get;
+ set;
+ }
+
+ public string lte_timeoutcnt
+ {
+ get;
+ set;
+ }
+
+ public string lte_intf
+ {
+ get;
+ set;
+ }
+
+ public string lte_local_addr
+ {
+ get;
+ set;
+ }
+
+ public string lte_remote_addr
+ {
+ get;
+ set;
+ }
+
+ public string rtt_mode
+ {
+ get;
+ set;
+ }
+
+ public string rtt_threshold
+ {
+ get;
+ set;
+ }
+
+ public string rtt_violationtime
+ {
+ get;
+ set;
+ }
+
+ public string rtt_compliancetime
+ {
+ get;
+ set;
+ }
+
+ public string rtt_dsl
+ {
+ get;
+ set;
+ }
+
+ public string rtt_lte
+ {
+ get;
+ set;
+ }
+
+ public string rtt_diff
+ {
+ get;
+ set;
+ }
+
+ public string bypass_up_bw
+ {
+ get;
+ set;
+ }
+
+ public string bypass_dw_bw
+ {
+ get;
+ set;
+ }
+
+ public string bypass_up_rb
+ {
+ get;
+ set;
+ }
+
+ public string bypass_dw_rb
+ {
+ get;
+ set;
+ }
+
+ public string bypass_up_record
+ {
+ get;
+ set;
+ }
+
+ public string bypass_dw_record
+ {
+ get;
+ set;
+ }
+
+ public string bypass_check
+ {
+ get;
+ set;
+ }
+ }
}
using System.Threading;
using System.Windows;
-namespace SpeedportHybridControl.PageModel {
- class AboutPageModel : SuperViewModel {
- private DelegateCommand _donateCommand;
- private DelegateCommand _bugtrackerCommand;
- private DelegateCommand _updateCommand;
-
- public string version
- {
- get { return MainWindowModel.VERSION; }
- }
-
- public DelegateCommand DonateCommand
- {
- get { return _donateCommand; }
- set { SetProperty(ref _donateCommand, value); }
- }
-
- public DelegateCommand BugtrackerCommand
- {
- get { return _bugtrackerCommand; }
- set { SetProperty(ref _bugtrackerCommand, value); }
- }
-
- public DelegateCommand UpdateCommand
- {
- get { return _updateCommand; }
- set { SetProperty(ref _updateCommand, value); }
- }
-
- private void OnDonateCommandExecute () {
- Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E7EBAC5NP928J");
- }
-
- private void OnBugtrackerCommandExecute () {
- Process.Start("https://stricted.net/bugtracker/index.php/ProductList/");
- }
-
- private void OnUpdateCommandExecute () {
- if (util.checkUpdate(MainWindowModel.VERSION).Equals(true)) {
- new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
- }
- else {
- new Thread(() => { MessageBox.Show("SpeedportHybridControl ist auf dem neuesten Stand.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }
-
- public AboutPageModel () {
- DonateCommand = new DelegateCommand(new Action(OnDonateCommandExecute));
- BugtrackerCommand = new DelegateCommand(new Action(OnBugtrackerCommandExecute));
- UpdateCommand = new DelegateCommand(new Action(OnUpdateCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class AboutPageModel : SuperViewModel
+ {
+ private DelegateCommand _donateCommand;
+ private DelegateCommand _bugtrackerCommand;
+ private DelegateCommand _updateCommand;
+
+ public string version
+ {
+ get { return MainWindowModel.VERSION; }
+ }
+
+ public DelegateCommand DonateCommand
+ {
+ get { return _donateCommand; }
+ set { SetProperty(ref _donateCommand, value); }
+ }
+
+ public DelegateCommand BugtrackerCommand
+ {
+ get { return _bugtrackerCommand; }
+ set { SetProperty(ref _bugtrackerCommand, value); }
+ }
+
+ public DelegateCommand UpdateCommand
+ {
+ get { return _updateCommand; }
+ set { SetProperty(ref _updateCommand, value); }
+ }
+
+ private void OnDonateCommandExecute()
+ {
+ Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E7EBAC5NP928J");
+ }
+
+ private void OnBugtrackerCommandExecute()
+ {
+ Process.Start("https://stricted.net/bugtracker/index.php/ProductList/");
+ }
+
+ private void OnUpdateCommandExecute()
+ {
+ if (util.checkUpdate(MainWindowModel.VERSION).Equals(true))
+ {
+ new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
+ }
+ else {
+ new Thread(() => { MessageBox.Show("SpeedportHybridControl ist auf dem neuesten Stand.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }
+
+ public AboutPageModel()
+ {
+ DonateCommand = new DelegateCommand(new Action(OnDonateCommandExecute));
+ BugtrackerCommand = new DelegateCommand(new Action(OnBugtrackerCommandExecute));
+ UpdateCommand = new DelegateCommand(new Action(OnUpdateCommandExecute));
+ }
+ }
}
using System.Threading;
using System.Diagnostics;
-namespace SpeedportHybridControl.PageModel {
- class ControlsPageModel : SuperViewModel {
- private DelegateCommand _rebootCommand;
- private DelegateCommand _dslReconnectCommand;
- private DelegateCommand _lteReconnectCommand;
- private DelegateCommand _dslLteReconnectCommand;
- private DelegateCommand _checkFirmwareUpdateCommand;
- private DelegateCommand _clearDNSCacheCommand;
- private DelegateCommand _speedtestNetCommand;
- private DelegateCommand _speedtestTKCommand;
- private DelegateCommand _disconnectDslCommand;
- private DelegateCommand _connectDslCommand;
- private DelegateCommand _disconnectLteCommand;
- private DelegateCommand _connectLteCommand;
- private DelegateCommand _resetToFactoryCommand;
-
- public DelegateCommand RebootCommand {
- get { return _rebootCommand; }
- set { SetProperty(ref _rebootCommand, value); }
- }
-
- public DelegateCommand DslReconnectcommand {
- get { return _dslReconnectCommand; }
- set { SetProperty(ref _dslReconnectCommand, value); }
- }
-
- public DelegateCommand LteReconncetCommand {
- get { return _lteReconnectCommand; }
- set { SetProperty(ref _lteReconnectCommand, value); }
- }
-
- public DelegateCommand DslLteReconnectCommand {
- get { return _dslLteReconnectCommand; }
- set { SetProperty(ref _dslLteReconnectCommand, value); }
- }
-
- public DelegateCommand CheckFirmwareUpdateCommand {
- get { return _checkFirmwareUpdateCommand; }
- set { SetProperty(ref _checkFirmwareUpdateCommand, value); }
- }
-
- public DelegateCommand ClearDNSCacheCommand {
- get { return _clearDNSCacheCommand; }
- set { SetProperty(ref _clearDNSCacheCommand, value); }
- }
-
- public DelegateCommand SpeedtestNetCommand {
- get { return _speedtestNetCommand; }
- set { SetProperty(ref _speedtestNetCommand, value); }
- }
-
- public DelegateCommand SpeedtestTKCommand {
- get { return _speedtestTKCommand; }
- set { SetProperty(ref _speedtestTKCommand, value); }
- }
-
- public DelegateCommand DisconnectDslCommand {
- get { return _disconnectDslCommand; }
- set { SetProperty(ref _disconnectDslCommand, value); }
- }
-
- public DelegateCommand ConnectDslCommand {
- get { return _connectDslCommand; }
- set { SetProperty(ref _connectDslCommand, value); }
- }
-
- public DelegateCommand DisconnectLteCommand {
- get { return _disconnectLteCommand; }
- set { SetProperty(ref _disconnectLteCommand, value); }
- }
-
- public DelegateCommand ConnectLteCommand {
- get { return _connectLteCommand; }
- set { SetProperty(ref _connectLteCommand, value); }
- }
-
- public DelegateCommand ResetToFactoryCommand {
- get { return _resetToFactoryCommand; }
- set { SetProperty(ref _resetToFactoryCommand, value); }
- }
-
- private void OnRebootCommandExecute () {
- MessageBoxResult result = MessageBox.Show("Willst du den Router wirklich neustarten?", "Confirmation", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
- if (result.Equals(MessageBoxResult.Yes)) {
- SpeedportHybridAPI.getInstance().reboot();
- }
- }
-
- private void OnDslReconnectcommandExecute () {
- new Thread(() => {
- bool reconnectDSL = SpeedportHybridAPI.getInstance().reconnectDSL();
- if (reconnectDSL.Equals(false)) {
- new Thread(() => { MessageBox.Show("Could not reconnect DSL.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not reconnect DSL.");
- }
- else {
- new Thread(() => { MessageBox.Show("DSL reconnected", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }).Start();
- }
-
- private void OnLteReconncetCommandExecute () {
- new Thread(() => {
- bool reconnectLte = SpeedportHybridAPI.getInstance().reconnectLte();
- if (reconnectLte.Equals(false)) {
- new Thread(() => { MessageBox.Show("Could not reconnect LTE.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not reconnect LTE.");
- }
- else {
- new Thread(() => { MessageBox.Show("LTE reconnected", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }).Start();
- }
-
- private void OnDslLteReconnectCommandExecute () {
- //TODO
- }
-
- private void OnCheckFirmwareUpdateCommandExecute () {
- SpeedportHybridAPI.getInstance().checkFirmware();
- }
-
- private void OnClearDNSCacheCommandExecute () {
- new Thread(() => { SpeedportHybridAPI.getInstance().flushDNS(); }).Start();
- }
-
- private void OnSpeedtestNetCommandExecute () {
- Process.Start("http://www.speedtest.net/");
- }
-
- private void OnSpeedtestTKCommandExecute () {
- Process.Start("http://speedtest.t-online.de/");
- }
-
- private void OnDisconnectDslCommandExecute () {
- bool status = SpeedportHybridAPI.getInstance().changeDSLStatus("offline");
- if (status.Equals(false)) {
- new Thread(() => { MessageBox.Show("DSL Trennen Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not disconnect DSL.");
- }
- else {
- new Thread(() => { MessageBox.Show("DSL Trennen erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }
-
- private void OnConnectDslCommandExecute () {
- bool status = SpeedportHybridAPI.getInstance().changeDSLStatus("online");
- if (status.Equals(false)) {
- new Thread(() => { MessageBox.Show("DSL Verbinden Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not connect DSL.");
- }
- else {
- new Thread(() => { MessageBox.Show("DSL Verbinden erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }
-
- private void OnDisconnectLteCommandExecute () {
- bool status = SpeedportHybridAPI.getInstance().changeLTEStatus("offline");
- if (status.Equals(false)) {
- new Thread(() => { MessageBox.Show("LTE Trennen Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not disconnect LTE.");
- }
- else {
- new Thread(() => { MessageBox.Show("LTE Trennen erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }
-
- private void OnConnectLteCommandExecute () {
- bool status = SpeedportHybridAPI.getInstance().changeLTEStatus("online");
- if (status.Equals(false)) {
- new Thread(() => { MessageBox.Show("LTE Verbinden Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not connect LTE.");
- }
- else {
- new Thread(() => { MessageBox.Show("LTE Verbinden erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
- }
- }
-
- private void OnResetToFactoryCommandExecute () {
- MessageBoxResult result = MessageBox.Show("Beim Zurücksetzen auf die Werkseinstellungen gehen alle Ihre Einstellungen verloren.\nSind Sie sicher, dass Sie den Router zurücksetzen möchten ? ", "Confirmation", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
- if (result.Equals(MessageBoxResult.Yes)) {
- bool reconnectDSL = SpeedportHybridAPI.getInstance().resetToFactoryDefault();
- if (reconnectDSL.Equals(false)) {
- new Thread(() => { MessageBox.Show("Could not reset the router.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Could not reset the router.");
- }
- }
- }
-
- public ControlsPageModel () {
- RebootCommand = new DelegateCommand(new Action(OnRebootCommandExecute));
- DslReconnectcommand = new DelegateCommand(new Action(OnDslReconnectcommandExecute));
- LteReconncetCommand = new DelegateCommand(new Action(OnLteReconncetCommandExecute));
- DslLteReconnectCommand = new DelegateCommand(new Action(OnDslLteReconnectCommandExecute));
- CheckFirmwareUpdateCommand = new DelegateCommand(new Action(OnCheckFirmwareUpdateCommandExecute));
- ClearDNSCacheCommand = new DelegateCommand(new Action(OnClearDNSCacheCommandExecute));
- SpeedtestNetCommand = new DelegateCommand(new Action(OnSpeedtestNetCommandExecute));
- SpeedtestTKCommand = new DelegateCommand(new Action(OnSpeedtestTKCommandExecute));
- DisconnectDslCommand = new DelegateCommand(new Action(OnDisconnectDslCommandExecute));
- ConnectDslCommand = new DelegateCommand(new Action(OnConnectDslCommandExecute));
- DisconnectLteCommand = new DelegateCommand(new Action(OnDisconnectLteCommandExecute));
- ConnectLteCommand = new DelegateCommand(new Action(OnConnectLteCommandExecute));
- ResetToFactoryCommand = new DelegateCommand(new Action(OnResetToFactoryCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class ControlsPageModel : SuperViewModel
+ {
+ private DelegateCommand _rebootCommand;
+ private DelegateCommand _dslReconnectCommand;
+ private DelegateCommand _lteReconnectCommand;
+ private DelegateCommand _dslLteReconnectCommand;
+ private DelegateCommand _checkFirmwareUpdateCommand;
+ private DelegateCommand _clearDNSCacheCommand;
+ private DelegateCommand _speedtestNetCommand;
+ private DelegateCommand _speedtestTKCommand;
+ private DelegateCommand _disconnectDslCommand;
+ private DelegateCommand _connectDslCommand;
+ private DelegateCommand _disconnectLteCommand;
+ private DelegateCommand _connectLteCommand;
+ private DelegateCommand _resetToFactoryCommand;
+
+ public DelegateCommand RebootCommand
+ {
+ get { return _rebootCommand; }
+ set { SetProperty(ref _rebootCommand, value); }
+ }
+
+ public DelegateCommand DslReconnectcommand
+ {
+ get { return _dslReconnectCommand; }
+ set { SetProperty(ref _dslReconnectCommand, value); }
+ }
+
+ public DelegateCommand LteReconncetCommand
+ {
+ get { return _lteReconnectCommand; }
+ set { SetProperty(ref _lteReconnectCommand, value); }
+ }
+
+ public DelegateCommand DslLteReconnectCommand
+ {
+ get { return _dslLteReconnectCommand; }
+ set { SetProperty(ref _dslLteReconnectCommand, value); }
+ }
+
+ public DelegateCommand CheckFirmwareUpdateCommand
+ {
+ get { return _checkFirmwareUpdateCommand; }
+ set { SetProperty(ref _checkFirmwareUpdateCommand, value); }
+ }
+
+ public DelegateCommand ClearDNSCacheCommand
+ {
+ get { return _clearDNSCacheCommand; }
+ set { SetProperty(ref _clearDNSCacheCommand, value); }
+ }
+
+ public DelegateCommand SpeedtestNetCommand
+ {
+ get { return _speedtestNetCommand; }
+ set { SetProperty(ref _speedtestNetCommand, value); }
+ }
+
+ public DelegateCommand SpeedtestTKCommand
+ {
+ get { return _speedtestTKCommand; }
+ set { SetProperty(ref _speedtestTKCommand, value); }
+ }
+
+ public DelegateCommand DisconnectDslCommand
+ {
+ get { return _disconnectDslCommand; }
+ set { SetProperty(ref _disconnectDslCommand, value); }
+ }
+
+ public DelegateCommand ConnectDslCommand
+ {
+ get { return _connectDslCommand; }
+ set { SetProperty(ref _connectDslCommand, value); }
+ }
+
+ public DelegateCommand DisconnectLteCommand
+ {
+ get { return _disconnectLteCommand; }
+ set { SetProperty(ref _disconnectLteCommand, value); }
+ }
+
+ public DelegateCommand ConnectLteCommand
+ {
+ get { return _connectLteCommand; }
+ set { SetProperty(ref _connectLteCommand, value); }
+ }
+
+ public DelegateCommand ResetToFactoryCommand
+ {
+ get { return _resetToFactoryCommand; }
+ set { SetProperty(ref _resetToFactoryCommand, value); }
+ }
+
+ private void OnRebootCommandExecute()
+ {
+ MessageBoxResult result = MessageBox.Show("Willst du den Router wirklich neustarten?", "Confirmation", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
+ if (result.Equals(MessageBoxResult.Yes))
+ {
+ SpeedportHybridAPI.getInstance().reboot();
+ }
+ }
+
+ private void OnDslReconnectcommandExecute()
+ {
+ new Thread(() => {
+ bool reconnectDSL = SpeedportHybridAPI.getInstance().reconnectDSL();
+ if (reconnectDSL.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("Could not reconnect DSL.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not reconnect DSL.");
+ }
+ else {
+ new Thread(() => { MessageBox.Show("DSL reconnected", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }).Start();
+ }
+
+ private void OnLteReconncetCommandExecute()
+ {
+ new Thread(() => {
+ bool reconnectLte = SpeedportHybridAPI.getInstance().reconnectLte();
+ if (reconnectLte.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("Could not reconnect LTE.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not reconnect LTE.");
+ }
+ else {
+ new Thread(() => { MessageBox.Show("LTE reconnected", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }).Start();
+ }
+
+ private void OnDslLteReconnectCommandExecute()
+ {
+ //TODO
+ }
+
+ private void OnCheckFirmwareUpdateCommandExecute()
+ {
+ SpeedportHybridAPI.getInstance().checkFirmware();
+ }
+
+ private void OnClearDNSCacheCommandExecute()
+ {
+ new Thread(() => { SpeedportHybridAPI.getInstance().flushDNS(); }).Start();
+ }
+
+ private void OnSpeedtestNetCommandExecute()
+ {
+ Process.Start("http://www.speedtest.net/");
+ }
+
+ private void OnSpeedtestTKCommandExecute()
+ {
+ Process.Start("http://speedtest.t-online.de/");
+ }
+
+ private void OnDisconnectDslCommandExecute()
+ {
+ bool status = SpeedportHybridAPI.getInstance().changeDSLStatus("offline");
+ if (status.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("DSL Trennen Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not disconnect DSL.");
+ }
+ else {
+ new Thread(() => { MessageBox.Show("DSL Trennen erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }
+
+ private void OnConnectDslCommandExecute()
+ {
+ bool status = SpeedportHybridAPI.getInstance().changeDSLStatus("online");
+ if (status.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("DSL Verbinden Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not connect DSL.");
+ }
+ else {
+ new Thread(() => { MessageBox.Show("DSL Verbinden erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }
+
+ private void OnDisconnectLteCommandExecute()
+ {
+ bool status = SpeedportHybridAPI.getInstance().changeLTEStatus("offline");
+ if (status.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("LTE Trennen Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not disconnect LTE.");
+ }
+ else {
+ new Thread(() => { MessageBox.Show("LTE Trennen erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }
+
+ private void OnConnectLteCommandExecute()
+ {
+ bool status = SpeedportHybridAPI.getInstance().changeLTEStatus("online");
+ if (status.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("LTE Verbinden Fehlgeschlagen", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not connect LTE.");
+ }
+ else {
+ new Thread(() => { MessageBox.Show("LTE Verbinden erfolgreich.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+ }
+ }
+
+ private void OnResetToFactoryCommandExecute()
+ {
+ MessageBoxResult result = MessageBox.Show("Beim Zurücksetzen auf die Werkseinstellungen gehen alle Ihre Einstellungen verloren.\nSind Sie sicher, dass Sie den Router zurücksetzen möchten ? ", "Confirmation", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
+ if (result.Equals(MessageBoxResult.Yes))
+ {
+ bool reconnectDSL = SpeedportHybridAPI.getInstance().resetToFactoryDefault();
+ if (reconnectDSL.Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("Could not reset the router.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Could not reset the router.");
+ }
+ }
+ }
+
+ public ControlsPageModel()
+ {
+ RebootCommand = new DelegateCommand(new Action(OnRebootCommandExecute));
+ DslReconnectcommand = new DelegateCommand(new Action(OnDslReconnectcommandExecute));
+ LteReconncetCommand = new DelegateCommand(new Action(OnLteReconncetCommandExecute));
+ DslLteReconnectCommand = new DelegateCommand(new Action(OnDslLteReconnectCommandExecute));
+ CheckFirmwareUpdateCommand = new DelegateCommand(new Action(OnCheckFirmwareUpdateCommandExecute));
+ ClearDNSCacheCommand = new DelegateCommand(new Action(OnClearDNSCacheCommandExecute));
+ SpeedtestNetCommand = new DelegateCommand(new Action(OnSpeedtestNetCommandExecute));
+ SpeedtestTKCommand = new DelegateCommand(new Action(OnSpeedtestTKCommandExecute));
+ DisconnectDslCommand = new DelegateCommand(new Action(OnDisconnectDslCommandExecute));
+ ConnectDslCommand = new DelegateCommand(new Action(OnConnectDslCommandExecute));
+ DisconnectLteCommand = new DelegateCommand(new Action(OnDisconnectLteCommandExecute));
+ ConnectLteCommand = new DelegateCommand(new Action(OnConnectLteCommandExecute));
+ ResetToFactoryCommand = new DelegateCommand(new Action(OnResetToFactoryCommandExecute));
+ }
+ }
}
using System.Timers;
using System.Windows;
-namespace SpeedportHybridControl.PageModel {
- class DslPageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
- private DelegateCommand _autoReloadCommand;
- private bool _autoReload;
- private bool _log;
- private bool _logEnabled;
- private System.Timers.Timer _timer;
-
- private Connection _Connection;
- private Line _Line;
- private string _datetime;
-
- private string _lastCRC;
- private string _lastHEC;
- private string _lastFEC;
-
- private int lastdFEC;
- private int lastuFEC;
- private int lastdHEC;
- private int lastuHEC;
- private int lastdCRC;
- private int lastuCRC;
- private DateTime lastReload;
-
- public Connection Connection {
- get { return _Connection; }
- set { SetProperty(ref _Connection, value); }
- }
-
- public Line Line {
- get { return _Line; }
- set { SetProperty(ref _Line, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- public string lastCRC {
- get { return _lastCRC; }
- set { SetProperty(ref _lastCRC, value); }
- }
-
- public string lastFEC {
- get { return _lastFEC; }
- set { SetProperty(ref _lastFEC, value); }
- }
-
- public string lastHEC {
- get { return _lastHEC; }
- set { SetProperty(ref _lastHEC, value); }
- }
-
-
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
-
- public DelegateCommand AutoReloadCommand {
- get { return _autoReloadCommand; }
- set { SetProperty(ref _autoReloadCommand, value); }
- }
-
- public bool AutoReload {
- get { return _autoReload; }
- set { SetProperty(ref _autoReload, value); }
- }
-
- public bool Log {
- get { return _log; }
- set { SetProperty(ref _log, value); }
- }
-
- public bool LogEnabled {
- get { return _logEnabled; }
- set { SetProperty(ref _logEnabled, value); }
- }
-
- private void OnReloadCommandExecute () {
- new Thread(() => {
- SpeedportHybrid.initDSL();
-
- if (lastReload.Equals(DateTime.MinValue).Equals(false)) {
- DateTime now = DateTime.Now;
- double difference = Math.Ceiling(Math.Ceiling((DateTime.Now - lastReload).TotalSeconds) / 60);
-
- double diffdCRC = Math.Ceiling((Line.dCRC - lastdCRC) / difference);
- double diffuCRC = Math.Ceiling((Line.uCRC - lastuCRC) / difference);
- lastCRC = string.Format("CRC/min (last {0} min) Upstream: {1} Downstream: {2}", difference, diffuCRC, diffdCRC);
-
- double diffdHEC = Math.Ceiling((Line.dHEC - lastdHEC) / difference);
- double diffuHEC = Math.Ceiling((Line.uHEC - lastuHEC) / difference);
- lastHEC = string.Format("HEC/min (last {0} min) Upstream: {1} Downstream: {2}", difference, diffuHEC, diffdHEC);
-
- double diffdFEC = Math.Ceiling((Line.dFEC - lastdFEC) / difference);
- double diffuFEC = Math.Ceiling((Line.uFEC - lastuFEC) / difference);
- lastFEC = string.Format("FEC/min (last {0} min) Upstream: {1} Downstream: {2}", difference, diffuFEC, diffdFEC);
- }
-
- lastReload = DateTime.Now;
- lastdCRC = Line.dCRC;
- lastuCRC = Line.uCRC;
-
- lastdHEC = Line.dHEC;
- lastuHEC = Line.uHEC;
-
- lastdFEC = Line.dFEC;
- lastuFEC = Line.uFEC;
- }).Start();
- }
-
- private void OnAutoReloadCommandExecute () {
- if (AutoReload.Equals(true)) {
- StartTimer();
- LogEnabled = true;
- }
- else {
- StopTimer();
- }
- }
-
- public void StopTimer () {
- if (Object.Equals(_timer, null).Equals(false)) {
- _timer.Stop();
- }
-
- if (AutoReload.Equals(true)) {
- AutoReload = false;
- }
-
- if (Log.Equals(true)) {
- Log = false;
- }
-
- LogEnabled = false;
- }
-
- private void StartTimer () {
- _timer = new System.Timers.Timer {
- Interval = 1000, // every second
- };
-
- _timer.Elapsed += timer_Elapsed;
- _timer.Start();
- }
-
- private void timer_Elapsed (object sender, ElapsedEventArgs e) {
- SpeedportHybrid.initDSL();
-
- Application.Current.Dispatcher.BeginInvoke(new Action(() => {
- if (Log.Equals(true)) {
- //log
- string prepare = "State: {0}, Actual Data Rate: up: {1} down: {2}, Attainable Data Rate: up: {3} down: {4}, SNR Margin up: {5} down: {6}, CRC error count: up: {7} down: {8}, HEC error count: up: {9} down: {10}, FEC error count: up: {11} down: {12}";
- log(string.Format(prepare, Connection.state, Line.uactual, Line.dactual, Line.uattainable, Line.dattainable, Line.uSNR, Line.dSNR, Line.uCRC, Line.dCRC, Line.uHEC, Line.dHEC, Line.uFEC, Line.dFEC));
- log(string.Format("CRC/min up: {0} down: {1}, HEC/min up: {2} down: {3}, FEC/min up: {4} down: {5}", Line.uCRCsec, Line.dCRCsec, Line.uHECsec, Line.dHECsec, Line.uFECsec, Line.dFECsec));
- }
- }));
- }
-
- private void log (string value) {
- DateTime time = DateTime.Now;
-
- if (Directory.Exists("log/").Equals(false))
- Directory.CreateDirectory("log/");
-
- if (Directory.Exists("log/dsl/").Equals(false))
- Directory.CreateDirectory("log/dsl/");
-
- StreamWriter file = new StreamWriter(string.Concat("log/dsl/", time.ToString("dd.MM.yyyy"), ".txt"), true);
- file.WriteLine(string.Concat("[", time.ToString("dd.MM.yyyy HH:mm:ss"), "]: ", value));
- file.Close();
- }
-
- public DslPageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- AutoReloadCommand = new DelegateCommand(new Action(OnAutoReloadCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class DslPageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+ private DelegateCommand _autoReloadCommand;
+ private bool _autoReload;
+ private bool _log;
+ private bool _logEnabled;
+ private System.Timers.Timer _timer;
+
+ private Connection _Connection;
+ private Line _Line;
+ private string _datetime;
+
+ private string _lastCRC;
+ private string _lastHEC;
+ private string _lastFEC;
+
+ private int lastdFEC;
+ private int lastuFEC;
+ private int lastdHEC;
+ private int lastuHEC;
+ private int lastdCRC;
+ private int lastuCRC;
+ private DateTime lastReload;
+
+ public Connection Connection
+ {
+ get { return _Connection; }
+ set { SetProperty(ref _Connection, value); }
+ }
+
+ public Line Line
+ {
+ get { return _Line; }
+ set { SetProperty(ref _Line, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ public string lastCRC
+ {
+ get { return _lastCRC; }
+ set { SetProperty(ref _lastCRC, value); }
+ }
+
+ public string lastFEC
+ {
+ get { return _lastFEC; }
+ set { SetProperty(ref _lastFEC, value); }
+ }
+
+ public string lastHEC
+ {
+ get { return _lastHEC; }
+ set { SetProperty(ref _lastHEC, value); }
+ }
+
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ public DelegateCommand AutoReloadCommand
+ {
+ get { return _autoReloadCommand; }
+ set { SetProperty(ref _autoReloadCommand, value); }
+ }
+
+ public bool AutoReload
+ {
+ get { return _autoReload; }
+ set { SetProperty(ref _autoReload, value); }
+ }
+
+ public bool Log
+ {
+ get { return _log; }
+ set { SetProperty(ref _log, value); }
+ }
+
+ public bool LogEnabled
+ {
+ get { return _logEnabled; }
+ set { SetProperty(ref _logEnabled, value); }
+ }
+
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => {
+ SpeedportHybrid.initDSL();
+
+ if (lastReload.Equals(DateTime.MinValue).Equals(false))
+ {
+ DateTime now = DateTime.Now;
+ double difference = Math.Ceiling(Math.Ceiling((DateTime.Now - lastReload).TotalSeconds) / 60);
+
+ double diffdCRC = Math.Ceiling((Line.dCRC - lastdCRC) / difference);
+ double diffuCRC = Math.Ceiling((Line.uCRC - lastuCRC) / difference);
+ lastCRC = string.Format("CRC/min (last {0} min) Upstream: {1} Downstream: {2}", difference, diffuCRC, diffdCRC);
+
+ double diffdHEC = Math.Ceiling((Line.dHEC - lastdHEC) / difference);
+ double diffuHEC = Math.Ceiling((Line.uHEC - lastuHEC) / difference);
+ lastHEC = string.Format("HEC/min (last {0} min) Upstream: {1} Downstream: {2}", difference, diffuHEC, diffdHEC);
+
+ double diffdFEC = Math.Ceiling((Line.dFEC - lastdFEC) / difference);
+ double diffuFEC = Math.Ceiling((Line.uFEC - lastuFEC) / difference);
+ lastFEC = string.Format("FEC/min (last {0} min) Upstream: {1} Downstream: {2}", difference, diffuFEC, diffdFEC);
+ }
+
+ lastReload = DateTime.Now;
+ lastdCRC = Line.dCRC;
+ lastuCRC = Line.uCRC;
+
+ lastdHEC = Line.dHEC;
+ lastuHEC = Line.uHEC;
+
+ lastdFEC = Line.dFEC;
+ lastuFEC = Line.uFEC;
+ }).Start();
+ }
+
+ private void OnAutoReloadCommandExecute()
+ {
+ if (AutoReload.Equals(true))
+ {
+ StartTimer();
+ LogEnabled = true;
+ }
+ else {
+ StopTimer();
+ }
+ }
+
+ public void StopTimer()
+ {
+ if (Object.Equals(_timer, null).Equals(false))
+ {
+ _timer.Stop();
+ }
+
+ if (AutoReload.Equals(true))
+ {
+ AutoReload = false;
+ }
+
+ if (Log.Equals(true))
+ {
+ Log = false;
+ }
+
+ LogEnabled = false;
+ }
+
+ private void StartTimer()
+ {
+ _timer = new System.Timers.Timer
+ {
+ Interval = 1000, // every second
+ };
+
+ _timer.Elapsed += timer_Elapsed;
+ _timer.Start();
+ }
+
+ private void timer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ SpeedportHybrid.initDSL();
+
+ Application.Current.Dispatcher.BeginInvoke(new Action(() => {
+ if (Log.Equals(true))
+ {
+ //log
+ string prepare = "State: {0}, Actual Data Rate: up: {1} down: {2}, Attainable Data Rate: up: {3} down: {4}, SNR Margin up: {5} down: {6}, CRC error count: up: {7} down: {8}, HEC error count: up: {9} down: {10}, FEC error count: up: {11} down: {12}";
+ log(string.Format(prepare, Connection.state, Line.uactual, Line.dactual, Line.uattainable, Line.dattainable, Line.uSNR, Line.dSNR, Line.uCRC, Line.dCRC, Line.uHEC, Line.dHEC, Line.uFEC, Line.dFEC));
+ log(string.Format("CRC/min up: {0} down: {1}, HEC/min up: {2} down: {3}, FEC/min up: {4} down: {5}", Line.uCRCsec, Line.dCRCsec, Line.uHECsec, Line.dHECsec, Line.uFECsec, Line.dFECsec));
+ }
+ }));
+ }
+
+ private void log(string value)
+ {
+ DateTime time = DateTime.Now;
+
+ if (Directory.Exists("log/").Equals(false))
+ Directory.CreateDirectory("log/");
+
+ if (Directory.Exists("log/dsl/").Equals(false))
+ Directory.CreateDirectory("log/dsl/");
+
+ StreamWriter file = new StreamWriter(string.Concat("log/dsl/", time.ToString("dd.MM.yyyy"), ".txt"), true);
+ file.WriteLine(string.Concat("[", time.ToString("dd.MM.yyyy HH:mm:ss"), "]: ", value));
+ file.Close();
+ }
+
+ public DslPageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ AutoReloadCommand = new DelegateCommand(new Action(OnAutoReloadCommandExecute));
+ }
+ }
}
using System.Threading;
using System.Threading.Tasks;
-namespace SpeedportHybridControl.PageModel {
- class InterfacePageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
- private List<InterfaceList> _interfaceList;
- private string _datetime;
+namespace SpeedportHybridControl.PageModel
+{
+ class InterfacePageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+ private List<InterfaceList> _interfaceList;
+ private string _datetime;
- public DelegateCommand ReloadCommand
- {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
- public List<InterfaceList> interfaceList
- {
- get { return _interfaceList; }
- set { SetProperty(ref _interfaceList, value); }
- }
+ public List<InterfaceList> interfaceList
+ {
+ get { return _interfaceList; }
+ set { SetProperty(ref _interfaceList, value); }
+ }
- public string datetime
- {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initInterface(); }).Start();
- }
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initInterface(); }).Start();
+ }
- public InterfacePageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- }
- }
+ public InterfacePageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ }
+ }
}
using SpeedportHybridControl.Implementations;
using System.Threading;
-namespace SpeedportHybridControl.PageModel {
- class LanPageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
+namespace SpeedportHybridControl.PageModel
+{
+ class LanPageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
- private List<DeviceList> _deviceList;
- private string _datetime;
+ private List<DeviceList> _deviceList;
+ private string _datetime;
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
- public List<DeviceList> deviceList {
- get { return _deviceList; }
- set { SetProperty(ref _deviceList, value); }
- }
+ public List<DeviceList> deviceList
+ {
+ get { return _deviceList; }
+ set { SetProperty(ref _deviceList, value); }
+ }
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initLan(); }).Start();
- }
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initLan(); }).Start();
+ }
- public LanPageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- }
- }
+ public LanPageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ }
+ }
}
using System.Threading;
using SpeedportHybridControl.Model;
-namespace SpeedportHybridControl.PageModel {
- class LoginPageModel : SuperViewModel {
- private string _ip = "speedport.ip";
- private string _password;
- private string _loginButtonText = "Login";
- private bool _showPassword;
- private bool _savePassword;
- private Visibility _passwordBoxVisibility = Visibility.Visible;
- private Visibility _passwordTextBoxVisibility = Visibility.Hidden;
- private Visibility _loginFieldsVisibility = Visibility.Visible;
-
- private DelegateCommand _showPasswordCommand;
- private DelegateCommand _savePasswordCommand;
- private DelegateCommand _loginCommand;
-
- public string ip {
- get { return _ip; }
- set { SetProperty(ref _ip, value); }
- }
-
- public string password {
- get { return _password; }
- set { SetProperty(ref _password, value); }
- }
-
- public string LoginButtonText {
- get { return _loginButtonText; }
- set { SetProperty(ref _loginButtonText, value); }
- }
-
- public bool ShowPassword {
- get { return _showPassword; }
- set { SetProperty(ref _showPassword, value); }
- }
-
- public bool SavePassword {
- get { return _savePassword; }
- set { SetProperty(ref _savePassword, value); }
- }
-
- public Visibility PasswordBoxVisibility {
- get { return _passwordBoxVisibility; }
- set { SetProperty(ref _passwordBoxVisibility, value); }
- }
-
- public Visibility PasswordTextBoxVisibility {
- get { return _passwordTextBoxVisibility; }
- set { SetProperty(ref _passwordTextBoxVisibility, value); }
- }
-
- public Visibility LoginFieldsVisibility {
- get { return _loginFieldsVisibility; }
- set { SetProperty(ref _loginFieldsVisibility, value); }
- }
-
- public DelegateCommand ShowPasswordCommand {
- get { return _showPasswordCommand; }
- set { SetProperty(ref _showPasswordCommand, value); }
- }
-
- public DelegateCommand SavePasswordCommand {
- get { return _savePasswordCommand; }
- set { SetProperty(ref _savePasswordCommand, value); }
- }
-
- public DelegateCommand LoginCommand {
- get { return _loginCommand; }
- set { SetProperty(ref _loginCommand, value); }
- }
-
- private void OnShowPasswordCommandExecute () {
- if (ShowPassword.Equals(true)) {
- PasswordBoxVisibility = Visibility.Hidden;
- PasswordTextBoxVisibility = Visibility.Visible;
+namespace SpeedportHybridControl.PageModel
+{
+ class LoginPageModel : SuperViewModel
+ {
+ private string _ip = "speedport.ip";
+ private string _password;
+ private string _loginButtonText = "Login";
+ private bool _showPassword;
+ private bool _savePassword;
+ private Visibility _passwordBoxVisibility = Visibility.Visible;
+ private Visibility _passwordTextBoxVisibility = Visibility.Hidden;
+ private Visibility _loginFieldsVisibility = Visibility.Visible;
+
+ private DelegateCommand _showPasswordCommand;
+ private DelegateCommand _savePasswordCommand;
+ private DelegateCommand _loginCommand;
+
+ public string ip
+ {
+ get { return _ip; }
+ set { SetProperty(ref _ip, value); }
+ }
+
+ public string password
+ {
+ get { return _password; }
+ set { SetProperty(ref _password, value); }
+ }
+
+ public string LoginButtonText
+ {
+ get { return _loginButtonText; }
+ set { SetProperty(ref _loginButtonText, value); }
+ }
+
+ public bool ShowPassword
+ {
+ get { return _showPassword; }
+ set { SetProperty(ref _showPassword, value); }
+ }
+
+ public bool SavePassword
+ {
+ get { return _savePassword; }
+ set { SetProperty(ref _savePassword, value); }
+ }
+
+ public Visibility PasswordBoxVisibility
+ {
+ get { return _passwordBoxVisibility; }
+ set { SetProperty(ref _passwordBoxVisibility, value); }
+ }
+
+ public Visibility PasswordTextBoxVisibility
+ {
+ get { return _passwordTextBoxVisibility; }
+ set { SetProperty(ref _passwordTextBoxVisibility, value); }
+ }
+
+ public Visibility LoginFieldsVisibility
+ {
+ get { return _loginFieldsVisibility; }
+ set { SetProperty(ref _loginFieldsVisibility, value); }
+ }
+
+ public DelegateCommand ShowPasswordCommand
+ {
+ get { return _showPasswordCommand; }
+ set { SetProperty(ref _showPasswordCommand, value); }
+ }
+
+ public DelegateCommand SavePasswordCommand
+ {
+ get { return _savePasswordCommand; }
+ set { SetProperty(ref _savePasswordCommand, value); }
+ }
+
+ public DelegateCommand LoginCommand
+ {
+ get { return _loginCommand; }
+ set { SetProperty(ref _loginCommand, value); }
+ }
+
+ private void OnShowPasswordCommandExecute()
+ {
+ if (ShowPassword.Equals(true))
+ {
+ PasswordBoxVisibility = Visibility.Hidden;
+ PasswordTextBoxVisibility = Visibility.Visible;
}
- else {
- PasswordBoxVisibility = Visibility.Visible;
- PasswordTextBoxVisibility = Visibility.Hidden;
- }
- }
-
- private void OnSavePasswordCommandExecute () {
- Console.WriteLine(SavePassword);
- }
-
- private void OnLoginCommandExecute () {
- MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
-
- if (LoginButtonText.Equals("Login")) {
- if (SpeedportHybridAPI.getInstance().ip.Equals(ip).Equals(false)) {
- SpeedportHybridAPI.getInstance().ip = ip;
- }
-
- bool login = SpeedportHybridAPI.getInstance().login(password);
- if (login.Equals(true)) {
- if (SavePassword.Equals(true)) {
- SettingsModel SettingsModel = new SettingsModel {
- password = password,
- ip = SpeedportHybridAPI.getInstance().ip
- };
-
- Settings.save(SettingsModel);
- }
- else {
- SettingsModel SettingsModel = new SettingsModel {
- password = string.Empty,
- ip = SpeedportHybridAPI.getInstance().ip
- };
-
- Settings.save(SettingsModel);
- }
- LoginFieldsVisibility = Visibility.Hidden;
- mwm.ButtonOverviewPageIsActive = true;
- mwm.ButtonDSLPageIsActive = true;
- mwm.ButtonLteInfoPageIsActive = true;
- mwm.ButtonSyslogPageIsActive = true;
- mwm.ButtonTR181PageIsActive = true;
- mwm.ButtonPhonePageIsActive = true;
- mwm.ButtonLanPageIsActive = true;
- mwm.ButtonInterfacePageIsActive = true;
- mwm.ButtonControlsPageIsActive = true;
-
- LoginButtonText = "Logout";
- mwm.LoginButtonContent = "Logout";
- }
- else {
- new Thread(() => { MessageBox.Show("Login fehlgeschlagen. Sie haben ein falsches Gerätepasswort eingegeben. Bitte versuchen Sie es erneut und achten Sie auf die korrekte Schreibweise.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
- LogManager.WriteToLog("Login Failed, wrong password");
- }
- }
- else {
- if (SpeedportHybridAPI.getInstance().logout().Equals(true)) {
- // TODO: util.logout();
- LogoutAction();
- }
- }
- }
-
- public void LogoutAction () {
- MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
- LoginFieldsVisibility = Visibility.Visible;
- mwm.ButtonOverviewPageIsActive = false;
- mwm.ButtonDSLPageIsActive = false;
- mwm.ButtonLteInfoPageIsActive = false;
- mwm.ButtonSyslogPageIsActive = false;
- mwm.ButtonTR181PageIsActive = false;
- mwm.ButtonPhonePageIsActive = false;
- mwm.ButtonLanPageIsActive = false;
- mwm.ButtonInterfacePageIsActive = false;
- mwm.ButtonControlsPageIsActive = false;
-
- LoginButtonText = "Login";
- mwm.LoginButtonContent = "Login";
- }
-
- public LoginPageModel () {
- SettingsModel settings = Settings.load();
- if (settings.ip.IsNullOrEmpty().Equals(false)) {
- ip = settings.ip;
- }
-
- SpeedportHybridAPI.getInstance().ip = ip;
-
- if (settings.password.IsNullOrEmpty().Equals(false)) {
- SavePassword = true;
- password = settings.password;
- }
-
- ShowPasswordCommand = new DelegateCommand(new Action(OnShowPasswordCommandExecute));
- SavePasswordCommand = new DelegateCommand(new Action(OnSavePasswordCommandExecute));
- LoginCommand = new DelegateCommand(new Action(OnLoginCommandExecute));
- }
- }
+ else {
+ PasswordBoxVisibility = Visibility.Visible;
+ PasswordTextBoxVisibility = Visibility.Hidden;
+ }
+ }
+
+ private void OnSavePasswordCommandExecute()
+ {
+ Console.WriteLine(SavePassword);
+ }
+
+ private void OnLoginCommandExecute()
+ {
+ MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
+
+ if (LoginButtonText.Equals("Login"))
+ {
+ if (SpeedportHybridAPI.getInstance().ip.Equals(ip).Equals(false))
+ {
+ SpeedportHybridAPI.getInstance().ip = ip;
+ }
+
+ bool login = SpeedportHybridAPI.getInstance().login(password);
+ if (login.Equals(true))
+ {
+ if (SavePassword.Equals(true))
+ {
+ SettingsModel SettingsModel = new SettingsModel
+ {
+ password = password,
+ ip = SpeedportHybridAPI.getInstance().ip
+ };
+
+ Settings.save(SettingsModel);
+ }
+ else {
+ SettingsModel SettingsModel = new SettingsModel
+ {
+ password = string.Empty,
+ ip = SpeedportHybridAPI.getInstance().ip
+ };
+
+ Settings.save(SettingsModel);
+ }
+ LoginFieldsVisibility = Visibility.Hidden;
+ mwm.ButtonOverviewPageIsActive = true;
+ mwm.ButtonDSLPageIsActive = true;
+ mwm.ButtonLteInfoPageIsActive = true;
+ mwm.ButtonSyslogPageIsActive = true;
+ mwm.ButtonTR181PageIsActive = true;
+ mwm.ButtonPhonePageIsActive = true;
+ mwm.ButtonLanPageIsActive = true;
+ mwm.ButtonInterfacePageIsActive = true;
+ mwm.ButtonControlsPageIsActive = true;
+
+ LoginButtonText = "Logout";
+ mwm.LoginButtonContent = "Logout";
+ }
+ else {
+ new Thread(() => { MessageBox.Show("Login fehlgeschlagen. Sie haben ein falsches Gerätepasswort eingegeben. Bitte versuchen Sie es erneut und achten Sie auf die korrekte Schreibweise.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("Login Failed, wrong password");
+ }
+ }
+ else {
+ if (SpeedportHybridAPI.getInstance().logout().Equals(true))
+ {
+ // TODO: util.logout();
+ LogoutAction();
+ }
+ }
+ }
+
+ public void LogoutAction()
+ {
+ MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;
+ LoginFieldsVisibility = Visibility.Visible;
+ mwm.ButtonOverviewPageIsActive = false;
+ mwm.ButtonDSLPageIsActive = false;
+ mwm.ButtonLteInfoPageIsActive = false;
+ mwm.ButtonSyslogPageIsActive = false;
+ mwm.ButtonTR181PageIsActive = false;
+ mwm.ButtonPhonePageIsActive = false;
+ mwm.ButtonLanPageIsActive = false;
+ mwm.ButtonInterfacePageIsActive = false;
+ mwm.ButtonControlsPageIsActive = false;
+
+ LoginButtonText = "Login";
+ mwm.LoginButtonContent = "Login";
+ }
+
+ public LoginPageModel()
+ {
+ SettingsModel settings = Settings.load();
+ if (settings.ip.IsNullOrEmpty().Equals(false))
+ {
+ ip = settings.ip;
+ }
+
+ SpeedportHybridAPI.getInstance().ip = ip;
+
+ if (settings.password.IsNullOrEmpty().Equals(false))
+ {
+ SavePassword = true;
+ password = settings.password;
+ }
+
+ ShowPasswordCommand = new DelegateCommand(new Action(OnShowPasswordCommandExecute));
+ SavePasswordCommand = new DelegateCommand(new Action(OnSavePasswordCommandExecute));
+ LoginCommand = new DelegateCommand(new Action(OnLoginCommandExecute));
+ }
+ }
}
using System.Windows.Controls;
using System.Windows.Media;
-namespace SpeedportHybridControl.PageModel {
- class LteInfoModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
- private DelegateCommand _autoReloadCommand;
- private DelegateCommand _saveCommand;
- private DelegateCommand _popupCommand;
- private System.Timers.Timer _timer;
- private bool _autoReload;
- private ltepopup _ltepopup;
- private ComboBoxItem _selectedItem;
-
-
- private string _imei;
- private string _imsi;
- private string _device_status;
- private string _card_status;
- private string _antenna_mode;
- private string _antenna_mode2;
- private string _phycellid;
- private string _cellid;
- private string _rsrp;
- private Brush _rsrp_bg = Brushes.Transparent;
- private string _rsrq;
- private Brush _rsrq_bg = Brushes.Transparent;
- private string _service_status;
- private string _tac;
- private string _datetime;
- private string _frequenz;
-
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
-
- public DelegateCommand AutoReloadCommand {
- get { return _autoReloadCommand; }
- set { SetProperty(ref _autoReloadCommand, value); }
- }
-
- public DelegateCommand SaveCommand {
- get { return _saveCommand; }
- set { SetProperty(ref _saveCommand, value); }
- }
-
- public DelegateCommand PopupCommand {
- get { return _popupCommand; }
- set { SetProperty(ref _popupCommand, value); }
- }
-
- public ComboBoxItem SelectedItem {
- get { return _selectedItem; }
- set { SetProperty(ref _selectedItem, value); }
- }
-
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initLTE(); }).Start();
- }
-
- private void OnAutoReloadCommandExecute () {
- if (AutoReload.Equals(true)) {
- StartTimer();
- }
- else {
- StopTimer();
- }
- }
-
- private void OnSaveCommandExecute () {
- SpeedportHybridAPI.getInstance().setAntennaMode(SelectedItem.Name);
- OnReloadCommandExecute();
- }
-
- private void OnPopupCommandExecute () {
- if (Object.Equals(_ltepopup, null)) {
- _ltepopup = new ltepopup();
- }
- else if (Object.Equals(_ltepopup, null).Equals(false) && _ltepopup.IsLoaded.Equals(false)) {
- _ltepopup = null;
- _ltepopup = new ltepopup();
- }
-
- if (_ltepopup.Visibility.Equals(Visibility.Visible).Equals(false)) {
- _ltepopup.Show();
- StopTimer();
-
- ltepopupModel lm = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
- lm.StartTimer();
- }
- }
-
- public bool AutoReload {
- get { return _autoReload; }
- set { SetProperty(ref _autoReload, value); }
- }
-
- public void StopTimer () {
- if (Object.Equals(_timer, null).Equals(false)) {
- _timer.Stop();
- }
-
- if (AutoReload.Equals(true)) {
- AutoReload = false;
- }
- }
-
- private void StartTimer () {
- _timer = new System.Timers.Timer {
- Interval = 1000, // every second
- };
-
- _timer.Elapsed += timer_Elapsed;
- _timer.Start();
- }
-
- private void timer_Elapsed (object sender, ElapsedEventArgs e) {
- OnReloadCommandExecute();
- }
-
- public string imei {
- get { return _imei; }
- set { SetProperty(ref _imei, value); }
- }
-
- public string imsi {
- get { return _imsi; }
- set { SetProperty(ref _imsi, value); }
- }
-
- public string device_status {
- get { return _device_status; }
- set { SetProperty(ref _device_status, value); }
- }
-
- public string card_status {
- get { return _card_status; }
- set { SetProperty(ref _card_status, value); }
- }
-
- public string antenna_mode {
- get { return _antenna_mode; }
- set { SetProperty(ref _antenna_mode, value); }
- }
-
- public string antenna_mode2 {
- get { return _antenna_mode2; }
- set { SetProperty(ref _antenna_mode2, value); }
- }
-
- public string phycellid {
- get { return _phycellid; }
- set { SetProperty(ref _phycellid, value); }
- }
-
- public string cellid {
- get { return _cellid; }
- set { SetProperty(ref _cellid, value); }
- }
-
- public string rsrp {
- get { return _rsrp; }
- set { SetProperty(ref _rsrp, value); }
- }
-
- public Brush rsrp_bg {
- get { return _rsrp_bg; }
- set { SetProperty(ref _rsrp_bg, value); }
- }
-
- public string rsrq {
- get { return _rsrq; }
- set { SetProperty(ref _rsrq, value); }
- }
-
- public Brush rsrq_bg {
- get { return _rsrq_bg; }
- set { SetProperty(ref _rsrq_bg, value); }
- }
-
- public string service_status {
- get { return _service_status; }
- set { SetProperty(ref _service_status, value); }
- }
-
- public string tac {
- get { return _tac; }
- set { SetProperty(ref _tac, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- public string frequenz {
- get { return _frequenz; }
- set { SetProperty(ref _frequenz, value); }
- }
-
- public LteInfoModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- AutoReloadCommand = new DelegateCommand(new Action(OnAutoReloadCommandExecute));
- SaveCommand = new DelegateCommand(new Action(OnSaveCommandExecute));
- PopupCommand = new DelegateCommand(new Action(OnPopupCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class LteInfoModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+ private DelegateCommand _autoReloadCommand;
+ private DelegateCommand _saveCommand;
+ private DelegateCommand _popupCommand;
+ private System.Timers.Timer _timer;
+ private bool _autoReload;
+ private ltepopup _ltepopup;
+ private ComboBoxItem _selectedItem;
+
+
+ private string _imei;
+ private string _imsi;
+ private string _device_status;
+ private string _card_status;
+ private string _antenna_mode;
+ private string _antenna_mode2;
+ private string _phycellid;
+ private string _cellid;
+ private string _rsrp;
+ private Brush _rsrp_bg = Brushes.Transparent;
+ private string _rsrq;
+ private Brush _rsrq_bg = Brushes.Transparent;
+ private string _service_status;
+ private string _tac;
+ private string _datetime;
+ private string _frequenz;
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ public DelegateCommand AutoReloadCommand
+ {
+ get { return _autoReloadCommand; }
+ set { SetProperty(ref _autoReloadCommand, value); }
+ }
+
+ public DelegateCommand SaveCommand
+ {
+ get { return _saveCommand; }
+ set { SetProperty(ref _saveCommand, value); }
+ }
+
+ public DelegateCommand PopupCommand
+ {
+ get { return _popupCommand; }
+ set { SetProperty(ref _popupCommand, value); }
+ }
+
+ public ComboBoxItem SelectedItem
+ {
+ get { return _selectedItem; }
+ set { SetProperty(ref _selectedItem, value); }
+ }
+
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initLTE(); }).Start();
+ }
+
+ private void OnAutoReloadCommandExecute()
+ {
+ if (AutoReload.Equals(true))
+ {
+ StartTimer();
+ }
+ else {
+ StopTimer();
+ }
+ }
+
+ private void OnSaveCommandExecute()
+ {
+ SpeedportHybridAPI.getInstance().setAntennaMode(SelectedItem.Name);
+ OnReloadCommandExecute();
+ }
+
+ private void OnPopupCommandExecute()
+ {
+ if (Object.Equals(_ltepopup, null))
+ {
+ _ltepopup = new ltepopup();
+ }
+ else if (Object.Equals(_ltepopup, null).Equals(false) && _ltepopup.IsLoaded.Equals(false))
+ {
+ _ltepopup = null;
+ _ltepopup = new ltepopup();
+ }
+
+ if (_ltepopup.Visibility.Equals(Visibility.Visible).Equals(false))
+ {
+ _ltepopup.Show();
+ StopTimer();
+
+ ltepopupModel lm = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
+ lm.StartTimer();
+ }
+ }
+
+ public bool AutoReload
+ {
+ get { return _autoReload; }
+ set { SetProperty(ref _autoReload, value); }
+ }
+
+ public void StopTimer()
+ {
+ if (Object.Equals(_timer, null).Equals(false))
+ {
+ _timer.Stop();
+ }
+
+ if (AutoReload.Equals(true))
+ {
+ AutoReload = false;
+ }
+ }
+
+ private void StartTimer()
+ {
+ _timer = new System.Timers.Timer
+ {
+ Interval = 1000, // every second
+ };
+
+ _timer.Elapsed += timer_Elapsed;
+ _timer.Start();
+ }
+
+ private void timer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ OnReloadCommandExecute();
+ }
+
+ public string imei
+ {
+ get { return _imei; }
+ set { SetProperty(ref _imei, value); }
+ }
+
+ public string imsi
+ {
+ get { return _imsi; }
+ set { SetProperty(ref _imsi, value); }
+ }
+
+ public string device_status
+ {
+ get { return _device_status; }
+ set { SetProperty(ref _device_status, value); }
+ }
+
+ public string card_status
+ {
+ get { return _card_status; }
+ set { SetProperty(ref _card_status, value); }
+ }
+
+ public string antenna_mode
+ {
+ get { return _antenna_mode; }
+ set { SetProperty(ref _antenna_mode, value); }
+ }
+
+ public string antenna_mode2
+ {
+ get { return _antenna_mode2; }
+ set { SetProperty(ref _antenna_mode2, value); }
+ }
+
+ public string phycellid
+ {
+ get { return _phycellid; }
+ set { SetProperty(ref _phycellid, value); }
+ }
+
+ public string cellid
+ {
+ get { return _cellid; }
+ set { SetProperty(ref _cellid, value); }
+ }
+
+ public string rsrp
+ {
+ get { return _rsrp; }
+ set { SetProperty(ref _rsrp, value); }
+ }
+
+ public Brush rsrp_bg
+ {
+ get { return _rsrp_bg; }
+ set { SetProperty(ref _rsrp_bg, value); }
+ }
+
+ public string rsrq
+ {
+ get { return _rsrq; }
+ set { SetProperty(ref _rsrq, value); }
+ }
+
+ public Brush rsrq_bg
+ {
+ get { return _rsrq_bg; }
+ set { SetProperty(ref _rsrq_bg, value); }
+ }
+
+ public string service_status
+ {
+ get { return _service_status; }
+ set { SetProperty(ref _service_status, value); }
+ }
+
+ public string tac
+ {
+ get { return _tac; }
+ set { SetProperty(ref _tac, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ public string frequenz
+ {
+ get { return _frequenz; }
+ set { SetProperty(ref _frequenz, value); }
+ }
+
+ public LteInfoModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ AutoReloadCommand = new DelegateCommand(new Action(OnAutoReloadCommandExecute));
+ SaveCommand = new DelegateCommand(new Action(OnSaveCommandExecute));
+ PopupCommand = new DelegateCommand(new Action(OnPopupCommandExecute));
+ }
+ }
}
using SpeedportHybridControl.Model;
using System.Windows;
-namespace SpeedportHybridControl.PageModel {
- class MainWindowModel : SuperViewModel {
- public const string VERSION = "1.0-pre11";
-
- private string _loginButtonContent = "Login";
-
- private DelegateCommand _switchToLoginPage;
- private DelegateCommand _switchToStatusPage;
- private DelegateCommand _switchToOverviewPage;
- private DelegateCommand _switchToDSLPage;
- private DelegateCommand _switchToLteInfoPage;
- private DelegateCommand _switchToSyslogPage;
- private DelegateCommand _switchToTR181Page;
- private DelegateCommand _switchToPhonePage;
- private DelegateCommand _switchToLanPage;
- private DelegateCommand _switchToInterfacePage;
- private DelegateCommand _switchToControlsPage;
- private DelegateCommand _sitchToAboutPage;
-
- private bool _buttonOverviewPageIsActive = false;
- private bool _buttonDSLPageIsActive = false;
- private bool _buttonLteInfoPageIsActive = false;
- private bool _buttonSyslogPageIsActive = false;
- private bool _buttonTR181PageIsActive = false;
- private bool _buttonPhonePageIsActive = false;
- private bool _buttonLanPageIsActive = false;
- private bool _buttonInterfacePageIsActive = false;
- private bool _buttonControlsPageIsActive = false;
-
- private Brush _buttonLoginPageBackground = Brushes.LightGray;
- private Brush _buttonStatusPageBackground = Brushes.LightGray;
- private Brush _buttonOverviewPageBackground = Brushes.LightGray;
- private Brush _buttonDSLPageBackground = Brushes.LightGray;
- private Brush _buttonLteInfoPageBackground = Brushes.LightGray;
- private Brush _buttonSyslogPageBackground = Brushes.LightGray;
- private Brush _buttonTR181PageBackground = Brushes.LightGray;
- private Brush _buttonPhonePageBackground = Brushes.LightGray;
- private Brush _buttonLanPageBackground = Brushes.LightGray;
- private Brush _buttonInterfacePageBackground = Brushes.LightGray;
- private Brush _buttonControlsPageBackground = Brushes.LightGray;
- private Brush _buttonAboutPageBackground = Brushes.LightGray;
-
- private Page _FrameSource;
-
- private string _title;
-
- public string LoginButtonContent {
- get { return _loginButtonContent; }
- set { SetProperty(ref _loginButtonContent, value); }
- }
-
- public DelegateCommand SwitchToLoginPage {
- get { return _switchToLoginPage; }
- set { SetProperty(ref _switchToLoginPage, value); }
- }
-
- public DelegateCommand SwitchToStatusPage {
- get { return _switchToStatusPage; }
- set { SetProperty(ref _switchToStatusPage, value); }
- }
-
- public DelegateCommand SwitchToOverviewPage {
- get { return _switchToOverviewPage; }
- set { SetProperty(ref _switchToOverviewPage, value); }
- }
-
- public DelegateCommand SwitchToDSLPage {
- get { return _switchToDSLPage; }
- set { SetProperty(ref _switchToDSLPage, value); }
- }
-
- public DelegateCommand SwitchToLteInfoPage {
- get { return _switchToLteInfoPage; }
- set { SetProperty(ref _switchToLteInfoPage, value); }
- }
-
- public DelegateCommand SwitchToSyslogPage {
- get { return _switchToSyslogPage; }
- set { SetProperty(ref _switchToSyslogPage, value); }
- }
-
- public DelegateCommand SwitchToTR181Page {
- get { return _switchToTR181Page; }
- set { SetProperty(ref _switchToTR181Page, value); }
- }
-
- public DelegateCommand SwitchToPhonePage {
- get { return _switchToPhonePage; }
- set { SetProperty(ref _switchToPhonePage, value); }
- }
-
- public DelegateCommand SwitchToLanPage {
- get { return _switchToLanPage; }
- set { SetProperty(ref _switchToLanPage, value); }
- }
-
- public DelegateCommand SwitchToInterfacePage
- {
- get { return _switchToInterfacePage; }
- set { SetProperty(ref _switchToInterfacePage, value); }
- }
-
- public DelegateCommand SwitchToControlsPage {
- get { return _switchToControlsPage; }
- set { SetProperty(ref _switchToControlsPage, value); }
- }
-
- public DelegateCommand SwitchToAboutPage {
- get { return _sitchToAboutPage; }
- set { SetProperty(ref _sitchToAboutPage, value); }
- }
-
- public bool ButtonOverviewPageIsActive {
- get { return _buttonOverviewPageIsActive; }
- set { SetProperty(ref _buttonOverviewPageIsActive, value); }
- }
-
- public bool ButtonDSLPageIsActive {
- get { return _buttonDSLPageIsActive; }
- set { SetProperty(ref _buttonDSLPageIsActive, value); }
- }
-
- public bool ButtonLteInfoPageIsActive {
- get { return _buttonLteInfoPageIsActive; }
- set { SetProperty(ref _buttonLteInfoPageIsActive, value); }
- }
-
- public bool ButtonSyslogPageIsActive {
- get { return _buttonSyslogPageIsActive; }
- set { SetProperty(ref _buttonSyslogPageIsActive, value); }
- }
-
- public bool ButtonTR181PageIsActive {
- get { return _buttonTR181PageIsActive; }
- set { SetProperty(ref _buttonTR181PageIsActive, value); }
- }
-
- public bool ButtonPhonePageIsActive {
- get { return _buttonPhonePageIsActive; }
- set { SetProperty(ref _buttonPhonePageIsActive, value); }
- }
-
- public bool ButtonLanPageIsActive {
- get { return _buttonLanPageIsActive; }
- set { SetProperty(ref _buttonLanPageIsActive, value); }
- }
-
- public bool ButtonInterfacePageIsActive
- {
- get { return _buttonInterfacePageIsActive; }
- set { SetProperty(ref _buttonInterfacePageIsActive, value); }
- }
-
- public bool ButtonControlsPageIsActive {
- get { return _buttonControlsPageIsActive; }
- set { SetProperty(ref _buttonControlsPageIsActive, value); }
- }
-
- public Brush ButtonLoginPageBackground {
- get { return _buttonLoginPageBackground; }
- set { SetProperty(ref _buttonLoginPageBackground, value); }
- }
-
- public Brush ButtonStatusPageBackground {
- get { return _buttonStatusPageBackground; }
- set { SetProperty(ref _buttonStatusPageBackground, value); }
- }
-
- public Brush ButtonOverviewPageBackground {
- get { return _buttonOverviewPageBackground; }
- set { SetProperty(ref _buttonOverviewPageBackground, value); }
- }
-
- public Brush ButtonDSLPageBackground {
- get { return _buttonDSLPageBackground; }
- set { SetProperty(ref _buttonDSLPageBackground, value); }
- }
-
- public Brush ButtonLteInfoPageBackground {
- get { return _buttonLteInfoPageBackground; }
- set { SetProperty(ref _buttonLteInfoPageBackground, value); }
- }
-
- public Brush ButtonSyslogPageBackground {
- get { return _buttonSyslogPageBackground; }
- set { SetProperty(ref _buttonSyslogPageBackground, value); }
- }
-
- public Brush ButtonTR181PageBackground {
- get { return _buttonTR181PageBackground; }
- set { SetProperty(ref _buttonTR181PageBackground, value); }
- }
-
- public Brush ButtonPhonePageBackground {
- get { return _buttonPhonePageBackground; }
- set { SetProperty(ref _buttonPhonePageBackground, value); }
- }
-
- public Brush ButtonLanPageBackground {
- get { return _buttonLanPageBackground; }
- set { SetProperty(ref _buttonLanPageBackground, value); }
- }
-
- public Brush ButtonInterfacePageBackground
- {
- get { return _buttonInterfacePageBackground; }
- set { SetProperty(ref _buttonInterfacePageBackground, value); }
- }
-
- public Brush ButtonControlsPageBackground {
- get { return _buttonControlsPageBackground; }
- set { SetProperty(ref _buttonControlsPageBackground, value); }
- }
-
- public Brush ButtonAboutPageBackground {
- get { return _buttonAboutPageBackground; }
- set { SetProperty(ref _buttonAboutPageBackground, value); }
- }
-
- public Page FrameSource {
- get { return _FrameSource; }
- set { SetProperty(ref _FrameSource, value); }
- }
-
- public string Title {
- get { return _title; }
- set { SetProperty(ref _title, value); }
- }
-
- private void OnSwitchToLoginPageExecute () {
- changePage("login");
- }
-
- private void OnSwitchToStatusPageExecute () {
- changePage("status");
- new Thread(() => { SpeedportHybrid.initStatus(); }).Start();
- }
-
- private void OnSwitchToOverviewPageExecute () {
- changePage("overview");
- new Thread(() => { SpeedportHybrid.initOverview(); }).Start();
- }
-
- private void OnSwitchToDSLPageExecute () {
- changePage("dsl");
- new Thread(() => { SpeedportHybrid.initDSL(); }).Start();
- }
-
- private void OnSwitchToLteInfoPageExecute () {
- changePage("lte");
- new Thread(() => { SpeedportHybrid.initLTE(); }).Start();
- }
-
- private void OnSwitchToSyslogPageExecute () {
- changePage("syslog");
- new Thread(() => { SpeedportHybrid.initSyslog(); }).Start();
- }
-
- private void OnSwitchToTR181PageExecute () {
- changePage("tr181");
- new Thread(() => { SpeedportHybrid.initTR181(); }).Start();
- }
-
- private void OnSwitchToPhonePageExecute () {
- changePage("phone");
- new Thread(() => { SpeedportHybrid.initPhone(); }).Start();
- }
-
- private void OnSwitchToLanPageExecute () {
- changePage("lan");
- new Thread(() => { SpeedportHybrid.initLan(); }).Start();
- }
-
- private void OnSwitchToInterfacePageExecute () {
- changePage("interface");
- new Thread(() => { SpeedportHybrid.initInterface(); }).Start();
- }
-
- private void OnSwitchToControlsPageExecute () {
- changePage("controls");
- }
-
- private void OnSwitchToAboutPageExecute () {
- changePage("about");
- }
-
- private void changePage (string page) {
- if (object.Equals(FrameSource, null).Equals(false)) {
- if (FrameSource.GetType().Equals(typeof(LteInfoPage))) {
- LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
- lte.StopTimer();
- }
-
- if (FrameSource.GetType().Equals(typeof(DslPage))) {
- DslPageModel dsl = Application.Current.FindResource("DslPageModel") as DslPageModel;
- dsl.StopTimer();
- }
- }
-
- if (page.Equals("login")) {
- FrameSource = new LoginPage();
- }
- else if (page.Equals("status")) {
- FrameSource = new StatusPage();
- }
- else if (page.Equals("overview")) {
- FrameSource = new OverviewPage();
- }
- else if (page.Equals("dsl")) {
- FrameSource = new DslPage();
- }
- else if (page.Equals("lte")) {
- FrameSource = new LteInfoPage();
- }
- else if (page.Equals("syslog")) {
- FrameSource = new SyslogPage();
- }
- else if (page.Equals("tr181")) {
- FrameSource = new TR181Page();
- }
- else if (page.Equals("phone")) {
- FrameSource = new PhonePage();
- }
- else if (page.Equals("lan")) {
- FrameSource = new LanPage();
- }
- else if (page.Equals("interface")) {
- FrameSource = new InterfacePage();
- }
- else if (page.Equals("controls")) {
- FrameSource = new ControlsPage();
- }
- else if (page.Equals("about")) {
- FrameSource = new AboutPage();
- }
-
- changeColor(page);
- }
-
- private void changeColor (string page) {
- ButtonLoginPageBackground = Brushes.LightGray;
- ButtonStatusPageBackground = Brushes.LightGray;
- ButtonOverviewPageBackground = Brushes.LightGray;
- ButtonDSLPageBackground = Brushes.LightGray;
- ButtonLteInfoPageBackground = Brushes.LightGray;
- ButtonSyslogPageBackground = Brushes.LightGray;
- ButtonTR181PageBackground = Brushes.LightGray;
- ButtonPhonePageBackground = Brushes.LightGray;
- ButtonLanPageBackground = Brushes.LightGray;
- ButtonInterfacePageBackground = Brushes.LightGray;
- ButtonControlsPageBackground = Brushes.LightGray;
- ButtonAboutPageBackground = Brushes.LightGray;
-
- if (page.Equals("login")) {
- ButtonLoginPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("status")) {
- ButtonStatusPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("overview")) {
- ButtonOverviewPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("dsl")) {
- ButtonDSLPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("lte")) {
- ButtonLteInfoPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("syslog")) {
- ButtonSyslogPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("tr181")) {
- ButtonTR181PageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("phone")) {
- ButtonPhonePageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("lan")) {
- ButtonLanPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("interface")) {
- ButtonInterfacePageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("controls")) {
- ButtonControlsPageBackground = Brushes.LightGreen;
- }
-
- if (page.Equals("about")) {
- ButtonAboutPageBackground = Brushes.LightGreen;
- }
- }
-
- public MainWindowModel () {
- Title = string.Concat("Speedport Hybrid Konfigurationsprogramm", " (version ", VERSION, ")");
-
- if (util.checkInstalled("Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219").Equals(false)) {
- new Thread(() => { MessageBox.Show("Bitte installiere das 'Microsoft Visual C++ 2010 Redistributable Package' aus den ordner 'vcredis' um das programm vollständig benutzen zu können.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
- }
-
- if (util.checkUpdate(VERSION).Equals(true)) {
- new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
- }
-
- changePage("login");
-
- SwitchToLoginPage = new DelegateCommand(new Action(OnSwitchToLoginPageExecute));
- SwitchToStatusPage = new DelegateCommand(new Action(OnSwitchToStatusPageExecute));
- SwitchToOverviewPage = new DelegateCommand(new Action(OnSwitchToOverviewPageExecute));
- SwitchToDSLPage = new DelegateCommand(new Action(OnSwitchToDSLPageExecute));
- SwitchToLteInfoPage = new DelegateCommand(new Action(OnSwitchToLteInfoPageExecute));
- SwitchToSyslogPage = new DelegateCommand(new Action(OnSwitchToSyslogPageExecute));
- SwitchToTR181Page = new DelegateCommand(new Action(OnSwitchToTR181PageExecute));
- SwitchToPhonePage = new DelegateCommand(new Action(OnSwitchToPhonePageExecute));
- SwitchToLanPage = new DelegateCommand(new Action(OnSwitchToLanPageExecute));
- SwitchToInterfacePage = new DelegateCommand(new Action(OnSwitchToInterfacePageExecute));
- SwitchToControlsPage = new DelegateCommand(new Action(OnSwitchToControlsPageExecute));
-
- SwitchToAboutPage = new DelegateCommand(new Action(OnSwitchToAboutPageExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class MainWindowModel : SuperViewModel
+ {
+ public const string VERSION = "1.0-pre11";
+
+ private string _loginButtonContent = "Login";
+
+ private DelegateCommand _switchToLoginPage;
+ private DelegateCommand _switchToStatusPage;
+ private DelegateCommand _switchToOverviewPage;
+ private DelegateCommand _switchToDSLPage;
+ private DelegateCommand _switchToLteInfoPage;
+ private DelegateCommand _switchToSyslogPage;
+ private DelegateCommand _switchToTR181Page;
+ private DelegateCommand _switchToPhonePage;
+ private DelegateCommand _switchToLanPage;
+ private DelegateCommand _switchToInterfacePage;
+ private DelegateCommand _switchToControlsPage;
+ private DelegateCommand _sitchToAboutPage;
+
+ private bool _buttonOverviewPageIsActive = false;
+ private bool _buttonDSLPageIsActive = false;
+ private bool _buttonLteInfoPageIsActive = false;
+ private bool _buttonSyslogPageIsActive = false;
+ private bool _buttonTR181PageIsActive = false;
+ private bool _buttonPhonePageIsActive = false;
+ private bool _buttonLanPageIsActive = false;
+ private bool _buttonInterfacePageIsActive = false;
+ private bool _buttonControlsPageIsActive = false;
+
+ private Brush _buttonLoginPageBackground = Brushes.LightGray;
+ private Brush _buttonStatusPageBackground = Brushes.LightGray;
+ private Brush _buttonOverviewPageBackground = Brushes.LightGray;
+ private Brush _buttonDSLPageBackground = Brushes.LightGray;
+ private Brush _buttonLteInfoPageBackground = Brushes.LightGray;
+ private Brush _buttonSyslogPageBackground = Brushes.LightGray;
+ private Brush _buttonTR181PageBackground = Brushes.LightGray;
+ private Brush _buttonPhonePageBackground = Brushes.LightGray;
+ private Brush _buttonLanPageBackground = Brushes.LightGray;
+ private Brush _buttonInterfacePageBackground = Brushes.LightGray;
+ private Brush _buttonControlsPageBackground = Brushes.LightGray;
+ private Brush _buttonAboutPageBackground = Brushes.LightGray;
+
+ private Page _FrameSource;
+
+ private string _title;
+
+ public string LoginButtonContent
+ {
+ get { return _loginButtonContent; }
+ set { SetProperty(ref _loginButtonContent, value); }
+ }
+
+ public DelegateCommand SwitchToLoginPage
+ {
+ get { return _switchToLoginPage; }
+ set { SetProperty(ref _switchToLoginPage, value); }
+ }
+
+ public DelegateCommand SwitchToStatusPage
+ {
+ get { return _switchToStatusPage; }
+ set { SetProperty(ref _switchToStatusPage, value); }
+ }
+
+ public DelegateCommand SwitchToOverviewPage
+ {
+ get { return _switchToOverviewPage; }
+ set { SetProperty(ref _switchToOverviewPage, value); }
+ }
+
+ public DelegateCommand SwitchToDSLPage
+ {
+ get { return _switchToDSLPage; }
+ set { SetProperty(ref _switchToDSLPage, value); }
+ }
+
+ public DelegateCommand SwitchToLteInfoPage
+ {
+ get { return _switchToLteInfoPage; }
+ set { SetProperty(ref _switchToLteInfoPage, value); }
+ }
+
+ public DelegateCommand SwitchToSyslogPage
+ {
+ get { return _switchToSyslogPage; }
+ set { SetProperty(ref _switchToSyslogPage, value); }
+ }
+
+ public DelegateCommand SwitchToTR181Page
+ {
+ get { return _switchToTR181Page; }
+ set { SetProperty(ref _switchToTR181Page, value); }
+ }
+
+ public DelegateCommand SwitchToPhonePage
+ {
+ get { return _switchToPhonePage; }
+ set { SetProperty(ref _switchToPhonePage, value); }
+ }
+
+ public DelegateCommand SwitchToLanPage
+ {
+ get { return _switchToLanPage; }
+ set { SetProperty(ref _switchToLanPage, value); }
+ }
+
+ public DelegateCommand SwitchToInterfacePage
+ {
+ get { return _switchToInterfacePage; }
+ set { SetProperty(ref _switchToInterfacePage, value); }
+ }
+
+ public DelegateCommand SwitchToControlsPage
+ {
+ get { return _switchToControlsPage; }
+ set { SetProperty(ref _switchToControlsPage, value); }
+ }
+
+ public DelegateCommand SwitchToAboutPage
+ {
+ get { return _sitchToAboutPage; }
+ set { SetProperty(ref _sitchToAboutPage, value); }
+ }
+
+ public bool ButtonOverviewPageIsActive
+ {
+ get { return _buttonOverviewPageIsActive; }
+ set { SetProperty(ref _buttonOverviewPageIsActive, value); }
+ }
+
+ public bool ButtonDSLPageIsActive
+ {
+ get { return _buttonDSLPageIsActive; }
+ set { SetProperty(ref _buttonDSLPageIsActive, value); }
+ }
+
+ public bool ButtonLteInfoPageIsActive
+ {
+ get { return _buttonLteInfoPageIsActive; }
+ set { SetProperty(ref _buttonLteInfoPageIsActive, value); }
+ }
+
+ public bool ButtonSyslogPageIsActive
+ {
+ get { return _buttonSyslogPageIsActive; }
+ set { SetProperty(ref _buttonSyslogPageIsActive, value); }
+ }
+
+ public bool ButtonTR181PageIsActive
+ {
+ get { return _buttonTR181PageIsActive; }
+ set { SetProperty(ref _buttonTR181PageIsActive, value); }
+ }
+
+ public bool ButtonPhonePageIsActive
+ {
+ get { return _buttonPhonePageIsActive; }
+ set { SetProperty(ref _buttonPhonePageIsActive, value); }
+ }
+
+ public bool ButtonLanPageIsActive
+ {
+ get { return _buttonLanPageIsActive; }
+ set { SetProperty(ref _buttonLanPageIsActive, value); }
+ }
+
+ public bool ButtonInterfacePageIsActive
+ {
+ get { return _buttonInterfacePageIsActive; }
+ set { SetProperty(ref _buttonInterfacePageIsActive, value); }
+ }
+
+ public bool ButtonControlsPageIsActive
+ {
+ get { return _buttonControlsPageIsActive; }
+ set { SetProperty(ref _buttonControlsPageIsActive, value); }
+ }
+
+ public Brush ButtonLoginPageBackground
+ {
+ get { return _buttonLoginPageBackground; }
+ set { SetProperty(ref _buttonLoginPageBackground, value); }
+ }
+
+ public Brush ButtonStatusPageBackground
+ {
+ get { return _buttonStatusPageBackground; }
+ set { SetProperty(ref _buttonStatusPageBackground, value); }
+ }
+
+ public Brush ButtonOverviewPageBackground
+ {
+ get { return _buttonOverviewPageBackground; }
+ set { SetProperty(ref _buttonOverviewPageBackground, value); }
+ }
+
+ public Brush ButtonDSLPageBackground
+ {
+ get { return _buttonDSLPageBackground; }
+ set { SetProperty(ref _buttonDSLPageBackground, value); }
+ }
+
+ public Brush ButtonLteInfoPageBackground
+ {
+ get { return _buttonLteInfoPageBackground; }
+ set { SetProperty(ref _buttonLteInfoPageBackground, value); }
+ }
+
+ public Brush ButtonSyslogPageBackground
+ {
+ get { return _buttonSyslogPageBackground; }
+ set { SetProperty(ref _buttonSyslogPageBackground, value); }
+ }
+
+ public Brush ButtonTR181PageBackground
+ {
+ get { return _buttonTR181PageBackground; }
+ set { SetProperty(ref _buttonTR181PageBackground, value); }
+ }
+
+ public Brush ButtonPhonePageBackground
+ {
+ get { return _buttonPhonePageBackground; }
+ set { SetProperty(ref _buttonPhonePageBackground, value); }
+ }
+
+ public Brush ButtonLanPageBackground
+ {
+ get { return _buttonLanPageBackground; }
+ set { SetProperty(ref _buttonLanPageBackground, value); }
+ }
+
+ public Brush ButtonInterfacePageBackground
+ {
+ get { return _buttonInterfacePageBackground; }
+ set { SetProperty(ref _buttonInterfacePageBackground, value); }
+ }
+
+ public Brush ButtonControlsPageBackground
+ {
+ get { return _buttonControlsPageBackground; }
+ set { SetProperty(ref _buttonControlsPageBackground, value); }
+ }
+
+ public Brush ButtonAboutPageBackground
+ {
+ get { return _buttonAboutPageBackground; }
+ set { SetProperty(ref _buttonAboutPageBackground, value); }
+ }
+
+ public Page FrameSource
+ {
+ get { return _FrameSource; }
+ set { SetProperty(ref _FrameSource, value); }
+ }
+
+ public string Title
+ {
+ get { return _title; }
+ set { SetProperty(ref _title, value); }
+ }
+
+ private void OnSwitchToLoginPageExecute()
+ {
+ changePage("login");
+ }
+
+ private void OnSwitchToStatusPageExecute()
+ {
+ changePage("status");
+ new Thread(() => { SpeedportHybrid.initStatus(); }).Start();
+ }
+
+ private void OnSwitchToOverviewPageExecute()
+ {
+ changePage("overview");
+ new Thread(() => { SpeedportHybrid.initOverview(); }).Start();
+ }
+
+ private void OnSwitchToDSLPageExecute()
+ {
+ changePage("dsl");
+ new Thread(() => { SpeedportHybrid.initDSL(); }).Start();
+ }
+
+ private void OnSwitchToLteInfoPageExecute()
+ {
+ changePage("lte");
+ new Thread(() => { SpeedportHybrid.initLTE(); }).Start();
+ }
+
+ private void OnSwitchToSyslogPageExecute()
+ {
+ changePage("syslog");
+ new Thread(() => { SpeedportHybrid.initSyslog(); }).Start();
+ }
+
+ private void OnSwitchToTR181PageExecute()
+ {
+ changePage("tr181");
+ new Thread(() => { SpeedportHybrid.initTR181(); }).Start();
+ }
+
+ private void OnSwitchToPhonePageExecute()
+ {
+ changePage("phone");
+ new Thread(() => { SpeedportHybrid.initPhone(); }).Start();
+ }
+
+ private void OnSwitchToLanPageExecute()
+ {
+ changePage("lan");
+ new Thread(() => { SpeedportHybrid.initLan(); }).Start();
+ }
+
+ private void OnSwitchToInterfacePageExecute()
+ {
+ changePage("interface");
+ new Thread(() => { SpeedportHybrid.initInterface(); }).Start();
+ }
+
+ private void OnSwitchToControlsPageExecute()
+ {
+ changePage("controls");
+ }
+
+ private void OnSwitchToAboutPageExecute()
+ {
+ changePage("about");
+ }
+
+ private void changePage(string page)
+ {
+ if (object.Equals(FrameSource, null).Equals(false))
+ {
+ if (FrameSource.GetType().Equals(typeof(LteInfoPage)))
+ {
+ LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
+ lte.StopTimer();
+ }
+
+ if (FrameSource.GetType().Equals(typeof(DslPage)))
+ {
+ DslPageModel dsl = Application.Current.FindResource("DslPageModel") as DslPageModel;
+ dsl.StopTimer();
+ }
+ }
+
+ if (page.Equals("login"))
+ {
+ FrameSource = new LoginPage();
+ }
+ else if (page.Equals("status"))
+ {
+ FrameSource = new StatusPage();
+ }
+ else if (page.Equals("overview"))
+ {
+ FrameSource = new OverviewPage();
+ }
+ else if (page.Equals("dsl"))
+ {
+ FrameSource = new DslPage();
+ }
+ else if (page.Equals("lte"))
+ {
+ FrameSource = new LteInfoPage();
+ }
+ else if (page.Equals("syslog"))
+ {
+ FrameSource = new SyslogPage();
+ }
+ else if (page.Equals("tr181"))
+ {
+ FrameSource = new TR181Page();
+ }
+ else if (page.Equals("phone"))
+ {
+ FrameSource = new PhonePage();
+ }
+ else if (page.Equals("lan"))
+ {
+ FrameSource = new LanPage();
+ }
+ else if (page.Equals("interface"))
+ {
+ FrameSource = new InterfacePage();
+ }
+ else if (page.Equals("controls"))
+ {
+ FrameSource = new ControlsPage();
+ }
+ else if (page.Equals("about"))
+ {
+ FrameSource = new AboutPage();
+ }
+
+ changeColor(page);
+ }
+
+ private void changeColor(string page)
+ {
+ ButtonLoginPageBackground = Brushes.LightGray;
+ ButtonStatusPageBackground = Brushes.LightGray;
+ ButtonOverviewPageBackground = Brushes.LightGray;
+ ButtonDSLPageBackground = Brushes.LightGray;
+ ButtonLteInfoPageBackground = Brushes.LightGray;
+ ButtonSyslogPageBackground = Brushes.LightGray;
+ ButtonTR181PageBackground = Brushes.LightGray;
+ ButtonPhonePageBackground = Brushes.LightGray;
+ ButtonLanPageBackground = Brushes.LightGray;
+ ButtonInterfacePageBackground = Brushes.LightGray;
+ ButtonControlsPageBackground = Brushes.LightGray;
+ ButtonAboutPageBackground = Brushes.LightGray;
+
+ if (page.Equals("login"))
+ {
+ ButtonLoginPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("status"))
+ {
+ ButtonStatusPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("overview"))
+ {
+ ButtonOverviewPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("dsl"))
+ {
+ ButtonDSLPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("lte"))
+ {
+ ButtonLteInfoPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("syslog"))
+ {
+ ButtonSyslogPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("tr181"))
+ {
+ ButtonTR181PageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("phone"))
+ {
+ ButtonPhonePageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("lan"))
+ {
+ ButtonLanPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("interface"))
+ {
+ ButtonInterfacePageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("controls"))
+ {
+ ButtonControlsPageBackground = Brushes.LightGreen;
+ }
+
+ if (page.Equals("about"))
+ {
+ ButtonAboutPageBackground = Brushes.LightGreen;
+ }
+ }
+
+ public MainWindowModel()
+ {
+ Title = string.Concat("Speedport Hybrid Konfigurationsprogramm", " (version ", VERSION, ")");
+
+ if (util.checkInstalled("Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219").Equals(false))
+ {
+ new Thread(() => { MessageBox.Show("Bitte installiere das 'Microsoft Visual C++ 2010 Redistributable Package' aus den ordner 'vcredis' um das programm vollständig benutzen zu können.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
+ }
+
+ if (util.checkUpdate(VERSION).Equals(true))
+ {
+ new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
+ }
+
+ changePage("login");
+
+ SwitchToLoginPage = new DelegateCommand(new Action(OnSwitchToLoginPageExecute));
+ SwitchToStatusPage = new DelegateCommand(new Action(OnSwitchToStatusPageExecute));
+ SwitchToOverviewPage = new DelegateCommand(new Action(OnSwitchToOverviewPageExecute));
+ SwitchToDSLPage = new DelegateCommand(new Action(OnSwitchToDSLPageExecute));
+ SwitchToLteInfoPage = new DelegateCommand(new Action(OnSwitchToLteInfoPageExecute));
+ SwitchToSyslogPage = new DelegateCommand(new Action(OnSwitchToSyslogPageExecute));
+ SwitchToTR181Page = new DelegateCommand(new Action(OnSwitchToTR181PageExecute));
+ SwitchToPhonePage = new DelegateCommand(new Action(OnSwitchToPhonePageExecute));
+ SwitchToLanPage = new DelegateCommand(new Action(OnSwitchToLanPageExecute));
+ SwitchToInterfacePage = new DelegateCommand(new Action(OnSwitchToInterfacePageExecute));
+ SwitchToControlsPage = new DelegateCommand(new Action(OnSwitchToControlsPageExecute));
+
+ SwitchToAboutPage = new DelegateCommand(new Action(OnSwitchToAboutPageExecute));
+ }
+ }
}
using System;
using System.Threading;
-namespace SpeedportHybridControl.PageModel {
- class OverviewPageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
-
- private string _onlinestatus;
- private string _dsl_link_status;
- private string _lte_image = "../assets/lte0.png";
- private string _number_status;
- private string _use_dect;
- private string _dect_devices;
- private string _devices;
- private string _use_wlan;
- private string _use_wlan_5ghz;
- private string _wlan_enc;
- private string _wlan_power;
- private string _external_devices;
- private string _nas_sync_active;
- private string _nas_backup_active;
- private string _mc_state;
- private string _days_online;
- private string _datetime;
-
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
-
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initOverview(); }).Start();
- }
-
- public string onlinestatus {
- get { return _onlinestatus; }
- set { SetProperty(ref _onlinestatus, value); }
- }
-
- public string dsl_link_status {
- get { return _dsl_link_status; }
- set { SetProperty(ref _dsl_link_status, value); }
- }
-
- public string lte_image {
- get { return _lte_image; }
- set { SetProperty(ref _lte_image, value); }
- }
-
- public string number_status {
- get { return _number_status; }
- set { SetProperty(ref _number_status, value); }
- }
-
- public string use_dect {
- get { return _use_dect; }
- set { SetProperty(ref _use_dect, value); }
- }
-
- public string dect_devices {
- get { return _dect_devices; }
- set { SetProperty(ref _dect_devices, value); }
- }
-
- public string devices {
- get { return _devices; }
- set { SetProperty(ref _devices, value); }
- }
-
- public string use_wlan {
- get { return _use_wlan; }
- set { SetProperty(ref _use_wlan, value); }
- }
-
- public string use_wlan_5ghz {
- get { return _use_wlan_5ghz; }
- set { SetProperty(ref _use_wlan_5ghz, value); }
- }
-
- public string wlan_enc {
- get { return _wlan_enc; }
- set { SetProperty(ref _wlan_enc, value); }
- }
-
- public string wlan_power {
- get { return _wlan_power; }
- set { SetProperty(ref _wlan_power, value); }
- }
-
- public string external_devices {
- get { return _external_devices; }
- set { SetProperty(ref _external_devices, value); }
- }
-
- public string nas_sync_active {
- get { return _nas_sync_active; }
- set { SetProperty(ref _nas_sync_active, value); }
- }
-
- public string nas_backup_active {
- get { return _nas_backup_active; }
- set { SetProperty(ref _nas_backup_active, value); }
- }
-
- public string mc_state {
- get { return _mc_state; }
- set { SetProperty(ref _mc_state, value); }
- }
-
- public string days_online {
- get { return _days_online; }
- set { SetProperty(ref _days_online, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- public OverviewPageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class OverviewPageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+
+ private string _onlinestatus;
+ private string _dsl_link_status;
+ private string _lte_image = "../assets/lte0.png";
+ private string _number_status;
+ private string _use_dect;
+ private string _dect_devices;
+ private string _devices;
+ private string _use_wlan;
+ private string _use_wlan_5ghz;
+ private string _wlan_enc;
+ private string _wlan_power;
+ private string _external_devices;
+ private string _nas_sync_active;
+ private string _nas_backup_active;
+ private string _mc_state;
+ private string _days_online;
+ private string _datetime;
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initOverview(); }).Start();
+ }
+
+ public string onlinestatus
+ {
+ get { return _onlinestatus; }
+ set { SetProperty(ref _onlinestatus, value); }
+ }
+
+ public string dsl_link_status
+ {
+ get { return _dsl_link_status; }
+ set { SetProperty(ref _dsl_link_status, value); }
+ }
+
+ public string lte_image
+ {
+ get { return _lte_image; }
+ set { SetProperty(ref _lte_image, value); }
+ }
+
+ public string number_status
+ {
+ get { return _number_status; }
+ set { SetProperty(ref _number_status, value); }
+ }
+
+ public string use_dect
+ {
+ get { return _use_dect; }
+ set { SetProperty(ref _use_dect, value); }
+ }
+
+ public string dect_devices
+ {
+ get { return _dect_devices; }
+ set { SetProperty(ref _dect_devices, value); }
+ }
+
+ public string devices
+ {
+ get { return _devices; }
+ set { SetProperty(ref _devices, value); }
+ }
+
+ public string use_wlan
+ {
+ get { return _use_wlan; }
+ set { SetProperty(ref _use_wlan, value); }
+ }
+
+ public string use_wlan_5ghz
+ {
+ get { return _use_wlan_5ghz; }
+ set { SetProperty(ref _use_wlan_5ghz, value); }
+ }
+
+ public string wlan_enc
+ {
+ get { return _wlan_enc; }
+ set { SetProperty(ref _wlan_enc, value); }
+ }
+
+ public string wlan_power
+ {
+ get { return _wlan_power; }
+ set { SetProperty(ref _wlan_power, value); }
+ }
+
+ public string external_devices
+ {
+ get { return _external_devices; }
+ set { SetProperty(ref _external_devices, value); }
+ }
+
+ public string nas_sync_active
+ {
+ get { return _nas_sync_active; }
+ set { SetProperty(ref _nas_sync_active, value); }
+ }
+
+ public string nas_backup_active
+ {
+ get { return _nas_backup_active; }
+ set { SetProperty(ref _nas_backup_active, value); }
+ }
+
+ public string mc_state
+ {
+ get { return _mc_state; }
+ set { SetProperty(ref _mc_state, value); }
+ }
+
+ public string days_online
+ {
+ get { return _days_online; }
+ set { SetProperty(ref _days_online, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ public OverviewPageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ }
+ }
}
using System.Threading;
using System.Windows;
-namespace SpeedportHybridControl.PageModel {
- class PhonePageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
- private DelegateCommand _copyCommand;
- private DelegateCommand _clearCommand;
- private PhoneCallList _selectedItem;
+namespace SpeedportHybridControl.PageModel
+{
+ class PhonePageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+ private DelegateCommand _copyCommand;
+ private DelegateCommand _clearCommand;
+ private PhoneCallList _selectedItem;
- private List<PhoneCallList> _missedCalls;
- private List<PhoneCallList> _takenCalls;
- private List<PhoneCallList> _dialedCalls;
- private string _datetime;
+ private List<PhoneCallList> _missedCalls;
+ private List<PhoneCallList> _takenCalls;
+ private List<PhoneCallList> _dialedCalls;
+ private string _datetime;
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
- public DelegateCommand CopyCommand {
- get { return _copyCommand; }
- set { SetProperty(ref _copyCommand, value); }
- }
+ public DelegateCommand CopyCommand
+ {
+ get { return _copyCommand; }
+ set { SetProperty(ref _copyCommand, value); }
+ }
- public DelegateCommand ClearCommand {
- get { return _clearCommand; }
- set { SetProperty(ref _clearCommand, value); }
- }
+ public DelegateCommand ClearCommand
+ {
+ get { return _clearCommand; }
+ set { SetProperty(ref _clearCommand, value); }
+ }
- public PhoneCallList SelectedItem {
- get { return _selectedItem; }
- set { SetProperty(ref _selectedItem, value); }
- }
+ public PhoneCallList SelectedItem
+ {
+ get { return _selectedItem; }
+ set { SetProperty(ref _selectedItem, value); }
+ }
- public List<PhoneCallList> missedCalls {
- get { return _missedCalls; }
- set { SetProperty(ref _missedCalls, value); }
- }
+ public List<PhoneCallList> missedCalls
+ {
+ get { return _missedCalls; }
+ set { SetProperty(ref _missedCalls, value); }
+ }
- public List<PhoneCallList> takenCalls {
- get { return _takenCalls; }
- set { SetProperty(ref _takenCalls, value); }
- }
+ public List<PhoneCallList> takenCalls
+ {
+ get { return _takenCalls; }
+ set { SetProperty(ref _takenCalls, value); }
+ }
- public List<PhoneCallList> dialedCalls {
- get { return _dialedCalls; }
- set { SetProperty(ref _dialedCalls, value); }
- }
+ public List<PhoneCallList> dialedCalls
+ {
+ get { return _dialedCalls; }
+ set { SetProperty(ref _dialedCalls, value); }
+ }
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initPhone(); }).Start();
- }
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initPhone(); }).Start();
+ }
- private void OnCopyCommandExecute () {
- Clipboard.SetText(SelectedItem.ToString());
- }
+ private void OnCopyCommandExecute()
+ {
+ Clipboard.SetText(SelectedItem.ToString());
+ }
- private void OnClearCommandExecute () {
- //TODO
- }
+ private void OnClearCommandExecute()
+ {
+ //TODO
+ }
- public PhonePageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute));
- ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute));
- }
- }
+ public PhonePageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute));
+ ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute));
+ }
+ }
}
using System.Threading;
using SpeedportHybridControl.Data;
-namespace SpeedportHybridControl.PageModel {
- class StatusPageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
-
- private string _device_name;
- private string _lte_status;
- private string _lte_signal;
- private string _lte_image = "../assets/lte0.png";
- private string _datetime;
- private string _imei;
- private string _dsl_link_status;
- private string _status;
- private string _dsl_downstream;
- private string _dsl_upstream;
- private List<StatusPhoneList> _addphonenumber;
- private string _use_dect;
- private string _dect_devices;
- private string _wlan_ssid;
- private string _wlan_5ghz_ssid;
- private string _use_wlan;
- private string _use_wlan_5ghz;
- private string _wlan_devices;
- private string _wlan_5ghz_devices;
- private string _lan1_device = "../assets/x.png";
- private string _lan2_device = "../assets/x.png";
- private string _lan3_device = "../assets/x.png";
- private string _lan4_device = "../assets/x.png";
- private string _hsfon_status;
- private string _firmware_version;
- private string _serial_number;
- private string _uptime;
-
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
-
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initStatus(); }).Start();
- }
-
- public string device_name {
- get { return _device_name; }
- set { SetProperty(ref _device_name, value); }
- }
-
- public string lte_status {
- get { return _lte_status; }
- set { SetProperty(ref _lte_status, value); }
- }
-
- public string lte_signal {
- get { return _lte_signal; }
- set { SetProperty(ref _lte_signal, value); }
- }
-
- public string lte_image {
- get { return _lte_image; }
- set { SetProperty(ref _lte_image, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- public string imei {
- get { return _imei; }
- set { SetProperty(ref _imei, value); }
- }
-
- public string dsl_link_status {
- get { return _dsl_link_status; }
- set { SetProperty(ref _dsl_link_status, value); }
- }
-
- public string status {
- get { return _status; }
- set { SetProperty(ref _status, value); }
- }
-
- public string dsl_downstream {
- get { return _dsl_downstream; }
- set { SetProperty(ref _dsl_downstream, value); }
- }
-
- public string dsl_upstream {
- get { return _dsl_upstream; }
- set { SetProperty(ref _dsl_upstream, value); }
- }
-
- public List<StatusPhoneList> addphonenumber {
- get { return _addphonenumber; }
- set { SetProperty(ref _addphonenumber, value); }
- }
-
- public string use_dect {
- get { return _use_dect; }
- set { SetProperty(ref _use_dect, value); }
- }
-
- public string dect_devices {
- get { return _dect_devices; }
- set { SetProperty(ref _dect_devices, value); }
- }
-
- public string wlan_ssid {
- get { return _wlan_ssid; }
- set { SetProperty(ref _wlan_ssid, value); }
- }
-
- public string wlan_5ghz_ssid {
- get { return _wlan_5ghz_ssid; }
- set { SetProperty(ref _wlan_5ghz_ssid, value); }
- }
-
- public string use_wlan {
- get { return _use_wlan; }
- set { SetProperty(ref _use_wlan, value); }
- }
-
- public string use_wlan_5ghz {
- get { return _use_wlan_5ghz; }
- set { SetProperty(ref _use_wlan_5ghz, value); }
- }
-
- public string wlan_devices {
- get { return _wlan_devices; }
- set { SetProperty(ref _wlan_devices, value); }
- }
-
- public string wlan_5ghz_devices {
- get { return _wlan_5ghz_devices; }
- set { SetProperty(ref _wlan_5ghz_devices, value); }
- }
-
- public string lan1_device {
- get { return _lan1_device; }
- set { SetProperty(ref _lan1_device, value); }
- }
-
- public string lan2_device {
- get { return _lan2_device; }
- set { SetProperty(ref _lan2_device, value); }
- }
-
- public string lan3_device {
- get { return _lan3_device; }
- set { SetProperty(ref _lan3_device, value); }
- }
-
- public string lan4_device {
- get { return _lan4_device; }
- set { SetProperty(ref _lan4_device, value); }
- }
-
- public string hsfon_status {
- get { return _hsfon_status; }
- set { SetProperty(ref _hsfon_status, value); }
- }
-
- public string firmware_version {
- get { return _firmware_version; }
- set { SetProperty(ref _firmware_version, value); }
- }
-
- public string serial_number {
- get { return _serial_number; }
- set { SetProperty(ref _serial_number, value); }
- }
-
- public string uptime {
- get { return _uptime; }
- set { SetProperty(ref _uptime, value); }
- }
-
- public StatusPageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class StatusPageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+
+ private string _device_name;
+ private string _lte_status;
+ private string _lte_signal;
+ private string _lte_image = "../assets/lte0.png";
+ private string _datetime;
+ private string _imei;
+ private string _dsl_link_status;
+ private string _status;
+ private string _dsl_downstream;
+ private string _dsl_upstream;
+ private List<StatusPhoneList> _addphonenumber;
+ private string _use_dect;
+ private string _dect_devices;
+ private string _wlan_ssid;
+ private string _wlan_5ghz_ssid;
+ private string _use_wlan;
+ private string _use_wlan_5ghz;
+ private string _wlan_devices;
+ private string _wlan_5ghz_devices;
+ private string _lan1_device = "../assets/x.png";
+ private string _lan2_device = "../assets/x.png";
+ private string _lan3_device = "../assets/x.png";
+ private string _lan4_device = "../assets/x.png";
+ private string _hsfon_status;
+ private string _firmware_version;
+ private string _serial_number;
+ private string _uptime;
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initStatus(); }).Start();
+ }
+
+ public string device_name
+ {
+ get { return _device_name; }
+ set { SetProperty(ref _device_name, value); }
+ }
+
+ public string lte_status
+ {
+ get { return _lte_status; }
+ set { SetProperty(ref _lte_status, value); }
+ }
+
+ public string lte_signal
+ {
+ get { return _lte_signal; }
+ set { SetProperty(ref _lte_signal, value); }
+ }
+
+ public string lte_image
+ {
+ get { return _lte_image; }
+ set { SetProperty(ref _lte_image, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ public string imei
+ {
+ get { return _imei; }
+ set { SetProperty(ref _imei, value); }
+ }
+
+ public string dsl_link_status
+ {
+ get { return _dsl_link_status; }
+ set { SetProperty(ref _dsl_link_status, value); }
+ }
+
+ public string status
+ {
+ get { return _status; }
+ set { SetProperty(ref _status, value); }
+ }
+
+ public string dsl_downstream
+ {
+ get { return _dsl_downstream; }
+ set { SetProperty(ref _dsl_downstream, value); }
+ }
+
+ public string dsl_upstream
+ {
+ get { return _dsl_upstream; }
+ set { SetProperty(ref _dsl_upstream, value); }
+ }
+
+ public List<StatusPhoneList> addphonenumber
+ {
+ get { return _addphonenumber; }
+ set { SetProperty(ref _addphonenumber, value); }
+ }
+
+ public string use_dect
+ {
+ get { return _use_dect; }
+ set { SetProperty(ref _use_dect, value); }
+ }
+
+ public string dect_devices
+ {
+ get { return _dect_devices; }
+ set { SetProperty(ref _dect_devices, value); }
+ }
+
+ public string wlan_ssid
+ {
+ get { return _wlan_ssid; }
+ set { SetProperty(ref _wlan_ssid, value); }
+ }
+
+ public string wlan_5ghz_ssid
+ {
+ get { return _wlan_5ghz_ssid; }
+ set { SetProperty(ref _wlan_5ghz_ssid, value); }
+ }
+
+ public string use_wlan
+ {
+ get { return _use_wlan; }
+ set { SetProperty(ref _use_wlan, value); }
+ }
+
+ public string use_wlan_5ghz
+ {
+ get { return _use_wlan_5ghz; }
+ set { SetProperty(ref _use_wlan_5ghz, value); }
+ }
+
+ public string wlan_devices
+ {
+ get { return _wlan_devices; }
+ set { SetProperty(ref _wlan_devices, value); }
+ }
+
+ public string wlan_5ghz_devices
+ {
+ get { return _wlan_5ghz_devices; }
+ set { SetProperty(ref _wlan_5ghz_devices, value); }
+ }
+
+ public string lan1_device
+ {
+ get { return _lan1_device; }
+ set { SetProperty(ref _lan1_device, value); }
+ }
+
+ public string lan2_device
+ {
+ get { return _lan2_device; }
+ set { SetProperty(ref _lan2_device, value); }
+ }
+
+ public string lan3_device
+ {
+ get { return _lan3_device; }
+ set { SetProperty(ref _lan3_device, value); }
+ }
+
+ public string lan4_device
+ {
+ get { return _lan4_device; }
+ set { SetProperty(ref _lan4_device, value); }
+ }
+
+ public string hsfon_status
+ {
+ get { return _hsfon_status; }
+ set { SetProperty(ref _hsfon_status, value); }
+ }
+
+ public string firmware_version
+ {
+ get { return _firmware_version; }
+ set { SetProperty(ref _firmware_version, value); }
+ }
+
+ public string serial_number
+ {
+ get { return _serial_number; }
+ set { SetProperty(ref _serial_number, value); }
+ }
+
+ public string uptime
+ {
+ get { return _uptime; }
+ set { SetProperty(ref _uptime, value); }
+ }
+
+ public StatusPageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ }
+ }
}
using SpeedportHybridControl.Data;
using System.Windows;
-namespace SpeedportHybridControl.PageModel {
- class SyslogPageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
- private DelegateCommand _copyCommand;
- private DelegateCommand _clearCommand;
-
- private string _searchText;
-
- private List<SyslogList> _syslogList;
- private List<SyslogList> _filteredList;
- private string _datetime;
-
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
-
- public DelegateCommand CopyCommand {
- get { return _copyCommand; }
- set { SetProperty(ref _copyCommand, value); }
- }
-
- public DelegateCommand ClearCommand {
- get { return _clearCommand; }
- set { SetProperty(ref _clearCommand, value); }
- }
-
- public string SearchText {
- get { return _searchText; }
- set {
- SetProperty(ref _searchText, value);
- ApplyFilter();
- }
- }
-
- public List<SyslogList> syslogList {
- get { return _syslogList; }
- set {
- SetProperty(ref _syslogList, value);
- ApplyFilter();
- }
- }
-
- public List<SyslogList> filteredList {
- get { return _filteredList; }
- set { SetProperty(ref _filteredList, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initSyslog(); }).Start();
- }
-
- public IEnumerable<SyslogList> SelectedItens
- {
- get { return filteredList.Where(o => o.IsSelected); }
- }
-
- private void OnCopyCommandExecute () {
- string text = string.Empty;
- foreach (SyslogList item in SelectedItens) {
- text = string.Concat(text, Environment.NewLine, item.ToString());
- }
-
- Clipboard.SetText(text);
- }
-
- private void OnClearCommandExecute () {
- MessageBoxResult result = MessageBox.Show("Sollen die System-Informationen wirklich gelöscht werden?", "Confirmation", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
- if (result.Equals(MessageBoxResult.Yes)) {
- SpeedportHybridAPI.getInstance().clearSyslog();
- SpeedportHybrid.initSyslog();
- SearchText = string.Empty;
- }
- }
-
- private void ApplyFilter () {
- if (object.ReferenceEquals(syslogList, null)) {
- filteredList = syslogList;
- }
- else {
- List<SyslogList> tmp = syslogList;
- filteredList = tmp.Where(item => SyslogFilter(item)).ToList();
- }
- }
-
- private bool SyslogFilter (object item) {
- if (SearchText.IsNullOrEmpty().Equals(false)) {
- return ((item as SyslogList).message.IndexOf(SearchText, StringComparison.OrdinalIgnoreCase) >= 0);
- }
-
- return true;
- }
-
- public SyslogPageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute));
- ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class SyslogPageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+ private DelegateCommand _copyCommand;
+ private DelegateCommand _clearCommand;
+
+ private string _searchText;
+
+ private List<SyslogList> _syslogList;
+ private List<SyslogList> _filteredList;
+ private string _datetime;
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ public DelegateCommand CopyCommand
+ {
+ get { return _copyCommand; }
+ set { SetProperty(ref _copyCommand, value); }
+ }
+
+ public DelegateCommand ClearCommand
+ {
+ get { return _clearCommand; }
+ set { SetProperty(ref _clearCommand, value); }
+ }
+
+ public string SearchText
+ {
+ get { return _searchText; }
+ set
+ {
+ SetProperty(ref _searchText, value);
+ ApplyFilter();
+ }
+ }
+
+ public List<SyslogList> syslogList
+ {
+ get { return _syslogList; }
+ set
+ {
+ SetProperty(ref _syslogList, value);
+ ApplyFilter();
+ }
+ }
+
+ public List<SyslogList> filteredList
+ {
+ get { return _filteredList; }
+ set { SetProperty(ref _filteredList, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initSyslog(); }).Start();
+ }
+
+ public IEnumerable<SyslogList> SelectedItens
+ {
+ get { return filteredList.Where(o => o.IsSelected); }
+ }
+
+ private void OnCopyCommandExecute()
+ {
+ string text = string.Empty;
+ foreach (SyslogList item in SelectedItens)
+ {
+ text = string.Concat(text, Environment.NewLine, item.ToString());
+ }
+
+ Clipboard.SetText(text);
+ }
+
+ private void OnClearCommandExecute()
+ {
+ MessageBoxResult result = MessageBox.Show("Sollen die System-Informationen wirklich gelöscht werden?", "Confirmation", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
+ if (result.Equals(MessageBoxResult.Yes))
+ {
+ SpeedportHybridAPI.getInstance().clearSyslog();
+ SpeedportHybrid.initSyslog();
+ SearchText = string.Empty;
+ }
+ }
+
+ private void ApplyFilter()
+ {
+ if (object.ReferenceEquals(syslogList, null))
+ {
+ filteredList = syslogList;
+ }
+ else {
+ List<SyslogList> tmp = syslogList;
+ filteredList = tmp.Where(item => SyslogFilter(item)).ToList();
+ }
+ }
+
+ private bool SyslogFilter(object item)
+ {
+ if (SearchText.IsNullOrEmpty().Equals(false))
+ {
+ return ((item as SyslogList).message.IndexOf(SearchText, StringComparison.OrdinalIgnoreCase) >= 0);
+ }
+
+ return true;
+ }
+
+ public SyslogPageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute));
+ ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute));
+ }
+ }
}
using SpeedportHybridControl.Implementations;
using System.Threading;
-namespace SpeedportHybridControl.PageModel {
- class TR181PageModel : SuperViewModel {
- private DelegateCommand _reloadCommand;
- private DelegateCommand _saveCommand;
-
- private string _enable1;
- private string _status1;
- private string _mode;
- private string _servername;
- private string _severip;
- private string _bw;
- private string _errorinfo;
- private string _hellostatus;
- private string _lte_tunnel;
- private string _dsl_tunnel;
- private string _bonding;
- private string _QueueSkbTimeOut;
- private string _datetime;
- private string _bypass_up_bw;
- private string _bypass_dw_bw;
- private string _bypass_up_rb;
- private string _bypass_dw_rb;
- private string _bypass_check;
-
- public DelegateCommand ReloadCommand {
- get { return _reloadCommand; }
- set { SetProperty(ref _reloadCommand, value); }
- }
-
- public DelegateCommand SaveCommand {
- get { return _saveCommand; }
- set { SetProperty(ref _saveCommand, value); }
- }
-
- public string enable1 {
- get { return _enable1; }
- set { SetProperty(ref _enable1, value); }
- }
-
- public string status1 {
- get { return _status1; }
- set { SetProperty(ref _status1, value); }
- }
-
- public string mode {
- get { return _mode; }
- set { SetProperty(ref _mode, value); }
- }
-
- public string servername {
- get { return _servername; }
- set { SetProperty(ref _servername, value); }
- }
-
- public string severip {
- get { return _severip; }
- set { SetProperty(ref _severip, value); }
- }
-
- public string bw {
- get { return _bw; }
- set { SetProperty(ref _bw, value); }
- }
-
- public string errorinfo {
- get { return _errorinfo; }
- set { SetProperty(ref _errorinfo, value); }
- }
-
- public string hellostatus {
- get { return _hellostatus; }
- set { SetProperty(ref _hellostatus, value); }
- }
-
- public string lte_tunnel {
- get { return _lte_tunnel; }
- set { SetProperty(ref _lte_tunnel, value); }
- }
-
- public string dsl_tunnel {
- get { return _dsl_tunnel; }
- set { SetProperty(ref _dsl_tunnel, value); }
- }
-
- public string bonding {
- get { return _bonding; }
- set { SetProperty(ref _bonding, value); }
- }
-
- public string QueueSkbTimeOut {
- get { return _QueueSkbTimeOut; }
- set { SetProperty(ref _QueueSkbTimeOut, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- public string bypass_up_bw {
- get { return _bypass_up_bw; }
- set { SetProperty(ref _bypass_up_bw, value); }
- }
-
- public string bypass_dw_bw {
- get { return _bypass_dw_bw; }
- set { SetProperty(ref _bypass_dw_bw, value); }
- }
-
- public string bypass_up_rb {
- get { return _bypass_up_rb; }
- set { SetProperty(ref _bypass_up_rb, value); }
- }
-
- public string bypass_dw_rb {
- get { return _bypass_dw_rb; }
- set { SetProperty(ref _bypass_dw_rb, value); }
- }
-
- public string bypass_check {
- get { return _bypass_check; }
- set { SetProperty(ref _bypass_check, value); }
- }
-
- private void OnReloadCommandExecute () {
- new Thread(() => { SpeedportHybrid.initTR181(); }).Start();
- }
-
- private void OnSaveCommandExecute () {
- SpeedportHybridAPI.getInstance().setQueueSkbTimeOut(QueueSkbTimeOut);
- }
-
- public TR181PageModel () {
- ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
- SaveCommand = new DelegateCommand(new Action(OnSaveCommandExecute));
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class TR181PageModel : SuperViewModel
+ {
+ private DelegateCommand _reloadCommand;
+ private DelegateCommand _saveCommand;
+
+ private string _enable1;
+ private string _status1;
+ private string _mode;
+ private string _servername;
+ private string _severip;
+ private string _bw;
+ private string _errorinfo;
+ private string _hellostatus;
+ private string _lte_tunnel;
+ private string _dsl_tunnel;
+ private string _bonding;
+ private string _QueueSkbTimeOut;
+ private string _datetime;
+ private string _bypass_up_bw;
+ private string _bypass_dw_bw;
+ private string _bypass_up_rb;
+ private string _bypass_dw_rb;
+ private string _bypass_check;
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ public DelegateCommand SaveCommand
+ {
+ get { return _saveCommand; }
+ set { SetProperty(ref _saveCommand, value); }
+ }
+
+ public string enable1
+ {
+ get { return _enable1; }
+ set { SetProperty(ref _enable1, value); }
+ }
+
+ public string status1
+ {
+ get { return _status1; }
+ set { SetProperty(ref _status1, value); }
+ }
+
+ public string mode
+ {
+ get { return _mode; }
+ set { SetProperty(ref _mode, value); }
+ }
+
+ public string servername
+ {
+ get { return _servername; }
+ set { SetProperty(ref _servername, value); }
+ }
+
+ public string severip
+ {
+ get { return _severip; }
+ set { SetProperty(ref _severip, value); }
+ }
+
+ public string bw
+ {
+ get { return _bw; }
+ set { SetProperty(ref _bw, value); }
+ }
+
+ public string errorinfo
+ {
+ get { return _errorinfo; }
+ set { SetProperty(ref _errorinfo, value); }
+ }
+
+ public string hellostatus
+ {
+ get { return _hellostatus; }
+ set { SetProperty(ref _hellostatus, value); }
+ }
+
+ public string lte_tunnel
+ {
+ get { return _lte_tunnel; }
+ set { SetProperty(ref _lte_tunnel, value); }
+ }
+
+ public string dsl_tunnel
+ {
+ get { return _dsl_tunnel; }
+ set { SetProperty(ref _dsl_tunnel, value); }
+ }
+
+ public string bonding
+ {
+ get { return _bonding; }
+ set { SetProperty(ref _bonding, value); }
+ }
+
+ public string QueueSkbTimeOut
+ {
+ get { return _QueueSkbTimeOut; }
+ set { SetProperty(ref _QueueSkbTimeOut, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ public string bypass_up_bw
+ {
+ get { return _bypass_up_bw; }
+ set { SetProperty(ref _bypass_up_bw, value); }
+ }
+
+ public string bypass_dw_bw
+ {
+ get { return _bypass_dw_bw; }
+ set { SetProperty(ref _bypass_dw_bw, value); }
+ }
+
+ public string bypass_up_rb
+ {
+ get { return _bypass_up_rb; }
+ set { SetProperty(ref _bypass_up_rb, value); }
+ }
+
+ public string bypass_dw_rb
+ {
+ get { return _bypass_dw_rb; }
+ set { SetProperty(ref _bypass_dw_rb, value); }
+ }
+
+ public string bypass_check
+ {
+ get { return _bypass_check; }
+ set { SetProperty(ref _bypass_check, value); }
+ }
+
+ private void OnReloadCommandExecute()
+ {
+ new Thread(() => { SpeedportHybrid.initTR181(); }).Start();
+ }
+
+ private void OnSaveCommandExecute()
+ {
+ SpeedportHybridAPI.getInstance().setQueueSkbTimeOut(QueueSkbTimeOut);
+ }
+
+ public TR181PageModel()
+ {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ SaveCommand = new DelegateCommand(new Action(OnSaveCommandExecute));
+ }
+ }
}
using System.Windows;
using System.Threading;
-namespace SpeedportHybridControl.PageModel {
- class ltepopupModel : SuperViewModel {
- private System.Timers.Timer _timer;
- private DelegateCommand _pinCommand;
- private DelegateCommand _closeWindowCommand;
- private bool _pinActive;
- private bool _logActive;
-
- private bool _topmost = false;
- private LTECollection _lteCollection;
- private LTECollection _lteCollection2;
- private EnumerableDataSource<LTEData> _rsrqGraph;
- private EnumerableDataSource<LTEData> _rsrpGraph;
- private HorizontalDateTimeAxis _dateTimeAxis1;
- private HorizontalDateTimeAxis _dateTimeAxis2;
-
- private string _phycellid;
- private string _cellid;
- private string _rsrp;
- private Brush _rsrp_bg = Brushes.Transparent;
- private string _rsrq;
- private Brush _rsrq_bg = Brushes.Transparent;
- private string _datetime;
-
- public DelegateCommand PinCommand {
- get { return _pinCommand; }
- set { SetProperty(ref _pinCommand, value); }
- }
-
- public DelegateCommand CloseWindowCommand {
- get { return _closeWindowCommand; }
- set { SetProperty(ref _closeWindowCommand, value); }
- }
-
- public bool PinActive {
- get { return _pinActive; }
- set { SetProperty(ref _pinActive, value); }
- }
-
- public bool LogActive {
- get { return _logActive; }
- set { SetProperty(ref _logActive, value); }
- }
-
- public bool Topmost {
- get { return _topmost; }
- set { SetProperty(ref _topmost, value); }
- }
-
- public LTECollection LTECollection {
- get { return _lteCollection; }
- set { SetProperty(ref _lteCollection, value); }
- }
-
- public LTECollection LTECollection2 {
- get { return _lteCollection2; }
- set { SetProperty(ref _lteCollection2, value); }
- }
-
- public EnumerableDataSource<LTEData> RsrqGraph {
- get { return _rsrqGraph; }
- set { SetProperty(ref _rsrqGraph, value); }
- }
-
- public EnumerableDataSource<LTEData> RsrpGraph {
- get { return _rsrpGraph; }
- set { SetProperty(ref _rsrpGraph, value); }
- }
-
- public HorizontalDateTimeAxis DateTimeAxis1 {
- get { return _dateTimeAxis1; }
- set { SetProperty(ref _dateTimeAxis1, value); }
- }
-
- public HorizontalDateTimeAxis DateTimeAxis2 {
- get { return _dateTimeAxis2; }
- set { SetProperty(ref _dateTimeAxis2, value); }
- }
-
- public string phycellid {
- get { return _phycellid; }
- set { SetProperty(ref _phycellid, value); }
- }
-
- public string cellid {
- get { return _cellid; }
- set { SetProperty(ref _cellid, value); }
- }
-
- public string rsrp {
- get { return _rsrp; }
- set { SetProperty(ref _rsrp, value); }
- }
-
- public Brush rsrp_bg {
- get { return _rsrp_bg; }
- set { SetProperty(ref _rsrp_bg, value); }
- }
-
- public string rsrq {
- get { return _rsrq; }
- set { SetProperty(ref _rsrq, value); }
- }
-
- public Brush rsrq_bg {
- get { return _rsrq_bg; }
- set { SetProperty(ref _rsrq_bg, value); }
- }
-
- public string datetime {
- get { return _datetime; }
- set { SetProperty(ref _datetime, value); }
- }
-
- public void StopTimer () {
- if (Object.Equals(_timer, null).Equals(false)) {
- _timer.Stop();
- }
- }
-
- public void StartTimer () {
- _timer = new System.Timers.Timer {
- Interval = 1000, // every second
- };
-
- _timer.Elapsed += timer_Elapsed;
- _timer.Start();
- }
-
- void timer_Elapsed (object sender, ElapsedEventArgs e) {
- new Thread(() => {
- SpeedportHybrid.initLtePopup();
- Application.Current.Dispatcher.BeginInvoke(new Action(() => {
- LTECollection.Add(new LTEData() { Date = DateTime.Now, Data = rsrq.ToInt() });
- LTECollection2.Add(new LTEData() { Date = DateTime.Now, Data = rsrp.ToInt() });
-
- if (LogActive.Equals(true)) {
- // log
- log(string.Concat("Pysical Cell ID: ", phycellid, ", Cell ID: ", cellid, ", RSRP: ", rsrp, ", RSRQ: ", rsrq));
- }
- }));
- }).Start();
- }
-
- private void log (string value) {
- DateTime time = DateTime.Now;
-
- if (Directory.Exists("log/").Equals(false))
- Directory.CreateDirectory("log/");
-
- if (Directory.Exists("log/lte/").Equals(false))
- Directory.CreateDirectory("log/lte/");
-
- StreamWriter file = new StreamWriter(string.Concat("log/lte/", time.ToString("dd.MM.yyyy"), ".txt"), true);
- file.WriteLine(string.Concat("[", time.ToString("dd.MM.yyyy HH:mm:ss"), "]: ", value));
- file.Close();
- }
-
- private void OnPinCommandExecute () {
- if (PinActive.Equals(true)) {
- Topmost = true;
- }
- else {
- Topmost = false;
- }
- }
-
- private void OnCloseWindowCommandExecute () {
- StopTimer();
- }
-
- public ltepopupModel () {
- PinCommand = new DelegateCommand(new Action(OnPinCommandExecute));
- CloseWindowCommand = new DelegateCommand(new Action(OnCloseWindowCommandExecute));
-
- LTECollection = new LTECollection();
- LTECollection2 = new LTECollection();
- DateTimeAxis1 = new HorizontalDateTimeAxis();
- DateTimeAxis2 = new HorizontalDateTimeAxis();
-
- var ds = new EnumerableDataSource<LTEData>(LTECollection);
- ds.SetXMapping(x => DateTimeAxis1.ConvertToDouble(x.Date));
- ds.SetYMapping(y => y.Data);
-
- RsrqGraph = ds;
-
- var ds2 = new EnumerableDataSource<LTEData>(LTECollection2);
- ds2.SetXMapping(x => DateTimeAxis1.ConvertToDouble(x.Date));
- ds2.SetYMapping(y => y.Data);
-
- RsrpGraph = ds2;
- }
- }
+namespace SpeedportHybridControl.PageModel
+{
+ class ltepopupModel : SuperViewModel
+ {
+ private System.Timers.Timer _timer;
+ private DelegateCommand _pinCommand;
+ private DelegateCommand _closeWindowCommand;
+ private bool _pinActive;
+ private bool _logActive;
+
+ private bool _topmost = false;
+ private LTECollection _lteCollection;
+ private LTECollection _lteCollection2;
+ private EnumerableDataSource<LTEData> _rsrqGraph;
+ private EnumerableDataSource<LTEData> _rsrpGraph;
+ private HorizontalDateTimeAxis _dateTimeAxis1;
+ private HorizontalDateTimeAxis _dateTimeAxis2;
+
+ private string _phycellid;
+ private string _cellid;
+ private string _rsrp;
+ private Brush _rsrp_bg = Brushes.Transparent;
+ private string _rsrq;
+ private Brush _rsrq_bg = Brushes.Transparent;
+ private string _datetime;
+
+ public DelegateCommand PinCommand
+ {
+ get { return _pinCommand; }
+ set { SetProperty(ref _pinCommand, value); }
+ }
+
+ public DelegateCommand CloseWindowCommand
+ {
+ get { return _closeWindowCommand; }
+ set { SetProperty(ref _closeWindowCommand, value); }
+ }
+
+ public bool PinActive
+ {
+ get { return _pinActive; }
+ set { SetProperty(ref _pinActive, value); }
+ }
+
+ public bool LogActive
+ {
+ get { return _logActive; }
+ set { SetProperty(ref _logActive, value); }
+ }
+
+ public bool Topmost
+ {
+ get { return _topmost; }
+ set { SetProperty(ref _topmost, value); }
+ }
+
+ public LTECollection LTECollection
+ {
+ get { return _lteCollection; }
+ set { SetProperty(ref _lteCollection, value); }
+ }
+
+ public LTECollection LTECollection2
+ {
+ get { return _lteCollection2; }
+ set { SetProperty(ref _lteCollection2, value); }
+ }
+
+ public EnumerableDataSource<LTEData> RsrqGraph
+ {
+ get { return _rsrqGraph; }
+ set { SetProperty(ref _rsrqGraph, value); }
+ }
+
+ public EnumerableDataSource<LTEData> RsrpGraph
+ {
+ get { return _rsrpGraph; }
+ set { SetProperty(ref _rsrpGraph, value); }
+ }
+
+ public HorizontalDateTimeAxis DateTimeAxis1
+ {
+ get { return _dateTimeAxis1; }
+ set { SetProperty(ref _dateTimeAxis1, value); }
+ }
+
+ public HorizontalDateTimeAxis DateTimeAxis2
+ {
+ get { return _dateTimeAxis2; }
+ set { SetProperty(ref _dateTimeAxis2, value); }
+ }
+
+ public string phycellid
+ {
+ get { return _phycellid; }
+ set { SetProperty(ref _phycellid, value); }
+ }
+
+ public string cellid
+ {
+ get { return _cellid; }
+ set { SetProperty(ref _cellid, value); }
+ }
+
+ public string rsrp
+ {
+ get { return _rsrp; }
+ set { SetProperty(ref _rsrp, value); }
+ }
+
+ public Brush rsrp_bg
+ {
+ get { return _rsrp_bg; }
+ set { SetProperty(ref _rsrp_bg, value); }
+ }
+
+ public string rsrq
+ {
+ get { return _rsrq; }
+ set { SetProperty(ref _rsrq, value); }
+ }
+
+ public Brush rsrq_bg
+ {
+ get { return _rsrq_bg; }
+ set { SetProperty(ref _rsrq_bg, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ public void StopTimer()
+ {
+ if (Object.Equals(_timer, null).Equals(false))
+ {
+ _timer.Stop();
+ }
+ }
+
+ public void StartTimer()
+ {
+ _timer = new System.Timers.Timer
+ {
+ Interval = 1000, // every second
+ };
+
+ _timer.Elapsed += timer_Elapsed;
+ _timer.Start();
+ }
+
+ void timer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ new Thread(() => {
+ SpeedportHybrid.initLtePopup();
+ Application.Current.Dispatcher.BeginInvoke(new Action(() => {
+ LTECollection.Add(new LTEData() { Date = DateTime.Now, Data = rsrq.ToInt() });
+ LTECollection2.Add(new LTEData() { Date = DateTime.Now, Data = rsrp.ToInt() });
+
+ if (LogActive.Equals(true))
+ {
+ // log
+ log(string.Concat("Pysical Cell ID: ", phycellid, ", Cell ID: ", cellid, ", RSRP: ", rsrp, ", RSRQ: ", rsrq));
+ }
+ }));
+ }).Start();
+ }
+
+ private void log(string value)
+ {
+ DateTime time = DateTime.Now;
+
+ if (Directory.Exists("log/").Equals(false))
+ Directory.CreateDirectory("log/");
+
+ if (Directory.Exists("log/lte/").Equals(false))
+ Directory.CreateDirectory("log/lte/");
+
+ StreamWriter file = new StreamWriter(string.Concat("log/lte/", time.ToString("dd.MM.yyyy"), ".txt"), true);
+ file.WriteLine(string.Concat("[", time.ToString("dd.MM.yyyy HH:mm:ss"), "]: ", value));
+ file.Close();
+ }
+
+ private void OnPinCommandExecute()
+ {
+ if (PinActive.Equals(true))
+ {
+ Topmost = true;
+ }
+ else {
+ Topmost = false;
+ }
+ }
+
+ private void OnCloseWindowCommandExecute()
+ {
+ StopTimer();
+ }
+
+ public ltepopupModel()
+ {
+ PinCommand = new DelegateCommand(new Action(OnPinCommandExecute));
+ CloseWindowCommand = new DelegateCommand(new Action(OnCloseWindowCommandExecute));
+
+ LTECollection = new LTECollection();
+ LTECollection2 = new LTECollection();
+ DateTimeAxis1 = new HorizontalDateTimeAxis();
+ DateTimeAxis2 = new HorizontalDateTimeAxis();
+
+ var ds = new EnumerableDataSource<LTEData>(LTECollection);
+ ds.SetXMapping(x => DateTimeAxis1.ConvertToDouble(x.Date));
+ ds.SetYMapping(y => y.Data);
+
+ RsrqGraph = ds;
+
+ var ds2 = new EnumerableDataSource<LTEData>(LTECollection2);
+ ds2.SetXMapping(x => DateTimeAxis1.ConvertToDouble(x.Date));
+ ds2.SetYMapping(y => y.Data);
+
+ RsrpGraph = ds2;
+ }
+ }
}
using SpeedportHybridControl.PageModel;
using System.Windows;
-namespace SpeedportHybridControl {
- /// <summary>
- /// Interaction logic for Window1.xaml
- /// </summary>
- public partial class ltepopup : Window {
- public ltepopup () {
- InitializeComponent();
- }
+namespace SpeedportHybridControl
+{
+ /// <summary>
+ /// Interaction logic for Window1.xaml
+ /// </summary>
+ public partial class ltepopup : Window
+ {
+ public ltepopup()
+ {
+ InitializeComponent();
+ }
- // quick & dirty
- private void Window_Closing (object sender, System.ComponentModel.CancelEventArgs e) {
- ltepopupModel lm = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
- lm.StopTimer();
+ // quick & dirty
+ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ ltepopupModel lm = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
+ lm.StopTimer();
}
- }
+ }
}
using System.ComponentModel;
using System.Runtime.CompilerServices;
-namespace SpeedportHybridControl.Model {
- public class SuperViewModel : INotifyPropertyChanged {
+namespace SpeedportHybridControl.Model
+{
+ public class SuperViewModel : INotifyPropertyChanged
+ {
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler PropertyChanged;
- protected void SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = null) {
- if (object.Equals(property, value))
- return;
+ protected void SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = null)
+ {
+ if (object.Equals(property, value))
+ return;
- property = value;
- onPropertyChanged(propertyName);
- }
+ property = value;
+ onPropertyChanged(propertyName);
+ }
- protected void onPropertyChanged ([CallerMemberName] string propertyName = null) {
- if (object.Equals(PropertyChanged, null))
- return;
+ protected void onPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ if (object.Equals(PropertyChanged, null))
+ return;
- PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for AboutPage.xaml
- /// </summary>
- public partial class AboutPage : Page {
- public AboutPage () {
- InitializeComponent();
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for AboutPage.xaml
+ /// </summary>
+ public partial class AboutPage : Page
+ {
+ public AboutPage()
+ {
+ InitializeComponent();
}
- }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for ControlsPage.xaml
- /// </summary>
- public partial class ControlsPage : Page {
- public ControlsPage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for ControlsPage.xaml
+ /// </summary>
+ public partial class ControlsPage : Page
+ {
+ public ControlsPage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- public partial class DslPage : Page {
- public DslPage () {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ public partial class DslPage : Page
+ {
+ public DslPage()
+ {
+ InitializeComponent();
+ }
+ }
}
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaktionslogik für InterfacePage.xaml
- /// </summary>
- public partial class InterfacePage : Page {
- public InterfacePage () {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaktionslogik für InterfacePage.xaml
+ /// </summary>
+ public partial class InterfacePage : Page
+ {
+ public InterfacePage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for LanPage.xaml
- /// </summary>
- public partial class LanPage : Page {
- public LanPage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for LanPage.xaml
+ /// </summary>
+ public partial class LanPage : Page
+ {
+ public LanPage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for LoginPage.xaml
- /// </summary>
- public partial class LoginPage : Page {
- public LoginPage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for LoginPage.xaml
+ /// </summary>
+ public partial class LoginPage : Page
+ {
+ public LoginPage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for LteInfoPage.xaml
- /// </summary>
- public partial class LteInfoPage : Page {
- public LteInfoPage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for LteInfoPage.xaml
+ /// </summary>
+ public partial class LteInfoPage : Page
+ {
+ public LteInfoPage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for OverviewPage.xaml
- /// </summary>
- public partial class OverviewPage : Page {
- public OverviewPage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for OverviewPage.xaml
+ /// </summary>
+ public partial class OverviewPage : Page
+ {
+ public OverviewPage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for PhonePage.xaml
- /// </summary>
- public partial class PhonePage : Page {
- public PhonePage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for PhonePage.xaml
+ /// </summary>
+ public partial class PhonePage : Page
+ {
+ public PhonePage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for StatusPage.xaml
- /// </summary>
- public partial class StatusPage : Page {
- public StatusPage() {
- InitializeComponent();
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for StatusPage.xaml
+ /// </summary>
+ public partial class StatusPage : Page
+ {
+ public StatusPage()
+ {
+ InitializeComponent();
+ }
}
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for SyslogPage.xaml
- /// </summary>
- public partial class SyslogPage : Page {
- public SyslogPage() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for SyslogPage.xaml
+ /// </summary>
+ public partial class SyslogPage : Page
+ {
+ public SyslogPage()
+ {
+ InitializeComponent();
+ }
+ }
}
using System.Windows.Controls;
-namespace SpeedportHybridControl.page {
- /// <summary>
- /// Interaction logic for TR181Page.xaml
- /// </summary>
- public partial class TR181Page : Page {
- public TR181Page() {
- InitializeComponent();
- }
- }
+namespace SpeedportHybridControl.page
+{
+ /// <summary>
+ /// Interaction logic for TR181Page.xaml
+ /// </summary>
+ public partial class TR181Page : Page
+ {
+ public TR181Page()
+ {
+ InitializeComponent();
+ }
+ }
}