2024-12-05 15:57:07 +03:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gidrolock_Modbus_Scanner
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Device
|
|
|
|
|
|
{
|
|
|
|
|
|
public string name;
|
|
|
|
|
|
public string description;
|
|
|
|
|
|
public List<Entry> entries;
|
2024-12-12 15:14:13 +03:00
|
|
|
|
public CheckEntry checkEntry;
|
|
|
|
|
|
public Device(string name, string description, CheckEntry checkEntry, List<Entry> entries)
|
2024-12-05 15:57:07 +03:00
|
|
|
|
{
|
|
|
|
|
|
this.name = name;
|
|
|
|
|
|
this.description = description;
|
2024-12-12 15:14:13 +03:00
|
|
|
|
this.checkEntry = checkEntry;
|
2024-12-05 15:57:07 +03:00
|
|
|
|
this.entries = entries;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public struct Entry
|
|
|
|
|
|
{
|
|
|
|
|
|
public string name;
|
|
|
|
|
|
public RegisterType registerType;
|
2024-12-06 16:32:10 +03:00
|
|
|
|
public ushort address;
|
|
|
|
|
|
public ushort length;
|
2024-12-05 15:57:07 +03:00
|
|
|
|
public string dataType;
|
|
|
|
|
|
public bool readOnce;
|
|
|
|
|
|
|
2024-12-09 16:24:02 +03:00
|
|
|
|
public Entry(string name, RegisterType registerType, ushort address, ushort length = 1, string dataType = "uint16", bool readOnce = false)
|
2024-12-05 15:57:07 +03:00
|
|
|
|
{
|
|
|
|
|
|
this.name = name;
|
|
|
|
|
|
this.registerType = registerType;
|
|
|
|
|
|
this.address = address;
|
|
|
|
|
|
this.length = length;
|
|
|
|
|
|
this.dataType = dataType;
|
|
|
|
|
|
this.readOnce = readOnce;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-12 15:14:13 +03:00
|
|
|
|
public struct CheckEntry
|
|
|
|
|
|
{
|
|
|
|
|
|
public RegisterType registerType;
|
|
|
|
|
|
public ushort address;
|
|
|
|
|
|
public ushort length;
|
|
|
|
|
|
public string dataType;
|
|
|
|
|
|
public string expectedValue;
|
|
|
|
|
|
public CheckEntry(RegisterType registerType, ushort address, ushort length, string dataType, string expectedValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.registerType = registerType;
|
|
|
|
|
|
this.address = address;
|
|
|
|
|
|
this.length = length;
|
|
|
|
|
|
this.dataType = dataType;
|
|
|
|
|
|
this.expectedValue = expectedValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-09 17:58:37 +03:00
|
|
|
|
public enum RegisterType { Coil = 1, Discrete = 2, Holding = 3, Input = 4}
|
2024-12-05 15:57:07 +03:00
|
|
|
|
}
|