private Task <MethodResponse> SendCommand(MethodRequest methodRequest, object userContext)
        {
            bool success          = false;
            var  payloadDefintion = new
            {
                commandName = (CommandName)(-1),
            };

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

            if (payload.commandName.Valid())
            {
                success = _device.SendCommand(payload.commandName);
            }

            return(methodRequest.GetMethodResponse(success));
        }
Esempio n. 2
0
 public IActionResult OnPostOSSCSendCommand(CommandName commandName)
 {
     _ossc.SendCommand(commandName);
     return(RedirectToPage());
 }
Esempio n. 3
0
 public IActionResult OnPostSendCommand(CommandName commandName)
 {
     _device.SendCommand(commandName);
     return(RedirectToPage());
 }
Esempio n. 4
0
 public void GivenDevice_WhenSendCommand_ThenSuccessIsTrue()
 {
     Assert.IsTrue(_device.SendCommand(CommandName.Menu));
 }