コード例 #1
0
ファイル: storfactoryimpl.hpp プロジェクト: zzilla/opencvr
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;
}
コード例 #2
0
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()]);
		}
	}

}
コード例 #3
0
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;

}
コード例 #4
0
ファイル: vidcamadd.cpp プロジェクト: hau21um/opencvr
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()));
	}

}
コード例 #5
0
ファイル: oapisimpl.hpp プロジェクト: Strongc/opencvr
BOOL OAPIServer::ProcessGetDevice(s32 len)
{
	if (len == 0)
	{
		return FALSE;
	}
	char *pRecv = new char[len + 1];
	s32 nRetBody = m_pSocket->Recv((void *)pRecv, len);
	oapi::OAPICameraListReq req;
	if (nRetBody == len)
	{
		autojsoncxx::ParsingResult result;
		if (!autojsoncxx::from_json_string(pRecv, req, result)) 
		{
			std::cerr << result << '\n';
			delete [] pRecv;
			return FALSE;
		}
		
	}

	oapi::OAPICameraListRsp dataList;
	dataList.Num = 0;

	CameraOnlineMap pCameraOnlineMap;

	m_pFactory.GetCameraOnlineMap(pCameraOnlineMap);

	VidCameraList pCameraList;
	m_pFactory.GetCameraList(pCameraList);

	for (s32 i = 0; i < pCameraList.cvidcamera_size(); i ++)
	{
		const VidCamera &cam = pCameraList.cvidcamera(i);
		oapi::OAPICamera data;
		OAPIConverter::Converter((VidCamera &)cam, data);
		data.bOnline = pCameraOnlineMap[cam.strid()];
		dataList.list.push_back(data);
		dataList.Num ++;
	}

	//autojsoncxx::to_json_string

	std::string strJson = autojsoncxx::to_pretty_json_string(dataList);
	s32 nJsonLen = strJson.length();
	if (nJsonLen <= 0)
	{
		return FALSE;
	}
	OAPIHeader header;
	header.cmd = htonl(OAPI_CMD_DEVICE_LIST_RSP);
	header.length = htonl(nJsonLen + 1);

	m_pSocket->Send((void *)&header, sizeof(header));
	m_pSocket->Send((void *)strJson.c_str(), nJsonLen + 1);

	return TRUE;
}
コード例 #6
0
ファイル: factoryimpl.hpp プロジェクト: doksec/opencvr
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;
}