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; }
// 拼装客户端抓拍通用返回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; }
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; }
//查询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; }
// 通用请求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 COCXDrawXMLProcess::UnSelectGraphicGetXML(CString &xmlToCU) { IVS_DEBUG_TRACE(""); CXml xmlGraphics; unsigned int uiLen = 0; CHECK_SUCCESS(xmlGraphics.AddDeclaration("1.0","UTF-8","")); CHECK_SUCCESS(xmlGraphics.AddElem("Content")); xmlToCU = xmlGraphics.GetXMLStream(uiLen); return IVS_SUCCEED; }
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; }
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; }
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; }
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; }
//通用的查询请求 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 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; }
// 拼装查询操作日志响应的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; }
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; }
// 通用查询转换成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 IVS_INT32 OCXCapturePictureXMLProcess::GetSnapshotListGetXml(CXml &xml, const IVS_SNAPSHOT_INFO_LIST *pSnapshotList, IVS_UINT32 iTotalNum) { CHECK_POINTER(pSnapshotList,IVS_PARA_INVALID); IVS_DEBUG_TRACE(""); (void)xml.AddElem("Content"); (void)xml.AddChildElem("ResultCode"); (void)xml.IntoElem(); (void)xml.SetElemValue("0"); (void)xml.AddElem("PageInfo"); (void)xml.AddChildElem("RealNum"); (void)xml.IntoElem(); (void)xml.SetElemValue(CToolsHelp::Int2Str((int)pSnapshotList->uiTotal).c_str()); (void)xml.AddElem("FromIndex"); (void)xml.SetElemValue(CToolsHelp::Int2Str((int)pSnapshotList->stIndexRange.uiFromIndex).c_str()); (void)xml.AddElem("ToIndex"); (void)xml.SetElemValue(CToolsHelp::Int2Str((int)pSnapshotList->stIndexRange.uiToIndex).c_str()); xml.OutOfElem(); (void)xml.AddElem("SnapshotList"); IVS_UINT32 uIndex = 0; if ((pSnapshotList->uiTotal) > iTotalNum) { uIndex = iTotalNum; } else { uIndex = pSnapshotList->uiTotal; } for (IVS_UINT32 i = 0; i < uIndex; i++) { IVS_SNAPSHOT_INFO cSnapshotInfo = pSnapshotList->stSnapshotInfo[i]; i == 0 ? xml.AddChildElem("SnapInfo") : xml.AddElem("SnapInfo"); (void)xml.IntoElem(); (void)xml.AddChildElem("PictureID"); (void)xml.IntoElem(); (void)xml.SetElemValue(CToolsHelp::Int2Str((int)cSnapshotInfo.uiPictureID).c_str()); (void)xml.AddElem("PictureName"); IVS_CHAR cPictureName[IVS_FILE_NAME_LEN + 1] = {0}; if (!CToolsHelp::Memcpy(cPictureName, IVS_FILE_NAME_LEN, cSnapshotInfo.cPictureName, IVS_FILE_NAME_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot List GetXml", "Memcpy pPictureName failed"); return IVS_ALLOC_MEMORY_ERROR; } (void)xml.SetElemValue(cPictureName); //直接用CU的大CameraCode (void)xml.AddElem("CameraCode"); IVS_CHAR cCameraCode[IVS_DEV_CODE_LEN + 1] = {0}; if (!CToolsHelp::Memcpy(cCameraCode, IVS_DEV_CODE_LEN, cSnapshotInfo.cCameraCode, IVS_DEV_CODE_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot List GetXml", "Memcpy cCameraCode failed"); return IVS_ALLOC_MEMORY_ERROR; } (void)xml.SetElemValue(cCameraCode); (void)xml.AddElem("SnapTime"); IVS_CHAR cSnapTime[IVS_TIME_LEN + 1] = {0}; if (!CToolsHelp::Memcpy(cSnapTime, IVS_TIME_LEN, cSnapshotInfo.cSnapTime, IVS_TIME_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot List GetXml", "Memcpy cSnapTime failed"); return IVS_ALLOC_MEMORY_ERROR; } (void)xml.SetElemValue(cSnapTime); (void)xml.AddElem("SnapType"); (void)xml.SetElemValue(CToolsHelp::Int2Str((int)cSnapshotInfo.uiSnapType).c_str()); (void)xml.AddElem("PictureSize"); (void)xml.SetElemValue(CToolsHelp::Int2Str((int)cSnapshotInfo.uiPictureSize).c_str()); (void)xml.AddElem("PreviewUrl"); IVS_CHAR cPreviewUrl[IVS_URL_LEN + 1] = {0}; if (!CToolsHelp::Memcpy(cPreviewUrl, IVS_URL_LEN, cSnapshotInfo.cPreviewUrl, IVS_URL_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot List GetXml", "Memcpy cPreviewUrl failed"); return IVS_ALLOC_MEMORY_ERROR; } (void)xml.SetElemValue(cPreviewUrl); (void)xml.AddElem("PictureUrl"); IVS_CHAR cPictureUrl[IVS_URL_LEN + 1] = {0}; if (!CToolsHelp::Memcpy(cPictureUrl, IVS_URL_LEN, cSnapshotInfo.cPictureUrl, IVS_URL_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot List GetXml", "Memcpy cPictureUrl failed"); return IVS_ALLOC_MEMORY_ERROR; } (void)xml.SetElemValue(cPictureUrl); xml.OutOfElem(); } xml.GetRootPos(); return IVS_SUCCEED; }
//查询平台抓拍计划:将响应结构体转换为结果XML IVS_INT32 OCXCapturePictureXMLProcess::GetSnapshotPlanGetXML(IVS_INT32 iRet,const IVS_CHAR* pCameraCode,const IVS_SNAPSHOT_PLAN* pSnapShotPlan,CXml &xml) { CHECK_POINTER(pCameraCode, IVS_PARA_INVALID); CHECK_POINTER(pSnapShotPlan, IVS_PARA_INVALID); IVS_DEBUG_TRACE(""); (void)xml.AddDeclaration("1.0","UTF-8",""); (void)xml.AddElem("Content"); (void)xml.AddChildElem("ResultCode"); (void)xml.IntoElem(); (void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(iRet)).c_str()); (void)xml.AddElem("SnapshotPlanInfo"); (void)xml.AddChildElem("CameraCode"); (void)xml.IntoElem(); (void)xml.SetElemValue(pCameraCode); (void)xml.AddElem("IsEnable"); (void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pSnapShotPlan->bEnable)).c_str()); (void)xml.AddElem("PlanType"); (void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pSnapShotPlan->uiPlanType)).c_str()); (void)xml.AddElem("PlanList"); IVS_CHAR cStartTime[IVS_TIME_LEN+1] = {0}; IVS_CHAR cEndTime[IVS_TIME_LEN+1] = {0}; for (IVS_UINT32 i=0; i<pSnapShotPlan->uiPlanInfoNum; i++) { if (i == 0) { (void)xml.AddChildElem("PlanInfo"); (void)xml.IntoElem();// ------------4 } else { (void)xml.AddElem("PlanInfo"); } (void)xml.AddChildElem("DayType"); (void)xml.IntoElem();// -------------3 (void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pSnapShotPlan->stPlanInfo[i].uiDayType)).c_str()); (void)xml.AddElem("TimeList"); for (IVS_UINT32 j=0; j<pSnapShotPlan->stPlanInfo[i].uiTimeSpanInfoNum; j++) { if (j == 0) { (void)xml.AddChildElem("TimeInfo"); (void)xml.IntoElem();// ---------------------- 2 } else{ (void)xml.AddElem("TimeInfo"); } if (!CToolsHelp::Memcpy(cStartTime, IVS_TIME_LEN, pSnapShotPlan->stPlanInfo[i].stTimeSpanInfo[j].cStart, IVS_TIME_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot Plan Get XML", "Memcpy cStartTime failed"); return IVS_ALLOC_MEMORY_ERROR; } if (!CToolsHelp::Memcpy(cEndTime, IVS_TIME_LEN, pSnapShotPlan->stPlanInfo[i].stTimeSpanInfo[j].cEnd, IVS_TIME_LEN)) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "Get Snapshot Plan Get XML", "Memcpy cEndTime failed"); return IVS_ALLOC_MEMORY_ERROR; } (void)xml.AddChildElem("StartTime"); (void)xml.IntoElem();//-------------------------1 (void)xml.SetElemValue(cStartTime); (void)xml.AddElem("EndTime"); (void)xml.SetElemValue(cEndTime); (void)xml.AddElem("SnapInterval"); (void)xml.SetElemValue(CToolsHelp::Int2Str(static_cast<IVS_INT32>(pSnapShotPlan->stPlanInfo[i].stTimeSpanInfo[j].SnapInterval)).c_str()); xml.OutOfElem();//-------------------------1 } xml.OutOfElem();// ---------------------2 xml.OutOfElem();//----------------3 } xml.OutOfElem();//----------------4 xml.OutOfElem(); return IVS_SUCCEED; }
// 构建获取图形的XML IVS_INT32 COCXDrawXMLProcess::GetGraphicsGetXML(const IA_GRAPHICS *pGraphicsArr, IVS_INT32 iResultCode, ULONG ulNum, CXml& xmlGraphics, const SIZE &szGraphic) { CHECK_POINTER(pGraphicsArr, IVS_FAIL); IVS_DEBUG_TRACE("iResultCode: %d, ulNum:%d, GraphicWidth: %d, GraphicHeight: %d", iResultCode, ulNum, szGraphic.cx, szGraphic.cy); char val[64] = {0}; 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); CHECK_SUCCESS(xmlGraphics.AddElem("Graphics")); CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicNum")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(ulNum, val, xmlGraphics); if (0 == ulNum) { xmlGraphics.OutOfElem(); xmlGraphics.OutOfElem(); return IVS_SUCCEED; } CHECK_SUCCESS(xmlGraphics.AddElem("GraphicList")); for (ULONG i = 0; i < ulNum; i++) { if (i == 0) { CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicInfo")); CHECK_SUCCESS(xmlGraphics.IntoElem()); } else { CHECK_SUCCESS(xmlGraphics.AddElem("GraphicInfo")); } CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicType")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(pGraphicsArr[i].ulGraphicType, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicGroup")); SET_ELEMENT_LONG(pGraphicsArr[i].ulGraphicGroup, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicGroupName")); SET_ELEMENT_STRING(pGraphicsArr[i].GraphicGroupName, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicBackgroundColor")); CHECK_SUCCESS(xmlGraphics.AddChildElem("Opacity")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Alpha, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Red")); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Red, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Green")); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Green, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Blue")); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Blue, val, xmlGraphics); xmlGraphics.OutOfElem(); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicLineColor")); CHECK_SUCCESS(xmlGraphics.AddChildElem("Opacity")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Alpha, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Red")); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Red, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Green")); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Green, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Blue")); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Blue, val, xmlGraphics); xmlGraphics.OutOfElem(); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicLineWidth")); SET_ELEMENT_LONG(pGraphicsArr[i].ulLineWidth, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("PointNum")); SET_ELEMENT_LONG(pGraphicsArr[i].ulPointsNum, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("PointList")); for (ULONG j = 0; j < pGraphicsArr[i].ulPointsNum; j++) { if (0 == j) { CHECK_SUCCESS(xmlGraphics.AddChildElem("Point")); CHECK_SUCCESS(xmlGraphics.IntoElem()); } else { CHECK_SUCCESS(xmlGraphics.AddElem("Point")); } CHECK_SUCCESS(xmlGraphics.AddChildElem("X")); CHECK_SUCCESS(xmlGraphics.IntoElem()); if ((0 == szGraphic.cx) || (0 == szGraphic.cy)) { SET_ELEMENT_LONG(pGraphicsArr[i].IAPoints[j].x, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Y")); SET_ELEMENT_LONG(pGraphicsArr[i].IAPoints[j].y, val, xmlGraphics); } else { char cPointValue[10]; memset(cPointValue, 0, sizeof(cPointValue)); double dPointValue = (double)pGraphicsArr[i].IAPoints[j].x / szGraphic.cx; (void)_snprintf_s(cPointValue, sizeof(cPointValue) - 1, "%f", dPointValue); cPointValue[8] = '\0'; CHECK_SUCCESS(xmlGraphics.SetElemValue(cPointValue)); CHECK_SUCCESS(xmlGraphics.AddElem("Y")); memset(cPointValue, 0, sizeof(cPointValue)); dPointValue = (double)pGraphicsArr[i].IAPoints[j].y / szGraphic.cy; (void)_snprintf_s(cPointValue, sizeof(cPointValue) - 1, "%f", dPointValue); cPointValue[8] = '\0'; CHECK_SUCCESS(xmlGraphics.SetElemValue(cPointValue)); } xmlGraphics.OutOfElem(); } xmlGraphics.OutOfElem(); CHECK_SUCCESS(xmlGraphics.AddElem("NamePosition")); SET_ELEMENT_LONG(pGraphicsArr[i].NamePosition, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("DeleteByMouse")); SET_ELEMENT_LONG(pGraphicsArr[i].bAllowDelete, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("AddNewPoint")); SET_ELEMENT_LONG(pGraphicsArr[i].bAllowAddNewPoint, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("AllowModifySize")); SET_ELEMENT_LONG(pGraphicsArr[i].bAllowModifySize, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("ArrowType")); SET_ELEMENT_LONG(pGraphicsArr[i].ulArrowType, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("KeepHorizon")); SET_ELEMENT_LONG(pGraphicsArr[i].bKeepHorizon, val, xmlGraphics); xmlGraphics.OutOfElem(); } xmlGraphics.OutOfElem(); xmlGraphics.OutOfElem(); return IVS_SUCCEED; }
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; }
IVS_INT32 CMediaXMLProcess::GetURLXML(const ST_URL_MEDIA_INFO& stUrlMediaInfo, const ST_SRU_LOGIN_RSP& /*stSRULoginRsp*/, CXml &xml) { IVS_DEBUG_TRACE(""); (void)xml.AddDeclaration("1.0","UTF-8",""); (void)xml.AddElem("Content"); if ( 0 != strlen(stUrlMediaInfo.cDomainCode)) { (void)xml.AddChildElem("DomainCode"); (void)(xml.IntoElem()); (void)xml.SetElemValue(stUrlMediaInfo.cDomainCode); (void)xml.AddElem("MediaInfo"); (void)xml.IntoElem(); } else { (void)xml.AddChildElem("MediaInfo"); (void)xml.IntoElem(); } // { (void)xml.AddChildElem("ServiceType"); (void)xml.IntoElem(); (void)xml.SetElemValue(CToolsHelp::Int2Str(stUrlMediaInfo.ServiceType).c_str()); (void)xml.AddElem("SrcCode"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szSrcCode); (void)xml.AddElem("DstCode"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szDstCode); const IVS_MEDIA_PARA& stMediaPara = stUrlMediaInfo.MediaPara; std::string strStreamType = CToolsHelp::Int2Str(stMediaPara.StreamType); (void)xml.AddElem("StreamID"); (void)xml.IntoElem(); (void)xml.SetElemValue(strStreamType.c_str()); (void)xml.AddElem("DstTP"); (void)xml.IntoElem(); std::string strProtocolType = CToolsHelp::Int2Str(stMediaPara.ProtocolType); (void)xml.SetElemValue(strProtocolType.c_str()); (void)xml.AddElem("DstPP"); (void)xml.IntoElem(); std::string strPP = CToolsHelp::Int2Str(PACK_PROTOCOL_ES); (void)xml.SetElemValue(strPP.c_str()); (void)xml.AddElem("DstCast"); (void)xml.IntoElem(); std::string strBroadcastType = CToolsHelp::Int2Str(stMediaPara.BroadCastType); (void)xml.SetElemValue(strBroadcastType.c_str()); (void)xml.AddElem("DstIP"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szDstIP); (void)xml.AddElem("DstPort"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szDstPort); if(stUrlMediaInfo.ServiceType != SERVICE_TYPE_AUDIO_CALL && stUrlMediaInfo.ServiceType != SERVICE_TYPE_AUDIO_BROADCAST) { (void)xml.AddElem("VMedia"); (void)xml.IntoElem(); // 视频格式改为由MU去数据库中查,SDK只把MP的视频解码能力通知给MU std::string strVideoDecType = IVS_C02_VIDEO_DEC_ABILITY; (void)xml.SetElemValue(strVideoDecType.c_str()); } (void)xml.AddElem("AMedia"); (void)xml.IntoElem(); // 音频格式改为由MU去数据库中查,SDK只把MP的音频解码能力通知给MU std::string strAudioDecType = IVS_C02_AUDIO_DEC_ABILITY; (void)xml.SetElemValue(strAudioDecType.c_str()); if(SERVICE_TYPE_PLAYBACK == stUrlMediaInfo.ServiceType || SERVICE_TYPE_PU_PLAYBACK == stUrlMediaInfo.ServiceType || SERVICE_TYPE_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_PU_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_BACKUPRECORD_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_BACKUPRECORD_PLAYBACK == stUrlMediaInfo.ServiceType // add by lilongxin || SERVICE_TYPE_DISASTEBACKUP_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_DISASTEBACKUP_PLAYBACK == stUrlMediaInfo.ServiceType ) { (void)xml.AddElem("TimeSpan"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szTimeSpan); //add by c00206592 添加NVRCode if (0 != strlen(stUrlMediaInfo.szNVRCode)) { (void)xml.AddElem("NVRCode"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szNVRCode); } //end add } (void)xml.AddElem("TransMode"); (void)xml.IntoElem(); std::string strTransMode = CToolsHelp::Int2Str(stMediaPara.TransMode); (void)xml.SetElemValue(strTransMode.c_str()); if(0!=stUrlMediaInfo.iClientType) { std::string strClientType = CToolsHelp::Int2Str(stUrlMediaInfo.iClientType); (void)xml.AddElem("ClientType"); (void)xml.IntoElem(); (void)xml.SetElemValue(strClientType.c_str()); } if(strlen(stUrlMediaInfo.szEncryAlgorithm)>0) { (void)xml.AddElem("EncryAlgorithm"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szEncryAlgorithm); } if(SERVICE_TYPE_PLAYBACK == stUrlMediaInfo.ServiceType || SERVICE_TYPE_PU_PLAYBACK == stUrlMediaInfo.ServiceType || SERVICE_TYPE_PU_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_BACKUPRECORD_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_BACKUPRECORD_PLAYBACK == stUrlMediaInfo.ServiceType // add by lilongxin || SERVICE_TYPE_DISASTEBACKUP_DOWNLOAD == stUrlMediaInfo.ServiceType || SERVICE_TYPE_DISASTEBACKUP_PLAYBACK == stUrlMediaInfo.ServiceType ) { (void)xml.AddElem("FileName"); (void)xml.IntoElem(); (void)xml.SetElemValue(stUrlMediaInfo.szFileName); } xml.OutOfElem(); //} return IVS_SUCCEED; }