2023-06-13 10:53:52 +00:00
|
|
|
using InnovEnergy.Lib.Protocols.Modbus.Channels;
|
|
|
|
using InnovEnergy.Lib.Units;
|
2023-05-06 13:41:59 +00:00
|
|
|
using InnovEnergy.Lib.Utils;
|
2023-06-13 10:53:52 +00:00
|
|
|
using static InnovEnergy.Lib.Devices.Battery48TL.Battery48TlDevice;
|
2023-05-06 13:41:59 +00:00
|
|
|
|
|
|
|
namespace InnovEnergy.Lib.Devices.Battery48TL;
|
|
|
|
|
|
|
|
public static class Program
|
|
|
|
{
|
|
|
|
public static Task Main(string[] args)
|
|
|
|
{
|
2023-06-13 10:53:52 +00:00
|
|
|
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() }};
|
2023-05-06 13:41:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
var x = d.Read();
|
2023-06-13 10:53:52 +00:00
|
|
|
x.ToCsv().WriteLine();
|
|
|
|
|
|
|
|
//(x, options).Apply(JsonSerializer.Serialize).WriteLine();
|
2023-05-06 13:41:59 +00:00
|
|
|
}
|
|
|
|
}
|
2023-06-13 10:53:52 +00:00
|
|
|
|
2023-05-06 13:41:59 +00:00
|
|
|
}
|