dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
247 stars 126 forks source link

Same code working on 300 RTK but not on Mini 3 Pro #358

Open antonymarion opened 3 weeks ago

antonymarion commented 3 weeks ago

Hi Dji

I am printing the datalink type, firmware version and product Uuid

OK on 300 RTK Same code fails on mini 3 Pro

uavDataLinkType = KeyManager.getInstance().getValue(KeyTools.createKey( ProductKey.KeyDataLinkType)).toString() uavFirmwareVersion = KeyManager.getInstance().getValue(KeyTools.createKey( ProductKey.KeyFirmwareVersion)).toString() uavProductUUid = KeyManager.getInstance().getValue(KeyTools.createKey( ProductKey.KeyProductUUID)).toString()

Notice:

SN and ProductEdition does not work on both drones..

uavProductType = KeyManager.getInstance().getValue(KeyTools.createKey( ProductKey.KeyProductType)).toString() uavProductEdition = KeyManager.getInstance().getValue(KeyTools.createKey( ProductKey.KeyProductEdition)).toString()

Please provide us a list of working/non working features in your SDK

dji-dev commented 3 weeks ago

Agent comment from yating.liao in Zendesk ticket #108923:

API documentation provides interfaces that have been verified to be stable for use. We cannot guarantee the effectiveness of interfaces not documented, so they may present different issues on different device models. https://developer.dji.com/api-reference-v5/android-api/Components/SDKManager/DJISDKManager.html

°°°

antonymarion commented 3 weeks ago

These keys are in your doc; So how should I know there are not working?

image

dji-lyt commented 3 weeks ago

image The KeyProductType is functioning properly. You may consider utilizing a callback to retrieve the results. It is important to ensure that the Product is connected before attempting to retrieve the ProductType.

antonymarion commented 3 weeks ago

Could you please add in the doc the information of the Key that needs callback/subscribe/listening mechanism versus other ?

It would ease developpers' usage of this SDK (since now the only way to discover it is investigating the Sample DJI Code..)

dji-dev commented 3 weeks ago

Agent comment from yating.liao in Zendesk ticket #108923:

KeyProductType is not a Key that can only be used with a listener. If this is your first time calling KeyProductType, we recommend using listen. This is because the SDK takes some time to recognize the device, and calling the get interface before the device is recognized can lead to the issue you are experiencing, whereas the listener will not.

I will try to pass your suggestion on to the documentation engineer.

°°°

antonymarion commented 3 weeks ago

I used the following ProductVM class.

I put some breakpoint to debug what happens. It goes to the listenProductKey fun but never goes in the callback of thelisten(this) { }

class ProductVM : DJIViewModel()  {
    private var productType: ProductType? = null

    init {
        listenProductKey()
    }

    private fun listenProductKey(){
        ProductKey.KeyProductType.create().listen(this) {
            Log.d("DGEO", "productType=$it")
            if (it != ProductType.UNRECOGNIZED && productType != it) {
                productType = it
            }
        }
    }

}

Could you please show us a working code snippet, thks (I am testing it on 300 RTK)

antonymarion commented 2 weeks ago

I updated to last firmware and it's OK on mini 3 Pro

dji-dev commented 2 weeks ago

Agent comment from yating.liao in Zendesk ticket #108923:

Could you please confirm if this issue will still occur on the M300 RTK? It is important to note that the Key listener should be set after a successful registerApp.

°°°

antonymarion commented 2 weeks ago

No it's ok once updated on mini 3 Pro, I will test it also on M300 RTK and let you know

dji-dev commented 2 weeks ago

Agent comment from yating.liao in Zendesk ticket #108923:

Thank you, I will wait for the results of your test.

°°°

antonymarion commented 2 weeks ago

It is not working after test for both productEdition and productType for 300 RTK..

antonymarion commented 2 weeks ago

For your information it does not come from a timing issue, since I tested also with a 5s timer and productEdition and Type are still not filled...

Whereas uavFirmwareVersion is filled using the same kind of call (Key.listen(this) {})

dji-lyt commented 1 week ago

image I have no problem testing the value of KeyProductType.

antonymarion commented 1 week ago

Well you modified the source code of the MSDKManagerVM kotlin file.

I don't believe the SDK should be used modifying the source files.

Could you please provide a working snippet calling the SDK in a separated file (DJIMainActivity.kt for instance) and calling the SDK

For instance using observer msdkManagerVM.lvRegisterState.observe(this) { and depending on the resultPair, for instance here: image

Will ProductKey work here instead ?

dji-lyt commented 1 week ago

The correct way is actually to set the listener after OnRegisterSuccess. If you are unable to get the listener in the sample code, Could you provide me with the steps you followed to reproduce the issue? image

antonymarion commented 1 week ago

Well it goes to observeSDKManager

image

but never to the resultPair.first { ... }

OK got it, it never goes to the resultPair when the RC is in standby Mode (dark screen)

By the way I believe the pb is the same with the productKey: if the RC screen is Black (kind of standby mode, no access to productsKey).

But this behaviour is very weird, since with blackScreen on RC we can move Gimbal, set Zoom, change lenses etc etc..

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #108923:

Could you confirm if using the MSDK interface to set the zoom length on the remote control while it is in standby mode was successful?

°°°

antonymarion commented 1 week ago

Well, I dont get it..

I If use the RC it will not be any more in standby mode.

So it wil surely work because using your app we have to touch the screen.

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #108923:

How should I interpret this sentence “But this behaviour is very weird, since with blackScreen on RC we can move Gimbal, set Zoom, change lenses etc etc..”? Could you perform these actions using the buttons on the remote control?

°°°