mavlink / MAVSDK-Java

MAVSDK client for Java.
68 stars 40 forks source link

Drone Connection and disconnection info #119

Closed Chandanrajshaw closed 1 year ago

Chandanrajshaw commented 1 year ago

I m developing android application. my Question is that How can I get the drone connection and disconnection info or connected drone info from any activity in the project so that before doing any operation i can raise messge like Drone is available/not available . I am new in the drone app development

divyanshupundir commented 1 year ago

Hello @Chandanrajshaw.

Due to some problems, we do not get the correct value of the drone connection state. But you probably do not even need it. In case you call a function, for example, arm, the call site would look like this:

drone.getAction().arm().subscribe(
  () -> { },       // onComplete block
  throwable -> { } // onError block
);

Now, if the throwable can be an instance of MavsdkException, that object will have the information of whether there is no system available to take the command.