UniversalFunc.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef UNIVERSALFUNC_H
  2. #define UNIVERSALFUNC_H
  3. #include <string>
  4. #include "GlobalVariable.h"
  5. /* ==========================================================
  6. * 通用的功能函数
  7. * ========================================================== */
  8. /* 解析Redis的基础通用数据,不包含bBoxes数组数据 */
  9. void parseRedisBaseData(const std::string& strData, AlarmInfo& alarmInfo);
  10. /* 解析Redis的bBoxes数据 */
  11. void parseRedisBBoxesData(const std::string& strData, AlarmInfo& alarmInfo);
  12. /* 解析Redis的其他数据,人员计数版,主要是BBoxes和PersonList */
  13. bool parseOtherDataPersonCount(const std::string& strData, AlarmInfo& alarmInfo);
  14. /* 将字符串转换成QDateTime */
  15. QDateTime strToDateTime(const std::string& strTime);
  16. /* 判断时间是否长时间没有更新 */
  17. bool isEventTimeVaild(const std::string& strTime);
  18. /* 判断redis数据是否长时间没有更新 */
  19. bool isEventTimeVaild(const QDateTime& nowTime, const std::string& strTime);
  20. /* 计算与当前时间的时间差,返回秒 */
  21. int timeDiffWithNow(const std::string& strTime);
  22. /* 字符串时间转换成std::chrono时间点 */
  23. std::chrono::system_clock::time_point strTimeToChrono(const std::string& strTime);
  24. /* 时间点转换成字符串 */
  25. std::string chronoToStrTime(const std::chrono::system_clock::time_point& timePoint);
  26. /* 通过应用ID获取应用名称 */
  27. std::string getAppFunctionName(const AppFunction appID);
  28. /* 获取应用ID在EQM数据库中的编号,按位运算的编号 */
  29. int getAppFunctionID(const AppFunction appID);
  30. /* 根据EQM数据库中的编号,转换成本地的AppID */
  31. AppFunction getAppFunctionID(int nID);
  32. /* 根据数字获取周几字符串,范围1-7 */
  33. std::string getWeekDayString(int nWeek);
  34. #endif // UNIVERSALFUNC_H