亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? smssendrecv.cpp

?? 攔截短消息
?? CPP
字號:
// SMSSendRecv.cpp
//
// Copyright (c) 2003 Symbian Ltd.  All rights reserved.
//

#include "SMSSendRecv.h"

//To get SMS service centre address
#include <SMUTSET.H>  
#include <MSVAPI.H>


#ifdef EKA2
	#include <csmsaccount.h>
#else
	//Observer class, required to get the service centre address before EKA2
	class CObserver : public MMsvSessionObserver
		{
	public:
		void HandleSessionEvent(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
		void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
		};
	void CObserver::HandleSessionEvent(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) {}
	void CObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) {}
#endif


CSMSSender* CSMSSender::NewL()
/**
	Intended Usage: Static factory constructor. Uses two phase 
	construction and leaves nothing on the CleanupStack.

	@returns a new CSMSSender instance.
*/
	{
	CSMSSender* self = NewLC();
	CleanupStack::Pop();
	return self;
	}

CSMSSender* CSMSSender::NewLC()
/**
	Intended Usage: Static factory constructor. Uses two phase 
	construction and leaves a CSMSSender instance on the CleanupStack.

	@returns a new CSMSSender instance.
*/
	{
	CSMSSender* self = new(ELeave) CSMSSender;
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

void CSMSSender::ConstructL()
/**
	Second phase of construction, opens connections to the Socket Server and File server,
	and opens an SMS socket.
*/
	{
	iSocketServer.Connect();
	iFs.Connect();
	User::LeaveIfError(iSocket.Open(iSocketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol));
	}

CSMSSender::~CSMSSender() 
/**
	Close the connections to the Socket Server, Socket and File Server
*/
	{
	iSocket.Close();
	iSocketServer.Close();
	iFs.Close();
	}


void CSMSSender::CreateSMSMessageL(const TDesC& aText, const TDesC8& aAddress)
/**
	Prepare SMS specific objects ready to send via ESOCK
	@param aText buffer containing ascii contents of message to send
	@param aAddress buffer with telephone number of SMS receiver 
*/
	{
	TSmsAddr smsAddr;
    smsAddr.SetSmsAddrFamily(ESmsAddrSendOnly);
	iSocket.Bind(smsAddr);

	CSmsBuffer* smsBuffer = CSmsBuffer::NewL();
	//CleanupStack::PushL(smsBuffer) is NOT used because CSmsMessage takes ownership of our buffer :-)
	CSmsMessage* smsMsg = CSmsMessage::NewL(iFs, CSmsPDU::ESmsSubmit, smsBuffer);
	CleanupStack::PushL(smsMsg);
	
	TSmsUserDataSettings smsSettings;
    smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabetUCS2);
	smsSettings.SetTextCompressed(EFalse);
	smsMsg->SetUserDataSettingsL(smsSettings);
	
	TBuf<KMaxAddressSize> toAddress;
	toAddress.Copy(aAddress);
	smsMsg->SetToFromAddressL(toAddress);

	//Get service centre address.
	// The method used here assumes the SMS settings are provisioned, which is true in known cases.
	// There are alternative partner-only APIs, however this allow this source to be kept public
	#ifdef EKA2
		CSmsSettings* smsSCSettings = CSmsSettings::NewL();
		CleanupStack::PushL(smsSCSettings);
    	CSmsAccount* smsAccount=CSmsAccount::NewLC();
    	smsAccount->LoadSettingsL(*smsSCSettings);
 		// index of the default service centre address for this service
 		TInt defIndex;
		User::LeaveIfError(defIndex = smsSCSettings->DefaultServiceCenter());
 		// Get the service center address
		CSmsServiceCenter&  scAddr = smsSCSettings->GetServiceCenter(defIndex);
	
		TPtrC theAddress=scAddr.Address();
		HBufC* serviceCentreAddress=HBufC::NewLC(theAddress.Length());
		*serviceCentreAddress=theAddress;
		smsMsg->SmsPDU().SetServiceCenterAddressL(*serviceCentreAddress);
		CleanupStack::PopAndDestroy(serviceCentreAddress);//
		CleanupStack::PopAndDestroy(smsAccount);
		CleanupStack::PopAndDestroy(smsSCSettings);	
				
	#else
		TMsvId		serviceId;
		CObserver* pObserver = new (ELeave) CObserver();
		CleanupStack::PushL(pObserver);
		CMsvSession* pSession = CMsvSession::OpenSyncL(*pObserver);
		CleanupStack::PushL(pSession);
		TSmsUtilities::ServiceIdL(*pSession, serviceId, KUidMsgTypeSMS);
		CMsvEntry* service = pSession->GetEntryL(serviceId);
		CleanupStack::PushL(service);
		CMsvStore* msvstore = service->ReadStoreL();
		CleanupStack::PushL(msvstore);
		CSmsSettings* smsSCSettings = CSmsSettings::NewL();
		CleanupStack::PushL(smsSCSettings);
		smsSCSettings->RestoreL(*msvstore);
		TInt defIndex;
		User::LeaveIfError(defIndex = smsSCSettings->DefaultSC());
		defIndex = smsSCSettings->DefaultSC();
 		// Get the default service center address
		CSmsNumber&  scAddr = smsSCSettings->SCAddress(defIndex);
		TPtrC theAddress=scAddr.Address();
		HBufC* serviceCentreAddress=HBufC::NewLC(theAddress.Length());
		*serviceCentreAddress=theAddress;
		smsMsg->SmsPDU().SetServiceCenterAddressL(*serviceCentreAddress);
		CleanupStack::PopAndDestroy(serviceCentreAddress);//
		CleanupStack::PopAndDestroy(smsSCSettings); //smsSettings
		CleanupStack::PopAndDestroy(msvstore);
		CleanupStack::PopAndDestroy(service);
		CleanupStack::PopAndDestroy(pSession);
		CleanupStack::PopAndDestroy(pObserver);		
	#endif
	
	//convert to wide
	HBufC* payload = HBufC::NewL(aText.Length());
	CleanupStack::PushL(payload);
	TPtr pPayload=payload->Des();
	pPayload.Copy(aText); //copy from narrow to wide and convert
	smsBuffer->InsertL(0, pPayload); //copies payload
	RSmsSocketWriteStream writeStream(iSocket);
	CleanupClosePushL(writeStream);
	writeStream << *smsMsg; // remember << operator _CAN_ leave
	writeStream.CommitL();
	CleanupStack::PopAndDestroy(&writeStream);
	CleanupStack::PopAndDestroy(2);//smsMsg, payload	
	}


void CSMSSender::SendSMSL(const TDesC& aText, const TDesC8& aAddress, TRequestStatus& aStatus)
/**
	Send an SMS message Asynchronously
	@param aText buffer containing ascii contents of message to send
	@param aAddress buffer with telephone number of SMS receiver 
	@param aStatus TRequestStatus which receives completion notification following a Send
	@capability NetworkServices
	@capability ReadUserData	
*/
	{
	CreateSMSMessageL(aText, aAddress);
	iSocket.Ioctl(KIoctlSendSmsMessage, aStatus, &iBuf, KSolSmsProv);
	}


/*
	CSMSReceiver
*/

// Construction functions
CSMSReceiver::CSMSReceiver() : CActive(EPriorityStandard)
/**
	Standard priortiy active object.
*/
	{
	}

CSMSReceiver* CSMSReceiver::NewL()
/**
	Intended Usage: Static factory constructor. Uses two phase 
	construction and leaves nothing on the CleanupStack.

	@returns a new CSMSSender instance.
*/
	{
	CSMSReceiver* self = NewLC();
	CleanupStack::Pop();
	return self;
	}

CSMSReceiver* CSMSReceiver::NewLC()
/**
	Intended Usage: Static factory constructor. Uses two phase 
	construction and leaves an instance of CSMSReceiver on the CleanupStack.

	@returns a new CSMSSender instance.
*/
	{
	CSMSReceiver* self = new(ELeave) CSMSReceiver;
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

void CSMSReceiver::ConstructL()
/**
	Second phase of construction, opens connections to the Socket Server and File server,
	and opens an SMS socket.
*/
	{
	iSocketServer.Connect();
	iFs.Connect();
	User::LeaveIfError(iSocket.Open(iSocketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol));
	iReceiveStatus = EIdle;
	CActiveScheduler::Add(this);
	}

CSMSReceiver::~CSMSReceiver() 
/**
	Cancels any outstanding Receive, before closing sessions with the Socket and File Servers.
*/
	{
	Cancel(); //Cancel any outstanding Receiver
	iSocket.Close();
	iSocketServer.Close();
	iFs.Close();
	delete iSmsMsg;
	}

void CSMSReceiver::RunL()
/**
	Handle asynchronous receive which is a two step process. 
	1. Accept and process an incoming SMS
	2. Inform network that you received the message and not to try a resend.

	Then we can complete the clients TRequestStatus we stored earlier
*/
	{
	switch (iReceiveStatus)
		{
		case EListening:	
			{
			// Got an SMS, lets extract it
			ExtractMessageL();
			// And now let the network know that we received the message so that we
			// do not receive another attempt
			iSocket.Ioctl(KIoctlReadMessageSucceeded, iStatus, &iBuf, KSolSmsProv);
			iReceiveStatus = EAcknowledging;
			SetActive();
			break;
			}
		case EAcknowledging:	
			// Finished Network acknowledgement. Client now needs to be informed 
			// of the outcome
			User::RequestComplete(iClientStatus, iStatus.Int());
			break;
		default:
			User::Panic(_L("Not Possible to be in RunL in Idle state"),KErrUnknown);
			break;
		}
	}

void CSMSReceiver::DoCancel()
/**
	Cancel any outstanding Ioctls.
*/
	{
	iSocket.CancelIoctl();
	User::RequestComplete(iClientStatus, KErrCancel);
	}


void CSMSReceiver::SetupSocketsL(const TDesC8& aPattern)
/**
	Bind to socket and specify pattern match so that only incoming messages matching
	the pattern are intercepted. Other messages will be caught by the messaging component.
	
	@param aPattern buffer pattern match at beginning of incoming SMS message. Only SMS 
	messages containing this Pattern match will be intercepted.
*/
	{
    TSmsAddr smsAddr;
	smsAddr.SetSmsAddrFamily(ESmsAddrMatchText);

	smsAddr.SetTextMatch(aPattern);
	User::LeaveIfError(iSocket.Bind(smsAddr));
	
	}


void CSMSReceiver::ExtractMessageL()
/**
	Following receive extract the contents of the message and store within CDatagram object.
*/
	{
	CSmsBuffer* buffer;
	buffer=CSmsBuffer::NewL();
	//CleanupStack::PushL(buffer) is NOT used because CSmsMessage takes ownership of our buffer :-)
	
	if (iSmsMsg)
		{
		delete iSmsMsg;
		iSmsMsg=NULL;
		}
	iSmsMsg = CSmsMessage::NewL(iFs, CSmsPDU::ESmsSubmit, buffer);
	RSmsSocketReadStream readStream(iSocket);
	CleanupClosePushL(readStream);
	readStream >> *iSmsMsg;
	CleanupStack::PopAndDestroy(&readStream);

	HBufC* dgram = HBufC::NewLC(KMaxSMSSize);
	TPtr ptr = dgram->Des();
	buffer->Extract(ptr, 0, buffer->Length());

	// Convert from unicode data 
	TBuf<KMaxSMSSize> buf; // it is ok to do this on the stack because SMS size is small
	buf.Copy(*dgram);
	iDatagram->SetDataL(buf);
	
	CleanupStack::PopAndDestroy(); //dgram	
	}


void CSMSReceiver::ListenForSMSL(const TDesC8& aPattern, CDatagram* aDatagram, TRequestStatus& aStatus)
/**
	Receive an SMS message Asynchronously
	@param aPattern buffer pattern match at beginning of incoming SMS message. Only SMS 
	messages containing this Pattern match will be intercepted. Example: //MYPATTERN 

    @param aDatagram CDatagram to be populated during receive.
	@param aStatus will receive completion notification following receive
*/
	{
	aStatus = KRequestPending;
	iDatagram = aDatagram;
	iClientStatus = &aStatus;
	SetupSocketsL(aPattern);
    iBuf()=KSockSelectRead;
    iSocket.Ioctl(KIOctlSelect, iStatus, &iBuf,KSOLSocket);
	iReceiveStatus = EListening;
	SetActive();
	}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久中文综合久久牛| 麻豆精品久久精品色综合| 欧美一级高清片| 欧美日韩高清一区二区| 欧美美女直播网站| 欧美精品乱码久久久久久按摩 | 日韩精品久久理论片| 午夜精品久久久久久不卡8050| 亚洲制服丝袜av| 日韩精品国产精品| 国产乱子伦视频一区二区三区| 精品亚洲成a人在线观看| 国产一区二区三区四区五区入口| 岛国精品在线播放| 在线观看视频一区| 欧美一区二区三区婷婷月色| 久久亚洲捆绑美女| 亚洲三级在线观看| 婷婷国产在线综合| 国产剧情一区在线| 91免费看片在线观看| 91麻豆精品国产91久久久久久久久| 91精品国产一区二区| 国产亚洲一本大道中文在线| 亚洲欧洲一区二区在线播放| 午夜国产精品影院在线观看| 麻豆精品视频在线| 一本久久综合亚洲鲁鲁五月天| 欧美群妇大交群中文字幕| 337p粉嫩大胆色噜噜噜噜亚洲| 中文字幕一区二区三区蜜月 | 日韩女优电影在线观看| 欧美韩国日本综合| 婷婷激情综合网| 成人av高清在线| 日韩欧美一区在线| 一区二区三区免费观看| 黄网站免费久久| 欧美日韩一区二区在线观看| 国产三级欧美三级日产三级99 | 日韩精品综合一本久道在线视频| 欧美激情在线看| 天堂在线亚洲视频| a在线播放不卡| 久久女同互慰一区二区三区| 亚洲夂夂婷婷色拍ww47| 懂色av中文一区二区三区| 欧美一级理论片| 亚洲国产视频直播| 99精品久久只有精品| 2024国产精品| 久久精品国产一区二区| 欧美日产国产精品| 亚洲日本va午夜在线影院| 国产精品一级片在线观看| 日韩一区二区三区免费看| 亚洲综合一二三区| www.激情成人| 国产日产欧美一区| 国产一区视频在线看| 日韩一级高清毛片| 青青国产91久久久久久| 欧美日韩精品三区| 亚洲国产精品一区二区www在线| 91一区二区在线观看| 国产精品免费av| 成熟亚洲日本毛茸茸凸凹| 久久先锋影音av| 国产综合色精品一区二区三区| 51精品国自产在线| 日韩av一区二区三区四区| 欧美日韩精品久久久| 亚洲成在人线免费| 91麻豆精品国产91久久久久久久久| 亚洲与欧洲av电影| 在线成人小视频| 久久精品二区亚洲w码| 欧美大胆一级视频| 国产一区二区三区综合| 日本一区二区三级电影在线观看| 国产美女精品人人做人人爽| 久久久精品中文字幕麻豆发布| 国产精品99久久久久久似苏梦涵| 国产网站一区二区| av一本久道久久综合久久鬼色| 亚洲图片你懂的| 欧美色窝79yyyycom| 奇米影视在线99精品| 日韩美女一区二区三区四区| 国产一区二区成人久久免费影院| 久久久久久久综合日本| 波多野结衣在线aⅴ中文字幕不卡| 亚洲欧洲成人精品av97| 欧洲精品在线观看| 老司机精品视频导航| 国产蜜臀av在线一区二区三区| jlzzjlzz亚洲日本少妇| 亚洲五码中文字幕| 久久久久久黄色| 91色九色蝌蚪| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产亚洲欧洲一区高清在线观看| jizz一区二区| 毛片一区二区三区| ...av二区三区久久精品| 欧美色图在线观看| 国产成人精品亚洲777人妖| 亚洲欧美国产77777| 欧美男同性恋视频网站| 成人免费高清在线观看| 亚洲午夜影视影院在线观看| 久久综合久久鬼色| 欧美视频在线一区| 国产精品一区2区| 三级亚洲高清视频| 国产精品久久久久久久久动漫| 欧美人牲a欧美精品| 成人av在线播放网址| 日韩在线一区二区三区| 中文字幕永久在线不卡| 久久亚洲精品小早川怜子| 欧美精品粉嫩高潮一区二区| 99久久婷婷国产精品综合| 国产一区在线观看麻豆| 男人的天堂久久精品| 亚洲黄色片在线观看| 亚洲国产成人午夜在线一区| 欧美xfplay| 欧美日韩三级在线| 色偷偷久久一区二区三区| 成人午夜激情影院| 国产精品一区二区你懂的| 另类小说视频一区二区| 午夜精品在线视频一区| 一区二区三区在线播| 国产精品嫩草影院com| 久久伊人蜜桃av一区二区| 欧美一区二区三区精品| 欧美日韩精品系列| 欧美性受xxxx| 欧美亚洲动漫精品| 91官网在线免费观看| 97国产一区二区| 99久久精品国产精品久久| 国产69精品久久久久毛片| 国内成人自拍视频| 精品一区二区在线播放| 精品一区二区三区日韩| 蜜臂av日日欢夜夜爽一区| 日韩av不卡一区二区| 日本va欧美va精品发布| 天堂蜜桃一区二区三区| 免费在线观看一区二区三区| 丝袜美腿高跟呻吟高潮一区| 水蜜桃久久夜色精品一区的特点 | 日韩欧美综合在线| 日韩限制级电影在线观看| 91精品国产91久久综合桃花 | √…a在线天堂一区| 自拍偷拍亚洲激情| 一区二区三区丝袜| 首页国产丝袜综合| 久久精品国产一区二区| 国产成人精品免费| 日本黄色一区二区| 欧美日韩久久久| 2021国产精品久久精品| 国产精品成人一区二区艾草| 亚洲男女一区二区三区| 亚洲国产sm捆绑调教视频 | 亚洲国产人成综合网站| 日韩精品成人一区二区三区 | 亚洲午夜免费视频| 日本成人超碰在线观看| 国产一区二区在线免费观看| 成人小视频免费在线观看| 91久久精品一区二区二区| 欧美一级一区二区| 国产精品福利一区| 婷婷一区二区三区| 国产精品一区一区| 日本电影欧美片| 日韩欧美在线不卡| 亚洲黄色小说网站| 国产一区日韩二区欧美三区| 91免费在线播放| 精品第一国产综合精品aⅴ| 亚洲婷婷综合色高清在线| 毛片av一区二区| 日本精品一区二区三区四区的功能| 51精品秘密在线观看| 国产精品久久综合| 蜜臀a∨国产成人精品| 91老司机福利 在线| 2023国产精品| 免费日韩伦理电影| 在线观看国产91| 中文字幕第一页久久| 麻豆成人综合网| 欧美色国产精品|