Differences between 4.X and 5.X
The following are the comparison and illustration of core interfaces between MSDK 4.X and MSDK 5.X. It mainly includes the DJIKey type interfaces and some core interfaces, for example, the SDK registration management class(SDKManager), device health status management class(DeviceHealthManager) and so on. We hope to assist users to quickly understand and use MSDK 5.X .
Notes:
- Version 4.X is not compatiable with version 5.X, they cannot be used together.
- For the aircraft models supported by MSDK 5.X, please read the "Supported Product List and Firmware Version" on the Release Note. And MSDK will only supports some of the new DJI products in the future.
DJIKey differences
DJIKey
Most interaction functions with the device of MSDK 5.X is realized by the DJIKey. One DJIKey represents a specified module function.
In version 4.X, most interface is the encapsulation of the DJIKey. For example, the Camera$startShootPhoto
is the application of CameraKey.START_SHOOT_PHOTO
. In the following comparison table, only show the DJIKey for 4.X rather than the interface. If there are any special situation, it will be dealt.
Take the method areMotorsOn
from Motors
of FlightControllerState
for example. Firstly, search the introduction of method areMotorsOn
from 4.X documentation. Then search the corresponding 4.X DJIKey.FlightControllerKey.ARE_MOTOR_ON. Finally, and find the corresponding 5.X DJIKey of method areMotorsOn
from migration documentation.
Difference:
Function Description | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
DJIKey operation | KeyManager | IKeyManager | Key operation encapsulation class |
DJIKey creation | Create methods of various Various Key Class, like CameraKey$create, CameraKey$createLensKey, FlightControllerKey$create and so on. | KeyTools | The Key creation of 5.X uniformly uses the related interface of Keytools. |
DJIKey-Product | ProductKey | ProductKey | 5.X is for the whole machine. |
DJIKey-AirLink | AirLinkKey | AirLinkKey | AirLink related |
DJIKey- base station | BaseStationKey | RtkBaseStationKey | RTK base station related |
DJIKey-battery | BatteryKey | BatteryKey | Battery related |
DJIKey-camera | CameraKey | CameraKey | Camera related |
DJIKey-flight control | FlightControllerKey | FlightControllerKey | Flight control related |
DJIKey-gimbal | GimbalKey | GimbalKey | Gimbal related |
DJIKey-Lidar | LidarKey | LidarKey | Lidar related |
DJIKey-DJI payload | PayloadKey | PayloadKey | Payload related |
DJIKey-radar | RadarKey | RadarKey | Radar related |
DJIKey-remote controller | RemoteControllerKey | RemoteControllerKey | Remote controller related |
KeyManager
Function Description | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Read data | KeyManager$getValue | IKeyManager$getValue | similar |
Set data | KeyManager$setValue | IKeyManager$setValue | similar |
Action | KeyManager$performAction | IKeyManager$performAction | similar |
Listen | KeyManager$addListener | IKeyManager$listen | 5.X add an concept of Holder , developer can bind the listeners to Holder. When developer remove the listener, they can be cancelled together through IKeyManager$cancelListen(Object listenHolder). |
Remove the listener | KeyManager$removeListener | IKeyManager$cancelListen | See the illustration of Listen |
Remove the data of Key | KeyManager$removeKey | None | Not supported in 5.X |
How to CreateKey
In 4.X, the create function of DJIKey is defined at various module Key. Take the CameraKey for example:
- Create the key of main pisition: CameraKey$create(String paramKey)
- Create the key of specified position: CameraKey$create(String paramKey, int componentIndex)
- Create the key of specified position and specified lens: CameraKey$createLensKey(String paramKey, int componentIndex, int subComponentIndex)
In 5.X, the create function of DJIKey is uniformly defined in KeyTools. Take the CameraKey for example:
Only one method to create the DJIKey of specified position and specified: KeyTools$createCameraKey(DJIKeyInfo<T> mKeyInfo, ComponentIndexType componentIndexType, CameraLensType cameraLensType)
. If the related DJIKey does not define the lens, use the CameraLensType.CAMERA_LENS_DEFAULT (At Kotlin, DJIKeyInfo have expansion method: createCamera. The default value of cameraLensType is CameraLensType.CAMERA_LENS_DEFAULT).
Parameter Illustration:
Function Description | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
DJIKey Information | paramKey | mKeyInfo | Describe the basic information of DJIKey. |
Camera Position | componentIndex | ComponentIndexType | Camera position, it is enumeration in 5.X. |
Lens Position | subComponentIndex | CameraLensType | Lens position, it is enumeration in 5.X. |
The rest part of 5.X, please refer to KeyTools.
ProductKey Mapping Relation
Function Description | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Device Connection | ProductKey.CONNECTION | ProductKey.KeyConnection | similar |
FligthControllerKey Mapping Relation
Function Description(FligthController) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Device connection | FlightControllerKey.CONNECTION | FlightControllerKey.KeyConnection | similar |
Motor is start or not | FlightControllerKey.ARE_MOTOR_ON | FlightControllerKey.KeyAreMotorsOn | similar |
airSense connection status | FlightControllerKey.AIR_SENSE_SYSTEM_CONNECTE | FlightControllerKey.KeyAirSenseSystemConnected | similar |
airSense information | FlightControllerKey.AIR_SENSE_SYSTEM_WARNING_LEVEL , FlightControllerKey.AIR_SENSE_AIRPLANE_STATES | FlightControllerKey.KeyAirSenseSystemInformation | similar |
Drone height | FlightControllerKey.ALTITUDE | FlightControllerKey.KeyAltitude | similar |
Height of takeoff point | FlightControllerKey.TAKEOFF_LOCATION_ALTITUDE | FlightControllerKey.KeyTakeoffLocationAltitude | similar |
Height of home point | FlightControllerKey.GO_HOME_HEIGHT_IN_METERS | FlightControllerKey.KeyGoHomeHeight | similar |
Home point location | FlightControllerKey.HOME_LOCATION_LATITUDE, FlightControllerKey.HOME_LOCATION_LONGITUDE | FlightControllerKey.KeyHomeLocation | similar |
Current height | FlightControllerKey.ALTITUDE | FlightControllerKey.KeyAltitude | similar |
Drone location | FlightControllerKey.AIRCRAFT_LOCATION_LATITUDE, FlightControllerKey.AIRCRAFT_LOCATION_LONGITUDE | FlightControllerKey.KeyAircraftLocation | The latitude and longitude in 4.X are two Keys. In 5.X, it is an object contains two data. |
Is flying or not | FlightControllerKey.IS_FLYING | FlightControllerKey.KeyIsFlying | similar |
Is landing or not | FlightControllerKey.IS_LANDING | FlightControllerKey.KeyIsInLandingMode | similar |
Need to confirm whether to land | FlightControllerKey.IS_LANDING_CONFIRMATION_NEEDED | FlightControllerKey.KeyIsLandingConfirmationNeeded | similar |
Forced landing height | FlightControllerKey.FORCE_LANDING_HEIGHT | FlightControllerKey.KeyTouchDownConfirmLimitHeight | similar |
Flight mode string | FlightControllerKey.FLIGHT_MODE_STRING | FlightControllerKey.KeyFlightModeString | similar |
Landing protection state | FlightControllerKey.LANDING_PROTECTION_STATE | FlightAssistantKey.KeyLandingProtectionState | similar |
Battery for go home | FlightControllerKey.BATTERY_PERCENTAGE_NEEDED_TO_GO_HOME | FlightControllerKey.KeyBatteryPercentNeededToGoHome | similar |
CameraKey Mapping Relation
Function Description(Camera) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Connection status | CameraKey.CONNECTION | CameraKey.KeyConnection | similar |
Start shooting photo | CameraKey.START_SHOOT_PHOTO | CameraKey.KeyStartShootPhoto | similar |
Stop shooting photo | CameraKey.STOP_SHOOT_PHOTO | CameraKey.KeyStopShootPhoto | similar |
AE Lock switch | CameraKey.AE_LOCK | CameraKey.KeyAELockEnabled | similar |
Whether is recording | CameraKey.IS_RECORDING | CameraKey.KeyIsRecording | similar |
Recording time in seconds | CameraKey.CURRENT_VIDEO_RECORDING_TIME_IN_SECONDS | CameraKey.KeyRecordingTime | similar |
Camera type | CameraKey.CAMERA_TYPE | CameraKey.KeyCameraType | similar |
Storage type | CameraKey.CAMERA_STORAGE_LOCATION | CameraKey.KeyCameraStorageLocation | similar |
SD card state | CameraKey.SDCARD_STATE | CameraKey.KeyCameraSDCardState | similar |
Internal storage status | CameraKey.INNERSTORAGE_STATE | CameraKey.KeyInternalStorageState | similar |
Available recording time in seconds of current SD Card | CameraKey.SDCARD_AVAILABLE_RECORDING_TIME_IN_SECONDS | CameraKey .KeySSDAvailableRecordingTimeInSeconds | similar |
Available recording time in seconds of current internal storage | CameraKey.INNERSTORAGE_AVAILABLE_RECORDING_TIME_IN_SECONDS | CameraKey.KeyInternalStorageAvailableVideoDuration | similar |
Start recording | CameraKey.START_RECORD_VIDEO | CameraKey.KeyStartRecord | similar |
Stop recording | CameraKey.STOP_RECORD_VIDEO | CameraKey.KeyStopRecord | similar |
AEB setting | CameraKey.PHOTO_AEB_COUNT | CameraKey.KeyAEBSettings | The count of 4.X in the hotoAEBSettings class of the 5.X. |
Photo burst count | CameraKey.PHOTO_BURST_COUNT | CameraKey.KeyPhotoBurstCount | similar |
Photo burst setting | CameraKey.PHOTO_TIME_INTERVAL_SETTINGS | CameraKey.KeyPhotoIntervalShootSettings | similar |
raw format photo burst count | CameraKey.PHOTO_RAW_BURST_COUNT | CameraKey.KeyRawBurstCount | similar |
Panorama mode | CameraKey.PHOTO_PANORAMA_MODE | CameraKey.KeyPhotoPanoramaMode | similar |
Whether is shooting | CameraKey.IS_SHOOTING_PHOTO | CameraKey.KeyIsShootingPhoto | similar |
Whether is sotring photo | CameraKey.IS_STORING_PHOTO | CameraKey.KeyCameraStoringFile | similar |
Whether shooting is allowed | CameraKey.IS_SHOOTING_PHOTO_ENABLED | CameraKey.KeyShootPhotoNotAllowed | similar |
Whether is shooting panorama photo | CameraKey.IS_SHOOTING_PANORAMA_PHOTO | CameraKey.KeyIsShootingPhotoPanorama | similar |
Exposure mode | CameraKey.EXPOSURE_MODE | CameraKey.KeyExposureMode | similar |
Range of exposure mode | CameraKey.EXPOSURE_MODE_RANGE | CameraKey.KeyExposureModeRange | similar |
ISO setting | CameraKey.ISO | CameraKey.KeyISO | similar |
Range of ISO setting | CameraKey.ISO_RANGE | CameraKey.KeyISORange | similar |
Exposure setting | CameraKey.EXPOSURE_SETTINGS | CameraKey.KeyExposureSettings | similar |
Exposure sensitivity setting | CameraKey.EXPOSURE_SENSITIVITY_MODE | CameraKey.KeyExposureSensitivityMode | similar |
EI value | CameraKey.EI_VALUE | CameraKey.KeyEI | similar |
Recommanded EI value | CameraKey.RECOMMENDED_EI_VALUE | CameraKey.KeyRecommendedEI | similar |
Range of EI value | CameraKey.EI_VALUE_RANGE | CameraKey.KeyEIRange | similar |
Camera mode | CameraKey.MODE/CameraKey.FLAT_CAMERA_MODE | CameraKey.KeyCameraMode | In 5.X, we integrate two ModeKeys in 4.X into one. |
Camera video stream source | CameraKey.CAMERA_VIDEO_STREAM_SOURCE | CameraKey.KeyCameraVideoStreamSource | similar |
Focus mode | CameraKey.FOCUS_MODE | CameraKey.KeyCameraFocusMode | similar |
Metering mode | CameraKey.METERING_MODE | CameraKey.KeyCameraMeteringMode | similar |
Focus target | CameraKey.FOCUS_TARGET | CameraKey.KeyCameraFocusTarget | similar |
Spot metering target | CameraKey.SPOT_METERING_TARGET | CameraKey.KeySpotMeteringTargetPoint | similar |
GimbalKey Mapping Relation
Function Description(Gimbal) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Gimbal connection status | GimbalKey.CONNECTION | GimbalKey.KeyConnection | similar |
Gimbal attitude | GimbalKey.ATTITUDE_IN_DEGREES | GimbalKey.KeyGimbalAttitude | similar |
Gimbal rotate | GimbalKey.ROTATE | GimbalKey.KeyRotateBySpeed, GimbalKey.KeyRotateByAngle | In 5.X, there are two keys. |
RemoteControlKey Mapping Relation
Function Description(RemoteControl) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Connection event | RemoteControllerKey.CONNECTION | RemoteControllerKey.KeyConnection | similar |
Battery status | RemoteControllerKey.BATTERY_STATE | RemoteControllerKey.KeyBatteryInfo | similar |
Whether is low battery | RemoteControllerKey.IS_CHARGE_REMAINING_LOW | RemoteControllerKey.KeyBatteryInfo | It needs developers to count by themselves. In 4.X, battery less than 30% is low battery. |
Remote controller GPS information | RemoteControllerKey.GPS_DATA | RemoteControllerKey.KeyRcGPSInfo | similar |
Remote controller mode setting | RemoteControllerKey.AIRCRAFT_MAPPING_STYLE | RemoteControllerKey.KeyControlMode | Compared with 4.X, the remote controller mode can be defined directly through enumeration in 5.X. |
RTKKey Mapping Relation
Function Description(RTK) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Home point data source | FlightControllerKey.RTK_FUSION_HOME_LOCATION_DATA_SOURCE | RtkMobileStationKey.KeyRTKHomePointInfo | similar |
Whether to set the take off height | FlightControllerKey.RTK_FUSION_HAS_SET_TAKE_OFF_ALTITUDE | RtkMobileStationKey.KeyRTKTakeoffAltitudeInfo | similar |
Whether to enable RTK | FlightControllerKey.RTK_ENABLED | RtkMobileStationKey.KeyRTKEnable | similar |
Whether RTK is supported | FlightControllerKey.IS_RTK_SUPPORTED | FlightControllerKey.KeyIsRtkSupported | similar |
Whether RTK is connected | FlightControllerKey.IS_RTK_CONNECTED | RtkMobileStationKey.KeyConnection | similar |
BatteryKey Mapping Relation
Function Description(Battery) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Battery temperature | BatteryKey.TEMPERATURE | BatteryKey.KeyBatteryTemperature | similar |
Battery power | BatteryKey.CHARGE_REMAINING_IN_PERCENT | BatteryKey.KeyChargeRemainingInPercent | similar |
Battery voltage | BatteryKey.CELL_VOLTAGES | BatteryKey.KeyCellVoltages | similar |
Exception information | BatteryKey.LATEST_WARNING_RECORD | BatteryKey.KeyBatteryException | In 5.X, we integrate into this key. |
Aggregation information | BatteryKey.AGGREGATION_STATE | BatteryKey.KeyNumberOfConnectedBatteries, BatteryKey.KeyIsAnyBatteryDisconnected, BatteryKey.KeyIsCellDamaged, BatteryKey.KeyIsFirmwareDifferenceDetected, BatteryKey.KeyIsVoltageDifferenceDetected, BatteryKey.KeyIsLowCellVoltageDetected, BatteryKey.KeyBatteryOverviews | In 4.X, we read the aggregation information of multi-battery. When create DJKey in 5.X, ComponentIndexType.AGGREGATION is passed in. |
DJI Core Module Differences
ISDKManager
ISDKManager is the entrance management class. Compared with 4.X, it makes some simpilification. Please refer to Quick Start to understand the registration, setting, App Key application and how to use the sample code.
Function Description | 4.x | 5.x | Illustration/Difference |
---|---|---|---|
Registration/Activition | DJISDKManager$registerApp | SDKManager$init and SDKManager$registerApp | 5.x extractes the part of init. Developers only need to call the init once after the application starts. |
Device Connection Event | SDKManagerCallback$onComponentChange | Use varioous KeyConnections of Key, for example: CameraKey.KeyConnection, FlightControllerKey.KeyConnection | 5.x listens the device connection event through KeyConnection of each module. |
Virtual Stick Module
The interfaces of virtual stick in 4.X and 5.X are very different. Please refer the 5.X documentation: Virtual Stick Sample.
If you used the DJIKey to achieve, there are the follwing comparisons:
Function Description(VirtualStick) | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Enable/disable the virtual stick | FlightControllerKeys.VIRTUAL_STICK_CONTROL_MODE_ENABLED | FlightControllerKey.KeyVirtualStickEnabled | similar |
Send the virtual stick data | FlightControllerKeys.SEND_VIRTUAL_STICK_FLIGHT_CONTROL_DATA | FlightControllerKey.KeySendVirtualStickFlightControlData | Overall data is similar |
Video Stream Module
Compared with 4.X, the video stream function in 5.X simplified the operation a lot. Please refer to 5.X documentation: Video Stream Sample.
Live Stream Module
Compared with 4.X, the live stream function in 5.X is more abundant, and supports more protocol. Please refer to 5.X documentation: Live Stream Sample.
Diagnostic Module
In 5.X, diagnostic is completed through IDeviceHealthManager. Please refer to 5.X documentation: Diagnostic Sample.
Parameters comparison:
Description | 4.X | 5.X | Illustration/Difference |
---|---|---|---|
Error code | DJIDiagnostics$getCode | DJIDeviceHealthInfo$informationCode | Compared with 4.X, the hms error code in 5.X is more easier to check, more comprehensive and more in amount. |
Error description | DJIDiagnostics$getReason, DJIDiagnostics$getSolution | DJIDeviceHealthInfo$title, DJIDeviceHealthInfo$description | In 5.X, they are unified as titile and error description(English and Chinese are supported). |
Simulator Module
Please refer to 5.X documentation: Simulator Sample.
Media File Module
Please refer to 5.X documentation: Media File Sample.
Waypoint Module
Currently, the waypoint is send to the drone by KMZ file. Please refer to 5.X documentation: Waypoint Sample。
RTK Module
Please refer to 5.X documentation: RTK Sample.
LDM Module
Please refer to 5.X documentation: LDM Sample.