Example #1
0
 private RemoteCar fakeCar() throws UnknownHostException {
   RemoteCar ret = new RemoteCar();
   ret.setIp(InetAddress.getByName("192.168.18.243"));
   ret.setControlPort(18000);
   ret.setCameraPort(8002);
   return ret;
 }
Example #2
0
  private void showVideo() throws IOException {
    if (videoFrame == null) {
      videoFrame = new JFrame("Remote Car Video");
      video = new VideoPanel(car.getIp(), car.getCameraPort());
      videoFrame.getContentPane().add(video);
      videoFrame.setResizable(false);
      videoFrame.addWindowListener(
          new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
              System.out.println("closing");
              super.windowClosed(e);
              video.disconnect();
              btnCamera.setSelected(false);
            }

            @Override
            public void windowOpened(WindowEvent e) {
              System.out.println("opened");
              super.windowOpened(e);
              try {
                video.connect();
              } catch (MalformedURLException e1) {
                e1.printStackTrace();
              }
              video.play();
            }

            @Override
            public void windowActivated(WindowEvent e) {
              video.play();
            }

            @Override
            public void windowIconified(WindowEvent e) {
              video.pause();
            }
          });
    }
    Point location = this.getLocation();
    Dimension dim = this.getSize();
    videoFrame.setLocation(location.x + dim.width + 2, location.y);
    videoFrame.setVisible(true);
    videoFrame.pack();
    sendCommand(Command.TOGGLE_CAMERA);
  }
Example #3
0
 private RemoteCar findCar() throws IOException, InterruptedException {
   return RemoteCar.find(8001);
 }