Browse Source

change RemoteCtrl_Wide.

yuchuli 2 years ago
parent
commit
b8f033c66c

+ 19 - 15
src/common/common/md5/md5_encode.cpp

@@ -23,6 +23,8 @@ UInt32 Md5Encode::CycleMoveLeft(UInt32 src_num, int bit_num_to_move) {
     }
     UInt32 num1 = src_num1 << bit_num_to_move;
     UInt32 num2 = src_num2 >> (32 - bit_num_to_move);
+    (void)num1;
+    (void)num2;
     
     return ((src_num1 << bit_num_to_move) \
         | (src_num2 >> (32 - bit_num_to_move)));
@@ -36,6 +38,7 @@ UInt32 Md5Encode::CycleMoveLeft(UInt32 src_num, int bit_num_to_move) {
 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;
+    (void)grop_num;
     int mod_bit_num = bit_num % BIT_OF_GROUP;
     int bit_need_fill = 0;
     if (mod_bit_num > (BIT_OF_GROUP - SRC_DATA_LEN)) {
@@ -48,19 +51,19 @@ UInt32 Md5Encode::FillData(const char *in_data_ptr, int data_byte_len, char** ou
     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);
+        memset(*out_data_ptr, 0, static_cast<size_t>(all_bit / BIT_OF_BYTE + SRC_DATA_LEN / BIT_OF_BYTE) );
         // copy data
-        memcpy(*out_data_ptr, in_data_ptr, data_byte_len);
+        memcpy(*out_data_ptr, in_data_ptr, static_cast<size_t>(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;
+        unsigned long long * origin_num =   reinterpret_cast<unsigned long long *>((*out_data_ptr) + ((all_bit / BIT_OF_BYTE)));
+        *origin_num = static_cast<unsigned long long>( data_byte_len*BIT_OF_BYTE)  ;
     }
-    return (all_bit / BIT_OF_BYTE + SRC_DATA_LEN / BIT_OF_BYTE);
+    return static_cast<unsigned int>(all_bit / BIT_OF_BYTE + SRC_DATA_LEN / BIT_OF_BYTE);
 }
 
 void Md5Encode::RoundF(char *data_BIT_OF_GROUP_ptr, ParamDynamic & param) {
@@ -87,7 +90,7 @@ 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));
+        UInt32 ti = static_cast<unsigned int >( 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);
@@ -108,7 +111,7 @@ 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));
+        UInt32 ti = static_cast<unsigned int>(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);
@@ -129,7 +132,7 @@ 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));
+        UInt32 ti = static_cast< unsigned int>( 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);
@@ -169,7 +172,7 @@ void Md5Encode::RotationCalculate(char *data_512_ptr, ParamDynamic & param) {
 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;
+    unsigned char *tmptr = reinterpret_cast<unsigned char *>(&num_str);
     int len = sizeof(num_str);
     // 小端字节序,逆序打印
     for (int i = 0; i < len; i++){
@@ -188,18 +191,18 @@ std::string Md5Encode::GetHexStr(unsigned int num_str) {
 std::string Md5Encode::Encode(std::string src_info) {
     ParamDynamic param;
     param.ua_ = kA;
-    param.ub_ = kB;
-    param.uc_ = kC;
+    param.ub_ = static_cast<unsigned int>(kB);
+    param.uc_ = static_cast<unsigned int>(kC);
     param.ud_ = kD;
     param.va_last_ = kA;
-    param.vb_last_ = kB;
-    param.vc_last_ = kC;
+    param.vb_last_ = static_cast<unsigned int>(kB);
+    param.vc_last_ = static_cast<unsigned int>(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);
+    int total_byte = static_cast<int>(FillData(src_data, static_cast<int>(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;
@@ -207,7 +210,8 @@ std::string Md5Encode::Encode(std::string src_info) {
         RotationCalculate(data_BIT_OF_GROUP, param);
     }
     if (NULL != out_data_ptr) {
-        delete[] out_data_ptr, out_data_ptr = NULL;
+        delete[] out_data_ptr;
+        out_data_ptr = NULL;
     }
     result.append(GetHexStr(param.ua_));
     result.append(GetHexStr(param.ub_));

+ 13 - 0
src/driver/driver_h264_dec/ivh264framedecode.cpp

@@ -324,6 +324,19 @@ void ivh264framedecode::decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket
         {
             mframeheight = frame->height;
             mframewidth = frame->width;
+
+            int i;
+            for(i=0;i<FRAMEDECBUFSIZE;i++)
+            {
+        #ifndef USEJPEG_NOOPENCV
+                mdecbuf[i].mbuf.myuvImg.create(mframeheight*3/2, mframewidth, CV_8UC1);
+        #else
+                mdecbuf[i].mbuf.mpyuv_ptr = std::shared_ptr<char>(new char[mframeheight* mframewidth*3/2]);
+        #endif
+                mdecbuf[i].mbuf.framewidth = mframewidth;
+                mdecbuf[i].mbuf.frameheight = mframeheight;
+
+            }
         }
         if(mbTransJpeg)
         {

+ 1 - 1
src/tool/RemoteCtrl_Wide/grpcpc.h

@@ -73,7 +73,7 @@ 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 gstrVIN = "AAAAAAAAAAAAAAAAB";
     std::string gstrqueryMD5 = "5d41402abc4b2a76b9719d911017c592";
     std::string gstrctrlMD5 = "5d41402abc4b2a76b9719d911017c592";
 

+ 45 - 26
src/tool/RemoteCtrl_Wide/mainwindow.cpp

@@ -299,6 +299,14 @@ void MainWindow::resizeEvent(QResizeEvent *event)
 
     int nMode = 1;
 
+    if(sizemain.height()>0)
+    {
+        if((sizemain.width()/sizemain.height())<3)
+        {
+            nMode = 0;
+        }
+    }
+
     ui->lineEdit_lat->setVisible(false);
     ui->lineEdit_lon->setVisible(false);
     ui->pushButton_test->setVisible(false);
@@ -472,27 +480,27 @@ void MainWindow::resizeEvent(QResizeEvent *event)
         //    mpWheel->setGeometry(sizemain.width()/2 + 20,10,200,200);
 
         int grouppos_x =  sizemain.width()*1/5;
-        int grouppos_y = sizemain.height()/2;
+        int grouppos_y =  260;
         int grouppos_width = sizemain.width()*1/5;
-        int grouppos_height = sizemain.height() * 1/2;
+        int grouppos_height = sizemain.height() -260;
 
 
         //    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);
+        int speed_width = grouppos_height - 130;
+        if(speed_width*3 > (sizemain.width()*1/5))speed_width = (sizemain.width()*1/5)/3;
+        mpWheel->setGeometry(0,130 ,speed_width,speed_width);
+        mpBrake->setGeometry(grouppos_width*1/3,130,speed_width,speed_width);
+        mpAcc->setGeometry(grouppos_width*2/3 ,130,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_y = 0;//sizemain.height();
         int groupmap_width = sizemain.width()/5;
-        int groupmap_height = sizemain.height();
+        int groupmap_height = 80;// 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);
@@ -500,47 +508,49 @@ void MainWindow::resizeEvent(QResizeEvent *event)
         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_y = 80;//sizemain.height()/2;
         int groupgps_width = sizemain.width()/5;
-        int groupgps_height = sizemain.height()/2;
+        int groupgps_height = 160;//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 lablewidth =groupgps_width*3/20;// (groupgps_width-50)*2/10;
+        int lewidth = groupgps_width*5/20;
         int leheight = 26;
 
+        ui->groupBox_gps->setGeometry(groupgps_x,groupgps_y,groupgps_width,groupgps_height);
+
+
         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_gpsrtk->setGeometry(groupgps_width/2,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsrtk->setGeometry(groupgps_width/2+10+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_gpslat->setGeometry(groupgps_width/2,nypos,lablewidth,leheight);
+        ui->lineEdit_gpslat->setGeometry(groupgps_width/2+10+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_gpsheight->setGeometry(groupgps_width/2,nypos,lablewidth,leheight);
+        ui->lineEdit_gpsheight->setGeometry(groupgps_width/2+10+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);
+ //       nypos = nypos + leheight*11/10;
+        ui->label_gpssat->setGeometry(groupgps_width/2,nypos,lablewidth,leheight);
+        ui->lineEdit_gpssat->setGeometry(groupgps_width/2+10+lablewidth,nypos,lewidth,leheight);
 
 
         double fscale = (sizemain.width()*1/5)*1.0/mnframewidth;
@@ -1183,6 +1193,15 @@ void MainWindow::threadpic(int ncampos)
         int cx = pbuf->framewidth;
         cv::Mat rgbImg(cy, cx,CV_8UC3);
 
+        if((cy!=mnframeheight) || (cx != mnframewidth))
+        {
+            mnframeheight = cy;
+            mnframewidth = cx;
+            resizeEvent(NULL);
+
+        }
+
+
 #ifndef USE_QSV
         cv::cvtColor(pbuf->myuvImg, rgbImg,  CV_YUV2RGB_I420);
 #endif

+ 2 - 2
src/tool/RemoteCtrl_Wide/mainwindow.h

@@ -218,8 +218,8 @@ private:
 private:
     ivh264framedecode * mph264decode[NUM_CAM];
 
-    int mnframewidth = 1920;
-    int mnframeheight = 1080;
+    int mnframewidth =  1920;
+    int mnframeheight = 1080;//720;
 
     std::thread * mpthreadframe[NUM_CAM];
     std::thread * mpthreadpic[NUM_CAM];

+ 1 - 1
src/tool/RemoteCtrl_Wide/mainwindow.ui

@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>1920</width>
-    <height>270</height>
+    <height>603</height>
    </rect>
   </property>
   <property name="windowTitle">

+ 3 - 3
src/tool/tool_ntripbroadcast/mainwindow.cpp

@@ -279,7 +279,7 @@ void MainWindow::readNtripMessage()
             str[ba.length()] = 0;
             memcpy(str,ba.data(),ba.length());
 //            qDebug(str);
-            if(strstr(str,"GET / HTTP") >0)
+            if(strstr(str,"GET / HTTP") != NULL)
             {
                 QDateTime dt = QDateTime::currentDateTime();
 
@@ -305,7 +305,7 @@ void MainWindow::readNtripMessage()
             }
             else
             {
-            if(strstr(str,"NTRIP") > 0)
+            if(strstr(str,"NTRIP") != NULL)
             {
                 qDebug(str);
                 qDebug("send cors ok");
@@ -317,7 +317,7 @@ void MainWindow::readNtripMessage()
                 mvectorNC.at(i)->mnState = 1;
 
             }
-            if(strstr(str,"$GPGGA") > 0)
+            if(strstr(str,"$GPGGA") != NULL)
             {
                 qDebug(str);
                 mvectorNC.at(i)->mstrGGA = str;

+ 2 - 2
src/tool/tool_ntripbroadcast/ntrip_client.cpp

@@ -76,14 +76,14 @@ void ntrip_client::readyReadSlot()
 
     case 4:
         str = (char *)message.data();
-        if(strstr(str,"ICY 200 OK") > 0)
+        if(strstr(str,"ICY 200 OK") != NULL)
         {
             mFindCMState = 5;
             qDebug("Login succcess");
         }
         else
         {
-            if(strstr(str,"HTTP 401 Unauthorized") > 0)
+            if(strstr(str,"HTTP 401 Unauthorized") != NULL)
             {
                 mFindCMState = -1;
                 qDebug("Authorize Fail. message is %s",message.data());