⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ngnsmpit.cpp

📁 AG_SMP_SDC设备接口连接,可以了解AG设备接口连接协议
💻 CPP
字号:
/***************************************************************** (C) Copyright aa* DATE:       2008-3-21* VERSION:    1.0* NOTES:      Implementation file*****************************************************************/#include "ne/NgnSmpIt.hpp"#include "ne/MMLMessage3_1.hpp"#include "ne/NeException.hpp"#include "util/SuperString.hpp"#include <iostream>using namespace std;CNgnSmpIt::CNgnSmpIt(int iPhysicNeId){	_pMMLMessage = new CMMLMessage3_1();	_pMMLMessage->init("MACHINEID=ZXWN1000;HLRAREA=00");//根据中兴要求填写	_strLoggerName = "orig/NgnSmp_" + CSuperString::toString(iPhysicNeId);}CNgnSmpIt::~CNgnSmpIt(){	delete _pMMLMessage;}void CNgnSmpIt::login(const std::string& strUserName,const std::string& strPwd){	string strLoginCmd;	string strResult;	try	{		string strInitMsg;		size_t pos = strUserName.find("||");		if( pos != string::npos )		{			strInitMsg = strUserName.substr(0,pos);			_pMMLMessage->init(strInitMsg);			strLoginCmd = "LOGIN:USER=" + strUserName.substr(pos+2) + ",PSWD=" + strPwd;		}		else		{			throw CNeException(1345, "用户名需配置 服务名等等");		}		strResult = execute(strLoginCmd);		if(strResult.find("RETN=000000") == string::npos)		{			throw CNeException(1345, "用户名或者密码错误");		}		_pMMLMessage->setMsgType(CMMLMessage3_1::CON_MSG);	}	catch(CNeException& e)	{		cout<<"catch a neexception!!!"<<endl;		throw;	}	catch(...)	{		cout<<"catch a other exception!!!"<<endl;		throw;	}}void CNgnSmpIt::logout(){	string strLogoutCmd;	try	{		_pMMLMessage->setMsgType(CMMLMessage3_1::LOGOUT_MSG);		strLogoutCmd = _strLoginSvc + "LOGOUT";		execute(strLogoutCmd);	}	catch(CNeException& e)	{		cout<<"catch a neexception!!!"<<endl;		throw;	}	catch(...)	{		cout<<"catch a other exception!!!"<<endl;		throw;	}}string CNgnSmpIt::instWrapper(const std::string& strCommand){	_pMMLMessage->setServieName(strCommand.substr(0,8));	return	_pMMLMessage->getMsg(strCommand.substr(8));}string CNgnSmpIt::recvReport(){	string 	strRecv;	int 	iReceiveCount;	strRecv = "";	try	{		strRecv += _communicate->recv(8);		int iMsgLength = _pMMLMessage->HEXStrToInt(strRecv.substr(4));		strRecv += _communicate->recv(iMsgLength+8);		_pMMLMessage->analyse(strRecv);	}	catch(CNeException& e)	{		cout << "ERROR" <<  e.GetErrorInfo() << endl;		throw;	}	catch(...)	{		throw CNeException(2990, "接收ZX智能网系统报告失败");	}	toReport(strRecv,false);    return  strRecv;}string CNgnSmpIt::reportAnalyse(const std::string& strReport,const std::string strInst){	string strResult = strReport;	if(strResult.find("RETN=0000") == string::npos)	{		strResult += " ,RETN!=0000";		cout << "结果为" << strResult << endl;	}	return strResult;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -