浏览代码

shared memory hmi

jiaolili 3 年之前
父节点
当前提交
89a2c93302
共有 1 个文件被更改,包括 49 次插入7 次删除
  1. 49 7
      src/v2x/CommunicatePlatform/mainwindow.cpp

+ 49 - 7
src/v2x/CommunicatePlatform/mainwindow.cpp

@@ -273,13 +273,10 @@ void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const un
             disableTbox();
             disableTbox();
         }
         }
     }
     }
-    if(xhmi.has_platformen()) {
-        bool enTbox=xhmi.platformen();
-        if(enTbox) {
-            enableTbox();
-        } else {
-            disableTbox();
-        }
+    if(xhmi.has_vin()) {
+        std::string str=xhmi.vin();
+        ui->lineEdit_VIN->setText(QString::fromStdString(str));
+        m_tbox->setTboxNewVin(str);
     }
     }
     if(xhmi.has_rodeinfoen()) {
     if(xhmi.has_rodeinfoen()) {
         bool enRadioBroadcast = xhmi.rodeinfoen();
         bool enRadioBroadcast = xhmi.rodeinfoen();
@@ -292,6 +289,51 @@ void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const un
         ui->checkBox_collisionWarning->setChecked(enRadioWarning);
         ui->checkBox_collisionWarning->setChecked(enRadioWarning);
     }
     }
     if(xhmi.has_roadjamsen()) {
     if(xhmi.has_roadjamsen()) {
+        bool enRadioIdenti = xhmi.roadjamsen();
+        m_radio->getBusyRoad(enRadioIdenti);
+        ui->checkBox_busyRoad->setChecked(enRadioIdenti);
+    }
+    if(xhmi.has_roaddricrimsen()) {
+        bool enRadioDanger =xhmi.roaddricrimsen();
+        m_radio->getDangerDrive(enRadioDanger);
+        ui->checkBox_dangerousDrive->setChecked(enRadioDanger);
+    }
+    if((xhmi.has_carcount())&&(xhmi.has_latup())&&(xhmi.has_latlow())
+            &&(xhmi.has_lonup())&&(xhmi.has_lonlow())
+            &&(xhmi.has_headingup())&&(xhmi.has_headinglow())
+            &&(xhmi.has_speedlow())&&(xhmi.has_speedup())) {
+        int virtualVehicleNum= int(xhmi.carcount());
+        ui->lineEdit_virtualVehicleNum->setText(QString::number(virtualVehicleNum));
+        double latMax = xhmi.latup();
+        ui->lineEdit_latMax->setText(QString("%1").arg(latMax));
+        double latMin= xhmi.latlow();
+        ui->lineEdit_latMin->setText(QString("%1").arg(latMin));
+        double lngMax= xhmi.lonup();
+        ui->lineEdit_lngMax->setText(QString("%1").arg(lngMax));
+        double lngMin= xhmi.lonlow();
+        ui->lineEdit_lngMin->setText(QString("%1").arg(lngMin));
+        float speedMax= xhmi.speedup();
+        ui->lineEdit_speedMax->setText(QString("%1").arg(speedMax));
+        float speedMin= xhmi.speedlow();
+        ui->lineEdit_speedMin->setText(QString("%1").arg(speedMin));
+        float yawMax=xhmi.headingup();
+        ui->lineEdit_yawMax->setText(QString("%1").arg(yawMax));
+        float yawMin=xhmi.headinglow();
+        ui->lineEdit_yawMin->setText(QString("%1").arg(yawMin));
+        int randId=qrand()%10000;
+        m_vectorRandom.push_back(randId);
+        virtualVehicleM structVirtualVehicle;
+        for(int i=1;i<virtualVehicleNum;i++) {
+            getRandomNum();
+        }
+        for(int i=0;i<virtualVehicleNum;i++) {
+            structVirtualVehicle.vin = m_vectorVin[i];
+            structVirtualVehicle.gps_lat=latMin+((double(m_vectorRandom[i]))/10000.0)*(latMax-latMin);
+            structVirtualVehicle.gps_lng=lngMin+((double(m_vectorRandom[i]))/10000.0)*(lngMax-lngMin);
+            structVirtualVehicle.speed=speedMin+((float(m_vectorRandom[i]))/10000.0)*(speedMax-speedMin);
+            structVirtualVehicle.yaw=yawMin+((float(m_vectorRandom[i]))/10000.0)*(yawMax-yawMin);
+            m_radio->upVirtualVehicle(structVirtualVehicle);
+        }
 
 
     }
     }