Ejemplo n.º 1
0
  /**
   * This constructor receives as parameter the address and port of the drone
   *
   * <p>to instantiate and a command to send.
   *
   * <p>It instantiates GereThreads class that manages most of the necessary
   *
   * <p>threads in the application and NavdataReceiver class that get drone status and
   *
   * <p>data.
   *
   * <p>It also creates the socket and packet with CreationSocketPacket ()
   *
   * <p>function, and starts immediatly WatchDog thread to avoid losing the
   *
   * <p>connection.
   */
  public DroneManager(
      String CommandeStart,
      String Adresse,
      int iPort,
      Drone_UI joyActivity) { // CONSTRUCTEUR RECOI l'objet de classe MainActivity en parametre

    sAdresse = Adresse;
    iPortDrone = iPort;
    CommandeGenere = CommandeStart;
    mJoy = joyActivity;

    mThreads = new ThreadsManager(this);

    udp_socket = CreationSocketPacket(CommandeStart, iPort, Adresse); // Socket creation

    NavRec = new SensorData_Receiver(udp_socket);

    mThreads.StartDonnee();

    mThreads.StartWatchDog();
  }