12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef SPASERVER_H
- #define SPASERVER_H
- #include "FromSuperBrain.h"
- #include "FromRedis.h"
- #include "ToEQMDataBase.h"
- /**
- * 安播辅助提示系统服务类
- *
- */
- class SPAServer
- {
- public:
- SPAServer();
- ~SPAServer();
- /* 启动服务 */
- void startServer();
- private:
- /* 从基础平台获取算法信息和设备信息的线程函数 */
- void threadFromSuperBrain();
- /* 处理算法信息,返回值为true,说明有改变,需要重新读取 */
- bool processAlgorithmInfo(std::vector<AlgorithmInfo> vecNewAlgInfo);
- /* 处理设备信息,传入新获取到的值,返回true需要更新本地数据缓存 */
- bool processDeviceInfo(std::vector<DeviceInfo> vecNewDevInfo);
- /* 对比算法信息现有的数据和新获取到的数据,取出要删除和添加的数据 */
- void compareAlgorithmInfo(const std::vector<AlgorithmInfo>& vecNewInfo, std::vector<AlgorithmInfo>& vecAlgUpdate, std::vector<AlgorithmInfo>& vecAlgDelete);
- /* 对比设备和算法关联表是否需要更新 */
- void compareDeviceAlgorithmInfo(const std::vector<DeviceInfo>& vecNewInfo, std::vector<DeviceInfo>& vecDevUpdate);
- /* 从Redis获取数据线程函数,这个是摄像机线程 */
- void threadFromRedis(const CameraThreadInfo& info);
- /* 解析Redis基础数据 */
- void parseRedisData(const std::string& strData, AlarmInfo& alarmInfo);
- private:
- std::shared_ptr<spdlog::logger> m_logger = nullptr;
- bool m_threadRunning = true; /* 线程正在运行 */
- FromSuperBrain m_fromSuperBrain;
- ToEQMDataBase m_toEQMDataBase;
- std::string m_keyContraband; /* 违禁品检测的Key,这个Key后面可能随时会变动 */
- std::string m_KeyFace; /* 人脸检测的Key */
- /* 算法信息,这个就是tAction在内存中的数据,方便后续对比,程序启动的时候会先获取一份 */
- std::vector<AlgorithmInfo> m_vecEqmAlgInfo;
- /* 设备信息,这个是tActionCamer的信息 */
- std::vector<DeviceInfo> m_vecEqmDevInfo;
- /* 设备和算法关联信息,这里存储着已经删除的设备对应的算法信息,将在这一轮循环中删除 */
- std::list<int> m_listDevIDDelete;
- };
- #endif /* SPASERVER_H */
|