123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #ifndef VEHICLE_PATROL_H
- #define VEHICLE_PATROL_H
- #include <QObject>
- #include <QTimer>
- #include <QDateTime>
- #include <QVector>
- #include <QThread>
- #include <QMutex>
- #include <iostream>
- #include <memory>
- #include <string>
- #include <yaml-cpp/yaml.h>
- #include <grpcpp/grpcpp.h>
- #include "VehiclePatrol_service.grpc.pb.h"
- #include "VehiclePatrol.grpc.pb.h"
- #ifndef IV_MSGUNIT
- #define IV_MSGUNIT
- namespace iv {
- struct msgunit
- {
- char mstrmsgname[256];
- int mnBufferSize = 10000;
- int mnBufferCount = 1;
- void * mpa = nullptr;
- std::shared_ptr<char> mpstrmsgdata;
- int mndatasize = 0;
- bool mbRefresh = false;
- bool mbImportant = false;
- int mnkeeptime = 100;
- };
- }
- #endif
- using grpc::Channel;
- using grpc::ClientContext;
- using grpc::Status;
- using org::jeecg::defsPatrol::grpc::VehiclePatrolException; ///< service name
- using org::jeecg::defsPatrol::grpc::PatrolRequest;
- class VehiclePatrolExceptionClient : public QThread{
- Q_OBJECT
- public:
- VehiclePatrolExceptionClient(std::shared_ptr<Channel> channel);
- ~VehiclePatrolExceptionClient(void);
- std::string uploadVehiclePatrolInfo(void);
- void updatePatrolData(void);
- void dec_yaml(const char * stryamlpath);
- void ListenGPSIMUMsg(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
- protected:
- void run();
- private:
- std::unique_ptr<VehiclePatrolException::Stub> stub_;
- iv::msgunit shmGPSIMU;
- iv::msgunit shmPicFront;
- iv::msgunit shmPicRear;
- iv::msgunit shmPicLeft;
- iv::msgunit shmPicRight;
- iv::msgunit shmStartTurnstile;
- iv::msgunit shmTurnstile;
- QMutex mutex_GPSIMU;
- org::jeecg::defsPatrol::grpc::GPSPoint currentPosition;
- double currentSpeed;
- std::string id;
- bool isTVR = false; ///< Traffic Violation Recognition
- int32_t violationStatus; ///< 0 no violation 1 overspeed 2 illegal parking 3 direction wrong 4 run the red light
- std::string vehicleLicenseNumber;
- QByteArray violationImage;
- uint64_t violationTime; ///< time when get violationImage
- org::jeecg::defsPatrol::grpc::GPSPoint violationPosition; ///< positon when get violationImage
- bool isFSM = false; ///< Fire and Smoke Monitor
- int32_t fireStatus; ///< 0 no fire 1 has fire
- QByteArray fireImage;
- uint64_t fireTime; ///< time when get fireImage
- org::jeecg::defsPatrol::grpc::GPSPoint firePosition; ///< positon when get fireImage
- bool isTSGM = false; ///< Turn Stile Gate Monitor
- int32_t gateStatus; ///< 0 no gate 1 gate close 2 gate open
- QByteArray gateImage;
- uint64_t gateTime; ///< time when get gateImage
- org::jeecg::defsPatrol::grpc::GPSPoint gatePosition; ///< positon when get gateImage
- bool isNeedTSGM = false;
- QTime timerTSGM;
- uint8_t statusTSGM = 0; ///< 0 ready 1 wait for result 2 has result 3 timeout but no result
- org::jeecg::defsPatrol::grpc::GPSPoint gateDestination;
- std::string plateNumber;
- };
- #endif // VEHICLE_PATROL_H
|