Know if drone is already paired


#1

Product: Mambo
Product version: [X.X.X]
SDK version: 3.0.1
Use of libARController: YES (Only for ARSDK)
SDK platform: iOS
Reproductible with the official app: YES

Which attribute ou method does provide the information if the drone is already connected with other device? I have a screen in my app that shows all the drones that can be paired, but I want to exclude the ones that already have been paired.

I only found a state “ARDISCOVERY_CONNECTION_STATE_CONNECTED_TO_OTHER” in the “ARDISCOVERY_Connection.h” library, but I do not know how to reach that.


#2

It is a BLE connection… There is no legacy pairing involved.

Discovery and actually connecting are two vastly different things.

If I understand your use case correctly you are trying to exclude already connected drones (assumedly connected to other devices) from Discovery.

There is no means on the part of the client to do this absent attempting to connect that I’m aware of.


#3

Hi,

In fact you can access the connection state of the Mambo but only on the from the service discovered in Bluetooth.
To do that, get the connectionState from the ARBLEService. Here is a code extract of a little change I made in the iOS Samples (DeviceListFV, in tableView:cellForRowAtIndexPath function):

    ARService *service = (ARService*)[_dataSource objectAtIndex:indexPath.row];
    NSString *networkType;
    switch (service.network_type) {
        ...
        case ARDISCOVERY_NETWORK_TYPE_BLE:
            networkType = @"BLE";
            NSLog(@"Connection state = %d", ((ARBLEService*)service.service).connectionState);
            break;
        ...
    }

With this connectionState you can be informed if the drone seen is currently ARSDK-connected to another controller.
You can also know if the camera is plugged, thus if you can connect to the Mambo through Wifi.


#4

While the cast works fine, the hasMinicam() method always returns false on Android:

case ARDISCOVERY_NETWORK_TYPE_BLE: {
         final ARDiscoveryDeviceBLEService bleDevice = (ARDiscoveryDeviceBLEService) service.getDevice();
         logEvent(Log.INFO, CLASS_NAME, "ble found minicam=" + bleDevice.hasMinicam() + " state=" + bleDevice.getConnectionState().name());

Verified with a Mambo with cam enabled prior to ignoring the BLE registration and connecting via Wi-Fi.


#5

I did verify that connectionState is working properly. It is only hasMinicam() this is not functional. Oddly enough, this function appears to work fine in FF Mini as it is able to detect the presence of the minicam without issue through discovery.


#6
                // connection state is taken from the first bit of byte 8
                int has_camera = (data[8] & 0x01);
                res = has_camera == 0x01;

data[8] is always 0. However, with the cam connected there is a data[9] and its value is 1 when the cam is connected. If the cam is not connected (I also tested with the gun connected) data does not have a 9th byte.


#7

You’re right @synman, a fix for that has been submitted and integrated in the 3.13.1 fresh release.