Please select Into the mobile phone version | Continue to access the computer ver.
Close
You need to log in before you can reply       Login | Register now

[Bug] Wrong Data from Transparent Transmission

Author: Rt Chen 2017-4-12 16:03
1 230
Last edited by Rt Chen In 2017-4-12 16:03 Editor

I use Android Mobile SDK send a message to Onboard SDK.
I use  .sendDataToOnboardSDKDevice  method in Android Mobile SDK.


I set my Callback Function to handle the message in STM32 Onboard SDK. But the message I got was wrong. I use MDK's Debug Session to watch the Memmory.


I found that, no matter what I sent from Mobile SDK, I will always get only 8 bytes incorrect message in Onboard SDK.


In the picture you can see that, below the header, we got the CMD Set and CMD ID correctly.
But the Payload is different from what I sent by MobileSDK ( byte[] btest ).


I sure the marco USE_ENCRYPT not uncomment in DJI_Config.h.


I am confused about this, please help me, thank you!


【Other Infomation】
Mobile SDK : Android Mobile SDK 3.5.1
Onboard SDK: Onboard SDK 3.2.0 & STM32
UAV :  M600 Pro ( latest A3 firmware )

This post contains more resources

You need to Login Before they can download or view, Not have an account?Register now

x
Reply
Replies
dzb5138
Hello,
I had the same issue with IOS. The issue is on the Onboard SDK.

From my point of view, there is a bug in DJI_App.cpp
The userData buffer is never filled-in by the SDK. So, the information you send from the mobile is lost.
Have a look in the following method:

void DJI:nboardSDK::CoreAPI::recvReqData(Header *protocolHeader)
{
  unsigned char buf[100] = { 0, 0 };

  uint8_t ack = *((unsigned char *)protocolHeader + sizeof(Header) + 2);
  if (getCmdSet(protocolHeader) == SET_BROADCAST)
  {
    switch (getCmdCode(protocolHeader))
    {
      case CODE_BROADCAST:
        broadcast(protocolHeader);
        break;
      case CODE_FROMMOBILE:
        API_LOG(serialDevice, STATUS_LOG, "Receive data from mobile\n");
        if (fromMobileCallback.callback)
        {
          fromMobileCallback.callback(this, protocolHeader, fromMobileCallback.userData);
        }
        else
        {
          parseFromMobileCallback(this, protocolHeader);
        }
        break;

I modified this method to copy the userData:
        API_LOG(serialDevice, STATUS_LOG, "Receive data from mobile\n");
        if (fromMobileCallback.callback)
        {
           memcpy(fromMobileCallback.userData,
                ((unsigned char*)protocolHeader) + sizeof(Header),
                100);


           fromMobileCallback.callback(this, protocolHeader, fromMobileCallback.userData);

It works for me now.

Best regards
2017-5-7 15:46
You need to log in before you can reply Login | Register now

Quick Reply Back to top Back to list
Quick Reply Back to top Back to list