Advertisement
parkerlreed

Untitled

Oct 12th, 2012
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.25 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.net.*;
  3. import java.io.*;
  4. public class Xbmcremote
  5. {
  6.     public static void main(String[] args) throws Exception
  7.     {
  8.         String textsent = "";
  9.         URL sendup = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Up%22}");
  10.         URL senddown = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Down%22}");
  11.         URL sendleft = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Left%22}");
  12.         URL sendright = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Right%22}");
  13.         URL sendselect = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Select%22}");
  14.         URL sendback = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Back%22}");
  15.         URL sendhome = new URL("http://192.168.1.128:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Input.Home%22}");
  16.         int choice;
  17.         URLConnection up = sendup.openConnection();
  18.         URLConnection down = senddown.openConnection();
  19.         URLConnection left = sendleft.openConnection();
  20.         URLConnection right = sendright.openConnection();
  21.         URLConnection select = sendselect.openConnection();
  22.         URLConnection back = sendback.openConnection();
  23.         URLConnection home = sendhome.openConnection();
  24.         Scanner kb = new Scanner(System.in);
  25.        
  26.         System.out.print("Choose from the following options\n"
  27.                         + "    1. Up\n"
  28.                         + "    2. Down\n"
  29.                         + "    3. Left\n"
  30.                         + "    4. Right\n"
  31.                         + "    5. Select\n"
  32.                         + "    6. Back\n"
  33.                         + "    7. Home\n"
  34.                         + "Enter your choice: ");  
  35.         choice = kb.nextInt();
  36.         kb.nextLine();
  37.         switch(choice)
  38.         {
  39.         case 1: up.getInputStream();
  40.                 break;
  41.         case 2: down.getInputStream();
  42.                 break;
  43.         case 3: left.getInputStream();
  44.                 break;
  45.         case 4: right.getInputStream();
  46.                 break;
  47.         case 5: select.getInputStream();
  48.                 break;
  49.         case 6: back.getInputStream();
  50.                 break;
  51.         case 7: home.getInputStream();
  52.                 break;
  53.         default: System.out.println("EXTERMINATE!");
  54.                 break;
  55.         }
  56.     }  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement