|
@@ -23,53 +23,53 @@ std::string gstruploadMapInterval = "500";
|
|
|
std::string gstrid = "1234567890123456789H";
|
|
|
std::string gstrplateNumber = "津A123456";
|
|
|
|
|
|
-class mainloop : public QThread
|
|
|
-{
|
|
|
-// Q_OBJECT
|
|
|
-public:
|
|
|
- mainloop(VehicleControlClient *pCC,DataExchangeClient *pUC);
|
|
|
- void run();
|
|
|
-private:
|
|
|
- VehicleControlClient *pControlClient;
|
|
|
- DataExchangeClient *pUploadClient;
|
|
|
-};
|
|
|
-
|
|
|
-mainloop::mainloop(VehicleControlClient *pCC,DataExchangeClient *pUC)
|
|
|
-{
|
|
|
- pControlClient = pCC;
|
|
|
- pUploadClient = pUC;
|
|
|
-}
|
|
|
-
|
|
|
-void mainloop::run()
|
|
|
-{
|
|
|
- while (1) {
|
|
|
-// msleep(100);
|
|
|
- if(pControlClient->get_isNeedMap() == true)
|
|
|
- {
|
|
|
- std::cout<<"patrol path calculating"<<std::endl;
|
|
|
- QFile mapfile("/home/samuel/Documents/path1.txt");
|
|
|
- QVector<org::jeecg::defsDetails::grpc::MapPoint> somePoints;
|
|
|
- if(mapfile.open(QIODevice::ReadOnly | QIODevice::Text))
|
|
|
- {
|
|
|
- while(!mapfile.atEnd())
|
|
|
- {
|
|
|
- QByteArray line = mapfile.readLine();
|
|
|
- QString map_str(line);
|
|
|
- QStringList oneline = map_str.split(",");
|
|
|
- org::jeecg::defsDetails::grpc::MapPoint onePoint;
|
|
|
- onePoint.set_index(oneline.at(0).toInt());
|
|
|
- onePoint.mutable_mappoint()->set_longitude(oneline.at(1).toDouble());
|
|
|
- onePoint.mutable_mappoint()->set_latitude(oneline.at(2).toDouble());
|
|
|
- onePoint.mutable_mappoint()->set_height(oneline.at(3).toDouble());
|
|
|
- somePoints.append(onePoint);
|
|
|
- }
|
|
|
- }
|
|
|
- pUploadClient->updatePath(pControlClient->get_patrolPathID(),somePoints);
|
|
|
- pUploadClient->uploadPath();
|
|
|
- pControlClient->set_isNeedMap(false);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+//class mainloop : public QThread
|
|
|
+//{
|
|
|
+//// Q_OBJECT
|
|
|
+//public:
|
|
|
+// mainloop(VehicleControlClient *pCC,DataExchangeClient *pUC);
|
|
|
+// void run();
|
|
|
+//private:
|
|
|
+// VehicleControlClient *pControlClient;
|
|
|
+// DataExchangeClient *pUploadClient;
|
|
|
+//};
|
|
|
+
|
|
|
+//mainloop::mainloop(VehicleControlClient *pCC,DataExchangeClient *pUC)
|
|
|
+//{
|
|
|
+// pControlClient = pCC;
|
|
|
+// pUploadClient = pUC;
|
|
|
+//}
|
|
|
+
|
|
|
+//void mainloop::run()
|
|
|
+//{
|
|
|
+// while (1) {
|
|
|
+//// msleep(100);
|
|
|
+// if(pControlClient->get_isNeedMap() == true)
|
|
|
+// {
|
|
|
+// std::cout<<"patrol path calculating"<<std::endl;
|
|
|
+// QFile mapfile("/home/samuel/Documents/path1.txt");
|
|
|
+// QVector<org::jeecg::defsDetails::grpc::MapPoint> somePoints;
|
|
|
+// if(mapfile.open(QIODevice::ReadOnly | QIODevice::Text))
|
|
|
+// {
|
|
|
+// while(!mapfile.atEnd())
|
|
|
+// {
|
|
|
+// QByteArray line = mapfile.readLine();
|
|
|
+// QString map_str(line);
|
|
|
+// QStringList oneline = map_str.split(",");
|
|
|
+// org::jeecg::defsDetails::grpc::MapPoint onePoint;
|
|
|
+// onePoint.set_index(oneline.at(0).toInt());
|
|
|
+// onePoint.mutable_mappoint()->set_longitude(oneline.at(1).toDouble());
|
|
|
+// onePoint.mutable_mappoint()->set_latitude(oneline.at(2).toDouble());
|
|
|
+// onePoint.mutable_mappoint()->set_height(oneline.at(3).toDouble());
|
|
|
+// somePoints.append(onePoint);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// pUploadClient->updatePath(pControlClient->get_patrolPathID(),somePoints);
|
|
|
+// pUploadClient->uploadPath();
|
|
|
+// pControlClient->set_isNeedMap(false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|
|
|
|
|
|
void dec_yaml(const char * stryamlpath)
|
|
|
{
|
|
@@ -161,8 +161,11 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
VehiclePatrolExceptionClient vehiclepatrol(grpc::CreateChannel(patrol_str, grpc::InsecureChannelCredentials()));
|
|
|
|
|
|
- mainloop loop(vehiclecontrol,vehicleupload);
|
|
|
- loop.start();
|
|
|
+ QObject::connect(vehiclecontrol,&VehicleControlClient::patrolPOI_Recieved,vehicleupload,&DataExchangeClient::patrolPOI_Recieved_Slot);
|
|
|
+ QObject::connect(vehicleupload,&DataExchangeClient::uploadPath_Finished,vehiclecontrol,&VehicleControlClient::uploadPath_Finished_Slot);
|
|
|
+
|
|
|
+// mainloop loop(vehiclecontrol,vehicleupload);
|
|
|
+// loop.start();
|
|
|
|
|
|
return a.exec();
|
|
|
}
|