예제 #1
0
        public Task <T> Get <T>() where T : Model.Instance
        {
            if (_modbusClient == null)
            {
                throw new InvalidOperationException("Not yet connected. Call ConnectAsync first.");
            }

            _logger.LogInformation($"Reading '{typeof(T).Name}' from inverter at {_address}:{_port}");
            var result = _modbusClient.Read <T>();

            _logger.LogInformation($"Reading of '{typeof(T).Name}' successful");

            return(Task.FromResult(result));
        }