// 拼装客户端抓拍通用返回xml
IVS_INT32 OCXCapturePictureXMLProcess::LocalCaptureBuildXMLGeneric(LONG iEventCode, ULONG iWndID, const IVS_CHAR* pFileName, CXml &xml)
{
// 	CHECK_POINTER(pFileName, IVS_OPERATE_MEMORY_ERROR); // 可以为空
	IVS_DEBUG_TRACE("");
	char buf[IVS_FILE_NAME_LEN + 1] = {0};

	CHECK_SUCCESS(xml.AddDeclaration("1.0","UTF-8",""));
	CHECK_SUCCESS(xml.AddElem("Content"));
	CHECK_SUCCESS(xml.AddChildElem("WndID"));
	xml.IntoElem();
	(void)_itoa_s((int)iWndID, buf, 10);//lint !e713
	CHECK_SUCCESS(xml.SetElemValue(buf));
	
	CHECK_SUCCESS(xml.AddElem("EventID"));
	(void)_itoa_s(iEventCode, buf, 10);
	CHECK_SUCCESS(xml.SetElemValue(buf));
	
	if (NULL != pFileName)
	{
		CHECK_SUCCESS(xml.AddElem("FileName"));
		CHECK_SUCCESS(xml.SetElemValue(pFileName));
	}

	xml.OutOfElem();
	return IVS_SUCCEED;
}
Beispiel #2
0
eLTE_RET XMLProcess::SetXmlStringEventNotifySDSStatus(const SdsMessageInfo* pInfo,
	CString& xmlStr)
{
	/************************************************************************
			--- XML 格式 ---
			<Content>
			<SdsMsgId>消息ID</SdsMsgId>
			<SdsRetCode>消息发送状态</SdsRetCode>
			</Content>
	************************************************************************/
	LOG_TRACE();
	CXml xml;
	(void)xml.AddElem("Content");
	(void)xml.AddChildElem("SdsMsgId");
	(void)xml.IntoElem();
	(void)xml.SetElemValue(pInfo->strSubject.c_str());

	(void)xml.AddElem("SdsRetCode");
	(void)xml.SetElemValue(pInfo->strRetCode.c_str());

	xml.OutOfElem();

	IVS_UINT32 uiLen = 0;
	const char* pXmlStr = xml.GetXMLStream(uiLen);
	if (NULL == pXmlStr)
	{
		LOG_RUN_ERROR("pXmlStr is null.");
		return eLTE_ERR_FAILED;
	}
	xmlStr = eLTE_Tool::ANSIToUnicode(pXmlStr).c_str();

	INFO_PARAM1(pXmlStr);
	return eLTE_ERR_SUCCESS;
}
Beispiel #3
0
//视频上墙
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;
}
Beispiel #4
0
// 解析入参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;
}
Beispiel #5
0
eLTE_RET XMLProcess::SetXmlStringEventNotifyGisReport(const GisReportInfo* pInfo,
	CString& xmlStr)
{
	/************************************************************************
			--- XML 格式 ---
			<Content>
			<ResourceID>上报方</ResourceID>
			<Time>最后一次上报时间</Time>
			<Altitude>高度</Altitude>
			<Latitude>纬度</Latitude>
			<Longtitude>经度</Longtitude>
			<TriggerCode>周期上报(0),特定事件(1、紧急呼叫)</TriggerCode>
			<ReportStatus>GPS正常开启(0),GPS搜星失败(1)或其它异常(2)</ReportStatus>
			</Content>
	************************************************************************/
	LOG_TRACE();

	if (NULL == pInfo)
	{
		LOG_RUN_ERROR("pInfo is null.");
		return eLTE_ERR_FAILED;
	}

	CXml xml;
	(void)xml.AddElem("Content");
	(void)xml.AddChildElem("ResourceID");
	(void)xml.IntoElem();
	(void)xml.SetElemValue(pInfo->strSender.c_str());
	(void)xml.AddElem("Time");
	(void)xml.SetElemValue(pInfo->strTime.c_str());
	(void)xml.AddElem("Altitude");
	(void)xml.SetElemValue(pInfo->strAltitude.c_str());
	(void)xml.AddElem("Latitude");
	(void)xml.SetElemValue(pInfo->strLatitude.c_str());
	(void)xml.AddElem("Longtitude");
	(void)xml.SetElemValue(pInfo->strLongtitude.c_str());
	(void)xml.AddElem("TriggerCode");
	(void)xml.SetElemValue(eLTE_Tool::Int2String(pInfo->iTriggerCode).c_str());
	(void)xml.AddElem("ReportStatus");
	(void)xml.SetElemValue(eLTE_Tool::Int2String(pInfo->iReportState).c_str());
	xml.OutOfElem();

	IVS_UINT32 uiLen = 0;
	const char* pXmlStr = xml.GetXMLStream(uiLen);
	if (NULL == pXmlStr)
	{
		LOG_RUN_ERROR("pXmlStr is null.");
		return eLTE_ERR_FAILED;
	}
	xmlStr = eLTE_Tool::ANSIToUnicode(pXmlStr).c_str();

	INFO_PARAM1(pXmlStr);
	return eLTE_ERR_SUCCESS;
}
//查询MU的资源预算是否达到上限及当前摄像机视频流是否被引用
IVS_INT32 CMediaXMLProcess::VideoNumAndResourceGetXML(const std::string& strCameraCode, CXml &xml)
{
	IVS_DEBUG_TRACE("");
	(void)xml.AddDeclaration("1.0", "UTF-8", "");
	(void)xml.AddElem("Content");
	(void)xml.AddChildElem("CameraCode");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(strCameraCode.c_str());
	xml.OutOfElem();
	return IVS_SUCCEED;
}
Beispiel #7
0
ELTE_INT32 CMediaMgr::TelephoneDial(const ELTE_CHAR* pTelNumber) const
{
	LOG_TRACE();
	if(NULL == m_pUserMgr)
	{
		LOG_RUN_ERROR("UserMgr is null.");
		return eLTE_SDK_ERR_NULL_POINTER;
	}

	//构造xml
	CXml reqXml;
	(void)reqXml.AddElem("Content");
	(void)reqXml.AddChildElem("TelNumber");
	(void)reqXml.IntoElem();
	(void)reqXml.SetElemValue(pTelNumber);

	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_TELEPHONEDIAL_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;
}
//解析相应详细
IVS_INT32 CMediaXMLProcess::ParseVideoNumAndResource(CXml& xmlRsq,IVS_INT32& iReachLimit, IVS_INT32& iWhetherCited)
{
	const char*AttriValue = NULL;   //临时存储单个节点值
	if (xmlRsq.FindElemEx("Content"))
	{
		(void)xmlRsq.IntoElem();
		GET_ELEM_VALUE_NUM("ReachLimit", AttriValue, iReachLimit, xmlRsq);

		GET_ELEM_VALUE_NUM("WhetherCited", AttriValue, iWhetherCited, xmlRsq);
		return IVS_SUCCEED;
	}
	BP_RUN_LOG_ERR(IVS_FAIL, "Parse VideoNum And Resource XML", "Get VideoNum And Resource Error");
	return IVS_FAIL;
}
// 解析抓拍图片查询参数xml
IVS_INT32 OCXCapturePictureXMLProcess::GetSnapshotListParseXml(CXml &xml, IVS_QUERY_SNAPSHOT_PARAM *pQueryParam, const IVS_CHAR* pCameraCode)
{
	CHECK_POINTER(pQueryParam,IVS_PARA_INVALID);
	CHECK_POINTER(pCameraCode, IVS_PARA_INVALID);
	IVS_DEBUG_TRACE("");

	const char* szElemValue = NULL;
	const char* pTemp = NULL;
	if (!xml.FindElemEx("Content"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Parse Result XML", "xml.FindElem(Content/PageInfo) is fail");
		return IVS_XML_INVALID;
	}
	GET_ELEM_VALUE_CHAR("CameraCode",szElemValue,  pCameraCode,IVS_DEV_CODE_LEN, xml);

	if (!xml.FindElemEx("Content/PageInfo"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Parse Result XML", "xml.FindElem(Content/PageInfo) is fail");
		return IVS_XML_INVALID;
	}
	(void)xml.IntoElem();
	GET_ELEM_VALUE_NUM_FOR_UINT("FromIndex", pTemp, pQueryParam->stIndexRange.uiFromIndex, xml);
	GET_ELEM_VALUE_NUM_FOR_UINT("ToIndex", pTemp, pQueryParam->stIndexRange.uiToIndex, xml);

	if (!xml.FindElemEx("Content/TimeInfo"))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Parse Result XML", "xml.FindElem(Content/PageInfo) is fail");
		return IVS_XML_INVALID;
	}
	(void)xml.IntoElem();
	GET_ELEM_VALUE_CHAR("FromTime",szElemValue,  pQueryParam->stTimeSpan.cStart, IVS_TIME_LEN, xml);
	GET_ELEM_VALUE_CHAR("ToTime",szElemValue,  pQueryParam->stTimeSpan.cEnd, IVS_TIME_LEN, xml);
	xml.OutOfElem();
	GET_ELEM_VALUE_NUM_FOR_UINT("SnapType", pTemp, pQueryParam->uiSnapType, xml); // plint !e

	return IVS_SUCCEED;
}
Beispiel #10
0
ELTE_INT32 CMediaMgr::RecvVideoPlay(const ELTE_CHAR* pResourceID) const
{
	LOG_TRACE();
	if(NULL == m_pUserMgr)
	{
		LOG_RUN_ERROR("UserMgr is null.");
		return eLTE_SDK_ERR_NULL_POINTER;
	}
	CXml reqXml;
	(void)reqXml.AddElem("Content");
	(void)reqXml.AddChildElem("ResourceID");
	(void)reqXml.IntoElem();
	(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_RECVVIDEOPLAY_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 && !CUserMgr::m_iBypass)
	{
		iRet = SharedMemoryMgr::Instance().CreateSharedMemory(pResourceID);
		if(eLTE_SDK_ERR_SUCCESS != iRet)
		{
			LOG_RUN_ERROR("CreateSharedMemory failed.");
		}
	}
	return iRet;
}
// 构建获取图形失败的XML
IVS_INT32 COCXDrawXMLProcess::GetGraphicsGetErrXML(IVS_INT32 iResultCode, CXml& xmlGraphics)
{
	char val[64] = {0};
	IVS_DEBUG_TRACE("iResultCode: %d", iResultCode);

	CHECK_SUCCESS(xmlGraphics.AddDeclaration("1.0","UTF-8",""));
	CHECK_SUCCESS(xmlGraphics.AddElem("Content"));
	CHECK_SUCCESS(xmlGraphics.AddChildElem("ResultCode"));
	CHECK_SUCCESS(xmlGraphics.IntoElem());
	SET_ELEMENT_LONG(iResultCode, val, xmlGraphics);
	xmlGraphics.OutOfElem();

	return IVS_SUCCEED;

}
// 构建选中图形消息XML
IVS_INT32 COCXDrawXMLProcess::SelectGraphicGetXML(CString &xmlToCU, IVS_ULONG ulGraphicGroup)
{
	IVS_DEBUG_TRACE("GraphicGroup: %lu", ulGraphicGroup);
	CXml xmlGraphics;
	char val[64] = {0};
	unsigned int uiLen = 0;

	CHECK_SUCCESS(xmlGraphics.AddDeclaration("1.0","UTF-8",""));
	CHECK_SUCCESS(xmlGraphics.AddElem("Content"));
	CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicGroup"));
	CHECK_SUCCESS(xmlGraphics.IntoElem());
	SET_ELEMENT_LONG(ulGraphicGroup, val, xmlGraphics);
	xmlGraphics.OutOfElem();
	xmlToCU = xmlGraphics.GetXMLStream(uiLen);

	return IVS_SUCCEED;
}
//解析密钥值
IVS_INT32 CMediaXMLProcess::ParseStreamencryKey(CXml& xmlRsq,char* pStreamencryKey)
{
	if (NULL == pStreamencryKey)
	{
		BP_RUN_LOG_ERR(IVS_FAIL, "Streamencry Key Space is NULL", "Get Streamencry Key Error");
		return IVS_FAIL;
	}
	const char*AttriValue = NULL;   //临时存储单个节点值
	if (xmlRsq.FindElemEx("Content"))
	{
		(void)xmlRsq.IntoElem();
		GET_ELEM_VALUE_CHAR("StreamEncryPWD", AttriValue, pStreamencryKey, ENCRY_KEY_LEN, xmlRsq);
	//	memcpy(pStreamencryKey,AttriValue,IVS_PWD_LEN);
		return IVS_SUCCEED;
	}
	BP_RUN_LOG_ERR(IVS_FAIL, "Parse Streamencry Key XML", "Get Streamencry Key Error");
	return IVS_FAIL;
}
Beispiel #14
0
ELTE_INT32 CMediaMgr::StopRealPlay(const ELTE_CHAR* pResourceID) const
{
	LOG_TRACE();
	if(NULL == m_pUserMgr)
	{
		LOG_RUN_ERROR("UserMgr is null.");
		return eLTE_SDK_ERR_NULL_POINTER;
	}

	CXml reqXml;
	(void)reqXml.AddElem("Content");
	(void)reqXml.AddChildElem("ResourceID");
	(void)reqXml.IntoElem();
	(void)reqXml.SetElemValue(pResourceID);

	//发送消息
	SSL_Socket& socket = const_cast<SSL_Socket&>(m_pUserMgr->GetSSLSocket());
	MutexLocker Locker(m_pUserMgr->GetMutexHandle());
	ELTE_INT32 iRet = socket.SendMsg(ELTE_SERVICE_STOPREALPLAY_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;
	}
	iRet = m_pUserMgr->GetPacketData().RspCode;
	::ResetEvent(m_pUserMgr->GetEventHandle());
	if(eLTE_SDK_ERR_SUCCESS == iRet && !CUserMgr::m_iBypass)
	{
		SharedMemoryMgr::Instance().DeleteSharedMemory(pResourceID);
	}
	return iRet;
}
Beispiel #15
0
ELTE_INT32 CMediaMgr::PTZControl(const ELTE_CHAR* pResourceID, ELTE_UINT32 iPTZControlCode, ELTE_UINT32 iPTZControlValue) const
{
	LOG_TRACE();
	if(NULL == m_pUserMgr)
	{
		LOG_RUN_ERROR("UserMgr is null.");
		return eLTE_SDK_ERR_NULL_POINTER;
	}

	CXml reqXml;
	(void)reqXml.AddElem("Content");
	(void)reqXml.AddChildElem("ResourceID");
	(void)reqXml.IntoElem();
	(void)reqXml.SetElemValue(pResourceID);
	(void)reqXml.AddElem("PTZControlCode");
	(void)reqXml.SetElemValue(eLTE_Tool::UInt2String(iPTZControlCode).c_str());
	(void)reqXml.AddElem("PTZControlValue");
	(void)reqXml.SetElemValue(eLTE_Tool::UInt2String(iPTZControlValue).c_str());

	//发送消息
	SSL_Socket& socket = const_cast<SSL_Socket&>(m_pUserMgr->GetSSLSocket());
	MutexLocker Locker(m_pUserMgr->GetMutexHandle());
	ELTE_INT32 iRet = socket.SendMsg(ELTE_SERVICE_PTZCONTROL_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;
	}
	iRet = m_pUserMgr->GetPacketData().RspCode;
	::ResetEvent(m_pUserMgr->GetEventHandle());
	return iRet;
}
 //通用的查询请求
 IVS_INT32 CXmlProcess::GetCommConfigGetXML(const IVS_CHAR* pDomainCode,const IVS_CHAR* pDevCode, CXml& xml, enConfigType enType)
 {
	 CHECK_POINTER(pDomainCode,IVS_OPERATE_MEMORY_ERROR);
	 CHECK_POINTER(pDevCode,IVS_OPERATE_MEMORY_ERROR);

	 (void)xml.AddDeclaration("1.0","UTF-8","");
	 (void)xml.AddElem("Content");

	 (void)xml.AddChildElem("DomainCode");
	 (void)xml.IntoElem();
	 (void)xml.SetElemValue(pDomainCode);
	 if (SDKCAMERA == enType)
	 {
		 (void)xml.AddElem("CameraCode");
	 }
	 else if (SDKDEVICE == enType)
	 {
		 (void)xml.AddElem("DevCode");
	 }
	 else if (SDKALARMINCODE == enType)
	 {
		 (void)xml.AddElem("AlarmInCode");
	 }
	 else if (SDKALARMOUTCODE == enType)
	 {
		 (void)xml.AddElem("AlarmOutCode");
	 }
	 else if (SDKSERIAL == enType)
	 {
		 (void)xml.AddElem("SerialCode");
	 }
	 else if (SDKVOICE == enType)
	 {
		 (void)xml.AddElem("VoiceCode");
	 }


	 (void)xml.SetElemValue(pDevCode);
	 xml.OutOfElem();

	 return IVS_SUCCEED;
 }
 // 通用请求XML增加QueryField字段
 IVS_INT32 CXmlProcess::AddQueryFieldForUnifiedFormatQueryXML(const IVS_CHAR* pField,const IVS_CHAR* pValue, CXml& xmlReq)
 {
	 CHECK_POINTER(pField, IVS_OPERATE_MEMORY_ERROR);
	 CHECK_POINTER(pValue, IVS_OPERATE_MEMORY_ERROR);

	 std::string sQueryType = "EXACT";
	 if (xmlReq.FindElemEx("Content/PageInfo/QueryCond/QueryField"))
	 {
		 xmlReq.OutOfElem();
		 (void)xmlReq.AddElem("QueryField");
		 (void)xmlReq.AddChildElem("Field");
		 (void)xmlReq.IntoElem();
		 (void)xmlReq.SetElemValue(pField);
		 (void)xmlReq.AddElem("Value");
		 (void)xmlReq.SetElemValue(pValue); 
		 (void)xmlReq.AddElem("QueryType");
		 (void)xmlReq.SetElemValue(sQueryType.c_str());
		 xmlReq.OutOfElem();
	 }
	 return IVS_SUCCEED;
 }
//请求录像加密的工作密钥或者异或因子xml
IVS_INT32 CMediaXMLProcess::ApplyStreamencryPwdGetXML(const std::string& strCameraCode,const std::string& strDomainCode,
	const std::string& strDestModule,int& iStreamType,const std::string& strSessionID,const std::string& strSecurityTransID, CXml &xml)
{
	IVS_DEBUG_TRACE("");
	(void)xml.AddDeclaration("1.0", "UTF-8", "");
	(void)xml.AddElem("Content");
	(void)xml.AddChildElem("CameraCode");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(strCameraCode.c_str());

	(void)xml.AddElem("DomainCode");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(strDomainCode.c_str());

	(void)xml.AddElem("DestModule");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(strDestModule.c_str());

	if(!strSessionID.empty())
	{
		(void)xml.AddElem("SessionID");
		(void)(xml.IntoElem());
		(void)xml.SetElemValue(strSessionID.c_str());
	}

	(void)xml.AddElem("StreamID");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(CToolsHelp::Int2Str(iStreamType).c_str());

	(void)xml.AddElem("ExchangeTransNo");
	(void)(xml.IntoElem());
	(void)xml.SetElemValue(strSecurityTransID.c_str());

	xml.OutOfElem();
	return IVS_SUCCEED;
}
Beispiel #19
0
eLTE_RET XMLProcess::SetXmlStringEventNotifyGisStatus(const GisReportInfo* pInfo,
	CString& xmlStr)
{
	/************************************************************************
			--- XML 格式 ---
			<Content>
			<ResourceID>上报方</ResourceID>
			<AckStatusList>
			<AckStatus>终端号:订阅状态,举例如下:
			1001:0。</AckStatus>
			</AckStatusList>
			</Content>
	************************************************************************/
	LOG_TRACE();

	if (NULL == pInfo)
	{
		LOG_RUN_ERROR("pInfo is null.");
		return eLTE_ERR_FAILED;
	}

	CXml xml;
	(void)xml.AddElem("Content");
	(void)xml.AddChildElem("ResourceID");
	(void)xml.IntoElem();
	(void)xml.SetElemValue(pInfo->strSender.c_str());
	(void)xml.AddElem("AckStatusList");

	AckStateMap::iterator itor_b = (const_cast<GisReportInfo*>(pInfo))->ackStateMap.begin();
	AckStateMap::iterator itor_e = (const_cast<GisReportInfo*>(pInfo))->ackStateMap.end();
	std::string strAckStatus;
	for(; itor_b != itor_e; ++itor_b)
	{
		if(itor_b == pInfo->ackStateMap.begin())
		{
			(void)xml.AddChildElem("AckStatus");
			(void)xml.IntoElem();
		}
		else
		{
			(void)xml.AddElem("AckStatus");
		}
		strAckStatus.clear();
		strAckStatus = "";
		strAckStatus.append(eLTE_Tool::Int2String(itor_b->first).c_str());
		strAckStatus.append(":");
		strAckStatus.append(eLTE_Tool::Int2String(itor_b->second).c_str());
		(void)xml.SetElemValue(strAckStatus.c_str());
	}
	xml.OutOfElem();
	xml.OutOfElem();

	IVS_UINT32 uiLen = 0;
	const char* pXmlStr = xml.GetXMLStream(uiLen);
	if (NULL == pXmlStr)
	{
		LOG_RUN_ERROR("pXmlStr is null.");
		return eLTE_ERR_FAILED;
	}
	xmlStr = eLTE_Tool::ANSIToUnicode(pXmlStr).c_str();

	INFO_PARAM1(pXmlStr);
	return eLTE_ERR_SUCCESS;
}
Beispiel #20
0
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;
}
// 解析设置图形的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;
}
// 拼装查询操作日志响应的xml
IVS_INT32 COCXLogMgrXMLProcess::GetResOperationLogXML(IVS_OPERATION_LOG_LIST* pOperationLogList, CXml& xmlRes)
{
	CHECK_POINTER(pOperationLogList, IVS_XML_INVALID);
	IVS_DEBUG_TRACE("");
	
	(void)xmlRes.AddDeclaration("1.0","UTF-8","");
	(void)xmlRes.AddElem("Content");
	(void)xmlRes.AddChildElem("ResultCode");
	(void)xmlRes.IntoElem();
	(void)xmlRes.SetElemValue("0");	

	(void)xmlRes.AddElem("PageInfo");
	(void)xmlRes.IntoElem();
	(void)xmlRes.AddChildElem("RealNum");
	(void)xmlRes.IntoElem();

	(void)xmlRes.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pOperationLogList->uiTotal)).c_str());	
	(void)xmlRes.AddElem("FromIndex");
	(void)xmlRes.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>((pOperationLogList->stIndexRange).uiFromIndex)).c_str());	

	(void)xmlRes.AddElem("ToIndex");
	(void)xmlRes.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>((pOperationLogList->stIndexRange).uiToIndex)).c_str());	
	xmlRes.OutOfElem();

	(void)xmlRes.AddElem("OperationLogList");

	
	IVS_UINT32 uiFromIndex = pOperationLogList->stIndexRange.uiFromIndex;
	IVS_UINT32 uiToIndex = pOperationLogList->stIndexRange.uiToIndex;
	IVS_UINT32 uiTotal = pOperationLogList->uiTotal;
    IVS_UINT32 uiRestltNum = 0;
	// 判断实际返回来的数据有多少条
	if (uiTotal <= uiToIndex )
	{
		uiRestltNum = (uiTotal - uiFromIndex) + 1;
	}
	else 
	{
		uiRestltNum = (uiToIndex - uiFromIndex) + 1;
	}
	IVS_UINT32  i = 0;
	while(i < uiRestltNum)
	{
		IVS_OPERATION_LOG_INFO &pOperationLogInfo = pOperationLogList->stOperationInfo[i];
		i == 0?(void)xmlRes.AddChildElem("OperationLogInfo"):(void)xmlRes.AddElem("OperationLogInfo");
		(void)xmlRes.IntoElem();
		(void)xmlRes.AddChildElem("Account");
		(void)xmlRes.IntoElem();

		IVS_CHAR szAccount[IVS_NAME_LEN + 1];
		memset(szAccount, 0x0, IVS_NAME_LEN + 1);
		if (!CToolsHelp::Memcpy(szAccount, IVS_NAME_LEN, pOperationLogInfo.cAccount, IVS_NAME_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cAccount failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.SetElemValue(szAccount);

		IVS_CHAR szClientIP[IVS_IP_LEN + 1];
		memset(szClientIP, 0x0, IVS_IP_LEN + 1);
		if (!CToolsHelp::Memcpy(szClientIP, IVS_IP_LEN, pOperationLogInfo.cClientIp, IVS_IP_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cClientIp failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("ClientIP");
		(void)xmlRes.SetElemValue(szClientIP);

		(void)xmlRes.AddElem("Grade");
		(void)xmlRes.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pOperationLogInfo.iGrade)).c_str());

		IVS_CHAR szServiceCode[IVS_DESCRIBE_LEN + 1];
		memset(szServiceCode, 0x0, IVS_DESCRIBE_LEN + 1);
		if (!CToolsHelp::Memcpy(szServiceCode, IVS_DESCRIBE_LEN, pOperationLogInfo.cServiceCode, IVS_DESCRIBE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cServiceCode failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("ServiceCode");
		(void)xmlRes.SetElemValue(szServiceCode);

		IVS_CHAR szModuleType[IVS_DESCRIBE_LEN + 1];
		memset(szModuleType, 0x0, IVS_DESCRIBE_LEN + 1);
		if (!CToolsHelp::Memcpy(szModuleType, IVS_DESCRIBE_LEN, pOperationLogInfo.cModuleType, IVS_DESCRIBE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cModuleType failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("ModuleType");
		(void)xmlRes.SetElemValue(szModuleType);

		IVS_CHAR szModuleCode[IVS_DEV_CODE_LEN + 1];
		memset(szModuleCode, 0x0, IVS_DEV_CODE_LEN + 1);
		if (!CToolsHelp::Memcpy(szModuleCode, IVS_DEV_CODE_LEN, pOperationLogInfo.cModuleCode, IVS_DEV_CODE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cModuleCode failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("ModuleCode");
		(void)xmlRes.SetElemValue(szModuleCode); 

		IVS_CHAR szOperationCode[IVS_DEV_CODE_LEN + 1];
		memset(szOperationCode, 0x0, IVS_DEV_CODE_LEN + 1);
		if (!CToolsHelp::Memcpy(szOperationCode, IVS_DEV_CODE_LEN, pOperationLogInfo.cOperationCode, IVS_DEV_CODE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cOperationCode failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("OperationCode");
		(void)xmlRes.SetElemValue(szOperationCode);

		IVS_CHAR szOperationObjectCode[IVS_DESCRIBE_LEN + 1];
		memset(szOperationObjectCode, 0x0, IVS_DESCRIBE_LEN + 1);
		if (!CToolsHelp::Memcpy(szOperationObjectCode, IVS_DESCRIBE_LEN, pOperationLogInfo.cOperationObjectCode, IVS_DESCRIBE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cOperationCode failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("OperationObjectCode");
		(void)xmlRes.SetElemValue(szOperationObjectCode);

		IVS_CHAR szOccurTime[IVS_TIME_LEN + 1];
		memset(szOccurTime, 0x0, IVS_TIME_LEN + 1);
		if (!CToolsHelp::Memcpy(szOccurTime, IVS_TIME_LEN, pOperationLogInfo.cOccurTime, IVS_TIME_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy szOccurTime failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("OccurTime");
		(void)xmlRes.SetElemValue(szOccurTime);

		IVS_CHAR szErrorCode[IVS_DESCRIBE_LEN + 1];
		memset(szErrorCode, 0x0, IVS_DESCRIBE_LEN + 1);
		if (!CToolsHelp::Memcpy(szErrorCode, IVS_DESCRIBE_LEN, pOperationLogInfo.cErrorCode, IVS_DESCRIBE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cErrorCode failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("ErrorCode");
		(void)xmlRes.SetElemValue(szErrorCode);

		(void)xmlRes.AddElem("Result");
		(void)xmlRes.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pOperationLogInfo.iResult)).c_str());	

		IVS_CHAR szAdditionalInfo[IVS_DESCRIBE_LEN + 1];
		memset(szAdditionalInfo, 0x0, IVS_DESCRIBE_LEN + 1);
		if (!CToolsHelp::Memcpy(szAdditionalInfo, IVS_DESCRIBE_LEN, pOperationLogInfo.cAdditionalInfo, IVS_DESCRIBE_LEN))
		{
			BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Response Operation Log XML", "Memcpy cAdditionalInfo failed");
			return IVS_ALLOC_MEMORY_ERROR;
		}
		(void)xmlRes.AddElem("AdditionalInfo");
		(void)xmlRes.SetElemValue(szAdditionalInfo);

		xmlRes.OutOfElem();
		i++;
	}

	xmlRes.OutOfElem();
	xmlRes.OutOfElem();

	return IVS_SUCCEED;
}
Beispiel #23
0
eLTE_RET XMLProcess::SetXmlStringPlayerEvent(int iEventId, const PlayerEventParamInfo* pInfo,
	CString& xmlStr)
{
	LOG_TRACE();

	if (NULL == pInfo)
	{
		LOG_RUN_ERROR("pInfo is null.");
		return eLTE_ERR_FAILED;
	}

	CXml xml;

	switch (iEventId)
	{
	case eLTE_PLAYER_REVERSE:		// OCX 播放器切换镜头
		{
			/************************************************************************
			--- XML 格式 ---
			<Content>
				<VideoFormat></VideoFormat>
				<CameraType></CameraType>
				<UserConfirmType></UserConfirmType>
				<MuteType></MuteType>
			</Content>
			************************************************************************/

			(void)xml.AddElem("Content");
			(void)xml.AddChildElem("VideoFormat");
			(void)xml.IntoElem();
			(void)xml.SetElemValue(pInfo->strFmtValue.c_str());
			(void)xml.AddElem("CameraType");
			(void)xml.SetElemValue(pInfo->strCameraType.c_str());
			(void)xml.AddElem("UserConfirmType");
			(void)xml.SetElemValue(pInfo->strUserCfmType.c_str());
			(void)xml.AddElem("MuteType");
			(void)xml.SetElemValue(pInfo->strMuteType.c_str());
			xml.OutOfElem();
		}
		break;
	case eLTE_PLAYER_SNAPSHOT:		// OCX 播放器抓图
		{
			/************************************************************************
			--- XML 格式 ---
			<Content>
				<SnapshotPath></SnapshotPath>
			</Content>
			************************************************************************/

			(void)xml.AddElem("Content");
			(void)xml.AddChildElem("SnapshotPath");
			(void)xml.IntoElem();
			(void)xml.SetElemValue(pInfo->strSnapshotPath.c_str());
			xml.OutOfElem();
		}
		break;
	case eLTE_PLAYER_POSITION:		// OCX 播放器坐标变动
		{
			/************************************************************************
			--- XML 格式 ---
			<Content>
				<Left></Left>
				<Top></Top>
				<Width></Width>
				<Height></Height>
			</Content>
			************************************************************************/

			(void)xml.AddElem("Content");
			(void)xml.AddChildElem("Left");
			(void)xml.IntoElem();
			(void)xml.SetElemValue(eLTE_Tool::Int2String(pInfo->iLeft).c_str());
			(void)xml.AddElem("Top");
			(void)xml.SetElemValue(eLTE_Tool::Int2String(pInfo->iTop).c_str());
			(void)xml.AddElem("Width");
			(void)xml.SetElemValue(eLTE_Tool::Int2String(pInfo->iWidth).c_str());
			(void)xml.AddElem("Height");
			(void)xml.SetElemValue(eLTE_Tool::Int2String(pInfo->iHeight).c_str());
			xml.OutOfElem();
		}
		break;
	case eLTE_PLAYER_TITLE:			// OCX 播放器窗口标题
		{
			/************************************************************************
			--- XML 格式 ---
			<Content>
				<TitleText></TitleText>
			</Content>
			************************************************************************/

			(void)xml.AddElem("Content");
			(void)xml.AddChildElem("TitleText");
			(void)xml.IntoElem();
			(void)xml.SetElemValue(pInfo->strTitle.c_str());
			xml.OutOfElem();
		}
		break;
	default:
		{
			LOG_RUN_ERROR("Invalid eventId.");
			return eLTE_ERR_FAILED;
		}
	}

	IVS_UINT32 uiLen = 0;
	const char* pXmlStr = xml.GetXMLStream(uiLen);
	if (NULL == pXmlStr)
	{
		LOG_RUN_ERROR("pXmlStr is null.");
		return eLTE_ERR_FAILED;
	}
	xmlStr = eLTE_Tool::ANSIToUnicode(pXmlStr).c_str();

	//INFO_PARAM1(xmlStr);
	return eLTE_ERR_SUCCESS;
}
Beispiel #24
0
// 解析入参视频播放参数
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;
}
Beispiel #25
0
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;
}
Beispiel #26
0
// 解析入参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;
}
Beispiel #27
0
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;
}
// 通用查询转换成XML
IVS_INT32 CXmlProcess::GetUnifiedFormatQueryXML(const IVS_QUERY_UNIFIED_FORMAT* pUnifiedQuery, CXml &xml,
	const IVS_CHAR* pDomainCode/* = NULL*/,const IVS_CHAR* pCamerCode)
{
	// pDomainCode不要事先判空,作为默认参数
	CHECK_POINTER(pUnifiedQuery, IVS_OPERATE_MEMORY_ERROR);  

	(void)xml.AddDeclaration("1.0","UTF-8","");
	(void)xml.AddElem("Content");	
	if (NULL != pDomainCode)
	{
		(void)xml.AddChildElem("DomainCode");
		(void)xml.IntoElem();
		(void)xml.SetElemValue(pDomainCode);
		(void)xml.AddElem("PageInfo");
	}
	else
	{
		(void)xml.AddChildElem("PageInfo");
	}
	
	(void)xml.IntoElem();
	(void)xml.AddChildElem("FromIndex");
	(void)xml.IntoElem();
	(void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>((pUnifiedQuery->stIndex).uiFromIndex)).c_str());
	(void)xml.AddElem("ToIndex");
	(void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>((pUnifiedQuery->stIndex).uiToIndex)).c_str());

	IVS_UINT32 iFieldNum = static_cast<IVS_UINT32>(pUnifiedQuery->iFieldNum);	

	if (iFieldNum > 0) //如果是0的话,这个QueryCond节点都不要了
	{
		IVS_CHAR szValue[IVS_QUERY_VALUE_LEN+1]={0};
		(void)xml.AddElem("QueryCond");	
		for (unsigned int i=0;i < iFieldNum;i++)
		{	
			if (0 == i)
			{
				(void)xml.AddChildElem("QueryField");
			}
			else
			{
				(void)xml.AddElem("QueryField");	
			}

			(void)xml.IntoElem();
			(void)xml.AddChildElem("Field");
			(void)xml.IntoElem();

			std::string  iField = QUERYFILED.GetValue(pUnifiedQuery->stQueryField[i].eFieID);
			(void)xml.SetElemValue(iField.c_str());
			(void)xml.AddElem("Value");
			if (QUERY_CAMERA_CODE == pUnifiedQuery->stQueryField[i].eFieID || QUERY_OPERATION_OBJECT_CODE == pUnifiedQuery->stQueryField[i].eFieID)
			{
				if (NULL != pCamerCode)
				{
					(void)xml.SetElemValue(pCamerCode);
				}
				else
				{
					IVS_CHAR chDevCode[IVS_DEV_CODE_LEN+1];
					IVS_CHAR chDomaCode[IVS_DOMAIN_CODE_LEN+1];
					(IVS_VOID)CXmlProcess::ParseDevCode(pUnifiedQuery->stQueryField[i].cValue, chDevCode, chDomaCode);
					(void)xml.SetElemValue(chDevCode);
				}
			}
			else
			{
				if (!CToolsHelp::Memcpy(szValue, IVS_QUERY_VALUE_LEN, pUnifiedQuery->stQueryField[i].cValue, IVS_QUERY_VALUE_LEN))
				{
					BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Unified Format Query XML", "Memcpy szValue failed");
					return IVS_ALLOC_MEMORY_ERROR;
				}
				(void)xml.SetElemValue(szValue);
			}

			//注意如果这里的值不是0/1,直接返回参数错误的错误码
			CHECK_IVSBOOL(pUnifiedQuery->stQueryField[i].bExactQuery);
			
			(void)xml.AddElem("QueryType");
			if (MATCHED_SUCCEED == pUnifiedQuery->stQueryField[i].bExactQuery)
			{
				(void)xml.SetElemValue("EXACT");
			}
			else
			{
				(void)xml.SetElemValue("INEXACT");
			}
			xml.OutOfElem();
		}
		xml.OutOfElem();

		//注意如果这里的值不是0/1,直接返回参数错误的错误码
		CHECK_IVSBOOL(pUnifiedQuery->stOrderCond.bEnableOrder);

		if (pUnifiedQuery->stOrderCond.bEnableOrder)
		{
			(void)xml.AddElem("OrderCond");
			(void)xml.AddChildElem("OrderField");
			(void)xml.IntoElem();	
			std::string iOrderField = QUERYFILED.GetValue(pUnifiedQuery->stOrderCond.eFieID);
			(void)xml.SetElemValue(iOrderField.c_str());

			//注意如果这里的值不是0/1,直接返回参数错误的错误码
			CHECK_IVSBOOL(pUnifiedQuery->stOrderCond.bUp);

			(void)xml.AddElem("Order");
			if (MATCHED_SUCCEED==pUnifiedQuery->stOrderCond.bUp)
			{
				(void)xml.SetElemValue("UP");
			}
			else
			{
				(void)xml.SetElemValue("DOWN");
			}
			xml.OutOfElem();
		}
	}
	xml.OutOfElem();

	return IVS_SUCCEED;
}
//对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
// 解析画图前图形属性设置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;

}