Esempio n. 1
0
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));
}
Esempio n. 2
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();
}