Beispiel #1
0
        public IActionResult OnPostSetOutputRate(int width, int height, float refreshRate)
        {
            var edid = Edid.GetEdid(width, height, refreshRate);

            _device.SetOutputRate(edid);
            return(RedirectToPage());
        }
Beispiel #2
0
 public void GivenInvalidDevice_WhenSetOutputRate_ThenResultsIsFalse()
 {
     using (var device = CreateInvalidDevice())
     {
         var edid = Edid.GetEdid(1280, 720, 60.0f);
         Assert.IsNotNull(edid);
         Assert.IsFalse(device.SetOutputRate(edid));
     }
 }
Beispiel #3
0
        public Edid GetOutputRate()
        {
            if (!_rs232Device.Enabled)
            {
                return(null);
            }

            var result = _rs232Device.WriteWithResponse($"{_cmdEsc}RATE{_cmdCr}", _patternNumberLine);
            var number = int.Parse(result);

            return(Edid.GetEdid(number));
        }
Beispiel #4
0
        public void GivenDevice_WhenSetOutputRate_ThenOutputRateIsTheSame()
        {
            using (var device = CreateDevice())
            {
                var edid = Edid.GetEdid(1280, 720, 60.0f);
                Assert.IsNotNull(edid);

                var result = device.SetOutputRate(edid);
                Assert.IsTrue(result);

                var outputRate = device.GetOutputRate();
                Assert.IsTrue(outputRate == edid);
            }
        }
Beispiel #5
0
        public bool SetOutputRateWithoutEdid(int width, int height, float refreshRate)
        {
            var edid = Edid.GetEdid(width, height, refreshRate);

            //Handle null Edid gracefully, just return false
            if (edid != null)
            {
                return(SetOutputRate(edid));
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        public bool SetOutputRate(Edid value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (!_rs232Device.Enabled)
            {
                return(false);
            }

            var result = _rs232Device.WriteWithResponse($"{_cmdEsc}{value.Id}RATE{_cmdCr}", @"^Rate[0-9]+$", TimeSpan.FromSeconds(5));

            return(result != null);
        }
        private Task <MethodResponse> SetOutputRate(MethodRequest methodRequest, object userContext)
        {
            bool success          = false;
            var  payloadDefintion = new
            {
                Id = 0,
            };

            var payload = JsonConvert.DeserializeAnonymousType(methodRequest.DataAsJson, payloadDefintion);

            var edid = Edid.GetEdid(payload.Id);

            if (edid != null)
            {
                success = _device.SetOutputRate(edid);
            }

            return(methodRequest.GetMethodResponse(success));
        }
 public void GivenDevice_WhenSetOutputRate_ThenResultIsTrue()
 {
     Assert.IsTrue(_device.SetOutputRate(Edid.GetEdid(1280, 720, 50.0f)));
 }