diff --git a/Gidrolock Modbus Configurator.csproj b/Gidrolock Modbus Configurator.csproj
index 4e122e8..4c56a59 100644
--- a/Gidrolock Modbus Configurator.csproj
+++ b/Gidrolock Modbus Configurator.csproj
@@ -6,7 +6,7 @@
AnyCPU
{47A399D3-30C1-4EF4-9E94-F3518919A59C}
WinExe
- Gidrolock_Modbus_Configurator
+ Gidrolock_Modbus_Scanner
Gidrolock Modbus Configurator
v4.8
512
diff --git a/Modbus.cs b/Modbus.cs
index 716b8ce..ec3b7f7 100644
--- a/Modbus.cs
+++ b/Modbus.cs
@@ -14,7 +14,7 @@ namespace Gidrolock_Modbus_Scanner
public static class Modbus
{
public static SerialPort port = new SerialPort();
-
+
public static event EventHandler ResponseReceived = delegate { };
public static void Init()
@@ -276,38 +276,34 @@ namespace Gidrolock_Modbus_Scanner
static int count = 0;
static void PortDataReceived(object sender, EventArgs e)
{
+
//reset values on every event call;
buffer = new byte[255];
offset = 0;
try
{
- //reset values on every event call;
- buffer = new byte[255];
- offset = 0;
- try
+ stopwatch.Restart();
+ while (stopwatch.ElapsedMilliseconds < 20)
{
- stopwatch.Restart();
- while (stopwatch.ElapsedMilliseconds < 20)
+ if (port.BytesToRead > 0)
{
- if (port.BytesToRead > 0)
- {
- stopwatch.Restart();
- count = port.BytesToRead;
- port.Read(buffer, offset, port.BytesToRead);
- offset += count;
- }
+ stopwatch.Restart();
+ count = port.BytesToRead;
+ port.Read(buffer, offset, port.BytesToRead);
+ offset += count;
}
- // assume that the message ended
+ }
+ // assume that the message ended
- List message = new List();
- for (int i = 0; i < offset; i++)
- {
- message.Add(buffer[i]);
- }
- if (message.Count == 0)
- return;
+ List message = new List();
+ for (int i = 0; i < offset; i++)
+ {
+ message.Add(buffer[i]);
+ }
+ if (message.Count == 0)
+ return;
- Console.WriteLine("Incoming message: " + ByteArrayToString(message.ToArray(), false));
+ Console.WriteLine("Incoming message: " + ByteArrayToString(message.ToArray(), false));
/*
if (!CheckResponse(message.ToArray()))
{
@@ -342,7 +338,6 @@ namespace Gidrolock_Modbus_Scanner
}
}
-
public class ModbusResponseEventArgs : EventArgs
{
public byte[] Message { get; set; }
@@ -362,7 +357,7 @@ namespace Gidrolock_Modbus_Scanner
}
//Console.WriteLine("Read data: " + Modbus.ByteArrayToString(Data, false));
}
- else Data = new byte[1] {0x0F};
+ else Data = new byte[1] { 0x0F };
}
}
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index b9a4de3..2198345 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Gidrolock_Modbus_Configurator.Properties {
+namespace Gidrolock_Modbus_Scanner.Properties {
using System;
@@ -39,7 +39,7 @@ namespace Gidrolock_Modbus_Configurator.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gidrolock_Modbus_Configurator.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gidrolock_Modbus_Scanner.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index 6b9c2f5..df0c1cb 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Gidrolock_Modbus_Configurator.Properties {
+namespace Gidrolock_Modbus_Scanner.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]