Browse Source

add RemoteCtrl_Wide.

yuchuli 2 years ago
parent
commit
9754ca8be0
36 changed files with 4882 additions and 1 deletions
  1. 1 1
      src/common/modulecomm/shm/procsm_if.cpp
  2. 341 0
      src/tool/RemoteCtrl_Wide/BaiDuMap.html
  3. 11 0
      src/tool/RemoteCtrl_Wide/RemoteCtrl.xml
  4. 189 0
      src/tool/RemoteCtrl_Wide/RemoteCtrl_Wide.pro
  5. BIN
      src/tool/RemoteCtrl_Wide/car.png
  6. 78 0
      src/tool/RemoteCtrl_Wide/dialogsetpassword.cpp
  7. 39 0
      src/tool/RemoteCtrl_Wide/dialogsetpassword.h
  8. 97 0
      src/tool/RemoteCtrl_Wide/dialogsetpassword.ui
  9. 69 0
      src/tool/RemoteCtrl_Wide/dialogsetting.cpp
  10. 33 0
      src/tool/RemoteCtrl_Wide/dialogsetting.h
  11. 160 0
      src/tool/RemoteCtrl_Wide/dialogsetting.ui
  12. 31 0
      src/tool/RemoteCtrl_Wide/driver_cloud_grpc_pc.yaml
  13. BIN
      src/tool/RemoteCtrl_Wide/en_CN.qm
  14. 580 0
      src/tool/RemoteCtrl_Wide/grpcpc.cpp
  15. 153 0
      src/tool/RemoteCtrl_Wide/grpcpc.h
  16. 165 0
      src/tool/RemoteCtrl_Wide/joyreadthread.cpp
  17. 42 0
      src/tool/RemoteCtrl_Wide/joyreadthread.h
  18. 76 0
      src/tool/RemoteCtrl_Wide/main.cpp
  19. 1239 0
      src/tool/RemoteCtrl_Wide/mainwindow.cpp
  20. 236 0
      src/tool/RemoteCtrl_Wide/mainwindow.h
  21. 463 0
      src/tool/RemoteCtrl_Wide/mainwindow.ui
  22. 128 0
      src/tool/RemoteCtrl_Wide/myview.cpp
  23. 36 0
      src/tool/RemoteCtrl_Wide/myview.h
  24. 2 0
      src/tool/RemoteCtrl_Wide/pos.txt
  25. 16 0
      src/tool/RemoteCtrl_Wide/pos_def.h
  26. 6 0
      src/tool/RemoteCtrl_Wide/remotecomm.cpp
  27. 24 0
      src/tool/RemoteCtrl_Wide/remotecomm.h
  28. BIN
      src/tool/RemoteCtrl_Wide/remotectrl.png
  29. 7 0
      src/tool/RemoteCtrl_Wide/remotectrl.qrc
  30. 162 0
      src/tool/RemoteCtrl_Wide/remotectrlini.cpp
  31. 58 0
      src/tool/RemoteCtrl_Wide/remotectrlini.h
  32. 136 0
      src/tool/RemoteCtrl_Wide/rtspclientdown.cpp
  33. 54 0
      src/tool/RemoteCtrl_Wide/rtspclientdown.h
  34. 199 0
      src/tool/RemoteCtrl_Wide/speed.cpp
  35. 51 0
      src/tool/RemoteCtrl_Wide/speed.h
  36. BIN
      src/tool/RemoteCtrl_Wide/zh_CN.qm

+ 1 - 1
src/common/modulecomm/shm/procsm_if.cpp

@@ -198,7 +198,7 @@ void procsm_if_readthread::run()
 }
 
 
-mmutex.unlock();
+
 #ifdef USE_GROUPUDP
     void procsm_if_readthread::WakeRead()
     {

+ 341 - 0
src/tool/RemoteCtrl_Wide/BaiDuMap.html

@@ -0,0 +1,341 @@
+
+
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
+    <style type="text/css">
+        body, html, #allmap {
+            width: 100%;
+            height: 100%;
+            overflow: hidden;
+            margin: 0;
+            font-family: "微软雅黑";
+        }
+    </style>
+    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=EVi8PXiYpKBGvBr7tgGMzcbdwzWWNf2o"></script>
+
+    
+    <title>野火GPS地图</title>
+</head>
+<body>
+    <div id="allmap"></div>
+
+
+
+</body>
+</html>
+
+
+
+<script type="text/javascript">
+    try {
+
+   
+    // 百度地图API功能
+    var map = new BMap.Map("allmap");            // 创建Map实例
+
+    //添加拖拽和缩放功能
+    map.enableScrollWheelZoom(true);
+    map.enableDragging();   
+
+    //添加控件和比例尺
+    var top_right_control = new BMap.ScaleControl({ anchor: BMAP_ANCHOR_BOTTOM_LEFT });// 左下角,添加比例尺
+    var top_right_navigation = new BMap.NavigationControl({ anchor: BMAP_ANCHOR_BOTTOM_LEFT });  //左下角,添加默认缩放平移控件
+
+    map.addControl(top_right_control);
+    map.addControl(top_right_navigation);
+
+
+    //添加地图类型
+    var mapType1 = new BMap.MapTypeControl({ mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP] });
+    var mapType2 = new BMap.MapTypeControl({ anchor: BMAP_ANCHOR_TOP_LEFT });
+
+    //添加地图类型和缩略图
+   
+    map.addControl(mapType1);          //2D图,卫星图
+    map.addControl(mapType2);          //左上角,默认地图控件
+
+    var drawtrail = 0;
+
+    var grotation = 0;
+
+
+    //创建点
+    //map.clearOverlays();
+    var point = new BMap.Point(117.355, 39.066);
+    var markerCur = new BMap.Marker(point);
+    var markerObj = new BMap.Marker(point);
+    var havepointlast = 0;
+    var pointlast = new BMap.Point(116,39);
+    var pointobj = new BMap.Point(116,39);
+    var bobjset = 0;
+    var gtracelist = []; 
+    var gtraceraw = [];
+    var tracenow = 0;
+    var tracenum = 0;
+    map.centerAndZoom(point, 18);
+    var convertor = new BMap.Convertor();
+    var polylineTrace;
+/*
+    var polylineTrace =new BMap.Polyline(gtracelist, {
+    enableEditing: false,//是否启用线编辑,默认为false
+    enableClicking: false,//是否响应点击事件,默认为true
+    strokeWeight:'4',//折线的宽度,以像素为单位
+    strokeOpacity: 0.8,//折线的透明度,取值范围0 - 1
+    strokeColor:"red" //折线颜色
+    });*/
+    //var marker = new BMap.Marker(point);  // 创建标注
+    //map.addOverlay(marker);               // 将标注添加到地图中
+    
+    //根据IP定位城市
+    function myFun(result) {
+        var cityName = result.name;
+        map.setCenter(cityName);
+    }
+    var myCity = new BMap.LocalCity();
+    myCity.get(myFun);
+
+	var icon = new BMap.Icon('car.png',new BMap.Size(15,30));
+        icon.imageSize = new BMap.Size(15,30);
+        icon.anchor = new BMap.Size(8,15);
+        
+
+    //showalert(testmsg);
+
+    //对传入的经纬度进行标注:纬度,经度
+   // var Latt = 116.404;
+   // var Lott = 39.915;
+
+   // theLocation(Latt, Lott);
+   // testAlert();
+
+    function SetDrawTrail(x)
+   {
+	
+	if(x == 1)drawtrail = 1;
+	else drawtrail = 0;
+   }    
+
+
+    function clear()
+    {
+	gtracelist = [];
+    }
+
+   
+        // 用经纬度设置地图中心点
+    function objLocation(Longitude,Latitude) {
+
+        var gpsPoint = new BMap.Point(Longitude, Latitude);
+
+	var pointArr = [];
+	pointArr.push(gpsPoint);
+        convertor.translate(pointArr, 1, 5, translateCallbackobj)
+        //gps坐标纠偏
+ //       BMap.Convertor.translate(gpsPoint, 0, translateCallbackobj);     //真实经纬度转成百度坐标
+
+
+    }
+
+    // 用经纬度设置地图中心点
+    function theLocation(Longitude,Latitude,rotation) {
+        
+        grotation = rotation;
+        var gpsPoint = new BMap.Point(Longitude, Latitude);
+
+        //gps坐标纠偏
+
+
+var pointArr = [];
+pointArr.push(gpsPoint);
+        convertor.translate(pointArr, 1, 5, translateCallback)
+//convertor.translate(gpsPoint, 0, translateCallback);     //真实经纬度转成百度坐标
+ //       BMap.Convertor.translate(gpsPoint, 0, translateCallback);     //真实经纬度转成百度坐标
+
+
+            //map.clearOverlays();
+            //var new_point = new BMap.Point(Longitude,Latitude );
+            //var marker = new BMap.Marker(new_point);  // 创建标注
+            //map.addOverlay(marker);              // 将标注添加到地图中
+            //map.panTo(new_point);
+            //marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
+
+    }
+
+
+function settrace(numlist,num2list)                    //仅把qt传来的数组转换成可用的list
+{
+    //alert(numlist);
+    var num_list,num2_list;                         //以下为格式转换,分割成可用的数组
+    num_list = numlist.substring(1,numlist.length-1);
+    num2_list = num2list.substring(1,num2list.length-1);
+    num_list = num_list.split(",");
+    num2_list = num2_list.split(",");
+    //alert("the num_list is: "+num_list[0]+" "+num_list[1]);
+
+    
+    gtraceraw = [];
+    gtracelist = [];
+    for(i=0;i<num_list.length;i++)
+    {
+        point= new BMap.Point(num_list[i],num2_list[i]);
+        gtraceraw.push(point);                                  
+    }
+    tracenum = num_list.length;
+    tracenow = 0;
+
+    setTimeout("converttrace()", 30);// 调用画轨迹的函数
+
+    
+}
+
+function converttrace() 
+{
+    var tracelist = [];     //为轨迹做准备,把所有的点扔里面,但不对每个点标注
+    var index = 0;
+    for(i=tracenow;i<tracenum;i++)
+    {
+	tracelist.push(gtraceraw[i]);
+	index++;
+	if(index>=10)break;
+    }
+    if(index>0)
+    {
+	
+        convertor.translate(tracelist, 1,5,translateCallbacktrace);     //真实经纬度转成百度坐标
+     }
+
+}
+
+
+translateCallbacktrace = function (data){
+      if(data.status == 0) {
+        for (var i = 0; i < data.points.length; i++) {
+	gtracelist.push(data.points[i]);
+        }
+	tracenow = tracenow + data.points.length;
+      }
+
+    map.removeOverlay(polylineTrace);
+    polylineTrace =new BMap.Polyline(gtracelist, {
+    enableEditing: false,//是否启用线编辑,默认为false
+    enableClicking: false,//是否响应点击事件,默认为true
+    strokeWeight:'4',//折线的宽度,以像素为单位
+    strokeOpacity: 0.8,//折线的透明度,取值范围0 - 1
+    strokeColor:"red" //折线颜色
+    });
+    map.addOverlay(polylineTrace);          //增加折线
+      setTimeout("converttrace()", 250);// 调用画轨迹的函数
+	
+}
+
+
+
+
+    // 用经纬度设置地图中心点
+    function testAlert(msg) {
+
+        var str = new String;
+        str =  msg.toString()
+       // str = "test"
+
+        alert(str);
+    }
+
+    function enableZoomDrag()
+    {
+        //添加拖拽和缩放功能
+        map.enableScrollWheelZoom(true);
+        map.enableDragging();
+    }
+
+        //坐标转换完之后的回调函数
+    translateCallbackmap = function (point) {
+
+	gtracelist.push(point);       
+ //       map.setCenter(point);
+      //  marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
+    }
+
+        //坐标转换完之后的回调函数
+    translateCallbacktr = function (point) {
+
+	gtracelist.push(point);       
+ //       map.setCenter(point);
+      //  marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
+    }
+
+    //坐标转换完之后的回调函数
+    translateCallbackobj = function (data) {
+	if(data.status === 0) {
+         var point = data.points[0];
+	pointobj = point;
+	bobjset = 1;
+ //       map.clearOverlays();
+	map.removeOverlay(markerObj);
+        markerObj = new BMap.Marker(point);
+
+        map.addOverlay(markerObj);
+	}
+
+ //       map.setCenter(point);
+      //  marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
+    }
+
+
+    //坐标转换完之后的回调函数
+    translateCallback = function (data) {
+
+if(data.status === 0) {
+         var point = data.points[0]
+        map.removeOverlay(markerCur);
+        markerCur = new BMap.Marker(point);
+        if(havepointlast == 1)
+	{
+		if(drawtrail == 1)
+		{
+		var line = new BMap.Polyline([pointlast, point], {strokeColor: "green", strokeWeight: 1, strokeOpacity: 1});
+		map.addOverlay(line);  
+		line.disableMassClear();
+		}
+	}
+        pointlast = point;
+        havepointlast = 1;
+
+	markerCur.setOffset(-30,-30);
+	markerCur.setIcon(icon); 
+	markerCur.setShadow(icon) 
+	markerCur.setRotation(grotation);
+        map.addOverlay(markerCur);
+        map.setCenter(point);
+      }
+//	return;
+//        map.clearOverlays();
+
+/*
+	if(bobjset == 1)
+	{
+		map.removeOverlay(markerObj);
+        	markerObj = new BMap.Marker(pointobj);
+
+        	map.addOverlay(markerObj);
+	}
+
+*/
+
+      //  marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
+    }
+
+    } catch (e) {
+
+        alert("地图加载失败,请检查网络!");
+
+    }
+
+   
+</script>
+
+
+

+ 11 - 0
src/tool/RemoteCtrl_Wide/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>

+ 189 - 0
src/tool/RemoteCtrl_Wide/RemoteCtrl_Wide.pro

@@ -0,0 +1,189 @@
+
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+ QT       += core gui  xml network
+
+
+#contains(QMAKE_HOST.arch, aarch64){
+#    QT       += core gui  xml #webenginewidgets    #AGX
+#    DEFINES += NVIDIA_AGX
+#}else{
+#    QT       += core gui  xml network  #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 \
+    myview.cpp \
+    remotectrlini.cpp \
+    speed.cpp \
+    ../../driver/driver_cloud_grpc_thread/uploadthreadmsg.grpc.pb.cc \
+    ../../include/msgtype/cloud.pb.cc \
+    ../../include/msgtype/uploadthreadmsg.pb.cc \
+    grpcpc.cpp \
+    remotecomm.cpp \
+    ../../driver/driver_h264_dec/ivh264framedecode.cpp \
+    rtspclientdown.cpp
+
+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 \
+    myview.h \
+    pos_def.h \
+    remotectrlini.h \
+    speed.h \
+    ../../driver/driver_cloud_grpc_thread/uploadthreadmsg.grpc.pb.h \
+    ../../include/msgtype/cloud.pb.h \
+    ../../include/msgtype/uploadthreadmsg.pb.h \
+    grpcpc.h \
+    remotecomm.h \
+    ../../driver/driver_h264_dec/ivh264framedecode.h \
+    rtspclientdown.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_thread
+
+INCLUDEPATH += $$PWD/../../plugin/common
+
+
+INCLUDEPATH += $$PWD/../../driver/driver_h264_dec
+
+LIBS += -lprotobuf -lyaml-cpp
+
+
+unix: LIBS += -lopencv_highgui -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lopencv_video  -lopencv_videoio -lpthread #-lopencv_shape
+
+
+#INCLUDEPATH += $$PWD/../../../include/
+#LIBS += -L$$PWD/../../../bin/ -lxmlparam -lmodulecomm -livbacktrace #-livlog -livfault
+
+INCLUDEPATH += $$PWD/../../../thirdpartylib/AGX/qtwebenginewidgets/include/include     # If AGX, Need this line,if x86 please comment this line
+
+contains(QMAKE_HOST.arch, aarch64){
+    LIBS += -lQt5WebEngineWidgets  # If AGX, sudo apt-get install libqt5webenginewidgets5, If x86 comment this line
+}
+
+unix: LIBS += -lQt5WebEngineWidgets
+
+RESOURCES += \
+    remotectrl.qrc
+
+TRANSLATIONS = zh_CN.ts\
+            en_CN.ts
+
+unix: LIBS += -lboost_system
+
+win32: DEFINES +=  _WIN32_WINNT=0x0602
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+!include(../../../include/ivboost.pri ) {
+    error( "Couldn't find the ivboost.pri file!" )
+}
+
+!include(../../../include/ivgrpc.pri ) {
+    error( "Couldn't find the ivgrpc.pri file!" )
+}
+
+!include(../../../include/ivyaml-cpp.pri ) {
+    error( "Couldn't find the ivyaml-cpp.pri file!" )
+}
+
+!include(../../../include/ivopencv.pri ) {
+    error( "Couldn't find the ivopencv.pri file!" )
+}
+
+INCLUDEPATH += $$PWD/../../../thirdpartylib/grpc/include
+
+LIBS += -L$$PWD/../../../thirdpartylib/grpc/lib
+
+
+unix: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
+
+#DEFINES += USE_QSV
+
+
+if(contains(DEFINES,USE_QSV)){
+INCLUDEPATH += /usr/local/include
+INCLUDEPATH += /opt/intel/mediasdk/include
+LIBS += /opt/intel/mediasdk/lib/libmfx.so.1
+LIBS += -L/opt/intel/mediasdk/lib -lmfx
+LIBS += /home/yuchuli/File1/git/ffmpeg/lib/libavcodec.so.59
+LIBS += /home/yuchuli/File1/git/ffmpeg/lib/libavutil.so.57
+LIBS += /home/yuchuli/File1/git/ffmpeg/lib/libavdevice.so.59
+LIBS += /home/yuchuli/File1/git/ffmpeg/lib/libavformat.so.59
+
+
+} else {
+
+INCLUDEPATH += /usr/include/x86_64-linux-gnu
+unix: LIBS +=  -lavcodec -lavformat -lavutil
+}
+
+INCLUDEPATH +=  D:\ffmpegwin\include
+
+win32:LIBS += -LD:\ffmpegwin\bin
+win32:LIBS += -lavcodec-58 -lavformat-58 -lavutil-56  -lwsock32 -lws2_32
+

BIN
src/tool/RemoteCtrl_Wide/car.png


+ 78 - 0
src/tool/RemoteCtrl_Wide/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_Wide/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_Wide/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>

+ 69 - 0
src/tool/RemoteCtrl_Wide/dialogsetting.cpp

@@ -0,0 +1,69 @@
+#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());
+
+    ui->comboBox_language->addItem("Chinese");
+    ui->comboBox_language->addItem("English");
+
+    if(ServiceRCIni.GetLanguage() == "Chinese")ui->comboBox_language->setCurrentIndex(0);
+    else ui->comboBox_language->setCurrentIndex(1);
+
+
+    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);
+
+    if(ui->comboBox_language->currentIndex() == 0)
+    {
+        ServiceRCIni.SetLanguase("Chinese");
+    }
+    else
+    {
+        ServiceRCIni.SetLanguase("English");
+    }
+
+    this->accept();
+}
+
+void DialogSetting::on_pushButton_Close_clicked()
+{
+    this->reject();
+}

+ 33 - 0
src/tool/RemoteCtrl_Wide/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

+ 160 - 0
src/tool/RemoteCtrl_Wide/dialogsetting.ui

@@ -0,0 +1,160 @@
+<?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>617</width>
+    <height>384</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QPushButton" name="pushButton_Set">
+   <property name="geometry">
+    <rect>
+     <x>70</x>
+     <y>320</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>350</x>
+     <y>320</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 class="QLabel" name="label_6">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>260</y>
+     <width>101</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Language</string>
+   </property>
+  </widget>
+  <widget class="QComboBox" name="comboBox_language">
+   <property name="geometry">
+    <rect>
+     <x>170</x>
+     <y>260</y>
+     <width>211</width>
+     <height>41</height>
+    </rect>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 31 - 0
src/tool/RemoteCtrl_Wide/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
+
+
+

BIN
src/tool/RemoteCtrl_Wide/en_CN.qm


+ 580 - 0
src/tool/RemoteCtrl_Wide/grpcpc.cpp

@@ -0,0 +1,580 @@
+#include "grpcpc.h"
+
+#include "remotectrlini.h"
+
+static grpcpc * ggrpcpc;
+
+
+
+grpcpc::grpcpc(std::string stryamlpath)
+{
+
+    (void)stryamlpath;
+
+    ggrpcpc = this;
+
+    int i;
+
+    if(mbUseRTSP == false)
+    {
+    for(i=0;i<NUM_CAM;i++)
+    {
+        unsigned int j;
+        for(j=0;j<NUM_THREAD_PERCAM;j++)
+        {
+            mpThread[i*NUM_THREAD_PERCAM + j] = new std::thread(&grpcpc::threadpicdownload,this,i);
+        }
+    }
+    }
+    else
+    {
+        mstrrtspserverip = ServiceRCIni.GetServerIP();
+        std::string strfront = "rtsp://"+mstrrtspserverip+":"+mstrrtspserverport+"/"+gstrVIN+"-front-"+mstrrtsppass;
+        mprtspdown[0] = new rtspclientdown(strfront);
+        std::string strrear = "rtsp://"+mstrrtspserverip+":"+mstrrtspserverport+"/"+gstrVIN+"-rear-"+mstrrtsppass;
+        mprtspdown[1] = new rtspclientdown(strrear);
+        std::string strleft = "rtsp://"+mstrrtspserverip+":"+mstrrtspserverport+"/"+gstrVIN+"-left-"+mstrrtsppass;
+        mprtspdown[2] = new rtspclientdown(strleft);
+        std::string strright = "rtsp://"+mstrrtspserverip+":"+mstrrtspserverport+"/"+gstrVIN+"-right-"+mstrrtsppass;
+        mprtspdown[3] = new rtspclientdown(strright);
+    }
+}
+
+
+int grpcpc::Produceh264frame(int ncampos,iv::h264rawframedata & xframe)
+{
+    mmutexh264frame[ncampos].lock();
+    if(mvectorh264frame[ncampos].size() > mnframebuffersize)
+    {
+            while(mvectorh264frame[ncampos].size()>mnframebuffersize)
+            {
+                mvectorh264frame[ncampos].erase(mvectorh264frame[ncampos].begin());
+                std::cout<<"Because Consume slow. erase a frame."<<std::endl;
+            }
+    }
+    mvectorh264frame[ncampos].push_back(xframe);
+    mmutexh264frame[ncampos].unlock();
+    mcv[ncampos].notify_all();
+    return 0;
+}
+
+int grpcpc::Consumeh264frame(int ncampos,iv::h264rawframedata & xframe)
+{
+    if(mbUseRTSP)
+    {
+        return mprtspdown[ncampos]->Getrtspframe(xframe,0);
+    }
+    int nrtn = 0;
+    mmutexh264frame[ncampos].lock();
+    if(mvectorh264frame[ncampos].size() == 0)nrtn = 0;
+    else
+    {
+        xframe = mvectorh264frame[ncampos][0];
+        mvectorh264frame[ncampos].erase(mvectorh264frame[ncampos].begin());
+        nrtn = 1;
+    }
+    mmutexh264frame[ncampos].unlock();
+    return nrtn;
+}
+
+int grpcpc::Consumeh264frame(int ncampos,iv::h264rawframedata & xframe,int nwaitms)
+{
+    if(mbUseRTSP)
+    {
+        return mprtspdown[ncampos]->Getrtspframe(xframe,nwaitms);
+    }
+    int nrtn = 0;
+    mmutexh264frame[ncampos].lock();
+    if(mvectorh264frame[ncampos].size() == 0)nrtn = 0;
+    else
+    {
+        xframe = mvectorh264frame[ncampos][0];
+        mvectorh264frame[ncampos].erase(mvectorh264frame[ncampos].begin());
+        nrtn = 1;
+    }
+    mmutexh264frame[ncampos].unlock();
+    if(nrtn == 1)return nrtn;
+    if(nwaitms <= 0)return nrtn;
+    std::unique_lock<std::mutex> lk(mmutexh264cv[ncampos]);
+    if(mcv[ncampos].wait_for(lk, std::chrono::milliseconds(nwaitms)) == std::cv_status::timeout)
+    {
+        lk.unlock();
+    }
+    else
+    {
+        lk.unlock();
+    }
+    mmutexh264frame[ncampos].lock();
+    if(mvectorh264frame[ncampos].size() == 0)nrtn = 0;
+    else
+    {
+        xframe = mvectorh264frame[ncampos][0];
+        mvectorh264frame[ncampos].erase(mvectorh264frame[ncampos].begin());
+        nrtn = 1;
+    }
+    mmutexh264frame[ncampos].unlock();
+    return nrtn;
+
+
+}
+
+
+int grpcpc::SetCtrlMsg(std::string strmsgname,char * strdata,int ndatasize)
+{
+    mmutexctrlmsg.lock();
+    if(mvectorctrlmsg.size() == 0)
+    {
+        iv::cloud::cloudmsg xmsg;
+        mvectorctrlmsg.push_back(xmsg);
+    }
+    iv::cloud::cloudmsg * pmsg = &mvectorctrlmsg[0];
+    bool bExist =false;
+    int i;
+    for(i=0;i<pmsg->xclouddata_size();i++)
+    {
+        iv::cloud::cloudunit * punit = pmsg->mutable_xclouddata(i);
+        if(strmsgname == punit->msgname())
+        {
+            punit->set_data(strdata,ndatasize);
+            bExist = true;
+            break;
+        }
+    }
+    if(bExist == false)
+    {
+        iv::cloud::cloudunit * punit = pmsg->add_xclouddata();
+        punit->set_msgname(strmsgname);
+        punit->set_data(strdata,ndatasize);
+    }
+    mmutexctrlmsg.unlock();
+    return 0;
+}
+
+int grpcpc::GetCtrlMsg(iv::cloud::cloudmsg & xcloudmsg)
+{
+    int nrtn = 0;
+    mmutexctrlmsg.lock();
+    if(mvectorctrlmsg.size() == 0)nrtn = 0;
+    else
+    {
+        xcloudmsg.CopyFrom(mvectorctrlmsg[0]);
+        mvectorctrlmsg.clear();
+        nrtn = 1;
+    }
+    mmutexctrlmsg.unlock();
+    return nrtn;
+}
+
+int grpcpc::GetQueryMsg(iv::cloud::cloudmsg & xcloudmsg)
+{
+    int nrtn = 0;
+    mmutexquerymsg.lock();
+    if(mvectorquerymsg.size() == 0)nrtn = 0;
+    else
+    {
+        xcloudmsg.CopyFrom(mvectorquerymsg[0]);
+        mvectorquerymsg.erase(mvectorquerymsg.begin());
+        nrtn = 1;
+    }
+    mmutexquerymsg.unlock();
+    return nrtn;
+}
+
+int grpcpc::GetQueryMsg(iv::cloud::cloudmsg &xcloudmsg, int nwaitms)
+{
+    int nrtn = 0;
+    nrtn = GetQueryMsg(xcloudmsg);
+
+    if(nrtn == 1)return nrtn;
+    if(nwaitms <= 0)return nrtn;
+    std::unique_lock<std::mutex> lk(mmutexquerycv);
+    if(mcvquery.wait_for(lk, std::chrono::milliseconds(nwaitms)) == std::cv_status::timeout)
+    {
+        lk.unlock();
+    }
+    else
+    {
+        lk.unlock();
+    }
+
+    return GetQueryMsg(xcloudmsg);
+}
+
+int grpcpc::AddQueryMsg(iv::cloud::cloudmsg & xcloudmsg)
+{
+    mmutexquerymsg.lock();
+    while(mvectorquerymsg.size() > mnquerymsgbufsize)
+    {
+        mvectorquerymsg.erase(mvectorquerymsg.begin());
+    }
+    mvectorquerymsg.push_back(xcloudmsg);
+    mmutexquerymsg.unlock();
+    mcvquery.notify_all();
+    return 0;
+}
+
+void grpcpc::run()
+{
+//    int i;
+    qint64 nlasttime = 0;
+
+    int ninterval = atoi(gstruploadinterval.data());
+    if(ninterval<=0)ninterval = 100;
+
+    QTime xTime;
+    xTime.start();
+    int nlastsend = xTime.elapsed();
+
+    std::string target_str = gstrserverip+":";
+    target_str = target_str + gstrserverport ;//std::to_string()
+    auto cargs = grpc::ChannelArguments();
+    cargs.SetMaxReceiveMessageSize(1024 * 1024 * 1024); // 1 GB
+    cargs.SetMaxSendMessageSize(1024 * 1024 * 1024);
+
+    std::shared_ptr<Channel> channel = grpc::CreateCustomChannel(
+             target_str, grpc::InsecureChannelCredentials(),cargs);
+
+    std::unique_ptr<iv::UploadThread::Stub> stub_ = iv::UploadThread::NewStub(channel);
+
+
+    iv::queryReqThread request;
+    iv::queryReplyThread xreply;
+
+    int nid = 0;
+    int nctrlid = 0;
+
+    // Container for the data we expect from the server.
+//    iv::queryReply reply;
+
+    gpr_timespec timespec;
+      timespec.tv_sec = 30;//设置阻塞时间为2秒
+      timespec.tv_nsec = 0;
+      timespec.clock_type = GPR_TIMESPAN;
+
+
+    while(!QThread::isInterruptionRequested())
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(1));
+        if(abs(xTime.elapsed()-nlastsend)<ninterval)
+        {
+            continue;
+        }
+
+        bool bImportant = false;
+        int nkeeptime = 0;
+
+            iv::cloud::cloudmsg xmsg;
+            xmsg.clear_xclouddata();
+            GetCtrlMsg(xmsg);
+            xmsg.set_xtime(QDateTime::currentMSecsSinceEpoch());
+            nlastsend = xTime.elapsed();
+
+//            gMutexMsg.lock();
+//            for(i=0;i<nctrlsize;i++)
+//            {
+//                if(mvectorctrlmsgunit[i].mbRefresh)
+//                {
+//                    mvectorctrlmsgunit[i].mbRefresh = false;
+
+//                    if(mvectorctrlmsgunit[i].mbImportant)
+//                    {
+//                        bImportant = true;
+//                    }
+//                    if(mvectorctrlmsgunit[i].mnkeeptime > nkeeptime)
+//                    {
+//                        nkeeptime = mvectorctrlmsgunit[i].mnkeeptime;
+//                    }
+//                    iv::cloud::cloudunit xcloudunit;
+//                    xcloudunit.set_msgname(mvectorctrlmsgunit[i].mstrmsgname);
+//                    xcloudunit.set_data(mvectorctrlmsgunit[i].mpstrmsgdata.get(),mvectorctrlmsgunit[i].mndatasize);
+//                    iv::cloud::cloudunit * pcu = xmsg.add_xclouddata();
+//                    pcu->CopyFrom(xcloudunit);
+//                }
+
+//            }
+//            gMutexMsg.unlock();
+
+
+            {
+
+                ClientContext context ;
+                context.set_deadline(timespec);
+ //               qint64 time1 = QDateTime::currentMSecsSinceEpoch();
+
+                request.set_strquerymd5(gstrqueryMD5);
+                request.set_strvin(gstrVIN);
+
+                request.set_nlasttime(nlasttime);
+
+                request.set_id(nctrlid);nctrlid++;
+                request.set_strctrlmd5(gstrctrlMD5);
+                request.set_strvin(gstrVIN);
+                request.set_ntime(QDateTime::currentMSecsSinceEpoch());
+                request.set_bimportant(bImportant);
+                request.set_kepptime(nkeeptime);
+                if(xmsg.xclouddata_size()>0)
+                {
+                    int nbytesize = xmsg.ByteSize();
+                    std::vector<char> pvectordata;
+                    pvectordata.resize(nbytesize);
+                    if(xmsg.SerializeToArray(pvectordata.data(),nbytesize))
+                    {
+
+                        request.set_xdata(pvectordata.data(),pvectordata.size());
+
+                    }
+                }
+
+
+                QDateTime xTime;
+                xTime.fromMSecsSinceEpoch(1607905685318);  //1607914763641
+//                qDebug("time:%s",xTime.toString("yyyy-MM-dd:hh:mm:ss:zzz").toLatin1().data());
+//                qDebug("nlasttime is %ld",nlasttime);//1607905685318
+                nid++;
+                // The actual RPC.
+                Status status = stub_->queryctrl(&context, request, &xreply);
+                if (status.ok()) {
+ //                   std::cout<<nid<<" query successfully, res is "<<xreply.nres()<<std::endl;
+                    if(xreply.nres() == 1)
+                    {
+
+                        if(nlasttime != xmsg.xtime())
+                        {
+                            iv::cloud::cloudmsg xmsg;
+                            if(xmsg.ParseFromArray(xreply.xdata().data(),xreply.xdata().size()))
+                            {
+                                AddQueryMsg(xmsg);
+ //                               sharequerymsg(&xmsg);
+                            }
+                        }
+
+                        nlasttime = xreply.ntime();
+                    }
+                    else
+                    {
+                        std::this_thread::sleep_for(std::chrono::milliseconds(30));
+                    }
+                } else {
+                  std::cout << status.error_code() << ": " << status.error_message()
+                            << std::endl;
+                  std::cout<<"RPC failed"<<std::endl;
+
+                  if(status.error_code() == 4)
+                  {
+                      std::cout<<" RPC Exceed Time, Create New stub_"<<std::endl;
+                      channel = grpc::CreateCustomChannel(
+                               target_str, grpc::InsecureChannelCredentials(),cargs);
+
+                      stub_ = iv::UploadThread::NewStub(channel);
+                  }
+                  std::this_thread::sleep_for(std::chrono::milliseconds(900));
+
+                }
+
+            }
+
+
+
+    }
+}
+
+
+
+
+std::string grpcpc::GetVIN()
+{
+    return gstrVIN;
+}
+
+
+void grpcpc::threadpicdownload(int nCamPos)
+{
+    std::cout<<"thread cam "<<nCamPos<<"run"<<std::endl;
+ //   int nsize = mvectormsgunit.size();
+    int i;
+
+    std::string strcclientid = ServiceRCIni.GetClientID();
+
+    int ninterval = atoi(gstruploadinterval.data());
+    if(ninterval<=0)ninterval = 100;
+
+    QTime xTime;
+    xTime.start();
+    int nlastsend = xTime.elapsed();
+
+    std::string target_str = gstrserverip+":";
+    target_str = target_str + gstrserverport ;//std::to_string()
+    auto cargs = grpc::ChannelArguments();
+    cargs.SetMaxReceiveMessageSize(1024 * 1024 * 1024); // 1 GB
+    cargs.SetMaxSendMessageSize(1024 * 1024 * 1024);
+
+    std::shared_ptr<Channel> channel = grpc::CreateCustomChannel(
+             target_str, grpc::InsecureChannelCredentials(),cargs);
+
+    std::unique_ptr<iv::UploadThread::Stub> stub_ = iv::UploadThread::NewStub(channel);
+
+
+    iv::PicDownReqThread request;
+
+    int nid = 0;
+
+    // Container for the data we expect from the server.
+    iv::PicDownReplyThread reply;
+
+    gpr_timespec timespec;
+      timespec.tv_sec = 30;//设置阻塞时间为2秒
+      timespec.tv_nsec = 0;
+      timespec.clock_type = GPR_TIMESPAN;
+
+ //   ClientContext context;
+
+    qint64 nlastpicquerytime = 0;
+
+    while(true)
+    {
+        std::shared_ptr<char> pstr_ptr;
+        if((nCamPos<0)||(nCamPos >= NUM_CAM))
+        {
+            std::cout<<"Cam Pos Error. "<<"Pos: "<<nCamPos<<" TOTAL:"<<NUM_CAM<<std::endl;
+            std::this_thread::sleep_for(std::chrono::milliseconds(100));
+            continue;
+        }
+
+        if(abs(xTime.elapsed() - nlastsend)<30)
+        {
+            std::this_thread::sleep_for(std::chrono::milliseconds(1));
+            continue;
+        }
+
+
+        request.set_strclientid(strcclientid);
+        request.set_ncampos(nCamPos);
+        request.set_strquerymd5(gstrqueryMD5);
+        request.set_strvin(gstrVIN);
+        request.set_npicquerytime(nlastpicquerytime);
+
+
+        ClientContext context ;
+        context.set_deadline(timespec);
+        qint64 time1 = QDateTime::currentMSecsSinceEpoch();
+
+
+        nlastsend = xTime.elapsed();
+        // The actual RPC.
+        Status status = stub_->querypic(&context, request, &reply);
+        if (status.ok()) {
+
+            if(reply.nres() == 1)
+            {
+//                std::cout<<nCamPos<<":pic time is "<<reply.npictime()<<std::endl;
+                mnPicUpLatency[nCamPos] = reply.npicuplatency();
+                mnFrameRate[nCamPos] = reply.npicframerate();
+                mnPicDownLatency[nCamPos] = QDateTime::currentMSecsSinceEpoch() - time1;
+
+                char * pstrdata = (char * )reply.xdata().data();
+                int * pnowsize = (int * )pstrdata;
+                int npos = 0;
+                while((*pnowsize + npos)<=reply.xdata().size())
+                {
+                    npos = npos + sizeof(int);
+                    iv::h264rawframedata xframe;
+                    int ndatasize = *pnowsize;
+//                    std::cout<<" i "<<i<<" size: "<<ndatasize<<std::endl;
+                    xframe.mdatasize = ndatasize;
+                    xframe.mpstr_ptr = std::shared_ptr<char>(new char[ndatasize]);
+                    memcpy(xframe.mpstr_ptr.get(),pstrdata + npos,xframe.mdatasize);
+                    Produceh264frame(nCamPos,xframe);
+                    npos = npos + ndatasize;
+                    if(npos>= reply.xdata().size())
+                    {
+                        break;
+                    }
+                    pnowsize = (int *)(pstrdata + npos);
+                }
+
+
+//                mMutexPic[nCamPos].lock();
+//                iv::modulecomm::ModuleSendMsg(mpaPic[nCamPos],reply.xdata().data(),reply.xdata().size());
+//                mMutexPic[nCamPos].unlock();
+                nlastpicquerytime = reply.npictime();
+//                iv::cloud::cloudmsg xmsg;
+//                if(xmsg.ParseFromArray(reply.xdata().data(),reply.xdata().size()))
+//                {
+//                    sharectrlmsg(&xmsg);
+//                }
+            }
+            else
+            {
+ //               std::cout<<"  slleeeeeep "<<std::endl;
+ //               std::this_thread::sleep_for(std::chrono::milliseconds(10));
+ //               std::this_thread::sleep_for(std::chrono::milliseconds(10*NUM_THREAD_PERCAM));
+            }
+        } else {
+          std::cout << status.error_code() << ": " << status.error_message()
+                    << 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;
+              channel = grpc::CreateCustomChannel(
+                       target_str, grpc::InsecureChannelCredentials(),cargs);
+
+              stub_ = iv::UploadThread::NewStub(channel);
+          }
+          std::this_thread::sleep_for(std::chrono::milliseconds(900));
+
+        }
+
+
+    }
+}
+
+qint64 grpcpc::GetPicLatency(int nCamPos)
+{
+    if((nCamPos < 0)||(nCamPos >= NUM_CAM))return -1;
+    return mnPicUpLatency[nCamPos];
+}
+
+int grpcpc::GetFrameRate(int nCamPos)
+{
+    if((nCamPos < 0)||(nCamPos >= NUM_CAM))return -1;
+    return mnFrameRate[nCamPos];
+}
+
+qint64 grpcpc::GetPicDownLatency(int nCamPos)
+{
+    if((nCamPos < 0)||(nCamPos >= NUM_CAM))return -1;
+    return mnPicDownLatency[nCamPos];
+}
+
+void grpcpc::setserverip(std::string strip)
+{
+    gstrserverip = strip;
+}
+
+void grpcpc::setserverport(std::string strport)
+{
+    gstrserverport = strport;
+}
+
+void grpcpc::setqueryinterval(std::string strinterval)
+{
+    gstruploadinterval = strinterval;
+}
+
+void grpcpc::setVIN(std::string strVIN)
+{
+    gstrVIN = strVIN;
+}
+
+void grpcpc::setqueryMD5(std::string strmd5)
+{
+    gstrqueryMD5 = strmd5;
+}
+
+void grpcpc::setctrlMD5(std::string strmd5)
+{
+    gstrctrlMD5 = strmd5;
+}
+
+

+ 153 - 0
src/tool/RemoteCtrl_Wide/grpcpc.h

@@ -0,0 +1,153 @@
+#ifndef GRPCPC_H
+#define GRPCPC_H
+
+#include <QThread>
+
+#include <yaml-cpp/yaml.h>
+
+#include <QDateTime>
+
+#include <iostream>
+
+#include <vector>
+
+#include <memory>
+
+#include <QMutex>
+
+#include <thread>
+
+#include "cloud.pb.h"
+
+#include <iostream>
+#include <memory>
+#include <string>
+#include <condition_variable>
+
+
+#include <grpcpp/grpcpp.h>
+
+#include "uploadthreadmsg.grpc.pb.h"
+
+#include "rtspclientdown.h"
+
+#ifndef NUM_CAM
+#define NUM_CAM 4
+#endif
+
+#ifndef NUM_THREAD_PERCAM
+#define NUM_THREAD_PERCAM 1
+//int NUM_THREAD_PERCAM = 1;
+#endif
+
+using grpc::Channel;
+using grpc::ClientContext;
+using grpc::Status;
+
+namespace iv {
+struct msgunit
+{
+    char mstrmsgname[256];
+    int mnBufferSize = 10000;
+    int mnBufferCount = 1;
+    void * mpa;
+    std::shared_ptr<char> mpstrmsgdata;
+    int mndatasize = 0;
+    bool mbRefresh = false;
+    bool mbImportant = false;
+    int mnkeeptime = 100;
+};
+
+
+}
+
+class grpcpc : public QThread
+{
+public:
+    grpcpc(std::string stryamlpath);
+
+private:
+    void run();
+
+private:
+    std::string gstrserverip = "192.168.14.98";//"111.33.136.149";//"127.0.0.1";// "140.143.237.38";
+    std::string gstrserverport = "50051";//"9000";
+    std::string gstruploadinterval = "100";
+    std::string gstrVIN = "AAAAAAAAAAAAAAAAA";
+    std::string gstrqueryMD5 = "5d41402abc4b2a76b9719d911017c592";
+    std::string gstrctrlMD5 = "5d41402abc4b2a76b9719d911017c592";
+
+    int gindex = 0;
+
+public:
+    std::string GetVIN();
+
+private:
+    void threadpicdownload(int nCamPos);
+    void * mpaPic[NUM_CAM];
+    std::string mstrpicmsgname[NUM_CAM];
+
+    std::thread * mpThread[NUM_CAM * NUM_THREAD_PERCAM];
+
+    std::mutex mMutexPic[NUM_CAM];
+
+    qint64 mnPicUpLatency[NUM_CAM];
+    int mnFrameRate[NUM_CAM];
+    int mnPicDownLatency[NUM_CAM];
+
+
+public:
+    qint64 GetPicLatency(int nCamPos);
+    int GetFrameRate(int nCamPos);
+    qint64 GetPicDownLatency(int nCamPos);
+
+
+public:
+    void setserverip(std::string strip);
+    void setserverport(std::string strport);
+    void setqueryinterval(std::string strinterval);
+    void setVIN(std::string strVIN);
+    void setqueryMD5(std::string strmd5);
+    void setctrlMD5(std::string strmd5);
+
+public:
+    int Consumeh264frame(int ncampos,iv::h264rawframedata & xframe);
+    int Consumeh264frame(int ncampos,iv::h264rawframedata & xframe,int nwaitms);
+
+    int SetCtrlMsg(std::string strmsgname,char * strdata,int ndatasize);
+    int GetQueryMsg(iv::cloud::cloudmsg & xcloudmsg,int nwaitms);
+
+private:
+
+    std::vector<iv::h264rawframedata> mvectorh264frame[NUM_CAM];
+    QMutex mmutexh264frame[NUM_CAM];
+    int Produceh264frame(int ncampos,iv::h264rawframedata & xframe);
+
+    unsigned int mnframebuffersize = 10;
+    std::mutex mmutexh264cv[NUM_CAM];
+    std::condition_variable mcv[NUM_CAM];
+
+
+private:
+    std::vector<iv::cloud::cloudmsg> mvectorctrlmsg;
+    std::vector<iv::cloud::cloudmsg> mvectorquerymsg;
+    int GetCtrlMsg(iv::cloud::cloudmsg & xcloudmsg);
+    int GetQueryMsg(iv::cloud::cloudmsg & xcloudmsg);
+    int AddQueryMsg(iv::cloud::cloudmsg & xcloudmsg);
+    std::mutex mmutexctrlmsg;
+    std::mutex mmutexquerymsg;
+    unsigned int mnquerymsgbufsize = 10;
+    std::mutex mmutexquerycv;
+    std::condition_variable mcvquery;
+
+private:
+    bool mbUseRTSP = true;  //Use RTSP connect to the server.
+    std::string mstrrtspserverip = "111.33.136.149";
+    std::string mstrrtspserverport = "9554";
+    std::string mstrrtsppass = "hello";
+    rtspclientdown * mprtspdown[NUM_CAM];
+
+
+};
+
+#endif // GRPCPC_H

+ 165 - 0
src/tool/RemoteCtrl_Wide/joyreadthread.cpp

@@ -0,0 +1,165 @@
+#include "joyreadthread.h"
+
+#ifndef Q_OS_WIN
+#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;
+}
+
+
+#endif

+ 42 - 0
src/tool/RemoteCtrl_Wide/joyreadthread.h

@@ -0,0 +1,42 @@
+#ifndef JOYREADTHREAD_H
+#define JOYREADTHREAD_H
+
+#ifndef Q_OS_WIN
+#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
+
+#endif // JOYREADTHREAD_H

+ 76 - 0
src/tool/RemoteCtrl_Wide/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","h264front");
+    gstrmem_pic[1] = xp.GetParam("PicRear","h264rear");
+    gstrmem_pic[2] = xp.GetParam("PicLeft","h264left");
+    gstrmem_pic[3] = xp.GetParam("PicRight","h264right");
+    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();
+}

+ 1239 - 0
src/tool/RemoteCtrl_Wide/mainwindow.cpp

@@ -0,0 +1,1239 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "pos_def.h"
+
+#include "remotectrlini.h"
+
+MainWindow * gw;
+//#include "QStringLiteral"
+
+#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
+
+#include <opencv2/opencv.hpp>
+#include <opencv2/core.hpp>
+
+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 * gpaframe;
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::MainWindow)
+{
+
+    m_translator = new QTranslator(this);
+    QString strLanguageFile = ":/zh_CN.qm";
+    if(ServiceRCIni.GetLanguage() == "Chinese")
+    {
+        strLanguageFile = ":/zh_CN.qm";
+    }
+    else
+    {
+        strLanguageFile = ":/en_CN.qm";
+    }
+    if (QFile(strLanguageFile).exists())
+    {
+        m_translator->load(strLanguageFile);
+        qApp->installTranslator(m_translator);
+    }
+
+
+    gpaframe = iv::modulecomm::RegisterSend("h264frame",1000000,1);
+    gw = this;
+
+    ui->setupUi(this);
+
+
+
+    mstrserverip = ServiceRCIni.GetServerIP();
+    mstrserverport = ServiceRCIni.GetServerPort();
+    mstruploadinterval = ServiceRCIni.GetInterval();
+    mstrVehVIN = ServiceRCIni.GetVIN();
+    mstrqueryMD5 = ServiceRCIni.GetQueryMD5();
+    mstrctrlMD5 = ServiceRCIni.GetCtrlMD5();
+
+#ifndef Q_OS_WIN
+    mpJRT = new JoyReadThread();
+    mpJRT->start();
+#endif
+
+    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(50);
+
+    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(1000);
+
+    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();
+
+    for(i=0;i<NUM_CAM;i++)
+    {
+        mpImageCam[i] = new QImage(640, 360, QImage::Format_RGB32);
+        mbCamUpdate[i] = false;
+        mph264decode[i] = new ivh264framedecode(mnframewidth,mnframeheight);
+        mpthreadframe[i] = new std::thread(&MainWindow::threadframe,this,i);
+        mpthreadpic[i] = new std::thread(&MainWindow::threadpic,this,i);
+
+    }
+    mpthreadinfo = new std::thread(&MainWindow::threadinfo,this);
+
+    mstrVIN = mgrpcpc->GetVIN().data();
+    mstrVIN = " VIN:"+ mstrVIN+" ";
+
+
+
+//    mppicdlg = new DialogPic(this);
+//    mppicdlg->setModal(false);
+//    connect(mppicdlg,SIGNAL(finished(int)),this,SLOT(onCloseDlg()));
+
+//    mpbigpicdlg = new DialogBigPic(this);
+//    mpbigpicdlg->setModal(false);
+//    connect(mpbigpicdlg,SIGNAL(finished(int)),this,SLOT(onCloseBigDlg()));
+
+    QLabel * pLabel = new QLabel();
+    pLabel->setFixedWidth(600);
+    pLabel->setText("Latency");
+    mpLabelLatency = pLabel;
+    ui->statusbar->addPermanentWidget(pLabel);
+
+    ui->horizontalSlider_wheelspeed->setRange(1,30);
+
+    connect(this,SIGNAL(CamUpdate(int)),this,SLOT(onCamUpdate(int)));
+
+//    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()
+{
+
+    mbThreadrun = false;
+    int i;
+    mpthreadinfo->join();
+    for(i=0;i<NUM_CAM;i++)
+    {
+//        mph264decode[i] = new ivh264framedecode(mnframewidth,mnframeheight);
+        mpthreadframe[i]->join();
+        mpthreadpic[i]->join();
+    }
+    delete ui;
+}
+
+void MainWindow::CreateView()
+{
+//    mMapview = new QWebEngineView(ui->centralwidget);
+//    qDebug((QDir::currentPath()).toLatin1().data());
+//    mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
+
+ //   mMapview->setGeometry(10,10,800,800);
+
+//    mMapview->page()->runJavaScript("theLocation(117.355,39.066);");  //117.355,39.066
+
+    mpWheel = new Speed(ui->groupBox_rem);
+    mpWheel->settitle(QStringLiteral("方向盘"));
+    mpWheel->setminvalue(550);
+    mpWheel->setmaxvalue(-550);
+
+    mpAcc = new Speed(ui->groupBox_rem);
+
+    mpAcc->settitle(QStringLiteral("油门"));
+    mpAcc->updatevalue(0);
+    mpAcc->setminvalue(-100);
+    mpAcc->setmaxvalue(100);
+
+    mpBrake = new Speed(ui->groupBox_rem);
+    mpBrake->settitle(QStringLiteral("刹车"));
+    mpBrake->updatevalue(0);
+    mpBrake->setminvalue(0);
+    mpBrake->setmaxvalue(100);
+
+    mmyview = new MyView(ui->centralwidget);
+    mmyview->setObjectName(QStringLiteral("graphicsView"));
+    mmyview->setGeometry(QRect(30, 30, 600, 600));
+    mmyview->setCacheMode(mmyview->CacheBackground);
+
+    mmyviewLeft = new MyView(ui->centralwidget);
+    mmyviewLeft->setObjectName(QStringLiteral("graphicsView"));
+    mmyviewLeft->setGeometry(QRect(30, 30, 600, 600));
+    mmyviewLeft->setCacheMode(mmyviewLeft->CacheBackground);
+
+    mmyviewRear = new MyView(ui->centralwidget);
+    mmyviewRear->setObjectName(QStringLiteral("graphicsView"));
+    mmyviewRear->setGeometry(QRect(30, 30, 600, 600));
+    mmyviewRear->setCacheMode(mmyviewRear->CacheBackground);
+
+    mmyviewRight = new MyView(ui->centralwidget);
+    mmyviewRight->setObjectName(QStringLiteral("graphicsView"));
+    mmyviewRight->setGeometry(QRect(30, 30, 600, 600));
+    mmyviewRight->setCacheMode(mmyviewRight->CacheBackground);
+
+    mscene = new QGraphicsScene;
+    mpsceneImg[0] = mscene;
+    mpsceneImg[1] = new QGraphicsScene;
+    mpsceneImg[2] = new QGraphicsScene;
+    mpsceneImg[3] = new QGraphicsScene;
+
+    mpviewImg[0] = mmyview;
+    mpviewImg[1] = mmyviewRear;
+    mpviewImg[2] = mmyviewLeft;
+    mpviewImg[3] = mmyviewRight;
+
+    ui->radioButton_Null->setChecked(true);
+
+
+
+}
+
+
+void MainWindow::keyPressEvent(QKeyEvent *event)
+{
+
+    //按键按下,key值放入容器,如果是长按触发的repeat就不判断
+    if(!event->isAutoRepeat())
+        mPressKeys.insert(event->key());
+
+
+}
+
+void MainWindow::keyReleaseEvent(QKeyEvent *event)
+{
+    if(event->key() == Qt::Key_Escape)
+    {
+        showNormal();
+    }
+    if(!event->isAutoRepeat())mPressKeys.remove(event->key());
+    qDebug("key count is %d",mPressKeys.count());
+}
+
+void MainWindow::resizeEvent(QResizeEvent *event)
+{
+    (void)event;
+    QSize sizemain = ui->centralwidget->size();
+    qDebug("size x = %d y=%d",sizemain.width(),sizemain.height());
+
+//    mMapview->setVisible(false);
+//    mMapview->setGeometry(10,10,sizemain.width()/2,sizemain.height()*3/5);
+
+//    mpbaiduapp->SetGeometry(10,30,sizemain.width()/2,sizemain.height()*3/5);
+
+    int nMode = 1;
+
+    ui->lineEdit_lat->setVisible(false);
+    ui->lineEdit_lon->setVisible(false);
+    ui->pushButton_test->setVisible(false);
+
+    if(nMode == 0)
+    {
+
+        mmyview->setGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
+
+        int nfrontpos_x = sizemain.width()/6;
+        int nfrontpos_y = sizemain.height()/3;
+        int nfrontsize_x = sizemain.width()*2/3;
+        int nfrontsize_y = sizemain.height() * 2/3;
+        mmyview->setGeometry(nfrontpos_x,nfrontpos_y,nfrontsize_x,nfrontsize_y);
+
+        int nleftpos_x = 0;
+        int nleftpos_y = 0;
+        int nleftsize_x = sizemain.width()/3;
+        int nleftsize_y = sizemain.height()/3;
+        mmyviewLeft->setGeometry(nleftpos_x,nleftpos_y,nleftsize_x,nleftsize_y);
+
+        int nrearpos_x = sizemain.width()/3;
+        int nrearpos_y = 0;
+        int nrearsize_x = sizemain.width()/3;
+        int nrearsize_y = sizemain.height()/3;
+        mmyviewRear->setGeometry(nrearpos_x,nrearpos_y,nrearsize_x,nrearsize_y);
+
+        int nrightpos_x = sizemain.width() * 2/3;
+        int nrightpos_y = 0;
+        int nrightsize_x = sizemain.width()/3;
+        int nrightsize_y = sizemain.height()/3;
+        mmyviewRight->setGeometry(nrightpos_x,nrightpos_y,nrightsize_x,nrightsize_y);
+
+        //    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 =  sizemain.width()*5/6;
+        int grouppos_y = sizemain.height()/3;
+        int grouppos_width = sizemain.width()*1/6;
+        int grouppos_height = sizemain.height() * 2/3;
+
+
+        //    int speed_width = grouppos_height-40;
+        //    if((speed_width*3 + 150)>grouppos_width)speed_width = (grouppos_width - 150)/3;
+
+        int speed_width = grouppos_width;
+        if(speed_width*3 > (sizemain.height()/2))speed_width = sizemain.height()/6;
+        mpWheel->setGeometry(0,sizemain.height()/6 ,speed_width,speed_width);
+        mpBrake->setGeometry(0,sizemain.height()/6 + sizemain.height()/6,speed_width,speed_width);
+        mpAcc->setGeometry(0 ,sizemain.height()/6 + sizemain.height()/3,speed_width,speed_width);
+        ui->groupBox_rem->setGeometry(grouppos_x,grouppos_y,grouppos_width,grouppos_height);
+
+
+
+        int groupmap_x = 0;
+        int groupmap_y = sizemain.height()*1/3;
+        int groupmap_width = sizemain.width()/6;
+        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 = 0;
+        int groupgps_y = sizemain.height()/2;
+        int groupgps_width = sizemain.width()/6;
+        int groupgps_height = sizemain.height()/2;
+
+        ui->groupBox_gps->setGeometry(groupgps_x,groupgps_y,groupgps_width,groupgps_height);
+
+        int lablewidth =groupgps_width*3/10;// (groupgps_width-50)*2/10;
+        int lewidth = groupgps_width*6/10;
+        int leheight = 26;
+
+        int nypos = 40;
+        ui->label_gpsins->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsins->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpsrtk->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsrtk->setGeometry(20+lablewidth,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);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpslat->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpslat->setGeometry(20+lablewidth,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);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpsheight->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsheight->setGeometry(20+lablewidth,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);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpssat->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpssat->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+
+
+        double fscale = (sizemain.width()*2/3)*1.0/mnframewidth;
+        double fscale2 = (sizemain.height()*2/3)*1.0/mnframeheight;
+        if(fscale > fscale2) fscale = fscale2;
+        fscale = fscale * 0.99;
+        mmyview->viewscaleto(fscale);
+
+        int i;
+        for(i=1;i<NUM_CAM;i++)
+        {
+            fscale =  (sizemain.width()*1/3)*1.0/mnframewidth;
+            fscale2 = (sizemain.height()*1/3)*1.0/mnframeheight;
+            if(fscale > fscale2) fscale = fscale2;
+            fscale = fscale * 0.99;
+            mpviewImg[i]->viewscaleto(fscale);
+        }
+
+    }
+
+    if(nMode == 1)
+    {
+
+        int nfrontpos_x = sizemain.width()*2/5;
+        int nfrontpos_y = 0;
+        int nfrontsize_x = sizemain.width()*1/5;
+        int nfrontsize_y = sizemain.height();
+        mmyview->setGeometry(nfrontpos_x,nfrontpos_y,nfrontsize_x,nfrontsize_y);
+
+        int nleftpos_x = 0;
+        int nleftpos_y = 0;
+        int nleftsize_x = sizemain.width()*1/5;
+        int nleftsize_y = sizemain.height();
+        mmyviewLeft->setGeometry(nleftpos_x,nleftpos_y,nleftsize_x,nleftsize_y);
+
+//        int nrearpos_x = sizemain.width()/3;
+//        int nrearpos_y = 0;
+//        int nrearsize_x = sizemain.width()/3;
+//        int nrearsize_y = sizemain.height()/3;
+//        mmyviewRear->setGeometry(nrearpos_x,nrearpos_y,nrearsize_x,nrearsize_y);
+
+        mmyviewRear->setVisible(false);
+
+        int nrightpos_x = sizemain.width() * 4/5;
+        int nrightpos_y = 0;
+        int nrightsize_x = sizemain.width()*1/5;
+        int nrightsize_y = sizemain.height();
+        mmyviewRight->setGeometry(nrightpos_x,nrightpos_y,nrightsize_x,nrightsize_y);
+
+        //    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 =  sizemain.width()*1/5;
+        int grouppos_y = sizemain.height()/2;
+        int grouppos_width = sizemain.width()*1/5;
+        int grouppos_height = sizemain.height() * 1/2;
+
+
+        //    int speed_width = grouppos_height-40;
+        //    if((speed_width*3 + 150)>grouppos_width)speed_width = (grouppos_width - 150)/3;
+
+        int speed_width = grouppos_width;
+        if(speed_width*3 > (sizemain.height()/2))speed_width = sizemain.height()/6;
+        mpWheel->setGeometry(0,sizemain.height()/6 ,speed_width,speed_width);
+        mpBrake->setGeometry(0,sizemain.height()/6 + sizemain.height()/6,speed_width,speed_width);
+        mpAcc->setGeometry(0 ,sizemain.height()/6 + sizemain.height()/3,speed_width,speed_width);
+        ui->groupBox_rem->setGeometry(grouppos_x,grouppos_y,grouppos_width,grouppos_height);
+
+
+
+        int groupmap_x = sizemain.width()*1/5;
+        int groupmap_y = sizemain.height();
+        int groupmap_width = sizemain.width()/5;
+        int groupmap_height = sizemain.height();
+
+        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 = sizemain.width()*1/5;
+        int groupgps_y = sizemain.height()/2;
+        int groupgps_width = sizemain.width()/5;
+        int groupgps_height = sizemain.height()/2;
+
+        ui->groupBox_gps->setGeometry(groupgps_x,groupgps_y,groupgps_width,groupgps_height);
+
+        int lablewidth =groupgps_width*3/10;// (groupgps_width-50)*2/10;
+        int lewidth = groupgps_width*6/10;
+        int leheight = 26;
+
+        int nypos = 40;
+        ui->label_gpsins->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsins->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpsrtk->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsrtk->setGeometry(20+lablewidth,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);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpslat->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpslat->setGeometry(20+lablewidth,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);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpsheight->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsheight->setGeometry(20+lablewidth,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);
+
+        nypos = nypos + leheight*11/10;
+        ui->label_gpssat->setGeometry(10,nypos,lablewidth,leheight);
+        ui->lineEdit_gpssat->setGeometry(20+lablewidth,nypos,lewidth,leheight);
+
+
+        double fscale = (sizemain.width()*1/5)*1.0/mnframewidth;
+        double fscale2 = (sizemain.height()*1/1)*1.0/mnframeheight;
+        if(fscale > fscale2) fscale = fscale2;
+        fscale = fscale * 0.99;
+        mmyview->viewscaleto(fscale);
+
+        int i;
+        for(i=1;i<NUM_CAM;i++)
+        {
+            fscale =  (sizemain.width()*1/5)*1.0/mnframewidth;
+            fscale2 = (sizemain.height()*1/1)*1.0/mnframeheight;
+            if(fscale > fscale2) fscale = fscale2;
+            fscale = fscale * 0.99;
+            mpviewImg[i]->viewscaleto(fscale);
+        }
+
+    }
+
+}
+
+
+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);
+//    mMapview->page()->runJavaScript(strscript);
+}
+
+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()
+{
+
+    static qint64 nLastKeepKeyTime = 0;
+    const qint64 nKeepTime = 3000; //if press c key, 5 seconds. in keep mode.
+    double fOldWheel = mfWheel;
+    double fOldAcc = mfAcc;
+    double fOldBrake = mfBrake;
+    int timediff = mManualTime.elapsed() - mnLastTime;
+    mnLastTime = mManualTime.elapsed();
+
+    bool bInKeepMode = false;
+
+    int nOldShift = mnShift;
+
+#ifndef Q_OS_WIN
+    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);
+                break;
+            case 0:
+                ui->radioButton_Null->setChecked(true);
+                break;
+            case -1:
+                ui->radioButton_Rear->setChecked(true);
+                break;
+            default:
+                break;
+            }
+        }
+        return;
+    }
+#endif
+
+    if(mPressKeys.contains(Qt::Key_C)||(mPressKeys.contains(Qt::Key_A))||(mPressKeys.contains(Qt::Key_D))||(mPressKeys.contains(Qt::Key_W))||(mPressKeys.contains(Qt::Key_S)))
+    {
+        nLastKeepKeyTime = QDateTime::currentMSecsSinceEpoch();
+    }
+
+    if(abs(QDateTime::currentMSecsSinceEpoch() - nLastKeepKeyTime)  < nKeepTime)
+    {
+        bInKeepMode = true;
+    }
+
+
+    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_Z))
+    {
+        mfWheel = 0;
+    }
+
+    if(!mPressKeys.contains(Qt::Key_A)&&(!mPressKeys.contains((Qt::Key_D)))&&(bInKeepMode == false))
+    {
+        if(mfWheel != 0)
+        {
+            if(mfWheel > 0)mfWheel = mfWheel - timediff*mfWheelAutoDownSpeed/1000;
+            else mfWheel = mfWheel + timediff*mfWheelAutoDownSpeed/1000;
+            if(fabs(mfWheel)< 10)mfWheel =0;
+        }
+    }
+
+    if(mnVehMode == 2)   //ACC BRAKE
+    {
+        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;
+            }
+
+
+        }
+    }
+    else   //Speed Mode
+    {
+        if(mPressKeys.contains(Qt::Key_W)&&(mPressKeys.contains((Qt::Key_S))))
+        {
+            if(mfAcc > 0)
+            {
+                mfAcc = mfAcc - 10*timediff*mfAccSpeed/1000;
+                if(mfAcc<0)mfAcc = 0;
+            }
+            else
+            {
+                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))
+            {
+                if(mfAcc > 0)
+                {
+                    mfAcc = mfAcc - 10*timediff*mfAccSpeed/1000;
+                    if(mfAcc<0)mfAcc = 0;
+                }
+                else
+                {
+                    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)))&&(bInKeepMode == false))
+    {
+        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*5.5);
+    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))
+    {
+        mgrpcpc->SetCtrlMsg("remotectrl",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(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
+
+
+            QString cmd = QString("settrace(\"%1\",\"%2\")").arg(numJson).arg(num2Json);
+//            mMapview->page()->runJavaScript(cmd);
+        }
+
+    }
+
+//    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());
+//        mMapview->page()->runJavaScript(strscript);
+
+        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::onCamUpdate(int ncampos, QImage image)
+{
+    int i = ncampos;
+ //   ui->label_pic->setPixmap(QPixmap::fromImage(image));
+    mpsceneImg[i]->clear();
+//           mpsceneImg[i]->addPixmap(QPixmap::fromImage(image));
+    mpsceneImg[i]->addPixmap(QPixmap::fromImage(image));
+    mpviewImg[i]->setScene(mpsceneImg[i]);
+    mpviewImg[i]->show();
+}
+
+void MainWindow::paintEvent(QPaintEvent *)
+{
+    int i;
+    QTime xTime;
+    xTime;
+    xTime.start();
+    int nupdate = 0;
+    for(i=0;i<NUM_CAM;i++)
+    {
+ //       continue;
+        if(mbCamUpdate[i])
+        {
+            nupdate++;
+ //           xTime.start();
+ //           std::cout<<" copy image. "<<std::endl;
+            mMutexCam[i].lock();
+//            QImage image = mpImageCam[i]->copy();
+            mbCamUpdate[i] = false;
+
+
+            //       QImage image = mpPicView->GetImage();
+            mpsceneImg[i]->clear();
+ //           mpsceneImg[i]->addPixmap(QPixmap::fromImage(image));
+            mpsceneImg[i]->addPixmap(QPixmap::fromImage(*mpImageCam[i]));
+            mpviewImg[i]->setScene(mpsceneImg[i]);
+            mpviewImg[i]->show();
+            mMutexCam[i].unlock();
+//            std::cout<<" update a image use. "<<xTime.elapsed()<<std::endl;
+        }
+    }
+//    std::cout<<" time upadate time: "<<xTime.elapsed()<<" update cout:"<<nupdate<<std::endl;
+
+}
+
+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;
+
+
+    mgrpcpc->SetCtrlMsg("xodrreq",(char *)&xo,sizeof(xodrobj));
+//    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);
+ //   mMapview->page()->runJavaScript(strscript);
+
+}
+
+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;
+
+//    on_radioButton_picfront_clicked();
+}
+
+void MainWindow::on_radioButton_Null_clicked()
+{
+    mnShift = 0;
+}
+
+
+
+
+
+void MainWindow::onCloseDlg()
+{
+    qDebug("cloase");
+}
+
+void MainWindow::on_checkBox_clicked()
+{
+
+}
+
+void MainWindow::saveavi(int index)
+{
+    (void)index;
+}
+
+
+
+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();
+    }
+
+}
+
+void MainWindow::threadinfo()
+{
+    int nrtn;
+    iv::cloud::cloudmsg xcloudmsg;
+    while(mbThreadrun)
+    {
+        nrtn = mgrpcpc->GetQueryMsg(xcloudmsg,1000);
+        if(nrtn == 1)
+        {
+            int i;
+            for(i=0;i<xcloudmsg.xclouddata_size();i++)
+            {
+                iv::cloud::cloudunit * punit = xcloudmsg.mutable_xclouddata(i);
+                if(punit->msgname() == "hcp2_gpsimu")
+                {
+                    iv::gps::gpsimu xgpsimu;
+                    if(!xgpsimu.ParseFromArray(punit->data().data(),punit->data().size()))
+                    {
+                        std::cout<<"ListenRaw Parse error."<<std::endl;
+                        continue;
+                    }
+                    ggpsimu.CopyFrom(xgpsimu);
+                    gTimeGPSIMUUpdate = QDateTime::currentMSecsSinceEpoch();
+                }
+            }
+ //           std::cout<<" receive info msg. "<<std::endl;
+        }
+    }
+}
+
+void MainWindow::threadframe(int ncamppos)
+{
+    iv::h264rawframedata xframe;
+    while(mbThreadrun)
+    {
+//        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+//        continue;
+        int nrtn;
+        nrtn = mgrpcpc->Consumeh264frame(ncamppos,xframe,10);
+        if(nrtn == 1)
+        {
+//            std::cout<<"recv a frame."<<std::endl;
+            iv::rawframedata xrawframe;
+            xrawframe.mpstr_ptr = xframe.mpstr_ptr;
+            xrawframe.ndatasize = xframe.mdatasize;
+            mph264decode[ncamppos]->addframedata(xrawframe);
+        }
+    }
+}
+
+void MainWindow::threadpic(int ncampos)
+{
+
+    while(mbThreadrun)
+    {
+        int nindex = mph264decode[ncampos]->GetUpdatedIndex(10);
+        if(nindex<0)continue;
+//        std::cout<<" recv a yuv."<<std::endl;
+        iv::framedecodebuf * pbuf =  mph264decode[ncampos]->LockReadBuff(nindex);
+        int cy = pbuf->frameheight;
+        int cx = pbuf->framewidth;
+        cv::Mat rgbImg(cy, cx,CV_8UC3);
+
+#ifndef USE_QSV
+        cv::cvtColor(pbuf->myuvImg, rgbImg,  CV_YUV2RGB_I420);
+#endif
+#ifdef USE_QSV
+        cv::cvtColor(pbuf->myuvImg, rgbImg,  CV_YUV2RGB_NV12);
+#endif
+        mph264decode[ncampos]->UnlockReadBuff(nindex);
+
+        QImage image2 = QImage((uchar*)(rgbImg.data), rgbImg.cols, rgbImg.rows,  QImage::Format_RGB888);
+
+        mMutexCam[ncampos].lock();
+//        emit CamUpdate(ncampos,image2);
+        *mpImageCam[ncampos] = image2.copy();
+        mbCamUpdate[ncampos] = true;
+        mMutexCam[ncampos].unlock();
+        emit CamUpdate(ncampos);
+//        cv::cvtColor(rgbImg, rgbImg, CV_BGR2RGB);
+//        QImage image2 = QImage((uchar*)(rgbImg.data), rgbImg.cols, rgbImg.rows,  QImage::Format_RGB888);
+    }
+}
+
+void MainWindow::onCamUpdate(int ncampos)
+{
+    (void)ncampos;
+    static int64_t nlastupdate =0;
+    int64_t nnow = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
+    if(abs(nnow - nlastupdate)>30)
+    {
+        nlastupdate = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
+        update();
+    }
+}
+
+void MainWindow::on_actionFullScreem_triggered()
+{
+    showFullScreen();
+}
+
+void MainWindow::on_actionNormal_triggered()
+{
+    showNormal();
+}
+
+void MainWindow::on_horizontalSlider_wheelspeed_sliderMoved(int position)
+{
+    (void)position;
+    mfWheelSpeed = mfWheelBaseSpeed * ui->horizontalSlider_wheelspeed->value();
+}
+
+void MainWindow::on_horizontalSlider_wheelspeed_valueChanged(int value)
+{
+    (void)value;
+    mfWheelSpeed = mfWheelBaseSpeed * ui->horizontalSlider_wheelspeed->value();
+}

+ 236 - 0
src/tool/RemoteCtrl_Wide/mainwindow.h

@@ -0,0 +1,236 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+
+#define CAMERA_NUM 4
+
+#include <QMainWindow>
+
+#include <QTranslator>
+
+#include <QtWidgets>
+//#include <QtWebEngineWidgets/QtWebEngineWidgets>
+#include <QSet>
+#include <QMutex>
+#include <QLabel>
+
+#include <iostream>
+
+#include <speed.h>
+
+#include "remotectrl.pb.h"
+#include "gpsimu.pb.h"
+#include "rawpic.pb.h"
+
+#include "myview.h"
+#include "grpcpc.h"
+#include "modulecomm.h"
+#include "joyreadthread.h"
+#include "dialogsetpassword.h"
+#include "dialogsetting.h"
+#include "ivh264framedecode.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 onCloseDlg();
+    void onCloseBigDlg();
+
+    void on_checkBox_clicked();
+
+
+    void on_actionSet_Query_Pass_triggered();
+
+    void on_actionSetting_triggered();
+
+    void on_actionSet_Ctrl_Pass_triggered();
+
+    void onCamUpdate(int ncampos);
+
+    void on_actionFullScreem_triggered();
+
+    void on_actionNormal_triggered();
+
+    void on_horizontalSlider_wheelspeed_sliderMoved(int position);
+
+    void on_horizontalSlider_wheelspeed_valueChanged(int value);
+
+    void onCamUpdate(int ncampos,QImage image);
+
+signals:
+    void CamUpdate(int ncampos);
+    void CamUpdate(int ncampos,QImage image);
+public:
+     void resizeEvent(QResizeEvent *event);
+
+     void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+
+     void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+
+
+
+private:
+    Ui::MainWindow *ui;
+
+
+//    QWebEngineView * mMapview;
+
+    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 = 10; //100degree/s
+     double mfAccSpeed = 30; //30/s
+     double mfBrakeSpeed = 100; //100/s
+
+     double mfWheelBaseSpeed = 10;
+
+     double mfWheelAutoDownSpeed = 0;
+     double mfAccAutoDownSpeed = 10;
+     double mfBrakeAutoDownSpeed = 30;
+
+     iv::remotectrl mremotectrl;
+
+     void * mpa;
+
+     QTimer * mpTimerUpdateView;
+
+     MyView * mmyview;
+     QGraphicsScene *mscene;
+
+     MyView * mmyviewLeft,* mmyviewRear,*mmyviewRight;
+
+     MyView * mpviewImg[NUM_CAM];
+     QGraphicsScene * mpsceneImg[NUM_CAM];
+
+     void * mpadst;
+     void * mpasimpletrace;
+
+     grpcpc * mgrpcpc;
+
+     QString mstrProgName = "ADC IV Remote Control  ";
+     QString mstrGPSTime = " GPS:";
+     QString mstrPicTime = " Pic:";
+
+     QString mstrVIN;
+
+#ifndef Q_OS_WIN
+     JoyReadThread * mpJRT;
+#endif
+
+     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;
+
+private:
+    bool mbThreadrun = true;
+private:
+    void threadframe(int ncamppos);
+    void threadpic(int ncampos);
+    void threadinfo();
+
+private:
+    ivh264framedecode * mph264decode[NUM_CAM];
+
+    int mnframewidth = 1920;
+    int mnframeheight = 1080;
+
+    std::thread * mpthreadframe[NUM_CAM];
+    std::thread * mpthreadpic[NUM_CAM];
+    std::thread * mpthreadinfo;
+
+    QImage * mpImageCam[NUM_CAM];
+    bool mbCamUpdate[NUM_CAM];
+    QMutex mMutexCam[NUM_CAM];
+
+    int mnVehMode = 1; //1 Speed Mode  2 AccBrakeMode
+
+    QTranslator * m_translator;
+};
+#endif // MAINWINDOW_H

+ 463 - 0
src/tool/RemoteCtrl_Wide/mainwindow.ui

@@ -0,0 +1,463 @@
+<?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>270</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>840</x>
+      <y>240</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>30</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>80</x>
+       <y>30</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>210</x>
+       <y>20</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 class="QSlider" name="horizontalSlider_wheelspeed">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>100</y>
+       <width>181</width>
+       <height>21</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>60</y>
+       <width>131</width>
+       <height>31</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Wheel Speed:</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QGroupBox" name="groupBox_map">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>190</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>200</x>
+      <y>320</y>
+      <width>411</width>
+      <height>351</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>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1920</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>
+   <widget class="QMenu" name="menuView">
+    <property name="title">
+     <string>View</string>
+    </property>
+    <addaction name="actionFullScreem"/>
+    <addaction name="actionNormal"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menuView"/>
+  </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>
+  <action name="actionFullScreem">
+   <property name="text">
+    <string>FullScreen</string>
+   </property>
+  </action>
+  <action name="actionNormal">
+   <property name="text">
+    <string>Normal</string>
+   </property>
+  </action>
+ </widget>
+ <resources>
+  <include location="remotectrl.qrc"/>
+ </resources>
+ <connections/>
+</ui>

+ 128 - 0
src/tool/RemoteCtrl_Wide/myview.cpp

@@ -0,0 +1,128 @@
+#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);
+}
+
+void MyView::viewscaleto(double fratio)
+{
+    double fscale = fratio/beishu;
+    scale(fscale,fscale);
+    beishu *= fscale;
+    centerOn(450, 700 - (200 / beishu));
+}

+ 36 - 0
src/tool/RemoteCtrl_Wide/myview.h

@@ -0,0 +1,36 @@
+#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;
+    void viewscaleto(double fratio);
+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

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

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

+ 16 - 0
src/tool/RemoteCtrl_Wide/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

+ 6 - 0
src/tool/RemoteCtrl_Wide/remotecomm.cpp

@@ -0,0 +1,6 @@
+#include "remotecomm.h"
+
+remotecomm::remotecomm(grpcpc * pgrpcpc,QObject *parent) : QObject(parent)
+{
+    mpgrpcpc = pgrpcpc;
+}

+ 24 - 0
src/tool/RemoteCtrl_Wide/remotecomm.h

@@ -0,0 +1,24 @@
+#ifndef REMOTECOMM_H
+#define REMOTECOMM_H
+
+#include <QObject>
+
+#include "modulecomm.h"
+
+#include "grpcpc.h"
+
+class remotecomm : public QObject
+{
+    Q_OBJECT
+public:
+    explicit remotecomm(grpcpc * pgrpcpc, QObject *parent = nullptr);
+
+signals:
+
+public slots:
+
+private:
+    grpcpc * mpgrpcpc;
+};
+
+#endif // REMOTECOMM_H

BIN
src/tool/RemoteCtrl_Wide/remotectrl.png


+ 7 - 0
src/tool/RemoteCtrl_Wide/remotectrl.qrc

@@ -0,0 +1,7 @@
+<RCC>
+    <qresource prefix="/">
+        <file>remotectrl.png</file>
+        <file>zh_CN.qm</file>
+        <file>en_CN.qm</file>
+    </qresource>
+</RCC>

+ 162 - 0
src/tool/RemoteCtrl_Wide/remotectrlini.cpp

@@ -0,0 +1,162 @@
+#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";
+    }
+
+    mstrlanguage = configini->value("setting/language").toString().toStdString();
+    if(mstrlanguage == "")
+    {
+        mstrlanguage = "Chinese";
+    }
+
+    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;
+}
+
+std::string RemoteCtrlIni::GetLanguage()
+{
+    return mstrlanguage;
+}
+
+void RemoteCtrlIni::SetLanguase(std::string strlanguase)
+{
+    mstrlanguage = strlanguase;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/language",strlanguase.data());
+    delete configini;
+}

+ 58 - 0
src/tool/RemoteCtrl_Wide/remotectrlini.h

@@ -0,0 +1,58 @@
+#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();
+
+    std::string GetLanguage();
+    void SetLanguase(std::string strlanguase);
+
+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";
+
+    std::string mstrlanguage = "Chinese";
+};
+
+#define ServiceRCIni RemoteCtrlIni::Inst()
+
+#endif // REMOTECTRLINI_H

+ 136 - 0
src/tool/RemoteCtrl_Wide/rtspclientdown.cpp

@@ -0,0 +1,136 @@
+#include "rtspclientdown.h"
+
+#include <iostream>
+
+rtspclientdown::rtspclientdown(std::string strrtspserver)
+{
+    mpthread = new std::thread(&rtspclientdown::threadrtspdown,this,strrtspserver);
+}
+
+
+rtspclientdown::~rtspclientdown()
+{
+    mbthreadrun = false;
+    mpthread->join();
+}
+
+int rtspclientdown::Getretrycount()
+{
+    return mretrycount;
+}
+
+void rtspclientdown::threadrtspdown(std::string strrtspserver)
+{
+
+    AVFormatContext *i_fmt_ctx;
+    /* should set to NULL so that avformat_open_input() allocate a new one */
+    i_fmt_ctx = NULL;
+
+    AVDictionary *avdic=NULL;
+    char option_key[]="rtsp_transport";
+    char option_value[]="tcp";
+    av_dict_set(&avdic,option_key,option_value,0);
+
+    bool bConnected = false;
+
+    while(mbthreadrun)
+    {
+        if(bConnected == false)
+        {
+            i_fmt_ctx = NULL;
+            if (avformat_open_input(&i_fmt_ctx, strrtspserver.data(), NULL, &avdic)!=0)
+            {
+                fprintf(stderr, " = could not open input file\n");
+                std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+                mretrycount++;
+                continue ;
+            }
+
+
+            if (avformat_find_stream_info(i_fmt_ctx,NULL)<0)
+            {
+                fprintf(stderr, " = could not find stream info\n");
+                std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+                continue ;
+            }
+            bConnected = true;
+        }
+        AVPacket i_pkt;
+        av_init_packet(&i_pkt);
+        i_pkt.size = 0;
+        i_pkt.data = NULL;
+        if (av_read_frame(i_fmt_ctx, &i_pkt) <0 )
+        {
+            bConnected = false;
+            std::cout<<"connect fail. retry."<<std::endl;
+            continue;
+        }
+
+        iv::h264rawframedata xframe;
+        xframe.mdatasize = i_pkt.size;
+        xframe.mpstr_ptr = std::shared_ptr<char>(new char[xframe.mdatasize]);
+        memcpy(xframe.mpstr_ptr.get(),i_pkt.data,xframe.mdatasize);
+        mmutexframe.lock();
+        while(mvectorframe.size()>900)
+        {
+            std::cout<<" rtspclientdown::threadrtspdown. erase frame."<<std::endl;
+            mvectorframe.erase(mvectorframe.begin());
+        }
+        mvectorframe.push_back(xframe);
+        mmutexframe.unlock();
+
+        mcv.notify_all();
+
+
+         av_packet_unref(&i_pkt);
+    }
+}
+
+int rtspclientdown::Getrtspframe(iv::h264rawframedata &xframe, int nwaitms)
+{
+    int nrtn = 0;
+    if(mvectorframe.size()>0)
+    {
+        mmutexframe.lock();
+        if(mvectorframe.size()>0)
+        {
+            xframe = mvectorframe[0];
+            mvectorframe.erase(mvectorframe.begin());
+            nrtn = 1;
+        }
+        else
+        {
+            nrtn = 0;
+        }
+        mmutexframe.unlock();
+        return nrtn;
+    }
+
+    if(nwaitms == 0)return nrtn;
+
+    std::unique_lock<std::mutex> lk(mmutexcv);
+    if(mcv.wait_for(lk, std::chrono::milliseconds(nwaitms)) == std::cv_status::timeout)
+    {
+        lk.unlock();
+    }
+    else
+    {
+        lk.unlock();
+    }
+
+    mmutexframe.lock();
+    if(mvectorframe.size()>0)
+    {
+        xframe = mvectorframe[0];
+        mvectorframe.erase(mvectorframe.begin());
+        nrtn = 1;
+    }
+    else
+    {
+        nrtn = 0;
+    }
+    mmutexframe.unlock();
+    return nrtn;
+
+
+}

+ 54 - 0
src/tool/RemoteCtrl_Wide/rtspclientdown.h

@@ -0,0 +1,54 @@
+#ifndef RTSPCLIENTDOWN_H
+#define RTSPCLIENTDOWN_H
+
+extern "C"
+{
+#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
+#include <libavutil/imgutils.h>
+#include <libavutil/common.h>
+#include "libavutil/error.h"
+#include "libavutil/hwcontext.h"
+#include "libavformat/avformat.h"
+#include "libavformat/avio.h"
+}
+
+#include <mutex>
+#include <condition_variable>
+#include <thread>
+#include <vector>
+
+namespace iv {
+struct h264rawframedata
+{
+    std::shared_ptr<char> mpstr_ptr;
+    int mdatasize;
+};
+}
+
+class rtspclientdown
+{
+public:
+    rtspclientdown(std::string strrtspserver);
+    ~rtspclientdown();
+
+private:
+    std::thread * mpthread;
+    bool mbthreadrun = true;
+
+    std::vector<iv::h264rawframedata> mvectorframe;
+    std::mutex mmutexframe;
+    std::mutex mmutexcv;
+    std::condition_variable mcv;
+
+    int mretrycount = 0;
+
+private:
+    void threadrtspdown(std::string strrtspserver);
+
+public:
+    int Getrtspframe(iv::h264rawframedata & xframe,int nwaitms);
+    int Getretrycount();
+};
+
+#endif // RTSPCLIENTDOWN_H

+ 199 - 0
src/tool/RemoteCtrl_Wide/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 = 2;
+    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(double 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_Wide/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(double value);
+    void setunits(QString strunits);
+    void settitle(QString strtitle);
+};
+
+#endif // SPEED_H

BIN
src/tool/RemoteCtrl_Wide/zh_CN.qm