|
@@ -6,10 +6,27 @@
|
|
#include "vehicle_upload.h"
|
|
#include "vehicle_upload.h"
|
|
#include "vehicle_control.h"
|
|
#include "vehicle_control.h"
|
|
#include "vehicle_patrol.h"
|
|
#include "vehicle_patrol.h"
|
|
|
|
+#include "modulecomm.h"
|
|
|
|
|
|
#include <QFile>
|
|
#include <QFile>
|
|
#include <QString>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QStringList>
|
|
|
|
+#include <QMetaType>
|
|
|
|
+
|
|
|
|
+namespace iv {
|
|
|
|
+struct msgunit
|
|
|
|
+{
|
|
|
|
+ char mstrmsgname[256];
|
|
|
|
+ int mnBufferSize = 10000;
|
|
|
|
+ int mnBufferCount = 1;
|
|
|
|
+ void * mpa;
|
|
|
|
+ std::shared_ptr<char> mpstrmsgdata;
|
|
|
|
+ int mndatasize = 0;
|
|
|
|
+ bool mbRefresh = false;
|
|
|
|
+ bool mbImportant = false;
|
|
|
|
+ int mnkeeptime = 100;
|
|
|
|
+};
|
|
|
|
+}
|
|
|
|
|
|
std::string gstrserverip = "139.9.235.66";//"123.57.212.138";
|
|
std::string gstrserverip = "139.9.235.66";//"123.57.212.138";
|
|
std::string gstruploadPort = "10591";//"9000";
|
|
std::string gstruploadPort = "10591";//"9000";
|
|
@@ -22,6 +39,12 @@ std::string gstruploadMapInterval = "500";
|
|
std::string gstrid = "1234567890123456789H";
|
|
std::string gstrid = "1234567890123456789H";
|
|
std::string gstrplateNumber = "津A123456";
|
|
std::string gstrplateNumber = "津A123456";
|
|
|
|
|
|
|
|
+iv::msgunit shmPicFront;
|
|
|
|
+iv::msgunit shmPicRear;
|
|
|
|
+iv::msgunit shmPicLeft;
|
|
|
|
+iv::msgunit shmPicRight;
|
|
|
|
+iv::msgunit shmRemoteCtrl;
|
|
|
|
+
|
|
void dec_yaml(const char * stryamlpath)
|
|
void dec_yaml(const char * stryamlpath)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -85,6 +108,68 @@ void dec_yaml(const char * stryamlpath)
|
|
gstrplateNumber = config["plateNumber"].as<std::string>();
|
|
gstrplateNumber = config["plateNumber"].as<std::string>();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ std::string strmsgname;
|
|
|
|
+
|
|
|
|
+ if(config["pic_front"])
|
|
|
|
+ {
|
|
|
|
+ if(config["pic_front"]["msgname"]&&config["pic_front"]["buffersize"]&&config["pic_front"]["buffercount"])
|
|
|
|
+ {
|
|
|
|
+ strmsgname = config["pic_front"]["msgname"].as<std::string>();
|
|
|
|
+ strncpy(shmPicFront.mstrmsgname,strmsgname.data(),255);
|
|
|
|
+ shmPicFront.mnBufferSize = config["pic_front"]["buffersize"].as<int>();
|
|
|
|
+ shmPicFront.mnBufferCount = config["pic_front"]["buffercount"].as<int>();
|
|
|
|
+// std::cout << shmPicFront.mstrmsgname << shmPicFront.mnBufferSize << shmPicFront.mnBufferCount << std::endl;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["pic_rear"])
|
|
|
|
+ {
|
|
|
|
+ if(config["pic_rear"]["msgname"]&&config["pic_rear"]["buffersize"]&&config["pic_rear"]["buffercount"])
|
|
|
|
+ {
|
|
|
|
+ strmsgname = config["pic_rear"]["msgname"].as<std::string>();
|
|
|
|
+ strncpy(shmPicRear.mstrmsgname,strmsgname.data(),255);
|
|
|
|
+ shmPicRear.mnBufferSize = config["pic_rear"]["buffersize"].as<int>();
|
|
|
|
+ shmPicRear.mnBufferCount = config["pic_rear"]["buffercount"].as<int>();
|
|
|
|
+// std::cout << shmPicRear.mstrmsgname << shmPicRear.mnBufferSize << shmPicRear.mnBufferCount << std::endl;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["pic_left"])
|
|
|
|
+ {
|
|
|
|
+ if(config["pic_left"]["msgname"]&&config["pic_left"]["buffersize"]&&config["pic_left"]["buffercount"])
|
|
|
|
+ {
|
|
|
|
+ strmsgname = config["pic_left"]["msgname"].as<std::string>();
|
|
|
|
+ strncpy(shmPicLeft.mstrmsgname,strmsgname.data(),255);
|
|
|
|
+ shmPicLeft.mnBufferSize = config["pic_left"]["buffersize"].as<int>();
|
|
|
|
+ shmPicLeft.mnBufferCount = config["pic_left"]["buffercount"].as<int>();
|
|
|
|
+// std::cout << shmPicLeft.mstrmsgname << shmPicLeft.mnBufferSize << shmPicLeft.mnBufferCount << std::endl;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["pic_right"])
|
|
|
|
+ {
|
|
|
|
+ if(config["pic_right"]["msgname"]&&config["pic_right"]["buffersize"]&&config["pic_right"]["buffercount"])
|
|
|
|
+ {
|
|
|
|
+ strmsgname = config["pic_right"]["msgname"].as<std::string>();
|
|
|
|
+ strncpy(shmPicRight.mstrmsgname,strmsgname.data(),255);
|
|
|
|
+ shmPicRight.mnBufferSize = config["pic_right"]["buffersize"].as<int>();
|
|
|
|
+ shmPicRight.mnBufferCount = config["pic_right"]["buffercount"].as<int>();
|
|
|
|
+// std::cout << shmPicRight.mstrmsgname << shmPicRight.mnBufferSize << shmPicRight.mnBufferCount << std::endl;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["remote_ctrl"])
|
|
|
|
+ {
|
|
|
|
+ if(config["remote_ctrl"]["msgname"]&&config["remote_ctrl"]["buffersize"]&&config["remote_ctrl"]["buffercount"])
|
|
|
|
+ {
|
|
|
|
+ strmsgname = config["remote_ctrl"]["msgname"].as<std::string>();
|
|
|
|
+ strncpy(shmRemoteCtrl.mstrmsgname,strmsgname.data(),255);
|
|
|
|
+ shmRemoteCtrl.mnBufferSize = config["remote_ctrl"]["buffersize"].as<int>();
|
|
|
|
+ shmRemoteCtrl.mnBufferCount = config["remote_ctrl"]["buffercount"].as<int>();
|
|
|
|
+// std::cout << shmRemoteCtrl.mstrmsgname << shmRemoteCtrl.mnBufferSize << shmRemoteCtrl.mnBufferCount << std::endl;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -102,6 +187,7 @@ int main(int argc, char *argv[])
|
|
{
|
|
{
|
|
strncpy(stryamlpath,argv[1],255);
|
|
strncpy(stryamlpath,argv[1],255);
|
|
}
|
|
}
|
|
|
|
+
|
|
dec_yaml(stryamlpath);
|
|
dec_yaml(stryamlpath);
|
|
|
|
|
|
std::string control_str = gstrserverip+":";
|
|
std::string control_str = gstrserverip+":";
|
|
@@ -113,12 +199,16 @@ int main(int argc, char *argv[])
|
|
std::string upload_str = gstrserverip+":";
|
|
std::string upload_str = gstrserverip+":";
|
|
upload_str = upload_str + gstruploadPort ;
|
|
upload_str = upload_str + gstruploadPort ;
|
|
|
|
|
|
|
|
+// std::cout<<upload_str<<std::endl;
|
|
DataExchangeClient *vehicleuploaddata = new DataExchangeClient(grpc::CreateChannel(upload_str, grpc::InsecureChannelCredentials()));
|
|
DataExchangeClient *vehicleuploaddata = new DataExchangeClient(grpc::CreateChannel(upload_str, grpc::InsecureChannelCredentials()));
|
|
vehicleuploaddata->start();
|
|
vehicleuploaddata->start();
|
|
|
|
|
|
|
|
+// std::cout<<control_str<<std::endl;
|
|
VehicleChangeCtrlModeClient *vehiclechangectrlmode = new VehicleChangeCtrlModeClient(grpc::CreateChannel(control_str, grpc::InsecureChannelCredentials()));
|
|
VehicleChangeCtrlModeClient *vehiclechangectrlmode = new VehicleChangeCtrlModeClient(grpc::CreateChannel(control_str, grpc::InsecureChannelCredentials()));
|
|
VehicleControlClient *vehiclecontrol = new VehicleControlClient(grpc::CreateChannel(control_str, grpc::InsecureChannelCredentials()));
|
|
VehicleControlClient *vehiclecontrol = new VehicleControlClient(grpc::CreateChannel(control_str, grpc::InsecureChannelCredentials()));
|
|
|
|
+ qRegisterMetaType<org::jeecg::defsControl::grpc::CtrlMode>("org::jeecg::defsControl::grpc::CtrlMode"); ///< to solve the problem of signal and slot being in different threads
|
|
QObject::connect(vehiclechangectrlmode,&VehicleChangeCtrlModeClient::ctrlMode_Changed,vehiclecontrol,&VehicleControlClient::ctrlMode_Changed_Slot);
|
|
QObject::connect(vehiclechangectrlmode,&VehicleChangeCtrlModeClient::ctrlMode_Changed,vehiclecontrol,&VehicleControlClient::ctrlMode_Changed_Slot);
|
|
|
|
+// QObject::connect(vehiclechangectrlmode,&VehicleChangeCtrlModeClient::ctrlMode_Changed,vehicleuploaddata,&DataExchangeClient::ctrlMode_Changed_Slot);
|
|
vehiclechangectrlmode->start();
|
|
vehiclechangectrlmode->start();
|
|
vehiclecontrol->start();
|
|
vehiclecontrol->start();
|
|
|
|
|
|
@@ -127,8 +217,9 @@ int main(int argc, char *argv[])
|
|
QObject::connect(vehicleuploaddata,&DataExchangeClient::uploadPath_Finished,vehicleuploadmap,&VehicleUploadMapClient::uploadPath_Finished_Slot);
|
|
QObject::connect(vehicleuploaddata,&DataExchangeClient::uploadPath_Finished,vehicleuploadmap,&VehicleUploadMapClient::uploadPath_Finished_Slot);
|
|
vehicleuploadmap->start();
|
|
vehicleuploadmap->start();
|
|
|
|
|
|
- VehiclePatrolExceptionClient vehiclepatrol(grpc::CreateChannel(patrol_str, grpc::InsecureChannelCredentials()));
|
|
|
|
- vehiclepatrol.start();
|
|
|
|
|
|
+// std::cout<<patrol_str<<std::endl;
|
|
|
|
+// VehiclePatrolExceptionClient vehiclepatrol(grpc::CreateChannel(patrol_str, grpc::InsecureChannelCredentials()));
|
|
|
|
+// vehiclepatrol.start();
|
|
|
|
|
|
return a.exec();
|
|
return a.exec();
|
|
}
|
|
}
|