12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #ifndef GRPCCLIENTTHREAD_H
- #define GRPCCLIENTTHREAD_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 "ivgrpc.grpc.pb.h"
- #include "rpcmsgunit.h"
- using grpc::Channel;
- using grpc::ClientContext;
- using grpc::Status;
- class grpcclientthread : public QThread
- {
- public:
- grpcclientthread();
- ~grpcclientthread();
- private:
- std::string mstrserverip = "192.168.1.102";
- std::string mstrserverport = "30051";
- std::string mstrqueryinterval = "10";
- std::string mstrdevname = "PAD";
- bool mbRuning = true;
- void * mpa;
- QMutex mMutexMsg;
- std::thread * guploadthread;
- std::vector<iv::rpcmsgunit> mvectorquerymsgunit;
- std::vector<iv::rpcmsgunit> mvectorctrlmsgunit;
- public:
- void UpdateData(const char * strdata,const unsigned int nSize,const char * strmemname);
- void startlisten();
- void dec_yaml(const char * stryamlpath);
- void addquerymsgunit(std::string strquerymsg,int nbuffsize,int nbuffcount);
- void addctrlmsgunit(std::string strquerymsg,int nbuffsize,int nbuffcount);
- void setserverip(std::string strip);
- void setserverport(std::string strport);
- void setqueryinterval(std::string strinterval);
- void setdevname(std::string strdevname);
- private:
- void run();
- void sharequerymsg(const iv::ModuleMsg * pxmsg);
- };
- #endif
|