コード例 #1
0
ファイル: MediaMgr.cpp プロジェクト: eSDK/esdk_elte
//视频上墙
ELTE_INT32 CMediaMgr::VWallStart(const ELTE_CHAR* pResourceID, const ELTE_CHAR* pVideoParam) const
{
	LOG_TRACE();
	if(NULL == m_pUserMgr)
	{
		LOG_RUN_ERROR("UserMgr is null.");
		return eLTE_SDK_ERR_NULL_POINTER;
	}

	CXml reqXml;
	if(!reqXml.Parse(pVideoParam))
	{
		LOG_RUN_ERROR("ReqXml parse failed, param is %s.", pVideoParam);
		return eLTE_SDK_ERR_XML_PARSE;
	}

	if(!reqXml.FindElem("Content"))
	{
		LOG_RUN_ERROR("Find 'Content' failed, reqXml is %s.", pVideoParam);
		return eLTE_SDK_ERR_XML_FIND_ELEM;
	}

	(void)reqXml.IntoElem();
	(void)reqXml.AddElemBeforeCurNode("ResourceID");
	(void)reqXml.SetElemValue(pResourceID);

	ELTE_UINT32 xmlLen = 0;
	LOG_RUN_INFO("ReqXml is %s.", reqXml.GetXMLStream(xmlLen));

	//发送消息
	SSL_Socket& socket = const_cast<SSL_Socket&>(m_pUserMgr->GetSSLSocket());
	MutexLocker Locker(m_pUserMgr->GetMutexHandle());
	ELTE_INT32 iRet = socket.SendMsg(ELTE_SERVICE_VWALLSTART_REQ, reqXml, TRUE);
	if(eLTE_SDK_ERR_SUCCESS != iRet) 
	{
		return iRet;
	}

	iRet = m_pUserMgr->WaitObject(WAIT_OBJECT_TIME);
	if (eLTE_SDK_ERR_SUCCESS != iRet)
	{
		CServerMgr& serverMgr = const_cast<CServerMgr&>(m_pUserMgr->GetServerMgr());
		if(!serverMgr.ServerIsRunning() || 0 != m_pUserMgr->GetServerStatus())
		{
			m_pUserMgr->SetServerStatus(0);
			return eLTE_SDK_ERR_SERVER_NOT_RUNNING;
		}
		return iRet;
	}

	const PACKET_DATA& packetData = m_pUserMgr->GetPacketData();
	iRet = packetData.RspCode;
	::ResetEvent(m_pUserMgr->GetEventHandle());

	if (eLTE_SDK_ERR_SUCCESS != iRet)
	{
		LOG_RUN_ERROR("GetPacketData failed.");
	}
	return iRet;
}
コード例 #2
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
// 解析入参Mute_UL_parameter
eLTE_RET XMLProcess::XmlParseMuteULParameter(const std::string& xmlStr,	// 入参
		std::string& strCallType)			// 出参
{
	/************************************************************************
	--- XML 格式 ---
	<Content>
		<MuteParam>
			<CallType>"0"点呼,"1"组呼,"2"视频回传</CallType>
		</MuteParam>
	</Content>
	************************************************************************/ 
	
	LOG_TRACE();
	INFO_PARAM1(xmlStr);

	CXml xmlParse;
	if (!xmlParse.Parse(xmlStr.c_str()))
	{
		LOG_RUN_ERROR("parse xml failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlParse.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();
	if (!xmlParse.FindElem("MuteParam"))
	{
		LOG_RUN_ERROR("FindElem MuteParam failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();

	const unsigned int XML_VAR_LENGTH = 20;
	char elemValue[XML_VAR_LENGTH] = {0};
	const char* srcValue;
	unsigned int uiMaxLen = XML_VAR_LENGTH;

	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);	
	GET_XML_ELEM_VALUE_CHAR(xmlParse, "CallType", srcValue, elemValue, uiMaxLen);
	strCallType = elemValue;

	return eLTE_ERR_SUCCESS;
}
コード例 #3
0
//对XML中的设备编码拼装与编码
int CSDKMainctrl::ModifyDevCode(CXml& xml, IVS_CHAR* pData)const
{
	CHECK_POINTER(pData, IVS_OPERATE_MEMORY_ERROR);

	if (!xml.Parse(pData))
	{
		BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.Parse(pData)", "NA");
		//IVS_DELETE(pData, MUILI);
		return IVS_SMU_XML_INVALID;
	}
	if (!xml.FindElemEx("Content/Action"))
	{
		BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(Content/Action)", "NA");
		//IVS_DELETE(pData, MUILI);
		return IVS_SMU_XML_INVALID;		
	}
	// 若xml包含DevList,需要处理DevCode(拼接设备所在域编码DevDomainCode)
	if (xml.FindElem("DevList"))
	{
		xml.IntoElem();
		if (!xml.FindElem("DevInfo"))
		{
			BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(DevInfo)", "NA");
			//IVS_DELETE(pData, MUILI);
			return IVS_SMU_XML_INVALID;		
		}
		do 
		{
			(void)xml.IntoElem();
			// 找到设备所在域编码拼在DevCode后面
			if (!xml.FindElem("DevDomainCode"))
			{
				BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(DevCode)", "NA");
				//IVS_DELETE(pData, MUILI);
				return IVS_SMU_XML_INVALID;		
			}
			std::string strDevDomainCode;
            const IVS_CHAR* pDevDomainCode = xml.GetElemValue();
            if (NULL != pDevDomainCode)
            {
                strDevDomainCode = pDevDomainCode;
            }
			// 拼接设备所在域编码
			if (!xml.FindElem("DevCode"))
			{
				BP_RUN_LOG_ERR(IVS_SMU_XML_INVALID, "xml.FindElem(DevCode)", "NA");
				//IVS_DELETE(pData, MUILI);
				return IVS_SMU_XML_INVALID;		
			}
			std::string strDevCode;
            
            const IVS_CHAR* pDevCode = xml.GetElemValue();
            if (NULL != pDevCode)
            {
                strDevCode = pDevCode;
            }

			if (!strDevCode.empty())
			{
				strDevCode.append("#").append(strDevDomainCode);
				xml.ModifyElemValue(strDevCode.c_str());
			}
			xml.OutOfElem();
		} while (xml.NextElem());
		xml.OutOfElem();
	}
// 
// 	IVS_UINT32 uiXmlLen = 0;
// 	pDataXml = xml.GetXMLStream(uiXmlLen);
// 	CHECK_POINTER(pDataXml, IVS_OPERATE_MEMORY_ERROR);
	return IVS_SUCCEED;
}//lint !e818
コード例 #4
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
// 解析入参Video_UL_parameter
eLTE_RET XMLProcess::XmlParseVideoULParameter(const std::string& xmlStr,	// 入参
		std::string& strVideoFormat, std::string& strCameraType,			// 出参
		std::string& strUserConfirmType, std::string& strMuteType)			// 出参
{
	/************************************************************************
	--- XML 格式 ---
	<Content>
		<VideoParam>
			<VideoFormat>D1、CIF、QCIF、720P或1080P</VideoFormat>
			<CameraType>“0”表示前置,“1”表示后置。</CameraType>
			<UserConfirmType>“0”表示不需要用户确认,“1”表示需要用户确认。</UserConfirmType>
			<MuteType>“0”表示需要伴音;“1”表示不需要伴音</MuteType>
		</VideoParam>
	</Content>
	************************************************************************/ 
	
	LOG_TRACE();
	INFO_PARAM1(xmlStr);

	CXml xmlParse;
	if (!xmlParse.Parse(xmlStr.c_str()))
	{
		LOG_RUN_ERROR("parse xml failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlParse.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();
	if (!xmlParse.FindElem("VideoParam"))
	{
		LOG_RUN_ERROR("FindElem VideoParam failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();

	const unsigned int XML_VAR_LENGTH = 20;
	char elemValue[XML_VAR_LENGTH] = {0};
	const char* srcValue;
	unsigned int uiMaxLen = XML_VAR_LENGTH;

	GET_XML_ELEM_VALUE_CHAR(xmlParse, "VideoFormat", srcValue, elemValue, uiMaxLen);
	strVideoFormat = elemValue;

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);	
	GET_XML_ELEM_VALUE_CHAR(xmlParse, "CameraType", srcValue, elemValue, uiMaxLen);
	strCameraType = elemValue;

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);	
	GET_XML_ELEM_VALUE_CHAR(xmlParse, "UserConfirmType", srcValue, elemValue, uiMaxLen);
	strUserConfirmType = elemValue;

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);
	GET_XML_ELEM_VALUE_CHAR(xmlParse, "MuteType", srcValue, elemValue, uiMaxLen);
	strMuteType = elemValue;

	return eLTE_ERR_SUCCESS;
}
コード例 #5
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
eLTE_RET XMLProcess::ParseXmlStringEventNotifyP2pvideocallStatus(NotifyP2pvideocallStatusInfo& pInfo, const std::string& strXml)
{
	LOG_TRACE();
	INFO_PARAM1(strXml);

	CXml xmlParse;
	if (!xmlParse.Parse(strXml.c_str()))
	{
		LOG_RUN_ERROR("parse xml failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlParse.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();
	if (!xmlParse.FindElem("CallStatus"))
	{
		LOG_RUN_ERROR("FindElem CallStatus failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iCallStatus = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	if (!xmlParse.FindElem("Callee"))
	{
		LOG_RUN_ERROR("FindElem Callee failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iCallee = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	if (!xmlParse.FindElem("Caller"))
	{
		LOG_RUN_ERROR("FindElem Caller failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iCaller = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	if (!xmlParse.FindElem("LocalAudioPort"))
	{
		LOG_RUN_ERROR("FindElem LocalAudioPort failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iLocalAudioPort = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	if (!xmlParse.FindElem("LocalVideoPort"))
	{
		LOG_RUN_ERROR("FindElem LocalVideoPort failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iLocalVideoPort = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	if (!xmlParse.FindElem("RemoteAudioPort"))
	{
		LOG_RUN_ERROR("FindElem RemoteAudioPort failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iRemoteAudioPort = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	if (!xmlParse.FindElem("RemoteVideoPort"))
	{
		LOG_RUN_ERROR("FindElem RemoteVideoPort failed.");
		return eLTE_ERR_FAILED;
	}
	pInfo.iRemoteVideoPort = eLTE_Tool::String2Int(xmlParse.GetElemValue());

	return eLTE_ERR_SUCCESS;
}
コード例 #6
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
eLTE_RET XMLProcess::XmlParseGISSubscribeParameter(const std::string& xmlStr,     // 入参
	std::string& strSubType, std::string& strResourceList, std::string& strSubscriber)   // 出参
{
	/************************************************************************
	--- XML 格式 ---
	<Content>
		<GISParam>
			<SubType>7/8</SubType>
			<ResourceList>多个资源ID用分号分隔,最多200。例如1001;1002;1003</ResourceList>
			<Subscriber>目前可不填</Subscriber>
		</GISParam>
	</Content>
	************************************************************************/ 
	
	LOG_TRACE();
	INFO_PARAM1(xmlStr);

	CXml xmlParse;
	if (!xmlParse.Parse(xmlStr.c_str()))
	{
		LOG_RUN_ERROR("parse xml failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlParse.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();
	if (!xmlParse.FindElem("GISParam"))
	{
		LOG_RUN_ERROR("FindElem GISParam failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();

	const unsigned int XML_VAR_LENGTH = 20;
	char elemValue[XML_VAR_LENGTH] = {0};
	const char* srcValue;
	unsigned int uiMaxLen = XML_VAR_LENGTH;

	GET_XML_ELEM_VALUE_CHAR(xmlParse, "SubType", srcValue, elemValue, uiMaxLen);
	strSubType = elemValue;

	if (!xmlParse.FindElem("ResourceList"))													
	{																			
		LOG_RUN_ERROR("FindElem ResourceList failed.");								
		return eLTE_ERR_XML_FIND_ELEM;											
	}																			
	srcValue = xmlParse.GetElemValue();												
	if (NULL == srcValue)														
	{																			
		LOG_RUN_ERROR("GetElemValue ResourceList failed.");							
		return eLTE_ERR_XML_GET_ELEM_VALUE;										
	}
	strResourceList = srcValue;

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);	
	GET_XML_ELEM_VALUE_CHAR(xmlParse, "Subscriber", srcValue, elemValue, uiMaxLen);
	strSubscriber = elemValue;

	return eLTE_ERR_SUCCESS;
}
コード例 #7
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
eLTE_RET XMLProcess::SetXmlStringEventNotifySDSReport(const std::string& strSrc,
	CString& xmlStr)
{
	/************************************************************************
			--- XML 格式 ---
			<Content>
			<SdsType>消息类型</SdsType>
			<SdsContent>消息内容</SdsContent>
			<SdsFrom>发件人</SdsFrom>
			<SdsMmsFileNameList>
				<SdsMmsFileName>附件文件名列表</SdsMmsFileName>
				<SdsMmsFileName>附件文件名列表</SdsMmsFileName>
			</SdsMmsFileNameList>
			<SdsSubject>消息主题</SdsSubject>
			<SdsDate>消息发送日期</SdsDate>
			<SdsTime>消息发送时间</SdsTime>
			</Content>
	************************************************************************/
	LOG_TRACE();

	CXml xmlParse;

	if (!xmlParse.Parse(strSrc.c_str()))
	{
		LOG_RUN_ERROR("parse xml failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlParse.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlParse.IntoElem();
	if (!xmlParse.FindElem("SdsType"))
	{
		LOG_RUN_ERROR("FindElem CallStatus failed.");
		return eLTE_ERR_FAILED;
	}
	std::string strSdsType = xmlParse.GetElemValue();

	std::string strSdsContent = "";
	if(xmlParse.FindElem("SdsContent"))
	{
		strSdsContent = xmlParse.GetElemValue();
	}

	if (!xmlParse.FindElem("SdsFrom"))
	{
		LOG_RUN_ERROR("FindElem SdsFrom failed.");
		return eLTE_ERR_FAILED;
	}
	std::string strSdsFrom = xmlParse.GetElemValue();

	std::list<std::string> fileNameList;
	//彩信
	if (xmlParse.FindElem("SdsMmsFileNameList") && xmlParse.IntoElem())
	{
		do 
		{																		
			std::string srcValue = xmlParse.GetElemValue();
			if(!srcValue.empty())
			{
				fileNameList.push_back(srcValue);
			}
		} while (xmlParse.NextElem());
		xmlParse.OutOfElem();
	}

	if (!xmlParse.FindElem("SdsSubject"))
	{
		LOG_RUN_ERROR("FindElem SdsSubject failed.");
		return eLTE_ERR_FAILED;
	}
	std::string strSdsSubject = xmlParse.GetElemValue();


	if (!xmlParse.FindElem("SdsDate"))
	{
		LOG_RUN_ERROR("FindElem SdsDate failed.");
		return eLTE_ERR_FAILED;
	}
	std::string strSdsDate = xmlParse.GetElemValue();

	if (!xmlParse.FindElem("SdsTime"))
	{
		LOG_RUN_ERROR("FindElem SdsTime failed.");
		return eLTE_ERR_FAILED;
	}
	std::string strSdsTime = xmlParse.GetElemValue();


	//拼接xml
	xmlStr.Append(_T("<Content>"));

	xmlStr.Append(_T("<SdsType>"));
	xmlStr.Append(eLTE_Tool::ANSIToUnicode(strSdsType).c_str());
	xmlStr.Append(_T("</SdsType>"));

	if(!strSdsContent.empty())
	{
		xmlStr.Append(_T("<SdsContent>"));
		xmlStr.Append(eLTE_Tool::UTF8ToUnicode(strSdsContent).c_str());
		xmlStr.Append(_T("</SdsContent>"));
	}

	xmlStr.Append(_T("<SdsFrom>"));
	xmlStr.Append(eLTE_Tool::ANSIToUnicode(strSdsFrom).c_str());
	xmlStr.Append(_T("</SdsFrom>"));

	if(0 < fileNameList.size())
	{
		xmlStr.Append(_T("<SdsMmsFileNameList>"));
		std::list<std::string>::iterator it = fileNameList.begin();

		for (; it != fileNameList.end(); ++it)
		{
			xmlStr.Append(_T("<SdsMmsFileName>"));
			xmlStr.Append(eLTE_Tool::UTF8ToUnicode(*it).c_str());
			xmlStr.Append(_T("</SdsMmsFileName>"));
		}

		xmlStr.Append(_T("</SdsMmsFileNameList>"));
	}

	xmlStr.Append(_T("<SdsSubject>"));
	xmlStr.Append(eLTE_Tool::UTF8ToUnicode(strSdsSubject).c_str());
	xmlStr.Append(_T("</SdsSubject>"));

	
	xmlStr.Append(_T("<SdsDirection>"));
	xmlStr.Append(_T("false"));
	xmlStr.Append(_T("</SdsDirection>"));

	xmlStr.Append(_T("<SdsDate>"));
	xmlStr.Append(eLTE_Tool::ANSIToUnicode(strSdsDate).c_str());
	xmlStr.Append(_T("</SdsDate>"));

	xmlStr.Append(_T("<SdsTime>"));
	xmlStr.Append(eLTE_Tool::ANSIToUnicode(strSdsTime).c_str());
	xmlStr.Append(_T("</SdsTime>"));
	xmlStr.Append(_T("</Content>"));

	return eLTE_ERR_SUCCESS;
}
コード例 #8
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
// 解析入参视频播放参数
eLTE_RET XMLProcess::XmlParsePlayVideoParam(const std::string& xmlStrLocal, const std::string& xmlStrRemote,	// 入参
		std::string& strLocalIP, unsigned int& uiLocalVideoPort, unsigned int& uiLocalAudioPort,				// 出参
		std::string& strRemoteIP, unsigned int& uiRemoteVideoPort, unsigned int& uiRemoteAudioPort)				// 出参
{
	/************************************************************************
	--- XML 格式 ---
	<Content>
		<LocalMediaAddr>
			<LocalIP></LocalIP>
			<VideoPort></VideoPort>
			<AudioPort></AudioPort>
		</LocalMediaAddr>
	</Content>
	<Content>
		<RemoteMediaAddr>
			<RemoteIP></RemoteIP>
			<VideoPort></VideoPort>
			<AudioPort></AudioPort>
		</RemoteMediaAddr>
	</Content>
	************************************************************************/ 
	
	LOG_TRACE();
	INFO_PARAM2(xmlStrLocal, xmlStrRemote);

	// 解析本地视频参数
	CXml xmlLocal;
	if (!xmlLocal.Parse(xmlStrLocal.c_str()))
	{
		LOG_RUN_ERROR("parse xmlStrLocal failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlLocal.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlLocal.IntoElem();
	if (!xmlLocal.FindElem("LocalMediaAddr"))
	{
		LOG_RUN_ERROR("FindElem LocalMediaAddr failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlLocal.IntoElem();

	const unsigned int XML_VAR_LENGTH = 20;
	char elemValue[XML_VAR_LENGTH] = {0};
	const char* srcValue;
	unsigned int uiMaxLen = XML_VAR_LENGTH;

	GET_XML_ELEM_VALUE_CHAR(xmlLocal, "LocalIP", srcValue, elemValue, uiMaxLen);
	strLocalIP = elemValue;

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);
	GET_XML_ELEM_VALUE_CHAR(xmlLocal, "VideoPort", srcValue, elemValue, uiMaxLen);
	uiLocalVideoPort = eLTE_Tool::String2UInt(elemValue);

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);
	GET_XML_ELEM_VALUE_CHAR(xmlLocal, "AudioPort", srcValue, elemValue, uiMaxLen);
	uiLocalAudioPort = eLTE_Tool::String2UInt(elemValue);

	// 解析远端视频参数
	CXml xmlRemote;
	if (!xmlRemote.Parse(xmlStrRemote.c_str()))
	{
		LOG_RUN_ERROR("parse xmlStrRemote failed.");
		return eLTE_ERR_FAILED;
	}
	if (!xmlRemote.FindElem("Content"))
	{
		LOG_RUN_ERROR("FindElem Content failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlRemote.IntoElem();
	if (!xmlRemote.FindElem("RemoteMediaAddr"))
	{
		LOG_RUN_ERROR("FindElem RemoteMediaAddr failed.");
		return eLTE_ERR_FAILED;
	}
	(void)xmlRemote.IntoElem();

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);
	GET_XML_ELEM_VALUE_CHAR(xmlRemote, "RemoteIP", srcValue, elemValue, uiMaxLen);
	strRemoteIP = elemValue;

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);
	GET_XML_ELEM_VALUE_CHAR(xmlRemote, "VideoPort", srcValue, elemValue, uiMaxLen);
	uiRemoteVideoPort = eLTE_Tool::String2UInt(elemValue);

	uiMaxLen = XML_VAR_LENGTH;
	memset(elemValue, 0, sizeof(char)*XML_VAR_LENGTH);
	GET_XML_ELEM_VALUE_CHAR(xmlRemote, "AudioPort", srcValue, elemValue, uiMaxLen);
	uiRemoteAudioPort = eLTE_Tool::String2UInt(elemValue);

	return eLTE_ERR_SUCCESS;
}
コード例 #9
0
// 解析画图前图形属性设置XML
IVS_INT32 COCXDrawXMLProcess::DrawGraphicsPraseXML(IA_GRAPHICS &GraphicAttribute, ULONG &ulGroupDrawMaxNum, LPCTSTR pGraphicsXml)
{
	CHECK_POINTER(pGraphicsXml, IVS_OPERATE_MEMORY_ERROR);
	IVS_DEBUG_TRACE("GroupDrawMaxNum: %lu, GraphicsXml: %s", ulGroupDrawMaxNum, pGraphicsXml);

	CXml xml;
	if (!xml.Parse(pGraphicsXml))
	{
		return IVS_FAIL;
	}

	CHECK_SUCCESS(xml.FindElem("Content"));
	CHECK_SUCCESS(xml.IntoElem());
	CHECK_SUCCESS(xml.FindElem("Graphics"));
	CHECK_SUCCESS(xml.IntoElem());

	const char *value = NULL;

	CHECK_SUCCESS(xml.FindElem("GraphicNum") && (NULL != (value = xml.GetElemValue())));
	ulGroupDrawMaxNum = (ULONG)atoi(value);

	// 若设置的图形数大于图形数组长度,截断到最大画图个数
	if (ulGroupDrawMaxNum > GRAPHICS_NUM_MAX)
	{
		BP_RUN_LOG_INF("COCXDrawXMLProcess::DrawGraphicsPraseXML", "GroupDrawMaxNum Truncated to GRAPHICS_NUM_MAX");
		ulGroupDrawMaxNum = GRAPHICS_NUM_MAX;
	}

	CHECK_SUCCESS(xml.FindElem("GraphicList"));
	CHECK_SUCCESS(xml.IntoElem());

	// 给图形可选字段赋默认值
	memset(&GraphicAttribute, 0, sizeof(IA_GRAPHICS));
	GraphicAttribute.ulLineWidth = 3; // 默认基本线宽为3
	GraphicAttribute.bAllowDelete = TRUE; // 允许删除
	GraphicAttribute.bAllowModifySize = TRUE; // 允许修改矩形大小

	CHECK_SUCCESS(xml.FindElem("GraphicInfo"));
	CHECK_SUCCESS(xml.IntoElem());
	CHECK_SUCCESS(xml.FindElem("GraphicType") && (NULL != (value = xml.GetElemValue())));
	GraphicAttribute.ulGraphicType = (ULONG)atoi(value);

	GET_ELEMENT_ULONG(GraphicAttribute.ulGraphicGroup, GraphicGroup, xml);
	GET_ELEMENT_STRING(GraphicAttribute.GraphicGroupName, CHARACTER_NUM_MAX, GraphicGroupName, xml);

	if (xml.FindElem("GraphicBackgroundColor"))
	{
		CHECK_SUCCESS(xml.IntoElem());
		GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Alpha, Opacity, xml);
		GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Red, Red, xml);
		GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Green, Green, xml);
		GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Blue, Blue, xml);
		xml.OutOfElem();
	}

	if (xml.FindElem("GraphicLineColor"))
	{
		CHECK_SUCCESS(xml.IntoElem());
		GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Alpha, Opacity, xml);
		GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Red, Red, xml);
		GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Green, Green, xml);
		GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Blue, Blue, xml);
		xml.OutOfElem();
	}

	GET_ELEMENT_ULONG(GraphicAttribute.ulLineWidth, GraphicLineWidth, xml);

	GET_ELEMENT_ULONG(GraphicAttribute.NamePosition, NamePosition, xml);
	GET_ELEMENT_BOOL(GraphicAttribute.bAllowDelete, DeleteByMouse, xml);
	GET_ELEMENT_BOOL(GraphicAttribute.bAllowAddNewPoint, AddNewPoint, xml);
	GET_ELEMENT_BOOL(GraphicAttribute.bAllowModifySize, AllowModifySize, xml);
	GET_ELEMENT_ULONG(GraphicAttribute.ulArrowType, ArrowType, xml);
	GET_ELEMENT_BOOL(GraphicAttribute.bKeepHorizon, KeepHorizon, xml);

	xml.OutOfElem();
	xml.OutOfElem();
	xml.OutOfElem();

	return IVS_SUCCEED;

}
コード例 #10
0
// 解析设置图形的XML
IVS_INT32 COCXDrawXMLProcess::SetGraphicsPraseXML(IA_GRAPHICS *pGraphicsArr, ULONG &ulNum, LPCTSTR pGraphicsXml, const SIZE &szGraphic, BOOL bPersent)
{
	CHECK_POINTER(pGraphicsArr, IVS_FAIL);
	CHECK_POINTER(pGraphicsXml, IVS_OPERATE_MEMORY_ERROR);

	IVS_DEBUG_TRACE("GraphicsXml: %s, GraphicWidth: %d, GraphicHeight: %d",pGraphicsXml, szGraphic.cx, szGraphic.cy);

	CXml xml;
	if (!xml.Parse(pGraphicsXml))
	{
		return IVS_FAIL;
	}

	CHECK_SUCCESS(xml.FindElem("Content"));
	CHECK_SUCCESS(xml.IntoElem());
	CHECK_SUCCESS(xml.FindElem("Graphics"));
	CHECK_SUCCESS(xml.IntoElem());

	const char *value = NULL;

	CHECK_SUCCESS(xml.FindElem("GraphicNum") && (NULL != (value = xml.GetElemValue())));
	ulNum = (ULONG)atoi(value);

	// 若设置的图形数大于图形数组长度,截断到最大画图个数
	if (ulNum > GRAPHICS_NUM_MAX)
	{
		BP_RUN_LOG_INF("COCXDrawXMLProcess::SetGraphicsPraseXML", "GraphicNum Truncated to GRAPHICS_NUM_MAX");
		ulNum = GRAPHICS_NUM_MAX;
	}

	CHECK_SUCCESS(xml.FindElem("GraphicList"));
	CHECK_SUCCESS(xml.IntoElem());

	for (ULONG i = 0; i < ulNum; i++)
	{
		// 给图形可选字段赋默认值
		memset(&pGraphicsArr[i], 0, sizeof(IA_GRAPHICS));
		pGraphicsArr[i].ulLineWidth = 3; // 默认基本线宽为3
		pGraphicsArr[i].bAllowDelete = TRUE; // 允许删除
		pGraphicsArr[i].bAllowModifySize = TRUE; // 允许修改矩形大小

		if (0 == i)
		{
			CHECK_SUCCESS(xml.FindElem("GraphicInfo"));
		} else {
			CHECK_SUCCESS(xml.NextElem());
		}
		CHECK_SUCCESS(xml.IntoElem());
		CHECK_SUCCESS(xml.FindElem("GraphicType") && (NULL != (value = xml.GetElemValue())));
		pGraphicsArr[i].ulGraphicType = (ULONG)atoi(value);

		GET_ELEMENT_ULONG(pGraphicsArr[i].ulGraphicGroup, GraphicGroup, xml);
		GET_ELEMENT_STRING(pGraphicsArr[i].GraphicGroupName, CHARACTER_NUM_MAX, GraphicGroupName, xml);

		if (xml.FindElem("GraphicBackgroundColor"))
		{
			CHECK_SUCCESS(xml.IntoElem());
			GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Alpha, Opacity, xml);
			GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Red, Red, xml);
			GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Green, Green, xml);
			GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Blue, Blue, xml);
			xml.OutOfElem();
		}

		if (xml.FindElem("GraphicLineColor"))
		{
			CHECK_SUCCESS(xml.IntoElem());
			GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Alpha, Opacity, xml);
			GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Red, Red, xml);
			GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Green, Green, xml);
			GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Blue, Blue, xml);
			xml.OutOfElem();
		}

		GET_ELEMENT_ULONG(pGraphicsArr[i].ulLineWidth, GraphicLineWidth, xml);

		CHECK_SUCCESS(xml.FindElem("PointNum") && (NULL != (value = xml.GetElemValue())));
		pGraphicsArr[i].ulPointsNum = (ULONG)atoi(value);

		CHECK_SUCCESS(xml.FindElem("PointList"));
		CHECK_SUCCESS(xml.IntoElem());

		for (ULONG j = 0; j < pGraphicsArr[i].ulPointsNum; j++)
		{
			if (0 == j)
			{
				CHECK_SUCCESS(xml.FindElem("Point"));
			} else {
				CHECK_SUCCESS(xml.NextElem());
			}
			CHECK_SUCCESS(xml.IntoElem());

			if ((0 == szGraphic.cx) || (0 == szGraphic.cy))
			{
				if (bPersent)
				{
					CHECK_SUCCESS(xml.FindElem("X") && (NULL != (value = xml.GetElemValue())));
					pGraphicsArr[i].IAPoints[j].x = (LONG)(atof(value) * FLOAT_TO_LONG_COEFF);
					CHECK_SUCCESS(xml.FindElem("Y") && (NULL != (value = xml.GetElemValue())));
					pGraphicsArr[i].IAPoints[j].y = (LONG)(atof(value) * FLOAT_TO_LONG_COEFF);
				} else {
					CHECK_SUCCESS(xml.FindElem("X") && (NULL != (value = xml.GetElemValue())));
					pGraphicsArr[i].IAPoints[j].x = (LONG)atoi(value);
					CHECK_SUCCESS(xml.FindElem("Y") && (NULL != (value = xml.GetElemValue())));
					pGraphicsArr[i].IAPoints[j].y = (LONG)atoi(value);
				}
			}
			else
			{
				CHECK_SUCCESS(xml.FindElem("X") && (NULL != (value = xml.GetElemValue())));
				pGraphicsArr[i].IAPoints[j].x = (LONG)(atof(value) * szGraphic.cx + 0.5);
				CHECK_SUCCESS(xml.FindElem("Y") && (NULL != (value = xml.GetElemValue())));
				pGraphicsArr[i].IAPoints[j].y = (LONG)(atof(value) * szGraphic.cy + 0.5);
			}

			xml.OutOfElem();
		}
		xml.OutOfElem();

		GET_ELEMENT_ULONG(pGraphicsArr[i].NamePosition, NamePosition, xml);
		GET_ELEMENT_BOOL(pGraphicsArr[i].bAllowDelete, DeleteByMouse, xml);
		GET_ELEMENT_BOOL(pGraphicsArr[i].bAllowAddNewPoint, AddNewPoint, xml);
		GET_ELEMENT_BOOL(pGraphicsArr[i].bAllowModifySize, AllowModifySize, xml);
		GET_ELEMENT_ULONG(pGraphicsArr[i].ulArrowType, ArrowType, xml);
		GET_ELEMENT_BOOL(pGraphicsArr[i].bKeepHorizon, KeepHorizon, xml);

		xml.OutOfElem();
	}
	xml.OutOfElem();
	xml.OutOfElem();

	return IVS_SUCCEED;
}
コード例 #11
0
// 解析本地抓拍参数客户端配置xml
IVS_INT32 OCXCapturePictureXMLProcess::LocalCaptureParseClientConfig(LPCTSTR pXmlStr, IVS_LOCAL_CAPTURE_PARAM &LocalCaptuParam)
{
	IVS_DEBUG_TRACE("Local Capture Config %s", pXmlStr);
	(void)CToolsHelp::Strncpy(LocalCaptuParam.cCapturePath, sizeof(LocalCaptuParam.cCapturePath) - 1, CAPTURE_DEFAULT_PATH, sizeof(CAPTURE_DEFAULT_PATH));  
	LocalCaptuParam.uiSnapshotMode = CAPTURE_DEFAULT_MODE;
	LocalCaptuParam.uiSnapshotCount = CAPTURE_DEFAULT_COUNT;			
	LocalCaptuParam.uiSnapshotInterval = CAPTURE_DEFAULT_INTERVAL;		
	LocalCaptuParam.uiSnapshotFormat = CAPTURE_DEFAULT_FORMAT;		
	LocalCaptuParam.uiNameRule = CAPTURE_DEFAULT_NAME_RULE;		
	if (NULL == pXmlStr || '\0' == pXmlStr[0])
	{
		return IVS_PARA_INVALID;
	}

	CXml xml;
	if (!xml.Parse(pXmlStr))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID, "Local Capture Parse Client Config", "parse xml error, use default");
		return IVS_FAIL;
	}

	if (!xml.FindElemEx("CaptureConfig"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Local Capture Parse Client Config fail", "no 'CaptureConfig' elemenet");
		return IVS_XML_INVALID;
	}
	xml.IntoElem();

	const char *value = NULL;
	bool  bSuccess = true;
	bool  bRet = false;

	bSuccess = (xml.FindElem("CapturePath")) && (NULL != (value = xml.GetElemValue()));
	if (bSuccess)
	{
		bRet = CToolsHelp::Strncpy(LocalCaptuParam.cCapturePath, sizeof(LocalCaptuParam.cCapturePath) - 1, value, strlen(value));  
	} else {
		bRet = CToolsHelp::Strncpy(LocalCaptuParam.cCapturePath, sizeof(LocalCaptuParam.cCapturePath) - 1, CAPTURE_DEFAULT_PATH, sizeof(CAPTURE_DEFAULT_PATH));
	}
	if(false == bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Local Capture Parse Client Config", "Strncpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	bSuccess = (xml.FindElem("SnapshotMode")) && (NULL != (value = xml.GetElemValue()));
	LocalCaptuParam.uiSnapshotMode = bSuccess ? atoi(value) : CAPTURE_DEFAULT_MODE;

	bSuccess = (xml.FindElem("SnapshotCount")) &&(NULL != (value = xml.GetElemValue()));
	LocalCaptuParam.uiSnapshotCount = bSuccess ? (IVS_UINT32)atoi(value) : CAPTURE_DEFAULT_COUNT;

	bSuccess = (xml.FindElem("SnapshotInterval")) &&(NULL != (value = xml.GetElemValue()));
	LocalCaptuParam.uiSnapshotInterval = bSuccess ? (IVS_UINT32)atoi(value) : CAPTURE_DEFAULT_INTERVAL;
	
	bSuccess = (xml.FindElem("SnapshotFormat")) &&(NULL != (value = xml.GetElemValue()));
	LocalCaptuParam.uiSnapshotFormat = bSuccess ? atoi(value) : CAPTURE_DEFAULT_FORMAT;
	
	bSuccess = (xml.FindElem("NameRule")) && (NULL != (value = xml.GetElemValue()));
	LocalCaptuParam.uiNameRule = bSuccess ? atoi(value) : CAPTURE_DEFAULT_NAME_RULE;

	return IVS_SUCCEED;
}
コード例 #12
0
//设置平台抓拍计划:将请求XML转换为结构体
IVS_INT32 OCXCapturePictureXMLProcess::SetSnapshotPlanGetXML(IVS_CHAR* pCameraCode,IVS_SNAPSHOT_PLAN* pSnapShotPlan, CXml &xml)
{ 
	CHECK_POINTER(pCameraCode,IVS_PARA_INVALID);
	CHECK_POINTER(pSnapShotPlan,IVS_PARA_INVALID);
	IVS_DEBUG_TRACE("");
	if (!xml.FindElemEx("Content/SnapshotPlanInfo"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Set Snapshot Plan Get XML", "fail", "no 'SnapshotPlanInfo' elemenet");
		return IVS_XML_INVALID;
	}      
	(void)xml.IntoElem();
	const char* szElemValue = NULL;

	// 摄像机编码
	if (!xml.FindElem("CameraCode"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Set Snapshot Plan Get XML", "faill", "no 'CameraCode' elemenet");
		return IVS_XML_INVALID;
	}
	GET_ELEM_VALUE_CHAR("CameraCode",szElemValue,pCameraCode,IVS_DEV_CODE_LEN,xml);
	// 是否启用 
	if (!xml.FindElem("IsEnable"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Set Snapshot Plan Get XML", "faill", "no 'IsEnable' elemenet");
		return IVS_XML_INVALID;
	}
	const IVS_CHAR* cpszIsEnable = xml.GetElemValue();
	if (NULL == cpszIsEnable)
	{
		return IVS_XML_INVALID;
	}
	pSnapShotPlan->bEnable = static_cast<IVS_BOOL>(atoi(cpszIsEnable));

	// 计划方式(周计划 日计划 全程录像)
	if (!xml.FindElem("PlanType"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Set Snapshot Plan Get XML", "faill", "no 'PlanType' elemenet");
		return IVS_XML_INVALID;
	}
	GET_ELEM_VALUE_NUM_FOR_UINT("PlanType",szElemValue,pSnapShotPlan->uiPlanType,xml);

	IVS_UINT32 iPlanInfoNum = 0;
	IVS_INT32 iTimeInfoNum = 0;
	if (xml.FindElemEx("Content/SnapshotPlanInfo/PlanList"))
	{
		do 
		{
			(void)xml.IntoElem();
			//解析PlanInfo
			(void)xml.IntoElem();
			memset(&pSnapShotPlan->stPlanInfo[iPlanInfoNum],0, sizeof(IVS_SNAPSHOT_PLAN_INFO));
			GET_ELEM_VALUE_NUM_FOR_UINT("DayType",szElemValue,pSnapShotPlan->stPlanInfo[iPlanInfoNum].uiDayType,xml);

			if (xml.FindElem("TimeList"))
			{
				xml.IntoElem();
			}
			if(xml.FindElem("TimeInfo"))
			{
				do{ 
					(void)xml.IntoElem();
					GET_ELEM_VALUE_CHAR("StartTime",szElemValue,  pSnapShotPlan->stPlanInfo[iPlanInfoNum].stTimeSpanInfo[iTimeInfoNum].cStart,IVS_TIME_LEN,xml);
					GET_ELEM_VALUE_CHAR("EndTime",szElemValue,  pSnapShotPlan->stPlanInfo[iPlanInfoNum].stTimeSpanInfo[iTimeInfoNum].cEnd,IVS_TIME_LEN,xml);
					GET_ELEM_VALUE_NUM_FOR_UINT("SnapInterval",szElemValue,pSnapShotPlan->stPlanInfo[iPlanInfoNum].stTimeSpanInfo[iTimeInfoNum].SnapInterval,xml);
					iTimeInfoNum++;
					xml.OutOfElem();
				}while(xml.NextElem());
			}
			pSnapShotPlan->stPlanInfo[iPlanInfoNum].uiTimeSpanInfoNum = static_cast<IVS_UINT32>(iTimeInfoNum);
			xml.OutOfElem();
			xml.OutOfElem();
			iPlanInfoNum++;
			iTimeInfoNum = 0;
		} while(xml.NextElem());
	}
	pSnapShotPlan->uiPlanInfoNum = iPlanInfoNum;
	xml.OutOfElem();

	return IVS_SUCCEED;
}
コード例 #13
0
IVS_INT32 CDomainRouteMgr::GetShareCatalogList(const IVS_CHAR* pQueryInfo, IVS_CHAR** pRspXml)
{
    CHECK_POINTER(m_pUserMgr, IVS_OPERATE_MEMORY_ERROR);
	if (NULL == pQueryInfo)
	{
		BP_RUN_LOG_ERR(IVS_FAIL, "Get Share Cata log List", "Query Info is NULL");
		return IVS_FAIL;
	}
    // 获取本域SMU连接
    std::string strSMULinkID;
    IVS_INT32 iGetLinkRet = m_pUserMgr->GetLocalDomainLinkID(NET_ELE_SMU_NSS, strSMULinkID);
    if (IVS_SUCCEED != iGetLinkRet)
    {
        BP_RUN_LOG_ERR(iGetLinkRet, "Get LocalDomainLinkID failed", "NA");
        return iGetLinkRet;
    }
	CCmd* pCmd = CNSSOperator::instance().BuildSMUCmd(NSS_GET_SHARE_CATALOG_LIST_REQ, pQueryInfo, strSMULinkID);
	CHECK_POINTER(pCmd, IVS_OPERATE_MEMORY_ERROR);
	//发送消息
	IVS_INT32 iRet = IVS_FAIL;
	CCmd *pCmdRsp = CNSSOperator::instance().SendSyncCmd(pCmd);
	CHECK_POINTER(pCmdRsp, IVS_NET_RECV_TIMEOUT);
	const char* pBefore =  CNSSOperator::instance().ParseCmd2XML(pCmdRsp, iRet);
	if (IVS_SUCCEED != iRet || NULL == pBefore)
	{
		HW_DELETE(pCmdRsp);
		BP_RUN_LOG_ERR(iRet, "Share Cata log list", "XML illegal ");
		return iRet;
	}
	HW_DELETE(pCmdRsp);
	std::string strBefore = pBefore;
	IVS_DELETE(pBefore, MUILI);
	//std::string strBefore("<Content><ShareDevList><ShareDevInfo><OriginDevCode>123456</OriginDevCode><OriginDomainCode>0123456789</OriginDomainCode><LocalDevCode>0123#001</LocalDevCode></ShareDevInfo></ShareDevList></Content>");
	//std::string strBefore("<OriginDevCode>00000010000000000301</OriginDevCode><OriginDomainCode>001</OriginDomainCode><Latitude>0</Latitude><OriginDevCode>00000010000000000201#001</OriginDevCode><OriginDomainCode>001</OriginDomainCode><LocalDevCode /><Latitude>0</Latitude><OriginDevCode>00000010000000000101#001</OriginDevCode><OriginDomainCode>001</OriginDomainCode><OriginDevCode>1</OriginDevCode><OriginDomainCode /><LocalDevCode />");
	std::string strAfter;
	iRet = ComplicationDevDomainCode(strBefore,strAfter);

	CXml xml;
	std::string strDomainCode;
	m_pUserMgr->GetDomainCode(strDomainCode);
	std::string strLocalDevCode;
	if (!xml.Parse(strAfter.c_str()))
	{
		BP_RUN_LOG_ERR(IVS_OPERATE_MEMORY_ERROR, "xml.Parse(strAfter) fail", "NA");
		return IVS_OPERATE_MEMORY_ERROR;
	}
	if (!xml.FindElemEx("Content/ShareDevList"))
	{
		BP_RUN_LOG_ERR(IVS_SMU_DEV_REQ_XML_INVALID, "xml.FindElemEx(Content/ShareDevList) fail", "NA");
		return IVS_SMU_DEV_REQ_XML_INVALID;
	}
	if (!xml.FindElem("ShareDevInfo"))
	{
		IVS_UINT32 uiXmlLen = 0;
		const IVS_CHAR* pRsp = xml.GetXMLStream(uiXmlLen);
        if (NULL == pRsp)
        {
            return IVS_SMU_DEV_REQ_XML_INVALID;
        }

		IVS_CHAR *cTmp = IVS_NEW(cTmp,strlen(pRsp) + 1);
		if (NULL == cTmp)
		{
			return IVS_ALLOC_MEMORY_ERROR;
		}
		memset(cTmp, 0, strlen(pRsp) + 1);
		memcpy(cTmp, pRsp, strlen(pRsp));
		*pRspXml = cTmp;
		return IVS_SUCCEED;
	}
	do 
	{
		(void)xml.IntoElem();
		if (!xml.FindElem("LocalDevCode"))
		{
			BP_RUN_LOG_ERR(IVS_SMU_DEV_REQ_XML_INVALID, "xml.FindElem(LocalDevCode) fail", "NA");
			return IVS_SMU_DEV_REQ_XML_INVALID;
		}
        const IVS_CHAR* pLocalDevCode =  xml.GetElemValue();
        if (NULL != pLocalDevCode)
        {
            strLocalDevCode = pLocalDevCode;
        }

		if (0 != strcmp(strLocalDevCode.c_str(), ""))
		{
			strLocalDevCode.append("#");
			strLocalDevCode.append(strDomainCode);
			xml.ModifyElemValue(strLocalDevCode.c_str());
		}
		xml.OutOfElem();
	} while (xml.NextElem());

	IVS_UINT32 uiLen = 0;
	const IVS_CHAR* pRsq = xml.GetXMLStream(uiLen);

    if (NULL == pRsq)
    {
        return IVS_SMU_DEV_REQ_XML_INVALID;
    }

	IVS_CHAR *cTmp = IVS_NEW(cTmp,strlen(pRsq) + 1);
	if (NULL == cTmp)
	{
		return IVS_ALLOC_MEMORY_ERROR;
	}
	memset(cTmp, 0, strlen(pRsq) + 1);
	memcpy(cTmp, pRsq, strlen(pRsq));
	*pRspXml = cTmp;

	return iRet;
}//lint !e1762
コード例 #14
0
// 解析域路由到List
IVS_INT32 CDomainRouteMgr::GetDomainRouteToListParseXML(DOMAIN_CODE_LIST& stCodeInfoList, CXml &xmlRsp)
{
    BP_RUN_LOG_INF("Parse XML to List", "Enter");

    if (!xmlRsp.FindElemEx("Content/DomainRoutes"))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Parse XML to List",
                       "no 'Content/DomainRoutes' elemenet");
        return IVS_XML_INVALID;
    }

    if (!xmlRsp.FindElem("DomainRoute"))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Parse XML to List",
                       "no 'DevInfo' elemenet");
        return IVS_XML_INVALID;
    }

    const IVS_CHAR *pSzElement = NULL;
    IVS_UINT32 uiSTLen = sizeof(IVS_DOMAIN_ROUTE);
    const int tempLength = 10;
    IVS_CHAR tempChar[tempLength]={0};
    do
    {
        if (!xmlRsp.FindElemValue("DomainRoute"))
        {
            break;
        }

        xmlRsp.IntoElem();

        IVS_DOMAIN_ROUTE *pDomain_route = IVS_NEW(pDomain_route);

        if (NULL == pDomain_route)
        {
            return IVS_FAIL;
        }

        memset(pDomain_route, 0, uiSTLen);

        //域编码
        GET_ELEM_VALUE_CHAR("DomainCode", pSzElement, pDomain_route->cDomainCode, IVS_DOMAIN_CODE_LEN, xmlRsp);

        //域名称
        GET_ELEM_VALUE_CHAR("DomainName", pSzElement, pDomain_route->cDomainName, IVS_NAME_LEN, xmlRsp);

        //域IP
        GET_ELEM_VALUE_CHAR("DomainIP", pSzElement, pDomain_route->stIP.cIP, IVS_IP_LEN, xmlRsp);

        //域端口
        //GET_ELEM_VALUE_NUM_FOR_UINT("DomainPort", pSzElement, pDomain_route->uiPort, xmlRsp);

        //域模式
        GET_ELEM_VALUE_NUM_FOR_UINT("DomainType", pSzElement, pDomain_route->uiDomainType, xmlRsp);

        //是否代理
        GET_ELEM_VALUE_NUM("IsProxy", pSzElement, pDomain_route->bIsAgent, xmlRsp);

        //代理网段
        //GET_ELEM_VALUE_NUM("ProxySegment", pSzElement, stDomainRoute.bIsAgent, xmlRsp);

        //上级域编码
        GET_ELEM_VALUE_CHAR("SuperDomain", pSzElement, pDomain_route->cSuperDomain, IVS_DOMAIN_CODE_LEN, xmlRsp);

        GET_ELEM_VALUE_CHAR("IsOnline", pSzElement, tempChar, sizeof(tempChar) - 1, xmlRsp);

        pDomain_route->uiStatus = CDevEnum::GetDevStatusEnum(tempChar);

        //是否本域
        GET_ELEM_VALUE_NUM("IsLocalDomain", pSzElement, pDomain_route->bIsLocalDomain, xmlRsp);


        pDomain_route->uiPort = DEFAULT_SMU_PORT;
        
        stCodeInfoList.push_back(pDomain_route);
        xmlRsp.OutOfElem();
    } while (xmlRsp.NextElem());

    BP_RUN_LOG_INF("Parse XML to List", "Leave");
    return IVS_SUCCEED;
} //lint !e1762
コード例 #15
0
IVS_INT32 CMediaXMLProcess::GetURLResponseData(CXml &xmlRsp, ST_MEDIA_RSP& stMediaRsp, bool& bAssociatedAudio)
{
	IVS_DEBUG_TRACE("");

	memset(&stMediaRsp, 0, sizeof(ST_MEDIA_RSP));
	const char*AttriValue = NULL;   //临时存储单个节点值
	bool bRet = false;

	CHECK_SUCCESS(xmlRsp.FindElem("Content"));
	CHECK_SUCCESS(xmlRsp.IntoElem());


	CHECK_SUCCESS(xmlRsp.FindElem("URL"));
	CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue()));
	bRet = CToolsHelp::Memcpy(stMediaRsp.szURL, URL_LEN, AttriValue, strlen(AttriValue));
	if(!bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	if (xmlRsp.FindElem("AssociatedAudio"))
	{
		CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue()));
		bAssociatedAudio = (bool)atoi(AttriValue);	
	}

	CHECK_SUCCESS(xmlRsp.FindElem("RtspIP"));
	CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue()));
	bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPIP, IVS_IP_LEN, AttriValue, strlen(AttriValue));
	if(!bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	CHECK_SUCCESS(xmlRsp.FindElem("RtspPort"));
	CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue()));
	bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPPORT, PORT_LEN, AttriValue, strlen(AttriValue));
	if(!bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	//add by zwx211831, Date:20140625, 在URL中添加UserID和DomainID,以实现查询点播业务。
	//如果是旧的版本,则不变。
	if (xmlRsp.FindElem("UserId") && xmlRsp.FindElem("DomainId"))
	{
		(void)xmlRsp.FindElem("DomainId");
		CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue()));
		std::string strDomainCode("DomainCode=");
		strDomainCode += AttriValue;
		strDomainCode += "&";
		if(!CToolsHelp::Strncat(stMediaRsp.szURL, URL_LEN, strDomainCode.c_str()))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Strncat error.");
			return IVS_ALLOC_MEMORY_ERROR;
		}

		(void)xmlRsp.FindElem("UserId");
		CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue()));
		IVS_UINT32 uiUserID = 0;
		std::string strUserID("UserId=");
		GET_ELEM_VALUE_NUM_FOR_UINT("UserId", AttriValue, uiUserID, xmlRsp);
		strUserID += CToolsHelp::Int2Str(uiUserID);
		strUserID += "&";
		if(!CToolsHelp::Strncat(stMediaRsp.szURL, URL_LEN, strUserID.c_str()))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Strncat error.");
			return IVS_ALLOC_MEMORY_ERROR;
		}
	}

	xmlRsp.OutOfElem();

	return IVS_SUCCEED;


#if 0  //XML增加AssociatedAudio字段

	(void)xmlRsp.GetElem();    // Content
	(void)xmlRsp.IntoElem();
	(void)xmlRsp.GetElem();     // URL
	AttriValue=xmlRsp.GetElemValue(); 
	if(AttriValue == NULL)
	{
		BP_RUN_LOG_INF("Get URL Response Data", "URL is  null");
		return IVS_SDK_RET_SMU_SDK_XML_INVALD;
	}
	bool bRet = CToolsHelp::Memcpy(stMediaRsp.szURL,URL_LEN, AttriValue, strlen(AttriValue));
	if(false == bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	(void)xmlRsp.NextElem();               // RtspIP
	(void)xmlRsp.GetElem();
	AttriValue = xmlRsp.GetElemValue();
	if(AttriValue == NULL)
	{
		BP_RUN_LOG_INF("Get URL Response Data", "RtspIP is null");
		return IVS_SDK_RET_SMU_SDK_XML_INVALD;
	}
	bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPIP,IVS_IP_LEN, AttriValue, strlen(AttriValue));
	if(false == bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	(void)xmlRsp.NextElem();               // RtspPort
	(void)xmlRsp.GetElem();
	AttriValue = xmlRsp.GetElemValue();
	if(AttriValue == NULL)
	{
		BP_RUN_LOG_INF("Get URL Response Data", "RtspPort is null");
		return IVS_SDK_RET_SMU_SDK_XML_INVALD;
	}
	bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPPORT,PORT_LEN, AttriValue, strlen(AttriValue));
	if(false == bRet)
	{
		BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error.");
		return IVS_ALLOC_MEMORY_ERROR;
	}

	return IVS_SUCCEED;
#endif
}