Bugg fix, still issues with the map and video...
Esse commit está contido em:
BIN
Arquivo binário não exibido.
+1
-21
@@ -1,21 +1 @@
|
||||
[1/2] Building C object CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o
|
||||
In file included from /home/smartdrone/Working_Private/rosettadrone_work/app/src/main/cpp/dji_video_jni.c:4:
|
||||
In file included from ../../../../src/main/cpp/ffmpeg.h:34:
|
||||
In file included from ../../../../src/main/cpp/cmdutils.h:28:
|
||||
In file included from ../../../../src/main/cpp/include/libavcodec/avcodec.h:31:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/samplefmt.h:24:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/avutil.h:289:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/common.h:401:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/mem.h:33:
|
||||
../../../../src/main/cpp/include/libavutil/error.h:121:5: warning: non-constant static local variable in inline function may be different in different files [-Wstatic-local-in-inline]
|
||||
static char str[AV_ERROR_MAX_STRING_SIZE];
|
||||
^
|
||||
../../../../src/main/cpp/include/libavutil/error.h:119:1: note: use 'static' to give inline function 'av_err2str' internal linkage
|
||||
av_always_inline char *av_err2str(int errnum) {
|
||||
^
|
||||
static
|
||||
../../../../src/main/cpp/include/libavutil/attributes.h:37:30: note: expanded from macro 'av_always_inline'
|
||||
# define av_always_inline __attribute__((always_inline)) inline
|
||||
^
|
||||
1 warning generated.
|
||||
[2/2] Linking C shared library ../../../../build/intermediates/cmake/debug/obj/arm64-v8a/libdjivideojni.so
|
||||
ninja: no work to do.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"sdkFolder": "/home/smartdrone/Android/Sdk",
|
||||
"isNativeCompilerSettingsCacheEnabled": false,
|
||||
"isBuildOnlyTargetAbiEnabled": true,
|
||||
"ideBuildTargetAbi": "arm64-v8a,armeabi-v7a,armeabi",
|
||||
"splitsAbiFilterSet": [],
|
||||
"intermediatesFolder": "/home/smartdrone/Working_Private/rosettadrone_work/app/build/intermediates",
|
||||
"gradleModulePathName": ":app",
|
||||
@@ -39,9 +40,8 @@
|
||||
"gradleBuildOutputFolder": "/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cxx/debug",
|
||||
"isDebuggableEnabled": true,
|
||||
"validAbiList": [
|
||||
"ARMEABI_V7A",
|
||||
"ARM64_V8A",
|
||||
"X86"
|
||||
"ARMEABI_V7A"
|
||||
],
|
||||
"buildTargetSet": []
|
||||
},
|
||||
|
||||
@@ -5,47 +5,23 @@
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "rebuilding JSON /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a/android_gradle_build.json due to:"
|
||||
"message": "No CMake version was specified in build.gradle. Choosing a suitable version."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- expected json /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a/android_gradle_build.json file is not present, will remove stale json folder"
|
||||
"message": "Trying to locate CMake in local SDK repository."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- missing previous command file /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a/build_command.txt, will remove stale json folder"
|
||||
"message": "CMake \u00273.10.2\u0027 found in SDK did not match requested version \u00273.6.0\u0027."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- command changed from previous, will remove stale json folder"
|
||||
"message": "- CMake found in SDK at \u0027/home/smartdrone/Android/Sdk/cmake/3.6.4111459\u0027 had version \u00273.6.0\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "removing stale contents from \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "created folder \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "executing cmake Executable : /home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/cmake\narguments : \n-H/home/smartdrone/Working_Private/rosettadrone_work/app\n-B/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a\n-DANDROID_ABI\u003darm64-v8a\n-DANDROID_PLATFORM\u003dandroid-22\n-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003d/home/smartdrone/Working_Private/rosettadrone_work/app/build/intermediates/cmake/debug/obj/arm64-v8a\n-DCMAKE_BUILD_TYPE\u003dDebug\n-DANDROID_NDK\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147\n-DCMAKE_TOOLCHAIN_FILE\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147/build/cmake/android.toolchain.cmake\n-DCMAKE_MAKE_PROGRAM\u003d/home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/ninja\n-GAndroid Gradle - Ninja\njvmArgs : \n\n"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "Executable : /home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/cmake\narguments : \n-H/home/smartdrone/Working_Private/rosettadrone_work/app\n-B/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a\n-DANDROID_ABI\u003darm64-v8a\n-DANDROID_PLATFORM\u003dandroid-22\n-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003d/home/smartdrone/Working_Private/rosettadrone_work/app/build/intermediates/cmake/debug/obj/arm64-v8a\n-DCMAKE_BUILD_TYPE\u003dDebug\n-DANDROID_NDK\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147\n-DCMAKE_TOOLCHAIN_FILE\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147/build/cmake/android.toolchain.cmake\n-DCMAKE_MAKE_PROGRAM\u003d/home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/ninja\n-GAndroid Gradle - Ninja\njvmArgs : \n\n"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "done executing cmake"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "write build output /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a/build_output.txt"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "write command file /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a/build_command.txt"
|
||||
"message": "JSON \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/arm64-v8a/android_gradle_build.json\u0027 was up-to-date"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
|
||||
+1
-21
@@ -1,21 +1 @@
|
||||
[1/2] Building C object CMakeFiles/djivideojni.dir/src/main/cpp/dji_video_jni.c.o
|
||||
In file included from /home/smartdrone/Working_Private/rosettadrone_work/app/src/main/cpp/dji_video_jni.c:4:
|
||||
In file included from ../../../../src/main/cpp/ffmpeg.h:34:
|
||||
In file included from ../../../../src/main/cpp/cmdutils.h:28:
|
||||
In file included from ../../../../src/main/cpp/include/libavcodec/avcodec.h:31:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/samplefmt.h:24:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/avutil.h:289:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/common.h:401:
|
||||
In file included from ../../../../src/main/cpp/include/libavutil/mem.h:33:
|
||||
../../../../src/main/cpp/include/libavutil/error.h:121:5: warning: non-constant static local variable in inline function may be different in different files [-Wstatic-local-in-inline]
|
||||
static char str[AV_ERROR_MAX_STRING_SIZE];
|
||||
^
|
||||
../../../../src/main/cpp/include/libavutil/error.h:119:1: note: use 'static' to give inline function 'av_err2str' internal linkage
|
||||
av_always_inline char *av_err2str(int errnum) {
|
||||
^
|
||||
static
|
||||
../../../../src/main/cpp/include/libavutil/attributes.h:37:30: note: expanded from macro 'av_always_inline'
|
||||
# define av_always_inline __attribute__((always_inline)) inline
|
||||
^
|
||||
1 warning generated.
|
||||
[2/2] Linking C shared library ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libdjivideojni.so
|
||||
ninja: no work to do.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"sdkFolder": "/home/smartdrone/Android/Sdk",
|
||||
"isNativeCompilerSettingsCacheEnabled": false,
|
||||
"isBuildOnlyTargetAbiEnabled": true,
|
||||
"ideBuildTargetAbi": "arm64-v8a,armeabi-v7a,armeabi",
|
||||
"splitsAbiFilterSet": [],
|
||||
"intermediatesFolder": "/home/smartdrone/Working_Private/rosettadrone_work/app/build/intermediates",
|
||||
"gradleModulePathName": ":app",
|
||||
@@ -39,9 +40,8 @@
|
||||
"gradleBuildOutputFolder": "/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cxx/debug",
|
||||
"isDebuggableEnabled": true,
|
||||
"validAbiList": [
|
||||
"ARMEABI_V7A",
|
||||
"ARM64_V8A",
|
||||
"X86"
|
||||
"ARMEABI_V7A"
|
||||
],
|
||||
"buildTargetSet": []
|
||||
},
|
||||
|
||||
@@ -5,63 +5,7 @@
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "No CMake version was specified in build.gradle. Choosing a suitable version."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "Trying to locate CMake in local SDK repository."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "CMake \u00273.10.2\u0027 found in SDK did not match requested version \u00273.6.0\u0027."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- CMake found in SDK at \u0027/home/smartdrone/Android/Sdk/cmake/3.6.4111459\u0027 had version \u00273.6.0\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "rebuilding JSON /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a/android_gradle_build.json due to:"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- expected json /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a/android_gradle_build.json file is not present, will remove stale json folder"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- missing previous command file /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a/build_command.txt, will remove stale json folder"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- command changed from previous, will remove stale json folder"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "removing stale contents from \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "created folder \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "executing cmake Executable : /home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/cmake\narguments : \n-H/home/smartdrone/Working_Private/rosettadrone_work/app\n-B/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a\n-DANDROID_ABI\u003darmeabi-v7a\n-DANDROID_PLATFORM\u003dandroid-22\n-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003d/home/smartdrone/Working_Private/rosettadrone_work/app/build/intermediates/cmake/debug/obj/armeabi-v7a\n-DCMAKE_BUILD_TYPE\u003dDebug\n-DANDROID_NDK\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147\n-DCMAKE_TOOLCHAIN_FILE\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147/build/cmake/android.toolchain.cmake\n-DCMAKE_MAKE_PROGRAM\u003d/home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/ninja\n-GAndroid Gradle - Ninja\njvmArgs : \n\n"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "Executable : /home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/cmake\narguments : \n-H/home/smartdrone/Working_Private/rosettadrone_work/app\n-B/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a\n-DANDROID_ABI\u003darmeabi-v7a\n-DANDROID_PLATFORM\u003dandroid-22\n-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003d/home/smartdrone/Working_Private/rosettadrone_work/app/build/intermediates/cmake/debug/obj/armeabi-v7a\n-DCMAKE_BUILD_TYPE\u003dDebug\n-DANDROID_NDK\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147\n-DCMAKE_TOOLCHAIN_FILE\u003d/home/smartdrone/Android/Sdk/ndk/21.3.6528147/build/cmake/android.toolchain.cmake\n-DCMAKE_MAKE_PROGRAM\u003d/home/smartdrone/Android/Sdk/cmake/3.6.4111459/bin/ninja\n-GAndroid Gradle - Ninja\njvmArgs : \n\n"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "done executing cmake"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "write build output /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a/build_output.txt"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "write command file /home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a/build_command.txt"
|
||||
"message": "JSON \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/armeabi-v7a/android_gradle_build.json\u0027 was up-to-date"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
|
||||
@@ -3,22 +3,6 @@
|
||||
"level": "INFO",
|
||||
"message": "Start JSON generation. Platform version: 22 min SDK version: x86"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "No CMake version was specified in build.gradle. Choosing a suitable version."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "Trying to locate CMake in local SDK repository."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "CMake \u00273.10.2\u0027 found in SDK did not match requested version \u00273.6.0\u0027."
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "- CMake found in SDK at \u0027/home/smartdrone/Android/Sdk/cmake/3.6.4111459\u0027 had version \u00273.6.0\u0027"
|
||||
},
|
||||
{
|
||||
"level": "INFO",
|
||||
"message": "JSON \u0027/home/smartdrone/Working_Private/rosettadrone_work/app/.cxx/cmake/debug/x86/android_gradle_build.json\u0027 was up-to-date"
|
||||
|
||||
@@ -187,7 +187,7 @@ public class DroneModel implements CommonCallbacks.CompletionCallback {
|
||||
private boolean mSafetyEnabled = true;
|
||||
private boolean mMotorsArmed = false;
|
||||
private FollowMeMissionOperator fmmo;
|
||||
private FlightController mFlightController;
|
||||
public FlightController mFlightController;
|
||||
private Gimbal mGimbal = null;
|
||||
private Rotation mRotation = null;
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
private AMap aMap;
|
||||
private double droneLocationLat, droneLocationLng;
|
||||
private Marker droneMarker = null;
|
||||
private FlightController mFlightController;
|
||||
// private FlightController mFlightController;
|
||||
|
||||
private static BaseProduct mProduct;
|
||||
private final String TAG = MainActivity.class.getSimpleName();
|
||||
@@ -270,6 +270,7 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
|
||||
//------------------------------------------------------------
|
||||
videostreamPreviewTtView = findViewById(R.id.livestream_preview_ttv);
|
||||
videostreamPreviewTtViewSmall = findViewById(R.id.livestream_preview_ttv_small);
|
||||
videostreamPreviewTtView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -454,8 +455,7 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
//aMap.setOnMapClickListener(this);// add the listener for click for amap object
|
||||
}
|
||||
|
||||
|
||||
LatLng coordinate = new LatLng(22.5362, 113.9454);
|
||||
LatLng coordinate = new LatLng(60.4094, 10.4911);
|
||||
|
||||
if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
|
||||
coordinate = new LatLng(droneLocationLat, droneLocationLng);
|
||||
@@ -464,36 +464,17 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
aMap.addMarker(new MarkerOptions().position(coordinate));
|
||||
aMap.getUiSettings().setZoomControlsEnabled(false);
|
||||
aMap.moveCamera(CameraUpdateFactory.newLatLng(coordinate));
|
||||
|
||||
}
|
||||
|
||||
private void initFlightController() {
|
||||
// setResultToToast(droneLocationLat+"----"+droneLocationLng);
|
||||
|
||||
BaseProduct product;
|
||||
|
||||
if (RDApplication.getSim() == true) {
|
||||
product = DJISimulatorApplication.getAircraftInstance();
|
||||
}else {
|
||||
product = RDApplication.getProductInstance();
|
||||
}
|
||||
|
||||
if (product != null && product.isConnected()) {
|
||||
if (product instanceof Aircraft) {
|
||||
mFlightController = ((Aircraft) product).getFlightController();
|
||||
}
|
||||
}
|
||||
|
||||
if (mFlightController != null) {
|
||||
mFlightController.setStateCallback(
|
||||
new FlightControllerState.Callback() {
|
||||
@Override
|
||||
public void onUpdate(FlightControllerState djiFlightControllerCurrentState) {
|
||||
droneLocationLat = djiFlightControllerCurrentState.getAircraftLocation().getLatitude();
|
||||
droneLocationLng = djiFlightControllerCurrentState.getAircraftLocation().getLongitude();
|
||||
updateDroneLocation();
|
||||
|
||||
}
|
||||
if (mModel.mFlightController != null) {
|
||||
mModel.mFlightController.setStateCallback(
|
||||
djiFlightControllerCurrentState -> {
|
||||
droneLocationLat = djiFlightControllerCurrentState.getAircraftLocation().getLatitude();
|
||||
droneLocationLng = djiFlightControllerCurrentState.getAircraftLocation().getLongitude();
|
||||
updateDroneLocation();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -505,6 +486,7 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
private void updateDroneLocation(){
|
||||
|
||||
LatLng pos = new LatLng(droneLocationLat, droneLocationLng);
|
||||
|
||||
//Create MarkerOptions object
|
||||
final MarkerOptions markerOptions = new MarkerOptions();
|
||||
markerOptions.position(pos);
|
||||
@@ -737,17 +719,17 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
//When calibration is needed or the fetch key frame is required by SDK, should use the provideTranscodedVideoFeed
|
||||
//to receive the transcoded video feed from main camera.
|
||||
if (isTranscodedVideoFeedNeeded()) {
|
||||
mGstEnabled = false;
|
||||
standardVideoFeeder = VideoFeeder.getInstance().provideTranscodedVideoFeed();
|
||||
if (mExternalVideoOut == true) {
|
||||
standardVideoFeeder.addVideoDataListener(mReceivedVideoDataListener);
|
||||
mGstEnabled = false;
|
||||
logMessageDJI("Transcode Video !!!!!!!");
|
||||
}
|
||||
}else{
|
||||
mGstEnabled = true;
|
||||
VideoFeeder.getInstance().getPrimaryVideoFeed();
|
||||
if (mExternalVideoOut == true) {
|
||||
VideoFeeder.getInstance().getPrimaryVideoFeed().addVideoDataListener(mReceivedVideoDataListener);
|
||||
mGstEnabled = true;
|
||||
logMessageDJI("Do NOT Transcode Video !!!!!!!");
|
||||
}
|
||||
}
|
||||
@@ -1142,7 +1124,7 @@ public class MainActivity extends AppCompatActivity implements DJICodecManager.Y
|
||||
livestream_view.setVisibility(View.GONE);
|
||||
livestream_view_small.setVisibility(View.VISIBLE);
|
||||
|
||||
if (compare_height==0 && mCodecManager != null){
|
||||
if (compare_height==0 && mCodecManager != null && mGstEnabled == true){
|
||||
mCodecManager.cleanSurface();
|
||||
mCodecManager.destroyCodec();
|
||||
videoViewHeight = ((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 86, getResources().getDisplayMetrics()));
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
package sq.rogue.rosettadrone.settings;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -18,17 +12,9 @@ import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/* import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||
import com.google.android.gms.maps.CameraUpdate;
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.MapsInitializer;
|
||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;*/
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMap.OnMapClickListener;
|
||||
@@ -45,12 +31,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import dji.common.error.DJIError;
|
||||
import dji.common.flightcontroller.FlightControllerState;
|
||||
import dji.common.mission.waypoint.Waypoint;
|
||||
import dji.common.mission.waypoint.WaypointMission;
|
||||
import dji.common.mission.waypoint.WaypointMissionDownloadEvent;
|
||||
@@ -59,20 +40,28 @@ import dji.common.mission.waypoint.WaypointMissionFinishedAction;
|
||||
import dji.common.mission.waypoint.WaypointMissionFlightPathMode;
|
||||
import dji.common.mission.waypoint.WaypointMissionHeadingMode;
|
||||
import dji.common.mission.waypoint.WaypointMissionUploadEvent;
|
||||
import dji.common.useraccount.UserAccountState;
|
||||
import dji.common.util.CommonCallbacks;
|
||||
import dji.sdk.base.BaseProduct;
|
||||
import dji.sdk.flightcontroller.FlightController;
|
||||
import dji.sdk.mission.waypoint.WaypointMissionOperator;
|
||||
import dji.sdk.mission.waypoint.WaypointMissionOperatorListener;
|
||||
import dji.sdk.products.Aircraft;
|
||||
import dji.sdk.sdkmanager.DJISDKManager;
|
||||
import dji.sdk.useraccount.UserAccountManager;
|
||||
import sq.rogue.rosettadrone.DJISimulatorApplication;
|
||||
import sq.rogue.rosettadrone.MainActivity;
|
||||
import sq.rogue.rosettadrone.R;
|
||||
import sq.rogue.rosettadrone.RDApplication;
|
||||
|
||||
/* import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||
import com.google.android.gms.maps.CameraUpdate;
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.MapsInitializer;
|
||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;*/
|
||||
|
||||
public class GaodeActivity extends FragmentActivity implements View.OnClickListener, OnMapClickListener {
|
||||
private static final String TAG = GaodeActivity.class.getSimpleName();
|
||||
|
||||
@@ -153,7 +142,7 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
}
|
||||
|
||||
|
||||
LatLng coordinate = new LatLng(22.5362, 113.9454);
|
||||
LatLng coordinate = new LatLng(60.4094, 10.4911);
|
||||
|
||||
if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
|
||||
coordinate = new LatLng(droneLocationLat, droneLocationLng);
|
||||
@@ -222,14 +211,11 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
|
||||
if (mFlightController != null) {
|
||||
mFlightController.setStateCallback(
|
||||
new FlightControllerState.Callback() {
|
||||
@Override
|
||||
public void onUpdate(FlightControllerState djiFlightControllerCurrentState) {
|
||||
droneLocationLat = djiFlightControllerCurrentState.getAircraftLocation().getLatitude();
|
||||
droneLocationLng = djiFlightControllerCurrentState.getAircraftLocation().getLongitude();
|
||||
updateDroneLocation();
|
||||
djiFlightControllerCurrentState -> {
|
||||
droneLocationLat = djiFlightControllerCurrentState.getAircraftLocation().getLatitude();
|
||||
droneLocationLng = djiFlightControllerCurrentState.getAircraftLocation().getLongitude();
|
||||
updateDroneLocation();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -246,18 +232,15 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
markerOptions.position(pos);
|
||||
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.aircraft));
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (droneMarker != null) {
|
||||
droneMarker.remove();
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
if (droneMarker != null) {
|
||||
droneMarker.remove();
|
||||
}
|
||||
|
||||
// setResultToToast(droneLocationLat+"----"+droneLocationLng);
|
||||
if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
|
||||
if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
|
||||
// setResultToToast("小飞机标识");
|
||||
droneMarker = aMap.addMarker(markerOptions);
|
||||
}
|
||||
droneMarker = aMap.addMarker(markerOptions);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -275,13 +258,7 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
break;
|
||||
}
|
||||
case R.id.clear: {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
aMap.clear();
|
||||
}
|
||||
|
||||
});
|
||||
runOnUiThread(() -> aMap.clear());
|
||||
waypointList.clear();
|
||||
waypointMissionBuilder.waypointList(waypointList);
|
||||
updateDroneLocation();
|
||||
@@ -330,12 +307,7 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
}
|
||||
|
||||
private void setResultToToast(final String string){
|
||||
GaodeActivity.this.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(GaodeActivity.this, string, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
GaodeActivity.this.runOnUiThread(() -> Toast.makeText(GaodeActivity.this, string, Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -360,15 +332,12 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
|
||||
private void uploadWayPointMission(){
|
||||
|
||||
getWaypointMissionOperator().uploadMission(new CommonCallbacks.CompletionCallback() {
|
||||
@Override
|
||||
public void onResult(DJIError error) {
|
||||
if (error == null) {
|
||||
setResultToToast("Mission upload successfully!");
|
||||
} else {
|
||||
setResultToToast("Mission upload failed, error: " + error.getDescription() + " retrying...");
|
||||
getWaypointMissionOperator().retryUploadMission(null);
|
||||
}
|
||||
getWaypointMissionOperator().uploadMission(error -> {
|
||||
if (error == null) {
|
||||
setResultToToast("Mission upload successfully!");
|
||||
} else {
|
||||
setResultToToast("Mission upload failed, error: " + error.getDescription() + " retrying...");
|
||||
getWaypointMissionOperator().retryUploadMission(null);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -391,78 +360,57 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
RadioGroup actionAfterFinished_RG = (RadioGroup) wayPointSettings.findViewById(R.id.actionAfterFinished);
|
||||
RadioGroup heading_RG = (RadioGroup) wayPointSettings.findViewById(R.id.heading);
|
||||
|
||||
speed_RG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId == R.id.lowSpeed){
|
||||
mSpeed = 3.0f;
|
||||
} else if (checkedId == R.id.MidSpeed){
|
||||
mSpeed = 5.0f;
|
||||
} else if (checkedId == R.id.HighSpeed){
|
||||
mSpeed = 10.0f;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
actionAfterFinished_RG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
Log.d(TAG, "Select finish action");
|
||||
if (checkedId == R.id.finishNone){
|
||||
mFinishedAction = WaypointMissionFinishedAction.NO_ACTION;
|
||||
} else if (checkedId == R.id.finishGoHome){
|
||||
mFinishedAction = WaypointMissionFinishedAction.GO_HOME;
|
||||
} else if (checkedId == R.id.finishAutoLanding){
|
||||
mFinishedAction = WaypointMissionFinishedAction.AUTO_LAND;
|
||||
} else if (checkedId == R.id.finishToFirst){
|
||||
mFinishedAction = WaypointMissionFinishedAction.GO_FIRST_WAYPOINT;
|
||||
}
|
||||
speed_RG.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
if (checkedId == R.id.lowSpeed){
|
||||
mSpeed = 3.0f;
|
||||
} else if (checkedId == R.id.MidSpeed){
|
||||
mSpeed = 5.0f;
|
||||
} else if (checkedId == R.id.HighSpeed){
|
||||
mSpeed = 10.0f;
|
||||
}
|
||||
});
|
||||
|
||||
heading_RG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
actionAfterFinished_RG.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
Log.d(TAG, "Select finish action");
|
||||
if (checkedId == R.id.finishNone){
|
||||
mFinishedAction = WaypointMissionFinishedAction.NO_ACTION;
|
||||
} else if (checkedId == R.id.finishGoHome){
|
||||
mFinishedAction = WaypointMissionFinishedAction.GO_HOME;
|
||||
} else if (checkedId == R.id.finishAutoLanding){
|
||||
mFinishedAction = WaypointMissionFinishedAction.AUTO_LAND;
|
||||
} else if (checkedId == R.id.finishToFirst){
|
||||
mFinishedAction = WaypointMissionFinishedAction.GO_FIRST_WAYPOINT;
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
Log.d(TAG, "Select heading");
|
||||
heading_RG.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
Log.d(TAG, "Select heading");
|
||||
|
||||
if (checkedId == R.id.headingNext) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.AUTO;
|
||||
} else if (checkedId == R.id.headingInitDirec) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.USING_INITIAL_DIRECTION;
|
||||
} else if (checkedId == R.id.headingRC) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER;
|
||||
} else if (checkedId == R.id.headingWP) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.USING_WAYPOINT_HEADING;
|
||||
}
|
||||
if (checkedId == R.id.headingNext) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.AUTO;
|
||||
} else if (checkedId == R.id.headingInitDirec) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.USING_INITIAL_DIRECTION;
|
||||
} else if (checkedId == R.id.headingRC) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER;
|
||||
} else if (checkedId == R.id.headingWP) {
|
||||
mHeadingMode = WaypointMissionHeadingMode.USING_WAYPOINT_HEADING;
|
||||
}
|
||||
});
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("")
|
||||
.setView(wayPointSettings)
|
||||
.setPositiveButton("Finish",new DialogInterface.OnClickListener(){
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
String altitudeString = wpAltitude_TV.getText().toString();
|
||||
altitude = Integer.parseInt(nulltoIntegerDefault(altitudeString));
|
||||
Log.e(TAG,"altitude "+altitude);
|
||||
Log.e(TAG,"speed "+mSpeed);
|
||||
Log.e(TAG, "mFinishedAction "+mFinishedAction);
|
||||
Log.e(TAG, "mHeadingMode "+mHeadingMode);
|
||||
configWayPointMission();
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
.setPositiveButton("Finish", (dialog, id) -> {
|
||||
|
||||
String altitudeString = wpAltitude_TV.getText().toString();
|
||||
altitude = Integer.parseInt(nulltoIntegerDefault(altitudeString));
|
||||
Log.e(TAG,"altitude "+altitude);
|
||||
Log.e(TAG,"speed "+mSpeed);
|
||||
Log.e(TAG, "mFinishedAction "+mFinishedAction);
|
||||
Log.e(TAG, "mHeadingMode "+mHeadingMode);
|
||||
configWayPointMission();
|
||||
})
|
||||
.setNegativeButton("Cancel", (dialog, id) -> dialog.cancel())
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
@@ -567,24 +515,12 @@ public class GaodeActivity extends FragmentActivity implements View.OnClickListe
|
||||
};
|
||||
|
||||
private void startWaypointMission(){
|
||||
|
||||
getWaypointMissionOperator().startMission(new CommonCallbacks.CompletionCallback() {
|
||||
@Override
|
||||
public void onResult(DJIError error) {
|
||||
setResultToToast("Mission Start: " + (error == null ? "Successfully" : error.getDescription()));
|
||||
}
|
||||
});
|
||||
getWaypointMissionOperator().startMission(error -> setResultToToast("Mission Start: " + (error == null ? "Successfully" : error.getDescription())));
|
||||
|
||||
}
|
||||
|
||||
private void stopWaypointMission(){
|
||||
|
||||
getWaypointMissionOperator().stopMission(new CommonCallbacks.CompletionCallback() {
|
||||
@Override
|
||||
public void onResult(DJIError error) {
|
||||
setResultToToast("Mission Stop: " + (error == null ? "Successfully" : error.getDescription()));
|
||||
}
|
||||
});
|
||||
getWaypointMissionOperator().stopMission(error -> setResultToToast("Mission Stop: " + (error == null ? "Successfully" : error.getDescription())));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#FFFFFF"
|
||||
tools:context="sq.rogue.rosettadrone.settings.GaodeActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/locate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Locate"
|
||||
android:layout_weight="1"/>
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Add"
|
||||
android:layout_weight="1"/>
|
||||
<Button
|
||||
android:id="@+id/clear"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Clear"
|
||||
android:layout_weight="1"/>
|
||||
<Button
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Exit"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/config"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Config"
|
||||
android:layout_weight="0.9"/>
|
||||
<Button
|
||||
android:id="@+id/upload"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Upload"
|
||||
android:layout_weight="0.9"/>
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start"
|
||||
android:layout_weight="1"/>
|
||||
<Button
|
||||
android:id="@+id/stop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Stop"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<com.amap.api.maps.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Referência em uma Nova Issue
Bloquear um usuário