#include #include "../DB/LDBTool.h" #include "sdkHdlManage.h" #include #include sdkHdlManage::sdkHdlManage(LDBTool *dbTool) : TaskManage(dbTool) { init(); } sdkHdlManage::~sdkHdlManage() { } void sdkHdlManage::init(void) { //search all sdk_hdl_info m_list = db_c->searchSdkHdlTableAll(); } getsdkHdlManage sdkHdlManage::getTask(void) { getsdkHdlManage result; QDateTime endTime; if (m_list.size() > 0) { Record_Sdk_Hdl_info sdlHdlRec = *m_list.begin(); m_list.pop_front(); result.src_path = sdlHdlRec.str_src_path.toStdString(); result.total = sdlHdlRec.n_total; result.pos = sdlHdlRec.n_pos; auto t_rec = db_c->searchChnSdkTableByChannelId(sdlHdlRec.str_storage_dev_id, sdlHdlRec.n_chn);//.str_sdks.toStdString(); result.en_sdk = t_rec.str_sdks.toStdString(); result.str_addr = db_c->searchChannelTableByChannelId(sdlHdlRec.str_storage_dev_id, sdlHdlRec.n_chn).str_addr.toStdString(); result.str_cmp_thr = t_rec.str_cmp_thr.toStdString(); result.str_det_thr = t_rec.str_det_thr.toStdString(); result.strDevID = t_rec.str_storage_dev_id.toStdString(); result.nChannelID = t_rec.n_chn; } else { //get task from cut_video_info Record_Cut_Video_info rec = db_c->searchOldestRecordfromCutTableByUpdateTime(); if (rec.str_storage_dev_id.size() > 0) { result.src_path = rec.str_dst_path.toStdString(); result.total = rec.n_total; result.pos = 0; auto t_rec = db_c->searchChnSdkTableByChannelId(rec.str_storage_dev_id, rec.n_chn);//.str_sdks.toStdString(); result.en_sdk = t_rec.str_sdks.toStdString(); result.str_addr = db_c->searchChannelTableByChannelId(rec.str_storage_dev_id, rec.n_chn).str_addr.toStdString(); result.str_cmp_thr = t_rec.str_cmp_thr.toStdString(); result.str_det_thr = t_rec.str_det_thr.toStdString(); result.strDevID = t_rec.str_storage_dev_id.toStdString(); result.nChannelID = t_rec.n_chn; //insert rec to sdk_hdl_info && delete cut_video_info Record_Sdk_Hdl_info sdlHdlRec{0, rec.str_storage_dev_id, rec.n_chn, rec.str_dst_path, rec.n_total, 0, ""}; bool ret = db_c->insertSdkHdlTableAndDeleteCutVideoTable(sdlHdlRec, rec.str_storage_dev_id, rec.n_chn, rec.str_src_path); if (!ret) { return getsdkHdlManage(); } } } return result; } bool sdkHdlManage::updateSdkHdlPos(const pfinishSdkHdlManage finishInfo) { //根据devID&chn&src_path,更新sdk_hdl_info的pos,pos+1 return db_c->updateSdkHdlTablePos(QString::fromStdString(finishInfo->src_path), finishInfo->pos); } bool sdkHdlManage::finishTask(const pfinishSdkHdlManage finishInfo) { //TODO //根据devID&chn&src_path 删除sdk_hdl_info这条记录 return db_c->deleteSdkHdlTable(QString::fromStdString(finishInfo->src_path)); }