Beispiel #1
0
        public async Task <JsonResult> Command(Guid sid, string hid, [FromBody] CommandRequest request)
        {
            var hardwareId = new HardwareId(hid);
            var response   = await sessionManager.CommandRequestAsync(
                sid, hardwareId, request.command.name, request.command.args, request.timeout);

            if (response.TimedOut)
            {
                return(TimeoutResponse(sid, hardwareId, "reading response"));
            }
            else
            {
                return(Json(new {
                    sid = sid,
                    hid = hid,
                    command = new { send = response.CommandString, receive = response.ResponseString }
                }));
            }
        }