/** * This function stops the steering threads using a boolean, it stops the * * <p>timer and starts the Atterissage and Watchdog threads (the emergency landing * * <p>function is the same, only the thread and thus the associated command * * <p>change). */ public void atterissage() { mScheduleTaskExecutor.shutdownNow(); mScheduleTaskExecutor = Executors.newSingleThreadScheduledExecutor(); mThreads.bWatchDog = true; AttenteMs(50); mThreads.StartAtterissage(); AttenteMs(50); mThreads.StartWatchDog(); }
/** * 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(); }