M2ED returns camera count as 1
Hello, We have observed that the SDK, sometimes returns the camera count as 1, instead of 2.
We get the following output when we use the method DJISDKManager.getInstance().getProduct().getCameras(): list of cameras: [dji.internal.camera.cb@76dd83f] Camera 0 is Mavic 2 Enterprise Dual-Thermal
We have experienced this on SDK versions 4.15.1 and 4.16 as well.
Agent comment from DJI SDK in Zendesk ticket #59602:
尊敬的开发者,感谢您联系DJI 大疆创新
由于github不是我们主要的咨询渠道,您的问题可能跟进不及时。我们建议您通过填写表单( https://djisdksupport.zendesk.com/hc/zh-cn/requests/new )向我们反馈问题。或者您也可以在论坛发帖,与其它开发者交流。论坛链接:https://djisdksupport.zendesk.com/hc/zh-cn/community/topics
Dear developer, thank you for contacting DJI.
Since github is not our main consultation channel, your questions may not be followed up in time. We recommend that you fill in the form (https://djisdksupport.zendesk.com/hc/en-us/requests/new) to report problems to us. Or you can post in the forum to communicate with other developers. Forum link: https://djisdksupport.zendesk.com/hc/zh-cn/community/topics
°°°
Agent comment from yating.liao in Zendesk ticket #59602:
Dear Client
Thank you for contacting DJI.
Will the video feed disappear as well?
Kindly Regards,
DJI Developer Support
°°°
No, the video feed does not disappear
Agent comment from yating.liao in Zendesk ticket #59602:
Dear Client
Thank you for contacting DJI.
When i use the method DJISDKManager.getInstance().getProduct().getCameras(),the SDK returns normally on my side. What are the circumstances in which this error usually occurs?Can you upload a video about this issue in this Link? Link:https://pan-sec.djicorp.com/s/N9XsKJ6miPmQfLQ Password:dji123
Kindly Regards,
DJI Developer Support
°°°
This error normally occurs when we try to get the camera instance quickly as soon as we get the aircraft connection from onProductConnected(). However, If we give a delay of 2 seconds between onProductConnected() and getting the aircraft instance followed by getting the camera instance, it returns 2 cameras.
Agent comment from yating.liao in Zendesk ticket #59602:
Dear Client
Thank you for contacting DJI.
Aircraft connection and camera connection did not occor in same time, that means camera is not necessarily connected when A is connected. You should listen to the connection status of camera by onConnectivityChange.
Kindly Regards,
DJI Developer Support
°°°
Hello, we are already doing that. We only initialise our camera instance after we get the callback from onComponent changed that both the cameras are connected. Still, we face the same issue.
Agent comment from yating.liao in Zendesk ticket #59602:
Dear Client
Thank you for contacting DJI.
Can you send me the code you have for onComponent? Generally both cameras generate callbacks and then you can get the camera list normally.
Kindly Regards,
DJI Developer Support
°°°
@Override
public void onComponentChange(BaseProduct.ComponentKey componentKey, BaseComponent oldComponent,
BaseComponent newComponent) {
logger.debug("Called onComponentChange");
if (newComponent != null) {
updateComponentConnectionStatus(componentKey, newComponent.isConnected());
newComponent.setComponentListener(isConnected -> {
logger.debug("onComponentConnectivityChanged: " + componentKey.name() + " " + isConnected);
updateComponentConnectionStatus(componentKey, isConnected);
notifyDroneStatusChange();
if (componentKey == CAMERA && isConnected) {
logger.debug("Camera initialized");
djiCamera.setCameraInst(getCameraInstance(0));
}
if (componentKey == BATTERY && isConnected) {
updateBatteryInstance();
}
});
}
if (componentKey == BATTERY && null != newComponent) {
updateBatteryInstance();
}
if (componentKey == CAMERA && newComponent != null) {
logger.debug("Camera initialized");
djiCamera.setCameraInst(getCameraInstance(0));
}
logger.debug(
String.format("onComponentChange key:%s, oldComponent:%s, newComponent:%s",
componentKey,
oldComponent,
newComponent));
notifyDroneStatusChange();
}
Agent comment from yating.liao in Zendesk ticket #59602:
Dear Client
Thank you for contacting DJI.
When onProductConnect informs that the product connection is successful, go through notifyStatusChange to inform the MainActivity that the product connection is successful. This process takes some time and therefore causes the problem you are experiencing.
In fact, when onProductConnect informs that the product connection is successful,the parameter BaseProduct already can gain the correct camera list.

This is'n a MSDK's error.
Kindly Regards,
DJI Developer Support
inline-712254291.png
°°°