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

📄 sendthread.cpp

📁 关于联通的一个统一定制程序
💻 CPP
字号:
// SendThread.cpp : implementation file
//

#include "stdafx.h"
#include "SendThread.h"
#include "ICPSConn.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSendThread

IMPLEMENT_DYNCREATE(CSendThread, CWinThread)

CSendThread::CSendThread()
{
}

CSendThread::~CSendThread()
{
}

BOOL CSendThread::InitInstance()
{
	// TODO:  perform and per-thread initialization here
	return TRUE;
}

int CSendThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CSendThread, CWinThread)
	//{{AFX_MSG_MAP(CSendThread)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSendThread message handlers

int CSendThread::Run() 
{
	IOD_Info info;

	while (!theData.m_bServiceExit)
	{
		if (theData.GetOneSendMsg(&info))
			SendSMS(&info);
		else
			Sleep(10);
	}

	return CWinThread::Run();
}

void CSendThread::SendSMS(LPIOD_Info pInfo)
{
	ICPSConn icp = ICPSConn();
	int nRet = icp.SetMsg(pInfo->szDestMobile, 0, pInfo->lMsgLevel, pInfo->szSubID, pInfo->szSubID,
		pInfo->szFeeType, pInfo->szFeeCode, pInfo->szSrcTermID, pInfo->szSrcGWID, _TEXT(""),
		pInfo->lMsgFmt, pInfo->lMsgLen, pInfo->szContent);
	if (nRet != 0)
	{
		theData.WriteLog(LT_ISD, pInfo->szDestMobile, pInfo->szSubID, pInfo->lMsgFmt, pInfo->lMsgLen, pInfo->szContent, pInfo->szFeeMP,
			pInfo->szSrcGWID, pInfo->szSrcTermID, pInfo->lMsgLevel, "", pInfo->szFeeType, pInfo->szFeeCode, nRet, _TEXT("M"));
		return;
	}

	__int8 msgtype=pInfo->lMsgType;
	__int8 desttype=1;
	icp.AddOneTLV(TAG_MESSAGE_TYPE, 1, &msgtype);
	icp.AddOneTLV(TAG_DESTMOBILE_TYPE, 1, &desttype);
//	if (msgtype==0x98 || msgtype==0x99)
		//icp.AddOneTime();
	int nCount;
	TCHAR szResult[200];
	nRet = icp.Submit(theData.theCfgInfo.szRouterIP, theData.theCfgInfo.nRouterPort, nCount, szResult);
	if (nRet != 0 && nRet != 11 && nRet != 12 && nRet != 13 && nRet != 5)
	{
		if (pInfo->nLife < theData.theCfgInfo.nMaxRetryTime)
		{
			pInfo->nLife++;
			pInfo->lTime = CTime::GetCurrentTime().GetTime();
			theData.AddOneSendMsg(pInfo);
		}
		else
			theData.WriteLog(LT_ISD, pInfo->szDestMobile, pInfo->szSubID, pInfo->lMsgFmt, pInfo->lMsgLen, pInfo->szContent, pInfo->szFeeMP,
				pInfo->szSrcGWID, pInfo->szSrcTermID, pInfo->lMsgLevel, "", pInfo->szFeeType, pInfo->szFeeCode, nRet, _TEXT("S"));
	}
	else
		theData.WriteLog(LT_ISS, pInfo->szDestMobile, pInfo->szSubID, pInfo->lMsgFmt, pInfo->lMsgLen, pInfo->szContent, pInfo->szFeeMP,
			pInfo->szSrcGWID, pInfo->szSrcTermID, pInfo->lMsgLevel, "", pInfo->szFeeType, pInfo->szFeeCode, nRet, (nRet==0)?_TEXT(""):_TEXT("S"));
}

⌨️ 快捷键说明

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