Active#

Depending on drone state, a camera may become active or inactive.

For instance, on ANAFI Thermal drones, the main camera is inactive when the thermal camera is active and the thermal camera is inactive when the main camera is active.

When the drone is disconnected, all cameras are inactive.

When a camera is inactive, most features are unavailable, like photo capture, video recording, zoom control. However, it is still possible to configure camera parameters.

Camera 1#

Sample code to monitor if camera is active:

/// Keep reference on MainCamera peripheral to get notified of changes.
private var cameraRef: Ref<MainCamera>?

/// Monitors and prints active flag.
func monitorActive(drone: Drone) {
    cameraRef = drone.getPeripheral(Peripherals.mainCamera) { camera in
        if let camera = camera {
            let active = camera.isActive
            print("Active: \(active)")
        }
    }
}

Example of output:

Active: true
Active: false

Camera 2#

Sample code to monitor if camera is active:

/// Keep reference on MainCamera2 peripheral to get notified of changes.
private var cameraRef: Ref<MainCamera2>?

/// Monitors and prints active flag.
func monitorActive(drone: Drone) {
    cameraRef = drone.getPeripheral(Peripherals.mainCamera2) { camera in
        if let camera = camera {
            let active = camera.isActive
            print("Active: \(active)")
        }
    }
}

Example of output:

Active: true
Active: false