using Newtonsoft.Json.Linq;
using System;
using System.Linq;
+using System.Net;
+using System.Net.NetworkInformation;
+using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
+using System.Threading;
+using System.Windows;
using System.Windows.Media;
using System.Xml;
return false;
}
+
+ public static bool checkLteModul ()
+ {
+ Ping ping = new Ping();
+ try
+ {
+ PingReply reply = ping.Send("172.10.10.1", 2);
+
+ if (reply.Status == IPStatus.Success)
+ {
+ return true;
+ }
+#if DEBUG
+ else
+ {
+ LogManager.WriteToLog("unable to reach LTE Modul");
+ }
+#endif
+ }
+ catch (PingException) {
+#if DEBUG
+ LogManager.WriteToLog("unable to reach LTE Modul");
+#endif
+ }
+
+ return false;
+ }
+
+ public static void sendCommandToLteModul (string Command)
+ {
+ if (checkLteModul().Equals(true))
+ {
+ try
+ {
+ Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+ IPAddress serverAddr = IPAddress.Parse("172.10.10.1");
+ IPEndPoint endPoint = new IPEndPoint(serverAddr, 1280);
+ byte[] cmd = Encoding.ASCII.GetBytes(Command);
+ sock.SendTo(cmd, endPoint);
+ sock.Close();
+ }
+ catch (Exception)
+ {
+ new Thread(() => { MessageBox.Show("couldn't send Command to LTE Modul", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
+ LogManager.WriteToLog("couldn't send Command to LTE Modul");
+ }
+ }
+ }
}
}
-using System.Windows;
+using SpeedportHybridControl.Implementations;
+using System.Threading;
+using System.Windows;
namespace SpeedportHybridControl
{
public MainWindow()
{
InitializeComponent();
- }
+ /*
+ if (util.checkLteModul())
+ {
+ MessageBox.Show("ABC", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ else
+ {
+ MessageBox.Show("DEF", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ */
+ }
}
}