void VSCVidItemVidStor::TreeUpdated(bool bClear) { qDeleteAll(takeChildren()); if (bClear == true) { return; } VidCameraList cCamList = m_pFactory.GetStorFactory().GetVidCameraList(m_cStor.strid()); StorClientOnlineMap bOnline = m_pFactory.GetStorFactory().GetVidCameraOnlineList(m_cStor.strid()); StorClientRecMap bRec = m_pFactory.GetStorFactory().GetVidCameraRecList(m_cStor.strid()); int camSize = cCamList.cvidcamera_size(); for (s32 i = 0; i < cCamList.cvidcamera_size(); i ++) { VidCamera pCam = cCamList.cvidcamera(i); VidCameraId cCamId; cCamId.set_strcameraid(pCam.strid()); cCamId.set_strstorid(GetId()); VSCVidItemCam *pItemCam = new VSCVidItemCam(pCam, cCamId, m_pFactory, this); StorClientOnlineMap::iterator it = bOnline.find(pCam.strid()), ite = bOnline.end(); if (it != ite) { pItemCam->UpdateOnline(bOnline[pCam.strid()]); pItemCam->UpdateRec(bRec[pCam.strid()]); } } }
void VSCVidItemStorConf::TreeUpdated(bool bClear) { qDeleteAll(takeChildren()); if (bClear == true) { return; } /* Add fixed items */ m_pItemAddCam = new VSCVidItemAddCam(m_cStor, m_pFactory, this); VSCVidItemDiskConf *pDiskConf = new VSCVidItemDiskConf(m_cStor, m_pFactory, this); VidCameraList cCamList = m_pFactory.GetStorFactory().GetVidCameraList(m_cStor.strid()); StorClientOnlineMap bOnline = m_pFactory.GetStorFactory().GetVidCameraOnlineList(m_cStor.strid()); StorClientRecMap bRec = m_pFactory.GetStorFactory().GetVidCameraRecList(m_cStor.strid()); int camSize = cCamList.cvidcamera_size(); for (s32 i = 0; i < cCamList.cvidcamera_size(); i ++) { VidCamera pCam = cCamList.cvidcamera(i); /* All the camera are the child of the Add Cam */ VSCVidItemCamConf *pItemCam = new VSCVidItemCamConf(m_cStor, pCam, m_pFactory, m_pItemAddCam); StorClientOnlineMap::iterator it = bOnline.find(pCam.strid()), ite = bOnline.end(); if (it != ite) { pItemCam->UpdateOnline(bOnline[pCam.strid()]); pItemCam->UpdateRec(bRec[pCam.strid()]); } } return; }
inline BOOL StorFactory::Init() { /* Loop add the stor */ #if 0 //add camera for test { VidCameraList cameraList; CameraParam Param; Param.m_Conf.set_strip("192.168.1.1"); Param.m_Conf.set_strport("80"); Param.m_Conf.set_struser("admin"); Param.m_Conf.set_strpasswd("admin"); VidCamera *pAddCam = cameraList.add_cvidcamera(); *pAddCam = Param.m_Conf; m_Conf.UpdateCameraListConf(cameraList); } #endif VidCameraList cameraList; m_Conf.GetCameraListConf(cameraList); int cameraSize = cameraList.cvidcamera_size(); for (s32 i = 0; i < cameraList.cvidcamera_size(); i ++) { VidCamera cam = cameraList.cvidcamera(i); CameraParam pParam(cam); InitAddCamera(pParam, cam.strid()); } return TRUE; }
BOOL OAPIConverter::Converter(VidCamera &from, oapi::OAPICamera &to) { to.strId = from.strid(); to.strName = from.strname(); to.nType = from.ntype(); to.strIP = from.strip(); to.strPort = from.strport(); to.strUser = from.struser(); to.strPasswd = from.strpasswd(); to.strONVIFAddress = from.stronvifaddress(); to.bProfileToken = from.bprofiletoken(); to.strProfileToken1 = from.strprofiletoken1(); to.strProfileToken2 = from.strprofiletoken2(); to.strFile = from.strfile(); to.strRTSPUrl = from.strrtspurl(); to.bHWaccel = from.bhwaccel(); to.bServerMotion = from.bservermotion(); to.nConnectType = from.nconnecttype(); return TRUE; }
void VSCVidItemVidStor::CameraAdd(VidCamera cCam) { int cnt = this->childCount(); for (int i = 0; i < cnt; i ++) { QTreeWidgetItem * pChild = this->child(i); VSCVidItemInf *pItem = dynamic_cast<VSCVidItemInf*>(pChild); if (pItem && pItem->GetId() == cCam.strid()) { /* already in the list */ this->removeChild(pChild); } } VidCameraId cCamId; cCamId.set_strcameraid(cCam.strid()); cCamId.set_strstorid(GetId()); VSCVidItemCam *pItemCam = new VSCVidItemCam(cCam,cCamId, m_pFactory, this); }
void VSCVidItemStorConf::CameraAdd(VidCamera cCam) { if (m_pItemAddCam == NULL) { return; } int cnt = m_pItemAddCam->childCount(); for (int i = 0; i < cnt; i ++) { QTreeWidgetItem * pChild = m_pItemAddCam->child(i); VSCVidItemInf *pItem = dynamic_cast<VSCVidItemInf*>(pChild); if (pItem && pItem->GetId() == cCam.strid()) { /* already in the list */ m_pItemAddCam->removeChild(pChild); } } VSCVidItemCamConf *pItemCam = new VSCVidItemCamConf(m_cStor, cCam, m_pFactory, m_pItemAddCam); }
inline BOOL Factory::Init() { astring strPath; if (m_SysPath.GetSystemPath(strPath) == FALSE) { return FALSE; } printf("Sys path %s\n", strPath.c_str()); #ifdef WIN32 #ifndef _WIN64 astring strPathConf = strPath + "vidstor\\config"; #else astring strPathConf = strPath + "vidstor64\\config"; #endif #else astring strPathConf = strPath + "vidstor/config"; #endif m_Conf.Open(strPathConf); #ifndef _WIN64 astring strPathDb = strPath + "vidstor"; #else astring strPathDb = strPath + "vidstor64"; #endif m_pVdb = new VDB(strPathDb); VidHDFSConf HdfsConf; m_Conf.GetHdfsRecordConf(HdfsConf); astring strNameNode = HdfsConf.strnamenode(); astring strPort = HdfsConf.strport(); astring strUser = HdfsConf.struser(); m_pVHdfsdb = new VHdfsDB(strNameNode, strPort, strUser); #if 1 //add camera for test { VidCameraList cameraList; CameraParam Param; Param.m_Conf.set_strip("192.168.0.123"); Param.m_Conf.set_strport("80"); Param.m_Conf.set_struser("admin"); Param.m_Conf.set_strpasswd("12345"); VidCamera *pAddCam = cameraList.add_cvidcamera(); *pAddCam = Param.m_Conf; m_Conf.UpdateCameraListConf(cameraList); } #endif VidCameraList cameraList; m_Conf.GetCameraListConf(cameraList); int cameraSize = cameraList.cvidcamera_size(); for (s32 i = 0; i < cameraList.cvidcamera_size(); i ++) { VidCamera cam = cameraList.cvidcamera(i); CameraParam pParam(cam); InitAddCamera(pParam, cam.strid()); } #if 0 VSCConfData sysData; m_Conf.GetSysData(sysData); for (s32 i = 1; i < CONF_MAP_MAX; i ++) { if (sysData.data.conf.CameraMap[i] != CONF_MAP_INVALID_MIN && sysData.data.conf.CameraMap[i] != 0) { VDC_DEBUG( "%s Init Camera %d\n",__FUNCTION__, i); VSCCameraData Data; m_Conf.GetCameraData(i, Data); CameraParam mParam(Data); LockCameraID(Data.data.conf.nId); InitAddCamera(mParam, Data.data.conf.nId); VDC_DEBUG( "%s Id %d\n",__FUNCTION__, Data.data.conf.nId); } } #endif InitLicense(); //m_pThread = new thread(Factory::Run, (void *)this); //start(); m_HddTask = new FactoryHddTask(*this); m_HddTask->start(); //if (sysData.data.conf.OAPIPort == 0) { //sysData.data.conf.OAPIPort = 9080; } //m_pHttpServer = new CmnHttpServer(sysData.data.conf.OAPIPort); //m_pHttpServer->start(); /* Init export path */ astring strExportPath; GetExportPath(strExportPath); return TRUE; }