|
@@ -2,7 +2,7 @@
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
iv::Ivlog *givlog;
|
|
|
-unsigned int gv2xEn = true;
|
|
|
+unsigned int gv2xEn = false;
|
|
|
|
|
|
void ListenV2xStEn(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
{
|
|
@@ -28,12 +28,39 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
ui(new Ui::MainWindow)
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
- socket=new QTcpSocket();
|
|
|
- ui->lineEdit_ip->setText("47.95.196.28");
|
|
|
- ui->lineEdit_port->setText("12123");
|
|
|
+
|
|
|
+
|
|
|
+ QString strpath = QCoreApplication::applicationDirPath();
|
|
|
+ qDebug()<<strpath;
|
|
|
+ strpath = strpath + "/v2xTcpClient.xml";
|
|
|
+
|
|
|
+ iv::xmlparam::Xmlparam xp(strpath.toStdString());
|
|
|
+
|
|
|
+ std::string strCarVIN = xp.GetParam("carVIN","catarc001");
|
|
|
+ std::string strHostIP = xp.GetParam("hostIP","47.95.196.28");
|
|
|
+ std::string strHostPort = xp.GetParam("hostPort","12123");
|
|
|
+ std::string strStationCount = xp.GetParam("stationCount","20");
|
|
|
+ int count = std::stoi(strStationCount,nullptr,10);
|
|
|
+ stationGps location;
|
|
|
+ for(int i = 0; i < count; i++)
|
|
|
+ {
|
|
|
+ std::string strLatName = "lat" + std::to_string(i);
|
|
|
+ std::string strLonName = "lon" + std::to_string(i);
|
|
|
+ std::cout<<strLatName<<strLonName<<std::endl;
|
|
|
+ std::string strLatValue = xp.GetParam(strLatName,"0");
|
|
|
+ std::string strLonValue = xp.GetParam(strLonName,"0");
|
|
|
+
|
|
|
+ location.lat = std::stof(strLatValue,0);
|
|
|
+ location.lon = std::stof(strLonValue,0);
|
|
|
+ mstationGps.append(location);
|
|
|
+ }
|
|
|
+
|
|
|
+ socket=new QTcpSocket();
|
|
|
+ ui->lineEdit_ip->setText(QString::fromStdString(strHostIP));
|
|
|
+ ui->lineEdit_port->setText(QString::fromStdString(strHostPort));
|
|
|
ui->pushButton_connect->setEnabled(false);
|
|
|
-
|
|
|
|
|
|
+
|
|
|
givlog = new iv::Ivlog("v2x");
|
|
|
connect(socket, &QTcpSocket::readyRead, this, &MainWindow::socket_Read_Data);
|
|
|
connect(socket, &QTcpSocket::disconnected, this, &MainWindow::socket_Disconnected);
|
|
@@ -174,8 +201,8 @@ void MainWindow::ProAutoPilotControl(QStringList list)
|
|
|
msgV2xProto.add_stationid(stationId);
|
|
|
|
|
|
stGps=msgV2xProto.add_stgps();
|
|
|
- stGps->set_lat(0);
|
|
|
- stGps->set_lon(0);
|
|
|
+ stGps->set_lat(mstationGps.at(i-4).lat);
|
|
|
+ stGps->set_lon(mstationGps.at(i-4).lon);
|
|
|
ui->textEdit_messages->insertPlainText("服务器消息:car station has "+list[i]+"\n");
|
|
|
}
|
|
|
} else {
|