Ver código fonte

Change RemoteCtrl_Thread.

yuchuli 3 anos atrás
pai
commit
a0712407f5

+ 89 - 0
src/common/common/getinterface/get_interface.cpp

@@ -0,0 +1,89 @@
+#include "get_interface.h"
+
+#include <QtNetwork/QNetworkInterface>
+
+int getmac(std::string & strmac)
+{
+    bool bFindeth0 = false;
+    std::string strmacaddr;
+    std::vector<std::string> xvectormac;
+    QList<QNetworkInterface> interfaceList = QNetworkInterface::allInterfaces();
+
+    foreach(QNetworkInterface interfaceItem, interfaceList)
+    {
+        if(interfaceItem.flags().testFlag(QNetworkInterface::CanBroadcast)
+                &&interfaceItem.flags().testFlag(QNetworkInterface::CanMulticast)
+                &&!interfaceItem.flags().testFlag(QNetworkInterface::IsLoopBack)
+                &&interfaceItem.hardwareAddress()!="00:50:56:C0:00:01"
+                &&interfaceItem.hardwareAddress()!="00:50:56:C0:00:08")
+        {
+            std::string str = interfaceItem.hardwareAddress().toStdString();
+            xvectormac.push_back(str);
+            if(interfaceItem.name() == "eth0")
+            {
+                strmacaddr = str;
+                bFindeth0 = true;
+            }
+            QList<QNetworkAddressEntry> addressEntryList=interfaceItem.addressEntries();
+            foreach(QNetworkAddressEntry addressEntryItem, addressEntryList)
+            {
+                if(addressEntryItem.ip().protocol()==QAbstractSocket::IPv4Protocol)
+                {
+                    qDebug()<<"------------------------------------------------------------";
+                    qDebug()<<"Adapter Name:"<<interfaceItem.name();
+                    qDebug()<<"Adapter Address:"<<interfaceItem.hardwareAddress();
+                    qDebug()<<"IP Address:"<<addressEntryItem.ip().toString();
+                    qDebug()<<"IP Mask:"<<addressEntryItem.netmask().toString();
+                }
+            }
+        }
+    }
+
+    if(bFindeth0)
+    {
+        strmac = strmacaddr;
+        return 1;
+    }
+
+    if(xvectormac.size()>0)
+    {
+        strmac = xvectormac[0];
+        return 1;
+    }
+
+    return 0;
+}
+
+
+void getAdapterInfoWithQt()
+{
+    QList<QNetworkInterface> interfaceList = QNetworkInterface::allInterfaces();
+
+    foreach(QNetworkInterface interfaceItem, interfaceList)
+    {
+        if(interfaceItem.flags().testFlag(QNetworkInterface::IsUp)
+                &&interfaceItem.flags().testFlag(QNetworkInterface::IsRunning)
+                &&interfaceItem.flags().testFlag(QNetworkInterface::CanBroadcast)
+                &&interfaceItem.flags().testFlag(QNetworkInterface::CanMulticast)
+                &&!interfaceItem.flags().testFlag(QNetworkInterface::IsLoopBack)
+                &&interfaceItem.hardwareAddress()!="00:50:56:C0:00:01"
+                &&interfaceItem.hardwareAddress()!="00:50:56:C0:00:08")
+        {
+            QList<QNetworkAddressEntry> addressEntryList=interfaceItem.addressEntries();
+            foreach(QNetworkAddressEntry addressEntryItem, addressEntryList)
+            {
+                if(addressEntryItem.ip().protocol()==QAbstractSocket::IPv4Protocol)
+                {
+                    qDebug()<<"------------------------------------------------------------";
+                    qDebug()<<"Adapter Name:"<<interfaceItem.name();
+                    qDebug()<<"Adapter Address:"<<interfaceItem.hardwareAddress();
+                    qDebug()<<"IP Address:"<<addressEntryItem.ip().toString();
+                    qDebug()<<"IP Mask:"<<addressEntryItem.netmask().toString();
+                }
+            }
+        }
+    }
+}
+
+
+

+ 9 - 0
src/common/common/getinterface/get_interface.h

@@ -0,0 +1,9 @@
+#ifndef GET_INTERFACE_H
+#define GET_INTERFACE_H
+
+#include <string>
+
+int getmac(std::string & strmac);
+void getAdapterInfoWithQt();
+
+#endif // GET_INTERFACE_H

+ 217 - 0
src/common/common/md5/md5_encode.cpp

@@ -0,0 +1,217 @@
+#include "md5_encode.h"
+#include <iostream>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+// 幻数定义
+const int Md5Encode::kA = 0x67452301;
+const int Md5Encode::kB = 0xefcdab89;
+const int Md5Encode::kC = 0x98badcfe;
+const int Md5Encode::kD = 0x10325476;
+
+const unsigned long long Md5Encode::k_ti_num_integer = 4294967296;
+
+// function: CycleMoveLeft
+// @param src_num:要左移的数
+// @param bit_num_to_move:要移动的bit位数
+// @return  循环左移后的结果数
+UInt32 Md5Encode::CycleMoveLeft(UInt32 src_num, int bit_num_to_move) {
+    UInt32 src_num1 = src_num;
+    UInt32 src_num2 = src_num;
+    if (0 >= bit_num_to_move) {
+        return src_num;
+    }
+    UInt32 num1 = src_num1 << bit_num_to_move;
+    UInt32 num2 = src_num2 >> (32 - bit_num_to_move);
+    
+    return ((src_num1 << bit_num_to_move) \
+        | (src_num2 >> (32 - bit_num_to_move)));
+}
+
+// function: FillData
+// @param in_data_ptr:    要加密的信息数据
+// @param data_byte_len: 数据的字节数
+// @param out_data_ptr:  填充必要信息后的数据
+// return : 填充信息后的数据长度,以字节为单位
+UInt32 Md5Encode::FillData(const char *in_data_ptr, int data_byte_len, char** out_data_ptr) {
+    int bit_num = data_byte_len*BIT_OF_BYTE;
+    int grop_num = bit_num / BIT_OF_GROUP;
+    int mod_bit_num = bit_num % BIT_OF_GROUP;
+    int bit_need_fill = 0;
+    if (mod_bit_num > (BIT_OF_GROUP - SRC_DATA_LEN)) {
+        bit_need_fill = (BIT_OF_GROUP - mod_bit_num);
+        bit_need_fill += (BIT_OF_GROUP - SRC_DATA_LEN);
+    }
+    else {
+        bit_need_fill = (BIT_OF_GROUP - SRC_DATA_LEN) - mod_bit_num; //  这里多加了一个BIT_OF_GROUP,避免bit_need_fill正好等于0,暂时不加
+    }
+    int all_bit = bit_num + bit_need_fill;
+    if (0 < bit_need_fill) {
+        *out_data_ptr = new char[all_bit / BIT_OF_BYTE + SRC_DATA_LEN / BIT_OF_BYTE];
+        memset(*out_data_ptr, 0, all_bit / BIT_OF_BYTE + SRC_DATA_LEN / BIT_OF_BYTE);
+        // copy data
+        memcpy(*out_data_ptr, in_data_ptr, data_byte_len);
+        // fill rest data
+        unsigned char *tmp = reinterpret_cast<unsigned char *>(*out_data_ptr);
+        tmp += data_byte_len;
+        // fill 1 and 0
+        *tmp = 0x80;
+        // fill origin data len
+        unsigned long long * origin_num = (unsigned long long *)((*out_data_ptr) + ((all_bit / BIT_OF_BYTE)));
+        *origin_num = data_byte_len*BIT_OF_BYTE;
+    }
+    return (all_bit / BIT_OF_BYTE + SRC_DATA_LEN / BIT_OF_BYTE);
+}
+
+void Md5Encode::RoundF(char *data_BIT_OF_GROUP_ptr, ParamDynamic & param) {
+    UInt32 *M = reinterpret_cast<UInt32*>(data_BIT_OF_GROUP_ptr);
+    int s[] = { 7, 12, 17, 22 };
+    for (int i = 0; i < 16; ++i) {
+        UInt32 ti = k_ti_num_integer * abs(sin(i + 1));
+        if (i % 4 == 0) {
+            FF(param.ua_, param.ub_, param.uc_, param.ud_, M[i], s[i % 4], ti);
+        }
+        else if (i % 4 == 1) {
+            FF(param.ud_, param.ua_, param.ub_, param.uc_, M[i], s[i % 4], ti);
+        }
+        else if (i % 4 == 2) {
+            FF(param.uc_, param.ud_, param.ua_, param.ub_, M[i], s[i % 4], ti);
+        }
+        else if (i % 4 == 3) {
+            FF(param.ub_, param.uc_, param.ud_, param.ua_, M[i], s[i % 4], ti);
+        }
+    }
+}
+
+void Md5Encode::RoundG(char *data_BIT_OF_GROUP_ptr, ParamDynamic & param) {
+    UInt32 *M = reinterpret_cast<UInt32*>(data_BIT_OF_GROUP_ptr);
+    int s[] = { 5, 9, 14, 20 };
+    for (int i = 0; i < 16; ++i) {
+        UInt32 ti = k_ti_num_integer * abs(sin(i + 1 + 16));
+        int index = (i * 5 + 1) % 16;
+        if (i % 4 == 0) {
+            GG(param.ua_, param.ub_, param.uc_, param.ud_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 1) {
+            GG(param.ud_, param.ua_, param.ub_, param.uc_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 2) {
+            GG(param.uc_, param.ud_, param.ua_, param.ub_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 3) {
+            GG(param.ub_, param.uc_, param.ud_, param.ua_, M[index], s[i % 4], ti);
+        }
+    }
+}
+
+void Md5Encode::RoundH(char *data_BIT_OF_GROUP_ptr, ParamDynamic & param) {
+    UInt32 *M = reinterpret_cast<UInt32*>(data_BIT_OF_GROUP_ptr);
+    int s[] = { 4, 11, 16, 23 };
+    for (int i = 0; i < 16; ++i) {
+        UInt32 ti = k_ti_num_integer * abs(sin(i + 1 + 32));
+        int index = (i * 3 + 5) % 16;
+        if (i % 4 == 0) {
+            HH(param.ua_, param.ub_, param.uc_, param.ud_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 1) {
+            HH(param.ud_, param.ua_, param.ub_, param.uc_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 2) {
+            HH(param.uc_, param.ud_, param.ua_, param.ub_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 3) {
+            HH(param.ub_, param.uc_, param.ud_, param.ua_, M[index], s[i % 4], ti);
+        }
+    }
+}
+
+void Md5Encode::RoundI(char *data_BIT_OF_GROUP_ptr, ParamDynamic & param) {
+    UInt32 *M = reinterpret_cast<UInt32*>(data_BIT_OF_GROUP_ptr);
+    int s[] = { 6, 10, 15, 21 };
+    for (int i = 0; i < 16; ++i) {
+        UInt32 ti = k_ti_num_integer * abs(sin(i + 1 + 48));
+        int index = (i * 7 + 0) % 16;
+        if (i % 4 == 0) {
+            II(param.ua_, param.ub_, param.uc_, param.ud_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 1) {
+            II(param.ud_, param.ua_, param.ub_, param.uc_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 2) {
+            II(param.uc_, param.ud_, param.ua_, param.ub_, M[index], s[i % 4], ti);
+        }
+        else if (i % 4 == 3) {
+            II(param.ub_, param.uc_, param.ud_, param.ua_, M[index], s[i % 4], ti);
+        }
+    }
+}
+
+void Md5Encode::RotationCalculate(char *data_512_ptr, ParamDynamic & param) {
+    if (NULL == data_512_ptr) {
+        return;
+    }
+    RoundF(data_512_ptr, param);
+    RoundG(data_512_ptr, param);
+    RoundH(data_512_ptr, param);
+    RoundI(data_512_ptr, param);
+    param.ua_ = param.va_last_ + param.ua_;
+    param.ub_ = param.vb_last_ + param.ub_;
+    param.uc_ = param.vc_last_ + param.uc_;
+    param.ud_ = param.vd_last_ + param.ud_;
+    
+    param.va_last_ = param.ua_;
+    param.vb_last_ = param.ub_;
+    param.vc_last_ = param.uc_;
+    param.vd_last_ = param.ud_;
+}
+
+// 转换成十六进制字符串输出
+std::string Md5Encode::GetHexStr(unsigned int num_str) {
+    std::string hexstr = "";
+    char szch[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+    unsigned char *tmptr = (unsigned char *)&num_str;
+    int len = sizeof(num_str);
+    // 小端字节序,逆序打印
+    for (int i = 0; i < len; i++){
+        unsigned char ch = tmptr[i] & 0xF0;
+        ch = ch >> 4;
+        hexstr.append(1, szch[ch]);
+        ch = tmptr[i] & 0x0F;
+        hexstr.append(1, szch[ch]);
+    }
+    return hexstr;
+}
+
+// function: Encode
+// @param src_info:要加密的信息
+// return :加密后的MD5值
+std::string Md5Encode::Encode(std::string src_info) {
+    ParamDynamic param;
+    param.ua_ = kA;
+    param.ub_ = kB;
+    param.uc_ = kC;
+    param.ud_ = kD;
+    param.va_last_ = kA;
+    param.vb_last_ = kB;
+    param.vc_last_ = kC;
+    param.vd_last_ = kD;
+
+    std::string result;
+    const char *src_data = src_info.c_str();
+    char *out_data_ptr = NULL;
+    int total_byte = FillData(src_data, strlen(src_data), &out_data_ptr);
+    //char * data_BIT_OF_GROUP = out_data_ptr;
+    for (int i = 0; i < total_byte / (BIT_OF_GROUP / BIT_OF_BYTE); ++i) {
+        char * data_BIT_OF_GROUP = out_data_ptr;
+        data_BIT_OF_GROUP += i*(BIT_OF_GROUP / BIT_OF_BYTE);
+        RotationCalculate(data_BIT_OF_GROUP, param);
+    }
+    if (NULL != out_data_ptr) {
+        delete[] out_data_ptr, out_data_ptr = NULL;
+    }
+    result.append(GetHexStr(param.ua_));
+    result.append(GetHexStr(param.ub_));
+    result.append(GetHexStr(param.uc_));
+    result.append(GetHexStr(param.ud_));
+    return result;
+}

+ 71 - 0
src/common/common/md5/md5_encode.h

@@ -0,0 +1,71 @@
+/*
+*******************************************************
+* brief: md5 encryption
+* author: Monkey.Knight
+*******************************************************
+*/
+
+#ifndef __MD5_ENCODE_H__
+#define __MD5_ENCODE_H__
+
+// std
+#include <string>
+
+// define
+#define UInt32 unsigned int
+#define BIT_OF_BYTE  8
+#define BIT_OF_GROUP 512
+#define SRC_DATA_LEN 64
+
+// 四个非线性函数宏定义
+#define DEF_F(X, Y, Z ) ((( (X) & (Y) )|((~X)&(Z))))
+#define DEF_G(X, Y, Z)  (((X)&(Z))|((Y)&(~Z)))
+#define DEF_H(X, Y, Z)  ((X)^(Y)^(Z))
+#define DEF_I(X, Y, Z)  ((Y)^((X)|(~Z)))
+
+// 求链接数函数宏定义
+#define FF(a, b, c, d, Mj, s, ti)  (a = b + CycleMoveLeft((a + DEF_F(b,c,d) + Mj + ti),s));
+#define GG(a, b, c, d, Mj, s, ti)  (a = b + CycleMoveLeft((a + DEF_G(b,c,d) + Mj + ti),s));
+#define HH(a, b, c, d, Mj, s, ti)  (a = b + CycleMoveLeft((a + DEF_H(b,c,d) + Mj + ti),s));
+#define II(a, b, c, d, Mj, s, ti)  (a = b + CycleMoveLeft((a + DEF_I(b,c,d) + Mj + ti),s));
+
+
+class Md5Encode {
+public:
+    // 4轮循环算法
+    struct ParamDynamic{
+        UInt32 ua_;
+        UInt32 ub_;
+        UInt32 uc_;
+        UInt32 ud_;
+        UInt32 va_last_;
+        UInt32 vb_last_;
+        UInt32 vc_last_;
+        UInt32 vd_last_;
+    };
+public:
+    Md5Encode() {
+    }
+    std::string Encode(std::string src_info);
+
+protected:
+
+    UInt32 CycleMoveLeft(UInt32 src_num, int bit_num_to_move);
+    UInt32 FillData(const char *in_data_ptr, int data_byte_len, char** out_data_ptr);
+    void RoundF(char *data_512_ptr, ParamDynamic & param);
+    void RoundG(char *data_512_ptr, ParamDynamic & param);
+    void RoundH(char *data_512_ptr, ParamDynamic & param);
+    void RoundI(char *data_512_ptr, ParamDynamic & param);
+    void RotationCalculate(char *data_512_ptr, ParamDynamic & param);
+    std::string GetHexStr(unsigned int num_str);
+
+private:
+    // 幻数定义
+    static const int kA;
+    static const int kB;
+    static const int kC;
+    static const int kD;
+    static const unsigned long long k_ti_num_integer;
+};
+
+#endif

+ 2 - 2
src/common/modulecomm/shm/procsm.cpp

@@ -495,7 +495,7 @@ int procsm::writemsg(const char *str, const unsigned int nSize)
     }
     if(mbAttach == false)
     {
-        std::cout<<"ShareMemory Attach fail."<<std::endl;
+        std::cout<<mstrsmname<<"ShareMemory Attach fail."<<std::endl;
         return -1;
     }
     mpASM->lock();
@@ -606,7 +606,7 @@ int procsm::readmsg(unsigned int index, char *str, unsigned int nMaxSize,unsigne
     checkasm();
     if(mbAttach == false)
     {
-        std::cout<<"ShareMemory Attach fail."<<std::endl;
+        std::cout<<mstrsmname<<"ShareMemory Attach fail."<<std::endl;
         return -3;
     }    
     int nRtn = 0;

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

@@ -1,5 +1,6 @@
 #include "grpcpc.h"
 
+#include "remotectrlini.h"
 
 static grpcpc * ggrpcpc;
 
@@ -12,6 +13,7 @@ void ListenData(const char * strdata,const unsigned int nSize,const unsigned int
 grpcpc::grpcpc(std::string stryamlpath)
 {
 
+
     mstrpicmsgname[0] = "picfront";
     mstrpicmsgname[1] = "picrear";
     mstrpicmsgname[2] = "picleft";
@@ -20,9 +22,55 @@ grpcpc::grpcpc(std::string stryamlpath)
 
     ggrpcpc = this;
     dec_yaml(stryamlpath.data());
+
+    if(mvectormsgunit.size() == 0)
+    {
+        iv::msgunit xmu;
+        snprintf(xmu.mstrmsgname,256,"hcp2_gpsimu");
+        xmu.mnBufferSize = 10000;
+        xmu.mnBufferCount = 1;
+        mvectormsgunit.push_back(xmu);
+        snprintf(xmu.mstrmsgname,256,"simpletrace");
+        xmu.mnBufferSize = 100000;
+        xmu.mnBufferCount = 1;
+        mvectormsgunit.push_back(xmu);
+
+        if(mvectorctrlmsgunit.size() == 0)
+        {
+            snprintf(xmu.mstrmsgname,256,"xodrdst");
+            xmu.mnBufferSize = 1000;
+            xmu.mnBufferCount = 1;
+            mvectorctrlmsgunit.push_back(xmu);
+            snprintf(xmu.mstrmsgname,256,"xodrreq");
+            xmu.mnBufferSize = 1000;
+            xmu.mnBufferCount = 1;
+            xmu.mbImportant = true;
+            xmu.mnkeeptime = 3000;
+            mvectorctrlmsgunit.push_back(xmu);
+            snprintf(xmu.mstrmsgname,256,"remotectrl");
+            xmu.mnBufferSize = 1000;
+            xmu.mnBufferCount = 1;
+            mvectorctrlmsgunit.push_back(xmu);
+        }
+    }
+
     unsigned int i;
     for(i=0;i<mvectormsgunit.size();i++)
     {
+        bool bPicMsg = false;
+        unsigned int j;
+        for(j=0;j<NUM_CAM;j++)
+        {
+            if(strncmp(mvectormsgunit[i].mstrmsgname,mstrpicmsgname[j].data(),255 ) == 0)
+            {
+                bPicMsg = true;
+                break;
+            }
+        }
+        if(bPicMsg)
+        {
+            continue;
+        }
         mvectormsgunit[i].mpa = iv::modulecomm::RegisterSend(mvectormsgunit[i].mstrmsgname,mvectormsgunit[i].mnBufferSize,mvectormsgunit[i].mnBufferCount);
     }
 
@@ -390,7 +438,7 @@ void grpcpc::threadpicdownload(int nCamPos)
     int nsize = mvectormsgunit.size();
     int i;
 
-    std::string strcclientid = "test";
+    std::string strcclientid = ServiceRCIni.GetClientID();
 
     int ninterval = atoi(gstruploadinterval.data());
     if(ninterval<=0)ninterval = 100;
@@ -511,3 +559,34 @@ qint64 grpcpc::GetPicDownLatency(int nCamPos)
     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;
+}
+
+

+ 10 - 0
src/driver/driver_cloud_grpc_pc_thread/grpcpc.h

@@ -36,6 +36,7 @@
 
 #ifndef NUM_THREAD_PERCAM
 #define NUM_THREAD_PERCAM 1
+//int NUM_THREAD_PERCAM = 1;
 #endif
 
 using grpc::Channel;
@@ -114,6 +115,15 @@ public:
     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);
+
+
 };
 
 #endif // GRPCPC_H

+ 14 - 1
src/tool/RemoteCtrl_Thread/RemoteCtrl _Thread.pro → src/tool/RemoteCtrl_Thread/RemoteCtrl_Thread.pro

@@ -28,18 +28,23 @@ DEFINES += QT_DEPRECATED_WARNINGS
 #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/rawpic.pb.cc \
     ../../include/msgtype/remotectrl.pb.cc \
     dialogbigpic.cpp \
+    dialogsetpassword.cpp \
+    dialogsetting.cpp \
     ivpicview.cpp \
     ivview.cpp \
     joyreadthread.cpp \
     main.cpp \
     mainwindow.cpp \
     myview.cpp \
+    remotectrlini.cpp \
     speed.cpp \
     ../../driver/driver_cloud_grpc_pc_thread/grpcpc.cpp \
     ../../driver/driver_cloud_grpc_thread/uploadthreadmsg.grpc.pb.cc \
@@ -49,18 +54,23 @@ SOURCES += \
     ../../include/msgtype/uploadthreadmsg.pb.cc
 
 HEADERS += \
+    ../../common/common/getinterface/get_interface.h \
+    ../../common/common/md5/md5_encode.h \
     ../../include/msgtype/gps.pb.h \
     ../../include/msgtype/gpsimu.pb.h \
     ../../include/msgtype/imu.pb.h \
     ../../include/msgtype/rawpic.pb.h \
     ../../include/msgtype/remotectrl.pb.h \
     dialogbigpic.h \
+    dialogsetpassword.h \
+    dialogsetting.h \
     ivpicview.h \
     ivview.h \
     joyreadthread.h \
     mainwindow.h \
     myview.h \
     pos_def.h \
+    remotectrlini.h \
     speed.h \
     ../../driver/driver_cloud_grpc_pc_thread/grpcpc.h \
     ../../driver/driver_cloud_grpc_thread/uploadthreadmsg.grpc.pb.h \
@@ -71,6 +81,8 @@ HEADERS += \
 
 FORMS += \
     dialogbigpic.ui \
+    dialogsetpassword.ui \
+    dialogsetting.ui \
     mainwindow.ui \
     dialogpic.ui
 
@@ -115,6 +127,7 @@ LIBS += -L$$PWD/../../../thirdpartylib/grpc/lib
 
 LIBS += -lgrpc++_unsecure -lgrpc++_reflection -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_bad_variant_access -labsl_city -labsl_status -labsl_cord -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_bad_optional_access -labsl_raw_logging_internal -labsl_log_severity
 
-
+INCLUDEPATH += $$PWD/../../common/common/md5
+INCLUDEPATH += $$PWD/../../common/common/getinterface
 
 

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

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

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

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

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

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

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

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

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

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

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

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

+ 1 - 22
src/tool/RemoteCtrl_Thread/driver_cloud_grpc_pc.yaml

@@ -1,28 +1,7 @@
-server : 47.96.250.93
-port : 50051
-uploadinterval : 100
 
-VIN : AAAAAAAAAAAAAAAAA
-queryMD5 : 5d41402abc4b2a76b9719d911017c592
-ctrlMD5  : 5d41402abc4b2a76b9719d911017c592
 
 querymessage:
-  picfront:
-    msgname: picfront
-    buffersize: 10000000
-    buffercount: 1
-  picrear:
-    msgname: picrear
-    buffersize: 10000000
-    buffercount: 1
-  picleft:
-    msgname: picleft
-    buffersize: 10000000
-    buffercount: 1
-  picright:
-    msgname: picright
-    buffersize: 10000000
-    buffercount: 1
+
   hcp2_gpsimu:
     msgname: hcp2_gpsimu
     buffersize: 10000

+ 57 - 7
src/tool/RemoteCtrl_Thread/mainwindow.cpp

@@ -2,6 +2,8 @@
 #include "ui_mainwindow.h"
 #include "pos_def.h"
 
+#include "remotectrlini.h"
+
 MainWindow * gw;
 //#include "QStringLiteral"
 
@@ -120,20 +122,22 @@ MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindow)
 {
+
     gw = this;
+
     ui->setupUi(this);
 
-//    int * pax = 0;
-//    *pax = 1;
+    mstrserverip = ServiceRCIni.GetServerIP();
+    mstrserverport = ServiceRCIni.GetServerPort();
+    mstruploadinterval = ServiceRCIni.GetInterval();
+    mstrVehVIN = ServiceRCIni.GetVIN();
+    mstrqueryMD5 = ServiceRCIni.GetQueryMD5();
+    mstrctrlMD5 = ServiceRCIni.GetCtrlMD5();
 
     mpJRT = new JoyReadThread();
     mpJRT->start();
 
-    void * pa = iv::modulecomm::RegisterRecv(gstrmem_gpsimu.data(),Listengpsimu);
     int i;
-    for(i=0;i<CAMERA_NUM;i++)
-        pa = iv::modulecomm::RegisterRecv(gstrmem_pic[i].data(),Listenpic);
-
 
     CreateView();
 
@@ -168,9 +172,15 @@ MainWindow::MainWindow(QWidget *parent)
     timer->start(10);
 
     mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
-    mpasimpletrace = iv::modulecomm::RegisterRecv("simpletrace",Listensimpletrace);
+
 
     mgrpcpc = new grpcpc(gstryaml_path);
+    mgrpcpc->setserverip(mstrserverip);
+    mgrpcpc->setserverport(mstrserverport);
+    mgrpcpc->setqueryinterval(mstruploadinterval);
+    mgrpcpc->setVIN(mstrVehVIN);
+    mgrpcpc->setqueryMD5(mstrqueryMD5);
+    mgrpcpc->setctrlMD5(mstrctrlMD5);
     mgrpcpc->start();
 
     mstrVIN = mgrpcpc->GetVIN().data();
@@ -200,6 +210,15 @@ MainWindow::MainWindow(QWidget *parent)
     mpLabelLatency = pLabel;
     ui->statusbar->addPermanentWidget(pLabel);
 
+    mpasimpletrace = iv::modulecomm::RegisterRecv("simpletrace",Listensimpletrace);
+
+    void * pa = iv::modulecomm::RegisterRecv(gstrmem_gpsimu.data(),Listengpsimu);
+
+    for(i=0;i<CAMERA_NUM;i++)
+        pa = iv::modulecomm::RegisterRecv(gstrmem_pic[i].data(),Listenpic);
+
+
+
     setWindowTitle(mstrProgName +mstrVIN+  mstrGPSTime + mstrPicTime);
 
 }
@@ -856,3 +875,34 @@ void MainWindow::onCloseBigDlg()
 {
     mpbigpicdlg->setRefresh(false);
 }
+
+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();
+    }
+
+}

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

@@ -32,6 +32,10 @@
 
 #include "joyreadthread.h"
 
+#include "dialogsetpassword.h"
+#include "dialogsetting.h"
+
+
 
 QT_BEGIN_NAMESPACE
 namespace Ui { class MainWindow; }
@@ -102,6 +106,12 @@ private slots:
 
     void on_pushButton_big_clicked();
 
+    void on_actionSet_Query_Pass_triggered();
+
+    void on_actionSetting_triggered();
+
+    void on_actionSet_Ctrl_Pass_triggered();
+
 public:
      void resizeEvent(QResizeEvent *event);
 
@@ -183,5 +193,13 @@ private:
 
 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";
 };
 #endif // MAINWINDOW_H

+ 24 - 0
src/tool/RemoteCtrl_Thread/mainwindow.ui

@@ -489,8 +489,32 @@
      <height>28</height>
     </rect>
    </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>File</string>
+    </property>
+    <addaction name="actionSetting"/>
+    <addaction name="actionSet_Query_Pass"/>
+    <addaction name="actionSet_Ctrl_Pass"/>
+   </widget>
+   <addaction name="menuFile"/>
   </widget>
   <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionSetting">
+   <property name="text">
+    <string>Setting</string>
+   </property>
+  </action>
+  <action name="actionSet_Query_Pass">
+   <property name="text">
+    <string>Set Query Pass</string>
+   </property>
+  </action>
+  <action name="actionSet_Ctrl_Pass">
+   <property name="text">
+    <string>Set Ctrl Pass</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="remotectrl.qrc"/>

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

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

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

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