123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef GRPCPC_H
- #define GRPCPC_H
- #include <QThread>
- #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 "uploadstreammsg.grpc.pb.h"
- using grpc::Channel;
- using grpc::ClientContext;
- using grpc::Status;
- 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;
- };
- }
- class grpcpc : public QThread
- {
- public:
- grpcpc(std::string stryamlpath);
- private:
- void run();
- private:
- std::string gstrserverip = "127.0.0.1";
- std::string gstrserverport = "50051";
- std::string gstruploadinterval = "100";
- void * gpa;
- QMutex gMutexMsg;
- std::vector<iv::msgunit> mvectormsgunit;
- std::vector<iv::msgunit> mvectorctrlmsgunit;
- std::string gstrVIN = "AAAAAAAAAAAAAAAAA";
- std::string gstrqueryMD5 = "5d41402abc4b2a76b9719d911017c592";
- std::string gstrctrlMD5 = "5d41402abc4b2a76b9719d911017c592";
- int gindex = 0;
- private:
- void dec_yaml(const char * stryamlpath);
- void sharequerymsg(iv::cloud::cloudmsg * pxmsg);
- public:
- void UpdateData(const char * strdata,const unsigned int nSize,const char * strmemname);
- std::string GetVIN();
- void threadsend(std::shared_ptr<::grpc::ClientReaderWriter<iv::queryReqStream, iv::queryReplyStream> > writer,bool * pbrun);
- };
- #endif // GRPCPC_H
|