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

35 lines
1.0 KiB
C#

using InnovEnergy.Lib.Protocols.Modbus.Channels;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Utils;
using static InnovEnergy.Lib.Devices.Battery48TL.Battery48TlDevice;
namespace InnovEnergy.Lib.Devices.Battery48TL;
public static class Program
{
public static Task Main(string[] args)
{
var host = new SshHost("10.2.3.115", "ie-entwicklung");
var channel = new RemoteSerialChannel(host, "ttyUSB0", BaudRate, Parity, DataBits, StopBits);
var nodes = new Byte[] { 2 };
var devices = nodes
.Select(n => new Battery48TlDevice(channel, n))
.ToList();
var d = new Battery48TlDevices(devices);
//var options = new JsonSerializerOptions { WriteIndented = true, Converters = { new JsonStringEnumConverter() }};
while (true)
{
var x = d.Read();
x.ToCsv().WriteLine();
//(x, options).Apply(JsonSerializer.Serialize).WriteLine();
}
}
}