|
@@ -28,6 +28,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
ModuleFun funControl =std::bind(&MainWindow::UpdateControl,this,std::placeholders::_1, \
|
|
|
std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
mpMemControl = iv::modulecomm::RegisterRecvPlus("hcp2_chassis",funControl);
|
|
|
+ //ShareMem: state
|
|
|
+ ModuleFun funState =std::bind(&MainWindow::UpdateState,this,std::placeholders::_1, \
|
|
|
+ std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
+ mpMemState = iv::modulecomm::RegisterRecvPlus("hcp2_brainstate",funControl);
|
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
@@ -488,6 +492,22 @@ void MainWindow::UpdateControl(const char *strdata, const unsigned int nSize, co
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+void MainWindow::UpdateState(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
+{
|
|
|
+ iv::brain::brainstate xstate;
|
|
|
+ if(!xstate.ParseFromArray(strdata,nSize))
|
|
|
+ {
|
|
|
+ mivlog->warn("ADCIntelligentVehicle::UpdateGPSIMU parse error. nSize is %d",nSize);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ bool isSend=false;
|
|
|
+ //xstate.has
|
|
|
+ if(xstate.has_vehicle_state()) {
|
|
|
+ int type = xstate.vehicle_state();
|
|
|
+ m_radio->sendResponseMessage(type);
|
|
|
+ }
|
|
|
+}
|
|
|
void MainWindow::setRadioControlMemory()
|
|
|
{
|
|
|
controlM mcontrol;
|
|
@@ -507,3 +527,42 @@ unsigned char MainWindow::getError()
|
|
|
return 0x02;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void MainWindow::on_pushButton_clear_clicked()
|
|
|
+{
|
|
|
+ ui->textEdit->clear();
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::on_pushButton_outLight_clicked()
|
|
|
+{
|
|
|
+ lightMessage light;
|
|
|
+ light.lightType=0x01;
|
|
|
+ light.timeRemaining=30;
|
|
|
+ m_radio->outLight(light);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::on_pushButton_warning_clicked()
|
|
|
+{
|
|
|
+ collisionEarlyWarningMessage warning;
|
|
|
+ warning.warningType=0x01;
|
|
|
+ warning.speedLimit=30;
|
|
|
+ m_radio->outCollisionWarning(warning);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::on_pushButton_realTimeMessage_clicked()
|
|
|
+{
|
|
|
+ realtimeTrafficMessage realtime;
|
|
|
+ realtime.lat=39*1000000;
|
|
|
+ realtime.lng=137*1000000;
|
|
|
+ realtime.scope=100;
|
|
|
+ realtime.trafficInfo=0x01;
|
|
|
+ realtime.speedLimit=0xFF;
|
|
|
+ m_radio->outRealtimeTraffic(realtime);
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::on_pushButton_busy_clicked()
|
|
|
+{
|
|
|
+ congestionIdentificationMessage identi;
|
|
|
+ identi.openCommand=0x01;
|
|
|
+ m_radio->outCongestionIdenti(identi);
|
|
|
+}
|