new remoteidlist

This commit is contained in:
Martijn Scheepers
2021-10-22 11:08:29 +02:00
parent 36b9f35cc1
commit 79b6228d30
26 changed files with 1172 additions and 471 deletions

View File

@@ -19,7 +19,6 @@ namespace UCS.ConfigFile
public InitiationWorksheet Initiation_Data = new InitiationWorksheet();
public event EventHandler<string> ErrorMessageEvent;
public event EventHandler TelemetryConnectionStateUpdate;
public void ReadConfigFile(string xmlFilePath)
{
@@ -73,7 +72,7 @@ namespace UCS.ConfigFile
this.Remote_IDList.Add(new RemoteIdListLine());
this.Remote_IDList[i].LineNumber = i + 2;
this.Remote_IDList[i].ErrorMessageEvent += this.ErrorMessageEvent;
this.Remote_IDList[i].TelemetryConnectionStateUpdate += this.TelemetryConnectionStateUpdate;
//this.Remote_IDList[i].TelemetryConnectionStateUpdate += this.TelemetryConnectionStateUpdate;
}
break;
}

View File

@@ -5,7 +5,6 @@ namespace UCS.ConfigFile
public class RemoteIdListLine
{
internal event EventHandler<string> ErrorMessageEvent;
internal event EventHandler TelemetryConnectionStateUpdate;
public int LineNumber { get; set; }
public string UserInfo { get; set; } = string.Empty;
@@ -16,41 +15,6 @@ namespace UCS.ConfigFile
public int TimerInterval { get; set; } = 0; // tijd tussen de afvragingen
public int NotConnectValue { get; set; } = 0; // Aantal keren niet reageren tot een alarm
public int MinuteTimer { get; set; } = 0; // Om de tijd bij te houden tussen afvragingen
public int NotConnectCounter { get; set; } = 0; // Teller hoe vaak er niet is gereageerd
public string LastData { get; set; } = string.Empty;
private DateTime _lastDataDate;
public DateTime LastDataDate
{
get
{
return _lastDataDate;
}
set
{
_lastDataDate = value;
TelemetryConnectionStateUpdate?.Invoke(this, null);
}
}
private bool _connectionState = false;
public bool ConnectionState
{
get
{
return _connectionState;
}
set
{
if (_connectionState != value)
{
_connectionState = value;
TelemetryConnectionStateUpdate?.Invoke(this, null);
}
}
}
public void StoreRemoteIdListLine(int column, int row, string cellData)
{

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UCS.ConfigFile;
namespace UCS.RemoteIDList
{
public interface IMonitorObject
{
[DisplayName("User Info")]
string UserInfo { get; }
[DisplayName("Remote ID")]
string RemoteId { get; }
[DisplayName("Tx Com")]
CommType TxCom { get; }
[DisplayName("Tx String opstarten")]
string TxStringStartup { get; }
[DisplayName("Tx String")]
string TxString { get; }
[DisplayName("Timer Interval(minuten) 0=disabled")]
int TimerInterval { get; }
[DisplayName("Number of N/Cs before error")]
int NotConnectValue { get; }
[DisplayName("Time Left (seconds)")]
double TimeLeft { get; }
[DisplayName("Geen verbinding teller")]
int NotConnectCounter { get; }
[DisplayName("Laatste data")]
string LastData { get; }
[DisplayName("Laatste data tijd")]
DateTime LastDataDate { get; }
[DisplayName("Connectie status")]
bool ConnectionState { get; }
//[DisplayName("Reset Timer")]
//DataGridViewButtonCell ResetButton { get; }
//[DisplayName("Reset Timer")]
//DataGridViewButtonColumn ResetButtonColumn { get; }
event EventHandler<object> SendDataEvent;
event EventHandler OnlineEvent;
event EventHandler OfflineEvent;
void SendStartupMessage();
void SetLastData(string data);
void StopMonitor();
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UCS.ConfigFile;
namespace UCS.RemoteIDList
{
public class IOTMonitor : IMonitorObject
{
public string UserInfo { get; private set; }
public string RemoteId { get; private set; }
public CommType TxCom { get; private set; }
public string TxStringStartup { get; private set; }
public string TxString { get; private set; }
public int TimerInterval { get; private set; }
public int NotConnectValue { get; private set; }
public double TimeLeft => Math.Round(_timer.TimeLeftSeconds);
public int NotConnectCounter { get; private set; }
public string LastData { get; private set; }
public DateTime LastDataDate { get; private set; }
public bool ConnectionState { get; private set; }
//public DataGridViewButtonCell ResetButton { get; private set; }
//public DataGridViewButtonColumn ResetButtonColumn { get; private set; }
private readonly RemoteIdListTimer _timer = new RemoteIdListTimer();
public event EventHandler<object> SendDataEvent;
public event EventHandler OnlineEvent;
public event EventHandler OfflineEvent;
public IOTMonitor(RemoteIdListLine remoteIdListLine)
{
UserInfo = remoteIdListLine.UserInfo;
RemoteId = remoteIdListLine.RemoteId;
TxCom = remoteIdListLine.TxCom;
TxStringStartup = remoteIdListLine.TxStringStartup;
TxString = remoteIdListLine.TxString;
TimerInterval = remoteIdListLine.TimerInterval;
NotConnectValue = remoteIdListLine.NotConnectValue;
if (TimerInterval > 0)
{
_timer.Elapsed += Timer_Elapsed;
_timer.Interval = TimerInterval * (1000 * 60);
_timer.Start();
}
}
public void SendStartupMessage()
{
SendDataEvent?.Invoke(this, TxStringStartup);
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
SendDataEvent?.Invoke(this, TxString);
NotConnectCounter++;
if (NotConnectCounter == NotConnectValue)
{
ConnectionState = false;
OfflineEvent?.Invoke(this, null);
}
}
public void SetLastData(string data)
{
LastData = data;
LastDataDate = DateTime.Now;
NotConnectCounter = 0;
if (ConnectionState == false)
{
ConnectionState = true;
OnlineEvent?.Invoke(this, null);
}
}
public void StopMonitor()
{
_timer.Stop();
}
}
}

View File

@@ -0,0 +1,170 @@
//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Diagnostics;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using UCS.ConfigFile;
//namespace UCS.RemoteIDList
//{
// public class MonitorObject
// {
// [DisplayName("User Info")]
// public string UserInfo { get; private set; }
// [DisplayName("Remote ID")]
// public string RemoteId { get; private set; }
// [DisplayName("Tx Com")]
// public CommType TxCom { get; private set; }
// [DisplayName("Tx String opstarten")]
// public string TxStringStartup { get; private set; }
// [DisplayName("Tx String")]
// public string TxString { get; private set; }
// [DisplayName("Timer Interval(minuten) 0=disabled")]
// public int TimerInterval { get; private set; }
// [DisplayName("Number of N/Cs before error")]
// public int NotConnectValue { get; private set; }
// [DisplayName("Time Left (seconds)")]
// public double TimeLeft { get => Math.Round(_timer.TimeLeftSeconds); }
// [DisplayName("Geen verbinding teller")]
// public int NotConnectCounter { get; private set; }
// [DisplayName("Laatste data")]
// public string LastData { get; private set; }
// [DisplayName("Laatste data tijd")]
// public DateTime LastDataDate { get; private set; }
// [DisplayName("Connectie status")]
// public bool ConnectionState { get; private set; } = false;
// public event EventHandler<SendUDPEventArgs> SendUDPEvent;
// private readonly TimerPlus _timer = new TimerPlus();
// public MonitorObject(RemoteIdListLine remoteIdListLine)
// {
// UserInfo = remoteIdListLine.UserInfo;
// RemoteId = remoteIdListLine.RemoteId;
// TxCom = remoteIdListLine.TxCom;
// TxStringStartup = remoteIdListLine.TxStringStartup;
// TxString = remoteIdListLine.TxString;
// TimerInterval = remoteIdListLine.TimerInterval;
// NotConnectValue = remoteIdListLine.NotConnectValue;
// _timer.Elapsed += Timer_Elapsed;
// _timer.Interval = TimerInterval * (1000 * 60);
// _timer.Start();
// }
// public void SendStartupMessage()
// {
// switch (TxCom)
// {
// case CommType.Unknown:
// break;
// case CommType.I:
// break;
// case CommType.T:
// break;
// case CommType.M:
// break;
// case CommType.P:
// break;
// case CommType.L:
// break;
// case CommType.U:
// SendUDPEvent?.Invoke(this, new SendUDPEventArgs() { RemoteId = RemoteId, TxString = TxStringStartup });
// break;
// case CommType.X:
// break;
// case CommType.V:
// break;
// case CommType.VA:
// break;
// case CommType.VB:
// break;
// case CommType.VV:
// break;
// case CommType.VOIP:
// break;
// case CommType.BAC:
// break;
// case CommType.STEN:
// break;
// case CommType.IOT:
// break;
// case CommType.URL:
// break;
// case CommType.EMPTY:
// break;
// default:
// break;
// }
// }
// private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
// {
// Debug.WriteLine($"{UserInfo} Timer is over");
// switch (TxCom)
// {
// case CommType.Unknown:
// break;
// case CommType.I:
// break;
// case CommType.T:
// //TelnetRemoteId(Row);
// break;
// case CommType.M:
// break;
// case CommType.P:
// break;
// case CommType.L:
// break;
// case CommType.U:
// SendUDP();
// break;
// case CommType.X:
// break;
// case CommType.V:
// break;
// case CommType.VA:
// break;
// case CommType.VB:
// break;
// case CommType.VV:
// break;
// case CommType.VOIP:
// break;
// case CommType.BAC:
// break;
// case CommType.STEN:
// break;
// case CommType.IOT:
// SendIOT();
// break;
// case CommType.URL:
// break;
// case CommType.EMPTY:
// break;
// default:
// break;
// }
// }
// private void SendUDP()
// {
// SendUDPEvent?.Invoke(this, new SendUDPEventArgs() { RemoteId = RemoteId, TxString = TxString });
// }
// private void SendIOT()
// {
// }
// }
//}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name ="RemoteIDList" xsi:type="File"
fileName="${specialfolder:folder=MyDocuments:cached=true}\UCS\LogFiles\Datalogging\RemoteIDList.txt"
archiveFileName="${specialfolder:folder=MyDocuments:cached=true}\UCS\LogFiles\Datalogging\RemoteIDList-{#}.txt"
archiveNumbering="Date"
archiveEvery="Day"
archiveDateFormat="yyyyMMdd"
layout="${longdate}|${level:uppercase=true}| - ${message}"
/>
</targets>
<rules>
<logger name="RemoteIDList" writeTo="RemoteIDList" />
</rules>
</nlog>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UCS.RemoteIDList")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UCS.RemoteIDList")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9a388863-bdd7-4236-b55c-c129261ef66f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UCS.RemoteIDList
{
public static class RandomDelay
{
private static readonly Random rnd = new Random();
public static int GetRandomStartDelay()
{
return rnd.Next(0, 2000);
}
}
}

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UCS.ConfigFile;
namespace UCS.RemoteIDList
{
public static class RemoteIDList
{
private static readonly NLog.Logger Errorlog = NLog.LogManager.GetLogger("RemoteIDList");
private static readonly List<IMonitorObject> MonitorList = new List<IMonitorObject>();
public static event EventHandler<object> SendDataEvent;
public static event EventHandler OnlineEvent;
public static event EventHandler OfflineEvent;
public static void InitRemoteIdList(ref List<RemoteIdListLine> Remote_IDList)
{
Errorlog.Info("RemoteIDList wordt gestart.");
foreach (var item in Remote_IDList)
{
//Debug.WriteLine($"{item.UserInfo} - {item.RemoteId} - {item.TxCom}");
switch (item.TxCom)
{
case CommType.I:
break;
case CommType.T:
break;
case CommType.M:
break;
case CommType.P:
break;
case CommType.L:
break;
case CommType.U:
UDPMonitor uDPMonitor = new UDPMonitor(item);
uDPMonitor.SendDataEvent += SendDataEvent;
uDPMonitor.OnlineEvent += OnlineEvent;
uDPMonitor.OfflineEvent += OfflineEvent;
MonitorList.Add(uDPMonitor);
break;
case CommType.X:
break;
case CommType.V:
break;
case CommType.VA:
break;
case CommType.VB:
break;
case CommType.VV:
break;
case CommType.VOIP:
break;
case CommType.BAC:
break;
case CommType.STEN:
break;
case CommType.IOT:
IOTMonitor iOTMonitor = new IOTMonitor(item);
iOTMonitor.SendDataEvent += SendDataEvent;
iOTMonitor.OnlineEvent += OnlineEvent;
iOTMonitor.OfflineEvent += OfflineEvent;
MonitorList.Add(iOTMonitor);
break;
case CommType.URL:
URLMonitor uRLMonitor = new URLMonitor(item);
uRLMonitor.SendDataEvent += SendDataEvent;
uRLMonitor.OnlineEvent += OnlineEvent;
uRLMonitor.OfflineEvent += OfflineEvent;
MonitorList.Add(uRLMonitor);
break;
default:
break;
}
}
foreach (var item in MonitorList)
{
item.SendStartupMessage();
}
}
public static void StopRemoteIdList()
{
foreach (var item in MonitorList)
{
item.StopMonitor();
}
}
public static void UDPDataReceived(string remoteBoxID, string rxData)
{
//Debug.WriteLine($"receive = {remoteBoxID} - {rxData}");
foreach (var item in MonitorList.Where(x => x.TxCom == CommType.U && x.RemoteId == remoteBoxID))
{
item.SetLastData(rxData);
}
}
public static void IOTDataReceived(string remoteBoxID, string rxData)
{
//Debug.WriteLine($"receive = {remoteBoxID} - {rxData}");
foreach (var item in MonitorList.Where(x => x.TxCom == CommType.IOT && x.RemoteId == remoteBoxID))
{
item.SetLastData(rxData);
}
}
public static List<IMonitorObject> GetRemoteIdList()
{
return MonitorList;
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UCS.RemoteIDList
{
public class RemoteIdListTimer : System.Timers.Timer
{
private DateTime m_dueTime;
public RemoteIdListTimer() : base() => this.Elapsed += this.ElapsedAction;
protected new void Dispose()
{
this.Elapsed -= this.ElapsedAction;
base.Dispose();
}
public double TimeLeft => (this.m_dueTime - DateTime.Now).TotalMilliseconds;
public double TimeLeftSeconds => (this.m_dueTime - DateTime.Now).TotalSeconds;
public new void Start()
{
this.m_dueTime = DateTime.Now.AddMilliseconds(this.Interval);
base.Start();
}
private void ElapsedAction(object sender, System.Timers.ElapsedEventArgs e)
{
if (this.AutoReset)
this.m_dueTime = DateTime.Now.AddMilliseconds(this.Interval);
}
}
}

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9A388863-BDD7-4236-B55C-C129261EF66F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UCS.RemoteIDList</RootNamespace>
<AssemblyName>UCS.RemoteIDList</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.11\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IMonitorObject.cs" />
<Compile Include="IOTMonitor.cs" />
<Compile Include="MonitorObject.cs" />
<Compile Include="RandomDelay.cs" />
<Compile Include="RemoteIDList.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteIdListTimer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UDPMonitor.cs" />
<Compile Include="URLMonitor.cs" />
</ItemGroup>
<ItemGroup>
<None Include="NLog.RemoteIDList.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UCS.ConfigFile\UCS.ConfigFile.csproj">
<Project>{A1CD8042-0DF0-4AFA-AB88-9D0389321288}</Project>
<Name>UCS.ConfigFile</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using UCS.ConfigFile;
namespace UCS.RemoteIDList
{
public class UDPMonitor : IMonitorObject
{
public string UserInfo { get; private set; }
public string RemoteId { get; private set; }
public CommType TxCom { get; private set; }
public string TxStringStartup { get; private set; }
public string TxString { get; private set; }
public int TimerInterval { get; private set; }
public int NotConnectValue { get; private set; }
public double TimeLeft => Math.Round(_timer.TimeLeftSeconds);
public int NotConnectCounter { get; private set; }
public string LastData { get; private set; }
public DateTime LastDataDate { get; private set; }
public bool ConnectionState { get; private set; }
//public DataGridViewButtonCell ResetButton => new DataGridViewButtonCell();
//public DataGridViewButtonColumn ResetButtonColumn => new DataGridViewButtonColumn();
private readonly RemoteIdListTimer _timer = new RemoteIdListTimer();
public event EventHandler<object> SendDataEvent;
public event EventHandler OnlineEvent;
public event EventHandler OfflineEvent;
public UDPMonitor(RemoteIdListLine remoteIdListLine)
{
UserInfo = remoteIdListLine.UserInfo;
RemoteId = remoteIdListLine.RemoteId;
TxCom = remoteIdListLine.TxCom;
TxStringStartup = remoteIdListLine.TxStringStartup;
TxString = remoteIdListLine.TxString;
TimerInterval = remoteIdListLine.TimerInterval;
NotConnectValue = remoteIdListLine.NotConnectValue;
if (TimerInterval > 0)
{
_timer.Elapsed += Timer_Elapsed;
_timer.Interval = TimerInterval * (1000 * 60);
_timer.Start();
}
//ResetButton.Valu
}
public void SendStartupMessage()
{
//opstarten programma niet vertragen
Task.Run(() =>
{
//berichten verdelen bij opstarten
Thread.Sleep(RandomDelay.GetRandomStartDelay());
SendDataEvent?.Invoke(this, TxStringStartup);
});
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
SendDataEvent?.Invoke(this, TxString);
NotConnectCounter++;
if (NotConnectCounter == NotConnectValue)
{
ConnectionState = false;
OfflineEvent?.Invoke(this, null);
}
}
public void SetLastData(string data)
{
LastData = data;
LastDataDate = DateTime.Now;
NotConnectCounter = 0;
if (ConnectionState == false)
{
ConnectionState = true;
OnlineEvent?.Invoke(this, null);
}
_timer.Start();
}
public void StopMonitor()
{
_timer.Stop();
}
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UCS.ConfigFile;
namespace UCS.RemoteIDList
{
public class URLMonitor : IMonitorObject
{
public string UserInfo { get; private set; }
public string RemoteId { get; private set; }
public CommType TxCom { get; private set; }
public string TxStringStartup { get; private set; }
public string TxString { get; private set; }
public int TimerInterval { get; private set; }
public int NotConnectValue { get; private set; }
public double TimeLeft => Math.Round(_timer.TimeLeftSeconds);
public int NotConnectCounter { get; private set; }
public string LastData { get; private set; }
public DateTime LastDataDate { get; private set; }
public bool ConnectionState { get; private set; }
//public DataGridViewButtonCell ResetButton { get; private set; }
//public DataGridViewButtonColumn ResetButtonColumn { get; private set; }
private readonly RemoteIdListTimer _timer = new RemoteIdListTimer();
public event EventHandler<object> SendDataEvent;
public event EventHandler OnlineEvent;
public event EventHandler OfflineEvent;
private Int64 _PingCount;
public URLMonitor(RemoteIdListLine remoteIdListLine)
{
UserInfo = remoteIdListLine.UserInfo;
RemoteId = remoteIdListLine.RemoteId;
TxCom = remoteIdListLine.TxCom;
TxStringStartup = remoteIdListLine.TxStringStartup;
TxString = remoteIdListLine.TxString;
TimerInterval = remoteIdListLine.TimerInterval;
NotConnectValue = remoteIdListLine.NotConnectValue;
if (TimerInterval > 0)
{
_timer.Elapsed += Timer_Elapsed;
_timer.Interval = TimerInterval * (1000 * 60);
_timer.Start();
}
}
public void SendStartupMessage()
{
SendDataEvent?.Invoke(this, _PingCount);
_PingCount++;
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
SendDataEvent?.Invoke(this, _PingCount);
_PingCount++;
NotConnectCounter++;
if (NotConnectCounter == NotConnectValue)
{
ConnectionState = false;
OfflineEvent?.Invoke(this, null);
}
}
public void SetLastData(string data)
{
LastData = data;
LastDataDate = DateTime.Now;
NotConnectCounter = 0;
if (ConnectionState == false)
{
ConnectionState = true;
OnlineEvent?.Invoke(this, null);
}
}
public void StopMonitor()
{
_timer.Stop();
}
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.11" targetFramework="net48" />
</packages>

View File

@@ -46,11 +46,11 @@ namespace UCS.Telemetry
}
public static void UpdateConnectionStates(String name, String id, Boolean state, DateTime lastChange)
public static void UpdateConnectionState(String name, String id, Boolean state, DateTime lastChange)
{
UpdateConnectionStates(new ConnectionState(name, id, state, lastChange));
UpdateConnectionState(new ConnectionState(name, id, state, lastChange));
}
private static void UpdateConnectionStates(ConnectionState state)
private static void UpdateConnectionState(ConnectionState state)
{
try
{
@@ -58,7 +58,7 @@ namespace UCS.Telemetry
}
catch (Exception e)
{
Errorlog.Info($"UpdateConnectionStates Error {e}");
Errorlog.Info($"UpdateConnectionState Error {e}");
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@@ -1,91 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Timers;
namespace UCS.URLPost
{
public class URLMonitor
{
private static readonly NLog.Logger Errorlog = NLog.LogManager.GetLogger("URLPost");
//namespace UCS.URLPost
//{
// //public class URLMonitor
// //{
// //private static readonly NLog.Logger Errorlog = NLog.LogManager.GetLogger("URLPost");
private ConfigFile.RemoteIdListLine _RemoteIdListLine { get; set; }
private ConfigFile.ConfigFile _UCSConfigfile { get; set; }
// //private ConfigFile.RemoteIdListLine _RemoteIdListLine { get; set; }
// //private ConfigFile.ConfigFile _UCSConfigfile { get; set; }
public delegate void ServerOnlineHandler(ConfigFile.GraphicsIdListLine line, string LogText);
public event ServerOnlineHandler URLPostMonitorEvent;
// //public delegate void ServerOnlineHandler(ConfigFile.GraphicsIdListLine line, string LogText);
// //public event ServerOnlineHandler URLPostMonitorEvent;
private readonly Timer PushTimer = new Timer();
private Int64 _PingCount;
private bool IsFirstTime = true;
// //private readonly Timer PushTimer = new Timer();
// //private Int64 _PingCount;
// //private bool IsFirstTime = true;
public URLMonitor(ref ConfigFile.RemoteIdListLine remoteIdListLine, ref ConfigFile.ConfigFile configfile)
{
_RemoteIdListLine = remoteIdListLine;
_UCSConfigfile = configfile;
// //public URLMonitor(ref ConfigFile.RemoteIdListLine remoteIdListLine, ref ConfigFile.ConfigFile configfile)
// //{
// // _RemoteIdListLine = remoteIdListLine;
// // _UCSConfigfile = configfile;
if (_RemoteIdListLine.TimerInterval > 0)
{
if (PushTimer.Enabled == true)
{
PushTimer.Stop();
PushTimer.Elapsed -= OnPushTimerEvent;
}
PushTimer.Elapsed += OnPushTimerEvent;
PushTimer.Interval = (_RemoteIdListLine.TimerInterval * 60000); //60 sec
//PushTimer.Interval = (_RemoteIdListLine.TimerInterval * 10000); //10 sec
PushTimer.Start();
}
}
// // if (_RemoteIdListLine.TimerInterval > 0)
// // {
// // if (PushTimer.Enabled == true)
// // {
// // PushTimer.Stop();
// // PushTimer.Elapsed -= OnPushTimerEvent;
// // }
// // PushTimer.Elapsed += OnPushTimerEvent;
// // PushTimer.Interval = (_RemoteIdListLine.TimerInterval * 60000); //60 sec
// // //PushTimer.Interval = (_RemoteIdListLine.TimerInterval * 10000); //10 sec
// // PushTimer.Start();
// // }
// //}
private void OnPushTimerEvent(Object source, System.Timers.ElapsedEventArgs e)
{
//Console.WriteLine($"Timer for {_RemoteIdListLine.RemoteId}");
URLPost.SendPing(_RemoteIdListLine.RemoteId, _PingCount);
_PingCount++;
}
// //private void OnPushTimerEvent(Object source, System.Timers.ElapsedEventArgs e)
// //{
// // //Console.WriteLine($"Timer for {_RemoteIdListLine.RemoteId}");
// // URLPost.SendPing(_RemoteIdListLine.RemoteId, _PingCount);
// // _PingCount++;
// //}
public void URLOnlineHandler(object sender, string url)
{
if (url == _RemoteIdListLine.RemoteId)
{
//Console.WriteLine($"URL online = {url}");
_RemoteIdListLine.NotConnectCounter = 0;
_RemoteIdListLine.LastDataDate = DateTime.Now;
// //public void URLOnlineHandler(object sender, string url)
// //{
// //if (url == _RemoteIdListLine.RemoteId)
// //{
// // //Console.WriteLine($"URL online = {url}");
// // _RemoteIdListLine.NotConnectCounter = 0;
// // _RemoteIdListLine.LastDataDate = DateTime.Now;
if (_RemoteIdListLine.ConnectionState == false || IsFirstTime == true)
{
foreach (var item in _UCSConfigfile.Graphics_IDList.Where(x => x.RxRemoteId == _RemoteIdListLine.RemoteId && x.RxComm == ConfigFile.CommType.URL && x.RxString.ToUpper().Contains("ONLINE")))
{
URLPostMonitorEvent?.Invoke(item, "URLPost server verbinding herselt");
}
}
_RemoteIdListLine.ConnectionState = true;
IsFirstTime = false;
}
}
// // if (_RemoteIdListLine.ConnectionState == false || IsFirstTime == true)
// // {
// // foreach (var item in _UCSConfigfile.Graphics_IDList.Where(x => x.RxRemoteId == _RemoteIdListLine.RemoteId && x.RxComm == ConfigFile.CommType.URL && x.RxString.ToUpper().Contains("ONLINE")))
// // {
// // URLPostMonitorEvent?.Invoke(item, "URLPost server verbinding herselt");
// // }
// // }
// // _RemoteIdListLine.ConnectionState = true;
// // IsFirstTime = false;
// //}
// //}
public void URLOfflineHandler(object sender, string url)
{
if (url == _RemoteIdListLine.RemoteId)
{
//Console.WriteLine($"URL offline = {url}");
_RemoteIdListLine.NotConnectCounter += 1;
if (_RemoteIdListLine.NotConnectCounter == _RemoteIdListLine.NotConnectValue || IsFirstTime == true)
{
if (_RemoteIdListLine.ConnectionState == true || IsFirstTime == true)
{
_RemoteIdListLine.ConnectionState = false;
foreach (var item in _UCSConfigfile.Graphics_IDList.Where(x => x.RxRemoteId == _RemoteIdListLine.RemoteId && x.RxComm == ConfigFile.CommType.URL && x.RxString.ToUpper().Contains("OFFLINE")))
{
URLPostMonitorEvent?.Invoke(item, "Geen URLPost server verbinding");
}
}
}
IsFirstTime = false;
}
}
}
}
// //public void URLOfflineHandler(object sender, string url)
// //{
// //if (url == _RemoteIdListLine.RemoteId)
// //{
// // //Console.WriteLine($"URL offline = {url}");
// // _RemoteIdListLine.NotConnectCounter += 1;
// // if (_RemoteIdListLine.NotConnectCounter == _RemoteIdListLine.NotConnectValue || IsFirstTime == true)
// // {
// // if (_RemoteIdListLine.ConnectionState == true || IsFirstTime == true)
// // {
// // _RemoteIdListLine.ConnectionState = false;
// // foreach (var item in _UCSConfigfile.Graphics_IDList.Where(x => x.RxRemoteId == _RemoteIdListLine.RemoteId && x.RxComm == ConfigFile.CommType.URL && x.RxString.ToUpper().Contains("OFFLINE")))
// // {
// // URLPostMonitorEvent?.Invoke(item, "Geen URLPost server verbinding");
// // }
// // }
// // }
// // IsFirstTime = false;
// //}
// //}
// //}
//}

10
UCS.sln
View File

@@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UCS.ConfigFile.UnitTest", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UCS.URLPost", "UCS.URLPost\UCS.URLPost.csproj", "{EB3E5F3F-A33B-444E-A152-AE65AF218A1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UCS.RemoteIDList", "UCS.RemoteIDList\UCS.RemoteIDList.csproj", "{9A388863-BDD7-4236-B55C-C129261EF66F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -149,6 +151,14 @@ Global
{EB3E5F3F-A33B-444E-A152-AE65AF218A1A}.Release|Any CPU.Build.0 = Release|Any CPU
{EB3E5F3F-A33B-444E-A152-AE65AF218A1A}.Release|x64.ActiveCfg = Release|x64
{EB3E5F3F-A33B-444E-A152-AE65AF218A1A}.Release|x64.Build.0 = Release|x64
{9A388863-BDD7-4236-B55C-C129261EF66F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Debug|x64.ActiveCfg = Debug|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Debug|x64.Build.0 = Debug|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Release|Any CPU.Build.0 = Release|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Release|x64.ActiveCfg = Release|Any CPU
{9A388863-BDD7-4236-B55C-C129261EF66F}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,142 +0,0 @@
Imports System.Text
Imports System.Linq
Imports UCS.ConfigFile
Imports System.Collections.Generic
Module RemoteIdList
'centrale remote ID list afvraging
Friend Event TimerTickEventFired()
Friend WithEvents RemoteIdListTimer As New Timer
Private MonitorList As List(Of URLPost.URLMonitor) = New List(Of URLPost.URLMonitor)
Friend Sub RemoteIdListInit()
'Kijk of er data in de remoteid list staat en start de timer
For Each Row In UCSConfigFile.Remote_IDList
'Als er bruikbare data in de remoteidlist zit start de timer
If Row.TimerInterval > 0 Then
Select Case Row.TxCom
Case CommType.T
If RegistrationLicense.Telnet = True Then
StartRemoteIdListTimer()
End If
Case CommType.U
If RegistrationLicense.UDP = True Then
StartRemoteIdListTimer()
End If
Case CommType.IOT
'TODO: check licence
StartRemoteIdListTimer()
Case CommType.URL
Dim newmonitor As New URLPost.URLMonitor(Row, UCSConfigFile)
AddHandler URLPost.URLPost.URLOnlineEvent, AddressOf newmonitor.URLOnlineHandler
AddHandler URLPost.URLPost.URLOfflineEvent, AddressOf newmonitor.URLOfflineHandler
AddHandler newmonitor.URLPostMonitorEvent, AddressOf FrmMain.ReceiveObjectEventFired
MonitorList.Add(newmonitor)
End Select
End If
Telemetry.Telemetry.UpdateConnectionStates(Row.UserInfo, Row.RemoteId, Row.ConnectionState, Row.LastDataDate)
Next
End Sub
Private Sub StartRemoteIdListTimer()
If RemoteIdListTimer.Enabled = False Then
RemoteIdListTimer.Interval = 60000 '1 minute
RemoteIdListTimer.Enabled = True
End If
End Sub
Private Sub RemoteIdListTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoteIdListTimer.Tick 'Timer van 60sec voor de remoteidlist afvraging
RemoteIdListTimer.Interval = 60000 '1 minute
RaiseEvent TimerTickEventFired()
For Each Row In UCSConfigFile.Remote_IDList
If Row.TimerInterval > 0 Then
Select Case Row.TxCom
Case CommType.U 'UDP data
If RegistrationLicense.UDP = True Then
UDPRemoteId(Row)
End If
Case CommType.T 'Telenet data
If RegistrationLicense.Telnet = True Then
TelnetRemoteId(Row)
End If
Case CommType.IOT
IOTRemoteId(Row)
End Select
End If
Next
End Sub
Private Sub TelnetRemoteId(ByVal RemoteIdData As RemoteIdListLine)
RemoteIdData.MinuteTimer += 1
If RemoteIdData.MinuteTimer = RemoteIdData.TimerInterval Then
'Afvraging afhandelen
TCPCommunication.ConnectTelnet(RemoteIdData.RemoteId, RemoteIdData.TxString)
RemoteIdData.MinuteTimer = 0 'Reset de timer
If RemoteIdData.NotConnectCounter = RemoteIdData.NotConnectValue Then 'Als het niet vaak genoeg heeft gereageerd
RemoteIdData.ConnectionState = False
Dim RemoteActionButtons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = RemoteIdData.RemoteId AndAlso GraphicIdRow.RxComm = CommType.T AndAlso GraphicIdRow.RxSupplement.Equals("modtelneterr", StringComparison.OrdinalIgnoreCase)
Select GraphicIdRow).ToList
For Each Button In RemoteActionButtons
FrmMain.ReceiveObject(Button, "Kan geen verbinding maken met MGS unit")
Next
End If
RemoteIdData.NotConnectCounter += 1
End If
End Sub
'TODO: MGS sensor boxen afvragen gaat volledig fout (Constante afvraging)
Private Sub UDPRemoteId(ByVal RemoteIdData As RemoteIdListLine)
RemoteIdData.MinuteTimer += 1 'Verhoog de teller
If RemoteIdData.TimerInterval = RemoteIdData.MinuteTimer Then
UDPCommunication.SendUdpRemoteIdList(RemoteIdData, False)
RemoteIdData.MinuteTimer = 0 'Reset de teller
If RemoteIdData.NotConnectCounter = RemoteIdData.NotConnectValue Then 'Als een box niet vaak genoeg heeft gereageerd
RemoteIdData.ConnectionState = False 'Zet de status op false/ niet verbonden
Dim RemoteActionButtons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = RemoteIdData.RemoteId AndAlso GraphicIdRow.RxComm = CommType.U AndAlso GraphicIdRow.RxString.Contains("%??$")
Select GraphicIdRow).ToList
For Each Button In RemoteActionButtons
FrmMain.ReceiveObject(Button, "Geen verbinding")
Next
End If
RemoteIdData.NotConnectCounter += 1
End If
End Sub
Private Sub IOTRemoteId(ByVal RemoteIdData As RemoteIdListLine)
RemoteIdData.MinuteTimer += 1 'Verhoog de teller
If RemoteIdData.TimerInterval = RemoteIdData.MinuteTimer Then
RemoteIdData.MinuteTimer = 0 'Reset de teller
If RemoteIdData.NotConnectCounter = RemoteIdData.NotConnectValue Then 'Als een box niet vaak genoeg heeft gereageerd
RemoteIdData.ConnectionState = False 'Zet de status op false/ niet verbonden
Dim RemoteActionButtons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = RemoteIdData.RemoteId AndAlso GraphicIdRow.RxComm = CommType.IOT AndAlso GraphicIdRow.RxString.ToLower.Contains("modioterr")
Select GraphicIdRow).ToList
For Each Button In RemoteActionButtons
FrmMain.ReceiveObject(Button, "Geen IOT verbinding")
Next
End If
RemoteIdData.NotConnectCounter += 1
End If
End Sub
End Module

142
UCS/RemoteIdListOLD.vb Normal file
View File

@@ -0,0 +1,142 @@
'Imports System.Text
'Imports System.Linq
'Imports UCS.ConfigFile
'Imports System.Collections.Generic
'Module RemoteIdListOLD
' 'centrale remote ID list afvraging
' Friend Event TimerTickEventFired()
' Friend WithEvents RemoteIdListTimer As New Timer
' Private MonitorList As List(Of URLPost.URLMonitor) = New List(Of URLPost.URLMonitor)
' Friend Sub RemoteIdListInit()
' 'Kijk of er data in de remoteid list staat en start de timer
' For Each Row In UCSConfigFile.Remote_IDList
' 'Als er bruikbare data in de remoteidlist zit start de timer
' If Row.TimerInterval > 0 Then
' Select Case Row.TxCom
' Case CommType.T
' If RegistrationLicense.Telnet = True Then
' StartRemoteIdListTimer()
' End If
' Case CommType.U
' If RegistrationLicense.UDP = True Then
' StartRemoteIdListTimer()
' End If
' Case CommType.IOT
' 'TODO: check licence
' StartRemoteIdListTimer()
' Case CommType.URL
' Dim newmonitor As New URLPost.URLMonitor(Row, UCSConfigFile)
' AddHandler URLPost.URLPost.URLOnlineEvent, AddressOf newmonitor.URLOnlineHandler
' AddHandler URLPost.URLPost.URLOfflineEvent, AddressOf newmonitor.URLOfflineHandler
' AddHandler newmonitor.URLPostMonitorEvent, AddressOf FrmMain.ReceiveObjectEventFired
' MonitorList.Add(newmonitor)
' End Select
' End If
' Telemetry.Telemetry.UpdateConnectionStates(Row.UserInfo, Row.RemoteId, Row.ConnectionState, Row.LastDataDate)
' Next
' End Sub
' Private Sub StartRemoteIdListTimer()
' If RemoteIdListTimer.Enabled = False Then
' RemoteIdListTimer.Interval = 60000 '1 minute
' RemoteIdListTimer.Enabled = True
' End If
' End Sub
' Private Sub RemoteIdListTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoteIdListTimer.Tick 'Timer van 60sec voor de remoteidlist afvraging
' RemoteIdListTimer.Interval = 60000 '1 minute
' RaiseEvent TimerTickEventFired()
' For Each Row In UCSConfigFile.Remote_IDList
' If Row.TimerInterval > 0 Then
' Select Case Row.TxCom
' Case CommType.U 'UDP data
' If RegistrationLicense.UDP = True Then
' UDPRemoteId(Row)
' End If
' Case CommType.T 'Telenet data
' If RegistrationLicense.Telnet = True Then
' TelnetRemoteId(Row)
' End If
' Case CommType.IOT
' IOTRemoteId(Row)
' End Select
' End If
' Next
' End Sub
' Private Sub TelnetRemoteId(ByVal RemoteIdData As RemoteIdListLine)
' RemoteIdData.MinuteTimer += 1
' If RemoteIdData.MinuteTimer = RemoteIdData.TimerInterval Then
' 'Afvraging afhandelen
' TCPCommunication.ConnectTelnet(RemoteIdData.RemoteId, RemoteIdData.TxString)
' RemoteIdData.MinuteTimer = 0 'Reset de timer
' If RemoteIdData.NotConnectCounter = RemoteIdData.NotConnectValue Then 'Als het niet vaak genoeg heeft gereageerd
' RemoteIdData.ConnectionState = False
' Dim RemoteActionButtons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
' Where GraphicIdRow.RxRemoteId = RemoteIdData.RemoteId AndAlso GraphicIdRow.RxComm = CommType.T AndAlso GraphicIdRow.RxSupplement.Equals("modtelneterr", StringComparison.OrdinalIgnoreCase)
' Select GraphicIdRow).ToList
' For Each Button In RemoteActionButtons
' FrmMain.ReceiveObject(Button, "Kan geen verbinding maken met MGS unit")
' Next
' End If
' RemoteIdData.NotConnectCounter += 1
' End If
' End Sub
' 'TODO: MGS sensor boxen afvragen gaat volledig fout (Constante afvraging)
' Private Sub UDPRemoteId(ByVal RemoteIdData As RemoteIdListLine)
' RemoteIdData.MinuteTimer += 1 'Verhoog de teller
' If RemoteIdData.TimerInterval = RemoteIdData.MinuteTimer Then
' UDPCommunication.SendUdpRemoteIdList(RemoteIdData, False)
' RemoteIdData.MinuteTimer = 0 'Reset de teller
' If RemoteIdData.NotConnectCounter = RemoteIdData.NotConnectValue Then 'Als een box niet vaak genoeg heeft gereageerd
' RemoteIdData.ConnectionState = False 'Zet de status op false/ niet verbonden
' Dim RemoteActionButtons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
' Where GraphicIdRow.RxRemoteId = RemoteIdData.RemoteId AndAlso GraphicIdRow.RxComm = CommType.U AndAlso GraphicIdRow.RxString.Contains("%??$")
' Select GraphicIdRow).ToList
' For Each Button In RemoteActionButtons
' FrmMain.ReceiveObject(Button, "Geen verbinding")
' Next
' End If
' RemoteIdData.NotConnectCounter += 1
' End If
' End Sub
' Private Sub IOTRemoteId(ByVal RemoteIdData As RemoteIdListLine)
' RemoteIdData.MinuteTimer += 1 'Verhoog de teller
' If RemoteIdData.TimerInterval = RemoteIdData.MinuteTimer Then
' RemoteIdData.MinuteTimer = 0 'Reset de teller
' If RemoteIdData.NotConnectCounter = RemoteIdData.NotConnectValue Then 'Als een box niet vaak genoeg heeft gereageerd
' RemoteIdData.ConnectionState = False 'Zet de status op false/ niet verbonden
' Dim RemoteActionButtons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
' Where GraphicIdRow.RxRemoteId = RemoteIdData.RemoteId AndAlso GraphicIdRow.RxComm = CommType.IOT AndAlso GraphicIdRow.RxString.ToLower.Contains("modioterr")
' Select GraphicIdRow).ToList
' For Each Button In RemoteActionButtons
' FrmMain.ReceiveObject(Button, "Geen IOT verbinding")
' Next
' End If
' RemoteIdData.NotConnectCounter += 1
' End If
' End Sub
'End Module

View File

@@ -1,9 +1,9 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class RemoteIdListView
Inherits UcsServiceWindow
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@@ -20,14 +20,10 @@ Partial Class RemoteIdListView
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(RemoteIdListView))
Me.RemoteIDListDataGrid = New System.Windows.Forms.DataGridView()
Me.ProgressBarRemoteIDTimer = New System.Windows.Forms.ProgressBar()
Me.Label1 = New System.Windows.Forms.Label()
Me.TimerSeconden = New System.Windows.Forms.Label()
Me.RemoteIdListTimerReset = New System.Windows.Forms.Button()
CType(Me.RemoteIDListDataGrid, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
@@ -40,71 +36,24 @@ Partial Class RemoteIdListView
Me.RemoteIDListDataGrid.Location = New System.Drawing.Point(12, 12)
Me.RemoteIDListDataGrid.Name = "RemoteIDListDataGrid"
Me.RemoteIDListDataGrid.ReadOnly = True
Me.RemoteIDListDataGrid.Size = New System.Drawing.Size(610, 263)
Me.RemoteIDListDataGrid.Size = New System.Drawing.Size(610, 288)
Me.RemoteIDListDataGrid.TabIndex = 0
'
'ProgressBarRemoteIDTimer
'
Me.ProgressBarRemoteIDTimer.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.ProgressBarRemoteIDTimer.Location = New System.Drawing.Point(131, 281)
Me.ProgressBarRemoteIDTimer.Maximum = 60
Me.ProgressBarRemoteIDTimer.Name = "ProgressBarRemoteIDTimer"
Me.ProgressBarRemoteIDTimer.Size = New System.Drawing.Size(215, 23)
Me.ProgressBarRemoteIDTimer.TabIndex = 1
'
'Label1
'
Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 286)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(113, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Remote Id List Timer : "
'
'TimerSeconden
'
Me.TimerSeconden.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.TimerSeconden.AutoSize = True
Me.TimerSeconden.Location = New System.Drawing.Point(353, 286)
Me.TimerSeconden.Name = "TimerSeconden"
Me.TimerSeconden.Size = New System.Drawing.Size(76, 13)
Me.TimerSeconden.TabIndex = 3
Me.TimerSeconden.Text = "Even wachten"
'
'RemoteIdListTimerReset
'
Me.RemoteIdListTimerReset.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.RemoteIdListTimerReset.Location = New System.Drawing.Point(436, 281)
Me.RemoteIdListTimerReset.Name = "RemoteIdListTimerReset"
Me.RemoteIdListTimerReset.Size = New System.Drawing.Size(130, 23)
Me.RemoteIdListTimerReset.TabIndex = 4
Me.RemoteIdListTimerReset.Text = "RemoteIdList timer = 0"
Me.RemoteIdListTimerReset.UseVisualStyleBackColor = True
'
'RemoteIdListView
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(634, 312)
Me.Controls.Add(Me.RemoteIdListTimerReset)
Me.Controls.Add(Me.TimerSeconden)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.ProgressBarRemoteIDTimer)
Me.Controls.Add(Me.RemoteIDListDataGrid)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MinimumSize = New System.Drawing.Size(650, 350)
Me.Name = "RemoteIdListView"
Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show
Me.Text = "Remote ID List viewer"
Me.TopMost = True
CType(Me.RemoteIDListDataGrid, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents RemoteIDListDataGrid As System.Windows.Forms.DataGridView
Friend WithEvents ProgressBarRemoteIDTimer As System.Windows.Forms.ProgressBar
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TimerSeconden As System.Windows.Forms.Label
Friend WithEvents RemoteIdListTimerReset As System.Windows.Forms.Button
End Class

View File

@@ -4,8 +4,6 @@ Public Class RemoteIdListView
Public Overrides Property SettingsName As String = "RemoteIdListView"
Private WithEvents ScreenRefreshTimer As New Timer
Private CountDownValue As Integer = 61
Private Sub RemoteIdListView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@@ -20,63 +18,19 @@ Public Class RemoteIdListView
ScreenRefreshTimer.Interval = 1000 '1 seconden
ScreenRefreshTimer.Enabled = True
RemoteIDListDataGrid.DataSource = UCSConfigFile.Remote_IDList
RemoteIDListDataGrid.Columns(0).HeaderText = "Regel nummer"
RemoteIDListDataGrid.Columns(1).HeaderText = "User Info"
RemoteIDListDataGrid.Columns(2).HeaderText = "Remote ID"
RemoteIDListDataGrid.Columns(3).HeaderText = "Tx Com."
RemoteIDListDataGrid.Columns(4).HeaderText = "Tx String opstarten"
RemoteIDListDataGrid.Columns(5).HeaderText = "Tx String"
RemoteIDListDataGrid.Columns(6).HeaderText = "Timer Interval(minuten) 0=disabled"
RemoteIDListDataGrid.Columns(7).HeaderText = "Number of N/Cs before error"
RemoteIDListDataGrid.Columns(8).HeaderText = "Aantal verstreken minuten"
RemoteIDListDataGrid.Columns(9).HeaderText = "Geen verbinding teller"
RemoteIDListDataGrid.Columns(10).HeaderText = "Laatste data"
RemoteIDListDataGrid.Columns(11).HeaderText = "Laatste data tijd"
RemoteIDListDataGrid.Columns(12).HeaderText = "Connectie status"
RemoteIDListDataGrid.DataSource = RemoteIDList.RemoteIDList.GetRemoteIdList()
RemoteIDListDataGrid.AutoResizeColumns()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
AddHandler RemoteIdList.TimerTickEventFired, AddressOf Me.RemoteIdListTimerTick
End Sub
Private Sub RemoteIdListView_FormClosing(sender As Object, e As EventArgs) Handles MyBase.FormClosing
RemoveHandler RemoteIdList.TimerTickEventFired, AddressOf Me.RemoteIdListTimerTick
FrmMain.RemoteIDListToolStripMenuItem.Checked = False
End Sub
Public Sub RemoteIdListTimerTick()
CountDownValue = 60
End Sub
Private Sub ScreenRefreshTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ScreenRefreshTimer.Tick '1000 miliseconden
RemoteIDListDataGrid.Refresh()
If CountDownValue = 0 Then
ProgressBarRemoteIDTimer.Value = 0
CountDownValue = 60
TimerSeconden.Text = CountDownValue.ToString
ElseIf CountDownValue = 61 Then
ProgressBarRemoteIDTimer.Value = 0
TimerSeconden.Text = "Even wachten"
Else
ProgressBarRemoteIDTimer.Value = CountDownValue
TimerSeconden.Text = CountDownValue.ToString
CountDownValue -= 1
End If
End Sub
Private Sub RemoteIdListTimerReset_Click(sender As Object, e As EventArgs) Handles RemoteIdListTimerReset.Click
'Laat de remote id list timer aflopen
RemoteIdList.RemoteIdListTimer.Interval = 1
RemoteIdList.RemoteIdListTimer.Enabled = True
ProgressBarRemoteIDTimer.Value = 0
RemoteIDListDataGrid.AutoResizeColumns()
End Sub
End Class

View File

@@ -310,27 +310,27 @@ Module TCPCommunication
Private Sub ClearConnectCounter(ByVal RxData As String, ByVal MGSIpAddress As String)
For Each RemoteIdListRow In UCSConfigFile.Remote_IDList
If RemoteIdListRow.RemoteId = MGSIpAddress Then 'Als de het IpAdres voorkomt
RemoteIdListRow.NotConnectCounter = 0 'reset de teller
RemoteIdListRow.LastData = RxData
RemoteIdListRow.LastDataDate = DateTime.Now
'For Each RemoteIdListRow In UCSConfigFile.Remote_IDList
' If RemoteIdListRow.RemoteId = MGSIpAddress Then 'Als de het IpAdres voorkomt
' RemoteIdListRow.NotConnectCounter = 0 'reset de teller
' RemoteIdListRow.LastData = RxData
' RemoteIdListRow.LastDataDate = DateTime.Now
If RemoteIdListRow.ConnectionState = False Then 'Als er geen verbinding was
RemoteIdListRow.ConnectionState = True
' If RemoteIdListRow.ConnectionState = False Then 'Als er geen verbinding was
' RemoteIdListRow.ConnectionState = True
'Regel bij het herstelen van de verbinding
Dim RowsFromList = (From GraphicsListRow In UCSConfigFile.Graphics_IDList
Where GraphicsListRow.RxRemoteId = RemoteIdListRow.RemoteId AndAlso GraphicsListRow.RxComm = CommType.T AndAlso GraphicsListRow.RxSupplement.Equals("modtelnetok", StringComparison.OrdinalIgnoreCase)
Select GraphicsListRow).ToList
' 'Regel bij het herstelen van de verbinding
' Dim RowsFromList = (From GraphicsListRow In UCSConfigFile.Graphics_IDList
' Where GraphicsListRow.RxRemoteId = RemoteIdListRow.RemoteId AndAlso GraphicsListRow.RxComm = CommType.T AndAlso GraphicsListRow.RxSupplement.Equals("modtelnetok", StringComparison.OrdinalIgnoreCase)
' Select GraphicsListRow).ToList
For Each FoundRow In RowsFromList
RaiseEvent ReceiveEventFiredTCPObject(FoundRow, "Verbinding met MGS unit hersteld")
Next
' For Each FoundRow In RowsFromList
' RaiseEvent ReceiveEventFiredTCPObject(FoundRow, "Verbinding met MGS unit hersteld")
' Next
End If
End If
Next
' End If
' End If
'Next
End Sub
Private Sub AnalyseAlarmString(ByVal RxData As String, ByVal MGSIpAddress As String)

View File

@@ -298,7 +298,7 @@
<Compile Include="IOT\IOTServerConfiguration.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="RemoteIdList.vb" />
<Compile Include="RemoteIdListOLD.vb" />
<Compile Include="BACnet\BACnetConfiguration.Designer.vb">
<DependentUpon>BACnetConfiguration.vb</DependentUpon>
</Compile>
@@ -699,6 +699,10 @@
<Project>{a1cd8042-0df0-4afa-ab88-9d0389321288}</Project>
<Name>UCS.ConfigFile</Name>
</ProjectReference>
<ProjectReference Include="..\UCS.RemoteIDList\UCS.RemoteIDList.csproj">
<Project>{9a388863-bdd7-4236-b55c-c129261ef66f}</Project>
<Name>UCS.RemoteIDList</Name>
</ProjectReference>
<ProjectReference Include="..\UCS.Telemetry\UCS.Telemetry.csproj">
<Project>{f748442a-4dc8-4c16-a592-b55eecb15c28}</Project>
<Name>UCS.Telemetry</Name>

View File

@@ -8,6 +8,7 @@ Imports System.Xml
Imports System.Collections
Imports System.Diagnostics
Imports UCS.ConfigFile
Imports UCS.RemoteIDList
Public Module UDPCommunication
'Create a logger for use in this class
@@ -49,9 +50,7 @@ Public Module UDPCommunication
RaiseEvent UDPCommunicationErrorEvent("UDP ontvangst fout" & Environment.NewLine & ex.Message)
End Try
If NetworkConnectionStatus = True Then
UDPSendInitation() 'Stuur RemoteID list bij het opstarten
Else
If NetworkConnectionStatus = False Then
Errorlog.Warn("Netwerk niet aanwezig")
RaiseEvent UDPCommunicationErrorEvent("Geen active netwerk aansluiting, controleer de aansluiting.")
End If
@@ -102,38 +101,8 @@ Public Module UDPCommunication
Return False
End Function
''' <summary>
''' Zoek in de remote ID list naar startup data voor de UDP module.
''' </summary>
Private Sub UDPSendInitation()
For Each Row As RemoteIdListLine In UCSConfigFile.Remote_IDList
If Row.TxCom = CommType.U Then
If Row.TxStringStartup <> String.Empty Then
'SendUDPRemoteIdStartUp(Row)
SendUdpRemoteIdList(Row, True)
End If
End If
Next
End Sub
#Region "***************** UDP Data verzenden Broadcast *******************************"
'''<summary>Verstuur afvraag data van uit de remote id list.</summary>
Friend Sub SendUdpRemoteIdList(ByVal RemoteIdRowData As RemoteIdListLine, StartUp As Boolean)
Dim UdpTxData As New StringBuilder(15)
UdpTxData.Append(UCSConfigFile.Initiation_Data.Initatior)
UdpTxData.Append(RemoteIdRowData.RemoteId)
If StartUp = True Then
UdpTxData.Append(RemoteIdRowData.TxStringStartup)
Else
UdpTxData.Append(RemoteIdRowData.TxString)
End If
SendUDPDataString(UdpTxData.ToString)
End Sub
'''<summary>Verstuur data vanuit de graphics id list.</summary>
Friend Sub SendUDPGraphicsIdListObject(ByVal Button As GraphicsIdListLine)
If Button.TxComm = CommType.U Then
@@ -373,28 +342,7 @@ Public Module UDPCommunication
Next
End If
For Each RemoteIdRow In UCSConfigFile.Remote_IDList
If RemoteIdRow.RemoteId = RemoteBoxID Then 'Als de het ID voorkomt
RemoteIdRow.NotConnectCounter = 0 'reset de teller
RemoteIdRow.LastData = RxData
RemoteIdRow.LastDataDate = DateTime.Now
If RemoteIdRow.ConnectionState = False Then 'Als er geen verbinding met de box was
RemoteIdRow.ConnectionState = True
'Zoek de "er is weer verbinding" code
Dim RemoteActionButton = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = RemoteIdRow.RemoteId AndAlso GraphicIdRow.RxComm = CommType.U AndAlso GraphicIdRow.RxString = "%!!$"
Select GraphicIdRow).ToList
For Each Button In RemoteActionButton
RaiseEvent ReceiveEventFiredUDPObject(Button, RxData)
Next
End If
End If
Next
RemoteIDList.RemoteIDList.UDPDataReceived(RemoteBoxID, RxData)
End Sub
Private Sub ProcessRxXmlData(ByVal RxData As String)

View File

@@ -13,6 +13,7 @@ Imports System.Threading
Imports UCS.ConfigFile
Imports UCS.Stentofon
Imports UCS.URLPost
Imports UCS.RemoteIDList
Public Class FrmMain
@@ -61,7 +62,6 @@ Public Class FrmMain
SelectedConfigFileToolStripMenuItem.Text = LoadedConfigFile
AddHandler UCSConfigFile.ErrorMessageEvent, AddressOf ConfigFileErrorHandler
AddHandler UCSConfigFile.TelemetryConnectionStateUpdate, AddressOf TelemetryConnectionStateUpdateHandler
UCSConfigFile.ReadConfigFile(LoadedConfigFile)
If LoadingFailed Then
@@ -220,12 +220,22 @@ Public Class FrmMain
End If
'---------- URLPost
'AddHandler URLPost.URLPost.URLOnlineEvent, AddressOf
'AddHandler URLPost.URLPost.URLOfflineEvent, AddressOf
URLPost.URLPost.URLPostInit(UCSConfigFile)
'---------- Remote ID list
mySplashScreen.UpdateSplashScreen(100, "Remote id list starten")
RemoteIdList.RemoteIdListInit()
AddHandler RemoteIDList.RemoteIDList.SendDataEvent, AddressOf RemoteIdListSendDataEventHandler
AddHandler RemoteIDList.RemoteIDList.OnlineEvent, AddressOf RemoteIdListOnlineEventHandler
AddHandler RemoteIDList.RemoteIDList.OfflineEvent, AddressOf RemoteIdListOfflineEventHandler
RemoteIDList.RemoteIDList.InitRemoteIdList(UCSConfigFile.Remote_IDList)
For Each element In RemoteIDList.RemoteIDList.GetRemoteIdList()
Telemetry.Telemetry.UpdateConnectionState(element.UserInfo, element.RemoteId, element.ConnectionState, element.LastDataDate)
Next
'---------- Telemetry
Telemetry.Telemetry.SendTelemetry(5000)
'---------- Video Refresh timer
@@ -271,6 +281,14 @@ Public Class FrmMain
UCSlog.Info("UCS afgesloten")
Me.Text = "Remote ID List stoppen"
RemoveHandler RemoteIDList.RemoteIDList.SendDataEvent, AddressOf RemoteIdListSendDataEventHandler
RemoveHandler RemoteIDList.RemoteIDList.OnlineEvent, AddressOf RemoteIdListOnlineEventHandler
RemoveHandler RemoteIDList.RemoteIDList.OfflineEvent, AddressOf RemoteIdListOfflineEventHandler
RemoteIDList.RemoteIDList.StopRemoteIdList()
Me.Text = "UDP stoppen"
RemoveHandler UDPCommunication.ReceiveEventFiredUDPObject, AddressOf Me.ReceiveObjectEventFired
RemoveHandler UDPCommunication.UDPCommunicationErrorEvent, AddressOf Me.ErrorMessageBox
@@ -344,11 +362,6 @@ Public Class FrmMain
End If
End Sub
Private Sub TelemetryConnectionStateUpdateHandler(sender As Object, e As EventArgs)
Dim remoteID As ConfigFile.RemoteIdListLine = DirectCast(sender, ConfigFile.RemoteIdListLine)
Telemetry.Telemetry.UpdateConnectionStates(remoteID.UserInfo, remoteID.RemoteId, remoteID.ConnectionState, remoteID.LastDataDate)
End Sub
'********************************** Groepboxen **********************************************************
Private Sub GroupBoxCreate()
@@ -694,6 +707,61 @@ Public Class FrmMain
End Sub
'******************************************** Object ontvangen *****************************************
Friend Sub RemoteIdListSendDataEventHandler(sender As Object, data As Object)
'Console.WriteLine($"ReceiveIOTremoteIdObjectHandler {Message.RemoteId} - {Message.TxString}")
Dim monitorObject As IMonitorObject = DirectCast(sender, IMonitorObject)
If monitorObject.TxCom = CommType.U Then
Dim UdpTxData As New StringBuilder(15)
UdpTxData.Append(UCSConfigFile.Initiation_Data.Initatior)
UdpTxData.Append(monitorObject.RemoteId)
UdpTxData.Append(DirectCast(data, String))
If Me.InvokeRequired = True Then
Me.Invoke(Sub() UDPCommunication.SendUDPDataString(UdpTxData.ToString))
Else
UDPCommunication.SendUDPDataString(UdpTxData.ToString)
End If
ElseIf monitorObject.TxCom = CommType.IOT Then
ElseIf monitorObject.TxCom = CommType.URL Then
UCS.URLPost.URLPost.SendPing(monitorObject.RemoteId, Convert.ToInt64(data))
End If
End Sub
Friend Sub RemoteIdListOnlineEventHandler(sender As Object, e As EventArgs)
Dim monitorObject As IMonitorObject = DirectCast(sender, IMonitorObject)
'Console.WriteLine($"Online {monitorObject.UserInfo} - {monitorObject.RemoteId}")
Dim buttons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = monitorObject.RemoteId AndAlso GraphicIdRow.RxComm = monitorObject.TxCom AndAlso GraphicIdRow.RxString.ToLower.Contains("online")
Select GraphicIdRow).ToList
Dim lastdata As String = $"{monitorObject.UserInfo} - Online"
For Each button In buttons
Me.ReceiveObjectEventFired(button, lastdata)
Next
Telemetry.Telemetry.UpdateConnectionState(monitorObject.UserInfo, monitorObject.RemoteId, monitorObject.ConnectionState, monitorObject.LastDataDate)
Telemetry.Telemetry.SendTelemetry()
End Sub
Friend Sub RemoteIdListOfflineEventHandler(sender As Object, e As EventArgs)
Dim monitorObject As IMonitorObject = DirectCast(sender, IMonitorObject)
'Console.WriteLine($"Offline {monitorObject.UserInfo} - {monitorObject.RemoteId}")
Dim buttons = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = monitorObject.RemoteId AndAlso GraphicIdRow.RxComm = monitorObject.TxCom AndAlso GraphicIdRow.RxString.ToLower.Contains("offline")
Select GraphicIdRow).ToList
Dim lastdata As String = $"{monitorObject.UserInfo} - Offline"
For Each button In buttons
Me.ReceiveObjectEventFired(button, lastdata)
Next
Telemetry.Telemetry.UpdateConnectionState(monitorObject.UserInfo, monitorObject.RemoteId, monitorObject.ConnectionState, monitorObject.LastDataDate)
Telemetry.Telemetry.SendTelemetry()
End Sub
Friend Sub ReceiveIotServerObjectHandler(sender As Object, message As IOTServer.PrtgMessage)
For Each channel In message.PrtgData.Result
Dim rxBoxLines = (From Row In UCSConfigFile.Graphics_IDList
@@ -707,27 +775,7 @@ Public Class FrmMain
Me.ReceiveObjectEventFired(row, lastdata)
Next
'Zoek in Remote ID list
For Each RemoteIdRow In UCSConfigFile.Remote_IDList
If RemoteIdRow.RemoteId = message.Device Then
RemoteIdRow.NotConnectCounter = 0
RemoteIdRow.LastData = lastdata
RemoteIdRow.LastDataDate = DateTime.Now
If RemoteIdRow.ConnectionState = False Then 'Als er geen verbinding met de box was
RemoteIdRow.ConnectionState = True
'Zoek de "er is weer verbinding" code
Dim RemoteActionButton = (From GraphicIdRow In UCSConfigFile.Graphics_IDList
Where GraphicIdRow.RxRemoteId = message.Device AndAlso GraphicIdRow.RxComm = CommType.IOT AndAlso GraphicIdRow.RxString.ToLower.Contains("modiotok")
Select GraphicIdRow).ToList
For Each button In RemoteActionButton
Me.ReceiveObjectEventFired(button, lastdata)
Next
End If
End If
Next
RemoteIDList.RemoteIDList.IOTDataReceived(message.Device, lastdata)
Next
End Sub
Friend Sub ReceiveBACnetObjectHandler(sender As Object, message As BACnet.BACnetReceiveMessage)
@@ -769,6 +817,7 @@ Public Class FrmMain
' End If
' Next
'Next
End Sub
Friend Sub ReceiveStentofonObjectHandler(sender As Object, message As Stentofon.StentofonReceiveMessage)
'Debug.WriteLine($"Receive Stentofon stationA:{message.StationA} - stationB:{message.StationB} - type:{message.ReceiveMessageType}")