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; }
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; }
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 VidCamAdd::SetCamUI(VidCamera pCam) { switch(pCam.ntype()) { case VID_FILE: ui.radioButtonFile->setChecked(true); break; case VID_RTSP: ui.radioButtonRtsp->setChecked(true); break; case VID_ONVIF_S: ui.radioButtonOnvif->setChecked(true); break; default: return; } SlotRadioButtonClicked(); ui.lineEditName->setText(pCam.strname().c_str()); ui.lineEditIP->setText(pCam.strip().c_str()); ui.lineEditPort->setText(pCam.strport().c_str()); ui.lineEditUser->setText(pCam.struser().c_str()); ui.lineEditPassword->setText(pCam.strpasswd().c_str()); ui.lineEditFile->setText(pCam.strfile().c_str()); ui.lineEditRtspAddr->setText(pCam.strrtspurl().c_str()); ui.pbMotionJPEG->setChecked(pCam.bmotionjpeg()); }
void VidCamAdd::TreeWidgetUpdate() { VidCameraList camList; StorSyncInf syncInf(m_sStor, 5 * 1000); VSCLoading loading(NULL); loading.show(); QDesktopWidget *desktop = QApplication::desktop(); QRect rect = desktop->screenGeometry(0); loading.setGeometry(rect.width()/2, rect.height()/2, 64, 64); QCoreApplication::processEvents(); if (syncInf.Connect() == false) { return; } camList = syncInf.GetVidCameraList(); int storSize = camList.cvidcamera_size(); int nRowCnt = ui.tableWidget->rowCount(); for (s32 j = 0; j < nRowCnt; j ++) { ui.tableWidget->removeRow(j); } ui.tableWidget->clear(); for (s32 i = 0; i < camList.cvidcamera_size(); i ++) { VidCamera pCam = camList.cvidcamera(i); //int insertRow = ui.tableWidget->rowCount(); int insertRow = i; ui.tableWidget->insertRow(insertRow); QTableWidgetItem *firstCheck = new VidCamTableItem(pCam, false); firstCheck->setCheckState(Qt::Checked); ui.tableWidget->setItem(insertRow, 0, firstCheck); ui.tableWidget->setItem(insertRow, 1, new QTableWidgetItem(pCam.strname().c_str())); ui.tableWidget->setItem(insertRow, 2, new QTableWidgetItem(pCam.strip().c_str())); ui.tableWidget->setItem(insertRow, 3, new QTableWidgetItem(pCam.struser().c_str())); } }
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); }
bool Camera::UpdateRecSched(VidCamera &pCam) { m_cSchedMap.clear(); int cameraSize = pCam.crecsched_size(); for (s32 i = 0; i < pCam.crecsched_size(); i ++) { astring strid = pCam.crecsched(i); RecordSchedWeek sched; if (m_pConfDB.GetRecSched(strid, sched) == true) { m_cSchedMap[strid] = sched; } } m_cRecordWrapper.UpdateSchedMap(m_cSchedMap); return true; }
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; }
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 VidCamAdd::SlotNewCam() { VidCamera pCam; UUIDGenerator uuidCreator; astring strId = uuidCreator.createRandom().toString(); pCam.set_strid(strId); pCam.set_strname("New Camera"); pCam.set_strip("192.168.0.1"); pCam.set_strport("80"); pCam.set_struser("admin"); pCam.set_strpasswd("admin"); pCam.set_ntype(VID_ONVIF_S); pCam.set_stronvifaddress("/onvif/device_service"); pCam.set_bmotionjpeg(false); pCam.set_strrtspurl("rtsp://192.168.0.1:554/Streaming"); astring filePath = "camera.mp4"; pCam.set_strfile(filePath.c_str()); astring *pSched = pCam.add_crecsched(); *pSched = REC_SCHED_ALL_DAY; int insertRow = ui.tableWidget->rowCount(); ui.tableWidget->insertRow(insertRow); QTableWidgetItem *firstCheck = new VidCamTableItem(pCam, false); firstCheck->setCheckState(Qt::Checked); ui.tableWidget->setItem(insertRow, 0, firstCheck); ui.tableWidget->setItem(insertRow, 1, new QTableWidgetItem(pCam.strname().c_str())); ui.tableWidget->setItem(insertRow, 2, new QTableWidgetItem(pCam.strip().c_str())); ui.tableWidget->setItem(insertRow, 3, new QTableWidgetItem(pCam.struser().c_str())); ui.tableWidget->selectRow(insertRow); emit(SignalSectionClicked(insertRow, 0)); }
void VidCamAdd::SlotAddAll() { int insertRow = ui.tableSearch->rowCount(); VDC_DEBUG( "[ONVIF]: Searched %d", insertRow); StorSyncInf syncInf(m_sStor, 5 * 1000); VSCLoading loading(NULL); loading.show(); QDesktopWidget *desktop = QApplication::desktop(); QRect rect = desktop->screenGeometry(0); loading.setGeometry(rect.width()/2, rect.height()/2, 64, 64); QCoreApplication::processEvents(); if (syncInf.Connect() == false) { return; } /* Loop to add device */ for (int i = 0; i < insertRow; i ++) { if (ui.tableSearch->item(i, 0)->checkState() != Qt::Checked) { continue; } VidCamera pCam; UUIDGenerator uuidCreator; astring strId = uuidCreator.createRandom().toString(); pCam.set_strid(strId); pCam.set_strname(ui.tableSearch->item(i, 5)->text().toStdString()); pCam.set_strip(ui.tableSearch->item(i, 1)->text().toStdString()); pCam.set_strport(ui.tableSearch->item(i, 2)->text().toStdString()); pCam.set_struser(ui.tableSearch->item(i, 6)->text().toStdString()); pCam.set_strpasswd(ui.tableSearch->item(i, 7)->text().toStdString()); pCam.set_ntype(VID_ONVIF_S); pCam.set_stronvifaddress(ui.tableSearch->item(i, 4)->text().toStdString()); pCam.set_strrtspurl("/streamaddress"); astring filePath = "/camera.mp4"; pCam.set_strfile(filePath.c_str()); astring *pSched = pCam.add_crecsched(); *pSched = REC_SCHED_ALL_DAY; syncInf.AddCam(pCam); //m_pFactory.GetStorFactory().AddCam(m_sStor.strid(), pCam); } TreeWidgetUpdate(); }
void VidCamAdd::GetCamUI(VidCamera &pCam) { if (ui.radioButtonRtsp->isChecked() == true) { pCam.set_ntype(VID_RTSP); }else if (ui.radioButtonOnvif->isChecked() == true) { pCam.set_ntype(VID_ONVIF_S); }else if (ui.radioButtonFile->isChecked() == true) { pCam.set_ntype(VID_FILE); } pCam.set_stronvifaddress("/onvif/device_service"); pCam.set_strname(ui.lineEditName->text().toStdString()); pCam.set_strip(ui.lineEditIP->text().toStdString()); pCam.set_strport(ui.lineEditPort->text().toStdString()); pCam.set_struser(ui.lineEditUser->text().toStdString()); pCam.set_strpasswd(ui.lineEditPassword->text().toStdString()); pCam.set_strfile(ui.lineEditFile->text().toStdString()); pCam.set_strrtspurl(ui.lineEditRtspAddr->text().toStdString()); pCam.set_bmotionjpeg(ui.pbMotionJPEG->isChecked()); }
bool OAPIConverter::Converter(oapi::OAPICamera &from, VidCamera &to) { to.set_strid(from.strId); to.set_strname(from.strName); to.set_ntype((VidConf::CameraType)from.nType); to.set_strip(from.strIP); to.set_strport(from.strPort); to.set_struser(from.strUser); to.set_strpasswd(from.strPasswd); to.set_stronvifaddress(from.strONVIFAddress); to.set_bprofiletoken(from.bProfileToken); to.set_strprofiletoken1(from.strProfileToken1); to.set_strprofiletoken2(from.strProfileToken2); to.set_strfile(from.strFile); to.set_strrtspurl(from.strRTSPUrl); to.set_bhwaccel(from.bHWaccel); to.set_bservermotion(from.bServerMotion); to.set_nconnecttype((VidConf::CameraConnectType)from.nConnectType); return TRUE; }