#pragma once #include "json.hpp" #include "HIKBase.h" #include "DecisionPlatform.h" #include "DataTime.h" #include #define NVR_SUC 0 #define NVR_ERR_HIK 6 #define NVR_ERR_CONNECT_7 7 struct TimeRecord { DateTime TimeStart; DateTime TimeEnd; long long tmTimeStart; long long tmTimeEnd; // 目前是针对每天记录比对,所以只比对time即可。 bool IsInRecord(DateTime time_in) { if (TimeStart < time_in && TimeEnd > time_in) { return true; } return false; } }; class HIKNvr : public HIKBase { public: HIKNvr(); //初始化 Nvr bool InitNvr(std::string ip, std::string port, std::string username, std::string password, int channel); //按月查询 int CheckTimeRegionWithMonth(DateTime select_time, std::vector &available_date_vec); //按日查询 int CheckTimeRegionWithDay(DateTime select_time, std::vector &available_time_vec); //though input SelectTime get the time region bool GetTimeRegion(DateTime select_time,int value ,DateTime &time_start,DateTime &time_end); bool GetNvrUTCDiff(); int nDiffTotalMin; public: // 将时间转换成json nlohmann::json TimeToJson(DateTime Time,std::vector *pAvailableDateVec); nlohmann::json TimeToJsonInDay(DateTime Time,std::vector *pAvailableTimeVec); private: //record the time in the Nvr std::vector m_TimeRecords; //Nvr channel int m_Channel; };