瀏覽代碼

brain & UI& platform

HAPO-9# 3 年之前
父節點
當前提交
ba36084061

+ 2 - 0
src/decition/common/common/car_status.h

@@ -234,6 +234,8 @@ namespace iv {
         double iTrafficeLightLon = 0;
         QTime milightCheckTimer;
         QTime mRSUupdateTimer;
+         QTime mRSUWarnUpdateTimer;
+          QTime mRSUTrafficUpdateTimer;
     };
     typedef boost::serialization::singleton<iv::CarStatus> CarStatusSingleton;//非线程安全,注意多线程加锁,单例模式
 }

+ 2 - 0
src/decition/decition_brain_sf_1x/decition/brain.cpp

@@ -1691,6 +1691,7 @@ void iv::decition::BrainDecition::UpdateV2r(const char *pdata, const int ndatasi
     if(group_message.has_radiobroadcasttraffictype())
     {
         ServiceCarStatus.rsu_traffic_type = group_message.radiobroadcasttraffictype();
+        ServiceCarStatus.mRSUTrafficUpdateTimer.start();
     }
     if(group_message.has_radiobroadcastspeedlimit())
     {
@@ -1699,6 +1700,7 @@ void iv::decition::BrainDecition::UpdateV2r(const char *pdata, const int ndatasi
     if(group_message.has_radiowarningtype())
     {
         ServiceCarStatus.rsu_warning_type = group_message.radiowarningtype();
+        ServiceCarStatus.mRSUWarnUpdateTimer.start();
     }
     if(group_message.has_radiowarningspeedlimit())
     {

+ 19 - 1
src/decition/decition_brain_sf_1x/decition/decide_gps_00.cpp

@@ -2022,12 +2022,30 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
 
 
     //-----------------------------------------1+X采集车车路协同,add---------------------------------------------
-    if(ServiceCarStatus.mRSUupdateTimer.elapsed()>5*1000)
+    if(ServiceCarStatus.mRSUupdateTimer.elapsed()>10*1000)
     {
        ServiceCarStatus.rsu_traffic_type=200;//lvdeng
        ServiceCarStatus.rsu_warning_type=200;
 //       ServiceCarStatus.rsu_gps_lat = 0.0;  //路况信息或预警信息有效的时候才会使用到这写变量,所以这些变量的信息可不清除
 //       ServiceCarStatus.rsu_gps_lng = 0.0;
+//       ServiceCarStatus.rsu_trafficelimit_spd=200;
+    }
+    if(ServiceCarStatus.mRSUTrafficUpdateTimer.elapsed()>10*1000)
+    {
+       ServiceCarStatus.rsu_traffic_type=200;//lvdeng
+       ServiceCarStatus.rsu_trafficelimit_spd=200;
+//       ServiceCarStatus.rsu_warning_type=200;
+//       ServiceCarStatus.rsu_gps_lat = 0.0;  //路况信息或预警信息有效的时候才会使用到这写变量,所以这些变量的信息可不清除
+//       ServiceCarStatus.rsu_gps_lng = 0.0;
+//       ServiceCarStatus.rsu_trafficelimit_spd=200;
+    }
+    if(ServiceCarStatus.mRSUWarnUpdateTimer.elapsed()>10*1000)
+    {
+//       ServiceCarStatus.rsu_traffic_type=200;//lvdeng
+       ServiceCarStatus.rsu_warning_type=200;
+       ServiceCarStatus.rsu_warnlimit_spd=200;
+//       ServiceCarStatus.rsu_gps_lat = 0.0;  //路况信息或预警信息有效的时候才会使用到这写变量,所以这些变量的信息可不清除
+//       ServiceCarStatus.rsu_gps_lng = 0.0;
 //       ServiceCarStatus.rsu_trafficelimit_spd=200;
     }
     int traffic_type=ServiceCarStatus.rsu_traffic_type;//路况信息

+ 21 - 11
src/ui/ui_ads_hmi_1px/ADCIntelligentVehicle.cpp

@@ -433,7 +433,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
 
     mTimerState1.setTimerType(Qt::PreciseTimer);    //设置计时器的精确程度    Qt::PreciseTimer值为0,含义:精确定时器试图保持毫秒精度
     connect(&mTimerState1,SIGNAL(timeout()),this,SLOT(onStateTimerTraffic()));//广播发送UDP数据报
-    mTimerState1.start(100);   //定时100ms
+    mTimerState1.start(300);   //定时100ms
 
 #endif
 
@@ -612,11 +612,12 @@ void ADCIntelligentVehicle::updateV2R(iv::v2r::v2r_send xv2rMsg)
         ServiceCarStatus.time_straight = miLightRemain;
         miobuSt = 0;
     }
-    if(xv2rMsg.has_radiobroadcastgpslat())
+    if(xv2rMsg.has_radiobroadcastgpslat())//luuang
     {
         miBroadcastGpsLat = xv2rMsg.radiobroadcastgpslat();
         miBroadcastGpsLon = xv2rMsg.radiobroadcastgpslon();
         miobuSt = 0;
+        miobuLKSt = 1;
     }
     if(xv2rMsg.has_radiobroadcastrange())
     {
@@ -624,10 +625,11 @@ void ADCIntelligentVehicle::updateV2R(iv::v2r::v2r_send xv2rMsg)
         miBroadcastTrafficType = xv2rMsg.radiobroadcasttraffictype();
         miobuSt = 0;
     }
-    if(xv2rMsg.has_radiowarningspeedlimit())
+    if(xv2rMsg.has_radiowarningspeedlimit())//pengzhuang
     {
         miBroadcastSpeedLimit = xv2rMsg.radiobroadcastspeedlimit();
         miobuSt = 0;
+        miobuPZSt = 1;
     }
     if(xv2rMsg.has_radiowarningtype())
     {
@@ -640,10 +642,11 @@ void ADCIntelligentVehicle::updateV2R(iv::v2r::v2r_send xv2rMsg)
         miWarningSpeedLimit = xv2rMsg.radiowarningspeedlimit();
         miobuSt = 0;
     }
-    if(xv2rMsg.has_radioidentistart())
+    if(xv2rMsg.has_radioidentistart())//yongdu
     {
         miIdentiStart = xv2rMsg.radioidentistart();
         miobuSt = 0;
+        miobuYDSt = 1;
     }
 }
 
@@ -818,6 +821,14 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
             ui->label_35->setPixmap(QPixmap::fromImage(img3));
             break;
         }
+        if(mbTrafficInfoEn)
+            ui->button_trafficInfoLight_st->setStyleSheet("background-color: green");
+        if(mbFCWEn)
+            ui->button_FWCLight_st->setStyleSheet("background-color: green");
+        if(mbjamsEn)
+            ui->button_jamsLight_st->setStyleSheet("background-color: green");
+        if(mbjamsEn)//交通拥堵
+            ui->button_DriCrimsLight_st->setStyleSheet("background-color: green");
     }
     else
     {
@@ -830,7 +841,7 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
     {
         if(mbTrafficInfoEn)
         {
-            if(miobuSt == 1)
+            if(miobuSt == 1 && miobuLKSt == 1)
             {
                 QString eventType;
                 switch(miBroadcastTrafficType){
@@ -852,7 +863,6 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
                 }
 
 
-                ui->button_trafficInfoLight_st->setStyleSheet("background-color: green");
                 ui->textBr_trafficInfo->append(QTime::currentTime().toString("hh:mm:ss.zzz") + \
                                                "\n\t事件范围[ 经度:" + QString::number(miBroadcastGpsLon,'g',6) +\
                                                " 纬度:" + QString::number(miBroadcastGpsLat,'g',6) + \
@@ -871,6 +881,7 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
                 default:
                     break;
                 }
+                miobuLKSt++;
             }
             else if(miobuSt == 10)
             {
@@ -882,7 +893,7 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
         }
         else if(mbFCWEn)//碰撞预警
         {
-            if(miobuSt == 1)
+            if(miobuSt == 1 && miobuPZSt == 1)
             {
                 switch(miWarningType){
                 case 1:
@@ -896,7 +907,7 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
                 default:
                     break;
                 }
-                ui->button_FWCLight_st->setStyleSheet("background-color: green");
+                miobuPZSt++;
             }
             else if(miobuSt == 10)
             {
@@ -907,11 +918,11 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
         }
         else if(mbjamsEn)//交通拥堵
         {
-            if(miobuSt == 1)
+            if(miobuSt == 1 && miobuYDSt == 1)
             {
-                ui->button_jamsLight_st->setStyleSheet("background-color: green");
                 ui->lineEdit_jamsMode->setText("开启");
                 ui->lineEdit_jamsVIN->setText(QString::fromStdString(gstrvin));
+                miobuYDSt++;
 
             }
             else if(miobuSt == 10)
@@ -926,7 +937,6 @@ void ADCIntelligentVehicle::onStateTimerTraffic()
         {
             if(miobuSt == 1)
             {
-                ui->button_DriCrimsLight_st->setStyleSheet("background-color: green");
                 ui->textBr_FCW_2->append(QTime::currentTime().toString("hh:mm:ss.zzz")+"进入危险驾驶模式");
             }
             else if(miobuSt == 10)

+ 3 - 0
src/ui/ui_ads_hmi_1px/ADCIntelligentVehicle.h

@@ -357,6 +357,9 @@ private:
 //    bool mbSimCarEn = false;//仿真车辆设置使能
     bool mbdriCrimsEn = false;//危险驾驶使能状态
     int miobuSt=0; //obu状态监控,1s未更新判定为离线
+    int miobuLKSt=0;//lukuangjiankong
+    int miobuPZSt=0;//pengzhuang
+    int miobuYDSt=0;//yongdu
     void ShareHMIMsgPro(iv::hmi::hmimsg xhmimsg);
     int miLightType = 255;//红绿灯类型 1:绿灯 2:红灯 3:黄灯 254:异常 255:无效
     int miLightRemain = 0;//当前灯剩余时间 单位:S

+ 17 - 17
src/v2x/CommunicatePlatform/mainwindow.cpp

@@ -248,7 +248,7 @@ void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const un
     if(xhmi.has_vin()) {
         std::string str=xhmi.vin();
         //ui->lineEdit_VIN->setText(QString::fromStdString(str));
-        qDebug()<<"[HMI]:get vin "<<QString::fromStdString(str);
+        //qDebug()<<"[HMI]:get vin "<<QString::fromStdString(str);
         m_tbox->setTboxNewVin(str);
         m_radio->setVin(str);
     }
@@ -256,25 +256,25 @@ void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const un
         bool enRadioBroadcast = xhmi.rodeinfoen();
         m_radio->getTrafficBroadcast(enRadioBroadcast);
         //ui->checkBox_trafficBroadcast->setChecked(enRadioBroadcast);
-        qDebug()<<"[HMI]:get enRadioBroadcast is  "<<enRadioBroadcast;
+        //qDebug()<<"[HMI]:get enRadioBroadcast is  "<<enRadioBroadcast;
     }
     if(xhmi.has_rodefcwen()) {
         bool enRadioWarning = xhmi.rodefcwen();
         m_radio->getCollisonWarning(enRadioWarning);
         //ui->checkBox_collisionWarning->setChecked(enRadioWarning);
-        qDebug()<<"[HMI]:get enRadioWarning is  "<<enRadioWarning;
+        //qDebug()<<"[HMI]:get enRadioWarning is  "<<enRadioWarning;
     }
     if(xhmi.has_roadjamsen()) {
         bool enRadioIdenti = xhmi.roadjamsen();
         m_radio->getBusyRoad(enRadioIdenti);
         //ui->checkBox_busyRoad->setChecked(enRadioIdenti);
-        qDebug()<<"[HMI]:get enRadioIdenti is  "<<enRadioIdenti;
+        //qDebug()<<"[HMI]:get enRadioIdenti is  "<<enRadioIdenti;
     }
     if(xhmi.has_roaddricrimsen()) {
         bool enRadioDanger =xhmi.roaddricrimsen();
         m_radio->getDangerDrive(enRadioDanger);
         //ui->checkBox_dangerousDrive->setChecked(enRadioDanger);
-        qDebug()<<"[HMI]:get enRadioDanger is  "<<enRadioDanger;
+        //qDebug()<<"[HMI]:get enRadioDanger is  "<<enRadioDanger;
     }
     if((xhmi.has_carcount())&&(xhmi.has_latup())&&(xhmi.has_latlow())
             &&(xhmi.has_lonup())&&(xhmi.has_lonlow())
@@ -282,31 +282,31 @@ void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const un
             &&(xhmi.has_speedlow())&&(xhmi.has_speedup())) {
         int virtualVehicleNum= int(xhmi.carcount());
         //ui->lineEdit_virtualVehicleNum->setText(QString::number(virtualVehicleNum));
-        qDebug()<<"[HMI]:get virtualVehicleNum is  "<<virtualVehicleNum;
+        //qDebug()<<"[HMI]:get virtualVehicleNum is  "<<virtualVehicleNum;
         double latMax = xhmi.latup();
         //ui->lineEdit_latMax->setText(QString("%1").arg(latMax));
-        qDebug()<<"[HMI]:get latMax is  "<<latMax;
+        //qDebug()<<"[HMI]:get latMax is  "<<latMax;
         double latMin= xhmi.latlow();
         //ui->lineEdit_latMin->setText(QString("%1").arg(latMin));
-        qDebug()<<"[HMI]:get latMin is  "<<latMin;
+        //qDebug()<<"[HMI]:get latMin is  "<<latMin;
         double lngMax= xhmi.lonup();
         //ui->lineEdit_lngMax->setText(QString("%1").arg(lngMax));
-        qDebug()<<"[HMI]:get lngMax is  "<<lngMax;
+        //qDebug()<<"[HMI]:get lngMax is  "<<lngMax;
         double lngMin= xhmi.lonlow();
         //ui->lineEdit_lngMin->setText(QString("%1").arg(lngMin));
-        qDebug()<<"[HMI]:get lngMin is  "<<lngMin;
+        //qDebug()<<"[HMI]:get lngMin is  "<<lngMin;
         float speedMax= xhmi.speedup();
         //ui->lineEdit_speedMax->setText(QString("%1").arg(speedMax));
-        qDebug()<<"[HMI]:get speedMax is  "<<speedMax;
+        //qDebug()<<"[HMI]:get speedMax is  "<<speedMax;
         float speedMin= xhmi.speedlow();
         //ui->lineEdit_speedMin->setText(QString("%1").arg(speedMin));
-        qDebug()<<"[HMI]:get speedMin is  "<<speedMin;
+        //qDebug()<<"[HMI]:get speedMin is  "<<speedMin;
         float yawMax=xhmi.headingup();
         //ui->lineEdit_yawMax->setText(QString("%1").arg(yawMax));
-        qDebug()<<"[HMI]:get yawMax is  "<<yawMax;
+        //qDebug()<<"[HMI]:get yawMax is  "<<yawMax;
         float yawMin=xhmi.headinglow();
         //ui->lineEdit_yawMin->setText(QString("%1").arg(yawMin));
-        qDebug()<<"[HMI]:get yawMin is  "<<yawMin;
+        //qDebug()<<"[HMI]:get yawMin is  "<<yawMin;
         int randId=qrand()%10000;
         m_vectorRandom.push_back(randId);
         virtualVehicleM structVirtualVehicle;
@@ -343,7 +343,7 @@ void MainWindow::UpdateControl(const char *strdata, const unsigned int nSize, co
         float soc = xcontrol.soc();
         m_structChassisRaw.soc=soc;
         //ui->textEdit->append(QString("[chassis]:Memory control get soc: %1\n").arg(soc));
-        qDebug()<<"[chassis]:Memory control get soc: "<<soc;
+        //qDebug()<<"[chassis]:Memory control get soc: "<<soc;
     }
     if(xcontrol.has_driver_error()) {
         isSend=true;
@@ -433,10 +433,10 @@ unsigned char MainWindow::getError()
                     m_structChassisRaw.steer_motor_error|m_structChassisRaw.swj_error);
     if(error) {
         return 0x01;
-        qDebug()<<"[chassis]:Memory control get error true!";
+        //qDebug()<<"[chassis]:Memory control get error true!";
     } else {
         return 0x02;
-        qDebug()<<"[chassis]:Memory control get error false!";
+        //qDebug()<<"[chassis]:Memory control get error false!";
     }
 }
 

+ 78 - 71
src/v2x/CommunicatePlatform/radio.cpp

@@ -78,9 +78,9 @@ void Radio::sendProto(iv::v2r::v2r_send radio_protobuf_send)
     strser = new char[nbytesize];
     bser = radio_protobuf_send.SerializeToArray(strser,nbytesize);
     if(bser) {
-        qDebug()<<"[Radio]:ready send protobuffer"<<endl;
+        //qDebug()<<"[Radio]:ready send protobuffer"<<endl;
         iv::modulecomm::ModuleSendMsg(mpmem_radio_send_addr,strser,nbytesize);
-        qDebug()<<"[Radio]:has sended protobuffer"<<endl;
+        //qDebug()<<"[Radio]:has sended protobuffer"<<endl;
     } else {
         //mivlog->error("sendData","[%s:] radio serialize error.",__func__);
 //        gfault->SetFaultState(1, 0, "radio serialize err");
@@ -100,18 +100,18 @@ void Radio::setGpsImuMemory(gpsImuM m)
 
 void Radio::sendResponseMessage(int type)
 {
-    m_responseType=type&0xFF;
-    upRespondMessageRealtimeTraffic();
+    if(m_bEnTrafficBroadcast) {
+        m_responseType=type&0xFF;
+        upRespondMessageRealtimeTraffic();
+    }
+
 }
 void Radio::outRealtimeTraffic(realtimeTrafficMessage realtimeTraffic)
 {
     if(m_bEnTrafficBroadcast) {
         iv::v2r::v2r_send protobuf;
         double lat=((double)realtimeTraffic.lat)/1000000.0;
-        double lon=((double)realtimeTraffic.lng)/1000000.0;
-        qDebug()<<"[Radio]:real time traffic lat is "<<lat<<". lng is "<<lon
-               <<".scope is "<<realtimeTraffic.scope<<".traffic info is "<<realtimeTraffic.trafficInfo
-              <<". speed limit is "<<realtimeTraffic.speedLimit<<endl;
+        double lon=((double)realtimeTraffic.lng)/1000000.0;        
         protobuf.set_radiobroadcastgpslat(lat);
         protobuf.set_radiobroadcastgpslon(lon);
         protobuf.set_radiobroadcastrange(realtimeTraffic.scope);
@@ -127,7 +127,7 @@ void Radio::outCollisionWarning(collisionEarlyWarningMessage collisionWarning)
         iv::v2r::v2r_send protobuf;
         protobuf.set_radiowarningtype(collisionWarning.warningType);
         protobuf.set_radiowarningspeedlimit(collisionWarning.speedLimit);
-        qDebug()<<"[Radio]:warning type is "<<collisionWarning.warningType<<".speed limit is:"<<collisionWarning.speedLimit<<endl;
+        //qDebug()<<"[Radio]:warning type is "<<collisionWarning.warningType<<".speed limit is:"<<collisionWarning.speedLimit<<endl;
         sendProto(protobuf);
     }
 }
@@ -137,7 +137,7 @@ void Radio::outCongestionIdenti(congestionIdentificationMessage congestionIdenti
     if(m_bEnBusyRoad) {
         iv::v2r::v2r_send protobuf;
         protobuf.set_radioidentistart(congestionIdenti.openCommand);
-        qDebug()<<"[Radio]:congestion identi open command is "<<congestionIdenti.openCommand<<endl;
+        //qDebug()<<"[Radio]:congestion identi open command is "<<congestionIdenti.openCommand<<endl;
         sendProto(protobuf);
     }
 }
@@ -189,7 +189,7 @@ void Radio::heartBeat()
             openSerial();
         } else {
             decodeData();
-            testWarningSpeedLimit();
+            //testWarningSpeedLimit();
             upDataStream();
             //if no answer,shake hands three times
             if(m_iResponse!=-1) {
@@ -286,14 +286,14 @@ void Radio::upDataStream()
     m_serialPort_Radio->write(sendBuf,headLen+dataLen+1);
     m_serialPort_Radio->flush();
     //m_serialPort_Radio->write("sendBuf");
-    qDebug() << "[RADIO]:up vehicle message "<<endl;
+    //qDebug() << "[RADIO]:up vehicle message "<<endl;
 }
 void Radio::upVirtualVehicle(virtualVehicleM virtualVehicle)
 {
     m_iVirtualVehicle=0;
     m_structMVirtualVehicle=virtualVehicle;
     upVirtualVehicleRaw();
-    qDebug() << "[RADIO]:up virtual vehicle message "<<endl;
+    //qDebug() << "[RADIO]:up virtual vehicle message "<<endl;
 }
 void Radio::upVirtualVehicleRaw()
 {
@@ -339,13 +339,13 @@ void Radio::upVirtualVehicleRaw()
 }
 void Radio::upRespondMessage()
 {
-    qDebug() << "[RADIO]:up response message "<<endl;
+    //qDebug() << "[RADIO]:up response message "<<endl;
     m_iResponse=0;
     upRespondMessageRaw(0x02);
 }
 void Radio::upRespondMessageRealtimeTraffic()
 {
-    qDebug() << "[RADIO]:up response real time traffic message "<<endl;
+   // qDebug() << "[RADIO]:up response real time traffic message "<<endl;
     m_iResponseRealtimeTraffic=0;
     upRespondMessageRaw(0x01);
 }
@@ -477,8 +477,8 @@ void Radio::decodeData()
     if(m_data.size()>= BATH_LENTH) {
 
         // 防包太大
-        if (m_data.size() > 2048) {
-            qDebug() << "size too large";
+        if (m_data.size() > 512) {
+            //qDebug() << "size too large";
             m_data.clear();
             return;
         }
@@ -501,10 +501,10 @@ void Radio::decodeData()
             int high = m_data.at(16);
             int low = m_data.at(17);
             int dataLen = (high << 8) | low;
-            qDebug() << "dataLen:" << dataLen;
+            //qDebug() << "dataLen:" << dataLen;
             // 长度不对
             if ((dataLen + sizeof(packageDataHead)) > m_data.size()) {
-                qDebug() << "message len error";
+                //qDebug() << "message len error";
                 return;
             }
             QByteArray temp = m_data.left(sizeof(packageDataHead) + dataLen + 1);
@@ -559,86 +559,93 @@ void Radio::replyMessage()
     char *recvBuf = data.data();
     if(len < 21 || recvBuf == NULL)
     {
-        qDebug() << "len error";
+        //qDebug() << "len error";
         return;
     }
 
-    qDebug() <<"len:"<<len;
-    qDebug() <<"recvBuf: "<<recvBuf;
+    //qDebug() <<"len:"<<len;
+    //qDebug() <<"recvBuf: "<<recvBuf;
 
     bool is_checkok = false;
     is_checkok = BCCDecode(recvBuf,len);
     if(is_checkok==false) {
-        qDebug() << "check error";
+        //qDebug() << "check error";
         return;
     } else {
-        qDebug() << "check ok";
-    }
-    switch(recvBuf[5]) {
+        //qDebug() << "check ok";
+    }    
+    switch(recvBuf[5]) {    
         case TrafficLight: {
             lightMessage light;
             light.lightType=recvBuf[18];
             light.timeRemaining=(((recvBuf[19]<<8)&0xFF00)|((recvBuf[20])&0xFF));
-            qDebug() << "[RADIO]:receive light type is "<<int(light.lightType)<<" and remaining is "<<light.timeRemaining;
+            //qDebug() << "[RADIO]:receive light type is "<<int(light.lightType)<<" and remaining is "<<light.timeRemaining;
             outLight(light);
             break;
         }
-        case RealtimeTraffic: {        
-            realtimeTrafficMessage realtimeTraffic;
-            realtimeTraffic.lng=(((recvBuf[18]<<24)&0xFF000000)|((recvBuf[19]<<16)&0xFF0000)|((recvBuf[20]<<8)&0xFF00)|((recvBuf[21])&0xFF));
-            realtimeTraffic.lat=(((recvBuf[22]<<24)&0xFF000000)|((recvBuf[23]<<16)&0xFF0000)|((recvBuf[24]<<8)&0xFF00)|((recvBuf[25])&0xFF));
-            realtimeTraffic.scope=(((recvBuf[26]<<8)&0xFF00)|((recvBuf[27])&0xFF));
-            realtimeTraffic.trafficInfo=recvBuf[28];
-            realtimeTraffic.speedLimit=(recvBuf[29]&0xFF);
-            qDebug() << "[RADIO]:receive real time traffic message "<<endl;
-            outRealtimeTraffic(realtimeTraffic);
+        case RealtimeTraffic: {
+            if((recvBuf[4]==0x01)&&(recvBuf[3]==0x00)&&(recvBuf[2]==0x01)&&(recvBuf[1]=0x24)&&(recvBuf[0]==0x24)) {
+                realtimeTrafficMessage realtimeTraffic;
+                realtimeTraffic.lng=(((recvBuf[18]<<24)&0xFF000000)|((recvBuf[19]<<16)&0xFF0000)|((recvBuf[20]<<8)&0xFF00)|((recvBuf[21])&0xFF));
+                realtimeTraffic.lat=(((recvBuf[22]<<24)&0xFF000000)|((recvBuf[23]<<16)&0xFF0000)|((recvBuf[24]<<8)&0xFF00)|((recvBuf[25])&0xFF));
+                realtimeTraffic.scope=(((recvBuf[26]<<8)&0xFF00)|((recvBuf[27])&0xFF));
+                realtimeTraffic.trafficInfo=recvBuf[28];
+                realtimeTraffic.speedLimit=(recvBuf[29]&0xFF);
+                //qDebug() << "[RADIO]:receive real time traffic message "<<endl;
+                outRealtimeTraffic(realtimeTraffic);
+            }
             break;
         }
         case CollisionEarlyWarning: {
-            collisionEarlyWarningMessage collisionWarning;
-            char *str=new char[17];
-            memcpy(str, recvBuf+18, 17);
-            collisionWarning.isEnable=true;
-            collisionWarning.vin=str;
-            delete []str;
-            collisionWarning.warningType=recvBuf[35];
-            collisionWarning.speedLimit=recvBuf[36];
-            if(collisionWarning.vin==m_sVin) {
-                qDebug() << "[RADIO]:receive collisionEarlyWarning message "<<endl;
-                outCollisionWarning(collisionWarning);
-                responseCollisionEarlyWarning(collisionWarning);
-                m_responseType=collisionWarning.warningType;
-                m_bEnUpRespond=true;
-                //upRespondMessage();
-            } else {
-                qDebug()<<"[CollisionEarlyWarning] vin error"<<endl;
+            qDebug()<<"[JLLTest]:INTO WARNING"<<recvBuf[0]<<recvBuf[1]<<recvBuf[2]<<recvBuf[3]<<recvBuf[4]<<recvBuf[5]<<recvBuf[35]<<recvBuf[36]<<endl;
+            if(recvBuf[4]==0x02) {
+                collisionEarlyWarningMessage collisionWarning;
+                char *str=new char[17];
+                memcpy(str, recvBuf+18, 17);
+                collisionWarning.isEnable=true;
+                collisionWarning.vin=str;
+                delete []str;
+                collisionWarning.warningType=recvBuf[35];
+                collisionWarning.speedLimit=recvBuf[36];
+                if(collisionWarning.vin==m_sVin) {
+                    //qDebug() << "[RADIO]:receive collisionEarlyWarning message "<<endl;
+                    outCollisionWarning(collisionWarning);
+                    responseCollisionEarlyWarning(collisionWarning);
+                    m_responseType=collisionWarning.warningType;
+                    m_bEnUpRespond=true;
+                    //upRespondMessage();
+                } else {
+                    //qDebug()<<"[CollisionEarlyWarning] vin error"<<endl;
+                }
             }
             break;
         }
         case CongestionIdentification: {
-            congestionIdentificationMessage congestionIdenti;
-            char *str=new char[17];
-            memcpy(str, recvBuf+18, 17);
-            congestionIdenti.isEnable=true;
-            congestionIdenti.vin=str;
-            delete []str;
-            congestionIdenti.openCommand=recvBuf[35];
-            if(congestionIdenti.vin==m_sVin) {
-                qDebug() << "[RADIO]:receive congestion identification message "<<endl;
-                responseCongestionIdentification(congestionIdenti);
-                outCongestionIdenti(congestionIdenti);
-            } else {
-                qDebug()<<"[CongestionIdentification] vin error"<<endl;
+            if(recvBuf[4]==0x03) {
+                congestionIdentificationMessage congestionIdenti;
+                char *str=new char[17];
+                memcpy(str, recvBuf+18, 17);
+                congestionIdenti.isEnable=true;
+                congestionIdenti.vin=str;
+                delete []str;
+                congestionIdenti.openCommand=recvBuf[35];
+                if(congestionIdenti.vin==m_sVin) {
+                    //qDebug() << "[RADIO]:receive congestion identification message "<<endl;
+                    responseCongestionIdentification(congestionIdenti);
+                    outCongestionIdenti(congestionIdenti);
+                } else {
+                   // qDebug()<<"[CongestionIdentification] vin error"<<endl;
+                }
             }
             break;
         }
         case ResponseMessage: {
-            qDebug() << "[RADIO]:receive answer Response Message "<<endl;
+            //qDebug() << "[RADIO]:receive answer Response Message "<<endl;
             m_iResponse = -1;
             break;
         }
         case VirtualVehicle: {
-            qDebug() << "[RADIO]:receive answer VirtualVehicle "<<endl;
+            //qDebug() << "[RADIO]:receive answer VirtualVehicle "<<endl;
             m_iVirtualVehicle = -1;
             break;
         }
@@ -688,7 +695,7 @@ void Radio::ReceiveDecode(QByteArray &data)
     static int BATH_LENTH = 22;
     // 防包太大
     if (data.size() > 2048) {
-        qDebug() << "size too large";
+        //qDebug() << "size too large";
         return;
     }
     //  ##
@@ -710,10 +717,10 @@ void Radio::ReceiveDecode(QByteArray &data)
         int high = data.at(16);
         int low = data.at(17);
         int dataLen = (high << 8) | low;
-        qDebug() << "dataLen:" << dataLen;
+        //qDebug() << "dataLen:" << dataLen;
         // 长度不对
         if ((dataLen + sizeof(packageDataHead)) > data.size()) {
-            qDebug() << "message len error";
+            //qDebug() << "message len error";
             return;
         }
         QByteArray temp = data.left(sizeof(packageDataHead) + dataLen + 1);

+ 14 - 14
src/v2x/CommunicatePlatform/tbox.cpp

@@ -59,24 +59,24 @@ void Tbox::replyMessage()
     char *recvBuf = data.data();
     if(len < 31 || recvBuf == NULL)
     {
-        qDebug() << "len error";
+        //qDebug() << "len error";
         return;
     }
 
-    qDebug() <<"len:"<<len;
-    qDebug() <<"recvBuf: "<<recvBuf;
+    //qDebug() <<"len:"<<len;
+    //qDebug() <<"recvBuf: "<<recvBuf;
 
     bool is_checkok = false;
     is_checkok = BCCDecode(recvBuf,len);
     if(is_checkok==false) {
-        qDebug() << "check error";
+        //qDebug() << "check error";
     } else {
-        qDebug() << "check ok";
+        //qDebug() << "check ok";
     }
     if(recvBuf[2]==0x0A) {
     //232302fe4c4d574850315332374a31303035393035010017000000006142e3393b9aca0077359400140000000c63028c
     //if(recvBuf[2]==0x02) {
-        qDebug() << "receive vin change return";
+        //qDebug() << "receive vin change return";
         m_iVinChange=-1;
     }
 }
@@ -86,7 +86,7 @@ void Tbox::ReceiveDecode(QByteArray &data)
     static int BATH_LENTH = 31;
     // 防包太大
     if (data.size() > 2048) {
-        qDebug() << "size too large";
+        //qDebug() << "size too large";
         return;
     }
     //  ##
@@ -108,10 +108,10 @@ void Tbox::ReceiveDecode(QByteArray &data)
         int high = data.at(22);
         int low = data.at(23);
         int dataLen = (high << 8) | low;
-        qDebug() << "dataLen:" << dataLen;
+        //qDebug() << "dataLen:" << dataLen;
         // 长度不对
         if ((dataLen + sizeof(packageDataHead)) > data.size()) {
-            qDebug() << "message len error";
+            //qDebug() << "message len error";
             return;
         }
         QByteArray temp = data.left(sizeof(packageDataHead) + dataLen + 1);
@@ -282,18 +282,18 @@ void Tbox::newConnectionSlot()
     qDebug()<<"new connection";
     client=server->nextPendingConnection();
     QString ip=client->peerAddress().toString().split("::ffff:")[1];
-    qDebug()<<ip<<" 连接成功\n"<<endl;
+    //qDebug()<<ip<<" 连接成功\n"<<endl;
     connect(client,&QTcpSocket::readyRead,this,&Tbox::readDataSlot);
     connect(client,&QTcpSocket::disconnected,this,&Tbox::disconnectedSlot);
     //修改status
     m_bIsConnect = true;
-    qDebug()<<"连接成功\n"<<endl;
+    //qDebug()<<"连接成功\n"<<endl;
 
 }
 void Tbox::readDataSlot()
 {
     qint64 rLen = client->bytesAvailable();
-    qDebug() << "rLen:"<<rLen;
+    //qDebug() << "rLen:"<<rLen;
     if (rLen <= 0) {
         return;
     }
@@ -307,7 +307,7 @@ void Tbox::readDataSlot()
     //socket_mutex.unlock();
     if(ret <= 0)
     {
-        qDebug() << "read error";
+        //qDebug() << "read error";
         return;
     }
     QByteArray data(_data, ret);
@@ -321,5 +321,5 @@ void Tbox::disconnectedSlot()
 {
     //修改status
     m_bIsConnect = false;
-    qDebug()<<"client disconnected!\n"<<endl;
+    //qDebug()<<"client disconnected!\n"<<endl;
 }