Settings update#

Camera 1#

For each settings of camera, there is a method called isUpdating().

When you change a setting value while the drone is connected, a request to change this setting is sent to the drone. The isUpdating() method returns true indicating that a change request has been sent to the drone. When the drone answers to this request, the isUpdating() method returns false.

When you change a setting value while the drone is not connected, the isUpdating() method always return false. The request to change this setting will be sent once the drone is connected.

Note

The drone may accept or refuse the change request.

Sample code showing isUpdating() value when camera configuration is changed:

/** Sets roll alignment. */
fun setAlignmentRoll(camera: MainCamera, roll: Double) {
    camera.alignment()?.apply {
        // updating is false
        println("updating: $isUpdating")
        // set setting value
        setRoll(roll)
        // updating is true
        println("updating: $isUpdating")
    }
}

Camera 2#

Camera.Config has an updating field. Sub-components Camera.ExposureLock, Camera.WhiteBalanceLock and Camera.MediaMetadata have an applying field.

Thes field have the same role. When you change camera configuration, white balance lock, exposure lock or media metadata, while the drone is connected, a request is sent to the drone. The updating or applying field is set to true indicating that a change request has been sent to the drone. When the drone answers to this request, these flag is set back to false.

When you change a configuration value while the drone is not connected, the updating field remains false. The request to change the configuration will be sent once the drone is connected.

Note

The drone may accept or refuse the change request.

Sample code showing updating flag value when camera configuration is changed:

/** Sets roll alignment. */
fun setAlignmentRoll(camera: MainCamera, roll: Double) {
    // updating is false
    println("updating: $camera.config.updating")
    // create configuration editor, starting from current configuration
    val editor = camera.config.edit(fromScratch = false)
    // get configuration parameter
    editor[Camera.Config.ALIGNMENT_OFFSET_ROLL].let { configParam ->
        // change parameter value
        configParam.value = roll
        // automatically complete configuration
        editor.autoComplete()
        // send new configuration to drone
        editor.commit()
        // updating is true
        println("updating: $camera.config.updating")
    }
}