예제 #1
0
        public async Task <Get_channel_response> TuneToChannel(string channel)
        {
            DTVRest dtv = new DTVRest();
            KeyValuePair <string, string> x = parse_channel(channel);
            string results = await dtv.GetDataAsync(this.m_client, "/tv/tune?major=" + x.Key + "&minor=" + x.Value + "&clientAddr=" + clientAddr);

            Get_channel_response m = JsonConvert.DeserializeObject <Get_channel_response>(results);

            return(m);
        }
예제 #2
0
        public async Task <Get_channel_response> KeyPress(string key)
        {
            string[] valid_keys = { "power",   "poweron", "poweroff", "format", "pause",    "rew",    "replay", "stop",
                                    "advance", "ffwd",    "record",   "play",   "guide",    "active", "list",   "exit",
                                    "back",    "menu",    "info",     "up",     "down",     "left",   "right",  "select","red",
                                    "green",   "yellow",  "blue",     "chanup", "chandown", "prev",   "0",      "1",     "2",
                                    "3",       "4",       "5",        "6",      "7",        "8",      "9",      "dash",  "enter" };
            if (valid_keys.Contains(key))
            {
                DTVRest dtv     = new DTVRest();
                string  results = await dtv.GetDataAsync(this.m_client, "/remote/processKey?key = " + key + " & clientAddr = " + clientAddr);

                Get_channel_response m = JsonConvert.DeserializeObject <Get_channel_response>(results);
                return(m);
            }
            else
            {
                var response = new Key_press_response();
                response.key_err = true;
                return(null);
            }
        }