Innovenergy_trunk/csharp/Lib/Devices/EmuMeter/Program.cs

28 lines
686 B
C#
Raw Normal View History

2023-05-06 13:41:39 +00:00
using System.Text.Json;
using InnovEnergy.Lib.Protocols.Modbus.Channels;
using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Devices.EmuMeter;
public static class Program
{
public static Task Main(string[] args)
{
var ch = new TcpChannel("localhost", 5003);
var cl = new ModbusTcpClient(ch, 1);
var d = new EmuMeterDevice(cl);
while (true)
{
var x = d.Read();
//x.WriteLine();
var options = new JsonSerializerOptions { WriteIndented = true };
(x, options).Apply(JsonSerializer.Serialize).WriteLine();
}
}
}