| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #ifndef GRPCCLIENT_H
- #define GRPCCLIENT_H
- #include <QThread>
- #include <yaml-cpp/yaml.h>
- #include <QDateTime>
- #include <iostream>
- #include <vector>
- #include <memory>
- #include <QMutex>
- #include <thread>
- #include "modulecomm.h"
- #include <iostream>
- #include <memory>
- #include <string>
- #include <grpcpp/grpcpp.h>
- 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;
- };
- }
- using grpc::Channel;
- using grpc::ClientContext;
- using grpc::Status;
- class grpcclient : public QThread
- {
- public:
- grpcclient(std::string stryamlpath);
- private:
- 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 = "100";
- std::string gstrpatrolInterval = "100";
- std::string gstrcontrolInterval = "100";
- std::string gstrid = "1";
- std::string gstrplateNumber = "A00001";
- void * gpa;
- QMutex gMutexMsg;
- std::thread * guploadthread;
- std::vector<iv::msgunit> mvectormsgunit;
- std::vector<iv::msgunit> mvectorctrlmsgunit;
- int gindex = 0;
- public:
- void UpdateData(const char * strdata,const unsigned int nSize,const char * strmemname);
- private:
- void run();
- void dec_yaml(const char * stryamlpath);
- void sharectrlmsg(iv::cloud::cloudmsg * pxmsg);
- };
- #endif // GRPCCLIENT_H
|