|
@@ -1,309 +1,78 @@
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
-#include "grpcclient.h"
|
|
|
-
|
|
|
#include "ivversion.h"
|
|
|
|
|
|
-/*
|
|
|
#include <yaml-cpp/yaml.h>
|
|
|
-
|
|
|
-#include <QDateTime>
|
|
|
-
|
|
|
-#include <iostream>
|
|
|
-
|
|
|
-#include <vector>
|
|
|
-
|
|
|
-#include <memory>
|
|
|
-
|
|
|
-#include <QMutex>
|
|
|
-
|
|
|
-#include <thread>
|
|
|
-
|
|
|
-#include "modulecomm.h"
|
|
|
-
|
|
|
-#include "cloud.pb.h"
|
|
|
-
|
|
|
-#include <iostream>
|
|
|
-#include <memory>
|
|
|
-#include <string>
|
|
|
-
|
|
|
-#include <grpcpp/grpcpp.h>
|
|
|
-
|
|
|
-#include "uploadmsg.grpc.pb.h"
|
|
|
-
|
|
|
-
|
|
|
-using grpc::Channel;
|
|
|
-using grpc::ClientContext;
|
|
|
-using grpc::Status;
|
|
|
-
|
|
|
-
|
|
|
-void test()
|
|
|
+#include "vehicle_upload.h"
|
|
|
+#include "vehicle_control.h"
|
|
|
+#include "vehicle_patrol.h"
|
|
|
+
|
|
|
+#include <QFile>
|
|
|
+#include <QString>
|
|
|
+#include <QStringList>
|
|
|
+#include <QThread>
|
|
|
+
|
|
|
+std::string gstrserverip = "139.9.235.66";//"123.57.212.138";
|
|
|
+std::string gstruploadPort = "10591";//"9000";
|
|
|
+std::string gstrpatrolPort = "10592";//"9000";
|
|
|
+std::string gstrcontrolPort = "20591";//"9000";
|
|
|
+std::string gstruploadInterval = "500";
|
|
|
+std::string gstrpatrolInterval = "500";
|
|
|
+std::string gstrcontrolInterval = "100";
|
|
|
+std::string gstruploadMapInterval = "500";
|
|
|
+std::string gstrid = "1234567890123456789H";
|
|
|
+std::string gstrplateNumber = "津A123456";
|
|
|
+
|
|
|
+class mainloop : public QThread
|
|
|
{
|
|
|
- std::string target_str = "0.0.0.0:50051";
|
|
|
-
|
|
|
- auto cargs = grpc::ChannelArguments();
|
|
|
- cargs.SetMaxReceiveMessageSize(1024 * 1024 * 1024); // 1 GB
|
|
|
- cargs.SetMaxSendMessageSize(1024 * 1024 * 1024);
|
|
|
-
|
|
|
- std::shared_ptr<Channel> channel = grpc::CreateCustomChannel(
|
|
|
- target_str, grpc::InsecureChannelCredentials(),cargs);
|
|
|
-
|
|
|
- std::unique_ptr<iv::Upload::Stub> stub_ = iv::Upload::NewStub(channel);
|
|
|
-
|
|
|
-
|
|
|
- iv::UploadRequest request;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // Container for the data we expect from the server.
|
|
|
- iv::UploadReply reply;
|
|
|
-
|
|
|
- int nid = 0;
|
|
|
-
|
|
|
- nid = 1;
|
|
|
-
|
|
|
- while(1)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // Context for the client. It could be used to convey extra information to
|
|
|
- // the server and/or tweak certain RPC behaviors.
|
|
|
-
|
|
|
-
|
|
|
- ClientContext context ;
|
|
|
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
|
- qint64 time1 = QDateTime::currentMSecsSinceEpoch();
|
|
|
-
|
|
|
- request.set_id(nid);
|
|
|
- request.set_ntime(time1);
|
|
|
- nid++;
|
|
|
- // The actual RPC.
|
|
|
- Status status = stub_->upload(&context, request, &reply);
|
|
|
- if (status.ok()) {
|
|
|
- std::cout<<nid<<" upload successfully"<<std::endl;
|
|
|
-// qint64 time2;
|
|
|
-
|
|
|
-// memcpy(&time2,reply.data().data(),8);
|
|
|
-// qint64 time3 = QDateTime::currentMSecsSinceEpoch();
|
|
|
-// std::cout<<"reply data size is "<<reply.data().size()<<std::endl;
|
|
|
-// std::cout<<" latency is "<<(time2 - time1)<<" 2 is "<<(time3 - time2)<<std::endl;
|
|
|
-// return reply.message();
|
|
|
- } else {
|
|
|
- std::cout << status.error_code() << ": " << status.error_message()
|
|
|
- << std::endl;
|
|
|
- std::cout<<"RPC failed"<<std::endl;
|
|
|
- std::this_thread::sleep_for(std::chrono::milliseconds(900));
|
|
|
-
|
|
|
-// delete pcontext;
|
|
|
-// pcontext = new ClientContext;
|
|
|
-
|
|
|
-// channel = grpc::CreateCustomChannel(
|
|
|
-// target_str, grpc::InsecureChannelCredentials(),cargs);
|
|
|
-
|
|
|
-// stub_ = iv::Upload::NewStub(channel);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-std::string gstrserverip = "0.0.0.0";//"123.57.212.138";
|
|
|
-std::string gstrserverport = "50051";//"9000";
|
|
|
-std::string gstruploadinterval = "1000";
|
|
|
-void * gpa;
|
|
|
-QMutex gMutexMsg;
|
|
|
-std::thread * guploadthread;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-std::vector<iv::msgunit> mvectormsgunit;
|
|
|
-
|
|
|
-std::vector<iv::msgunit> mvectorctrlmsgunit;
|
|
|
-
|
|
|
-
|
|
|
-std::string gstrVIN = "AAAAAAAAAAAAAAAAA";
|
|
|
-std::string gstrqueryMD5 = "5d41402abc4b2a76b9719d911017c591";//"5d41402abc4b2a76b9719d911017c592";
|
|
|
-std::string gstrctrlMD5 = "5d41402abc4b2a76b9719d911017c591";
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-int gindex = 0;
|
|
|
-
|
|
|
-void ListenData(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
+// Q_OBJECT
|
|
|
+public:
|
|
|
+ mainloop(VehicleControlClient *pCC,DataExchangeClient *pUC);
|
|
|
+ void run();
|
|
|
+private:
|
|
|
+ VehicleControlClient *pControlClient;
|
|
|
+ DataExchangeClient *pUploadClient;
|
|
|
+};
|
|
|
+
|
|
|
+mainloop::mainloop(VehicleControlClient *pCC,DataExchangeClient *pUC)
|
|
|
{
|
|
|
-
|
|
|
- int nsize = mvectormsgunit.size();
|
|
|
- int i;
|
|
|
- for(i=0;i<nsize;i++)
|
|
|
- {
|
|
|
- if(strncmp(strmemname,mvectormsgunit[i].mstrmsgname,255) == 0)
|
|
|
- {
|
|
|
- gMutexMsg.lock();
|
|
|
- char * strtem = new char[nSize];
|
|
|
- memcpy(strtem,strdata,nSize);
|
|
|
- mvectormsgunit[i].mpstrmsgdata.reset(strtem);
|
|
|
- mvectormsgunit[i].mndatasize = nSize;
|
|
|
- mvectormsgunit[i].mbRefresh = true;
|
|
|
- gMutexMsg.unlock();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ pControlClient = pCC;
|
|
|
+ pUploadClient = pUC;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-void sharectrlmsg(iv::cloud::cloudmsg * pxmsg)
|
|
|
+void mainloop::run()
|
|
|
{
|
|
|
- int i;
|
|
|
- int nsize = pxmsg->xclouddata_size();
|
|
|
- for(i=0;i<nsize;i++)
|
|
|
- {
|
|
|
- int j;
|
|
|
- int nquerysize = mvectorctrlmsgunit.size();
|
|
|
- for(j=0;j<nquerysize;j++)
|
|
|
+ while (1) {
|
|
|
+ msleep(100);
|
|
|
+// if(pControlClient->get_isNeedMap() == true)
|
|
|
{
|
|
|
- if(strncmp(pxmsg->xclouddata(i).msgname().data(), mvectorctrlmsgunit[j].mstrmsgname,255) == 0)
|
|
|
+ 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))
|
|
|
{
|
|
|
- // qDebug("size is %d ",pxmsg->xclouddata(i).data().size());
|
|
|
- iv::modulecomm::ModuleSendMsg(mvectorctrlmsgunit[j].mpa,pxmsg->xclouddata(i).data().data(),pxmsg->xclouddata(i).data().size());
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void threadupload()
|
|
|
-{
|
|
|
- int nsize = mvectormsgunit.size();
|
|
|
- int i;
|
|
|
-
|
|
|
- int ninterval = atoi(gstruploadinterval.data());
|
|
|
- if(ninterval<=0)ninterval = 100;
|
|
|
-
|
|
|
- QTime xTime;
|
|
|
- xTime.start();
|
|
|
- int nlastsend = xTime.elapsed();
|
|
|
-
|
|
|
- std::string target_str = gstrserverip+":";
|
|
|
- target_str = target_str + gstrserverport ;//std::to_string()
|
|
|
- auto cargs = grpc::ChannelArguments();
|
|
|
- cargs.SetMaxReceiveMessageSize(1024 * 1024 * 1024); // 1 GB
|
|
|
- cargs.SetMaxSendMessageSize(1024 * 1024 * 1024);
|
|
|
-
|
|
|
- std::shared_ptr<Channel> channel = grpc::CreateCustomChannel(
|
|
|
- target_str, grpc::InsecureChannelCredentials(),cargs);
|
|
|
-
|
|
|
- std::unique_ptr<iv::Upload::Stub> stub_ = iv::Upload::NewStub(channel);
|
|
|
-
|
|
|
-
|
|
|
- iv::UploadRequest request;
|
|
|
-
|
|
|
- int nid = 0;
|
|
|
-
|
|
|
- // Container for the data we expect from the server.
|
|
|
- iv::UploadReply reply;
|
|
|
-
|
|
|
- gpr_timespec timespec;
|
|
|
- timespec.tv_sec = 30;//设置阻塞时间为2秒
|
|
|
- timespec.tv_nsec = 0;
|
|
|
- timespec.clock_type = GPR_TIMESPAN;
|
|
|
-
|
|
|
- // ClientContext context;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- while(true)
|
|
|
- {
|
|
|
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
|
|
- if((xTime.elapsed()-nlastsend)<ninterval)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- bool bImportant = false;
|
|
|
- int nkeeptime = 0;
|
|
|
- iv::cloud::cloudmsg xmsg;
|
|
|
- xmsg.set_xtime(QDateTime::currentMSecsSinceEpoch());
|
|
|
- gMutexMsg.lock();
|
|
|
- for(i=0;i<nsize;i++)
|
|
|
- {
|
|
|
- if(mvectormsgunit[i].mbRefresh)
|
|
|
+ while(!mapfile.atEnd())
|
|
|
{
|
|
|
- mvectormsgunit[i].mbRefresh = false;
|
|
|
- if(mvectormsgunit[i].mbImportant)
|
|
|
- {
|
|
|
- bImportant = true;
|
|
|
- }
|
|
|
- if(mvectormsgunit[i].mnkeeptime > nkeeptime)
|
|
|
- {
|
|
|
- nkeeptime = mvectormsgunit[i].mnkeeptime;
|
|
|
- }
|
|
|
- iv::cloud::cloudunit xcloudunit;
|
|
|
- xcloudunit.set_msgname(mvectormsgunit[i].mstrmsgname);
|
|
|
- xcloudunit.set_data(mvectormsgunit[i].mpstrmsgdata.get(),mvectormsgunit[i].mndatasize);
|
|
|
- iv::cloud::cloudunit * pcu = xmsg.add_xclouddata();
|
|
|
- pcu->CopyFrom(xcloudunit);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- gMutexMsg.unlock();
|
|
|
-
|
|
|
- int nbytesize = xmsg.ByteSize();
|
|
|
- char * strbuf = new char[nbytesize];
|
|
|
- std::shared_ptr<char> pstrbuf;
|
|
|
- pstrbuf.reset(strbuf);
|
|
|
- if(xmsg.SerializeToArray(strbuf,nbytesize))
|
|
|
- {
|
|
|
-
|
|
|
- ClientContext context ;
|
|
|
- context.set_deadline(timespec);
|
|
|
- qint64 time1 = QDateTime::currentMSecsSinceEpoch();
|
|
|
-
|
|
|
- request.set_id(nid);
|
|
|
- request.set_ntime(time1);
|
|
|
- request.set_strquerymd5(gstrqueryMD5);
|
|
|
- request.set_strctrlmd5(gstrctrlMD5);
|
|
|
- request.set_strvin(gstrVIN);
|
|
|
- request.set_xdata(strbuf,nbytesize);
|
|
|
- request.set_kepptime(nkeeptime);
|
|
|
- request.set_bimportant(bImportant);
|
|
|
- nid++;
|
|
|
- // The actual RPC.
|
|
|
- Status status = stub_->upload(&context, request, &reply);
|
|
|
- if (status.ok()) {
|
|
|
- std::cout<<nid<<" upload successfully"<<std::endl;
|
|
|
- if(reply.nres() == 1)
|
|
|
- {
|
|
|
- iv::cloud::cloudmsg xmsg;
|
|
|
- if(xmsg.ParseFromArray(reply.xdata().data(),reply.xdata().size()))
|
|
|
- {
|
|
|
- sharectrlmsg(&xmsg);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- std::cout << status.error_code() << ": " << status.error_message()
|
|
|
- << std::endl;
|
|
|
- std::cout<<"RPC failed"<<std::endl;
|
|
|
- if(status.error_code() == 4)
|
|
|
- {
|
|
|
- std::cout<<" RPC Exceed Time, Create New stub_"<<std::endl;
|
|
|
- channel = grpc::CreateCustomChannel(
|
|
|
- target_str, grpc::InsecureChannelCredentials(),cargs);
|
|
|
-
|
|
|
- stub_ = iv::Upload::NewStub(channel);
|
|
|
- }
|
|
|
- std::this_thread::sleep_for(std::chrono::milliseconds(900));
|
|
|
-
|
|
|
+ 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);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- nlastsend = xTime.elapsed();
|
|
|
-
|
|
|
+// pUploadClient->updatePath(pControlClient->get_patrolPathID(),somePoints);
|
|
|
+ pUploadClient->updatePath("testpath1",somePoints);
|
|
|
+ pUploadClient->uploadPath();
|
|
|
+ pControlClient->set_isNeedMap(false);
|
|
|
+ }
|
|
|
+// std::cout<<"thread running"<<std::endl;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void dec_yaml(const char * stryamlpath)
|
|
|
{
|
|
|
|
|
@@ -312,161 +81,90 @@ void dec_yaml(const char * stryamlpath)
|
|
|
{
|
|
|
config = YAML::LoadFile(stryamlpath);
|
|
|
}
|
|
|
- catch(YAML::BadFile e)
|
|
|
+ catch(...)
|
|
|
{
|
|
|
- qDebug("load error.");
|
|
|
+ qDebug("yaml file has some unknown code or load fail.");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- std::vector<std::string> vecmodulename;
|
|
|
-
|
|
|
-
|
|
|
if(config["server"])
|
|
|
{
|
|
|
gstrserverip = config["server"].as<std::string>();
|
|
|
}
|
|
|
- if(config["port"])
|
|
|
+ if(config["uploadPort"])
|
|
|
{
|
|
|
- gstrserverport = config["port"].as<std::string>();
|
|
|
+ gstruploadPort = config["uploadPort"].as<std::string>();
|
|
|
}
|
|
|
- if(config["uploadinterval"])
|
|
|
+ if(config["patrolPort"])
|
|
|
{
|
|
|
- gstruploadinterval = config["uploadinterval"].as<std::string>();
|
|
|
+ gstrpatrolPort = config["patrolPort"].as<std::string>();
|
|
|
}
|
|
|
-
|
|
|
- if(config["VIN"])
|
|
|
+ if(config["controlPort"])
|
|
|
{
|
|
|
- gstrVIN = config["VIN"].as<std::string>();
|
|
|
+ gstrcontrolPort = config["controlPort"].as<std::string>();
|
|
|
}
|
|
|
-
|
|
|
- if(config["queryMD5"])
|
|
|
+ if(config["uploadInterval"])
|
|
|
{
|
|
|
- gstrqueryMD5 = config["queryMD5"].as<std::string>();
|
|
|
+ gstruploadInterval = config["uploadInterval"].as<std::string>();
|
|
|
}
|
|
|
- else
|
|
|
+ if(config["patrolInterval"])
|
|
|
{
|
|
|
- return;
|
|
|
+ gstrpatrolInterval = config["patrolInterval"].as<std::string>();
|
|
|
}
|
|
|
-
|
|
|
- if(config["ctrlMD5"])
|
|
|
+ if(config["controlinterval"])
|
|
|
{
|
|
|
- gstrctrlMD5 = config["ctrlMD5"].as<std::string>();
|
|
|
+ gstrcontrolInterval = config["controlinterval"].as<std::string>();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- std::string strmsgname;
|
|
|
-
|
|
|
- if(config["uploadmessage"])
|
|
|
- {
|
|
|
-
|
|
|
- for(YAML::const_iterator it= config["uploadmessage"].begin(); it != config["uploadmessage"].end();++it)
|
|
|
- {
|
|
|
- std::string strtitle = it->first.as<std::string>();
|
|
|
- std::cout<<strtitle<<std::endl;
|
|
|
-
|
|
|
- if(config["uploadmessage"][strtitle]["msgname"]&&config["uploadmessage"][strtitle]["buffersize"]&&config["uploadmessage"][strtitle]["buffercount"])
|
|
|
- {
|
|
|
- iv::msgunit xmu;
|
|
|
- strmsgname = config["uploadmessage"][strtitle]["msgname"].as<std::string>();
|
|
|
- strncpy(xmu.mstrmsgname,strmsgname.data(),255);
|
|
|
- xmu.mnBufferSize = config["uploadmessage"][strtitle]["buffersize"].as<int>();
|
|
|
- xmu.mnBufferCount = config["uploadmessage"][strtitle]["buffercount"].as<int>();
|
|
|
- if(config["uploadmessage"][strtitle]["bimportant"])
|
|
|
- {
|
|
|
- std::string strimportant = config["uploadmessage"][strtitle]["bimportant"].as<std::string>();
|
|
|
- if(strimportant == "true")
|
|
|
- {
|
|
|
- xmu.mbImportant = true;
|
|
|
- }
|
|
|
- }
|
|
|
- if(config["uploadmessage"][strtitle]["keeptime"])
|
|
|
- {
|
|
|
- std::string strkeep = config["uploadmessage"][strtitle]["keeptime"].as<std::string>();
|
|
|
- xmu.mnkeeptime = atoi(strkeep.data());
|
|
|
- }
|
|
|
- mvectormsgunit.push_back(xmu);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ if(config["uploadmapinterval"])
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
+ gstruploadMapInterval = config["uploadmapinterval"].as<std::string>();
|
|
|
}
|
|
|
|
|
|
- if(!config["ctrlMD5"])
|
|
|
+ if(config["id"])
|
|
|
{
|
|
|
- return;
|
|
|
+ gstrid = config["id"].as<std::string>();
|
|
|
}
|
|
|
-
|
|
|
- if(config["ctrlmessage"])
|
|
|
+ if(config["plateNumber"])
|
|
|
{
|
|
|
- std::string strnodename = "ctrlmessage";
|
|
|
- for(YAML::const_iterator it= config[strnodename].begin(); it != config[strnodename].end();++it)
|
|
|
- {
|
|
|
- std::string strtitle = it->first.as<std::string>();
|
|
|
- std::cout<<strtitle<<std::endl;
|
|
|
-
|
|
|
- if(config[strnodename][strtitle]["msgname"]&&config[strnodename][strtitle]["buffersize"]&&config[strnodename][strtitle]["buffercount"])
|
|
|
- {
|
|
|
- iv::msgunit xmu;
|
|
|
- strmsgname = config[strnodename][strtitle]["msgname"].as<std::string>();
|
|
|
- strncpy(xmu.mstrmsgname,strmsgname.data(),255);
|
|
|
- xmu.mnBufferSize = config[strnodename][strtitle]["buffersize"].as<int>();
|
|
|
- xmu.mnBufferCount = config[strnodename][strtitle]["buffercount"].as<int>();
|
|
|
- mvectorctrlmsgunit.push_back(xmu);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
+ gstrplateNumber = config["plateNumber"].as<std::string>();
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-*/
|
|
|
-
|
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
|
- showversion("driver_cloud_grpc_client");
|
|
|
+ showversion("driver_cloud_grpc_client_BS");
|
|
|
QCoreApplication a(argc, argv);
|
|
|
|
|
|
- // std::thread * ptest = new std::thread(test);
|
|
|
-
|
|
|
- // return a.exec();
|
|
|
-
|
|
|
char stryamlpath[256];
|
|
|
if(argc<2)
|
|
|
{
|
|
|
- snprintf(stryamlpath,255,"driver_cloud_grpc_client.yaml");
|
|
|
-// strncpy(stryamlpath,abs_ymlpath,255);
|
|
|
+ snprintf(stryamlpath,255,"driver_cloud_grpc_client_BS.yaml");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strncpy(stryamlpath,argv[1],255);
|
|
|
}
|
|
|
-// dec_yaml(stryamlpath);
|
|
|
+ dec_yaml(stryamlpath);
|
|
|
+
|
|
|
+ std::string control_str = gstrserverip+":";
|
|
|
+ control_str = control_str + gstrcontrolPort ;
|
|
|
+
|
|
|
+ std::string patrol_str = gstrserverip+":";
|
|
|
+ patrol_str = patrol_str + gstrpatrolPort;
|
|
|
+
|
|
|
+ std::string upload_str = gstrserverip+":";
|
|
|
+ upload_str = upload_str + gstruploadPort ;
|
|
|
|
|
|
- grpcclient * pgrpcclient = new grpcclient(stryamlpath);
|
|
|
- pgrpcclient->start();
|
|
|
+ VehicleControlClient *vehiclecontrol = new VehicleControlClient(grpc::CreateChannel(control_str, grpc::InsecureChannelCredentials()));
|
|
|
|
|
|
-// int i;
|
|
|
-// for(i=0;i<mvectormsgunit.size();i++)
|
|
|
-// {
|
|
|
-// mvectormsgunit[i].mpa = iv::modulecomm::RegisterRecv(mvectormsgunit[i].mstrmsgname,ListenData);
|
|
|
-// }
|
|
|
+ DataExchangeClient *vehicleupload = new DataExchangeClient(grpc::CreateChannel(upload_str, grpc::InsecureChannelCredentials()));
|
|
|
|
|
|
-// for(i=0;i<mvectorctrlmsgunit.size();i++)
|
|
|
-// {
|
|
|
-// mvectorctrlmsgunit[i].mpa = iv::modulecomm::RegisterSend(mvectorctrlmsgunit[i].mstrmsgname,mvectorctrlmsgunit[i].mnBufferSize,
|
|
|
-// mvectorctrlmsgunit[i].mnBufferCount);
|
|
|
-// }
|
|
|
+ VehiclePatrolExceptionClient vehiclepatrol(grpc::CreateChannel(patrol_str, grpc::InsecureChannelCredentials()));
|
|
|
|
|
|
-// guploadthread = new std::thread(threadupload);
|
|
|
+ mainloop loop(vehiclecontrol,vehicleupload);
|
|
|
+ loop.start();
|
|
|
|
|
|
return a.exec();
|
|
|
}
|