Browse Source

Merge branch 'master' of http://47.96.250.93:3000/adc_pilot/modularization

lijinliang 4 years ago
parent
commit
0a39607e15

+ 185 - 0
src/ui/ADCIntelligentShow_grpc/ADCIntelligentShow_grpc_android.pro

@@ -0,0 +1,185 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2018-09-04T15:11:28
+#
+#-------------------------------------------------
+
+QT       += core gui xml
+QT  += multimedia
+
+QT += androidextras
+
+DEFINES += Android
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets network
+
+TARGET = ADCIntelligentShow_grpc
+TEMPLATE = app
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which has been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+DEFINES += PROTOBUF_USE_DLLS
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+
+SOURCES += \
+    ../../driver/driver_grpc_client/grpcclientthread.cpp \
+    ../../driver/driver_grpc_client/ivgrpc.grpc.pb.cc \
+    ../../driver/driver_grpc_client/ivgrpc.pb.cc \
+    ../../include/msgtype/brainstate.pb.cc \
+    ../../include/msgtype/decition.pb.cc \
+    ../../include/msgtype/gps.pb.cc \
+    ../../include/msgtype/gpsimu.pb.cc \
+    ../../include/msgtype/hmi.pb.cc \
+    ../../include/msgtype/imu.pb.cc \
+    ../../include/msgtype/radarobject.pb.cc \
+    ../../include/msgtype/radarobjectarray.pb.cc \
+    ivmapview.cpp \
+    ivview.cpp \
+        main.cpp \
+    adcintelligentshow.cpp \
+    myview.cpp
+
+HEADERS += \
+#        ../../decition/common/common/gps_type.h \
+        ../../driver/driver_grpc_client/grpcclientthread.h \
+        ../../driver/driver_grpc_client/ivgrpc.grpc.pb.h \
+        ../../driver/driver_grpc_client/ivgrpc.pb.h \
+        ../../include/msgtype/brainstate.pb.h \
+        ../../include/msgtype/decition.pb.h \
+        ../../include/msgtype/gps.pb.h \
+        ../../include/msgtype/gpsimu.pb.h \
+        ../../include/msgtype/hmi.pb.h \
+        ../../include/msgtype/imu.pb.h \
+        ../../include/msgtype/radarobject.pb.h \
+        ../../include/msgtype/radarobjectarray.pb.h \
+        adcintelligentshow.h \
+        gps_nbtype.h \
+        ivmapview.h \
+        ivview.h \
+        myview.h \
+        pos_def.h
+
+FORMS += \
+        adcintelligentshow.ui
+
+RESOURCES += \
+    adcintelligentshow.qrc
+#LIBS            +=  $$PWD/libprotobuf.lib
+
+
+win32: DEFINES +=  _WIN32_WINNT=0x0602
+
+
+INCLUDEPATH += $$PWD/armprotobuf
+
+INCLUDEPATH += $$PWD/yaml
+
+#INCLUDEPATH += $$PWD/armboost
+
+LIBS += -L$$PWD/armlib
+
+INCLUDEPATH += $$PWD/../../../include/
+LIBS += -L$$PWD/../bin/ -lmodulecomm   -lxmlparam  #-livlog -livfault -livexit
+
+
+INCLUDEPATH += $$PWD/../../../src/include/msgtype
+
+#LIBS += -lboost_system-clang-mt-a64-1_73  -lboost_serialization-clang-mt-a64-1_73   -lboost_thread-clang-mt-a64-1_73
+
+QMAKE_CXXFLAGS +=  -g
+
+CONFIG += c++11
+
+QMAKE_LFLAGS += -no-pie
+
+LIBS+= -lyaml-cpp -lprotobuf
+
+INCLUDEPATH += $$PWD/../src/include/msgtype
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+#!include(../../../include/ivboost.pri ) {
+#    error( "Couldn't find the ivboost.pri file!" )
+#}
+
+!include(../../../include/ivgrpc.pri ) {
+    error( "Couldn't find the ivgrpc.pri file!" )
+}
+
+!include(../../../include/ivyaml-cpp.pri ) {
+    error( "Couldn't find the ivyaml-cpp.pri file!" )
+}
+
+INCLUDEPATH += $$PWD/../../decition/common
+INCLUDEPATH += $$PWD/../../decition/common/common
+
+INCLUDEPATH += $$PWD/../../driver/driver_grpc_client
+
+#DISTFILES +=
+
+DISTFILES += \
+    android/AndroidManifest.xml \
+    android/build.gradle \
+    android/gradle/wrapper/gradle-wrapper.jar \
+    android/gradle/wrapper/gradle-wrapper.properties \
+    android/gradlew \
+    android/gradlew.bat \
+    android/res/values/libs.xml
+
+contains(ANDROID_TARGET_ARCH,arm64-v8a) {
+    ANDROID_PACKAGE_SOURCE_DIR = \
+        $$PWD/android
+
+    ANDROID_EXTRA_LIBS = \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_bad_optional_access.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_bad_variant_access.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_base.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_city.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_civil_time.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_cord.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_debugging_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_demangle_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_dynamic_annotations.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_exponential_biased.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_graphcycles_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_hash.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_hashtablez_sampler.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_int128.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_log_severity.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_malloc_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_raw_hash_set.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_raw_logging_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_spinlock_wait.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_stacktrace.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_status.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_str_format_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_strings.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_strings_internal.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_symbolize.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_synchronization.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_throw_delegate.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_time.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_time_zone.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libmodulecomm.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libprotobuf.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libyaml-cpp.so \
+        /home/yuchuli/qt/modularization/src/ui/ADCIntelligentShow_grpc/armlib/libabsl_bad_optional_access.so \
+        $$PWD/armlib/libxmlparam.so
+}
+
+unix:!macx: LIBS += -L$$PWD/armlib/ -lyaml-cpp
+
+#LIBS += -lboost_system # -lboost_serialization  -lboost_thread
+
+
+INCLUDEPATH += $$PWD/armlib
+DEPENDPATH += $$PWD/armlib

+ 18 - 0
src/ui/ADCIntelligentShow_grpc/main.cpp

@@ -68,6 +68,22 @@ void LoadPos(std::string strfilepath)
     xFile.close();
 }
 
+#ifdef Android
+
+bool requestPermission() {
+   QtAndroid::PermissionResult  r = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
+    if(r == QtAndroid::PermissionResult::Denied) {
+        QtAndroid::requestPermissionsSync( QStringList() << "android.permission.WRITE_EXTERNAL_STORAGE" );
+        r = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
+        if(r == QtAndroid::PermissionResult::Denied) {
+             return false;
+        }
+   }
+   return true;
+}
+
+#endif
+
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
@@ -75,6 +91,8 @@ int main(int argc, char *argv[])
 
 #ifdef Android
 
+    requestPermission();
+
     QAndroidJniEnvironment env;
     QAndroidJniObject activity = QtAndroid::androidActivity();