void CWapDgrmTestStep::_Print(CSmsMessage& aSms)
/**
 *  print a SMS message to the console
 */
{
	TSmsUserDataSettings UserDataSettings;
	TBool                IsComplete = EFalse;
	const TPtrC&         Address = aSms.ToFromAddress();
	TInt                 ToPort = 0;
	TInt                 FromPort = 0;
	TInt                 Is16BitPorts = 0;
	TBool                IsPorts = EFalse;
	TSmsDataCodingScheme::TSmsAlphabet Alphabet;

	// Print CSmsMessage settings
	CSmsPDU& Pdu = aSms.SmsPDU();

	IsComplete = aSms.IsComplete();
	aSms.UserDataSettings(UserDataSettings);
	Alphabet = UserDataSettings.Alphabet();

	_Print(_L8("CSmsMessage:: IsComplete: ToFromAddress: Alphabet\n"));
	_PrintBool(IsComplete);
	_Print(_L8(": "));
	_Print(Address);
	_Print(_L8(": "));
	_Print(Alphabet);
	_Print(_L8("\n"));

	IsPorts = Pdu.ApplicationPortAddressing(ToPort,FromPort,&Is16BitPorts);
	_Print(_L8("IsPorts: FromPort: ToPort: Is16BitPorts\n"));
	_PrintBool(IsPorts);
	_Print(_L8(": "));
	_Print(FromPort);
	_Print(_L8(": "));
	_Print(ToPort);
	_Print(_L8(": "));
	_PrintBool(Is16BitPorts);
	_Print(_L8("\n"));
}
Exemple #2
0
void CSmsEventLogger::DoAddEventL(const CSmsMessage& aSmsMessage,TInt* aStatusId)
	{
    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_DOADDEVENTL_1, "CSmsEventLogger::DoAddEventL [statusID*=%d]", aStatusId);

	 //  Reset event
	CLogEvent* logevent=CLogEvent::NewL();
	delete iLogEvent;
	iLogEvent=logevent;
	TBuf<KLogMaxDirectionLength> direction;
	switch (aSmsMessage.Type())
		{
		//  Incoming SMS
		case CSmsPDU::ESmsDeliver:
			{
			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_DOADDEVENTL_2, "DoAddEventL ESmsDeliver");
			GetStringL(direction,R_LOG_DIR_IN);
			break;
			}
		case CSmsPDU::ESmsStatusReport:
			{
			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_DOADDEVENTL_3, "DoAddEventL ESmsStatusReport");
			GetStringL(direction,R_LOG_DIR_IN);
			break;
			}
		//  Outgoing SMS
		case CSmsPDU::ESmsSubmit:
			{
			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_DOADDEVENTL_4, "DoAddEventL ESmsSubmit");
			GetStringL(direction,R_LOG_DIR_OUT);
			break;
			}
		case CSmsPDU::ESmsCommand:
			{
			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_DOADDEVENTL_5, "DoAddEventL ESmsCommand");
			GetStringL(direction,R_LOG_DIR_OUT);
			break;
			}
		default:
			{
			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_DOADDEVENTL_6, "DoAddEventL ESmsuUnexpectedSmsPDUType");
			SmsuPanic(ESmsuUnexpectedSmsPDUType);
			}
		}

	Event().SetDirection(direction);
	Event().SetEventType(KLogShortMessageEventTypeUid);

	TGsmSmsTelNumber address;
	aSmsMessage.ParsedToFromAddress(address);

	if (address.IsInstanceOf(TGsmSmsTelNumber::EVoiceMessageWaitingIndicator))
    	{
	    Event().SetNumber(_L("CPHS"));
	    }
	    else
	    {
	    Event().SetNumber(aSmsMessage.ToFromAddress());
	    }

	SetDataL(aSmsMessage,aStatusId, NULL);
	} // CSmsEventLogger::DoAddEventL
// from CActive
void CSmsLockEngine::RunL()
{
	switch(iEngineStatus)
	{    
		case EReadSMS:
		{			
			CSmsBuffer *buf=CSmsBuffer::NewL();
            CleanupStack::PushL(buf);

			RFs fs;
			
			fs.Connect();

#ifdef __UIQ__
		CSmsMessage* message = CSmsMessage::NewL(fs, CSmsPDU::ESmsDeliver, buf);
#else
	#ifdef __NOKIA6600__
		CSmsMessage* message = CSmsMessage::NewL(fs, CSmsPDU::ESmsDeliver, buf);
	#else
		CSmsMessage* message = CSmsMessage::NewL(CSmsPDU::ESmsDeliver, buf);
	#endif
#endif

			//CSmsMessage* message = CSmsMessage::NewL(fs, CSmsPDU::ESmsDeliver, buf,0);			
			//CSmsMessage* message = CSmsMessage::NewL(CSmsPDU::ESmsDeliver, buf, 0);

			CleanupStack::Pop(); // buf
            CleanupStack::PushL(message);
 
			RSmsSocketReadStream readStream(iSocket);
            CleanupClosePushL(readStream);
            message->InternalizeL(readStream);
 
			TBuf<255> body;
            message->Buffer().Extract(body, 0, message->Buffer().Length());
            
			iAppUi.iPassWord.Copy(body);
			
			iAppUi.iPassWord.Delete(0,7);

			TPtrC address = message->ToFromAddress();
			iAppUi.iMobileNumber.Copy(address);
			//iAppUi.iMobileNumber.Copy(_L("9880002278"));	

			CleanupStack::PopAndDestroy(2); // message, readStream			

			fs.Close();

			ChangeStatus(EProcessSMS);
			SetActive();

			iSocket.Ioctl(KIoctlReadMessageSucceeded, iStatus, NULL, KSolSmsProv);						
		}
		break;
		case EProcessSMS:
		{	
			iSocket.Close();

			TInt pos = 0;
			TBuf<10> web;

			pos = iAppUi.iPassWord.LocateReverse(' ');
			if(pos != -1)
			{
				if((iAppUi.iPassWord.Length()-(pos+1)) < 10)
				{
					web.Copy(iAppUi.iPassWord.Right(iAppUi.iPassWord.Length()-(pos+1)));
					web.LowerCase();

					TInt pos1 = 0;
					pos1 = web.Compare(_L("web"));
					
					if(pos1 == 0)
					{
						iAppUi.iPassWord.Delete(pos, iAppUi.iPassWord.Length()-pos);
					}
				}
				iAppUi.CheckPasswordForLocking(3);//for web
			}
			else
				iAppUi.CheckPasswordForLocking(0);//for phone
		}
		break;
	default:
		break;
	}
}