public static Task SendRokuManualKeyEntryAsync(Roku roku, char key) { var encodedKey = HttpUtility.UrlEncode(key.ToString()); var sendKeyUrl = roku.Url + "keypress/Lit_" + encodedKey; return(HTTPTools.PostAsync(sendKeyUrl)); }
/// <summary> /// /// </summary> private static void StopRoku() { if (runningProgram == "Roku") { Roku.KeyPress("Home"); } }
public void RefreshRokus() { rokus = RokuAccessor.GetRokuList(); if (rokus.Count > 0) { SelectedRoku = rokus[0]; } }
// GET: /Action/GoRoku public ActionResult GoRoku() { Roku.KeyPress("Home"); Screen.EnsureScreenOn(); Running.StartStream("Roku"); Receiver.SelectRokuInput(); Receiver.SelectTVOutput(); return(Content("")); }
/// <summary> /// Exit all running programmes /// </summary> /// <param name="keepScreen"></param> /// <returns></returns> public static bool ExitAllPrograms( bool keepScreen = false) { logger.Info("ExitAllPrograms"); lastActive = DateTime.UtcNow; if (spotifyRunning) { Spotify.ExitPlayer(); spotifyRunning = false; } if (runningProgram == "Music" || runningProgram == "Photo") { ExitJRMC(); } if (runningProgram == "Sky") { DesktopClient.SendIR(IRCodes.Codes["Sky.PowerSTB"], "Sky.PowerSTB"); Receiver.SelectComputerInput(); } if (runningProgram == "Roku") { Roku.KeyPress("Home"); Receiver.SelectComputerInput(); } if (!keepScreen) { Receiver.TurnOff(); Screen.SetScreenDisplayMode(0); } else { Screen.EnsureScreenOn(); Receiver.SelectTVOutput(); } bool ok = DesktopClient.ExitAllPrograms(); NothingRunning(); return(ok); }
public async Task LaunchRokuApp(RestClient client, Roku roku) { var restRequest = new RestRequest("query/apps"); var appResp = await client.ExecuteGetAsync(restRequest); var apps = XElement.Parse(appResp.Content); var appsList = apps.Elements("app").ToList(); var app = appsList.FirstOrDefault(a => a.Value.Contains(roku.LaunchApplication)); if (app != null) { var appId = app.Attribute("id"); var launchRestRequest = new RestRequest($"launch/{appId.Value}"); await client.ExecutePostAsync(launchRestRequest); } }
public async Task <SkillResponse> HandleLauncherIntent(SkillRequest request) { var req = request.Request as IntentRequest; var appToLaunch = req.Intent.Slots["RokuApp"] != null ? req.Intent.Slots["RokuApp"].Value : "Netflix"; var room = req.Intent.Slots["Room"] != null ? req.Intent.Slots["Room"].Value : "Living Room"; var sqsConfig = new AmazonSQSConfig(); sqsConfig.RegionEndpoint = RegionEndpoint.USEast1; var sqsClient = new AmazonSQSClient(sqsConfig); var queue = await sqsClient.GetQueueUrlAsync("my-roku-skill-queue", default(CancellationToken)); var roomType = RoomType.LivingRoom; switch (room.ToLowerInvariant()) { case "living room": roomType = RoomType.LivingRoom; break; case "bedroom": roomType = RoomType.Bedroom; break; } var rokuCommand = new Roku(appToLaunch, roomType); var rokuCommandJson = JsonConvert.SerializeObject(rokuCommand); await sqsClient.SendMessageAsync(queue.QueueUrl, rokuCommandJson, default(CancellationToken)); return(new SkillResponse { Response = new ResponseBody { OutputSpeech = new PlainTextOutputSpeech("Your Roku has obliged your request") }, Version = "0.1" }); }
public ContentResult SendText( string text) { Roku.SendText(text); return(this.Content("")); }
public ContentResult KeyPress( string id) { Roku.KeyPress(id); return(this.Content("")); }
public ContentResult KeyDown( string id) { Roku.KeyDown(id); return(this.Content("")); }
public ContentResult RokuLaunch( string id) { Roku.RunApp(id); return(this.Content("")); }
public async Task <SkillResponse> HandleRemoteIntent(SkillRequest request) { var req = request.Request as IntentRequest; var keyVal = req.Intent.Slots["Key"]; var room = req.Intent.Slots["Room"] != null ? req.Intent.Slots["Room"].Value : "Living Room"; var button = ButtonType.Home; var roomType = RoomType.LivingRoom; switch (room.ToLowerInvariant()) { case "living room": roomType = RoomType.LivingRoom; break; case "bedroom": roomType = RoomType.Bedroom; break; } Console.WriteLine(keyVal.Value.ToLowerInvariant()); switch (keyVal.Value.ToLowerInvariant()) { case "up": button = ButtonType.Up; break; case "down": button = ButtonType.Down; break; case "left": button = ButtonType.Left; break; case "right": button = ButtonType.Right; break; case "back": button = ButtonType.Back; break; case "play": button = ButtonType.Play; break; case "rewind": button = ButtonType.Rewind; break; case "forward": button = ButtonType.FastForward; break; case "ok": button = ButtonType.Select; break; case "enter": button = ButtonType.Select; break; case "select": button = ButtonType.Select; break; case "mute": button = ButtonType.Mute; break; default: button = ButtonType.Home; break; } // Send to SQS Queue var sqsConfig = new AmazonSQSConfig(); sqsConfig.RegionEndpoint = RegionEndpoint.USEast1; var sqsClient = new AmazonSQSClient(sqsConfig); var queue = await sqsClient.GetQueueUrlAsync("my-roku-skill-queue", default(CancellationToken)); var rokuCommand = new Roku(button, roomType); var rokuCommandJson = JsonConvert.SerializeObject(rokuCommand); await sqsClient.SendMessageAsync(queue.QueueUrl, rokuCommandJson, default(CancellationToken)); return(new SkillResponse { Response = new ResponseBody { OutputSpeech = new PlainTextOutputSpeech("Your Roku has obliged your request") }, Version = "0.1" }); }
public static void LaunchRokuApp(Roku roku, RokuApp app) { var launchUrl = roku.Url + "launch/" + app.Id; _ = HTTPTools.PostAsync(launchUrl); }
public static void SendRokuButton(Roku roku, KeyCode keyCode) { var sendKeyUrl = roku.Url + "keypress/" + keyCode; _ = HTTPTools.PostAsync(sendKeyUrl); }