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)); }
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; }
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(); }