void CWapDgrmTestStep::_PrintL(CArrayPtr<CSmsMessage>& aSmsArray) /** * print an array of SMS messages to the console */ { TInt Count = aSmsArray.Count(); TInt j = 1; for (TInt i=0;i<Count;i++,j++) { // Ordinal _Print(i); _Print(_L8(": \n")); CSmsMessage* Sms = aSmsArray.At(i); _Print(*Sms); // Print data CSmsBufferBase& SmsBuffer = Sms->Buffer(); _PrintL(SmsBuffer); } }
void CSmsEventLogger::SetDataL(const CSmsMessage& aSmsMessage,TInt* aStatusId, const TTime* aDischargeTime) { __ASSERT_DEBUG(iSmsPDUData.iType==aSmsMessage.Type(),SmsuPanic(ESmsuUnexpectedSmsPDUType)); TBuf<KLogMaxStatusLength> status; #ifdef _DEBUG if (aStatusId!=NULL) OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_1, "CSmsEventLogger::SetDataL StatusID = %d", *aStatusId); #endif if (aStatusId==NULL) { CSmsPDU::TSmsPDUType type=aSmsMessage.Type(); switch (type) { // Incoming SMS case CSmsPDU::ESmsDeliver: { if (iSmsPDUData.iTotal==iSmsPDUData.iReceived) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_2, "SetDataL ESmsDeliver R_LOG_DEL_DONE"); GetStringL(status,R_LOG_DEL_DONE); } else if (iSmsPDUData.iTotal>iSmsPDUData.iReceived) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_3, "SetDataL ESmsDeliver R_LOG_DEL_PENDING"); GetStringL(status,R_LOG_DEL_PENDING); } break; } case CSmsPDU::ESmsStatusReport: { if (iSmsPDUData.iTotal==iSmsPDUData.iReceived) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_4, "SetDataL ESmsStatusReport R_LOG_DEL_DONE"); GetStringL(status,R_LOG_DEL_DONE); } else if (iSmsPDUData.iTotal>iSmsPDUData.iReceived) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_5, "SetDataL ESmsStatusReport R_LOG_DEL_PENDING"); GetStringL(status,R_LOG_DEL_PENDING); } break; } // Outgoing SMS case CSmsPDU::ESmsSubmit: case CSmsPDU::ESmsCommand: { TBool statusreportrequest=EFalse; if (type==CSmsPDU::ESmsSubmit) { CSmsSubmit& submit=(CSmsSubmit&) aSmsMessage.SmsPDU(); statusreportrequest=submit.StatusReportRequest(); } else { CSmsCommand& command=(CSmsCommand&) aSmsMessage.SmsPDU(); statusreportrequest=command.StatusReportRequest(); } if (statusreportrequest) { if (iSmsPDUData.iSent==0) { // None sent yet GetStringL(status,R_LOG_DEL_NOT_SENT); OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_6, "SetDataL ESmsSubmit R_LOG_DEL_NOT_SENT SR"); } else if (iSmsPDUData.iTotal==iSmsPDUData.iDelivered) { // All have been delivered OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_7, "SetDataL ESmsSubmit R_LOG_DEL_DONE SR iSmsPDUData.iDelivered=%d", iSmsPDUData.iDelivered); GetStringL(status,R_LOG_DEL_DONE); } else if (iSmsPDUData.iSent<=iSmsPDUData.iTotal && iSmsPDUData.iFailed==0) { // One or more sent but not all, no failures OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_8, "SetDataL ESmsSubmit R_LOG_DEL_PENDING SR iSmsPDUData.iSent==%d, iSmsPDUData.iTotal==%d, iFailed==0", iSmsPDUData.iSent, iSmsPDUData.iTotal); GetStringL(status,R_LOG_DEL_PENDING); } else { // One or more failures or corruption of iSmsPDUData values OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_9, "SetDataL ESmsSubmit R_LOG_DEL_FAILED SR"); OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_10, " Total: %d, Sent: %d",iSmsPDUData.iTotal, iSmsPDUData.iSent ); OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_11, " Failed: %d, Delivered: %d",iSmsPDUData.iFailed, iSmsPDUData.iDelivered ); GetStringL(status,R_LOG_DEL_FAILED); } if (aDischargeTime != NULL) { iLogEvent->SetTime(*aDischargeTime); } } else { if (iSmsPDUData.iSent<iSmsPDUData.iTotal) { // IF not all PDUs sent, state is "NOT SENT". OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_12, "SetDataL ESmsSubmit R_LOG_DEL_NOT_SENT NOSR"); OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_13, " Total: %d, Sent: %d", iSmsPDUData.iTotal, iSmsPDUData.iSent ); GetStringL(status,R_LOG_DEL_NOT_SENT); } else if (iSmsPDUData.iTotal==iSmsPDUData.iSent) { // All sent OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_14, "SetDataL ESmsSubmit R_LOG_DEL_SENT NOSR"); GetStringL(status,R_LOG_DEL_SENT); } else { // The iSmsPDUData values have become corrupt OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_15, "SetDataL ESmsSubmit R_LOG_DEL_FAILED NOSR"); OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_16, " Total: %d, Sent: %d",iSmsPDUData.iTotal, iSmsPDUData.iSent ); OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_17, " Failed: %d, Delivered: %d",iSmsPDUData.iFailed, iSmsPDUData.iDelivered ); GetStringL(status,R_LOG_DEL_FAILED); } } OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_18, "SetDataL [status string=%S]",status); break; } default: { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSEVENTLOGGER_SETDATAL_19, "SetDataL ESmsuUnexpectedSmsPDUType"); SmsuPanic(ESmsuUnexpectedSmsPDUType); } } } else GetStringL(status,*aStatusId); TBuf<KLogMaxSubjectLength> subject; // // EDNAVSA-4VA9FQ Incoming SMSes with special chars are entered in the log as "data messages" // only 8 bit messages are displayed as data message in the log viewer // if (aSmsMessage.SmsPDU().DataCodingSchemePresent() && aSmsMessage.SmsPDU().Alphabet() == TSmsDataCodingScheme::ESmsAlphabet8Bit) { GetStringL(subject, R_LOG_SUBJECT_DATA_MESSAGE); } else if (aSmsMessage.TextPresent()) { const TInt length= Min(KLogMaxSubjectLength, aSmsMessage.Buffer().Length()); aSmsMessage.Buffer().Extract(subject, 0, length); subject.Trim(); } if (subject.Length() == 0) { GetStringL(subject, R_LOG_SUBJECT_NONE); } iLogEvent->SetSubject(subject); iLogEvent->SetStatus(status); TPckg<TLogSmsPduData> packeddata(iSmsPDUData); iLogEvent->SetDataL(packeddata); } // CSmsEventLogger::SetDataL
// 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; } }