29 lines
718 B
C#
29 lines
718 B
C#
|
using System.Text.Json;
|
||
|
using InnovEnergy.Lib.Protocols.Modbus.Channels;
|
||
|
using InnovEnergy.Lib.Protocols.Modbus.Clients;
|
||
|
using InnovEnergy.Lib.Utils;
|
||
|
|
||
|
namespace InnovEnergy.Lib.Devices.AMPT;
|
||
|
|
||
|
public static class Program
|
||
|
{
|
||
|
public static Task Main(string[] args)
|
||
|
{
|
||
|
var ch = new TcpChannel("localhost", 5005);
|
||
|
var cl = new ModbusTcpClient(ch, 1);
|
||
|
var d = new AmptDevice(cl);
|
||
|
|
||
|
while (true)
|
||
|
{
|
||
|
var x = d.Read();
|
||
|
|
||
|
var options = new JsonSerializerOptions{WriteIndented = true};
|
||
|
(x, options).Apply(JsonSerializer.Serialize).WriteLine();
|
||
|
|
||
|
//Console.WriteLine(x);
|
||
|
}
|
||
|
|
||
|
|
||
|
//Console.WriteLine(x);
|
||
|
}
|
||
|
}
|