コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: Running.cs プロジェクト: brianavid/Avid4G.Net
 /// <summary>
 ///
 /// </summary>
 private static void StopRoku()
 {
     if (runningProgram == "Roku")
     {
         Roku.KeyPress("Home");
     }
 }
コード例 #3
0
 public void RefreshRokus()
 {
     rokus = RokuAccessor.GetRokuList();
     if (rokus.Count > 0)
     {
         SelectedRoku = rokus[0];
     }
 }
コード例 #4
0
 // GET: /Action/GoRoku
 public ActionResult GoRoku()
 {
     Roku.KeyPress("Home");
     Screen.EnsureScreenOn();
     Running.StartStream("Roku");
     Receiver.SelectRokuInput();
     Receiver.SelectTVOutput();
     return(Content(""));
 }
コード例 #5
0
ファイル: Running.cs プロジェクト: brianavid/Avid4G.Net
    /// <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);
    }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
ファイル: MyRoku.cs プロジェクト: mikeweltejr/my-roku-skill
        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"
            });
        }
コード例 #8
0
 public ContentResult SendText(
     string text)
 {
     Roku.SendText(text);
     return(this.Content(""));
 }
コード例 #9
0
 public ContentResult KeyPress(
     string id)
 {
     Roku.KeyPress(id);
     return(this.Content(""));
 }
コード例 #10
0
 public ContentResult KeyDown(
     string id)
 {
     Roku.KeyDown(id);
     return(this.Content(""));
 }
コード例 #11
0
 public ContentResult RokuLaunch(
     string id)
 {
     Roku.RunApp(id);
     return(this.Content(""));
 }
コード例 #12
0
ファイル: MyRoku.cs プロジェクト: mikeweltejr/my-roku-skill
        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"
            });
        }
コード例 #13
0
        public static void LaunchRokuApp(Roku roku, RokuApp app)
        {
            var launchUrl = roku.Url + "launch/" + app.Id;

            _ = HTTPTools.PostAsync(launchUrl);
        }
コード例 #14
0
        public static void SendRokuButton(Roku roku, KeyCode keyCode)
        {
            var sendKeyUrl = roku.Url + "keypress/" + keyCode;

            _ = HTTPTools.PostAsync(sendKeyUrl);
        }