Differences between 4.X and 5.X

2023-08-29
No Rating

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:

  1. Version 4.X is not compatiable with version 5.X, they cannot be used together.
  2. For the aircraft models supported by MSDK 5.X, please read the "Supported Product List and Firmware Version" on the Release Noteopen in new window. 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 documentationopen in new window. 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.

对照指引 en.gif

Difference:

Function Description4.X5.XIllustration/Difference
DJIKey operationKeyManagerIKeyManagerKey operation encapsulation class
DJIKey creationCreate methods of various Various Key Class, like CameraKey$create, CameraKey$createLensKey, FlightControllerKey$create and so on.KeyToolsThe Key creation of 5.X uniformly uses the related interface of Keytools.
DJIKey-ProductProductKeyProductKey5.X is for the whole machine.
DJIKey-AirLinkAirLinkKeyAirLinkKeyAirLink related
DJIKey- base stationBaseStationKeyRtkBaseStationKeyRTK base station related
DJIKey-batteryBatteryKeyBatteryKeyBattery related
DJIKey-cameraCameraKeyCameraKeyCamera related
DJIKey-flight controlFlightControllerKeyFlightControllerKeyFlight control related
DJIKey-gimbalGimbalKeyGimbalKeyGimbal related
DJIKey-LidarLidarKeyLidarKeyLidar related
DJIKey-DJI payloadPayloadKeyPayloadKeyPayload related
DJIKey-radarRadarKeyRadarKeyRadar related
DJIKey-remote controllerRemoteControllerKeyRemoteControllerKeyRemote controller related
KeyManager
Function Description4.X5.XIllustration/Difference
Read dataKeyManager$getValueIKeyManager$getValuesimilar
Set dataKeyManager$setValueIKeyManager$setValuesimilar
ActionKeyManager$performActionIKeyManager$performActionsimilar
ListenKeyManager$addListenerIKeyManager$listen5.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 listenerKeyManager$removeListenerIKeyManager$cancelListenSee the illustration of Listen
Remove the data of KeyKeyManager$removeKeyNoneNot 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:

  1. Create the key of main pisition: CameraKey$create(String paramKey)
  2. Create the key of specified position: CameraKey$create(String paramKey, int componentIndex)
  3. 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 Description4.X5.XIllustration/Difference
DJIKey InformationparamKeymKeyInfoDescribe the basic information of DJIKey.
Camera PositioncomponentIndexComponentIndexTypeCamera position, it is enumeration in 5.X.
Lens PositionsubComponentIndexCameraLensTypeLens position, it is enumeration in 5.X.

The rest part of 5.X, please refer to KeyToolsopen in new window.

ProductKey Mapping Relation
Function Description4.X5.XIllustration/Difference
Device ConnectionProductKey.CONNECTIONProductKey.KeyConnectionsimilar
FligthControllerKey Mapping Relation
Function Description(FligthController)4.X5.XIllustration/Difference
Device connectionFlightControllerKey.CONNECTIONFlightControllerKey.KeyConnectionsimilar
Motor is start or notFlightControllerKey.ARE_MOTOR_ONFlightControllerKey.KeyAreMotorsOnsimilar
airSense connection statusFlightControllerKey.AIR_SENSE_SYSTEM_CONNECTEFlightControllerKey.KeyAirSenseSystemConnectedsimilar
airSense informationFlightControllerKey.AIR_SENSE_SYSTEM_WARNING_LEVEL , FlightControllerKey.AIR_SENSE_AIRPLANE_STATESFlightControllerKey.KeyAirSenseSystemInformationsimilar
Drone heightFlightControllerKey.ALTITUDEFlightControllerKey.KeyAltitudesimilar
Height of takeoff pointFlightControllerKey.TAKEOFF_LOCATION_ALTITUDEFlightControllerKey.KeyTakeoffLocationAltitudesimilar
Height of home pointFlightControllerKey.GO_HOME_HEIGHT_IN_METERSFlightControllerKey.KeyGoHomeHeightsimilar
Home point locationFlightControllerKey.HOME_LOCATION_LATITUDE, FlightControllerKey.HOME_LOCATION_LONGITUDEFlightControllerKey.KeyHomeLocationsimilar
Current heightFlightControllerKey.ALTITUDEFlightControllerKey.KeyAltitudesimilar
Drone locationFlightControllerKey.AIRCRAFT_LOCATION_LATITUDE, FlightControllerKey.AIRCRAFT_LOCATION_LONGITUDEFlightControllerKey.KeyAircraftLocationThe latitude and longitude in 4.X are two Keys. In 5.X, it is an object contains two data.
Is flying or notFlightControllerKey.IS_FLYINGFlightControllerKey.KeyIsFlyingsimilar
Is landing or notFlightControllerKey.IS_LANDINGFlightControllerKey.KeyIsInLandingModesimilar
Need to confirm whether to landFlightControllerKey.IS_LANDING_CONFIRMATION_NEEDEDFlightControllerKey.KeyIsLandingConfirmationNeededsimilar
Forced landing heightFlightControllerKey.FORCE_LANDING_HEIGHTFlightControllerKey.KeyTouchDownConfirmLimitHeightsimilar
Flight mode stringFlightControllerKey.FLIGHT_MODE_STRINGFlightControllerKey.KeyFlightModeStringsimilar
Landing protection stateFlightControllerKey.LANDING_PROTECTION_STATEFlightAssistantKey.KeyLandingProtectionStatesimilar
Battery for go homeFlightControllerKey.BATTERY_PERCENTAGE_NEEDED_TO_GO_HOMEFlightControllerKey.KeyBatteryPercentNeededToGoHomesimilar
CameraKey Mapping Relation
Function Description(Camera)4.X5.XIllustration/Difference
Connection statusCameraKey.CONNECTIONCameraKey.KeyConnectionsimilar
Start shooting photoCameraKey.START_SHOOT_PHOTOCameraKey.KeyStartShootPhotosimilar
Stop shooting photoCameraKey.STOP_SHOOT_PHOTOCameraKey.KeyStopShootPhotosimilar
AE Lock switchCameraKey.AE_LOCKCameraKey.KeyAELockEnabledsimilar
Whether is recordingCameraKey.IS_RECORDINGCameraKey.KeyIsRecordingsimilar
Recording time in secondsCameraKey.CURRENT_VIDEO_RECORDING_TIME_IN_SECONDSCameraKey.KeyRecordingTimesimilar
Camera typeCameraKey.CAMERA_TYPECameraKey.KeyCameraTypesimilar
Storage typeCameraKey.CAMERA_STORAGE_LOCATIONCameraKey.KeyCameraStorageLocationsimilar
SD card stateCameraKey.SDCARD_STATECameraKey.KeyCameraSDCardStatesimilar
Internal storage statusCameraKey.INNERSTORAGE_STATECameraKey.KeyInternalStorageStatesimilar
Available recording time in seconds of current SD CardCameraKey.SDCARD_AVAILABLE_RECORDING_TIME_IN_SECONDSCameraKey .KeySSDAvailableRecordingTimeInSecondssimilar
Available recording time in seconds of current internal storageCameraKey.INNERSTORAGE_AVAILABLE_RECORDING_TIME_IN_SECONDSCameraKey.KeyInternalStorageAvailableVideoDurationsimilar
Start recordingCameraKey.START_RECORD_VIDEOCameraKey.KeyStartRecordsimilar
Stop recordingCameraKey.STOP_RECORD_VIDEOCameraKey.KeyStopRecordsimilar
AEB settingCameraKey.PHOTO_AEB_COUNTCameraKey.KeyAEBSettingsThe count of 4.X in the hotoAEBSettings class of the 5.X.
Photo burst countCameraKey.PHOTO_BURST_COUNTCameraKey.KeyPhotoBurstCountsimilar
Photo burst settingCameraKey.PHOTO_TIME_INTERVAL_SETTINGSCameraKey.KeyPhotoIntervalShootSettingssimilar
raw format photo burst countCameraKey.PHOTO_RAW_BURST_COUNTCameraKey.KeyRawBurstCountsimilar
Panorama modeCameraKey.PHOTO_PANORAMA_MODECameraKey.KeyPhotoPanoramaModesimilar
Whether is shootingCameraKey.IS_SHOOTING_PHOTOCameraKey.KeyIsShootingPhotosimilar
Whether is sotring photoCameraKey.IS_STORING_PHOTOCameraKey.KeyCameraStoringFilesimilar
Whether shooting is allowedCameraKey.IS_SHOOTING_PHOTO_ENABLEDCameraKey.KeyShootPhotoNotAllowedsimilar
Whether is shooting panorama photoCameraKey.IS_SHOOTING_PANORAMA_PHOTOCameraKey.KeyIsShootingPhotoPanoramasimilar
Exposure modeCameraKey.EXPOSURE_MODECameraKey.KeyExposureModesimilar
Range of exposure modeCameraKey.EXPOSURE_MODE_RANGECameraKey.KeyExposureModeRangesimilar
ISO settingCameraKey.ISOCameraKey.KeyISOsimilar
Range of ISO settingCameraKey.ISO_RANGECameraKey.KeyISORangesimilar
Exposure settingCameraKey.EXPOSURE_SETTINGSCameraKey.KeyExposureSettingssimilar
Exposure sensitivity settingCameraKey.EXPOSURE_SENSITIVITY_MODECameraKey.KeyExposureSensitivityModesimilar
EI valueCameraKey.EI_VALUECameraKey.KeyEIsimilar
Recommanded EI valueCameraKey.RECOMMENDED_EI_VALUECameraKey.KeyRecommendedEIsimilar
Range of EI valueCameraKey.EI_VALUE_RANGECameraKey.KeyEIRangesimilar
Camera modeCameraKey.MODE/CameraKey.FLAT_CAMERA_MODECameraKey.KeyCameraModeIn 5.X, we integrate two ModeKeys in 4.X into one.
Camera video stream sourceCameraKey.CAMERA_VIDEO_STREAM_SOURCECameraKey.KeyCameraVideoStreamSourcesimilar
Focus modeCameraKey.FOCUS_MODECameraKey.KeyCameraFocusModesimilar
Metering modeCameraKey.METERING_MODECameraKey.KeyCameraMeteringModesimilar
Focus targetCameraKey.FOCUS_TARGETCameraKey.KeyCameraFocusTargetsimilar
Spot metering targetCameraKey.SPOT_METERING_TARGETCameraKey.KeySpotMeteringTargetPointsimilar
GimbalKey Mapping Relation
Function Description(Gimbal)4.X5.XIllustration/Difference
Gimbal connection statusGimbalKey.CONNECTIONGimbalKey.KeyConnectionsimilar
Gimbal attitudeGimbalKey.ATTITUDE_IN_DEGREESGimbalKey.KeyGimbalAttitudesimilar
Gimbal rotateGimbalKey.ROTATEGimbalKey.KeyRotateBySpeed, GimbalKey.KeyRotateByAngleIn 5.X, there are two keys.
RemoteControlKey Mapping Relation
Function Description(RemoteControl)4.X5.XIllustration/Difference
Connection eventRemoteControllerKey.CONNECTIONRemoteControllerKey.KeyConnectionsimilar
Battery statusRemoteControllerKey.BATTERY_STATERemoteControllerKey.KeyBatteryInfosimilar
Whether is low batteryRemoteControllerKey.IS_CHARGE_REMAINING_LOWRemoteControllerKey.KeyBatteryInfoIt needs developers to count by themselves. In 4.X, battery less than 30% is low battery.
Remote controller GPS informationRemoteControllerKey.GPS_DATARemoteControllerKey.KeyRcGPSInfosimilar
Remote controller mode settingRemoteControllerKey.AIRCRAFT_MAPPING_STYLERemoteControllerKey.KeyControlModeCompared with 4.X, the remote controller mode can be defined directly through enumeration in 5.X.
RTKKey Mapping Relation
Function Description(RTK)4.X5.XIllustration/Difference
Home point data sourceFlightControllerKey.RTK_FUSION_HOME_LOCATION_DATA_SOURCERtkMobileStationKey.KeyRTKHomePointInfosimilar
Whether to set the take off heightFlightControllerKey.RTK_FUSION_HAS_SET_TAKE_OFF_ALTITUDERtkMobileStationKey.KeyRTKTakeoffAltitudeInfosimilar
Whether to enable RTKFlightControllerKey.RTK_ENABLEDRtkMobileStationKey.KeyRTKEnablesimilar
Whether RTK is supportedFlightControllerKey.IS_RTK_SUPPORTEDFlightControllerKey.KeyIsRtkSupportedsimilar
Whether RTK is connectedFlightControllerKey.IS_RTK_CONNECTEDRtkMobileStationKey.KeyConnectionsimilar
BatteryKey Mapping Relation
Function Description(Battery)4.X5.XIllustration/Difference
Battery temperatureBatteryKey.TEMPERATUREBatteryKey.KeyBatteryTemperaturesimilar
Battery powerBatteryKey.CHARGE_REMAINING_IN_PERCENTBatteryKey.KeyChargeRemainingInPercentsimilar
Battery voltageBatteryKey.CELL_VOLTAGESBatteryKey.KeyCellVoltagessimilar
Exception informationBatteryKey.LATEST_WARNING_RECORDBatteryKey.KeyBatteryExceptionIn 5.X, we integrate into this key.
Aggregation informationBatteryKey.AGGREGATION_STATEBatteryKey.KeyNumberOfConnectedBatteries, BatteryKey.KeyIsAnyBatteryDisconnected, BatteryKey.KeyIsCellDamaged, BatteryKey.KeyIsFirmwareDifferenceDetected, BatteryKey.KeyIsVoltageDifferenceDetected, BatteryKey.KeyIsLowCellVoltageDetected, BatteryKey.KeyBatteryOverviewsIn 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 Startopen in new window to understand the registration, setting, App Key application and how to use the sample code.

Function Description
4.x5.xIllustration/Difference
Registration/ActivitionDJISDKManager$registerAppSDKManager$init and SDKManager$registerApp5.x extractes the part of init. Developers only need to call the init once after the application starts.
Device Connection EventSDKManagerCallback$onComponentChangeUse varioous KeyConnections of Key, for example: CameraKey.KeyConnection, FlightControllerKey.KeyConnection5.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 Sampleopen in new window.

If you used the DJIKey to achieve, there are the follwing comparisons:

Function Description(VirtualStick)4.X5.XIllustration/Difference
Enable/disable the virtual stickFlightControllerKeys.VIRTUAL_STICK_CONTROL_MODE_ENABLEDFlightControllerKey.KeyVirtualStickEnabledsimilar
Send the virtual stick dataFlightControllerKeys.SEND_VIRTUAL_STICK_FLIGHT_CONTROL_DATAFlightControllerKey.KeySendVirtualStickFlightControlDataOverall 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 Sampleopen in new window.

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 Sampleopen in new window.

Diagnostic Module

In 5.X, diagnostic is completed through IDeviceHealthManager. Please refer to 5.X documentation: Diagnostic Sampleopen in new window.

Parameters comparison:

Description4.X5.XIllustration/Difference
Error codeDJIDiagnostics$getCodeDJIDeviceHealthInfo$informationCodeCompared with 4.X, the hms error code in 5.X is more easier to check, more comprehensive and more in amount.
Error descriptionDJIDiagnostics$getReason, DJIDiagnostics$getSolutionDJIDeviceHealthInfo$title, DJIDeviceHealthInfo$descriptionIn 5.X, they are unified as titile and error description(English and Chinese are supported).

Simulator Module

Please refer to 5.X documentation: Simulator Sampleopen in new window.

Media File Module

Please refer to 5.X documentation: Media File Sampleopen in new window.

Waypoint Module

Currently, the waypoint is send to the drone by KMZ file. Please refer to 5.X documentation: Waypoint Sampleopen in new window

RTK Module

Please refer to 5.X documentation: RTK Sampleopen in new window.

LDM Module

Please refer to 5.X documentation: LDM Sampleopen in new window.

If you have any comments or confusion about our documentation, you can click here to give feedback and we will get back to you as soon as possible.