فهرست منبع

tbox ptotocal data change

jiaolili 3 سال پیش
والد
کامیت
d383b27ca4

+ 1 - 1
src/v2x/CommunicatePlatform/common.h

@@ -12,7 +12,7 @@
 //std::string strHostPort = xp.GetParam("hostPort","12123");
 extern std::string strHostIP = "127.0.0.1";
 extern int iHostPort = 6666;
-extern std::string VIN = "LMWHP1S27J1005905";
+extern std::string VIN = "A1000000CATARCS02";
 //////////////////////////////
 //         应答标识 TBOX         //
 /////////////////////////////

+ 56 - 2
src/v2x/CommunicatePlatform/mainwindow.cpp

@@ -5,8 +5,8 @@ MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::MainWindow)
 {
-    //m_tbox=new Tbox();
-    //initTboxMemory();
+    m_tbox=new Tbox();
+    initTboxMemory();
     m_radio=new Radio();
     ui->setupUi(this);
     initUi();
@@ -18,6 +18,10 @@ MainWindow::MainWindow(QWidget *parent) :
     ModuleFun fungpsimu =std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1, \
                                    std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
     mpMemGps = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",fungpsimu);
+    //ShareMem: ui
+    ModuleFun funUI =std::bind(&MainWindow::UpdateUI,this,std::placeholders::_1, \
+                                   std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
+    mpMemUI = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",funUI);
 }
 
 MainWindow::~MainWindow()
@@ -244,3 +248,53 @@ void MainWindow::UpdateGPSIMU(const char * strdata,const unsigned int nSize,cons
  //   mfspeed = sqrt(pow(data->vel_E,2)+pow(data->vel_N,2)) * 3.6;  //double pow(double x, double y) 返回 x 的 y 次幂,即 xy。
     //mistGPS = 0;
 }
+//UI DATA
+void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const unsigned int index,\
+                              const QDateTime * dt,const char * strmemname)
+{
+    double accX,accY,lat,lon,heading,rtk,ins,vd,ve,vn;
+    iv::hmi::hmimsg  xhmi;
+    if(!xhmi.ParseFromArray(strdata,nSize))
+    {
+        mivlog->warn("ADCIntelligentVehicle::UpdateGPSIMU parse error. nSize is %d",nSize);
+        return;
+    }
+
+
+    if(xhmi.has_obuen()) {
+        bool enRadio=xhmi.obuen();
+        setEnRadio(enRadio);
+    }
+    if(xhmi.has_platformen()) {
+        bool enTbox=xhmi.platformen();
+        if(enTbox) {
+            enableTbox();
+        } else {
+            disableTbox();
+        }
+    }
+    if(xhmi.has_platformen()) {
+        bool enTbox=xhmi.platformen();
+        if(enTbox) {
+            enableTbox();
+        } else {
+            disableTbox();
+        }
+    }
+    if(xhmi.has_rodeinfoen()) {
+        bool enRadioBroadcast = xhmi.rodeinfoen();
+        m_radio->getTrafficBroadcast(enRadioBroadcast);
+        ui->checkBox_trafficBroadcast->setChecked(enRadioBroadcast);
+    }
+    if(xhmi.has_rodefcwen()) {
+        bool enRadioWarning = xhmi.rodefcwen();
+        m_radio->getCollisonWarning(enRadioWarning);
+        ui->checkBox_collisionWarning->setChecked(enRadioWarning);
+    }
+    if(xhmi.has_roadjamsen()) {
+
+    }
+
+
+
+}

+ 3 - 0
src/v2x/CommunicatePlatform/mainwindow.h

@@ -24,6 +24,7 @@ private:
     std::vector<std::string> m_vectorVin;
     //20211009,jiaolili
     void * mpMemGps;
+    void * mpMemUI;
     iv::Ivlog *mivlog;
     ///////////////////////////////
 public:
@@ -36,6 +37,8 @@ public:
     void setEnRadio(bool en);
     void UpdateGPSIMU(const char * strdata,const unsigned int nSize,const unsigned int index,\
                                   const QDateTime * dt,const char * strmemname);
+    void UpdateUI(const char * strdata,const unsigned int nSize,const unsigned int index,\
+                                  const QDateTime * dt,const char * strmemname);
 private slots:
     void on_pushButton_connect_clicked();
     void on_pushButton_vinChange_clicked(); 

+ 3 - 3
src/v2x/CommunicatePlatform/radio.cpp

@@ -85,8 +85,8 @@ void Radio::outRealtimeTraffic(realtimeTrafficMessage realtimeTraffic)
 {
     if(m_bEnTrafficBroadcast) {
         iv::v2r::v2r_send protobuf;
-        float lat=((float)realtimeTraffic.lat)/1000000.0;
-        float lon=((float)realtimeTraffic.lng)/1000000.0;
+        double lat=((double)realtimeTraffic.lat)/1000000.0;
+        double lon=((double)realtimeTraffic.lng)/1000000.0;
         protobuf.set_radiobroadcastgpslat(lat);
         protobuf.set_radiobroadcastgpslat(lon);
         protobuf.set_radiobroadcastrange(realtimeTraffic.scope);
@@ -226,7 +226,7 @@ void Radio::upDataStream()
     carFormationInfo.yaw[1] = (yaw>>16)&0xff;
     carFormationInfo.yaw[2] = (yaw>>8)&0xff;
     carFormationInfo.yaw[3] = (yaw)&0xff;
-    float fele=m_structMControl.eleVoltage*100.0;
+    float fele=m_structMControl.eleVoltage;
     int iele = int(fele);
     unsigned char electrical=(iele)&0xff;
     carFormationInfo.electricalVoltage=electrical;

+ 2 - 1
src/v2x/CommunicatePlatform/tbox.cpp

@@ -180,6 +180,7 @@ void Tbox::upDataStream()
     carFormationInfo.time[5]=(timestamp>>16)&0xff;
     carFormationInfo.time[6]=(timestamp>>8)&0xff;
     carFormationInfo.time[7]=(timestamp)&0xff;
+    carFormationInfo.type=0x0A;
     float flng,flat;
     flng = (m_structM.gps_lng*1000000);
     flat = m_structM.gps_lat*1000000;
@@ -204,7 +205,7 @@ void Tbox::upDataStream()
     carFormationInfo.car_yaw[1] = (yaw>>16)&0xff;
     carFormationInfo.car_yaw[2] = (yaw>>8)&0xff;
     carFormationInfo.car_yaw[3] = (yaw)&0xff;
-    float fele=m_structM.ele_voltage*100.0;
+    float fele=m_structM.ele_voltage;
     int iele = int(fele);
     unsigned char electrical=(iele)&0xff;
     carFormationInfo.electrical_voltage=electrical;

+ 1 - 0
src/v2x/CommunicatePlatform/tbox.h

@@ -20,6 +20,7 @@ struct DataPackageHead//数据包结构
 struct CarFormationInfoData  //车况数据
 {
     unsigned char time[8];//本报文时间戳。格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数。
+    unsigned char type;//0A
     unsigned char gps_lng[4];//经度 有效值范围:0~180;精确到小数点后6位;“0xFF,0xFF,0xFF,0xFE”表示异常,“0xFF,0xFF,0xFF,0xFF”表示无效
     unsigned char gps_lat[4];//维度 有效值范围:0~180;精确到小数点后6位;“0xFF,0xFF,0xFF,0xFE”表示异常,“0xFF,0xFF,0xFF,0xFF”表示无效
     unsigned char car_speed;//车速 有效值范围:0~200(表示0km/h~200km/h),最小计量单元:1km/h;“0xFE”表示异常,“0xFF”表示无效