Ejemplo n.º 1
0
        public SamilPowerInverter(ILogger <SamilPowerInverter> logger, InverterMetricCollection inverterMetricCollection,
                                  SamilPowerProtocol protocol, TcpClient tcpClient, InverterInfoResponse inverterInfo)
        {
            _logger = logger;
            _inverterMetricCollection = inverterMetricCollection;
            _protocol  = protocol;
            _tcpClient = tcpClient;

            Model          = inverterInfo.ModelDescription;
            Identification = inverterInfo.SerialNumber ?? "unknown";
        }
Ejemplo n.º 2
0
        public SamilPowerInverterListener(ILoggerFactory loggerFactory, SamilPowerProtocol protocol,
                                          InverterMetricCollection inverterMetricCollection)
        {
            _loggerFactory            = loggerFactory;
            _logger                   = loggerFactory.CreateLogger <SamilPowerInverterListener>();
            _protocol                 = protocol;
            _inverterMetricCollection = inverterMetricCollection;

            // Don't care about dual stack here, these inverters don't support it anyway... :(
            _tcpListener = new TcpListener(IPAddress.Any, TcpListenPort);

            _advertisementTimer          = new Timer(AdvertisementInterval);
            _advertisementTimer.Elapsed += OnAdvertisementTimerElapsed;
        }