Browse Source

add RemoteCtrl_Thread_plugin. and add some plugin program.

yuchuli 3 years ago
parent
commit
74cb29df8b
63 changed files with 4468 additions and 108 deletions
  1. 1 1
      src/driver/driver_cloud_grpc_pc_thread/grpcpc.cpp
  2. 20 0
      src/plugin/Readme
  3. 3 0
      src/plugin/baidumapshow/Readme.md
  4. 8 4
      src/plugin/baidumapshow/baidumapshow.pro
  5. 42 32
      src/plugin/baidumapshow/mainwindow.cpp
  6. 23 6
      src/plugin/baidumapshow/mainwindow.h
  7. 0 33
      src/plugin/baidumapshow/plugbaidumapshow.cpp
  8. 0 24
      src/plugin/baidumapshow/plugbaidumapshow.h
  9. 75 0
      src/plugin/common/mainwindow_plugin.cpp
  10. 45 0
      src/plugin/common/mainwindow_plugin.h
  11. 7 2
      src/plugin/common/pluginapp.cpp
  12. 73 0
      src/plugin/plugin_fourpicshow/.gitignore
  13. 23 0
      src/plugin/plugin_fourpicshow/main.cpp
  14. 57 0
      src/plugin/plugin_fourpicshow/mainwindow.cpp
  15. 33 0
      src/plugin/plugin_fourpicshow/mainwindow.h
  16. 31 0
      src/plugin/plugin_fourpicshow/mainwindow.ui
  17. 47 0
      src/plugin/plugin_fourpicshow/plugin_fourpicshow.pro
  18. 73 0
      src/plugin/plugin_picshow/.gitignore
  19. 111 0
      src/plugin/plugin_picshow/ivpicview.cpp
  20. 40 0
      src/plugin/plugin_picshow/ivpicview.h
  21. 25 0
      src/plugin/plugin_picshow/ivview.cpp
  22. 34 0
      src/plugin/plugin_picshow/ivview.h
  23. 37 0
      src/plugin/plugin_picshow/main.cpp
  24. 124 0
      src/plugin/plugin_picshow/mainwindow.cpp
  25. 64 0
      src/plugin/plugin_picshow/mainwindow.h
  26. 30 0
      src/plugin/plugin_picshow/mainwindow.ui
  27. 120 0
      src/plugin/plugin_picshow/myview.cpp
  28. 35 0
      src/plugin/plugin_picshow/myview.h
  29. 56 0
      src/plugin/plugin_picshow/plugin_picshow.pro
  30. 73 0
      src/plugin/plugin_threepicshow/.gitignore
  31. 23 0
      src/plugin/plugin_threepicshow/main.cpp
  32. 50 0
      src/plugin/plugin_threepicshow/mainwindow.cpp
  33. 32 0
      src/plugin/plugin_threepicshow/mainwindow.h
  34. 31 0
      src/plugin/plugin_threepicshow/mainwindow.ui
  35. 47 0
      src/plugin/plugin_threepicshow/plugin_threepicshow.pro
  36. 24 3
      src/tool/RemoteCtrl_Thread/dialogbigpic.cpp
  37. 3 0
      src/tool/RemoteCtrl_Thread/dialogbigpic.h
  38. 0 1
      src/tool/RemoteCtrl_Thread/ivpicview.cpp
  39. 17 2
      src/tool/RemoteCtrl_Thread/mainwindow.cpp
  40. 1 0
      src/tool/RemoteCtrl_Thread/mainwindow.h
  41. 11 0
      src/tool/RemoteCtrl_Thread_plugin/RemoteCtrl.xml
  42. 118 0
      src/tool/RemoteCtrl_Thread_plugin/RemoteCtrl_Thread_plugin.pro
  43. 78 0
      src/tool/RemoteCtrl_Thread_plugin/dialogsetpassword.cpp
  44. 39 0
      src/tool/RemoteCtrl_Thread_plugin/dialogsetpassword.h
  45. 97 0
      src/tool/RemoteCtrl_Thread_plugin/dialogsetpassword.ui
  46. 54 0
      src/tool/RemoteCtrl_Thread_plugin/dialogsetting.cpp
  47. 33 0
      src/tool/RemoteCtrl_Thread_plugin/dialogsetting.h
  48. 137 0
      src/tool/RemoteCtrl_Thread_plugin/dialogsetting.ui
  49. 31 0
      src/tool/RemoteCtrl_Thread_plugin/driver_cloud_grpc_pc.yaml
  50. 161 0
      src/tool/RemoteCtrl_Thread_plugin/joyreadthread.cpp
  51. 39 0
      src/tool/RemoteCtrl_Thread_plugin/joyreadthread.h
  52. 76 0
      src/tool/RemoteCtrl_Thread_plugin/main.cpp
  53. 869 0
      src/tool/RemoteCtrl_Thread_plugin/mainwindow.cpp
  54. 195 0
      src/tool/RemoteCtrl_Thread_plugin/mainwindow.h
  55. 523 0
      src/tool/RemoteCtrl_Thread_plugin/mainwindow.ui
  56. 2 0
      src/tool/RemoteCtrl_Thread_plugin/pos.txt
  57. 16 0
      src/tool/RemoteCtrl_Thread_plugin/pos_def.h
  58. BIN
      src/tool/RemoteCtrl_Thread_plugin/remotectrl.png
  59. 5 0
      src/tool/RemoteCtrl_Thread_plugin/remotectrl.qrc
  60. 143 0
      src/tool/RemoteCtrl_Thread_plugin/remotectrlini.cpp
  61. 53 0
      src/tool/RemoteCtrl_Thread_plugin/remotectrlini.h
  62. 199 0
      src/tool/RemoteCtrl_Thread_plugin/speed.cpp
  63. 51 0
      src/tool/RemoteCtrl_Thread_plugin/speed.h

+ 1 - 1
src/driver/driver_cloud_grpc_pc_thread/grpcpc.cpp

@@ -524,7 +524,7 @@ void grpcpc::threadpicdownload(int nCamPos)
         } else {
           std::cout << status.error_code() << ": " << status.error_message()
                     << std::endl;
-          std::cout<<"RPC failed"<<std::endl;
+          std::cout<<"camera dowm"<<nCamPos<<" RPC failed"<<std::endl;
           if(status.error_code() == 4)
           {
               std::cout<<nCamPos<<" RPC Exceed Time, Create New stub_"<<std::endl;

+ 20 - 0
src/plugin/Readme

@@ -0,0 +1,20 @@
+介绍:
+plugin目录用来存放一些依赖项比较多,不好编译的模块。比如地图显示,图片显示。这些模块的界面会嵌入到其它程序界面中。
+
+使用说明:
+需要包含pluginapp类。
+定义:
+pluginapp * mpbaiduapp;
+在构造函数内:
+    mpbaiduapp = new pluginapp(this->winId(),"baidu","baidumapshow","/home/yuchuli/qt/modularization/src/plugin/build-baidumapshow-Debug"); //目录可以不写,默认为当前目录
+在析构函数内:
+delete mpbaiduapp;  //一定要执行这句,否则可能导致plugin程序不退出。
+其它地方:
+如果有调整窗口位置的需要,调用这句:
+mpbaiduapp->SetGeometry(10,30,sizemain.width()/2,sizemain.height()*3/5);
+如果由其它属性需要修改可以调用:
+SetAttr(const char *strattr, const char *strvalue, const int nvaluelen)
+
+
+
+

+ 3 - 0
src/plugin/baidumapshow/Readme.md

@@ -0,0 +1,3 @@
+1.这是一个嵌入的模块,用于使用百度地图显示车辆位置。
+2.使用pluginapp类来启动这个模块。
+3.使用的默认定位为hcp2_gpsimu,如果惯导数据的共享内存为其它名称,可以使用pluginapp的SetAttr来进行修改,attr为gpsimumsgname,value为共享内存名称。

+ 8 - 4
src/plugin/baidumapshow/baidumapshow.pro

@@ -16,15 +16,17 @@ DEFINES += QT_DEPRECATED_WARNINGS
 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 
 SOURCES += \
+    ../../include/msgtype/gpsimu.pb.cc \
     ../../include/msgtype/plugmsg.pb.cc \
+    ../common/mainwindow_plugin.cpp \
     main.cpp \
-    mainwindow.cpp \
-    plugbaidumapshow.cpp
+    mainwindow.cpp
 
 HEADERS += \
+    ../../include/msgtype/gpsimu.pb.h \
     ../../include/msgtype/plugmsg.pb.h \
-    mainwindow.h \
-    plugbaidumapshow.h
+    ../common/mainwindow_plugin.h \
+    mainwindow.h
 
 FORMS += \
     mainwindow.ui
@@ -42,3 +44,5 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
     error( "Couldn't find the ivprotobuf.pri file!" )
 }
 
+INCLUDEPATH += $$PWD/../common
+

+ 42 - 32
src/plugin/baidumapshow/mainwindow.cpp

@@ -4,30 +4,27 @@
 #include <iostream>
 
 MainWindow::MainWindow(QString strcid,QWidget *parent)
-    : QMainWindow(parent)
+    : MainWindow_plugin(parent)
     , ui(new Ui::MainWindow)
 {
     ui->setupUi(this);
 
+    MainWindow_plugin::Init(strcid,"baidumapshow");
 
     mMapview = new QWebEngineView(ui->centralwidget);
     mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
     mMapview->setGeometry(1000,100,500,500);
 
-    connect(this, SIGNAL(signalplug()) ,this,SLOT(ProcPlugMsg()));
+    connect(this,SIGNAL(signalupdategpsimu()),this,SLOT(ProcUpdateGPSIMU()));
 
-    QString strmsgname = "plugin_";
-    strmsgname = strmsgname + "baidumapshow";
-    strmsgname = strmsgname +"_"+strcid;
-
-    std::cout<<"msg name : "<<strmsgname.toStdString()<<std::endl;
-
-    ModuleFun funbaidmap = std::bind(&MainWindow::onPlugMsg,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
-    mpa = iv::modulecomm::RegisterRecvPlus(strmsgname.toLatin1().data(),funbaidmap);
+    ModuleFun fungpsimu = std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+    mpagpsimu = iv::modulecomm::RegisterRecvPlus(mstrgpsimumsgname.data(),fungpsimu);
 }
 
 MainWindow::~MainWindow()
 {
+    std::cout<<" baidumapshow ~MainWindow"<<std::endl;
+    iv::modulecomm::Unregister(mpagpsimu);
     delete ui;
 }
 
@@ -39,40 +36,53 @@ void MainWindow::resizeEvent(QResizeEvent *event)
     mMapview->setGeometry(0,0,sizemain.width(),sizemain.height());
 }
 
-void MainWindow::onPlugMsg(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
+void MainWindow::ProcPlugMsg(iv::plugin::plugmsg & xplugmsg)
+{
+
+    MainWindow_plugin::ProcPlugMsg(xplugmsg);
+
+    if(xplugmsg.strattr() == "gpsimumsgname")
+    {
+        if(xplugmsg.strvalue() != mstrgpsimumsgname)
+        {
+            mstrgpsimumsgname = xplugmsg.strvalue();
+            iv::modulecomm::Unregister(mpagpsimu);
+            ModuleFun fungpsimu = std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+            mpagpsimu = iv::modulecomm::RegisterRecvPlus(mstrgpsimumsgname.data(),fungpsimu);
+
+        }
+    }
+}
+
+void MainWindow::UpdateGPSIMU(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
 {
     (void)index;
     (void)dt;
     (void)strmemname;
-    iv::plugin::plugmsg xplugmsg;
-    std::cout<<"onPlugMsg"<<std::endl;
-    if(xplugmsg.ParseFromArray(strdata,nSize))
+    iv::gps::gpsimu xgpsimu;
+    if(xgpsimu.ParseFromArray(strdata,nSize))
     {
-        std::cout<<"signal "<<std::endl;
-        mMutexPlug.lock();
-        mplugmsg.CopyFrom(xplugmsg);
-        mMutexPlug.unlock();
-        emit signalplug();
+        mMutexgpsimu.lock();
+        mgpsimu.CopyFrom(xgpsimu);
+        mMutexgpsimu.unlock();
+        emit signalupdategpsimu();
     }
     else
     {
-        std::cout<<"MainWindow::onPlugMsg Parse Fail."<<std::endl;
+        std::cout<<"MainWindow::UpdateGPSIMU "<<" Parse error."<<std::endl;
     }
 }
 
-void MainWindow::ProcPlugMsg()
+void MainWindow::ProcUpdateGPSIMU()
 {
+    iv::gps::gpsimu xgpsimu;
+    mMutexgpsimu.lock();
+    xgpsimu.CopyFrom(mgpsimu);
+    mMutexgpsimu.unlock();
+
+    char strscript[256];
+    snprintf(strscript,255,"theLocation(%11.7f,%11.7f,%11.3f);",xgpsimu.lon(),xgpsimu.lat(),xgpsimu.heading());
+    mMapview->page()->runJavaScript(strscript);
 
-    iv::plugin::plugmsg xplugmsg;
-    mMutexPlug.lock();
-    xplugmsg.CopyFrom(mplugmsg);
-    mMutexPlug.unlock();
-    std::cout<<" x name "<<xplugmsg.strattr()<<std::endl;
-    if(xplugmsg.strattr() == "geometry")
-    {
-        int x,y,w,h;
-        sscanf(xplugmsg.strvalue().data(), "%d %d %d %d",&x,&y,&w,&h);
-        setGeometry(x,y,w,h);
-    }
 }
 

+ 23 - 6
src/plugin/baidumapshow/mainwindow.h

@@ -1,6 +1,7 @@
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
+#include "mainwindow_plugin.h"
 #include <QMainWindow>
 #include <QMutex>
 
@@ -9,12 +10,13 @@
 #include "modulecomm.h"
 
 #include "plugmsg.pb.h"
+#include "gpsimu.pb.h"
 
 QT_BEGIN_NAMESPACE
 namespace Ui { class MainWindow; }
 QT_END_NAMESPACE
 
-class MainWindow : public QMainWindow
+class MainWindow : public MainWindow_plugin
 {
     Q_OBJECT
 
@@ -26,25 +28,40 @@ private:
     Ui::MainWindow *ui;
 
 signals:
-    void signalplug();
+//    void signalplug();
+    void signalupdategpsimu();
 
 
 private slots:
-    void ProcPlugMsg();
+ //
+    void ProcUpdateGPSIMU();
 
 private:
     QWebEngineView * mMapview;
 
     void  * mpa;
+    void * mpagpsimu;
+
+private:
+    virtual void ProcPlugMsg(iv::plugin::plugmsg & xplugmsg);
 
 public:
      void resizeEvent(QResizeEvent *event);
 
 private:
-     void onPlugMsg(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
+//     void onPlugMsg(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
+
+     void UpdateGPSIMU(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
 
 private:
-     iv::plugin::plugmsg  mplugmsg;
-     QMutex mMutexPlug;
+//     iv::plugin::plugmsg  mplugmsg;
+//     QMutex mMutexPlug;
+
+     iv::gps::gpsimu mgpsimu;
+     QMutex mMutexgpsimu;
+
+     std::string mstrgpsimumsgname = "hcp2_gpsimu";
+
+
 };
 #endif // MAINWINDOW_H

+ 0 - 33
src/plugin/baidumapshow/plugbaidumapshow.cpp

@@ -1,33 +0,0 @@
-#include "plugbaidumapshow.h"
-
-plugbaidumapshow::plugbaidumapshow(WId parentwinid, QString strappname,const char * strdir)
-{
-   QString strapppath;
-   if(strdir == NULL)strapppath = strappname;
-   else
-   {
-       strapppath = strdir;
-       strapppath = strapppath + "/" + strappname;
-   }
-
-   mproc = new QProcess();
-   QStringList xarg;
-   xarg.push_back(QString::number(parentwinid));
-   mproc->start(strapppath,xarg);
-
-   QString strmsgname = "plugin-" + strappname;
-   mpa = iv::modulecomm::RegisterSend(strmsgname.toLatin1().data(),1000,1);
-
-}
-
-plugbaidumapshow::~plugbaidumapshow()
-{
-    iv::modulecomm::Unregister(mpa);
-    mproc->terminate();
-    mproc->waitForFinished(100);
-}
-
-void plugbaidumapshow::SetGeometry(int x, int y, int w, int h)
-{
-
-}

+ 0 - 24
src/plugin/baidumapshow/plugbaidumapshow.h

@@ -1,24 +0,0 @@
-#ifndef PLUGBAIDUMAPSHOW_H
-#define PLUGBAIDUMAPSHOW_H
-
-#include <QWidget>
-#include <QProcess>
-
-#include "modulecomm.h"
-
-class plugbaidumapshow
-{
-public:
-    plugbaidumapshow( WId parentwinid,  QString strappname,const char * strdir = NULL);
-    ~plugbaidumapshow();
-
-private:
-    QProcess * mproc;
-    void * mpa;
-
-
-public:
-    void SetGeometry(int x, int y,int w,int h);
-};
-
-#endif // PLUGBAIDUMAPSHOW_H

+ 75 - 0
src/plugin/common/mainwindow_plugin.cpp

@@ -0,0 +1,75 @@
+#include "mainwindow_plugin.h"
+
+#include <iostream>
+
+MainWindow_plugin::MainWindow_plugin(QWidget *parent)
+    : QMainWindow(parent)
+{
+
+}
+
+MainWindow_plugin::~MainWindow_plugin()
+{
+    if(mpa != NULL)iv::modulecomm::Unregister(mpa);
+}
+
+void MainWindow_plugin::Init(QString strcid,QString strappname)
+{
+
+    connect(this, SIGNAL(signalplug()) ,this,SLOT(slotProcPlugMsg()));
+
+    QString strmsgname = "plugin_";
+    strmsgname = strmsgname + strappname;
+    strmsgname = strmsgname +"_"+strcid;
+
+    std::cout<<"msg name : "<<strmsgname.toStdString()<<std::endl;
+
+    ModuleFun funbaidmap = std::bind(&MainWindow_plugin::onPlugMsg,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+    mpa = iv::modulecomm::RegisterRecvPlus(strmsgname.toLatin1().data(),funbaidmap);
+}
+
+void MainWindow_plugin::onPlugMsg(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
+{
+    (void)index;
+    (void)dt;
+    (void)strmemname;
+    iv::plugin::plugmsg xplugmsg;
+//    std::cout<<"onPlugMsg"<<std::endl;
+    if(xplugmsg.ParseFromArray(strdata,nSize))
+    {
+//        std::cout<<"signal "<<std::endl;
+        mMutexPlug.lock();
+        mplugmsg.CopyFrom(xplugmsg);
+        mMutexPlug.unlock();
+        emit signalplug();
+    }
+    else
+    {
+        std::cout<<"MainWindow::onPlugMsg Parse Fail."<<std::endl;
+    }
+}
+
+void MainWindow_plugin::ProcPlugMsg(iv::plugin::plugmsg & xplugmsg)
+{
+
+//    std::cout<<"use parent proc"<<std::endl;
+
+//    std::cout<<" x name "<<xplugmsg.strattr()<<std::endl;
+    if(xplugmsg.strattr() == "geometry")
+    {
+        int x,y,w,h;
+        sscanf(xplugmsg.strvalue().data(), "%d %d %d %d",&x,&y,&w,&h);
+        setGeometry(x,y,w,h);
+    }
+
+}
+
+void MainWindow_plugin::slotProcPlugMsg()
+{
+    iv::plugin::plugmsg xplugmsg;
+    mMutexPlug.lock();
+    xplugmsg.CopyFrom(mplugmsg);
+    mMutexPlug.unlock();
+    ProcPlugMsg(xplugmsg);
+}
+

+ 45 - 0
src/plugin/common/mainwindow_plugin.h

@@ -0,0 +1,45 @@
+#ifndef MAINWINDOW_PLUGIN_H
+#define MAINWINDOW_PLUGIN_H
+
+#include <QMainWindow>
+
+
+#include <QMutex>
+
+
+#include "modulecomm.h"
+
+#include "plugmsg.pb.h"
+
+class MainWindow_plugin : public QMainWindow
+{
+    Q_OBJECT
+public:
+    MainWindow_plugin(QWidget *parent);
+    ~MainWindow_plugin();
+
+signals:
+    void signalplug();
+
+private slots:
+    void slotProcPlugMsg();
+
+private:
+    void  * mpa = NULL;
+
+
+public:
+     virtual void ProcPlugMsg(iv::plugin::plugmsg & xplugmsg);
+
+public:
+     void Init(QString strcid,QString strappname);
+
+public:
+     virtual void onPlugMsg(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
+
+private:
+     iv::plugin::plugmsg  mplugmsg;
+     QMutex mMutexPlug;
+};
+
+#endif // MAINWINDOW_PLUGIN_H

+ 7 - 2
src/plugin/common/pluginapp.cpp

@@ -16,7 +16,7 @@ pluginapp::pluginapp(WId parentwinid, QString cid,QString strappname,const char
    }
 
    QString strmsgname = "plugin_" + strappname+"_"+cid;
-   mpa = iv::modulecomm::RegisterSend(strmsgname.toLatin1().data(),1000,1);
+   mpa = iv::modulecomm::RegisterSend(strmsgname.toLatin1().data(),10000,100);
 
    mproc = new QProcess();
    connect(mproc,SIGNAL(readyReadStandardOutput()),this,SLOT(onReadStandardOut()));
@@ -88,11 +88,16 @@ void pluginapp::onProcStarted()
 
 void pluginapp::onTimer()
 {
+    mpTimer->stop();
     mbStarted = true;
     if(mvectormsg.size()>0)
     {
         std::cout<<"write msg"<<std::endl;
-        SetAttr(mvectormsg[mvectormsg.size()-1].strattr().data(),mvectormsg[mvectormsg.size()-1].strvalue().data(),mvectormsg[mvectormsg.size()-1].strvalue().size());
+        unsigned int i;
+        for(i=0;i<mvectormsg.size();i++)
+        {
+            SetAttr(mvectormsg[i].strattr().data(),mvectormsg[i].strvalue().data(),mvectormsg[i].strvalue().size());
+        }
         mvectormsg.clear();
     }
 }

+ 73 - 0
src/plugin/plugin_fourpicshow/.gitignore

@@ -0,0 +1,73 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+

+ 23 - 0
src/plugin/plugin_fourpicshow/main.cpp

@@ -0,0 +1,23 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    if(argc == 3)
+     {
+        qDebug("argc == 3");
+         QApplication a(argc, argv);
+
+         QString strcid = argv[2];
+         MainWindow w(strcid);
+         w.show();//最后调用show,提前调用qt会为其生成窗口控件,这样就会和你原本想要嵌入进的父进程界面产生冲突
+
+
+         return a.exec();
+     }
+    QApplication a(argc, argv);
+    MainWindow w("");
+    w.show();
+    return a.exec();
+}

+ 57 - 0
src/plugin/plugin_fourpicshow/mainwindow.cpp

@@ -0,0 +1,57 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QString strcid,QWidget *parent)
+    : MainWindow_plugin(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+    MainWindow_plugin::Init(strcid,"plugin_fourpicshow");
+
+    mppicshowCenter = new pluginapp(this->winId(),"four_front","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+    mppicshowLeft = new pluginapp(this->winId(),"four_left","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowLeft->SetAttr("rawpicmsgname","picleft",strnlen("picleft",256));
+    mppicshowLeft->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowLeft->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+    mppicshowRight = new pluginapp(this->winId(),"four_right","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowRight->SetAttr("rawpicmsgname","picright",strnlen("picright",256));
+    mppicshowRight->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowRight->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+    mppicshowRear = new pluginapp(this->winId(),"four_rear","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowRear->SetAttr("rawpicmsgname","picright",strnlen("picright",256));
+    mppicshowRear->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowRear->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete mppicshowRear;
+    delete mppicshowRight;
+    delete mppicshowLeft;
+    delete mppicshowCenter;
+    delete ui;
+}
+
+void MainWindow::resizeEvent(QResizeEvent *event)
+{
+    (void )event;
+    QSize sizemain = ui->centralwidget->size();
+
+    double fwidth = sizemain.width()/1;
+    double fheight = sizemain.height()/1;
+
+
+    qDebug("width : %f ",fwidth);
+    mppicshowCenter->SetGeometry(0,0,fwidth/2,fheight/2);
+    mppicshowRear->SetGeometry(fwidth/2,0,fwidth/2,fheight/2);
+    mppicshowLeft->SetGeometry(0,fheight/2,fwidth/2,fheight/2);
+    mppicshowRight->SetGeometry(fwidth/2,fheight/2,fwidth/2,fheight/2);
+}
+

+ 33 - 0
src/plugin/plugin_fourpicshow/mainwindow.h

@@ -0,0 +1,33 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "mainwindow_plugin.h"
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+#include "pluginapp.h"
+
+class MainWindow : public MainWindow_plugin
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QString strcid,QWidget *parent = nullptr);
+    ~MainWindow();
+
+public:
+     void resizeEvent(QResizeEvent *event);
+
+private:
+    Ui::MainWindow *ui;
+
+    pluginapp * mppicshowCenter;
+    pluginapp * mppicshowLeft;
+    pluginapp * mppicshowRight;
+    pluginapp * mppicshowRear;
+};
+#endif // MAINWINDOW_H

+ 31 - 0
src/plugin/plugin_fourpicshow/mainwindow.ui

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1366</width>
+    <height>768</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1366</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 47 - 0
src/plugin/plugin_fourpicshow/plugin_fourpicshow.pro

@@ -0,0 +1,47 @@
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked 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
+
+# You can also make your code fail to compile if it uses 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 += \
+    ../../include/msgtype/plugmsg.pb.cc \
+    ../common/mainwindow_plugin.cpp \
+    ../common/pluginapp.cpp \
+    main.cpp \
+    mainwindow.cpp
+
+HEADERS += \
+    ../../include/msgtype/plugmsg.pb.h \
+    ../common/mainwindow_plugin.h \
+    ../common/pluginapp.h \
+    mainwindow.h
+
+FORMS += \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+INCLUDEPATH += $$PWD/../../plugin/common
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}

+ 73 - 0
src/plugin/plugin_picshow/.gitignore

@@ -0,0 +1,73 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+

+ 111 - 0
src/plugin/plugin_picshow/ivpicview.cpp

@@ -0,0 +1,111 @@
+#include "ivpicview.h"
+
+#include <QDateTime>
+
+#include <opencv2/opencv.hpp>
+#include <opencv2/core.hpp>
+
+#ifdef NVIDIA_AGX
+#include <opencv2/imgcodecs/legacy/constants_c.h>    //OpenCV4 use this line
+#include <opencv2/imgproc/types_c.h>   //OpenCV4 use this line
+#endif
+
+#define VIEW_WIDTH 640
+#define VIEW_HEIGHT 360
+
+IVPicView::IVPicView()
+{
+    mimagepaint = new QImage(VIEW_WIDTH, VIEW_HEIGHT, QImage::Format_RGB32);//画布的初始化大小设为300*300,使用32位颜色
+}
+
+void IVPicView::run()
+{
+    while(!QThread::isInterruptionRequested())
+    {
+        if(mnReadIndex != mnWriteIndex)
+        {
+            paint();
+            mnReadIndex = mnWriteIndex;
+            mbImageUpdate = true;
+        }
+        else
+        {
+            msleep(10);
+        }
+    }
+}
+
+
+
+void IVPicView::paint()
+{
+    iv::vision::rawpic pic;
+    mMutex.lock();
+    pic.CopyFrom(mrawpic);
+    mMutex.unlock();
+
+    cv::Mat mat(pic.height(),pic.width(),pic.mattype());
+
+    if(pic.type() == 1)
+        memcpy(mat.data,pic.picdata().data(),mat.rows*mat.cols*mat.elemSize());
+    else
+    {
+//        qDebug("jpg");
+        std::vector<unsigned char> buff(pic.picdata().data(),pic.picdata().data()+pic.picdata().size());
+        mat = cv::imdecode(buff,CV_LOAD_IMAGE_COLOR);
+        int font = cv::FONT_HERSHEY_DUPLEX;
+        QDateTime xrecvtime = QDateTime::fromMSecsSinceEpoch(pic.time());
+ //       char strtext[256];
+  //      snprintf(strtext,"%s",xrecvtime.toString("yyyy-MM-dd hh:mm:ss:zzz").toLatin1().data());
+        std::string strtext = xrecvtime.toString("yyyy-MM-dd hh:mm:ss:zzz").toStdString();
+        double fratio = pic.width()/640;
+        cv::putText(mat,strtext,cv::Point(pic.width() - 230*fratio,30*fratio),font,0.5*fratio,cv::Scalar(0,255,0),0.5*fratio);
+    }
+
+    cv::cvtColor(mat, mat, CV_BGR2RGB);
+    QImage image2 = QImage((uchar*)(mat.data), mat.cols, mat.rows,  QImage::Format_RGB888);
+
+    mMutexPaint.lock();
+
+//    delete mimagepaint;
+//    mimagepaint = new  QImage(mat.cols, mat.rows,  QImage::Format_RGB888);
+    *mimagepaint = image2.copy();
+    //  *mimagepaint = image2;
+ //   mimagepaint = new QImage(image2);
+    mMutexPaint.unlock();
+
+    mat.release();
+
+    emit painterupadate();
+}
+
+QImage IVPicView::GetImage()
+{
+
+    mMutexPaint.lock();
+//    QImage imagertn(*mimagepaint);
+//    QImage imagertn(mimagepaint->width(), mimagepaint->height(), QImage::Format_RGB32);
+    QImage imagertn = mimagepaint->copy();
+    mMutexPaint.unlock();
+    mbImageUpdate = false;
+    return imagertn;
+}
+
+bool IVPicView::IsHaveNew()
+{
+    return mbImageUpdate;
+}
+
+int IVPicView::GetType()
+{
+    return 2;
+}
+
+void IVPicView::SetPic(iv::vision::rawpic pic)
+{
+    mMutex.lock();
+    mrawpic.CopyFrom(pic);
+    mnWriteIndex++;
+    mMutex.unlock();
+}
+

+ 40 - 0
src/plugin/plugin_picshow/ivpicview.h

@@ -0,0 +1,40 @@
+#ifndef IVPICVIEW_H
+#define IVPICVIEW_H
+
+#include "ivview.h"
+
+#include "rawpic.pb.h"
+
+class IVPicView : public IVView
+{
+    Q_OBJECT
+public:
+    IVPicView();
+
+public:
+    QImage GetImage();
+    bool IsHaveNew();
+    int GetType();
+private:
+    void run();
+    int mnWriteIndex = 0;
+    int mnReadIndex = 0;
+
+private:
+    bool mbImageUpdate = false;
+    QMutex mMutex;
+    QMutex mMutexPaint;
+
+private:
+    void paint();
+    QImage * mimagepaint;
+signals:
+    void painterupadate();
+
+private:
+    iv::vision::rawpic mrawpic;
+public:
+    void SetPic(iv::vision::rawpic pic);
+};
+
+#endif // IVPICVIEW_H

+ 25 - 0
src/plugin/plugin_picshow/ivview.cpp

@@ -0,0 +1,25 @@
+#include "ivview.h"
+
+IVView::IVView()
+{
+
+
+}
+
+QImage IVView::GetImage()
+{
+    QImage * pimage = new QImage(100,100,QImage::Format_RGB32);
+    return *pimage;
+
+
+}
+
+bool IVView::IsHaveNew()
+{
+    return false;
+}
+
+int IVView::GetType()
+{
+    return 0;
+}

+ 34 - 0
src/plugin/plugin_picshow/ivview.h

@@ -0,0 +1,34 @@
+#ifndef IVVIEW_H
+#define IVVIEW_H
+
+#include <QImage>
+#include <QGraphicsScene>
+#include <QTimer>
+#include <QPainter>
+
+#include <QThread>
+
+#include <QMutex>
+
+//#include <pcl/conversions.h>
+//#include <pcl/point_cloud.h>
+//#include <pcl/point_types.h>
+
+
+class IVView : public QThread
+{
+public:
+    IVView();  
+
+public:
+    virtual QImage GetImage();
+    virtual bool IsHaveNew();
+    virtual int GetType();
+
+private:
+
+
+
+};
+
+#endif // IVVIEW_H

+ 37 - 0
src/plugin/plugin_picshow/main.cpp

@@ -0,0 +1,37 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+
+#include <QWindow>
+
+int main(int argc, char *argv[])
+{
+    if(argc == 3)
+     {
+        qDebug("argc == 3");
+         QApplication a(argc, argv);
+
+         QString strcid = argv[2];
+         MainWindow w(strcid);
+//         w.show();
+         //end
+
+         WId wid = WId(QString(argv[1]).toInt());//通过参数列表获取父进程窗口的WinId
+         QWindow *window = QWindow::fromWinId(wid);//获取父进程窗口
+
+         w.setProperty("_q_embedded_native_parent_handle", QVariant(wid));//设置属性,这句是必须的
+
+         w.winId();//必须调用一次,生成winId
+         w.windowHandle()->setParent(window);//设置父窗口
+         w.show();//最后调用show,提前调用qt会为其生成窗口控件,这样就会和你原本想要嵌入进的父进程界面产生冲突
+//         w.setGeometry(100,30,600,600);
+
+         fprintf(stderr, "%lld", w.winId());//写入标准错误输出,stderr能立即输出,stdout则不行
+
+         return a.exec();
+     }
+    QApplication a(argc, argv);
+    MainWindow w("");
+    w.show();
+    return a.exec();
+}

+ 124 - 0
src/plugin/plugin_picshow/mainwindow.cpp

@@ -0,0 +1,124 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+#include <iostream>
+
+MainWindow::MainWindow(QString strcid,QWidget *parent)
+    : MainWindow_plugin(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+
+    MainWindow_plugin::Init(strcid,"plugin_picshow");
+
+    mpPicView = new IVPicView();
+    mpPicView->start();
+    connect(mpPicView,SIGNAL(painterupadate()),this,SLOT(onPainterUpdate()));
+
+    mmyview = new MyView(ui->centralwidget);
+    mmyview->setObjectName(QStringLiteral("graphicsView"));
+    mmyview->setGeometry(QRect(30, 30, 600, 600));
+
+    mmyview->setCacheMode(mmyview->CacheBackground);
+
+    mscene = new QGraphicsScene;
+
+
+
+    ModuleFun funrawpic = std::bind(&MainWindow::UpdateRawPic,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+    mparawpic = iv::modulecomm::RegisterRecvPlus(mstrrawpicmsgname.data(),funrawpic);
+
+    connect(this,SIGNAL(signalrawpic()),this,SLOT(ProcUpdaterawpic()));
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::resizeEvent(QResizeEvent *event)
+{
+    QSize sizemain = ui->centralwidget->size();
+
+    mmyview->setGeometry(0,0,sizemain.width(),sizemain.height());
+}
+
+void MainWindow::UpdateRawPic(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
+{
+    (void)index;
+    (void)dt;
+    (void)strmemname;
+
+    iv::vision::rawpic xrawpic;
+    if(xrawpic.ParseFromArray(strdata,nSize))
+    {
+        mMutexrawpic.lock();
+        mrawpic.CopyFrom(xrawpic);
+        mMutexrawpic.unlock();
+        emit signalrawpic();
+    }
+    else
+    {
+        std::cout<<"MainWindow::UpdateRawPic parse fail"<<std::endl;
+    }
+}
+
+void MainWindow::ProcUpdaterawpic()
+{
+    iv::vision::rawpic xrawpic;
+    mMutexrawpic.lock();
+    xrawpic.CopyFrom(mrawpic);
+    mMutexrawpic.unlock();
+
+    mpPicView->SetPic(xrawpic);
+
+}
+
+void MainWindow::onPainterUpdate()
+{
+    mbDraw = true;
+    update();
+}
+
+void MainWindow::paintEvent(QPaintEvent * e)
+{
+    (void)e;
+    if(mbDraw)
+    {
+        mbDraw = false;
+        if(!mpPicView->IsHaveNew())
+        {
+
+        }
+        else
+        {
+            QImage image = mpPicView->GetImage();
+            mscene->clear();
+            mscene->addPixmap(QPixmap::fromImage(image));
+            mmyview->setScene(mscene);
+            mmyview->show();
+        }
+    }
+}
+
+void MainWindow::ProcPlugMsg(iv::plugin::plugmsg & xplugmsg)
+{
+
+    MainWindow_plugin::ProcPlugMsg(xplugmsg);
+
+
+    if(xplugmsg.strattr() == "rawpicmsgname")
+    {
+ //       std::cout<<"rawpic msg"<<std::endl;
+        if(xplugmsg.strvalue() != mstrrawpicmsgname)
+        {
+            mstrrawpicmsgname = xplugmsg.strvalue();
+            iv::modulecomm::Unregister(mparawpic);
+            ModuleFun funrawpic = std::bind(&MainWindow::UpdateRawPic,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+            mparawpic = iv::modulecomm::RegisterRecvPlus(mstrrawpicmsgname.data(),funrawpic);
+
+        }
+    }
+}
+

+ 64 - 0
src/plugin/plugin_picshow/mainwindow.h

@@ -0,0 +1,64 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QMutex>
+
+#include "mainwindow_plugin.h"
+
+#include "ivpicview.h"
+#include "myview.h"
+
+#include "rawpic.pb.h"
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class MainWindow : public MainWindow_plugin
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QString strcid,QWidget *parent = nullptr);
+    ~MainWindow();
+
+private:
+    Ui::MainWindow *ui;
+
+public:
+     void resizeEvent(QResizeEvent *event);
+
+signals:
+    void signalrawpic();
+
+
+private slots:
+ //
+    void ProcUpdaterawpic();
+    void onPainterUpdate();
+    virtual void paintEvent(QPaintEvent *);
+
+public:
+    virtual void ProcPlugMsg(iv::plugin::plugmsg & xplugmsg);
+
+private:
+     MyView * mmyview;
+     QGraphicsScene *mscene;
+     IVPicView * mpPicView;
+
+private:
+     iv::vision::rawpic mrawpic;
+     QMutex mMutexrawpic;
+
+     bool mbDraw = false;
+     void * mparawpic;
+
+private:
+     std::string mstrrawpicmsgname = "image00";
+
+private:
+     void UpdateRawPic(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
+
+};
+#endif // MAINWINDOW_H

+ 30 - 0
src/plugin/plugin_picshow/mainwindow.ui

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 120 - 0
src/plugin/plugin_picshow/myview.cpp

@@ -0,0 +1,120 @@
+#include "myview.h"
+#include <QScrollBar>
+#include <iostream>
+#define VIEW_CENTER viewport()->rect().center()
+const double PI = 3.1415926535898;
+
+MyView::MyView(QWidget *parent) :
+     QGraphicsView(parent),
+    beishu(1.00000)
+{
+    setDragMode(QGraphicsView::ScrollHandDrag);
+}
+
+void MyView::mousePressEvent(QMouseEvent *event)
+{
+//    qDebug("x is %d",event->pos().x());
+    bottonstatus = true;
+    QGraphicsView::mousePressEvent(event);
+}
+void MyView::mouseMoveEvent(QMouseEvent *event)
+{
+    QGraphicsView::mouseMoveEvent(event);
+//    QScrollBar * ps = verticalScrollBar();
+//    std::cout<<" size is "<<ps->size().height()<<" v = "<<ps->value()<<std::endl;
+//    QScrollBar * ps2= horizontalScrollBar();
+//     std::cout<<" size is "<<ps2->size().width()<<" h = "<<ps2->value()<<std::endl;
+}
+void MyView::mouseReleaseEvent(QMouseEvent *event)
+{
+    bottonstatus = false;
+    QGraphicsView::mouseReleaseEvent(event);
+}
+
+// 放大/缩小
+void MyView::wheelEvent(QWheelEvent *event)
+{
+    // 滚轮的滚动量
+    QPoint scrollAmount = event->angleDelta();
+    // 正值表示滚轮远离使用者(放大),负值表示朝向使用者(缩小)
+    scrollAmount.y() > 0 ? zoomIn() : zoomOut();
+}
+
+
+// 放大
+void MyView::zoomIn()
+{
+
+    int width,hgt;
+    width = sceneRect().width();
+    hgt = sceneRect().height();
+    QScrollBar * psV = verticalScrollBar();
+    QScrollBar * psH = horizontalScrollBar();
+
+    int centery = (psV->value() + psV->size().height()/2)/beishu;
+    int centerx = (psH->value() + psH->size().width()/2)/beishu;
+
+    scale(1.1, 1.1);
+    beishu *= 1.1;
+ //   centerOn(450, 700 - (200 / beishu));
+
+
+
+
+
+    centerOn(centerx,centery);
+
+//    QPoint x = viewport()->rect().center();
+
+
+//    std::cout<<" x is"<<sceneRect().bottom()<<" y is "<<sceneRect().y()<<std::endl;
+//    QScrollBar * ps = verticalScrollBar();
+//    std::cout<<" size is "<<ps->size().height()<<" v = "<<ps->value()<<std::endl;
+
+}
+
+// 缩小
+void MyView::zoomOut()
+{
+
+    int width,hgt;
+    width = sceneRect().width();
+    hgt = sceneRect().height();
+    QScrollBar * psV = verticalScrollBar();
+    QScrollBar * psH = horizontalScrollBar();
+
+    int centery = (psV->value() + psV->size().height()/2)/beishu;
+    int centerx = (psH->value() + psH->size().width()/2)/beishu;
+
+    scale(1 / 1.1, 1 / 1.1);
+    beishu /= 1.1;
+//    centerOn(450, 700 - (200 / beishu));
+
+    centerOn(centerx,centery);
+}
+
+void MyView::mouseDoubleClickEvent(QMouseEvent *event)
+{
+
+    QScrollBar * psV = verticalScrollBar();
+    QScrollBar * psH = horizontalScrollBar();
+
+    int centery = (psV->value() + psV->size().height()/2)/beishu;
+    int centerx = (psH->value() + psH->size().width()/2)/beishu;
+
+
+//    qDebug("x is %d y is %d view center x is %d  centerx is %d",event->pos().x(),
+//           event->pos().y(),
+//           viewport()->rect().center().x(),centerx);
+
+    int viewx,viewy;
+    if(beishu == 0)return;
+    viewx = centerx +(event->pos().x() - viewport()->rect().center().x())/beishu;
+    viewy = centery +(event->pos().y() - viewport()->rect().center().y())/beishu;
+
+    QPoint viewpoint;
+    viewpoint.setX(viewx);
+    viewpoint.setY(viewy);
+
+//    qDebug("view x is %d view y is %d ",viewx,viewy);
+}

+ 35 - 0
src/plugin/plugin_picshow/myview.h

@@ -0,0 +1,35 @@
+#ifndef MYVIEW_H
+#define MYVIEW_H
+
+#include <qtimer.h>
+#include <qpainter.h>
+#include <QGraphicsView>
+#include <QWheelEvent>
+#include <QKeyEvent>
+#include <QPoint>
+#include <QPointF>
+#include <QGraphicsItem>
+#include <QKeyEvent>
+
+class MyView : public QGraphicsView
+{
+    Q_OBJECT
+
+public:
+    explicit MyView(QWidget *parent =0);
+    qreal x, y, beishu;
+protected:
+    void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
+    void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+    void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+    void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+    void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+public Q_SLOTS:
+    void zoomIn();  // 放大
+    void zoomOut();  // 缩小
+private:
+    bool bottonstatus = false;
+    QPoint myview_lastMousePos;
+};
+
+#endif // MYVIEW_H

+ 56 - 0
src/plugin/plugin_picshow/plugin_picshow.pro

@@ -0,0 +1,56 @@
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked 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
+
+# You can also make your code fail to compile if it uses 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 += \
+    ../../include/msgtype/plugmsg.pb.cc \
+    ../../include/msgtype/rawpic.pb.cc \
+    ../common/mainwindow_plugin.cpp \
+    ivpicview.cpp \
+    ivview.cpp \
+    main.cpp \
+    mainwindow.cpp \
+    myview.cpp
+
+HEADERS += \
+    ../../include/msgtype/plugmsg.pb.h \
+    ../../include/msgtype/rawpic.pb.h \
+    ../common/mainwindow_plugin.h \
+    ivpicview.h \
+    ivview.h \
+    mainwindow.h \
+    myview.h
+
+FORMS += \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+LIBS += -lopencv_highgui -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lopencv_video  -lopencv_videoio -lpthread #-lopencv_shape
+
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+INCLUDEPATH += $$PWD/../common

+ 73 - 0
src/plugin/plugin_threepicshow/.gitignore

@@ -0,0 +1,73 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+

+ 23 - 0
src/plugin/plugin_threepicshow/main.cpp

@@ -0,0 +1,23 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    if(argc == 3)
+     {
+        qDebug("argc == 3");
+         QApplication a(argc, argv);
+
+         QString strcid = argv[2];
+         MainWindow w(strcid);
+         w.show();//最后调用show,提前调用qt会为其生成窗口控件,这样就会和你原本想要嵌入进的父进程界面产生冲突
+
+
+         return a.exec();
+     }
+    QApplication a(argc, argv);
+    MainWindow w("");
+    w.show();
+    return a.exec();
+}

+ 50 - 0
src/plugin/plugin_threepicshow/mainwindow.cpp

@@ -0,0 +1,50 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QString strcid,QWidget *parent)
+    : MainWindow_plugin(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+    MainWindow_plugin::Init(strcid,"plugin_threepicshow");
+
+    mppicshowCenter = new pluginapp(this->winId(),"big_center","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+    mppicshowLeft = new pluginapp(this->winId(),"big_left","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowLeft->SetAttr("rawpicmsgname","picleft",strnlen("picleft",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+    mppicshowRight = new pluginapp(this->winId(),"big_right","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshowRight->SetAttr("rawpicmsgname","picright",strnlen("picright",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+    mppicshowCenter->SetAttr("rawpicmsgname","picfront",strnlen("picfront",256));
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete mppicshowRight;
+    delete mppicshowLeft;
+    delete mppicshowCenter;
+    delete ui;
+}
+
+void MainWindow::resizeEvent(QResizeEvent *event)
+{
+    (void )event;
+    QSize sizemain = ui->centralwidget->size();
+
+    double fwidth = sizemain.width()/1;
+    double fheight = sizemain.height()/1;
+
+
+    qDebug("width : %f ",fwidth);
+    mppicshowCenter->SetGeometry(fwidth/4,0,fwidth/2,fheight);
+    mppicshowLeft->SetGeometry(0,0,fwidth/4,fheight/2);
+    mppicshowRight->SetGeometry(fwidth*3/4,0,fwidth/4,fheight/2);
+}
+

+ 32 - 0
src/plugin/plugin_threepicshow/mainwindow.h

@@ -0,0 +1,32 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "mainwindow_plugin.h"
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+#include "pluginapp.h"
+
+class MainWindow : public MainWindow_plugin
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QString strcid,QWidget *parent = nullptr);
+    ~MainWindow();
+
+public:
+     void resizeEvent(QResizeEvent *event);
+
+private:
+    Ui::MainWindow *ui;
+
+    pluginapp * mppicshowCenter;
+    pluginapp * mppicshowLeft;
+    pluginapp * mppicshowRight;
+};
+#endif // MAINWINDOW_H

+ 31 - 0
src/plugin/plugin_threepicshow/mainwindow.ui

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1920</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget"/>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1920</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 47 - 0
src/plugin/plugin_threepicshow/plugin_threepicshow.pro

@@ -0,0 +1,47 @@
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked 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
+
+# You can also make your code fail to compile if it uses 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 += \
+    ../../include/msgtype/plugmsg.pb.cc \
+    ../common/mainwindow_plugin.cpp \
+    ../common/pluginapp.cpp \
+    main.cpp \
+    mainwindow.cpp
+
+HEADERS += \
+    ../../include/msgtype/plugmsg.pb.h \
+    ../common/mainwindow_plugin.h \
+    ../common/pluginapp.h \
+    mainwindow.h
+
+FORMS += \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+INCLUDEPATH += $$PWD/../../plugin/common
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}

+ 24 - 3
src/tool/RemoteCtrl_Thread/dialogbigpic.cpp

@@ -5,6 +5,7 @@
 extern iv::vision::rawpic grawpic[CAMERA_NUM];
 extern qint64 gTimeRawPic[CAMERA_NUM] ;
 extern QMutex gMutexPic[CAMERA_NUM];
+extern std::string gstrmem_pic[CAMERA_NUM];
 
 
 DialogBigPic::DialogBigPic(QWidget *parent) :
@@ -55,6 +56,18 @@ DialogBigPic::DialogBigPic(QWidget *parent) :
     mpviewLeft->scale(0.4,0.4);
     mpviewRight->scale(0.4,0.4);
 
+    qDebug("wid : ",this->winId());
+
+
+    mppicshow[0] = new pluginapp(this->winId(),"big_center","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshow[0]->SetAttr("rawpicmsgname",gstrmem_pic[0].data(),gstrmem_pic[0].size());
+
+    mppicshow[1] = new pluginapp(this->winId(),"big_left","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshow[1]->SetAttr("rawpicmsgname",gstrmem_pic[1].data(),gstrmem_pic[1].size());
+
+    mppicshow[2] = new pluginapp(this->winId(),"big_right","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+    mppicshow[2]->SetAttr("rawpicmsgname",gstrmem_pic[2].data(),gstrmem_pic[2].size());
+
     QTimer * timer = new QTimer();
     connect(timer,SIGNAL(timeout()),this,SLOT(onTimerPic()));
     timer->start(10);
@@ -64,6 +77,8 @@ DialogBigPic::DialogBigPic(QWidget *parent) :
 
 DialogBigPic::~DialogBigPic()
 {
+    unsigned int i;
+    for(i=0;i<3;i++)delete mppicshow[i];
     delete ui;
 }
 
@@ -188,9 +203,15 @@ void DialogBigPic::resizeEvent(QResizeEvent *event)
      double fwidth = rect.width()/1;
      double fheight = rect.height()/1;
  //    mpview->setGeometry(0,0,fwidth,fheight);
-     mpview->setGeometry(fwidth/4,0,fwidth/2,fheight);
-     mpviewLeft->setGeometry(0,0,fwidth/4,fheight/2);
-     mpviewRight->setGeometry(fwidth*3/4,0,fwidth/4,fheight/2);
+//     mpview->setGeometry(fwidth/4,0,fwidth/2,fheight);
+//     mpviewLeft->setGeometry(0,0,fwidth/4,fheight/2);
+//     mpviewRight->setGeometry(fwidth*3/4,0,fwidth/4,fheight/2);
+
+
+     qDebug("width : %f ",fwidth);
+     mppicshow[0]->SetGeometry(fwidth/4,0,fwidth/2,fheight);
+     mppicshow[1]->SetGeometry(0,0,fwidth/4,fheight/2);
+     mppicshow[2]->SetGeometry(fwidth*3/4,0,fwidth/4,fheight/2);
 //     rect.setX(rect.x());
 }
 

+ 3 - 0
src/tool/RemoteCtrl_Thread/dialogbigpic.h

@@ -4,6 +4,7 @@
 #include <QDialog>
 
 
+#include "pluginapp.h"
 
 namespace Ui {
 class DialogBigPic;
@@ -62,6 +63,8 @@ private:
     int mnCamera = 0;
 
     bool mbFront = true;  //if false, rear drive
+
+    pluginapp * mppicshow[3];
 };
 
 #endif // DIALOGBIGPIC_H

+ 0 - 1
src/tool/RemoteCtrl_Thread/ivpicview.cpp

@@ -50,7 +50,6 @@ void IVPicView::paint()
         memcpy(mat.data,pic.picdata().data(),mat.rows*mat.cols*mat.elemSize());
     else
     {
-
 //        qDebug("jpg");
         std::vector<unsigned char> buff(pic.picdata().data(),pic.picdata().data()+pic.picdata().size());
         mat = cv::imdecode(buff,CV_LOAD_IMAGE_COLOR);

+ 17 - 2
src/tool/RemoteCtrl_Thread/mainwindow.cpp

@@ -219,7 +219,10 @@ MainWindow::MainWindow(QWidget *parent)
 
 
 
-    mpbaiduapp = new pluginapp(this->winId(),"baidu","baidumapshow","/home/yuchuli/qt/modularization/src/plugin/build-baidumapshow-Debug");
+//    mpbaiduapp = new pluginapp(this->winId(),"baidu","baidumapshow","/home/yuchuli/qt/modularization/src/plugin/build-baidumapshow-Debug");
+//    mppicshow = new pluginapp(this->winId(),"main","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+
+//    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[0].data(),gstrmem_pic[0].size());
 
     setWindowTitle(mstrProgName +mstrVIN+  mstrGPSTime + mstrPicTime);
 
@@ -228,6 +231,8 @@ MainWindow::MainWindow(QWidget *parent)
 MainWindow::~MainWindow()
 {
 
+//    delete mppicshow;
+//    delete mpbaiduapp;
     delete ui;
 }
 
@@ -296,10 +301,12 @@ void MainWindow::resizeEvent(QResizeEvent *event)
 
     mMapview->setGeometry(10,10,sizemain.width()/2,sizemain.height()*3/5);
 
-    mpbaiduapp->SetGeometry(10,30,sizemain.width()/2,sizemain.height()*3/5);
+//    mpbaiduapp->SetGeometry(10,30,sizemain.width()/2,sizemain.height()*3/5);
 
     mmyview->setGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
 
+//    mppicshow->SetGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
+
     ui->lineEdit_lat->setGeometry(sizemain.width()-100,10,90,30);
     ui->lineEdit_lon->setGeometry(sizemain.width()-100,50,90,30);
     ui->pushButton_test->setGeometry(sizemain.width()-100,90,90,30);
@@ -806,25 +813,30 @@ void MainWindow::on_radioButton_Rear_clicked()
 
 void MainWindow::on_radioButton_picfront_clicked()
 {
+
     mnSelPic = 0;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
     mpbigpicdlg->setCamera(mnSelPic);
 }
 
 void MainWindow::on_radioButton_picrear_clicked()
 {
     mnSelPic = 1;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
     mpbigpicdlg->setCamera(mnSelPic);
 }
 
 void MainWindow::on_radioButton_picleft_clicked()
 {
     mnSelPic = 2;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
     mpbigpicdlg->setCamera(mnSelPic);
 }
 
 void MainWindow::on_radioButton_picright_clicked()
 {
     mnSelPic = 3;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
     mpbigpicdlg->setCamera(mnSelPic);
 }
 
@@ -874,6 +886,9 @@ void MainWindow::saveavi(int index)
 
 void MainWindow::on_pushButton_big_clicked()
 {
+//    pluginapp * pa  = new pluginapp(this->winId(),"main","plugin_threepicshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_threepicshow-Debug");
+
+//    return;
     mpbigpicdlg->show();
     mpbigpicdlg->setRefresh(true);
 }

+ 1 - 0
src/tool/RemoteCtrl_Thread/mainwindow.h

@@ -204,5 +204,6 @@ private:
 
 private:
     pluginapp * mpbaiduapp;
+    pluginapp * mppicshow;
 };
 #endif // MAINWINDOW_H

+ 11 - 0
src/tool/RemoteCtrl_Thread_plugin/RemoteCtrl.xml

@@ -0,0 +1,11 @@
+<xml>	
+	<node name="RemoteCtrl">
+		<param name="gpsimu" value="hcp2_gpsimu" />
+		<param name="PicFront" value="picfront" />
+		<param name="PicRear" value="picrear" />
+		<param name="PicLeft" value="picleft" />
+		<param name="PicRight" value="picright" />
+		<param name="joypath" value="/dev/input/js0" />
+		<param name="yamlpath" value="./driver_cloud_grpc_pc.yaml" />
+	</node>
+</xml>

+ 118 - 0
src/tool/RemoteCtrl_Thread_plugin/RemoteCtrl_Thread_plugin.pro

@@ -0,0 +1,118 @@
+
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+
+QT      += network
+contains(QMAKE_HOST.arch, aarch64){
+    QT       += core gui  xml #webenginewidgets    #AGX
+    DEFINES += NVIDIA_AGX
+}else{
+    QT       += core gui  xml #webenginewidgets    #x86
+}
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+
+system(protoc -I=./../../include/proto3 --cpp_out=./../../include/msgtype   ./../../include/proto3/uploadthreadmsg.proto)
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked 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
+
+# You can also make your code fail to compile if it uses 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 += \
+    ../../common/common/getinterface/get_interface.cpp \
+    ../../common/common/md5/md5_encode.cpp \
+    ../../include/msgtype/gps.pb.cc \
+    ../../include/msgtype/gpsimu.pb.cc \
+    ../../include/msgtype/imu.pb.cc \
+    ../../include/msgtype/plugmsg.pb.cc \
+    ../../include/msgtype/rawpic.pb.cc \
+    ../../include/msgtype/remotectrl.pb.cc \
+    ../../plugin/common/pluginapp.cpp \
+    dialogsetpassword.cpp \
+    dialogsetting.cpp \
+    joyreadthread.cpp \
+    main.cpp \
+    mainwindow.cpp \
+    remotectrlini.cpp \
+    speed.cpp \
+    ../../driver/driver_cloud_grpc_pc_thread/grpcpc.cpp \
+    ../../driver/driver_cloud_grpc_thread/uploadthreadmsg.grpc.pb.cc \
+    ../../include/msgtype/cloud.pb.cc \
+    ../../include/msgtype/uploadthreadmsg.pb.cc
+
+HEADERS += \
+    ../../common/common/getinterface/get_interface.h \
+    ../../common/common/md5/md5_encode.h \
+    ../../include/msgtype/gps.pb.h \
+    ../../include/msgtype/gpsimu.pb.h \
+    ../../include/msgtype/imu.pb.h \
+    ../../include/msgtype/plugmsg.pb.h \
+    ../../include/msgtype/rawpic.pb.h \
+    ../../include/msgtype/remotectrl.pb.h \
+    ../../plugin/common/pluginapp.h \
+    dialogsetpassword.h \
+    dialogsetting.h \
+    joyreadthread.h \
+    mainwindow.h \
+    pos_def.h \
+    remotectrlini.h \
+    speed.h \
+    ../../driver/driver_cloud_grpc_pc_thread/grpcpc.h \
+    ../../driver/driver_cloud_grpc_thread/uploadthreadmsg.grpc.pb.h \
+    ../../include/msgtype/cloud.pb.h \
+    ../../include/msgtype/uploadthreadmsg.pb.h
+
+FORMS += \
+    dialogsetpassword.ui \
+    dialogsetting.ui \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+INCLUDEPATH += /usr/include/opencv4
+
+
+
+INCLUDEPATH += $$PWD/../../driver/driver_cloud_grpc_pc_thread
+INCLUDEPATH += $$PWD/../../driver/driver_cloud_grpc_thread
+
+INCLUDEPATH += $$PWD/../../plugin/common
+
+
+LIBS += -lprotobuf -lyaml-cpp
+
+
+
+#INCLUDEPATH += $$PWD/../../../include/
+#LIBS += -L$$PWD/../../../bin/ -lxmlparam -lmodulecomm -livbacktrace #-livlog -livfault
+
+
+RESOURCES += \
+    remotectrl.qrc
+
+LIBS += -lboost_system
+
+INCLUDEPATH += $$PWD/../../../thirdpartylib/grpc/include
+
+LIBS += -L$$PWD/../../../thirdpartylib/grpc/lib
+
+
+LIBS += -lgrpc++_unsecure -lgrpc++_reflection -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_bad_variant_access -labsl_city -labsl_status -labsl_cord -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_bad_optional_access -labsl_raw_logging_internal -labsl_log_severity
+
+INCLUDEPATH += $$PWD/../../common/common/md5
+INCLUDEPATH += $$PWD/../../common/common/getinterface
+
+

+ 78 - 0
src/tool/RemoteCtrl_Thread_plugin/dialogsetpassword.cpp

@@ -0,0 +1,78 @@
+#include "dialogsetpassword.h"
+#include "ui_dialogsetpassword.h"
+
+#include <QMessageBox>
+#include <iostream>
+
+#include <remotectrlini.h>
+
+DialogSetPassWord::DialogSetPassWord(DialogSetPassWord_Type xtype,std::string strmd5, QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogSetPassWord)
+{
+    ui->setupUi(this);
+
+    mType = xtype;
+
+    if(xtype == DialogSetPassWord_Type::QUERY)
+    {
+        setWindowTitle("设置查询密码");
+    }
+
+    if(xtype == DialogSetPassWord_Type::CTRL)
+    {
+        setWindowTitle("设置控制密码");
+    }
+
+    mstrmd5 = strmd5;
+}
+
+DialogSetPassWord::~DialogSetPassWord()
+{
+    delete ui;
+}
+
+void DialogSetPassWord::on_pushButton_Set_clicked()
+{
+    std::string stroldpass = ui->lineEdit_OldPass->text().toStdString();
+    std::string strnewpass = ui->lineEdit_NewPass->text().toStdString();
+    if(stroldpass =="")
+    {
+        QMessageBox::warning(this,"Warning"," Old Pass is NULL",QMessageBox::YesAll);
+        return;
+    }
+
+    if(strnewpass == "")
+    {
+        QMessageBox::warning(this,"Warning"," New Pass is NULL",QMessageBox::YesAll);
+        return;
+    }
+
+    Md5Encode encode_obj;
+    std::string stroldmd5 = encode_obj.Encode(stroldpass);
+
+    if(stroldmd5 != mstrmd5)
+    {
+        QMessageBox::warning(this,"Warning"," Old PassWord Error",QMessageBox::YesAll);
+        return;
+    }
+
+    std::string strnewmd5 = encode_obj.Encode(strnewpass);
+
+    std::cout<<"New Pass: "<<strnewmd5<<std::endl;
+
+    if(mType == DialogSetPassWord_Type::QUERY)
+        RemoteCtrlIni::Inst().SetQueryMD5(strnewmd5);
+    else
+       ServiceRCIni.SetCtrlMD5(strnewmd5);
+
+    QMessageBox::information(this,"Info","修改密码成功",QMessageBox::YesAll);
+
+    this->accept();
+
+}
+
+void DialogSetPassWord::on_pushButton_Close_clicked()
+{
+    this->accept();
+}

+ 39 - 0
src/tool/RemoteCtrl_Thread_plugin/dialogsetpassword.h

@@ -0,0 +1,39 @@
+#ifndef DIALOGSETPASSWORD_H
+#define DIALOGSETPASSWORD_H
+
+#include <QDialog>
+
+#include "md5_encode.h"
+
+namespace Ui {
+class DialogSetPassWord;
+}
+
+enum DialogSetPassWord_Type
+{
+    QUERY,
+    CTRL
+};
+
+class DialogSetPassWord : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogSetPassWord(DialogSetPassWord_Type xtype,std::string strmd5, QWidget *parent = nullptr);
+    ~DialogSetPassWord();
+
+private slots:
+    void on_pushButton_Set_clicked();
+
+    void on_pushButton_Close_clicked();
+
+private:
+    Ui::DialogSetPassWord *ui;
+
+    std::string mstrmd5;
+
+    DialogSetPassWord_Type mType;
+};
+
+#endif // DIALOGSETPASSWORD_H

+ 97 - 0
src/tool/RemoteCtrl_Thread_plugin/dialogsetpassword.ui

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogSetPassWord</class>
+ <widget class="QDialog" name="DialogSetPassWord">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>504</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QLineEdit" name="lineEdit_NewPass">
+   <property name="geometry">
+    <rect>
+     <x>180</x>
+     <y>103</y>
+     <width>221</width>
+     <height>40</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_OldPass">
+   <property name="geometry">
+    <rect>
+     <x>180</x>
+     <y>44</y>
+     <width>221</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>60</x>
+     <y>100</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>新密码</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>60</x>
+     <y>40</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>原密码</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Set">
+   <property name="geometry">
+    <rect>
+     <x>60</x>
+     <y>200</y>
+     <width>151</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>设置</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Close">
+   <property name="geometry">
+    <rect>
+     <x>300</x>
+     <y>200</y>
+     <width>151</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>关闭</string>
+   </property>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>lineEdit_OldPass</tabstop>
+  <tabstop>lineEdit_NewPass</tabstop>
+  <tabstop>pushButton_Set</tabstop>
+  <tabstop>pushButton_Close</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>

+ 54 - 0
src/tool/RemoteCtrl_Thread_plugin/dialogsetting.cpp

@@ -0,0 +1,54 @@
+#include "dialogsetting.h"
+#include "ui_dialogsetting.h"
+
+#include <QMessageBox>
+
+#include "remotectrlini.h"
+
+DialogSetting::DialogSetting(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogSetting)
+{
+    ui->setupUi(this);
+
+
+    mstrserverip = ServiceRCIni.GetServerIP();
+    mstrserverport = ServiceRCIni.GetServerPort();
+    mstrinterval = ServiceRCIni.GetInterval();
+    mstrVIN = ServiceRCIni.GetVIN();
+
+
+    ui->lineEdit_serverip->setText(mstrserverip.data());
+    ui->lineEdit_serverport->setText(mstrserverport.data());
+    ui->lineEdit_queryinterval->setText(mstrinterval.data());
+    ui->lineEdit_VIN->setText(mstrVIN.data());
+
+
+    setWindowTitle("Set Server");
+
+}
+
+DialogSetting::~DialogSetting()
+{
+    delete ui;
+}
+
+void DialogSetting::on_pushButton_Set_clicked()
+{
+    mstrserverip = ui->lineEdit_serverip->text().toStdString();
+    mstrserverport = ui->lineEdit_serverport->text().toStdString();
+    mstrinterval = ui->lineEdit_queryinterval->text().toStdString();
+    mstrVIN = ui->lineEdit_VIN->text().toStdString();
+
+    ServiceRCIni.SetServerIP(mstrserverip);
+    ServiceRCIni.SetServerPort(mstrserverport);
+    ServiceRCIni.SetInterval(mstrinterval);
+    ServiceRCIni.SetVIN(mstrVIN);
+
+    this->accept();
+}
+
+void DialogSetting::on_pushButton_Close_clicked()
+{
+    this->reject();
+}

+ 33 - 0
src/tool/RemoteCtrl_Thread_plugin/dialogsetting.h

@@ -0,0 +1,33 @@
+#ifndef DIALOGSETTING_H
+#define DIALOGSETTING_H
+
+#include <QDialog>
+#include <QSettings>
+
+namespace Ui {
+class DialogSetting;
+}
+
+class DialogSetting : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogSetting(QWidget *parent = nullptr);
+    ~DialogSetting();
+
+private slots:
+    void on_pushButton_Set_clicked();
+
+    void on_pushButton_Close_clicked();
+
+private:
+    Ui::DialogSetting *ui;
+
+    std::string mstrserverip;
+    std::string mstrserverport;
+    std::string mstrinterval;
+    std::string mstrVIN;
+};
+
+#endif // DIALOGSETTING_H

+ 137 - 0
src/tool/RemoteCtrl_Thread_plugin/dialogsetting.ui

@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogSetting</class>
+ <widget class="QDialog" name="DialogSetting">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>594</width>
+    <height>361</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QPushButton" name="pushButton_Set">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>277</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>设置</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Close">
+   <property name="geometry">
+    <rect>
+     <x>360</x>
+     <y>281</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>关闭</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>20</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>服务器 IP</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_serverip">
+   <property name="geometry">
+    <rect>
+     <x>170</x>
+     <y>24</y>
+     <width>221</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>80</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>服务器端口</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>140</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>查询间隔(ms)</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_serverport">
+   <property name="geometry">
+    <rect>
+     <x>170</x>
+     <y>83</y>
+     <width>113</width>
+     <height>40</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_queryinterval">
+   <property name="geometry">
+    <rect>
+     <x>170</x>
+     <y>140</y>
+     <width>113</width>
+     <height>40</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_VIN">
+   <property name="geometry">
+    <rect>
+     <x>170</x>
+     <y>196</y>
+     <width>221</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>196</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>车辆识别码</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 31 - 0
src/tool/RemoteCtrl_Thread_plugin/driver_cloud_grpc_pc.yaml

@@ -0,0 +1,31 @@
+
+
+querymessage:
+
+  hcp2_gpsimu:
+    msgname: hcp2_gpsimu
+    buffersize: 10000
+    buffercount: 1
+  simpletrace:
+    msgname: simpletrace
+    buffersize: 100000
+    buffercount: 1
+
+ctrlmessage:
+  xodrdst:
+    msgname: xodrdst
+    buffersize: 1000
+    buffercount: 1
+  xodrreq:
+    msgname: xodrreq
+    buffersize: 1000
+    buffercount: 1
+    bimportant: true
+    keeptime: 3000
+  remotectrl:
+    msgname: remotectrl
+    buffersize: 1000
+    buffercount: 1
+
+
+

+ 161 - 0
src/tool/RemoteCtrl_Thread_plugin/joyreadthread.cpp

@@ -0,0 +1,161 @@
+#include "joyreadthread.h"
+
+#include <assert.h>
+#include <math.h>
+#include <algorithm>
+#include <iostream>
+#include <stdexcept>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sstream>
+#include <unistd.h>
+#include <linux/joystick.h>
+
+#include <QFile>
+
+extern std::string gstrjoy_path;
+
+JoyReadThread::JoyReadThread()
+{
+
+    if ((fd = open(gstrjoy_path.data(), O_RDONLY)) < 0)
+    {
+        mbJoyOK = false;
+      std::ostringstream str;
+//      str << filename << ": " << strerror(errno);
+//      throw std::runtime_error(str.str());
+
+    }
+    else
+    {
+      // ok
+      uint8_t num_axis   = 0;
+      uint8_t num_button = 0;
+      ioctl(fd, JSIOCGAXES,    &num_axis);
+      ioctl(fd, JSIOCGBUTTONS, &num_button);
+      axis_count   = num_axis;
+      button_count = num_button;
+
+      // Get Name
+      char name_c_str[1024];
+      if (ioctl(fd, JSIOCGNAME(sizeof(name_c_str)), name_c_str) < 0)
+      {
+          mbJoyOK = false;
+          std::ostringstream str;
+    //      str << filename << ": " << strerror(errno);
+          str << "joy:" << ": " << strerror(errno);
+  //        throw std::runtime_error(str.str());
+      }
+      else
+      {
+          orig_name = name_c_str;
+//          try {
+//              name = Glib::convert_with_fallback(name_c_str, "UTF-8", "ISO-8859-1");
+//          } catch(Glib::ConvertError& err) {
+//              std::cout << err.what() << std::endl;
+//          }
+      }
+
+//      axis_state.resize(axis_count);
+    }
+}
+
+void JoyReadThread::run()
+{
+    if(mbJoyOK == false)return;
+    while(!QThread::isInterruptionRequested())
+    {
+        struct js_event event;
+
+        ssize_t len = read(fd, &event, sizeof(event));
+
+        if(len < 0)
+        {
+//            qDebug("fail.");
+            mbJoyOK = false;
+            break;
+        }
+
+ //       if(len >0)qDebug("len = %d",len);
+
+        if(len == sizeof(js_event))
+        {
+            switch (event.number) {
+            case 0:
+                mfWheel = event.value;
+                break;
+            case 2:
+                mfAcc = event.value;
+                break;
+            case 3:
+                mfBrake = event.value;
+                break;
+            case 12:
+                if(event.value ==1 ) mnShift = 1;
+                else mnShift = 0;
+                break;
+            case 13:
+                if(event.value ==1 ) mnShift = 2;
+                else mnShift = 0;
+                break;
+            case 14:
+                if(event.value ==1 ) mnShift = 3;
+                else mnShift = 0;
+                break;
+            case 15:
+                if(event.value ==1 ) mnShift = 4;
+                else mnShift = 0;
+                break;
+            case 16:
+                if(event.value ==1 ) mnShift = 5;
+                else mnShift = 0;
+                break;
+            case 17:
+                if(event.value ==1 ) mnShift = 6;
+                else mnShift = 0;
+                break;
+            case 18:
+                if(event.value ==1 ) mnShift = -1;
+                else mnShift = 0;
+                break;
+            default:
+                break;
+            }
+            qDebug("shift = %d",mnShift);
+//            qDebug("type = %d number = %d value = %d ",event.type,event.number,event.value);
+//            qDebug("wheel:%g acc:%g brake:%g",mfWheel,mfAcc,mfBrake);
+        }
+    }
+    close(fd);
+    mbJoyOK = false;
+}
+
+bool JoyReadThread::isOK()
+{
+    return mbJoyOK;
+}
+
+double JoyReadThread::GetAcc()
+{
+    return mfAcc;
+}
+
+double JoyReadThread::GetBrake()
+{
+    return mfBrake;
+}
+
+double JoyReadThread::GetWheel()
+{
+    return mfWheel;
+}
+
+int JoyReadThread::GetShift()
+{
+    return mnShift;
+}

+ 39 - 0
src/tool/RemoteCtrl_Thread_plugin/joyreadthread.h

@@ -0,0 +1,39 @@
+#ifndef JOYREADTHREAD_H
+#define JOYREADTHREAD_H
+
+#include <QThread>
+
+#include <QFile>
+
+class JoyReadThread : public QThread
+{
+public:
+    JoyReadThread();
+
+public:
+    bool isOK();
+    double GetWheel();
+    double GetAcc();
+    double GetBrake();
+    int GetShift();
+private:
+    void run();
+
+private:
+    int fd;
+    int axis_count;
+    int button_count;
+    std::string orig_name;
+
+    QFile mxFile;
+    QFile * mpFile;
+    bool mbJoyOK = true;
+
+    double mfWheel = 0;
+    double mfAcc = 32767;
+    double mfBrake = 32767;
+
+    int mnShift = 0; //0 N >0 D -1 R
+};
+
+#endif // JOYREADTHREAD_H

+ 76 - 0
src/tool/RemoteCtrl_Thread_plugin/main.cpp

@@ -0,0 +1,76 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+#include <QList>
+
+#include <vector>
+
+#include "pos_def.h"
+
+#include "xmlparam.h"
+#include "ivversion.h"
+
+std::string gstrmem_gpsimu;
+std::string gstrmem_pic[CAMERA_NUM];
+std::string gstryaml_path;
+std::string gstrjoy_path;
+
+std::vector<iv::pos_def> gvectorpos;
+
+
+void LoadPos(std::string strfilepath)
+{
+    QFile xFile;
+    xFile.setFileName(strfilepath.data());
+    if(xFile.open(QIODevice::ReadOnly))
+    {
+        QByteArray ba = xFile.readAll();
+        QList<QByteArray> baline =  ba.split('\n');
+        int nline = baline.size();
+        int i;
+        for(i=0;i<nline;i++)
+        {
+            QList<QByteArray> badata = baline[i].split('\t');
+            if(badata.size()>=3)
+            {
+                iv::pos_def xposdef;
+                xposdef.mstrstationname = badata[0].toStdString();
+                xposdef.mflon = badata[1].toDouble();
+                xposdef.mflat = badata[2].toDouble();
+                gvectorpos.push_back(xposdef);
+
+            }
+
+        }
+    }
+    xFile.close();
+}
+
+
+#include "ivbacktrace.h"
+
+int main(int argc, char *argv[])
+{
+
+    showversion("RemoteCtl");
+    QApplication a(argc, argv);
+
+    RegisterIVBackTrace();
+
+
+
+    iv::xmlparam::Xmlparam xp("RemoteCtrl.xml");
+    gstrmem_gpsimu = xp.GetParam("gpsimu","hcp2_gpsimu");
+    gstrmem_pic[0] = xp.GetParam("PicFront","picfront");
+    gstrmem_pic[1] = xp.GetParam("PicRear","picrear");
+    gstrmem_pic[2] = xp.GetParam("PicLeft","picleft");
+    gstrmem_pic[3] = xp.GetParam("PicRight","picright");
+    gstrjoy_path = xp.GetParam("joypath","/dev/input/js0");
+    gstryaml_path = xp.GetParam("yamlpath","./driver_cloud_grpc_pc.yaml");
+
+    LoadPos("pos.txt");
+
+    MainWindow w;
+    w.show();
+    return a.exec();
+}

+ 869 - 0
src/tool/RemoteCtrl_Thread_plugin/mainwindow.cpp

@@ -0,0 +1,869 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "pos_def.h"
+
+#include "remotectrlini.h"
+
+MainWindow * gw;
+//#include "QStringLiteral"
+
+
+iv::gps::gpsimu ggpsimu;
+qint64 gTimeGPSIMUUpdate = 0;
+
+iv::vision::rawpic grawpic[CAMERA_NUM];
+qint64 gTimeRawPic[CAMERA_NUM] = {0,0,0,0};
+QMutex gMutexPic[CAMERA_NUM];
+
+extern std::string gstrmem_gpsimu;
+extern std::string gstrmem_pic[CAMERA_NUM];
+extern std::vector<iv::pos_def> gvectorpos;
+extern std::string gstryaml_path;
+
+class xodrobj
+{
+public:
+    double flatsrc;
+    double flonsrc;
+    double fhgdsrc;
+    double flat;
+    double flon;
+    int lane;
+};
+
+namespace iv {
+struct simpletrace
+{
+    double gps_lat = 0;//纬度
+    double gps_lng = 0;//经度
+
+    double gps_x = 0;
+    double gps_y = 0;
+    double gps_z = 0;
+
+
+    double ins_heading_angle = 0;	//航向角
+};
+}
+
+std::vector<iv::simpletrace> gvectorsimplerace;
+QMutex gMutexTrace;
+qint64 gTimeTrace = 0;
+
+void Listenpic(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+    if(nSize<1000)return;
+    iv::vision::rawpic pic;
+    if(false == pic.ParseFromArray(strdata,nSize))
+    {
+        std::cout<<"picview Listenpic fail."<<std::endl;
+        return;
+    }
+    int indexpic = -1;
+    for(int i =0;i<CAMERA_NUM;i++)
+    {
+        if(strncmp(strmemname,gstrmem_pic[i].data(),256) == 0)
+        {
+            indexpic = i;
+            break;
+        }
+    }
+    if(indexpic >= 0)
+    {
+    gMutexPic[indexpic].lock();
+    grawpic[indexpic].CopyFrom(pic);
+    gTimeRawPic[indexpic] = QDateTime::currentMSecsSinceEpoch();
+    gMutexPic[indexpic].unlock();
+    gw->saveavi(indexpic);
+    }
+}
+
+void Listensimpletrace(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+    int npoint = nSize/sizeof(iv::simpletrace);
+    if(npoint < 1)
+    {
+        std::cout<<"simple trace is very smalll"<<std::endl;
+        return;
+    }
+
+    gMutexTrace.lock();
+    gvectorsimplerace.clear();
+    gvectorsimplerace.resize(npoint);
+    memcpy(gvectorsimplerace.data(),strdata,npoint*sizeof(iv::simpletrace));
+    gTimeTrace = QDateTime::currentMSecsSinceEpoch();
+    gMutexTrace.unlock();
+
+
+}
+
+void Listengpsimu(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+//        ggpsimu->UpdateGPSIMU(strdata,nSize);
+
+    iv::gps::gpsimu xgpsimu;
+    if(!xgpsimu.ParseFromArray(strdata,nSize))
+    {
+        std::cout<<"ListenRaw Parse error."<<std::endl;
+    }
+    ggpsimu.CopyFrom(xgpsimu);
+    gTimeGPSIMUUpdate = QDateTime::currentMSecsSinceEpoch();
+
+}
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::MainWindow)
+{
+
+    gw = this;
+
+    ui->setupUi(this);
+
+    mstrserverip = ServiceRCIni.GetServerIP();
+    mstrserverport = ServiceRCIni.GetServerPort();
+    mstruploadinterval = ServiceRCIni.GetInterval();
+    mstrVehVIN = ServiceRCIni.GetVIN();
+    mstrqueryMD5 = ServiceRCIni.GetQueryMD5();
+    mstrctrlMD5 = ServiceRCIni.GetCtrlMD5();
+
+    mpJRT = new JoyReadThread();
+    mpJRT->start();
+
+    int i;
+
+    CreateView();
+
+
+    int nstation = gvectorpos.size();
+    for(i=0;i<nstation;i++)
+    {
+        ui->comboBox_Station->addItem(gvectorpos[i].mstrstationname.data());
+    }
+
+    ui->radioButton_auto->setChecked(true);
+
+    mpa = iv::modulecomm::RegisterSend("remotectrl",10000,1);
+
+    mpTimerManual = new QTimer(this);
+    connect(mpTimerManual,SIGNAL(timeout()),this,SLOT(onTimerManual()));
+
+    mpTimerRemote = new QTimer(this);
+    connect(mpTimerRemote,SIGNAL(timeout()),this,SLOT(onTimerRemote()));
+    mpTimerRemote->start(10);
+
+    mpTimerUpdateView = new QTimer(this);
+    connect(mpTimerUpdateView,SIGNAL(timeout()),this,SLOT(onTimerUpdateView()));
+    mpTimerUpdateView->start(1000);
+
+    QTimer * timer = new QTimer(this);
+    connect(timer,SIGNAL(timeout()),this,SLOT(onTimerUpdatePic()));
+    timer->start(10);
+
+    mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
+
+
+    mgrpcpc = new grpcpc(gstryaml_path);
+    mgrpcpc->setserverip(mstrserverip);
+    mgrpcpc->setserverport(mstrserverport);
+    mgrpcpc->setqueryinterval(mstruploadinterval);
+    mgrpcpc->setVIN(mstrVehVIN);
+    mgrpcpc->setqueryMD5(mstrqueryMD5);
+    mgrpcpc->setctrlMD5(mstrctrlMD5);
+    mgrpcpc->start();
+
+    mstrVIN = mgrpcpc->GetVIN().data();
+    mstrVIN = " VIN:"+ mstrVIN+" ";
+
+
+    QLabel * pLabel = new QLabel();
+    pLabel->setFixedWidth(600);
+    pLabel->setText("Latency");
+    mpLabelLatency = pLabel;
+    ui->statusbar->addPermanentWidget(pLabel);
+
+    mpasimpletrace = iv::modulecomm::RegisterRecv("simpletrace",Listensimpletrace);
+
+    void * pa = iv::modulecomm::RegisterRecv(gstrmem_gpsimu.data(),Listengpsimu);
+
+    for(i=0;i<CAMERA_NUM;i++)
+        pa = iv::modulecomm::RegisterRecv(gstrmem_pic[i].data(),Listenpic);
+
+
+
+    mpbaiduapp = new pluginapp(this->winId(),"baidu","baidumapshow","/home/yuchuli/qt/modularization/src/plugin/build-baidumapshow-Debug");
+    mppicshow = new pluginapp(this->winId(),"main","plugin_picshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_picshow-Debug");
+
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[0].data(),gstrmem_pic[0].size());
+
+    setWindowTitle(mstrProgName +mstrVIN+  mstrGPSTime + mstrPicTime);
+
+}
+
+MainWindow::~MainWindow()
+{
+
+    delete mppicshow;
+    delete mpbaiduapp;
+    delete ui;
+}
+
+void MainWindow::CreateView()
+{
+
+//    mMapview->page()->runJavaScript("theLocation(117.355,39.066);");  //117.355,39.066
+
+    mpWheel = new Speed(ui->groupBox_rem);
+    mpWheel->settitle(QStringLiteral("方向盘"));
+
+    mpAcc = new Speed(ui->groupBox_rem);
+
+    mpAcc->settitle(QStringLiteral("油门"));
+    mpAcc->updatevalue(0);
+    mpAcc->setminvalue(0);
+    mpAcc->setmaxvalue(100);
+
+    mpBrake = new Speed(ui->groupBox_rem);
+    mpBrake->settitle(QStringLiteral("刹车"));
+    mpBrake->updatevalue(0);
+    mpBrake->setminvalue(0);
+    mpBrake->setmaxvalue(100);
+
+
+    ui->radioButton_Null->setChecked(true);
+
+    ui->radioButton_picfront->setChecked(true);
+
+
+}
+
+
+void MainWindow::keyPressEvent(QKeyEvent *event)
+{
+
+    //按键按下,key值放入容器,如果是长按触发的repeat就不判断
+    if(!event->isAutoRepeat())
+        mPressKeys.insert(event->key());
+
+
+}
+
+void MainWindow::keyReleaseEvent(QKeyEvent *event)
+{
+    if(!event->isAutoRepeat())mPressKeys.remove(event->key());
+    qDebug("key count is %d",mPressKeys.count());
+}
+
+void MainWindow::resizeEvent(QResizeEvent *event)
+{
+    QSize sizemain = ui->centralwidget->size();
+    qDebug("size x = %d y=%d",sizemain.width(),sizemain.height());
+
+
+
+    mpbaiduapp->SetGeometry(10,30,sizemain.width()/2,sizemain.height()*3/5);
+
+ //   mmyview->setGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
+
+    mppicshow->SetGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
+
+    ui->lineEdit_lat->setGeometry(sizemain.width()-100,10,90,30);
+    ui->lineEdit_lon->setGeometry(sizemain.width()-100,50,90,30);
+    ui->pushButton_test->setGeometry(sizemain.width()-100,90,90,30);
+
+//    mpWheel->setGeometry(sizemain.width()/2 + 20,10,200,200);
+
+    int grouppos_x = 10;
+    int grouppos_y = 20 + sizemain.height() *3/5;
+    int grouppos_width = sizemain.width()*6/10;
+    int grouppos_height = sizemain.height()*2/5 - 20;
+
+
+    int speed_width = grouppos_height-40;
+    if((speed_width*3 + 150)>grouppos_width)speed_width = (grouppos_width - 150)/3;
+
+    mpWheel->setGeometry(100,30,speed_width,speed_width);
+    mpBrake->setGeometry(120 + speed_width,30,speed_width,speed_width);
+    mpAcc->setGeometry(140 + 2*speed_width,30,speed_width,speed_width);
+    ui->groupBox_rem->setGeometry(grouppos_x,grouppos_y,grouppos_width,grouppos_height);
+
+    int grouppic_x = 10 + sizemain.width()*6/10 + 10;
+    int grouppic_y = 20 + sizemain.height() *3/5;
+    int grouppic_width = sizemain.width()*4/10 - 30;
+    int grouppic_height = sizemain.height()*1/10;
+
+    ui->groupBox_picsel->setGeometry(grouppic_x,grouppic_y,grouppic_width,grouppic_height);
+
+    int groupmap_x = 10 + sizemain.width()*6/10 + 10;
+    int groupmap_y = 20 + sizemain.height() *7/10;
+    int groupmap_width = sizemain.width()*4/10 - 30;
+    int groupmap_height = sizemain.height()*1/10;
+
+    ui->comboBox_Station->setGeometry(10,30,groupmap_width*3/5,30);
+    ui->pushButton_Go->setGeometry(20 + groupmap_width*3/5,30,groupmap_width*2/5 - 30,30);
+
+    ui->groupBox_map->setGeometry(groupmap_x,groupmap_y,groupmap_width,groupmap_height);
+
+    int groupgps_x = 10 + sizemain.width()*6/10 + 10;
+    int groupgps_y = 30 + sizemain.height() *8/10;
+    int groupgps_width = sizemain.width()*4/10 - 30;
+    int groupgps_height = sizemain.height()*2/10 - 30;
+
+    ui->groupBox_gps->setGeometry(groupgps_x,groupgps_y,groupgps_width,groupgps_height);
+
+    int lablewidth = (groupgps_width-50)*2/10;
+    int lewidth = (groupgps_width-50)*3/10;
+    int leheight = 26;
+
+    int nypos = 40;
+    ui->label_gpsins->setGeometry(10,nypos,lablewidth,leheight);
+    ui->lineEdit_gpsins->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+    ui->label_gpsrtk->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
+    ui->lineEdit_gpsrtk->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
+
+    nypos = nypos + leheight*11/10;
+    ui->label_gpslon->setGeometry(10,nypos,lablewidth,leheight);
+    ui->lineEdit_gpslon->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+    ui->label_gpslat->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
+    ui->lineEdit_gpslat->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
+
+    nypos = nypos + leheight*11/10;
+    ui->label_gpsheading->setGeometry(10,nypos,lablewidth,leheight);
+    ui->lineEdit_gpsheading->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+    ui->label_gpsheight->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
+    ui->lineEdit_gpsheight->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
+
+    nypos = nypos + leheight*11/10;
+    ui->label_gpsspeed->setGeometry(10,nypos,lablewidth,leheight);
+    ui->lineEdit_gpsspeed->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+    ui->label_gpssat->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
+    ui->lineEdit_gpssat->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
+
+
+}
+
+
+void MainWindow::on_pushButton_test_clicked()
+{
+    double flat = ui->lineEdit_lat->text().toDouble();
+    double flon = ui->lineEdit_lon->text().toDouble();
+
+    char strscript[256];
+    snprintf(strscript,255,"theLocation(%11.7f,%11.7f);",flon,flat);
+
+}
+
+void MainWindow::on_radioButton_manual_clicked()
+{
+    ui->radioButton_manual->setChecked(true);
+    mPressKeys.clear();
+    mfAcc = 0;
+    mfWheel = 0;
+    mfBrake = 0;
+    mpWheel->updatevalue(mfWheel);
+    mpAcc->updatevalue(mfAcc);
+    mpBrake->updatevalue(mfBrake);
+    mManualTime.restart();
+    mnLastTime = mManualTime.elapsed();
+    mpTimerManual->start(10);
+}
+
+void MainWindow::onTimerManual()
+{
+
+
+    double fOldWheel = mfWheel;
+    double fOldAcc = mfAcc;
+    double fOldBrake = mfBrake;
+    int timediff = mManualTime.elapsed() - mnLastTime;
+    mnLastTime = mManualTime.elapsed();
+
+    int nOldShift = mnShift;
+
+    if(mpJRT->isOK())
+    {
+        mfWheel = mpJRT->GetWheel() * (-100.0)/32768.0;
+        mfAcc = ((mpJRT->GetAcc()-32767.0)/65535)*(-100.0);
+        mfBrake = ((mpJRT->GetBrake()-32767.0)/65535)*(-100.0);
+        if(mfWheel != fOldWheel)mpWheel->updatevalue(mfWheel);
+        if(mfAcc != fOldAcc)mpAcc->updatevalue(mfAcc);
+        if(mfBrake != fOldBrake)mpBrake->updatevalue(mfBrake);
+
+        int x = mpJRT->GetShift();
+        if(x > 0)mnShift = 1;
+        if(x == 0)mnShift = 0;
+        if(x < 0)mnShift = -1;
+        if(mnShift != nOldShift)
+        {
+            switch (mnShift) {
+            case 1:
+                ui->radioButton_Drive->setChecked(true);
+                ui->radioButton_picfront->setChecked(true);
+                on_radioButton_picfront_clicked();
+                break;
+            case 0:
+                ui->radioButton_Null->setChecked(true);
+                break;
+            case -1:
+                ui->radioButton_Rear->setChecked(true);
+                ui->radioButton_picrear->setChecked(true);
+                on_radioButton_picrear_clicked();
+                break;
+            default:
+                break;
+            }
+        }
+        return;
+    }
+
+
+    if(mPressKeys.contains(Qt::Key_A)&&(mPressKeys.contains((Qt::Key_D))))
+    {
+        mfWheel = mfWheel;
+    }
+    else
+    {
+        if(mPressKeys.contains(Qt::Key_A))
+        {
+            if(mfWheel<0)mfWheel = 0;
+            else
+            {
+                mfWheel = mfWheel + timediff*mfWheelSpeed/1000;
+                if(mfWheel < -100)mfWheel = -100;
+                if(mfWheel > 100 )mfWheel = 100;
+            }
+        }
+
+        if(mPressKeys.contains(Qt::Key_D))
+        {
+            if(mfWheel>0)mfWheel = 0;
+            else
+            {
+                mfWheel = mfWheel - timediff*mfWheelSpeed/1000;
+                if(mfWheel < -100)mfWheel = -100;
+                if(mfWheel > 100 )mfWheel = 100;
+            }
+        }
+
+
+    }
+
+    if(!mPressKeys.contains(Qt::Key_A)&&(!mPressKeys.contains((Qt::Key_D))))
+    {
+        if(mfWheel != 0)
+        {
+            if(mfWheel > 0)mfWheel = mfWheel - timediff*mfWheelAutoDownSpeed/1000;
+            else mfWheel = mfWheel + timediff*mfWheelAutoDownSpeed/1000;
+            if(fabs(mfWheel)< 10)mfWheel =0;
+        }
+    }
+
+    if(mPressKeys.contains(Qt::Key_W)&&(mPressKeys.contains((Qt::Key_S))))
+    {
+        mfAcc = 0;
+        mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
+        if(mfBrake<0)mfBrake = 0;
+        if(mfBrake > 100)mfBrake = 100;
+    }
+    else
+    {
+        if(mPressKeys.contains(Qt::Key_W))
+        {
+            mfBrake = 0;
+            mfAcc = mfAcc + timediff*mfAccSpeed/1000;
+            if(mfAcc<0)mfAcc = 0;
+            if(mfAcc > 100)mfAcc = 100;
+
+        }
+
+        if(mPressKeys.contains(Qt::Key_S))
+        {
+            mfAcc = 0;
+            mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
+            if(mfBrake<0)mfBrake = 0;
+            if(mfBrake > 100)mfBrake = 100;
+        }
+
+
+    }
+
+
+    if(!mPressKeys.contains(Qt::Key_W)&&(!mPressKeys.contains((Qt::Key_S))))
+    {
+        if(mfBrake != 0)
+        {
+            mfBrake = mfBrake - timediff*mfBrakeAutoDownSpeed/1000;
+            if(mfBrake<0)mfBrake = 0;
+            if(mfBrake > 100)mfBrake = 100;
+        }
+
+        if(mfAcc != 0)
+        {
+            mfAcc = mfAcc - timediff*mfAccAutoDownSpeed/1000;
+            if(mfAcc<0)mfAcc = 0;
+            if(mfAcc > 100)mfAcc = 100;
+        }
+    }
+
+    if(mfWheel != fOldWheel)mpWheel->updatevalue(mfWheel);
+    if(mfAcc != fOldAcc)mpAcc->updatevalue(mfAcc);
+    if(mfBrake != fOldBrake)mpBrake->updatevalue(mfBrake);
+}
+
+void MainWindow::on_radioButton_auto_clicked()
+{
+    ui->radioButton_auto->setChecked(true);
+    mPressKeys.clear();
+    mpTimerManual->stop();
+
+}
+
+void MainWindow::onTimerRemote()
+{
+    if(ui->radioButton_auto->isChecked())
+    {
+        mremotectrl.set_ntype(iv::remotectrl_CtrlType_AUTO);
+//        mfAcc = 0;
+//        mfBrake = 0;
+//        mfWheel =0;
+//        mpWheel->updatevalue(mfWheel);
+//        mpAcc->updatevalue(mfAcc);
+//        mpBrake->updatevalue(mfBrake);
+
+
+    }
+    else
+    {
+        mremotectrl.set_ntype(iv::remotectrl_CtrlType_REMOTE);
+
+    }
+    mremotectrl.set_acc(mfAcc);
+    mremotectrl.set_brake(mfBrake);
+    mremotectrl.set_wheel(mfWheel);
+    mremotectrl.set_shift(mnShift);
+
+    int nsersize = mremotectrl.ByteSize();
+    char * strbuf = new char[nsersize];
+    if(mremotectrl.SerializeToArray(strbuf,nsersize))
+    {
+        iv::modulecomm::ModuleSendMsg(mpa,strbuf,nsersize);
+    }
+    delete strbuf;
+}
+
+void MainWindow::onTimerUpdatePic()
+{
+    static qint64 time_pic = 0;
+
+    static qint64 time_trace = 0;
+    static int pos = 0;
+    static std::vector<iv::simpletrace> xvectorsimpletrace;
+
+    if((mnSelPic>=0)&&(mnSelPic<4))
+    {
+        if((gTimeRawPic[mnSelPic] != time_pic) && (gTimeRawPic[mnSelPic] != 0))
+  //      if((gTimeRawPic[mnSelPic] != time_pic))
+        {
+            time_pic = gTimeRawPic[mnSelPic];
+            iv::vision::rawpic xpic;
+            gMutexPic[mnSelPic].lock();
+            xpic.CopyFrom(grawpic[mnSelPic]);
+            gMutexPic[mnSelPic].unlock();
+
+        }
+    }
+
+
+    if(gTimeTrace != time_trace)
+    {
+        time_trace = gTimeTrace;
+
+        gMutexTrace.lock();
+        xvectorsimpletrace = gvectorsimplerace;
+        gMutexTrace.unlock();
+        pos = 0;
+        if(xvectorsimpletrace.size()> 0)
+        {
+            QJsonArray num_json,num2_json;                       //声明QJsonArray
+            QJsonDocument num_document,num2_document;    //将QJsonArray改为QJsonDocument类
+            QByteArray num_byteArray,num2_byteArray;      //
+
+            int i=0;
+            for(i=0;i<xvectorsimpletrace.size();i++)                            //将数组传入压入num_json
+            {
+                num_json.append(xvectorsimpletrace[i].gps_lng);
+                num2_json.append(xvectorsimpletrace[i].gps_lat);
+            }
+
+            num_document.setArray(num_json);
+            num2_document.setArray(num2_json);
+            num_byteArray = num_document.toJson(QJsonDocument::Compact);
+            num2_byteArray = num2_document.toJson(QJsonDocument::Compact);
+            QString numJson(num_byteArray);             //再转为QString
+            QString num2Json(num2_byteArray);             //再转为QString
+
+
+
+        }
+
+    }
+
+//    if(pos<xvectorsimpletrace.size())
+//    {
+//        if(pos == 0)
+//        {
+//            mMapview->page()->runJavaScript("clear()");
+//        }
+
+//        char strscript[256];
+//        snprintf(strscript,255,"mapLocation(%11.7f,%11.7f);",xvectorsimpletrace[pos].gps_lng,xvectorsimpletrace[pos].gps_lat);
+//        mMapview->page()->runJavaScript(strscript);
+//        pos++;
+
+//    }
+}
+
+void MainWindow::onTimerUpdateView()
+{
+    static qint64 time_gps = 0;
+
+    unsigned int i;
+
+   char strlatency[1000];
+   char strtem[100];
+   snprintf(strlatency,1000,"Latency(Up|FrameRate|Down): ");
+   snprintf(strtem,100,"FT(%d|%d|%d) ",mgrpcpc->GetPicLatency(0),mgrpcpc->GetFrameRate(0),mgrpcpc->GetPicDownLatency(0));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"RR(%d|%d|%d) ",mgrpcpc->GetPicLatency(1),mgrpcpc->GetFrameRate(1),mgrpcpc->GetPicDownLatency(1));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"LT(%d|%d|%d) ",mgrpcpc->GetPicLatency(2),mgrpcpc->GetFrameRate(2),mgrpcpc->GetPicDownLatency(2));strncat(strlatency,strtem,1000);
+   snprintf(strtem,100,"RT(%d|%d|%d) ",mgrpcpc->GetPicLatency(3),mgrpcpc->GetFrameRate(3),mgrpcpc->GetPicDownLatency(3));strncat(strlatency,strtem,1000);
+
+   mpLabelLatency->setText(strlatency);
+
+
+    if(gTimeGPSIMUUpdate != time_gps)
+    {
+        time_gps = gTimeGPSIMUUpdate;
+        char strscript[256];
+        snprintf(strscript,255,"theLocation(%11.7f,%11.7f,%11.3f);",ggpsimu.lon(),ggpsimu.lat(),ggpsimu.heading());
+
+
+        iv::gps::gpsimu xgpsimu;
+        xgpsimu.CopyFrom(ggpsimu);
+
+        ui->lineEdit_gpsins->setText(QString::number(xgpsimu.ins_state()));
+        ui->lineEdit_gpsrtk->setText(QString::number(xgpsimu.rtk_state()));
+        ui->lineEdit_gpslon->setText(QString::number(xgpsimu.lon(),'f',7));
+        ui->lineEdit_gpslat->setText(QString::number(xgpsimu.lat(),'f',7));
+        ui->lineEdit_gpsheading->setText(QString::number(xgpsimu.heading(),'f',2));
+        ui->lineEdit_gpsheight->setText(QString::number(xgpsimu.height(),'f',2));
+        ui->lineEdit_gpsspeed->setText(QString::number(xgpsimu.speed(),'f',2));
+        ui->lineEdit_gpssat->setText(QString::number(xgpsimu.satnum1()));
+
+        mstrGPSTime =  QDateTime::fromMSecsSinceEpoch(xgpsimu.msgtime()).toString("GPS: yyyy-MM-dd hh:mm:ss  ");
+        setWindowTitle(mstrProgName + mstrVIN + mstrGPSTime + mstrPicTime);
+    }
+
+
+
+
+
+}
+
+void MainWindow::paintEvent(QPaintEvent *)
+{
+
+}
+
+void MainWindow::on_pushButton_Go_clicked()
+{
+
+
+
+    if(ui->comboBox_Station->currentIndex() < 0)return;
+    int index = ui->comboBox_Station->currentIndex();
+
+    if(index<0 ||  index>= gvectorpos.size())
+    {
+        std::cout<<"out range."<<std::endl;
+        return;
+    }
+    iv::pos_def xpos = gvectorpos[index];
+
+    double lon,lat;
+    lon = xpos.mflon;
+    lat = xpos.mflat;
+
+    xodrobj xo;
+    xo.flon = lon;
+    xo.flat = lat;
+    xo.lane = 3;
+
+    iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
+}
+
+void MainWindow::on_comboBox_Station_currentIndexChanged(int index)
+{
+    if(index<0 ||  index>= gvectorpos.size())
+    {
+        std::cout<<"out range."<<std::endl;
+        return;
+    }
+    iv::pos_def xpos = gvectorpos[index];
+
+    char strscript[256];
+    snprintf(strscript,255,"objLocation(%11.7f,%11.7f);",xpos.mflon,xpos.mflat);
+
+
+}
+
+void MainWindow::on_checkBox_Drive_stateChanged(int arg1)
+{
+
+}
+
+void MainWindow::on_checkBox_Drive_clicked()
+{
+}
+
+void MainWindow::on_checkBox_Null_clicked()
+{
+
+}
+
+void MainWindow::on_checkBox_Rear_clicked()
+{
+
+}
+
+void MainWindow::on_radioButton_Drive_clicked()
+{
+    mnShift = 1;
+    ui->radioButton_picfront->setChecked(true);
+    on_radioButton_picfront_clicked();
+}
+
+void MainWindow::on_radioButton_Null_clicked()
+{
+    mnShift = 0;
+
+}
+
+void MainWindow::on_radioButton_Rear_clicked()
+{
+    mnShift = -1;
+    ui->radioButton_picrear->setChecked(true);
+    on_radioButton_picrear_clicked();
+}
+
+void MainWindow::on_radioButton_picfront_clicked()
+{
+
+    mnSelPic = 0;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
+
+}
+
+void MainWindow::on_radioButton_picrear_clicked()
+{
+    mnSelPic = 1;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
+
+}
+
+void MainWindow::on_radioButton_picleft_clicked()
+{
+    mnSelPic = 2;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
+}
+
+void MainWindow::on_radioButton_picright_clicked()
+{
+    mnSelPic = 3;
+    mppicshow->SetAttr("rawpicmsgname",gstrmem_pic[mnSelPic].data(),gstrmem_pic[mnSelPic].size());
+}
+
+
+
+void MainWindow::on_pushButton_AllPic_clicked()
+{
+    pluginapp * pa  = new pluginapp(this->winId(),"main","plugin_fourpicshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_fourpicshow-Debug");
+
+}
+
+void MainWindow::onCloseDlg()
+{
+
+    qDebug("cloase");
+}
+
+void MainWindow::on_checkBox_clicked()
+{
+//    int i;
+//    if(ui->checkBox->isChecked())
+//    {
+//        for(i=0;i<4;i++)
+//        {
+//            mpPicSave[i]->startsave();
+//        }
+//        mbSavePic = true;
+//    }
+//    else
+//    {
+//        for(i=0;i<4;i++)
+//        {
+//            mpPicSave[i]->stopsave();
+//        }
+//        mbSavePic = false;
+//    }
+}
+
+void MainWindow::saveavi(int index)
+{
+//    if(mbSavePic == false)return;
+//    gMutexPic[index].lock();
+//    mpPicSave[index]->SetPic(grawpic[index]);
+//    gMutexPic[index].unlock();
+}
+
+void MainWindow::on_pushButton_big_clicked()
+{
+    pluginapp * pa  = new pluginapp(this->winId(),"main","plugin_threepicshow","/home/yuchuli/qt/modularization/src/plugin/build-plugin_threepicshow-Debug");
+
+    return;
+
+}
+
+void MainWindow::onCloseBigDlg()
+{
+}
+
+void MainWindow::on_actionSet_Query_Pass_triggered()
+{
+    DialogSetPassWord xdlg(DialogSetPassWord_Type::QUERY,mstrqueryMD5,this);
+    if(xdlg.exec() == xdlg.Accepted)
+    {
+        mgrpcpc->setqueryMD5(ServiceRCIni.GetQueryMD5());
+        mstrqueryMD5 = ServiceRCIni.GetQueryMD5();
+    }
+}
+
+void MainWindow::on_actionSetting_triggered()
+{
+    DialogSetting xdlg(this);
+    if(xdlg.exec() == QDialog::Accepted)
+    {
+        mgrpcpc->setVIN(ServiceRCIni.GetVIN());
+        mstrVehVIN = ServiceRCIni.GetVIN();
+    }
+}
+
+void MainWindow::on_actionSet_Ctrl_Pass_triggered()
+{
+    DialogSetPassWord xdlg(DialogSetPassWord_Type::CTRL,mstrctrlMD5,this);
+    if(xdlg.exec() == xdlg.Accepted)
+    {
+        mgrpcpc->setctrlMD5(ServiceRCIni.GetCtrlMD5());
+        mstrctrlMD5 = ServiceRCIni.GetCtrlMD5();
+    }
+
+}

+ 195 - 0
src/tool/RemoteCtrl_Thread_plugin/mainwindow.h

@@ -0,0 +1,195 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+
+#define CAMERA_NUM 4
+
+#include <QMainWindow>
+
+#include <QtWidgets>
+#include <QSet>
+#include <QMutex>
+#include <QLabel>
+
+#include <iostream>
+
+#include <speed.h>
+
+#include "remotectrl.pb.h"
+#include "gpsimu.pb.h"
+#include "rawpic.pb.h"
+
+
+#include "grpcpc.h"
+
+
+#include "modulecomm.h"
+
+#include "joyreadthread.h"
+
+#include "dialogsetpassword.h"
+#include "dialogsetting.h"
+
+#include "pluginapp.h"
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = nullptr);
+    ~MainWindow();
+
+private slots:
+    void on_pushButton_test_clicked();
+
+    virtual void paintEvent(QPaintEvent *);
+
+    void on_radioButton_manual_clicked();
+
+    void onTimerManual();
+
+    void onTimerRemote();
+
+    void onTimerUpdateView();
+
+    void onTimerUpdatePic();
+
+    void on_radioButton_auto_clicked();
+
+//    virtual void paintEvent(QPaintEvent *);
+
+
+
+    void on_pushButton_Go_clicked();
+
+    void on_comboBox_Station_currentIndexChanged(int index);
+
+    void on_checkBox_Drive_stateChanged(int arg1);
+
+    void on_checkBox_Drive_clicked();
+
+    void on_checkBox_Null_clicked();
+
+    void on_checkBox_Rear_clicked();
+
+    void on_radioButton_Drive_clicked();
+
+    void on_radioButton_Null_clicked();
+
+    void on_radioButton_Rear_clicked();
+
+
+    void on_radioButton_picfront_clicked();
+
+    void on_radioButton_picrear_clicked();
+
+    void on_radioButton_picleft_clicked();
+
+    void on_radioButton_picright_clicked();
+
+    void on_pushButton_AllPic_clicked();
+
+    void onCloseDlg();
+    void onCloseBigDlg();
+
+    void on_checkBox_clicked();
+
+    void on_pushButton_big_clicked();
+
+    void on_actionSet_Query_Pass_triggered();
+
+    void on_actionSetting_triggered();
+
+    void on_actionSet_Ctrl_Pass_triggered();
+
+public:
+     void resizeEvent(QResizeEvent *event);
+
+     void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+
+     void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+
+
+
+private:
+    Ui::MainWindow *ui;
+
+
+    Speed * mpWheel, * mpAcc, * mpBrake;
+
+     QSet<int> mPressKeys;
+
+     QTimer * mpTimerManual;
+     QTimer * mpTimerRemote;
+
+     double mfWheel = 0;
+     double mfAcc = 0;
+     double mfBrake = 0;
+
+     int mnLastTime;
+     QTime mManualTime;
+
+     double mfWheelSpeed = 100; //100degree/s
+     double mfAccSpeed = 30; //30/s
+     double mfBrakeSpeed = 100; //100/s
+
+     double mfWheelAutoDownSpeed = 30;
+     double mfAccAutoDownSpeed = 10;
+     double mfBrakeAutoDownSpeed = 30;
+
+     iv::remotectrl mremotectrl;
+
+     void * mpa;
+
+     QTimer * mpTimerUpdateView;
+
+
+     void * mpadst;
+     void * mpasimpletrace;
+
+     grpcpc * mgrpcpc;
+
+     QString mstrProgName = "ADC IV Remote Control  ";
+     QString mstrGPSTime = " GPS:";
+     QString mstrPicTime = " Pic:";
+
+     QString mstrVIN;
+
+     JoyReadThread * mpJRT;
+
+     int mnShift = 0;
+
+     int mnSelPic = 0;
+
+
+
+     bool mbSavePic = false;
+
+public:
+     void saveavi(int index);
+
+
+private:
+    void CreateView();
+
+private:
+    QLabel * mpLabelLatency;
+
+private:
+    std::string mstrserverip = "192.168.14.98";//"111.33.136.149";//"127.0.0.1";// "140.143.237.38";
+    std::string mstrserverport = "50051";//"9000";
+    std::string mstruploadinterval = "100";
+    std::string mstrVehVIN = "AAAAAAAAAAAAAAAAA";
+    std::string mstrqueryMD5 = "5d41402abc4b2a76b9719d911017c592";
+    std::string mstrctrlMD5 = "5d41402abc4b2a76b9719d911017c592";
+
+private:
+    pluginapp * mpbaiduapp;
+    pluginapp * mppicshow;
+};
+#endif // MAINWINDOW_H

+ 523 - 0
src/tool/RemoteCtrl_Thread_plugin/mainwindow.ui

@@ -0,0 +1,523 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1183</width>
+    <height>722</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="remotectrl.qrc">
+    <normaloff>:/remotectrl.png</normaloff>:/remotectrl.png</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QLineEdit" name="lineEdit_lat">
+    <property name="geometry">
+     <rect>
+      <x>940</x>
+      <y>50</y>
+      <width>113</width>
+      <height>25</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineEdit_lon">
+    <property name="geometry">
+     <rect>
+      <x>940</x>
+      <y>110</y>
+      <width>113</width>
+      <height>25</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_test">
+    <property name="geometry">
+     <rect>
+      <x>950</x>
+      <y>190</y>
+      <width>89</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Test</string>
+    </property>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_rem">
+    <property name="geometry">
+     <rect>
+      <x>870</x>
+      <y>270</y>
+      <width>291</width>
+      <height>311</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>Control</string>
+    </property>
+    <widget class="QRadioButton" name="radioButton_manual">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>40</y>
+       <width>61</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>远程</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_auto">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>70</y>
+       <width>61</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>自动</string>
+     </property>
+    </widget>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>110</y>
+       <width>71</width>
+       <height>101</height>
+      </rect>
+     </property>
+     <property name="title">
+      <string>档位</string>
+     </property>
+     <widget class="QRadioButton" name="radioButton_Drive">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>30</y>
+        <width>112</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>前进</string>
+      </property>
+     </widget>
+     <widget class="QRadioButton" name="radioButton_Null">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>50</y>
+        <width>112</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>空档</string>
+      </property>
+     </widget>
+     <widget class="QRadioButton" name="radioButton_Rear">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>70</y>
+        <width>112</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>后退</string>
+      </property>
+     </widget>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_map">
+    <property name="geometry">
+     <rect>
+      <x>280</x>
+      <y>320</y>
+      <width>351</width>
+      <height>121</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>Map</string>
+    </property>
+    <widget class="QPushButton" name="pushButton_Go">
+     <property name="geometry">
+      <rect>
+       <x>240</x>
+       <y>50</y>
+       <width>91</width>
+       <height>41</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>前往</string>
+     </property>
+    </widget>
+    <widget class="QComboBox" name="comboBox_Station">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>50</y>
+       <width>211</width>
+       <height>41</height>
+      </rect>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_gps">
+    <property name="geometry">
+     <rect>
+      <x>280</x>
+      <y>470</y>
+      <width>361</width>
+      <height>151</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>GPS</string>
+    </property>
+    <widget class="QLineEdit" name="lineEdit_gpsins">
+     <property name="geometry">
+      <rect>
+       <x>80</x>
+       <y>30</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpsins">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>30</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Ins</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpsrtk">
+     <property name="geometry">
+      <rect>
+       <x>190</x>
+       <y>30</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>RTK</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpsrtk">
+     <property name="geometry">
+      <rect>
+       <x>250</x>
+       <y>30</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpslon">
+     <property name="geometry">
+      <rect>
+       <x>80</x>
+       <y>60</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpslat">
+     <property name="geometry">
+      <rect>
+       <x>250</x>
+       <y>60</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpslon">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>60</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Lon</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpslat">
+     <property name="geometry">
+      <rect>
+       <x>190</x>
+       <y>60</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Lat</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpsheading">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>90</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Heading</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpsheading">
+     <property name="geometry">
+      <rect>
+       <x>80</x>
+       <y>90</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpsheight">
+     <property name="geometry">
+      <rect>
+       <x>250</x>
+       <y>90</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpsheight">
+     <property name="geometry">
+      <rect>
+       <x>190</x>
+       <y>90</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Height</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpsspeed">
+     <property name="geometry">
+      <rect>
+       <x>80</x>
+       <y>120</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_gpssat">
+     <property name="geometry">
+      <rect>
+       <x>250</x>
+       <y>120</y>
+       <width>81</width>
+       <height>25</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpsspeed">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>120</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Speed</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_gpssat">
+     <property name="geometry">
+      <rect>
+       <x>190</x>
+       <y>120</y>
+       <width>67</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Sat</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_picsel">
+    <property name="geometry">
+     <rect>
+      <x>280</x>
+      <y>210</y>
+      <width>551</width>
+      <height>91</height>
+     </rect>
+    </property>
+    <property name="title">
+     <string>图像</string>
+    </property>
+    <widget class="QRadioButton" name="radioButton_picfront">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>40</y>
+       <width>51</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>前</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_picrear">
+     <property name="geometry">
+      <rect>
+       <x>70</x>
+       <y>40</y>
+       <width>51</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>后</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_picleft">
+     <property name="geometry">
+      <rect>
+       <x>140</x>
+       <y>40</y>
+       <width>41</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>左</string>
+     </property>
+    </widget>
+    <widget class="QRadioButton" name="radioButton_picright">
+     <property name="geometry">
+      <rect>
+       <x>220</x>
+       <y>40</y>
+       <width>41</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>右</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_AllPic">
+     <property name="geometry">
+      <rect>
+       <x>300</x>
+       <y>40</y>
+       <width>71</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>All</string>
+     </property>
+    </widget>
+    <widget class="QCheckBox" name="checkBox">
+     <property name="geometry">
+      <rect>
+       <x>390</x>
+       <y>40</y>
+       <width>71</width>
+       <height>23</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Save</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_big">
+     <property name="geometry">
+      <rect>
+       <x>460</x>
+       <y>40</y>
+       <width>51</width>
+       <height>25</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Big</string>
+     </property>
+    </widget>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1183</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>File</string>
+    </property>
+    <addaction name="actionSetting"/>
+    <addaction name="actionSet_Query_Pass"/>
+    <addaction name="actionSet_Ctrl_Pass"/>
+   </widget>
+   <addaction name="menuFile"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionSetting">
+   <property name="text">
+    <string>Setting</string>
+   </property>
+  </action>
+  <action name="actionSet_Query_Pass">
+   <property name="text">
+    <string>Set Query Pass</string>
+   </property>
+  </action>
+  <action name="actionSet_Ctrl_Pass">
+   <property name="text">
+    <string>Set Ctrl Pass</string>
+   </property>
+  </action>
+ </widget>
+ <resources>
+  <include location="remotectrl.qrc"/>
+ </resources>
+ <connections/>
+</ui>

+ 2 - 0
src/tool/RemoteCtrl_Thread_plugin/pos.txt

@@ -0,0 +1,2 @@
+站点1	117.02730168	39.12070791
+站点2	117.02730387	39.12051011

+ 16 - 0
src/tool/RemoteCtrl_Thread_plugin/pos_def.h

@@ -0,0 +1,16 @@
+#ifndef POS_DEF_H
+#define POS_DEF_H
+
+#include <string>
+
+namespace  iv {
+struct pos_def
+{
+    double mflon;
+    double mflat;
+    std::string mstrstationname;
+};
+
+}
+
+#endif // POS_DEF_H

BIN
src/tool/RemoteCtrl_Thread_plugin/remotectrl.png


+ 5 - 0
src/tool/RemoteCtrl_Thread_plugin/remotectrl.qrc

@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/">
+        <file>remotectrl.png</file>
+    </qresource>
+</RCC>

+ 143 - 0
src/tool/RemoteCtrl_Thread_plugin/remotectrlini.cpp

@@ -0,0 +1,143 @@
+#include "remotectrlini.h"
+#include <QSettings>
+#include "get_interface.h"
+
+RemoteCtrlIni::RemoteCtrlIni()
+{
+    mstrinipath = "RemoteCtrl_Thread.ini";
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+
+    mstrserverip = configini->value("setting/serverip").toString().toStdString();
+    if(mstrserverip == "")
+    {
+        mstrserverip = "111.33.136.149";
+    }
+
+    mstrserverport = configini->value("setting/serverport").toString().toStdString();
+    if(mstrserverport == "")
+    {
+        mstrserverport = "50051";
+    }
+
+    mstruploadinterval = configini->value("setting/interval").toString().toStdString();
+    if(mstruploadinterval == "")
+    {
+        mstruploadinterval = "100";
+    }
+
+    mstrVehVIN = configini->value("setting/VIN").toString().toStdString();
+    if(mstrVehVIN == "")
+    {
+        mstrVehVIN = "AAAAAAAAAAAAAAAAA";
+    }
+
+    mstrqueryMD5 = configini->value("setting/queryMD5").toString().toStdString();
+    if(mstrqueryMD5 == "")
+    {
+        mstrqueryMD5 = "5d41402abc4b2a76b9719d911017c592";
+    }
+
+    mstrctrlMD5 = configini->value("setting/ctrlMD5").toString().toStdString();
+    if(mstrctrlMD5 == "")
+    {
+        mstrctrlMD5 = "5d41402abc4b2a76b9719d911017c592";
+    }
+
+    delete configini;
+
+    std::string strclientid;
+    if(getmac(strclientid) == 1)
+    {
+        mstrclientid = strclientid;
+    }
+
+}
+
+RemoteCtrlIni & RemoteCtrlIni::Inst()
+{
+    static RemoteCtrlIni xRemoteIni;
+    return xRemoteIni;
+}
+
+std::string RemoteCtrlIni::GetQueryMD5()
+{
+    return mstrqueryMD5;
+}
+
+void RemoteCtrlIni::SetQueryMD5(std::string strmd5)
+{
+    mstrqueryMD5 = strmd5;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/queryMD5",strmd5.data());
+    delete configini;
+}
+
+std::string RemoteCtrlIni::GetServerIP()
+{
+    return mstrserverip;
+}
+
+void RemoteCtrlIni::SetServerIP(std::string strserverip)
+{
+    mstrserverip = strserverip;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/serverip",strserverip.data());
+    delete configini;
+}
+
+std::string RemoteCtrlIni::GetServerPort()
+{
+    return mstrserverport;
+}
+
+void RemoteCtrlIni::SetServerPort(std::string strserverport)
+{
+    mstrserverport = strserverport;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/serverport",strserverport.data());
+    delete configini;
+}
+
+std::string RemoteCtrlIni::GetInterval()
+{
+    return mstruploadinterval;
+}
+
+void RemoteCtrlIni::SetInterval(std::string strinterval)
+{
+    mstruploadinterval = strinterval;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/interval",strinterval.data());
+    delete configini;
+}
+
+std::string RemoteCtrlIni::GetVIN()
+{
+    return mstrVehVIN;
+}
+
+void RemoteCtrlIni::SetVIN(std::string strVIN)
+{
+    mstrVehVIN = strVIN;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/VIN",strVIN.data());
+    delete configini;
+}
+
+std::string RemoteCtrlIni::GetCtrlMD5()
+{
+    return mstrctrlMD5;
+}
+
+void RemoteCtrlIni::SetCtrlMD5(std::string strmd5)
+{
+    mstrctrlMD5 = strmd5;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/ctrlMD5",strmd5.data());
+    delete configini;
+}
+
+std::string RemoteCtrlIni::GetClientID()
+{
+    return mstrclientid;
+}

+ 53 - 0
src/tool/RemoteCtrl_Thread_plugin/remotectrlini.h

@@ -0,0 +1,53 @@
+#ifndef REMOTECTRLINI_H
+#define REMOTECTRLINI_H
+
+#include <string>
+
+#include <QSettings>
+
+class RemoteCtrlIni
+{
+public:
+    RemoteCtrlIni();
+
+public:
+    static RemoteCtrlIni & Inst();
+
+public:
+    std::string GetQueryMD5();
+    void SetQueryMD5(std::string strmd5);
+
+    std::string GetServerIP();
+    void SetServerIP(std::string strserverip);
+
+    std::string GetServerPort();
+    void SetServerPort(std::string strserverport);
+
+    std::string GetInterval();
+    void SetInterval(std::string strinterval);
+
+    std::string GetVIN();
+    void SetVIN(std::string strVIN);
+
+    std::string GetCtrlMD5();
+    void SetCtrlMD5(std::string strmd5);
+
+    std::string GetClientID();
+
+private:
+    QString mstrinipath;
+
+private:
+    std::string mstrserverip = "192.168.14.98";//"111.33.136.149";//"127.0.0.1";// "140.143.237.38";
+    std::string mstrserverport = "50051";//"9000";
+    std::string mstruploadinterval = "100";
+    std::string mstrVehVIN = "AAAAAAAAAAAAAAAAA";
+    std::string mstrqueryMD5 = "5d41402abc4b2a76b9719d911017c592";
+    std::string mstrctrlMD5 = "5d41402abc4b2a76b9719d911017c592";
+
+    std::string mstrclientid = "test";
+};
+
+#define ServiceRCIni RemoteCtrlIni::Inst()
+
+#endif // REMOTECTRLINI_H

+ 199 - 0
src/tool/RemoteCtrl_Thread_plugin/speed.cpp

@@ -0,0 +1,199 @@
+#include "speed.h"
+
+
+#include <QPainter>
+
+#include <math.h>
+
+Speed::Speed(QWidget *parent) : QWidget(parent)
+{
+    m_background = Qt::black;
+    m_foreground = Qt::green;
+
+    m_startAngle = 60;
+    m_endAngle = 60;
+    m_scaleMajor = 10;
+    m_minValue = 100;
+    m_maxValue = -100;
+    m_scaleMajor = 10;//分度
+    m_scaleMinor = 10;
+    m_units = "";
+    m_title = "Wheel";
+    m_precision = 0;
+    m_value = 0;
+}
+
+void Speed::drawCrown(QPainter *painter) //绘制表冠
+{
+    painter->save();
+    int radius = 100;
+    QLinearGradient lg1(0, -radius, 0, radius);
+
+    lg1.setColorAt(0, Qt::white); //设置渐变的颜色和路径比例
+    lg1.setColorAt(1, Qt::gray); //只是粗略的颜色,具体的可以参考RGB颜色查询对照表
+
+    painter->setBrush(lg1); // 创建QBrush对象,把这个渐变对象传递进去:
+    painter->setPen(Qt::NoPen); //边框线无色
+    painter->drawEllipse(-radius, -radius, radius << 1, radius << 1);
+    painter->setBrush(m_background = Qt::black);
+    painter->drawEllipse(-92, -92, 184, 184);
+    painter->restore();
+}
+
+void Speed::drawScaleNum(QPainter *painter) //绘制刻度数字
+{
+    painter->save();
+    painter->setPen(m_foreground);
+    //m_startAngle是起始角度,m_endAngle是结束角度,m_scaleMajor在一个量程中分成的刻度数
+    double startRad = ( 270-m_startAngle) * (3.14 / 180);
+    double deltaRad = (360 - m_startAngle - m_endAngle) * (3.14 / 180) / m_scaleMajor;
+    double sina,cosa;
+    int x, y;
+    QFontMetricsF fm(this->font());
+    double w, h, tmpVal;
+    QString str;
+
+    for (int i = 0; i <= m_scaleMajor; i++)
+    {
+        sina = sin(startRad - i * deltaRad);
+        cosa = cos(startRad - i * deltaRad);
+
+        tmpVal = 1.0 * i *((m_maxValue - m_minValue) / m_scaleMajor) + m_minValue;
+        // tmpVal = 50;
+        str = QString( "%1" ).arg(tmpVal);  //%1作为占位符   arg()函数比起 sprintf()来是类型安全的
+        w = fm.size(Qt::TextSingleLine,str).width();
+        h = fm.size(Qt::TextSingleLine,str).height();
+        x = 82 * cosa - w / 2;
+        y = -82 * sina + h / 4;
+        painter->drawText(x, y, str); //函数的前两个参数是显示的坐标位置,后一个是显示的内容,是字符类型""
+
+    }
+    painter->restore();
+}
+
+void Speed::drawScale(QPainter *painter) //绘制刻度线
+{
+    painter->save();
+    painter->rotate(m_startAngle);
+    int steps = (m_scaleMajor * m_scaleMinor); //相乘后的值是分的份数
+    double angleStep = (360.0 - m_startAngle - m_endAngle) / steps; //每一个份数的角度
+
+    // painter->setPen(m_foreground); //m_foreground是颜色的设置
+    // QPen pen = painter->pen(); //第一种方法
+    QPen pen ;
+    pen.setColor(Qt::green); //推荐使用第二种方式
+    for (int i = 0; i <= steps; i++)
+    {
+        if (i % m_scaleMinor == 0)//整数刻度显示加粗
+        {
+            pen.setWidth(1); //设置线宽
+            painter->setPen(pen); //使用面向对象的思想,把画笔关联上画家。通过画家画出来
+
+            painter->drawLine(0, 62, 0, 72); //两个参数应该是两个坐标值
+        }
+        else
+        {
+            pen.setWidth(0);
+            painter->setPen(pen);
+            painter->drawLine(0, 67, 0, 72);
+        }
+        painter->rotate(angleStep);
+    }
+    painter->restore();
+
+}
+
+void Speed::drawTitle(QPainter *painter)
+{
+    painter->save();
+    painter->setPen(m_foreground);
+    //painter->setBrush(m_foreground);
+    QString str(m_title); //显示仪表的功能
+    QFontMetricsF fm(this->font());
+    double w = fm.size(Qt::TextSingleLine,str).width();
+    painter->drawText(-w / 2, -30, str);
+    painter->restore();
+}
+
+void Speed::drawNumericValue(QPainter *painter)
+{
+    QString str = QString("%1 %2").arg(m_value, 0, 'f', m_precision).arg(m_units);
+    QFontMetricsF fm(font());
+    double w = fm.size(Qt::TextSingleLine,str).width();
+    painter->setPen(m_foreground);
+    painter->drawText(-w / 2, 42, str);
+}
+
+void Speed::drawIndicator(QPainter *painter)
+{
+    painter->save();
+    QPolygon pts;
+    pts.setPoints(3, -2, 0, 2, 0, 0, 60);	/* (-2,0)/(2,0)/(0,60) *///第一个参数是 ,坐标的个数。后边的是坐标
+
+    painter->rotate(m_startAngle);
+    double degRotate = (360.0 - m_startAngle - m_endAngle) / (m_maxValue - m_minValue)*(m_value - m_minValue);
+
+    //画指针
+    painter->rotate(degRotate);  //顺时针旋转坐标系统
+    QRadialGradient haloGradient(0, 0, 60, 0, 0);  //辐射渐变
+    haloGradient.setColorAt(0, QColor(60, 60, 60));
+    haloGradient.setColorAt(1, QColor(160, 160, 160)); //灰
+    painter->setPen(Qt::white); //定义线条文本颜色  设置线条的颜色
+    painter->setBrush(haloGradient);//刷子定义形状如何填满 填充后的颜色
+    painter->drawConvexPolygon(pts); //这是个重载函数,绘制多边形。
+    painter->restore();
+
+    //画中心点
+    QColor niceBlue(150, 150, 200);
+    QConicalGradient coneGradient(0, 0, -90.0);  //角度渐变
+    coneGradient.setColorAt(0.0, Qt::darkGray);
+    coneGradient.setColorAt(0.2, niceBlue);
+    coneGradient.setColorAt(0.5, Qt::white);
+    coneGradient.setColorAt(1.0, Qt::darkGray);
+    painter->setPen(Qt::NoPen);  //没有线,填满没有边界
+    painter->setBrush(coneGradient);
+    painter->drawEllipse(-5, -5, 10, 10);
+}
+
+void Speed ::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);//一个类中的this表示一个指向该类自己的指针
+    painter.setRenderHint(QPainter::Antialiasing);  /* 使用反锯齿(如果可用) */
+    painter.translate(width() / 2, height() / 2);   /* 坐标变换为窗体中心 */
+    int side = qMin(width(), height());
+    painter.scale(side / 200.0, side / 200.0);      /* 比例缩放 */
+
+   drawCrown(&painter);                                 /* 画表盘边框 */
+   drawScaleNum(&painter);                          /* 画刻度数值值 */
+   drawScale(&painter);                                 /* 画刻度线 */
+   drawTitle(&painter);                                     /* 画单位 */
+   drawNumericValue(&painter);                      /* 画数字显示 */
+   drawIndicator(&painter);                             /* 画表针 */
+
+}
+
+void Speed::setminvalue(int value)
+{
+    m_minValue = value;
+}
+
+void Speed::setmaxvalue(int value)
+{
+    m_maxValue = value;
+}
+
+void Speed::updatevalue(int value)
+{
+    m_value = value;
+    update();
+}
+
+void Speed::setunits(QString strunits)
+{
+    m_units = strunits;
+}
+
+void Speed::settitle(QString strtitle)
+{
+    m_title = strtitle;
+}

+ 51 - 0
src/tool/RemoteCtrl_Thread_plugin/speed.h

@@ -0,0 +1,51 @@
+#ifndef SPEED_H
+#define SPEED_H
+
+#include <QWidget>
+
+class Speed : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit Speed(QWidget *parent = nullptr);
+
+protected:
+    void paintEvent(QPaintEvent *);
+
+    void drawCrown(QPainter *painter);
+    void drawBackground(QPainter *painter);
+    void drawScale(QPainter *painter);
+    void drawScaleNum(QPainter *painter);
+    void drawTitle(QPainter *painter);
+    void drawIndicator(QPainter *painter);
+    void drawNumericValue(QPainter *painter);
+
+private:
+    QColor m_background;
+    QColor m_foreground;
+
+
+    int m_maxValue;
+    int m_minValue;
+    int m_startAngle;
+    int m_endAngle;
+
+    int m_scaleMajor;
+    int m_scaleMinor;
+    double m_value;
+    int m_precision;
+    QTimer *m_updateTimer;
+    QString m_units;
+    QString m_title;
+    public Q_SLOTS:
+//	void UpdateAngle();
+
+public:
+    void setminvalue(int value);
+    void setmaxvalue(int value);
+    void updatevalue(int value);
+    void setunits(QString strunits);
+    void settitle(QString strtitle);
+};
+
+#endif // SPEED_H