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

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

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

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

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

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

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

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

	if (eLTE_SDK_ERR_SUCCESS != iRet)
	{
		LOG_RUN_ERROR("GetPacketData failed.");
	}
	return iRet;
}
コード例 #2
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
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;
}
コード例 #3
0
// 联动动作停止通知
int CSDKMainctrl::StopLinkageAction(CCmd* pCmd)const
{	
    // 获取通知内容
	CHECK_POINTER(pCmd, IVS_OPERATE_MEMORY_ERROR);
	IVS_CHAR* pData = CSDKMainService::ProcessMAUCmd(pCmd);
	CHECK_POINTER(pData, IVS_OPERATE_MEMORY_ERROR);

	int iSessionID = CLinkRouteMgr::instance().FindSessionIDByLinkID(pCmd->GetNetLinkID());  //lint !e1013 !e1055 !e746 !e64
	if (SDK_SESSIONID_INIT == iSessionID)
	{
		BP_RUN_LOG_ERR(IVS_SDK_RET_INVALID_SESSION_ID, "Stop linkage action", "iSessionID = %d", iSessionID);
		IVS_DELETE(pData, MUILI);
		return IVS_FAIL;
	}

	CXml xml;
	const IVS_CHAR* pDataXml = NULL;
	IVS_INT32 iRet = ModifyDevCode(xml, pData);

	if (IVS_SUCCEED != iRet)
	{
		IVS_DELETE(pData, MUILI);
		return iRet;
	}
	IVS_UINT32 uiXMLLen = 0;
	pDataXml = xml.GetXMLStream(uiXMLLen);

	IVS_DELETE(pData, MUILI);
	CHECK_POINTER(pDataXml, IVS_OPERATE_MEMORY_ERROR);

    CEventCallBackJob::instance().PostEvent(iSessionID, IVS_EVENT_STOP_LINKAGE_ACTION, pDataXml, static_cast<IVS_INT32>(strlen(pDataXml)) + 1);
    return IVS_SUCCEED;
}
コード例 #4
0
 // 实现外域发送消息公共方法(支持重定向)
 IVS_INT32 CXmlProcess::GetCommSendMgrForRedirect(CXml &xml, CUserMgr* pUserMgr, NSS_MSG_TYPE_E msgType, IVS_INT32 iType, const IVS_CHAR* pCameraCode,const IVS_CHAR* pDomainCode)
 {
	 CHECK_POINTER(pDomainCode, IVS_OPERATE_MEMORY_ERROR);
	 CHECK_POINTER(pUserMgr, IVS_OPERATE_MEMORY_ERROR);

	 IVS_UINT32 xmlLen = 0;
	 const IVS_CHAR* pReq = xml.GetXMLStream(xmlLen);
	 CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

	 BP_RUN_LOG_INF("Get CommSendMgr For Redirect", "send XML = %s", pReq);

	 // 构造带域的请求消息,并发送
	 CSendNssMsgInfo sendNssMsgInfo;
	 sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
	 sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
	 sendNssMsgInfo.SetReqID(msgType);
	 sendNssMsgInfo.SetReqData(pReq);
	 sendNssMsgInfo.SetCameraCode(pCameraCode);
	 sendNssMsgInfo.SetDomainCode(pDomainCode);
	 std::string strpRsp;
	 IVS_INT32 iNeedRedirect = IVS_FAIL;
	 IVS_INT32 iRet = pUserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);

     if (IVS_SUCCEED != iRet)
     {
          BP_RUN_LOG_ERR(iRet,"Get CommSendMgr For Redirect", "seng cmd fail");
          return iRet;
     }

	 if(NSS_GET_VOICE_INFO_REQ == msgType || NSS_GET_CAMERA_CFG_REQ == msgType)
	 {
		 if (IVS_SUCCEED == iNeedRedirect)
		 {
			 iRet = pUserMgr->SendRedirectServe(sendNssMsgInfo,strpRsp);
		 }
	 }

	 // 返回相应消息
	 if (BUILSTRING == iType)
	 {
		 if (strpRsp.empty())
		 {
			 BP_RUN_LOG_ERR(iRet,"NULL == strpRsp", "iRet = %d", iRet);
			 return iRet;
		 }
		 if(iRet == IVS_SUCCEED)
		 { 
			 iRet = IVS_XML_INVALID;
			 xml.RemoveElem();
			 if(xml.Parse(strpRsp.c_str()))
			 {
				 iRet = IVS_SUCCEED;
			 }
		 }
		 BP_RUN_LOG_INF("Get CommSendMgr For Redirect", "revice XML = %s", strpRsp.c_str());
	 }

	 return iRet;
 }
コード例 #5
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
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;
}
コード例 #6
0
// 增加角色
IVS_INT32 CRoleMgr::AddRole(const IVS_ROLE_INFO* pRoleInfo, IVS_UINT32* puiRoleID)
{
    //空校验
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pRoleInfo, IVS_PARA_INVALID);

    IVS_DEBUG_TRACE("");

    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    std::string strDomainCode;
    // 防止域编码达到临界值无结束符“\0” modify by xiongfeng
    char cDomainCodeTmp[IVS_DOMAIN_CODE_LEN + 1] = {0};
    (void)CToolsHelp::Memcpy(cDomainCodeTmp, IVS_DOMAIN_CODE_LEN, pRoleInfo->cDomainCode, IVS_DOMAIN_CODE_LEN);
    strDomainCode = cDomainCodeTmp;
    if (strDomainCode.empty())
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }

    CUserInfoMgrXMLProcess::GetRoleXML(strDomainCode.c_str(), pRoleInfo, xmlReq);
    IVS_UINT32 xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_ADD_ROLE_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    //发送请求
    std::string strRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Add Role","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(strRsp.c_str(), IVS_OPERATE_MEMORY_ERROR);
    CXml xmlRsp;
    if(!xmlRsp.Parse(strRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Add Role", "xml parsing error");

        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::AddRoleParseXML(xmlRsp, puiRoleID);

    return iRet;
}
コード例 #7
0
// 构建去选中图形消息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;
}
コード例 #8
0
// 查询角色列表
IVS_INT32 CRoleMgr::GetRoleList(const IVS_CHAR* pDomainCode, const IVS_INDEX_RANGE* pIndexRange, IVS_ROLE_INFO_LIST* pRoleInfoList, IVS_UINT32 /*uiBufferSize*/)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pIndexRange, IVS_PARA_INVALID);
    CHECK_POINTER(pRoleInfoList, IVS_PARA_INVALID);
    IVS_DEBUG_TRACE("");

    std::string strDomainCode;
    if ( NULL == pDomainCode || '\0' == pDomainCode[0])
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }
    else
    {
        strDomainCode = pDomainCode;
    }

    //构造请求xml
    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::CommDomainCodeXml(strDomainCode.c_str(), xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_GET_ROLE_LIST_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    std::string strpRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Main DeviceList fail","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(strpRsp.c_str(), IVS_XML_INVALID);
    CXml xmlRsp;
    if(!xmlRsp.Parse(strpRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get Role List", "xml parsing error");
        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::GetRoleListParseXML(xmlRsp, pRoleInfoList);

    return iRet;
}
コード例 #9
0
IVS_INT32 CXmlProcess::GetCommBuildRet( CXml &xml, NSS_MSG_TYPE_E msgType, IVS_INT32 iType, const std::string& strLinkID)
{
    IVS_UINT32 xmlLen = 0;
    const IVS_CHAR* pReq = xml.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

	BP_RUN_LOG_INF("COCXXmlProcess::GetCommBuildRet", "send XML = %s", pReq);
    //创建要发送的CMD,拼装了NSS消息头
    CCmd* pCmd = CNSSOperator::instance().BuildSMUCmd(msgType, pReq, strLinkID);
    CHECK_POINTER(pCmd, IVS_SDK_RET_BP_CMD_REQ_INVALID);

    //发送消息
    CCmd *pCmdRsp = CNSSOperator::instance().SendSyncCmd(pCmd);
    CHECK_POINTER(pCmdRsp, IVS_NET_RECV_TIMEOUT);

    //返回响应消息
    IVS_INT32 iRet = IVS_SUCCEED;
    const IVS_CHAR* pRsp = NULL;
    if (BUILDRET == iType)
    {
        iRet = CNSSOperator::instance().ParseCmd2NSS(pCmdRsp);
    }
    else
    {
        pRsp = CNSSOperator::instance().ParseCmd2XML(pCmdRsp, iRet);        
    }
	BP_RUN_LOG_INF("GetCommBuildRet", "revice XML = %s", pRsp);

    HW_DELETE(pCmdRsp);
    if (BUILSTRING == iType)
    {
        if (NULL == pRsp)
        {
            BP_RUN_LOG_ERR(iRet,"NULL == pRsp", "iRet = %d", iRet);
            return iRet;
        }

        if(iRet == IVS_SUCCEED)
        { 
            iRet = IVS_XML_INVALID;
            xml.RemoveElem();
            if(xml.Parse(pRsp))
            {
                iRet = IVS_SUCCEED;
            }
            IVS_DELETE(pRsp, MUILI);
        }
    }
    BP_RUN_LOG_INF("GetCommBuildRet", "iType = %d,iRet = %d", iType, iRet);
	return iRet;
}
コード例 #10
0
// 根据用户ID获取角色详细信息
IVS_INT32 CRoleMgr::GetRoleInfoByUserID(const IVS_CHAR* pDomainCode, IVS_UINT32 uiUserID, IVS_ROLE_INFO* pRoleInfo)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pRoleInfo, IVS_PARA_INVALID);
    IVS_DEBUG_TRACE("");

    std::string sDomainCode;
    if(NULL == pDomainCode)
    {
        m_UserMgr->GetDomainCode(sDomainCode);
    }
    else
    {
        sDomainCode = pDomainCode;
    }

    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::GetUserInfoGetXML(sDomainCode.c_str(), uiUserID, xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_GET_USER_ROLE_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(sDomainCode);
    std::string strpRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Role Info By UserID","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(strpRsp.c_str(), IVS_OPERATE_MEMORY_ERROR);

    CXml xmlRsp;
    if(!xmlRsp.Parse(strpRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get RoleInfo By UserID", "xml parsing error");
        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::GetRoleInfoParseXML(xmlRsp, pRoleInfo); 

    return iRet;
}
コード例 #11
0
// 获取用户权限信息
IVS_INT32 CRoleMgr::GetOperationRightGroup(const IVS_CHAR* pDomainCode, IVS_OPERATION_RIGHT_GROUP_LIST* pRightGroupList)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    IVS_DEBUG_TRACE("");

    std::string strDomainCode;
    if(NULL == pDomainCode || '\0' == pDomainCode[0])
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }
    else
    {
        strDomainCode = pDomainCode;
    }

    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::CommDomainCodeXml(strDomainCode.c_str(), xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_GET_ALL_OP_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    std::string sRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,sRsp,iNeedRedirect);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Operation Right Group","SendCmd to SMU Return Failed");
        return  iRet;
    }

    //CHECK_POINTER(sRsp.c_str(), IVS_OPERATE_MEMORY_ERROR);

    CXml xmlRsp;
    if(!xmlRsp.Parse(sRsp.c_str()))
    {
        BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get Operation Right Group", "xml parsing error");
        return IVS_XML_INVALID;
    }
    iRet = CUserInfoMgrXMLProcess::GetOperationRightGroupParseXML(xmlRsp, pRightGroupList); 

    return iRet;
}
コード例 #12
0
ファイル: MediaMgr.cpp プロジェクト: eSDK/esdk_elte
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;
}
コード例 #13
0
ファイル: MediaMgr.cpp プロジェクト: eSDK/esdk_elte
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;
}
コード例 #14
0
 //获取平台录像计划;
 IVS_INT32 CRecordPlanMgr::GetRecordPlan(const char* pCameraCode,IVS_UINT32 uiRecordMethod,
	 IVS_RECORD_PLAN* pRecordPlan)
 {
	 CHECK_POINTER(pCameraCode, IVS_PARA_INVALID);
	 CHECK_POINTER(pRecordPlan, IVS_PARA_INVALID);
	 CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
	 IVS_DEBUG_TRACE("");
	 //数据结构拼装XML并转换为const IVS_CHAR *
	 CXml xmlReq;
	 IVS_INT32 iRet = CRecordXMLProcess::GetRecordPlanGetXML(pCameraCode, uiRecordMethod, xmlReq);

	 unsigned int xmlLen = 0;
	 const IVS_CHAR * pReqPlan = xmlReq.GetXMLStream(xmlLen);
	 CHECK_POINTER(pReqPlan, IVS_OPERATE_MEMORY_ERROR);

	 IVS_CHAR chDevCode[IVS_DEV_CODE_LEN+1];
	 memset(chDevCode, 0, sizeof(chDevCode));

	 IVS_CHAR chDomaCode[IVS_DOMAIN_CODE_LEN+1];
	 memset(chDomaCode, 0, sizeof(chDomaCode));

	 (IVS_VOID)CXmlProcess::ParseDevCode(pCameraCode, chDevCode, chDomaCode);
	 //发送nss协议
	 CSendNssMsgInfo sendNssMsgInfo;	
	 sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
	 sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
	 sendNssMsgInfo.SetReqID(NSS_GET_RECORD_PLAN_REQ);
	 sendNssMsgInfo.SetReqData(pReqPlan); 
	 sendNssMsgInfo.SetCameraCode(chDevCode);
	 sendNssMsgInfo.SetDomainCode(chDomaCode);

	 std::string strpRsp;
	 IVS_INT32 iNeedRedirect = IVS_FAIL;
	 iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
	 if(IVS_SUCCEED != iRet)
	 {
		 BP_RUN_LOG_INF("Get Platform Record Plan", "ok", "Get Platform RecordPlan Success.pResultList size is 0.");
		 return iRet;
	 }

	 // 将xml转化成结构体返回
	 CXml xmlRsp;
	 (void)xmlRsp.Parse(strpRsp.c_str());
	 IVS_INT32 iParseRSPRet = CRecordXMLProcess::GetRecordPlanParseRSP(pRecordPlan,xmlRsp);

	 BP_RUN_LOG_INF("Get Record Plan", "ok", "msg have Parsed");
	 return iRet;
 }//lint !e1762 !e818 !e529
コード例 #15
0
// 构建选中图形消息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;
}
コード例 #16
0
// 删除角色
IVS_INT32 CRoleMgr::DeleteRole(const IVS_CHAR* pDomainCode, IVS_UINT32 uiRoleID)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    IVS_DEBUG_TRACE("");

    std::string strDomainCode;
    if(NULL == pDomainCode || '\0' == pDomainCode[0])
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }
    else
    {
        strDomainCode = pDomainCode;
    }

    IVS_ROLE_INFO pRoleInfo;
    memset(&pRoleInfo, 0, sizeof(IVS_ROLE_INFO));
    pRoleInfo.uiRoleID = uiRoleID;

    //拼接请求信息
    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::GetRoleXML(strDomainCode.c_str(), &pRoleInfo, xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_NOXML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_DEL_ROLE_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    std::string strpRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);

    return iRet;
}
コード例 #17
0
// 修改角色
IVS_INT32 CRoleMgr::ModifyRole(const IVS_ROLE_INFO* pRoleInfo)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pRoleInfo, IVS_PARA_INVALID);
    IVS_DEBUG_TRACE("");

    // 防止域编码达到临界值无结束符“\0” modify by xiongfeng
    std::string strDomainCode;
    char cDomainCodeTmp[IVS_DOMAIN_CODE_LEN + 1] = {0};
    (void)CToolsHelp::Memcpy(cDomainCodeTmp, IVS_DOMAIN_CODE_LEN, pRoleInfo->cDomainCode, IVS_DOMAIN_CODE_LEN);
    strDomainCode = cDomainCodeTmp;
    if (strDomainCode.empty())
    {
        m_UserMgr->GetDomainCode(strDomainCode);
    }

    //拼接修改角色xml请求
    IVS_INT32 iRet = IVS_FAIL;
    CXml xmlReq;
    CUserInfoMgrXMLProcess::GetRoleXML(strDomainCode.c_str(), pRoleInfo, xmlReq);
    unsigned int xmlLen = 0;
    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

    // 构造带域的请求消息,并发送
    CSendNssMsgInfo sendNssMsgInfo;
    sendNssMsgInfo.SetNeedXml(TYPE_NSS_NOXML);
    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
    sendNssMsgInfo.SetReqID(NSS_MOD_ROLE_REQ);
    sendNssMsgInfo.SetReqData(pReq);
    sendNssMsgInfo.SetDomainCode(strDomainCode);
    std::string strpRsp;
    IVS_INT32 iNeedRedirect = IVS_FAIL;
    iRet = m_UserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);

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

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

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

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

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

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

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

	return iRet;
}//lint !e1762
コード例 #19
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
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;
}
コード例 #20
0
ファイル: XMLProcess.cpp プロジェクト: eSDK/esdk_elte
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;
}
コード例 #21
0
// 查询设备组列表
IVS_INT32 CDeviceGroupMgr::GetDeviceGroup(const IVS_CHAR* pDomainCode,
                                          const IVS_CHAR* pDevGroupCode,
                                          IVS_DEVICE_GROUP_LIST* pDeviceGroupList,
                                          IVS_UINT32 uiBufferSize)
{
    CHECK_POINTER(m_pUserMgr, IVS_OPERATE_MEMORY_ERROR);
    CHECK_POINTER(pDeviceGroupList, IVS_OPERATE_MEMORY_ERROR);
	IVS_DEBUG_TRACE("");

    // 校验内存
	IVS_INT32 iRet = IVS_FAIL;
	IVS_UINT32 uiSize = 0;
	for (IVS_INT32 i = 0; i != 2; i++)//0是本域,1是外部域
	{
		CXml xmlReq;
		(IVS_VOID)CDeviceMgrXMLProcess::GetDeviceGroupXML(i, pDomainCode, pDevGroupCode, xmlReq);

            IVS_UINT32 xmlLen = 0;
	    const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
	    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);
           BP_RUN_LOG_INF("Get CommSendMgr", "send XML = %s", pReq);

	     // 构造带域的请求消息,并发送
	    CSendNssMsgInfo sendNssMsgInfo;
	    sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
	    sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
	    sendNssMsgInfo.SetReqID(NSS_GET_DEV_GROUP_LIST_REQ);
	    sendNssMsgInfo.SetReqData(pReq);	
	    sendNssMsgInfo.SetDomainCode(pDomainCode);
	    std::string strpRsp;
	    IVS_INT32 iNeedRedirect = IVS_FAIL;
	    iRet = m_pUserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
           if (IVS_SUCCEED != iRet && 0 == i)
           {
                BP_RUN_LOG_ERR(iRet, "Get DeviceGroup fail", "SendCmd fail");
                return iRet;
           }           

           CXml xmlRsp;
           if (iRet == IVS_SUCCEED)
           {
                iRet = IVS_XML_INVALID;
                if (xmlRsp.Parse(strpRsp.c_str()))
                {
                    iRet = IVS_SUCCEED;
                }
           }

           if (IVS_SUCCEED != iRet && 0 == i)
           {
                return iRet;
           }
           
           IVS_INT32 iReTurn = iRet;
	    iRet = IVS_SUCCEED;
	    if (IVS_SUCCEED == iReTurn)
           {                   
                iRet = CDeviceMgrXMLProcess::GetDeviceGroupParseXML(uiSize, pDeviceGroupList, uiBufferSize, xmlRsp); 
           }
	}
	pDeviceGroupList->uiTotal = uiSize;

    return iRet;
}
コード例 #22
0
// 查询摄像机计划设置信息
IVS_INT32 CRecordPlanMgr::GetCameraPlanInfo(IVS_UINT32 uiPlanType, IVS_CHAR** pRspXml)
{
    CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
    IVS_DEBUG_TRACE("");

    IVS_INT32 iRet = IVS_FAIL;
    std::vector<std::string> domainCodeList;
    domainCodeList.clear();
    iRet = m_UserMgr->GetDeviceMgr().GetDomainListByUserID(domainCodeList);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Domain List By User ID","Failed");
        return iRet;
    }

    CmdMap cmdMap;

    std::map<std::string, std::string> domainCodeMap;
    std::map<std::string, std::string>::iterator domainCodeMapIter;
    IVS_UINT32 iSize = domainCodeList.size();
    for(IVS_UINT32 i = 0; i < iSize; i++)
    {
        std::string strDomainCode = domainCodeList.at(i);

        CXml xmlReq;
        CRecordXMLProcess::GetCameraPlanInfoGetXML(uiPlanType, strDomainCode.c_str(), xmlReq);
        IVS_UINT32 xmlLen = 0;
        const IVS_CHAR* pReq = xmlReq.GetXMLStream(xmlLen);
        CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

        // 构造带域的请求消息,并发送
        CSendNssMsgInfo sendNssMsgInfo;
        sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
        sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
        sendNssMsgInfo.SetReqID(NSS_GET_CAMERA_PLAN_INFO_REQ);
        sendNssMsgInfo.SetReqData(pReq);
        sendNssMsgInfo.SetDomainCode(strDomainCode);

        CCmd *pCmd = m_UserMgr->BuildCmd(sendNssMsgInfo);
		if (NULL == pCmd)
		{
			BP_RUN_LOG_INF("build cmd error","cmd req id=%d, domain code=%s",NSS_GET_CAMERA_PLAN_INFO_REQ,strDomainCode.c_str());
			continue;
		}
        (void)domainCodeMap.insert(std::make_pair(pCmd->GetTransID(), strDomainCode));
        (void)cmdMap.insert(std::make_pair(pCmd->GetTransID(), pCmd));
    }

    if (cmdMap.empty())
    {
        return IVS_SUCCEED;
    }
    IVS_UINT32 uiTimeout = CSDKConfig::instance().GetTimeOutValue();
    iRet = CDispatcher::instance().dispatcherSyncMsgOutBatch(cmdMap, uiTimeout);
    if(IVS_SUCCEED != iRet)
    {
        BP_RUN_LOG_ERR(iRet, "Get Camera Plan Info fail","SendCmd to SMU Return Failed");
        return iRet;
    }

    std::map<std::string, PLAN_INFO_VEC> m_PlanMap;
    CmdMapIterator cmdMapIter;
    std::string strDomainCode;
    CCmd *pCmdRsp = NULL;
    for (cmdMapIter = cmdMap.begin(); cmdMapIter != cmdMap.end(); cmdMapIter++)
    {
        domainCodeMapIter = domainCodeMap.find(cmdMapIter->first);
        if (domainCodeMapIter != domainCodeMap.end())
        {
            strDomainCode = domainCodeMapIter->second;
        }
        if(strDomainCode.empty())
        {
            continue;
        }

        pCmdRsp = static_cast<CCmd *>(cmdMapIter->second);//lint !e63
        IVS_CHAR* pRsp = CNSSOperator::instance().ParseCmd2XML(pCmdRsp, iRet);

        if (NULL == pRsp)
        {
            continue;
        }
        CXml xmlRsp;
        if(!xmlRsp.Parse(pRsp))        
        {
            BP_RUN_LOG_ERR(IVS_XML_INVALID, "Get Camera Plan Info", "xml parsing error");
            continue;
        }
        PLAN_INFO_VEC m_PlanList;
        m_PlanList.clear();
        iRet = CRecordXMLProcess::GetCameraPlanInfoParseXML(xmlRsp, m_PlanList);
        if(IVS_SUCCEED != iRet)
        {
            BP_RUN_LOG_ERR(iRet, "Get Camera PlanInfo ParseXML", "xml parsing error");
            continue;
        }
        (void)m_PlanMap.insert(std::make_pair(strDomainCode, m_PlanList));
    }
    CXml rspXml;
    CRecordXMLProcess::GetCameraPlanInfoGetXml(m_PlanMap, rspXml);
    IVS_UINT32 iLen = 0;

    const IVS_CHAR* pRsq = rspXml.GetXMLStream(iLen);
    IVS_DELETE(*pRspXml, MUILI);
    CHECK_POINTER(pRsq, IVS_OPERATE_MEMORY_ERROR);
    IVS_CHAR* pResult = IVS_NEW(pResult, strlen(pRsq) + 1);
    memset(pResult, 0x0, strlen(pRsq) + 1);
    if (!CToolsHelp::Memcpy(pResult, strlen(pRsq) + 1, pRsq, strlen(pRsq) + 1))
    {
        BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR, "CToolsHelp::Memcpy pRsq to pResult failed", "NA");
        return IVS_ALLOC_MEMORY_ERROR;
    }
    *pRspXml = pResult;

    return iRet;
}
コード例 #23
0
 //删除平台录像计划;
IVS_INT32 CRecordPlanMgr::DeleteRecordPlan(IVS_UINT32 uiDeviceNum,const IVS_DEVICE_CODE* pDeviceList,
	IVS_UINT32 uiRecordMethod,IVS_RESULT_LIST* pResultList,IVS_UINT32 uiResultBufferSize)const
 {
	 CHECK_POINTER(pDeviceList, IVS_PARA_INVALID);
	 CHECK_POINTER(pResultList, IVS_PARA_INVALID);
	 CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
	 IVS_DEBUG_TRACE("");
 	
	DeviceCodeMap deviceCodeMap;
	std::string strSendDomainCode;
	CCmd *pCmd = NULL;
	CmdMap cmdMap;
	IVS_INT32 iRet = m_UserMgr->RecollectCameraDomainCodes2Map(uiDeviceNum,pDeviceList,deviceCodeMap);

	DeviceCodeMapIterator deviceCodeMapIter = deviceCodeMap.begin();
	DeviceCodeMapIterator deviceCodeMapIterEnd = deviceCodeMap.end();
	for (; deviceCodeMapIter != deviceCodeMapIterEnd; deviceCodeMapIter++)
	{
		DeviceCodeList devList = static_cast<DeviceCodeList>(deviceCodeMapIter->second); //lint !e612 !e69
		strSendDomainCode = deviceCodeMapIter->first;//lint !e612

		//数据结构拼装XML并转换为const IVS_CHAR *
		CXml delRecordPlanXmlReq;
		iRet = CRecordXMLProcess::DelRecordPlanGetXML(strSendDomainCode,devList, uiRecordMethod, delRecordPlanXmlReq);
		unsigned int xmlLen = 0;
		const IVS_CHAR* pReqPlan = delRecordPlanXmlReq.GetXMLStream(xmlLen);
		CHECK_POINTER(pReqPlan, IVS_OPERATE_MEMORY_ERROR);

		//构建发送nss协议
		CSendNssMsgInfo sendNssMsgInfo;	
		sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
		sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
		sendNssMsgInfo.SetReqID(NSS_DEL_RECORD_PLAN_REQ);
		sendNssMsgInfo.SetReqData(pReqPlan); 
		sendNssMsgInfo.SetDomainCode(strSendDomainCode.c_str());
		pCmd = m_UserMgr->BuildCmd(sendNssMsgInfo);
		if (NULL == pCmd)
		{
			BP_RUN_LOG_INF("build cmd error","cmd req id=%d, domain code=%s",NSS_DEL_RECORD_PLAN_REQ,strSendDomainCode.c_str());
			continue;
		}
		(void)cmdMap.insert(std::make_pair(pCmd->GetTransID(), pCmd));
	}
	if (cmdMap.empty())
	{
		return IVS_SUCCEED;
	}

	std::string strpRsp;
	IVS_UINT32 uiTimeOut =  CSDKConfig::instance().GetTimeOutValue();
	iRet = CDispatcher::instance().dispatcherSyncMsgOutBatch(cmdMap, uiTimeOut);

	//IVS_UINT32 iSize = deviceCodeMap.size();	
	IVS_INT32 iEachRet = 0;
	IVS_UINT32 iFailCount = 0;
	IVS_UINT32 uiRecordNum = 0;
	CmdMapIterator cmdMapIter;
	for (cmdMapIter = cmdMap.begin(); cmdMapIter != cmdMap.end(); cmdMapIter++)
	{
		CCmd *pCmdRsp = cmdMapIter->second; //lint !e612
		if(NULL != pCmdRsp)
		{
			IVS_CHAR* pRsp = CNSSOperator::instance().ParseCmd2XML(pCmdRsp,iEachRet);
			if (IVS_SUCCEED != iEachRet)
			{
				iFailCount++;
				iRet = iEachRet;
				BP_RUN_LOG_ERR(iEachRet, "Delete Record Plan", "Parse Cmd 2XML failed,rspCode = %d", iEachRet);

				// 解析响应的xml
				CXml xmlRsp;
				if (NULL != pRsp && xmlRsp.Parse(pRsp))
				{
					iEachRet = CRecordXMLProcess::RecordPlanParseRSP(uiDeviceNum,pDeviceList,pResultList,uiResultBufferSize,xmlRsp,uiRecordNum);
				}
			}
		}
	}

	if(iFailCount >0)
	{
		//iRet = IVS_FAIL;
		BP_RUN_LOG_ERR(iRet, "Delete Platform Record Plan", "Delete Platform Record Plan in some Domains failed.");
		return iRet;
	}

	BP_RUN_LOG_INF("Delete Record Plan", "ok", "msg have Parsed");
 	return IVS_SUCCEED;
 }//lint !e529
コード例 #24
0
//添加平台录像计划;
IVS_INT32 CRecordPlanMgr::AddRecordPlan(IVS_UINT32 uiDeviceNum,const IVS_DEVICE_CODE* pDeviceList,
	const IVS_RECORD_PLAN* pRecordPlan,IVS_RESULT_LIST* pResultList,IVS_UINT32 uiResultBufferSize)const
{
	CHECK_POINTER(pDeviceList, IVS_PARA_INVALID);
	CHECK_POINTER(pRecordPlan, IVS_PARA_INVALID);
	CHECK_POINTER(pResultList, IVS_PARA_INVALID);
	CHECK_POINTER(m_UserMgr, IVS_OPERATE_MEMORY_ERROR);
	IVS_DEBUG_TRACE("");

	IVS_UINT32 uiReqBufSize = sizeof(IVS_RESULT_LIST) + (uiDeviceNum-1)*sizeof(IVS_RESULT_INFO);
	if (uiReqBufSize > uiResultBufferSize)
	{
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "Add Record Plan", "Invalid DeviceNum or BufferSize");
		return IVS_PARA_INVALID;
	}

	if ((RECORD_PLAN_ALLDAY < pRecordPlan->uiRecordPlanType) ||
		(PLAN_WEEK == pRecordPlan->uiRecordPlanType && 7 < pRecordPlan->uiPlanInfoNum) ||
		(PLAN_DAY == pRecordPlan->uiRecordPlanType && 1 != pRecordPlan->uiPlanInfoNum) ||
		(PLAN_ALLDAY == pRecordPlan->uiRecordPlanType && 0 != pRecordPlan->uiPlanInfoNum))
	{
		pResultList->uiNum = uiDeviceNum;
		for (IVS_UINT32 i=0; i<pResultList->uiNum; i++)
		{
			pResultList->stInfo[i].uiSequence = i;
			pResultList->stInfo[i].iResult = IVS_PARA_INVALID;
			strncpy(pResultList->stInfo[i].cCode, pDeviceList[i].cDevCode, IVS_DEV_CODE_LEN);
		}
		BP_RUN_LOG_ERR(IVS_PARA_INVALID, "Add Record Plan", "Invalid PlanType or PlanInfoNum");
		return IVS_PARA_INVALID;
	}

	DeviceCodeMap deviceCodeMap;
	std::string strSendDomainCode;
	CmdMap cmdMap;
	CCmd *pCmd = NULL;
	IVS_INT32 iRet = m_UserMgr->RecollectCameraDomainCodes2Map(uiDeviceNum,pDeviceList,deviceCodeMap);

	DeviceCodeMapIterator deviceCodeMapIter = deviceCodeMap.begin();
	DeviceCodeMapIterator deviceCodeMapIterEnd = deviceCodeMap.end();
	for (; deviceCodeMapIter != deviceCodeMapIterEnd; deviceCodeMapIter++)
	{
		DeviceCodeList devList = static_cast<DeviceCodeList>(deviceCodeMapIter->second); //lint !e612 !e69
		strSendDomainCode = deviceCodeMapIter->first;//lint !e612

		//数据结构拼装XML并转换为const IVS_CHAR *
		CXml addRecordPlanXmlReq;
		iRet = CRecordXMLProcess::AddOrModRecordPlanGetXML(strSendDomainCode,devList, pRecordPlan, addRecordPlanXmlReq);
		if (IVS_SUCCEED != iRet)
		{
			pResultList->uiNum = uiDeviceNum;
			for (IVS_UINT32 i=0; i<pResultList->uiNum; i++)
			{
				pResultList->stInfo[i].uiSequence = i;
				pResultList->stInfo[i].iResult = iRet;
				strncpy(pResultList->stInfo[i].cCode, pDeviceList[i].cDevCode, IVS_DEV_CODE_LEN);
			}
			BP_RUN_LOG_ERR(iRet, "Add Record Plan", "Add Or Mod Record Plan Get XML failed");
			return iRet;
		}
		unsigned int xmlLen = 0;
		const IVS_CHAR* pReqPlan = addRecordPlanXmlReq.GetXMLStream(xmlLen);
		CHECK_POINTER(pReqPlan, IVS_OPERATE_MEMORY_ERROR);
		BP_DBG_LOG("ReqPlan:%s\n", pReqPlan);

		//构建发送nss协议
		CSendNssMsgInfo sendNssMsgInfo;	
		sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
		sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
		sendNssMsgInfo.SetReqID(NSS_MOD_RECORD_PLAN_REQ);
		sendNssMsgInfo.SetReqData(pReqPlan); 
		sendNssMsgInfo.SetDomainCode(strSendDomainCode.c_str());
		pCmd = m_UserMgr->BuildCmd(sendNssMsgInfo);
		if (NULL == pCmd)
		{
			BP_RUN_LOG_INF("build cmd error","cmd req id=%d, domain code=%s",NSS_MOD_RECORD_PLAN_REQ,strSendDomainCode.c_str());
			continue;
		}
		(void)cmdMap.insert(std::make_pair(pCmd->GetTransID(), pCmd));
	}
	if (cmdMap.empty())
	{
		return IVS_SUCCEED;
	}

	IVS_UINT32 uiTimeOut =  CSDKConfig::instance().GetTimeOutValue();
	std::string strpRsp;
	iRet = CDispatcher::instance().dispatcherSyncMsgOutBatch(cmdMap, uiTimeOut);

	//IVS_UINT32 iSize = deviceCodeMap.size();	
	IVS_INT32 iEachRet = 0;
	IVS_UINT32 iFailCount = 0;
	IVS_UINT32 uiRecordNum = 0;
	CmdMapIterator cmdMapIter = cmdMap.begin();
	for (; cmdMapIter != cmdMap.end(); cmdMapIter++)
	{
		CCmd *pCmdRsp = cmdMapIter->second; //lint !e612
		if(NULL != pCmdRsp)
		{
			IVS_CHAR* pRsp = CNSSOperator::instance().ParseCmd2XML(pCmdRsp,iEachRet);
			if (IVS_SUCCEED != iEachRet)
			{
				iFailCount++;
				iRet = iEachRet;
				BP_RUN_LOG_ERR(iEachRet, "Add Record Plan", "Parse Cmd 2XML failed,rspCode = %d", iEachRet);

				// 解析响应的xml
				CXml xmlRsp;
				if (NULL != pRsp && xmlRsp.Parse(pRsp))
				{
					iEachRet = CRecordXMLProcess::RecordPlanParseRSP(uiDeviceNum,pDeviceList,pResultList,uiResultBufferSize,xmlRsp,uiRecordNum);
				}
			}
		}
	}


	if(iFailCount >0)
	{
		//iRet = IVS_FAIL;
		BP_RUN_LOG_ERR(iRet, "Add Platform Record Plan", "Add Platform Record Plan in some Domains failed.");
		return iRet;
	}

	BP_RUN_LOG_INF("Add Platform Record Plan", "ok", "msg have Parsed");
	return IVS_SUCCEED;
}//lint !e529 
コード例 #25
0
// 查询平台运动检测幅度数据
IVS_INT32 CMotionDetection::GetMotionRangeDataPlatform(const IVS_CHAR* pCameraCode,const IVS_TIME_SPAN* pTimeSpan,const IVS_INDEX_RANGE* pIndexRange,IVS_MOTION_RANGE_DATA_LIST* pMotionRangeData,IVS_UINT32 uiBufferSize)
{
	CHECK_POINTER(pCameraCode, IVS_OPERATE_MEMORY_ERROR);
	CHECK_POINTER(pTimeSpan, IVS_OPERATE_MEMORY_ERROR);
	CHECK_POINTER(pIndexRange, IVS_OPERATE_MEMORY_ERROR);
	CHECK_POINTER(pMotionRangeData, IVS_OPERATE_MEMORY_ERROR);
	CHECK_POINTER(m_pUserMgr,IVS_OPERATE_MEMORY_ERROR);
	IVS_DEBUG_TRACE("");

	IVS_CHAR szCameraCode[IVS_SDK_DEV_CODE_LEN + 1] = {0};
	IVS_CHAR szDomainCode[IVS_DOMAIN_CODE_LEN + 1] = {0};
	// 解析pCameraCode到摄像机编码和域编码中
	IVS_INT32 iRet = CXmlProcess::ParseDevCode(pCameraCode, szCameraCode, szDomainCode);
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Get Motion Range Data Platform", "Parse Device Code failed");
		return iRet;
	}
	// 拼装请求xml
	CXml xmlReq;
	iRet = CMotionDetecMgrXMLProcess::GetMotionRangeDataPlatformReqXML(szCameraCode,szDomainCode,pTimeSpan,pIndexRange, xmlReq);
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Get Motion Range Data Platform", "Get Motion Range Data Platform Req XML failed");
		return iRet;
	}

	std::string sRecordMethod = "RecordMethod";
	iRet = CXmlProcess::AddQueryFieldForUnifiedFormatQueryXML(sRecordMethod.c_str(),CToolsHelp::Int2Str(RECORD_METHOD_PLATFORM).c_str(), xmlReq);
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Add QueryField For Unified Format Query XML failed", "failed");
		return iRet;
	}

	IVS_UINT32 xmlLen = 0;
	const IVS_CHAR* pReqXml = xmlReq.GetXMLStream(xmlLen);
	CHECK_POINTER(pReqXml, IVS_OPERATE_MEMORY_ERROR);

	CSendNssMsgInfo sendNssMsgInfo;	
	sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
	sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
	sendNssMsgInfo.SetReqID(NSS_GET_MD_DATA_REQ);
	sendNssMsgInfo.SetReqData(pReqXml);
	sendNssMsgInfo.SetCameraCode(szCameraCode);
	sendNssMsgInfo.SetDomainCode(szDomainCode);

	std::string strpRsp;
	IVS_INT32 iNeedRedirect = IVS_FAIL;
	// 发送操作失败,直接返回
	iRet = m_pUserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);
	if (IVS_SUCCEED == iNeedRedirect)
	{
		iRet = m_pUserMgr->SendRedirectServe(sendNssMsgInfo,strpRsp);
	}
	// NSS消息返回码错误,不解析数据,直接返回错误码
	if (IVS_SUCCEED != iRet)
	{
		BP_RUN_LOG_ERR(iRet, "Get Motion Range Data Platform", "SendCmd operation succeed,rspCode = %d", iRet);
		return iRet;
	}

	//解析数据
	CXml xmlRsp;
	(void)xmlRsp.Parse(strpRsp.c_str());
	
	//解析查询请求XML
	if (IVS_SUCCEED != CMotionDetecMgrXMLProcess::ParseGetMotionRangeDataPlatformRspXML(xmlRsp,pMotionRangeData,uiBufferSize))
	{
		BP_RUN_LOG_ERR(IVS_XML_INVALID,"Parse Get Motion Range Data Platform Rsp XML is failed","failed");
		return IVS_XML_INVALID;
	}	
	return iRet;
}