KeyThermalTemperatureMeasureMode returns an error

已完成

评论

5 条评论

  • DJI Developer Support
    Could you please provide us with the code where you call the KeyThermalTemperatureMeasureMode for analysis? Thank you.
    0
    评论操作 固定链接
  • Ihor

    I'm using FPVInteractionWidget from the sample.

    I've added this code to the method "void updateCameraSource(@NonNull ComponentIndexType cameraIndex, @NonNull CameraLensType lensType)"

            KeyManager keyManager = KeyManager.getInstance();
            DJIKey<CameraVideoStreamSourceType> keySteamSourceType = KeyTools
                    .createKey(CameraKey.KeyCameraVideoStreamSource);
            DJIKey<ThermalTemperatureMeasureMode> keyMeasureMode = KeyTools
                    .createKey(CameraKey.KeyThermalTemperatureMeasureMode);

            if (lensType == CameraLensType.CAMERA_LENS_THERMAL) {
                chbxTemperature.setVisibility(VISIBLE);

                keyManager.setValue(keyMeasureMode, ThermalTemperatureMeasureMode.SPOT, new CommonCallbacks.CompletionCallback() {
                    @Override
                    public void onSuccess() {
                        appentTxtLog("OK: KeyThermalTemperatureMeasureMode set to SPOT 1");
                    }

                    @Override
                    public void onFailure(@NonNull IDJIError idjiError) {
                        appentTxtLog("FAILED: KeyThermalTemperatureMeasureMode set to SPOT 1: " + idjiError);
                    }
                });

                keyManager.setValue(keySteamSourceType, CameraVideoStreamSourceType.INFRARED_CAMERA, new CommonCallbacks.CompletionCallback() {
                    @Override
                    public void onSuccess() {
                        appentTxtLog("OK: KeyCameraVideoStreamSource set to INFRARED_CAMERA");
                        keyManager.setValue(keyMeasureMode, ThermalTemperatureMeasureMode.SPOT, new CommonCallbacks.CompletionCallback() {
                            @Override
                            public void onSuccess() {
                                appentTxtLog("OK: KeyThermalTemperatureMeasureMode set to SPOT 2");
                            }

                            @Override
                            public void onFailure(@NonNull IDJIError idjiError) {
                                appentTxtLog("FAILED: KeyThermalTemperatureMeasureMode set to SPOT 2: " + idjiError);
                            }
                        });
                    }

                    @Override
                    public void onFailure(@NonNull IDJIError idjiError) {
                        appentTxtLog("FAILED: KeyCameraVideoStreamSource set to INFRARED_CAMERA: " + idjiError);
                    }
                });

            } else {
                chbxTemperature.setVisibility(GONE);

                keyManager.setValue(keyMeasureMode, ThermalTemperatureMeasureMode.DISABLED, null);
            }

    And this code to the method "void updateTarget(ControlMode controlMode, boolean isAeLocked, float targetX, float targetY)"

    if (touchTemperatureEnabled && getLensType() == CameraLensType.CAMERA_LENS_THERMAL) {
       getSpotMetersureTemperature(targetX, targetY);
    }

    And here is method getSpotMetersureTemperature

    private void getSpotMetersureTemperature(float targetX, float targetY) {

            CommonCallbacks.CompletionCallback pointCallback = new CommonCallbacks.CompletionCallback() {
                @Override
                public void onSuccess() {
                    appentTxtLog("KeyThermalSpotMetersurePoint set " + targetX + ", " + targetY + " OK");
                    DJIKey<Double> keyTemperature = KeyTools.createKey(CameraKey.KeyThermalSpotMetersureTemperature);

                    KeyManager.getInstance().getValue(keyTemperature, new CommonCallbacks.CompletionCallbackWithParam<Double>() {
                        @Override
                        public void onSuccess(Double aDouble) {
                            appentTxtLog("OK: get KeyThermalSpotMetersureTemperature");
                          String tempString = aDouble == null ? "null" : aDouble.toString();
                            showTemp(tempString);
                        }

                        @Override
                        public void onFailure(@NonNull IDJIError idjiError) {
                            appentTxtLog("FAILED: get KeyThermalSpotMetersureTemperature: " + idjiError);
                            showTemp("errror");
                        }
                    });

                }

                @Override
                public void onFailure(@NonNull IDJIError idjiError) {
                    appentTxtLog("FAILED: KeyThermalSpotMetersurePoint set " + targetX + ", " + targetY + " - " + idjiError);
                    Log.e(TAG, "onFailure: " + idjiError);
                    showTemp("error");
                }
            };

            DJIKey<DoublePoint2D> keyPoint = KeyTools.createKey(CameraKey.KeyThermalSpotMetersurePoint);
            DoublePoint2D dp3d = new DoublePoint2D((double) targetX, (double) targetY);
            KeyManager.getInstance().setValue(keyPoint, dp3d, pointCallback);
        }

    And here is the log

    FAILED: KeyThermalTemperatureMeasureMode set to SPOT 1: ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}

    OK: KeyCameraVideoStreamSource set to INFRARED_CAMERA

    FAILED: KeyThermalTemperatureMeasureMode set to SPOT 2: ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}

    FAILED: KeyThermalSpotMetersurePoint set 0.68541664, 0.734375 - ErrorImp{errorType='CORE', errorCode='KEY_MISS_EXECUTION_FUNCTION', innerCode='', description='null', hint='error code = -19'}
    0
    评论操作 固定链接
  • DJI Developer Support
    The KEY_MISS_EXECUTION_FUNCTION refers to the current state being unable to perform this action. Based on your code, it seems that you did not specify the infrared lens when creating the Key for the infrared lens. I recommend adding ComponentIndex and LensType when creating the Key. Setting the temperature measurement mode can only be successful when the video source is an infrared camera. I suggest waiting for a short period after switching to the infrared lens before setting the temperature measurement mode.
    0
    评论操作 固定链接
  • Ihor

    Thanks for your reply.

    Could you please give an example of how to add ComponentIndex and LensType when creating the Key? I've tried to use "ComponentIndexType cameraIndex", but it didn’t work out.

    DJIKey<CameraVideoStreamSourceType> keySteamSourceType = KeyTools.createKey(CameraKey.KeyCameraVideoStreamSource, cameraIndex);

     

    0
    评论操作 固定链接
  • yating.liao

    If you use createCameraKey to create a key, you can pass in these two parameters.

    Another method is to use the default version of createKey. Both productId and subComponentIndex can default to 0.

    0
    评论操作 固定链接

请先登录再写评论。