GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) // // Do all tests // { if( !PlatSec::IsCapabilityEnforced(ECapabilityDiskAdmin)) { test.Printf(_L("Capability ECapabilityDiskAdmin not enabled - leaving t_dcdiskadmin")); test.Printf(_L("\n")); // Prevent overwrite by next print return; } TurnAllocFailureOff(); TheFs.CharToDrive(gDriveToTest,gTheDriveNum); TBuf<30> sesspath; sesspath=_L("?:\\"); sesspath[0] = (TText)gDriveToTest; TInt r= TheFs.SetSessionPath(sesspath); test_KErrNone(r); //cleanup from previous run of this test TBuf<2> cmd; cmd.SetLength(1); cmd[0] = (TText)gDriveToTest; RProcess tp; r=tp.Create(_L("clean_prepdc.exe"),sesspath); test_KErrNone(r); { TRequestStatus ps; tp.Logon(ps); tp.Resume(); tp.Close(); User::WaitForRequest(ps); } //check double mode ie that Defpath still works RFs fs1; RFs fs2; r=fs1.Connect(); test_KErrNone(r); r=fs1.SessionPath(sesspath); test_KErrNone(r); test.Printf(_L("session1 Path=%S"),&sesspath); TBuf<30> privatepath; r=fs1.SetSessionToPrivate(gTheDriveNum); test_KErrNone(r); r=fs1.PrivatePath(privatepath); test_KErrNone(r); r=privatepath.Compare(KExpectedPrivatePath()); test_Value(r, r == 0); r=fs1.SessionPath(sesspath); test_KErrNone(r); r=privatepath.Compare(sesspath.Mid(KPathPosition)); test_Value(r, r == 0); r=fs1.CreatePrivatePath(gTheDriveNum); test_KErrNone(r); fs1.Close(); r=fs2.Connect(); test_KErrNone(r); r=fs2.SessionPath(sesspath); test_KErrNone(r); test.Printf(_L("session2 Path=%S"),&sesspath); fs2.Close(); TestCaps(); test.Printf(_L("No of files open=%d"), TheFs.ResourceCount()); CleanupL(); }
/** * Load and initialise an audio file. */ TVerdict CTestMmfAclntFileHandleSource::DoTestStepL( void ) { INFO_PRINTF1( _L("TestPlayerUtils : File")); TVerdict ret = EFail; iError = KErrTimedOut; // Get the file name. TBuf<KSizeBuf> filename; TPtrC filename1; if(!GetStringFromConfig(iSectName,iKeyName,filename1)) { return EInconclusive; } GetDriveName(filename); filename.Append(filename1); // Create CMdaAudioPlayerUtility Object CMdaAudioPlayerUtility* player = NULL; player = CMdaAudioPlayerUtility::NewL(*this); // Create RFs and RFile Objects RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); User::LeaveIfError(fs.ShareProtected()); RFile file; User::LeaveIfError( file.Open( fs, filename, EFileRead ) ); CleanupClosePushL(file); // Create TMMFileSource Object TMMFileHandleSource filehandlesource(file); player->OpenFileL(filehandlesource); // Wait for initialisation callback INFO_PRINTF1(_L("CMdaAudioPlayerUtility->OpenFileL(TMMFileHandleSource)")); CActiveScheduler::Start(); // Check for expected errors. if((iError != KErrNone) && (iExpectedError == iError)) { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->OpenFileL() Returned the Expected Error : %d"),iError); ret=EPass; } // Check for errors. if(iError != KErrNone) { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->OpenFileL() Failed with Error : %d"),iError); ret=EFail; } // Check for No errors, so as to start Playback if (iError == KErrNone && player != NULL) { if(iPlay) { iError = KErrTimedOut; player->Play(); // Wait for play complete callback INFO_PRINTF1(_L("CMdaAudioPlayerUtility->Play()")); CActiveScheduler::Start(); // Check for Callback errors if(iError == KErrNone) { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->Play() completed successfully with return code : %d"),iError); ret = EPass; } else { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->Play() Failed with Error : %d"),iError ); ret = EFail; } } else { ret = EPass; } } // Clean up activities. delete player; User::After(KOneSecond); // wait for deletion to shut down devsound CleanupStack::PopAndDestroy(2); return ret; }
/** * Performes the test by connecting to MLFW and makes 50 Location request */ TInt DoTestL() { TBuf<40> traceFile = GenerateFileNameForTraceL(); RFs fileserver; RFile file; User::LeaveIfError(fileserver.Connect()); CleanupClosePushL(fileserver); User::LeaveIfError(file.Open(fileserver, traceFile, EFileWrite)); CleanupClosePushL(file); _LIT(KClientStarted, "Client Started"); TraceL(KClientStarted, file); const TInt32 KUidMultiPsy = 0x01010176; TUid uidMultiPsy; uidMultiPsy.iUid = KUidMultiPsy; SetupPsyL(uidMultiPsy); _LIT(KMultiPsySetup, "MultiPsy set up"); TraceL(KMultiPsySetup, file); TInt numberOfRuns = 50; RPositionServer posServer; CleanupClosePushL(posServer); RPositioner positioner; CleanupClosePushL(positioner); TPositionInfo positionInfo = TPositionInfo(); _LIT(KConnectErr, "ERROR: Error when connecing to EPos server, %d"); TInt err = posServer.Connect(); AssertTrueL(err == KErrNone, KConnectErr, err, file); _LIT(KOpenErr, "ERROR: Error when opening positioner, %d"); err = positioner.Open(posServer, uidMultiPsy); AssertTrueL(err == KErrNone, KOpenErr, err, file); _LIT(KService ,"Service"); err = positioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KService); _LIT(KRequestor, "ERROR: Not possible to set requestor"); AssertTrueL(err == KErrNone, KRequestor, err, file); TTime now, startTime; TTimeIntervalMicroSeconds requestTime; TRequestStatus status; TInt64 reqTime; TCoordinate corr(0,0,0); TLocality loca(corr,0); TPosition pos(loca, TTime(0)); TBool success = ETrue; _LIT(KStartingRequests, "Starting requests"); TraceL(KStartingRequests, file); for (TInt i = 0; i < numberOfRuns; i++) { startTime.UniversalTime(); positionInfo.SetPosition(pos); positioner.NotifyPositionUpdate(positionInfo, status); User::WaitForRequest(status); err = status.Int(); if (err != KErrNone) { success=EFalse; } now.UniversalTime(); requestTime = now.MicroSecondsFrom(startTime); _LIT(KError, "Request time, %d µs. Error code from Notify = %d"); TBuf<100> buf; reqTime = requestTime.Int64(); buf.Format(KError, reqTime, err); TraceL(buf, file); TPosition result; positionInfo.GetPosition(result); // Sanity check if (result.Latitude() == pos.Latitude() || result.Longitude() == pos.Longitude() || result.Altitude() == pos.Altitude()) { success = EFalse; _LIT(KErrorPositon, "ERROR:: The postion was not updated"); TraceL(KErrorPositon, file); } } CleanupStack::PopAndDestroy(&positioner); CleanupStack::PopAndDestroy(&posServer); if (success) { _LIT(KOk, "SUCCESS"); TraceL(KOk, file); } else { _LIT(KErr, "FAILED"); TraceL(KErr, file); } CleanupStack::PopAndDestroy(&file); CleanupStack::PopAndDestroy(&fileserver); return (success) ? 0 : 1; }
TInt TRPSOwnNumbers::ExtractANumber(const RMobileONStore::TMobileONEntryV1& aEntry) { TInt ret(KErrNotFound); TBuf<1> prependstr; prependstr.Zero(); if(aEntry.iNumber.iTypeOfNumber == RMobilePhone::EInternationalNumber || aEntry.iNumber.iTelNumber.Left(2) == KUKCountryCode) { prependstr = KPlus; } // Check if entry's Service tag is set and extract number switch(aEntry.iService) { case RMobilePhone::EVoiceService: if(iOwnVoiceNumber.Length()==0) { iOwnVoiceNumber = prependstr; iOwnVoiceNumber += aEntry.iNumber.iTelNumber; } ret = KErrNone; break; case RMobilePhone::ECircuitDataService: if(iOwnDataNumber.Length()==0) { iOwnDataNumber = prependstr; iOwnDataNumber += aEntry.iNumber.iTelNumber; } ret = KErrNone; break; case RMobilePhone::EFaxService: if(iOwnFaxNumber.Length()==0) { iOwnFaxNumber = prependstr; iOwnFaxNumber += aEntry.iNumber.iTelNumber; } ret = KErrNone; break; default: { // Else check the text tag, assuming the user has set the text tag according to the RPS // user guide if(iOwnVoiceNumber.Length()==0) { if(aEntry.iText.Match(KVoiceTagU)!= KErrNotFound || aEntry.iText.Match(KVoiceTagL)!= KErrNotFound) { // Assume this is the voice line iOwnVoiceNumber = prependstr; iOwnVoiceNumber += aEntry.iNumber.iTelNumber; ret = KErrNone; } } if(iOwnFaxNumber.Length()==0) { if(aEntry.iText.Match(KFaxTagU)!= KErrNotFound || aEntry.iText.Match(KFaxTagL)!= KErrNotFound) { // Assume this is the fax line iOwnFaxNumber = prependstr; iOwnFaxNumber += aEntry.iNumber.iTelNumber; ret = KErrNone; } } if(iOwnDataNumber.Length()==0) { if(aEntry.iText.Match(KDataTagU)!= KErrNotFound || aEntry.iText.Match(KDataTagL)!= KErrNotFound) { // Assume this is the data line iOwnDataNumber = prependstr; iOwnDataNumber += aEntry.iNumber.iTelNumber; ret = KErrNone; } } } break; } return ret; }
// ---------------------------------------------------- // CDbtestAppUi::HandleCommandL(TInt aCommand) // ?implementation_description // ---------------------------------------------------- // void CDbtestAppUi::HandleCommandL(TInt aCommand) { switch ( aCommand ) { case EAknSoftkeyBack: case EEikCmdExit: { Exit(); break; } case EdbtestCmdAppOBEX: //bt->transfer_logs(); break; case EdbtestCmdAppTest: { #if 0 if (!is_open) { User::LeaveIfError(sockserv.Connect()); User::LeaveIfError(sock.Open(sockserv, KAfInet, KSockStream, KUndefinedProtocol)); TInetAddr a(INET_ADDR(128, 214, 48, 81) , 80); TRequestStatus s; sock.Connect(a, s); User::WaitForRequest(s); status_change(_L("opened")); is_open=true; } else { sock.CancelAll(); sock.Close(); sockserv.Close(); status_change(_L("closed")); is_open=false; } #else # if 0 //transferer->log_gps(); /* TInetAddr a(INET_ADDR(128, 214, 48, 81) , 21); ftp->Connect(a, _L8("tkt_cntx"), _L8("dKFJmqBi")); current_state=CONNECTING; */ /* run(this); */ # else //wap->Connect(1, _L("http://db.cs.helsinki.fi/~mraento/cgi-bin/put.pl")); # endif #endif } break; case EdbtestCmdAppCommDb: { CCommDbDump* dump=CCommDbDump::NewL(); CleanupStack::PushL(dump); dump->DumpDBtoFileL(_L("c:\\commdb.txt")); CleanupStack::PopAndDestroy(); } break; case EdbtestCmdAppCert: { auto_ptr<CCertInstaller> i(CCertInstaller::NewL(AppContext())); i->InstallCertL(_L("c:\\hy.der")); } case EdbtestCmdAppDiscover: //discoverer->search(); break; case EdbtestCmdAppCtmGSM: { TBuf<40> s; RDevRecharger c; TInt ret=0; TInt u=0; bool done=false; while (!done) { ret=c.Open(u); if (ret==KErrNone) { done=true; } else { ++u; if (u==KNullUnit) done=true; } } if (ret!=KErrNone) { s.Format(_L("Open: %d"), ret); } else { TChargeInfoV1 i; i.iRawTemperature=i.iSmoothedTemperature=0; i.iChargeType=EChargeNone; TChargeInfoV1Buf b(i); c.ChargeInfo(b); s.Format(_L("%d r %d s %d t %d"), u, i.iRawTemperature, i.iSmoothedTemperature, i.iChargeType) ; } status_change(s); } break; case EdbtestCmdAppVibra: CFLDRingingTonePlayer* p; p=CFLDRingingTonePlayer::NewL(ETrue); p->SetVibra(ETrue); p->SetRingingType(0); //((MFLDFileProcessor*)p)->ProcessFileL(_L("c:\\nokia\\sounds\\simple\\silent.rng")); ((MFLDFileProcessor*)p)->ProcessFileL(_L("c:\\system\\apps\\context_log\\silent.rng")); break; default: break; } }
EXPORT_C void CIpuTestHarness::GetAnEntry(const TDesC& ourPrompt, TDes& currentstring) // // Get an input string from the user, displaying a supplied prompt and default string value { // If we're scripting, try reading from script first TInt readScriptErr = KErrNotFound; if (iScriptRunning) { readScriptErr = ReadLineFromScript(currentstring); } if (!readScriptErr) return; // Either not scripting, or hit end of script - continue with user input TBuf16<KMaxUserEntrySize> ourLine; TBuf<KMaxUserEntrySize> tempstring; //tempstring is a unicode descriptor //create a temporary buffer where the //unicode strings are stored in order to //be displayed ourLine.Zero (); tempstring.Copy(currentstring); //Copy current string to Unicode buffer TKeyCode key = EKeyNull; //current string buffer is 8 bits wide. //Unicode string bufffer (tempstring) is 16 bits wide. for (;;) { if (ourLine.Length () == 0) { iTest.Console()->SetPos (0, iTest.Console()->WhereY ()); iTest.Console()->Printf (_L ("%S"), &ourPrompt); if (tempstring.Length () != 0) //get tempstring's number of items iTest.Console()->Printf (_L (" = %S"), &tempstring); //if not zero print them to iTest.Console() iTest.Console()->Printf (_L (" : ")); iTest.Console()->ClearToEndOfLine (); } key = iTest.Getch(); if (key == EKeyBackspace) { if (ourLine.Length() !=0) { ourLine.SetLength(ourLine.Length()-1); iTest.Console()->Printf (_L ("%c"), key); iTest.Console()->SetPos(iTest.Console()->WhereX(),iTest.Console()->WhereY()); iTest.Console()->ClearToEndOfLine(); } // end if (ourLine.Length() !=0) } // end if (key == KeyBackSpace) if (key == EKeyDelete) { ourLine.Zero(); iTest.Console()->SetPos (0, iTest.Console()->WhereY ()); iTest.Console()->ClearToEndOfLine (); tempstring.Copy(ourLine); break; } if (key == EKeyEnter) break; if (key < 32) { continue; } ourLine.Append (key); iTest.Console()->Printf (_L ("%c"), key); iTest.Console()->SetPos(iTest.Console()->WhereX(),iTest.Console()->WhereY()); iTest.Console()->ClearToEndOfLine(); if (ourLine.Length () == ourLine.MaxLength ()) break; } // end of for statement if ((key == EKeyEnter) && (ourLine.Length () == 0)) tempstring.Copy (currentstring); //copy contents of 8 bit "ourLine" descriptor iTest.Console()->SetPos (0, iTest.Console()->WhereY ()); iTest.Console()->ClearToEndOfLine (); iTest.Console()->Printf (_L ("%S"), &ourPrompt); if ((key == EKeyEnter) && (ourLine.Length() !=0)) tempstring.Copy(ourLine); if (tempstring.Length () != 0) //if temstring length is not zero { iTest.Console()->Printf (_L (" = %S\n"), &tempstring); //print the contents to iTest.Console() LogIt(_L ("%S = %S\n"), &ourPrompt, &tempstring); } else //iTest.Console()->Printf (_L (" is empty")); iTest.Console()->Printf (_L ("\n")); currentstring.Copy(tempstring); //copy 16 bit tempstring descriptor back }
void CUT_PBASE_T_USBDI_0486::DeviceInsertedL(TUint aDeviceHandle) { OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_ENTRY, this ); OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL, "--->DeviceInsertedL, case step = %d", iCaseStep); // Cancel the timeout timer Cancel(); TInt err(KErrNone); // Validate that device is as expected CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle); // Perform the correct test step switch(iCaseStep) { case EWaitForDeviceCConnection: { if(!CheckSN(testDevice.SerialNumber(), KTestDeviceC_SN())) { return TestFailed(KErrNotFound); } iCaseStep = EDeviceCConnected; err = testDevice.Device().GetTokenForInterface(0,iToken0DeviceC); if(err != KErrNone) { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP01, "<Error %d> Unable to retrieve token for interface 0",err); TestFailed(err); } // Open the interface err = iUsbInterface0.Open(iToken0DeviceC); if(err != KErrNone) { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP02, "<Error %d> Unable to open interface 0", err); TestFailed(err); } TUint32 token1; err = testDevice.Device().GetTokenForInterface(1,token1); if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Token for interface 1 could not be retrieved"),err); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP03, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } err = iUsbInterface1.Open(token1); // Default interface setting 0 if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Unable to open interface 1 using token %d"),err,token1); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP04, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } TInt endpointAddress; // Queue a bulk in transfer on endpoint 2 err = GetEndpointAddress(iUsbInterface1,0,KTransferTypeBulk,KEpDirectionIn,endpointAddress); if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Address for bulk in endpoint could not be obtained"),err); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP05, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP06, "Endpoint adress %08x",endpointAddress); err = iUsbInterface1.OpenPipeForEndpoint(iTestPipeInterface1BulkIn,endpointAddress,ETrue); if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Unable to open pipe for endpoint %08x"),err,endpointAddress); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP07, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } // Create the bulk transfers iInTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,256,*this, KBulkTranferId); // Initialise the descriptors for transfer OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP08, "Initialising the transfer descriptors"); err = iUsbInterface1.InitialiseTransferDescriptors(); if(err != KErrNone) { TBuf<256> msg; msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err); OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP09, msg); iCaseStep = EFailed; TTestCaseFailed request(err,msg); return iControlEp0->SendRequest(request,this); } iInTransfer[0]->TransferIn(KExpectedDataSize); // disconnect device C and connect device A TDisconnectDeviceCThenConnectDeviceARequest request; iControlEp0->SendRequest(request,this); // Monitor for the reconnection from the client iActorFDF->Monitor(); TimeoutIn(30); } break; case EWaitForDeviceAConnection: { if(!CheckSN(testDevice.SerialNumber(), TestCaseId())) { return TestFailed(KErrNotFound); } // try to open interface 0 err = iUsbInterface0.Open(iToken0DeviceC); if(err != KErrNotFound) // invalid token { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP10, "iUsbInterface0.Open(iToken0DeviceC) === %d", err); TestFailed(err); } // get token now TUint32 token0DeviceA; err = testDevice.Device().GetTokenForInterface(0,token0DeviceA); if(err != KErrNone) { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP11, "<Error %d> Unable to retrieve token(device A) for interface 0",err); TestFailed(err); } // Open the interface err = iUsbInterface0.Open(token0DeviceA); if(err != KErrNone) { OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP12, "<Error %d> Unable to open interface 0(device A)", err); TestFailed(err); } // ok, send EPassed request iCaseStep = EPassed; // Send test case passed request to client User::After(2000000); TTestCasePassed request; iControlEp0->SendRequest(request,this); } break; default: { OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_DUP13, "<Error> Test case actions out of sync"); TestFailed(KErrCorrupt); } break; } OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0486_DEVICEINSERTEDL_EXIT, this ); }
void CUploadContainer::ConstructL(const TRect& aRect) { CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("ConstructL")); iControls=new (ELeave) CArrayPtrFlat< CCoeControl >(10); CreateWindowL(); TRect r(TPoint(5, 5), TSize(aRect.Width()-10, 1)); if (iFileName.Right(3).CompareF(_L("jpg"))==0) { #ifndef __S60V2__ iMdaServer=CMdaServer::NewL(); iFileUtil=CMdaImageFileToBitmapUtility::NewL(*this, iMdaServer); #else iFileUtil=CMdaImageFileToBitmapUtility::NewL(*this, 0); #endif iFileUtil->OpenL(iFileName); scaled=false; iImgPlaceHolder=new (ELeave) CEikLabel; iControls->AppendL(iImgPlaceHolder); iImgPlaceHolder->SetContainerWindowL( *this ); iImgPlaceHolder->SetFont(iEikonEnv->DenseFont()); iImgPlaceHolder->SetTextL( _L("loading image...") ); r.SetHeight(IMG_HEIGHT); iImgPlaceHolder->SetRect(r); r.Move(0, r.Height()+4); } else { r.SetHeight(IMG_HEIGHT); r.Move(0, r.Height()+4); } TInt tagw=0; /* iTagLabel=new (ELeave) CEikLabel; iControls->AppendL(iTagLabel); iTagLabel->SetContainerWindowL( *this ); iTagLabel->SetTextL( _L("Tag:") ); r.SetHeight(12); iTagLabel->SetRect(r); tagw=iTagLabel->MinimumSize().iWidth+4; r.Move( tagw , 0); r.SetWidth(r.Width()-tagw); */ TBuf<100> tag; Settings().GetSettingL(SETTING_UPLOAD_TAG, tag); if (tag.Length() == 0) tag=KTag(); iTagEdit=new (ELeave) CEikEdwin; iControls->AppendL(iTagEdit); iTagEdit->SetContainerWindowL( *this ); iTagEdit->ConstructL(); iTagEdit->SetTextL(&tag); iTagEdit->AddEdwinObserverL(this); r.SetHeight(16); iTagEdit->SetRect(r); iTagEdit->ActivateL(); r.Move(-tagw, r.Height()+4); r.SetWidth(r.Width()+tagw); TBool no_descr; if (iTagOnly) no_descr=true; else no_descr=false; if (!no_descr) { TInt height=56; /* iDescriptionLabel=new (ELeave) CEikLabel; iControls->AppendL(iDescriptionLabel); iDescriptionLabel->SetContainerWindowL( *this ); iDescriptionLabel->SetTextL( _L("Description:") ); r.SetHeight(12); iDescriptionLabel->SetRect(r); r.Move(0, r.Height()+4); height-=16; */ r.Move(0, 2); iDescriptionEdit=new (ELeave) CEikEdwin; iControls->AppendL(iDescriptionEdit); iDescriptionEdit->SetContainerWindowL( *this ); iDescriptionEdit->ConstructL(); iDescriptionEdit->AddEdwinObserverL(this); iDescriptionEdit->SetTextL(&(KDescription())); r.SetHeight(height); iDescriptionEdit->SetRect(r); r.Move(0, r.Height()+4); SetEditSelected(iDescriptionEdit, true); SetEditActive(iDescriptionEdit, true); } else { SetEditSelected(iTagEdit, true); SetEditActive(iTagEdit, true); } SetRect(aRect); ActivateL(); }
// 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; } }
TVerdict CTEventHandlingPerf::doTestStepL() { /** @SYMTestCaseID GRAPHICS-UI-BENCH-0172 */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0172")); TBuf<KMaxDescLength> bufAvg; TPtr temp(NULL,0); TPtr temp1(NULL,0); TPtr temp2(NULL,0); // Here check if the HAL configuration are correct if not then finish the test case TInt maxPtr; TInt ret = HAL::Get(HALData::EPointerMaxPointers, maxPtr); if (ret != KErrNone || maxPtr < 2 || maxPtr > 8) { INFO_PRINTF1(_L("Incorrect HAL configuration. \n")); SetTestStepResult(EFail); CloseTMSGraphicsStep(); RecordTestResultL(); return TestStepResult(); } iProfiler->InitResults(); TInt minMemSize = 128; TInt maxMemSize = KMaxDescLength; // Create a shared chunk using the userheap function // Allocate some memory in that and then get the offset from it - chunk's base _LIT(KPerformanceTimingChunk, "PerformanceTimingChunk"); RHeap* heap = UserHeap::ChunkHeap(&KPerformanceTimingChunk, minMemSize, maxMemSize, 10); CleanupClosePushL(*heap); if (heap == NULL) { User::LeaveNoMemory(); } RChunk chunk; User::LeaveIfError(chunk.OpenGlobal(KPerformanceTimingChunk, ETrue)); CleanupClosePushL(chunk); TInt memSize = KMaxDescLength; TAny* perfDesc = heap->AllocL(memSize); if (!perfDesc) { User::LeaveNoMemory(); } TInt offset = reinterpret_cast<TUint8*>(perfDesc) - chunk.Base() ; // Create a process called te_multiptrperf // Pass in the offset as descriptor _LIT(KMultiPtrEventHandlingPerf,"z:\\sys\\bin\\te_multiptrperf.exe"); TBuf<128> buf; buf.Num(offset); RProcess eventHandPerf; User::LeaveIfError(eventHandPerf.Create(KMultiPtrEventHandlingPerf, buf)); TRequestStatus stat; eventHandPerf.Logon(stat); eventHandPerf.Resume(); User::WaitForRequest(stat); eventHandPerf.Close(); // Once the process finished its execution print the result by // reading the data from chunk's memory TPtr8 ptrDes((TUint8*)perfDesc, memSize, memSize); TPtr8 ptrDesDisplay((TUint8*)perfDesc, memSize, memSize); // If it has failed then just print description written in the same // when it is failed description contains '*' at the end TInt lastChar = 0; lastChar = ptrDes.Locate('*'); if (KErrNotFound != lastChar) { SetTestStepResult(EFail); TPtr8 temp = ptrDesDisplay.LeftTPtr(lastChar); TBuf<128> buf; buf.Copy(temp); INFO_PRINTF2(_L("%S"), &buf); RDebug::RawPrint(temp); goto END; } // If it has skipped then just print skip description from the chunk // when it is skipped description contains '#' at the end lastChar = ptrDes.Locate('#'); if (KErrNotFound != lastChar) { SetTestStepResult(EPass); TPtr8 temp = ptrDesDisplay.LeftTPtr(lastChar); TBuf<128> buf; buf.Copy(temp); INFO_PRINTF2(_L("%S"), &buf); RDebug::RawPrint(temp); goto END; } // If the every thing goes fine the descriptor is displayed as // "12345678,123456789,123456789" TInt avg4Events, avg8Events, avg16Events, avg32Events; bufAvg.Copy(ptrDesDisplay); for (TInt i=0; i<4; i++) { TInt locate = bufAvg.Locate(','); if (locate == KErrNotFound) { SetTestStepResult(EFail); goto END; } TLex lex(bufAvg.Left(locate)); lex.Val(avg4Events); locate++; temp.Set(bufAvg.MidTPtr(locate)); locate = temp.Locate(','); if (locate == KErrNotFound) { SetTestStepResult(EFail); goto END; } lex = temp.Left(locate); lex.Val(avg8Events); locate++; temp1.Set(temp.MidTPtr(locate)); locate = temp1.Locate(','); if (locate == KErrNotFound) { SetTestStepResult(EFail); goto END; } lex = temp.Left(locate); lex.Val(avg16Events); locate++; temp2.Set(temp1.MidTPtr(locate)); locate = temp2.Locate(','); if (locate == KErrNotFound) { SetTestStepResult(EFail); goto END; } lex = temp2.Left(locate); lex.Val(avg32Events); locate++; bufAvg.Copy(temp2.MidTPtr(locate)); switch (i) { case 0: INFO_PRINTF5(_L("TID: Average time for Single pointer(wait after each event) for 4 events:%i 8 events:%i 16 events:%i 32events:%i"), avg4Events, avg8Events, avg16Events, avg32Events); break; case 1: INFO_PRINTF5(_L("TID: Average time for Multi pointer(wait after each event) for 4 events:%i 8 events:%i 16 events:%i 32events:%i"), avg4Events, avg8Events, avg16Events, avg32Events); break; case 2: INFO_PRINTF5(_L("TID: Average time for single pointer for 4 events:%i 8 events:%i 16 events:%i 32events:%i"), avg4Events, avg8Events, avg16Events, avg32Events); break; case 3: INFO_PRINTF5(_L("TID: Average time for Multi pointer for 4 events:%i 8 events:%i 16 events:%i 32events:%i"), avg4Events, avg8Events, avg16Events, avg32Events); SetTestStepResult(EPass); break; default: break; } } iProfiler->ResultsAnalysis(KEventHandlingPerfName, 0, EColor16MA, EColor16MA, 1); END: // Once the data is printed or displyed delete the memory heap->Free(perfDesc); CleanupStack::PopAndDestroy(2, heap); RecordTestResultL(); CloseTMSGraphicsStep(); return TestStepResult(); }
void TSimpleSettings::ReadIniFileL( RFs& aFs ) { // Set few values without reading them from ini file CSimpleSettingFile* configFile = CSimpleSettingFile::NewL( aFs ); CleanupStack::PushL( configFile ); // ***** // Search current drive TFileName path; Dll::FileName( path ); TDriveName drive( TParsePtrC( path ).Drive( ) ); // In emulator we try to find from c drive // in hardware we try to find from current drive and then from RAM. #ifdef __WINS__ TFileName fileN( KSimpleIniFile); #else TFileName fileN( drive ); fileN.Append( KSimpleIniFile ); #endif TInt err = 0; // Open temporary config file TRAP( err, configFile->OpenL( fileN )); if ( err && drive.CompareF( _L("c:") )) { err = KErrNone; fileN = _L("c:"); fileN.Append( KSimpleIniFile ); TRAP( err, configFile->OpenL( fileN )); } if ( err ) { err = KErrNone; TSimpleLogger::Log(_L("Config file not found ***")); User::Leave( KErrNotFound ); } else { TSimpleLogger::Log(_L("Config file found ***")); } TUint32 myUint = 0; TPtrC8 myPtr; TBuf<8> myBuffer; // read expiry times TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryPuhlish))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iExpiryPuhlish = (TInt) myUint; } TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryWatcher))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iExpiryWatcher = (TInt) myUint; } TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryWinfo))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iExpiryWinfo = (TInt) myUint; } TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryAPI))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iExpiryApi = (TInt) myUint; } TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleObjLimit))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iObjLimit = (TInt) myUint; } TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleThrottle))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iThrottle = (TInt) myUint; } TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleMaxSubs))); if ( !err ) { myBuffer.Copy( myPtr ); TLex lex; lex.Assign( myBuffer ); lex.Val(myUint, EDecimal); iMaxSubscriptions = (TInt) myUint; } CleanupStack::PopAndDestroy(configFile); // debug logging TSimpleLogger::Log(_L("ReadFile iExpiryPuhlish=%d iExpiryWatcher=%d iExpiryWinfo=%d iExpiryAPI=%d"), iExpiryPuhlish, iExpiryWatcher, iExpiryWinfo, iExpiryApi); TSimpleLogger::Log(_L("ReadFile iObjLimit=%d iThrottle=%d iMaxSubs=%d"), iObjLimit, iThrottle, iMaxSubscriptions ); }
GLDEF_C TInt E32Main() { // test.SetLogged(EFalse); // Turn off serial port debugging! TInt r; test.Title(); test.Start(_L("PC Card Modem Test Program")); RProcess proc; TBuf <0x100> cmd; proc.CommandLine(cmd); // First parameter (if present) sets the serial port number TInt port=0; if ((cmd.Length()>0) && (cmd[0]>='1' && cmd[0]<='4')) port=(TInt)(cmd[0]-'0'); // 2nd parameter (if present) sets the start speed // (4=115K,3=57600,2=38400,1=19200,0=9600) TInt startSpeed=4; if ((cmd.Length()>3) && (cmd[2]>='0' && cmd[2]<='4')) startSpeed=(TInt)(cmd[2]-'0'); test.Next(_L("Load Device Drivers")); TBuf<10> pddName=PDD_NAME; #if !defined (__WINS__) pddName[5]=(TText)('1'+port); TInt muid=0; if (HAL::Get(HAL::EMachineUid, muid)==KErrNone) { // Brutus uses EUART4 for both COM3 and COM4 if (muid==HAL::EMachineUid_Brutus && port==4) pddName[5]=(TText)'4'; } #endif r=User::LoadPhysicalDevice(pddName); test(r==KErrNone||r==KErrAlreadyExists); r=User::LoadLogicalDevice(LDD_NAME); test(r==KErrNone||r==KErrAlreadyExists); test.Next(_L("Open serial port")); theSerialPort=new RComm; test(theSerialPort!=NULL); r=theSerialPort->Open(port); test(r==KErrNone); // TCommCaps capsBuf; // TCommCapsV01& caps=capsBuf(); // theSerialPort->Caps(capsBuf); // Check that the driver powering sequence has completed successfully by // issueing a few simple driver control functions. test.Next(_L("Modem power tests")); test(theSerialPort->SetReceiveBufferLength(KStandardRxBufferSize)==KErrNone); r=theSerialPort->ReceiveBufferLength(); // test.Printf(_L("(%d)"),r); // ??? test(r==KStandardRxBufferSize); r=(TInt)theSerialPort->Signals(); // test.Printf(_L("(%d)"),r); // ??? test(r>=0); RTimer timer; TRequestStatus rs; test(timer.CreateLocal()==KErrNone); TTime tim; tim.HomeTime(); tim+=TTimeIntervalSeconds(8); timer.At(rs,tim); UserHal::SwitchOff(); User::WaitForRequest(rs); test(rs.Int()==KErrNone); r=theSerialPort->ReceiveBufferLength(); // test.Printf(_L("(%d)"),r); // ??? test(r==KStandardRxBufferSize); r=(TInt)theSerialPort->Signals(); // test.Printf(_L("(%d)"),r); // ??? test(r>=0); User::After(2000000); // 2Secs !!! if (startSpeed>=4) { test.Next(_L("Testing at 115K")); testAllLineRates(EBps115200); } if (startSpeed>=3) { test.Next(_L("Testing at 57600")); testAllLineRates(EBps57600); } if (startSpeed>=2) { test.Next(_L("Testing at 38400")); testAllLineRates(EBps38400); } if (startSpeed>=1) { test.Next(_L("Testing at 19200")); testAllLineRates(EBps19200); } test.Next(_L("Testing at 9600")); testAllLineRates(EBps9600); test.Next(_L("Close serial port")); theSerialPort->Close(); delete theSerialPort; test.End(); return(KErrNone); }
/* ??? LOCAL_C void PrintBuf(TDes8 &aBuf) // // Print the contents of a buffer // { TInt len=aBuf.Length(); for (TInt i=0;i<=len/8;i++) { test.Printf(_L("%4d: "),i*8); for (TInt j=0;j<8;j++) { if ((i*8)+j>=len) break; TInt v=aBuf[(i*8)+j]; test.Printf(_L("%02x "),v); } test.Printf(_L("\n\r")); } } */ LOCAL_C void testLoopBack(TLineRate aLineRate,TBps aBaudRate) // // Perform an analogue loopback test at the specified linerate // { TInt err; TBuf<64> b; TPtrC bd=BaudRateInText(aBaudRate); b.Format(_L("Loopback test(%S)"),&bd); test.Start(b); TBuf8<KBlockSize> txBuf; theSerialPort->ResetBuffers(); txBuf.Format(_L8("AT&F+MS=%d,0,%d,%d\\N0&K3&D2M0\r"),LineModeData[aLineRate],LineRateData[aLineRate],LineRateData[aLineRate]); test(theSerialPort->WriteS(txBuf)==KErrNone); TBuf8<KBlockSize> rxBuf; User::After(2000000); // 2Secs err=theSerialPort->QueryReceiveBuffer(); test(err>0); rxBuf.SetLength(err); TRequestStatus rxStat; theSerialPort->ReadOneOrMore(rxStat,rxBuf); User::WaitForRequest(rxStat); // test.Printf(_L(" Rx(%d):"),rxStat); // ??? test(rxStat==KErrNone); txBuf.Append(_L("\r\nOK\r\n")); err=rxBuf.Compare(txBuf); // test(TranslateCrLf(rxBuf)==KErrNone); // ??? // test.Printf(_L(" %S\r\n"),&rxBuf); // ??? test(err==0); test.Next(_L("Get loopback")); txBuf.Format(_L8("AT&T1\r")); test(theSerialPort->WriteS(txBuf)==KErrNone); User::After(5000000); // 5Secs err=theSerialPort->QueryReceiveBuffer(); test(err>0); rxBuf.SetLength(err); theSerialPort->ReadOneOrMore(rxStat,rxBuf); User::WaitForRequest(rxStat); test.Printf(_L(" Rx(%d):"),rxStat); test(rxStat==KErrNone); txBuf.AppendFormat(_L8("\r\nCONNECT %d\r\n"),LineConnectData[aLineRate]); err=rxBuf.Compare(txBuf); test(TranslateCrLf(rxBuf)==KErrNone); test.Printf(_L(" %S\r\n"),&rxBuf); // Print what we got back (without CR/LF etc). // Sometimes get extra character as modem goes on-line so just look for command echo + connect test(err>=0); User::After(2000000); // 2Secs TInt totalBlocksToTransfer; if (aBaudRate<EBps1200||aLineRate<EV22_1200) totalBlocksToTransfer=KBlocksShort; else if (aBaudRate<EBps4800||aLineRate<EV32_4800) totalBlocksToTransfer=KBlocksMedium; else if (aLineRate<EV34_28800) totalBlocksToTransfer=KBlocksLong; else totalBlocksToTransfer=KBlocksVeryLong; b.Format(_L("Transfering data(%dK)"),(totalBlocksToTransfer*KBlockSize)/1024); test.Next(b); TInt loopBackFail=KErrGeneral; TRequestStatus txStat; txBuf.SetLength(KBlockSize); TInt i; for (i=0; i<KBlockSize; i++) txBuf[i]=(TUint8)i; theSerialPort->Write(txStat,txBuf,KBlockSize); TInt txBlks=(totalBlocksToTransfer-1); rxBuf.Fill(0,KBlockSize); theSerialPort->Read(rxStat,rxBuf,KBlockSize); TInt rxBlks=0; TRequestStatus tStat; RTimer tim; test(tim.CreateLocal()==KErrNone); tim.After(tStat,40000000); // 40Secs test.Printf(_L(">")); FOREVER { User::WaitForAnyRequest(); if (tStat!=KRequestPending) { // test.Printf(_L("t")); // Timed out theSerialPort->ReadCancel(); // Cancel serial read User::WaitForRequest(rxStat); if (txBlks>0) { theSerialPort->WriteCancel(); // Cancel serial write User::WaitForRequest(txStat); } loopBackFail=KErrTimedOut; // Test failed break; } else if (rxStat!=KRequestPending) { // test.Printf(_L("r")); // Serial rx request complete if (rxStat!=0) { loopBackFail=rxStat.Int(); // Test failed goto endSerial; } for (i=0; i<KBlockSize; i++) { if (rxBuf[i]!=i) { loopBackFail=KErrCorrupt; // Test failed rxBuf[KBlockSize-1]=0; // PrintBuf(rxBuf); // ??? // goto endSerial; // !!!Ignore compare fails for now!!! } } test.Printf(_L("<")); if (++rxBlks<totalBlocksToTransfer) { rxBuf.Fill(0,KBlockSize); theSerialPort->Read(rxStat,rxBuf,KBlockSize); } else { loopBackFail=KErrNone; endSerial: tim.Cancel(); // Cancel timer request. User::WaitForRequest(tStat); if (txBlks>0) { theSerialPort->WriteCancel(); // Cancel serial write User::WaitForRequest(txStat); } break; } } else if (txStat!=KRequestPending) { // test.Printf(_L("s")); // Serial tx request complete if (txBlks>0) { theSerialPort->Write(txStat,txBuf,KBlockSize); test.Printf(_L(">")); txBlks--; } } else { // test.Printf(_L("?")); // Stray signal - cancel everything theSerialPort->ReadCancel(); // Cancel serial read User::WaitForRequest(rxStat); tim.Cancel(); // Cancel timer request. User::WaitForRequest(tStat); if (txBlks>0) { theSerialPort->WriteCancel(); // Cancel serial write User::WaitForRequest(txStat); } loopBackFail=KErrDied; break; } } test.Printf(_L(" (%d)\r\n"),loopBackFail); // !!! At this point RTS may or may not be asserted following the write cancel. The // following seems necessary to make sure RTS is asserted so any remaining Rx data // can be received.and thrown away User::After(2000000); theSerialPort->ResetBuffers(); User::After(1000000); // Wait 1Secs for any remaining Rx data tim.Close(); test.Next(_L("Disconnect")); theSerialPort->ResetBuffers(); // Through away any remaining Rx data. txBuf.Format(_L8("+++")); test(theSerialPort->WriteS(txBuf)==KErrNone); User::After(2000000); // 2Secs err=theSerialPort->QueryReceiveBuffer(); test(err>0); rxBuf.SetLength(err); theSerialPort->ReadOneOrMore(rxStat,rxBuf); User::WaitForRequest(rxStat); test(rxStat==KErrNone); txBuf.Append(_L("\r\nOK\r\n")); err=rxBuf.Compare(txBuf); // test(TranslateCrLf(rxBuf)==KErrNone); // ??? // test.Printf(_L(" %S\r\n"),&rxBuf); // ??? test(err==0); txBuf.Format(_L8("ATH0\r")); test(theSerialPort->WriteS(txBuf)==KErrNone); User::After(4000000); // 4Secs err=theSerialPort->QueryReceiveBuffer(); test(err>0); rxBuf.SetLength(err); theSerialPort->ReadOneOrMore(rxStat,rxBuf); User::WaitForRequest(rxStat); test(rxStat==KErrNone); txBuf.Append(_L("\r\nOK\r\n")); err=rxBuf.Compare(txBuf); // test(TranslateCrLf(rxBuf)==KErrNone); // ??? // test.Printf(_L(" %S\r\n"),&rxBuf); // ??? test(err==0); test.Next(_L("Check result")); test(loopBackFail==KErrNone || loopBackFail==KErrCorrupt); // !!!Ignore compare fails for now!!! // test(loopBackFail==KErrNone); test.End(); }
LOCAL_C void systemRFstest() // // // { //system systestname=KSystemPath; systestname[0]=(TText)('A' + gTheDriveNum); mkdirname.Zero(); mkdirname.Append(systestname); mkdirname.Append(KMkDirSub); r=TheFs.MkDirAll(mkdirname); test_Value(r, r == KErrPermissionDenied); r=TheFs.RmDir(mkdirname); test_Value(r, r == KErrPermissionDenied); r=TheFs.SetSubst(systestname,EDriveS); test_Value(r, r == KErrPermissionDenied); r=TheFs.SetSessionPath(systestname); test_Value(r, r == KErrPermissionDenied); TheFs.NotifyChange(ENotifyAll,aStat1,systestname); test(aStat1==KErrPermissionDenied); systestfile=KSystemPath; systestfile[0]=(TText)('A' + gTheDriveNum); systestfile1=systestfile; systestfile.Append(KFileSys); systestfile1.Append(KFileSys3); oldName=KOldFile; oldName[0]=(TText)gDriveToTest; r=TheFs.GetShortName(systestfile, shortfilename); test_Value(r, r == KErrPermissionDenied); r=TheFs.GetLongName(systestfile1, longfilename); test_Value(r, r == KErrPermissionDenied); r=file1.Create(TheFs,oldName,EFileWrite); test_Value(r, r == KErrNone || r==KErrAlreadyExists); file1.Close(); r=TheFs.Replace(oldName,systestfile); test_Value(r, r == KErrPermissionDenied); r=TheFs.Rename(systestfile,systestfile1); test_Value(r, r == KErrPermissionDenied); r=TheFs.Entry(systestfile1,entry); test_Value(r, r == KErrPermissionDenied); r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); test_Value(r, r == KErrPermissionDenied); r=TheFs.Delete(systestfile1); test_Value(r, r == KErrPermissionDenied); // DEF141257: Security Issue in File Server // Test that we can't access the system drive by preceding it with a dot character _LIT(KSystemPathDot, "?:\\.Sys\\"); // try creating a file in "\.SYS"... TBuf<40> SysTestFileDot; SysTestFileDot=KSystemPathDot; SysTestFileDot[0]=(TText)('A' + gTheDriveNum); SysTestFileDot.Append(KFileSys); RFile file; r = file.Replace(TheFs, SysTestFileDot, EFileWrite); test_Value(r, r == KErrPathNotFound); // try creating a subst drive for "\.SYS"... TBuf<40> SysTestNameDot; SysTestNameDot=KSystemPathDot; SysTestNameDot[0]=(TText)('A' + gTheDriveNum); r=TheFs.SetSubst(SysTestNameDot,EDriveA); test_KErrNone(r); // try creating a file using substituted drive... TBuf<40> SubstTestFile = _L("A:\\"); SubstTestFile.Append(KFileSys); r = file.Replace(TheFs, SubstTestFile, EFileWrite); test_Value(r, r == KErrPathNotFound); r = TheFs.SetSubst(_L(""),EDriveA); test_KErrNone(r); // try listing files in "\.SYS" _LIT(KWildPathDot, "Z:\\.SYS\\"); TFindFile finder(TheFs); CDir* dir = NULL; r=finder.FindWildByDir(KWildFile, KWildPathDot, dir); test_Value(r, r == KErrNotFound); delete dir; // Deliberately create a directory called "\.SYS" // and verify shortname is NOT the same as "SYS" mkdirname.Zero(); mkdirname.Append(KSystemPathDot); mkdirname[0]=(TText)('A' + gTheDriveNum); r=TheFs.MkDirAll(mkdirname); test_KErrNone(r); r=TheFs.GetShortName(mkdirname, shortfilename); test_Value(r, r == KErrNone || r==KErrNotSupported); // short names not supported on LFFS // r = shortfilename.Compare(_L("SYS~1")); // test_KErrNone(r); r = shortfilename.Compare(_L("SYS")); test (r != 0); r = TheFs.RmDir(mkdirname); test_KErrNone(r); // Deliberately create a directory called "\..SYS" // and verify shortname is NOT the same as "SYS" _LIT(KSystemPathDotDot, "?:\\..Sys\\"); mkdirname.Zero(); mkdirname.Append(KSystemPathDotDot); mkdirname[0]=(TText)('A' + gTheDriveNum); r=TheFs.MkDirAll(mkdirname); test_KErrNone(r); r=TheFs.GetShortName(mkdirname, shortfilename); test_Value(r, r == KErrNone || r==KErrNotSupported); // short names not supported on LFFS // r = shortfilename.Compare(_L("_.SYS")); // test_KErrNone(r); r = shortfilename.Compare(_L("SYS")); test (r != 0); r = TheFs.RmDir(mkdirname); test_KErrNone(r); }
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
void bases::MergeCells( CList< TInt >& Candidates) { CALLSTACKITEM_N(_CL("bases"), _CL("MergeCells")); RDebug::Print(_L("Merging Cells...")); double max_time=0.0; CList< TInt >::Node *n=Candidates.iFirst; cell_list_node *merge_to=0, *cand_n=0; while (n) { cand_n=(cell_list_node*)cell_hash->GetData(n->Item); if (cand_n->t > max_time) { max_time=cand_n->t; merge_to=cand_n; } n=n->Next; } if (op) { op->write_time(now); op->write_to_output(_L("merging: ")); } TBuf<30> id; n=Candidates.iFirst; double added_time=0.0; auto_ptr< CList<TInt> > cells_in_merge_to( iMerged->GetCells(merge_to->id) ); while (n) { cand_n=(cell_list_node*)cell_hash->GetData(n->Item); if (cand_n != merge_to ) { auto_ptr< CList<TInt> > cells_in_merge_from( iMerged->GetCells(cand_n->id) ); if (op) { id.Format(_L("%d "), n->Item); op->write_to_output(id); } cand_n->merged_to=merge_to->id; added_time+=cand_n->t; merge_to->unaged_t+=cand_n->unaged_t; merge_to->f+=cand_n->f; CList<TInt>::Node *to_i, *from_i; for (from_i=cells_in_merge_from->iFirst; from_i; from_i=from_i->Next) { for (to_i=cells_in_merge_to->iFirst; to_i; to_i=to_i->Next) { merge_to->f-=iGraph->GetCount(from_i->Item, to_i->Item); merge_to->f-=iGraph->GetCount(to_i->Item, from_i->Item); } iMerged->Add(from_i->Item, merge_to->id); } cand_n->t=0; // FIXME: isn't correct if several to-be-merged // are adjacent in the list cand_n->cum_t=cand_n->prev->cum_t; // TODO: what should be done with the count? update_database(cand_n, false); } n=n->Next; } if (op) { id.Format(_L(" into %d\n"), merge_to->id); op->write_to_output(id); } total_t-=added_time; move_into_place(merge_to, added_time); update_database(merge_to, merge_to==current); }
EXPORT_C void CIpuTestHarness::DumpData(HBufC8& aData, TBool logIt) // // Do a formatted dump of binary data, optionally logging it { // Iterate the supplied block of data in blocks of 16 bytes TInt pos = 0; TBuf<KMaxLogEntrySize> logLine; TBuf<KMaxLogEntrySize> anEntry; while (pos < aData.Length()) { anEntry.Format(TRefByValue<const TDesC>_L("%04x : "), pos); logLine.Append(anEntry); // Hex output TInt offset = 0; for (offset = 0; offset < 16; offset++) { if (pos + offset < aData.Length()) { TInt nextByte = aData[pos + offset]; anEntry.Format(TRefByValue<const TDesC>_L("%02x "), nextByte); logLine.Append(anEntry); } else { anEntry.Format(TRefByValue<const TDesC>_L(" ")); logLine.Append(anEntry); } } anEntry.Format(TRefByValue<const TDesC>_L(": ")); logLine.Append(anEntry); // Char output for (offset = 0; offset < 16; offset++) { if (pos + offset < aData.Length()) { TInt nextByte = aData[pos + offset]; if ((nextByte >= 32) && (nextByte <= 127)) { anEntry.Format(TRefByValue<const TDesC>_L("%c"), nextByte); logLine.Append(anEntry); } else { anEntry.Format(TRefByValue<const TDesC>_L(".")); logLine.Append(anEntry); } } else { anEntry.Format(TRefByValue<const TDesC>_L(" ")); logLine.Append(anEntry); } } if (logIt) { LogIt(TRefByValue<const TDesC>_L("%S"), &logLine); } else { iTest.Printf(TRefByValue<const TDesC>_L("%S\n"), &logLine); } logLine.Zero(); // Advance to next 16 byte segment pos += 16; } }
EXPORT_C void bases::test(COperatorMap* aOpMap, CCellMap* aCellMap) { CALLSTACKITEM_N(_CL("bases"), _CL("test")); #ifdef __WINS__ aOpMap->AddRef(); iTimer->Reset(); testing=true; bool first=true; test_flags=0; scale=1.0; proportion=0.9; learning_done=false; RFile testf; TFileText test; int ts_len=15; TBuf<128> filen; TBuf<256> line; TBuf<30> id_d, dt_d; filen.Append(DataDir()); filen.Append(_L("bases_test_data.txt")); op=Cfile_output_base::NewL(AppContext(), _L("bases")); Cfile_output_base& o=*op; CBBSensorEvent e(KCell, KCellIdTuple); TBBCellId cell(KCell); e.iData.SetValue(&cell); e.iData.SetOwnsValue(EFalse); if (testf.Open(Fs(), filen, EFileShareAny | EFileStreamText | EFileRead)==KErrNone) { CleanupClosePushL(testf); test.Set(testf); int j=0; //int beg=23000, end=230000; int beg=0, end=0; while ( test.Read(line) == KErrNone && j < end) { //for (int i=0;i<TEST_DATA_COUNT; i++) { if (! (j % 1000) ) { TBuf<40> msg; msg.Format(_L("Testing at %d"), j); RDebug::Print(msg); } j++; if (j>=beg) { dt_d=line.Left(ts_len); id_d=line.Mid(ts_len+1); TTime time(dt_d); now=time; if (first) { previous_time=now; first_time=now; first=false; previous_day=previous_time; } if (! id_d.Compare(_L("SWITCH"))) { started=true; } else { e.iStamp()=time; CCellMap::Parse(id_d, cell.iCellId(), cell.iLocationAreaCode(), cell.iShortName()); if (cell.iCellId()==0 && cell.iLocationAreaCode()==0) { cell.iMCC()=0; cell.iMNC()=0; } else { aOpMap->NameToMccMnc(cell.iShortName(), cell.iMCC(), cell.iMNC()); } cell.iMappedId()=aCellMap->GetId(cell); NewSensorEventL(KNoTuple, KNullDesC, e); // name is ignored } } } CleanupStack::PopAndDestroy(); // testf } e.iData.SetValue(0); if (! (test_flags & NO_DB_UPDATE) ) { read_from_database(false, 0); } line.Format(_L("total %f\n"), total_t); o.write_to_output(line); cell_list_node* n=first_cell; while (n) { TInt base=0; if (n->is_base) base=1; line.Format(_L("%d: t %f f %d cum_t %f base %d merged to %d\n"), n->id, n->t, n->f, n->cum_t, base, n->merged_to); o.write_to_output(line); n=n->next; } o.write_to_output(_L("MAPPINGS:\n")); aCellMap->PrintMapping(o); delete op; User::LeaveIfError(table.SetIndex(idx_id)); testing=false; //clear(); iTimer->Wait(CELL_REFRESH); aOpMap->Release(); #endif }
TInt CIpuTestHarness::ReadLineFromScript(TDes& aBuffer) // // Reads the next line from the script file, and sets the passed-in descriptor with its contents. // Returns KErrNone if reading succeeded; KErrNotFound if the EOF was reached. When EOF is reached, // the file is closed. { // ********************************* // Assume script is 8-bit text file // ********************************* TBool isAComment = ETrue; TInt err = KErrNone; TBuf<512> line; while (isAComment && !err) { TFileText text; text.Set(*iScriptFile); line.SetLength(0); for(;;) { TBuf8<2> c; err = iScriptFile->Read(c,1); if (err && err != KErrEof) { iTest.Printf(_L("Error reading file: %d\n"), err); break; } if (c.Length() == 0) { err = KErrEof; break; } else { if (c[0] == '\n') // break out if it is CR break; else if (c[0] != (TUint8)(0x0d)) // otherwise append the char, _unless_ it is a LF line.Append(c[0]); } } if (err == KErrNone && line.Locate('/') != 0) // comment (only works if it's the first character) { isAComment = EFalse; } } // The line read is not a comment, or have hit end of file if (!err) { // copy to passed in descriptor, but do not allow an overflow aBuffer.Copy(line.Left(aBuffer.MaxLength())); LogIt(_L("***SCRIPT : read command '%S' ***\n"), &aBuffer); } else { iScriptFile->Close(); err = KErrNotFound; iScriptRunning = EFalse; LogIt(_L("***SCRIPT ENDED***\n")); } return err; }
void CApaAppListServer::ConstructPathsToMonitorL() { TInt drivesToMonitor = KApaDrivesToMonitor; #ifdef __WINS__ // KApaDrivesToMonitor is a Rom patchable constant, so need an emulator equivalent // if WINS then read value from epoc.ini requires licencees to set property in epoc.ini // Usage: In epoc.ini patchdata_apserv_dll_KApaDrivesToMonitor 4 TInt valueOfKApaDrivesToMonitor = 0; if (UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"patchdata_apserv_dll_KApaDrivesToMonitor",&valueOfKApaDrivesToMonitor) == KErrNone) { drivesToMonitor = valueOfKApaDrivesToMonitor; } #endif if ( drivesToMonitor != KApaMonitorAllDrives ) { // 1. Create and add CApaFsNotifier for all locations belonging to a drive if the drive is set to monitor. // 2. Do this for all the drives which are required to monitor. TInt maskBit = 1; TChar driveLetter; //Only bits from 0(EDriveA)- 25(EDriveZ) are valid other bits are ignored from 32-bit KApaDrivesToMonitor. for ( TInt i = EDriveA; i <= EDriveZ; i++ ) { if ( drivesToMonitor & maskBit ) { RFs::DriveToChar(i,driveLetter); RBuf pathToBeMonitored; TBuf<1> drive; drive.Append(driveLetter); //Creating or Adding <driveLetter>:\private\10003a3f\import\apps\ path to monitor. pathToBeMonitored.CreateL(KAppRegistrationFileImportLocation()); CleanupClosePushL(pathToBeMonitored); pathToBeMonitored.Replace(0,1,drive); if ( iAppFsMonitor == NULL ) { iAppFsMonitor=CApaFsMonitor::NewL(iFs, pathToBeMonitored, TCallBack(&AppFsNotifyCallBack, this)); } else { iAppFsMonitor->AddLocationL(pathToBeMonitored); } CleanupStack::PopAndDestroy(&pathToBeMonitored); //Adding <driveLetter>:\resource\apps\ path to monitor. pathToBeMonitored.CreateL(KAppResourceAppsLocation()); CleanupClosePushL(pathToBeMonitored); pathToBeMonitored.Replace(0,1,drive); iAppFsMonitor->AddLocationL(pathToBeMonitored); CleanupStack::PopAndDestroy(&pathToBeMonitored); } maskBit = maskBit << 1; } } else { iAppFsMonitor=CApaFsMonitor::NewL(iFs, KAppRegistrationFileImportLocation, TCallBack(&AppFsNotifyCallBack, this)); iAppFsMonitor->AddLocationL(KAppResourceAppsLocation); } }
EXPORT_C TInt TRPSOwnNumbers::RetrieveOwnNumbersL(RMobilePhone& aPhone) { RDEBUGPRINTLOGGER1(_L("RPS: TRPSOwnNumbers::RetrieveOwnNumbersL")); RMobileONStore ownNumberStore; User::LeaveIfError(ownNumberStore.Open(aPhone)); CleanupClosePushL(ownNumberStore); // Get Own Number Information RMobileONStore::TMobileONStoreInfoV1 ownNumberInfo; RMobileONStore::TMobileONStoreInfoV1Pckg ownNumberInfoPckg(ownNumberInfo); TRequestStatus status; ownNumberStore.GetInfo(status, ownNumberInfoPckg); User::WaitForRequest(status); User::LeaveIfError(status.Int()); // // Read entire Own Number store entries if supported // TInt errorReadingWhole = KErrNone; TInt errorsExtractANumber(0); if(ownNumberInfo.iCaps & (TUint32)RMobilePhoneStore::KCapsWholeStore) { // Reads phone's entire ON list CMobilePhoneONList* onList = NULL; // Assumes we have a scheduler to work with. CActiveScheduler* sched = CActiveScheduler::Current(); CActiveONRetrieverRps* retriever = new(ELeave)CActiveONRetrieverRps(ownNumberStore, onList, errorReadingWhole, sched); CleanupStack::PushL(retriever); retriever->StartL(); sched->Start(); if(!errorReadingWhole) { // Verify that the name and number are OK. TInt numOfEntry = onList->Enumerate(); for(TInt x = 0; x < numOfEntry; ++x) { if(ExtractANumber(onList->GetEntryL(x)) != KErrNone) ++errorsExtractANumber; } } delete onList; CleanupStack::PopAndDestroy(); } TInt lenVoiceNum(iOwnVoiceNumber.Length()); TInt lenFaxNum(iOwnFaxNumber.Length()); TInt lenDataNum(iOwnDataNumber.Length()); if(!(lenVoiceNum && lenFaxNum && lenDataNum)) { // Try reading ON store one entry at a time for (TInt i = 1; i <= ownNumberInfo.iTotalEntries; i++) { RMobileONStore::TMobileONEntryV1 ownNumberEntry; ownNumberEntry.iIndex = i; RMobileONStore::TMobileONEntryV1Pckg ownNumberEntryPckg(ownNumberEntry); ownNumberStore.Read(status, ownNumberEntryPckg); User::WaitForRequest(status); ExtractANumber(ownNumberEntry); } // As the last resort, // if the voice number has not been found, assume it is under the Unspecified service tag if(iOwnVoiceNumber.Length() == 0) { RMobileONStore::TMobileONEntryV1 ownNumberEntry; ownNumberEntry.iIndex = 1; RMobileONStore::TMobileONEntryV1Pckg ownNumberEntryPckg(ownNumberEntry); ownNumberStore.Read(status, ownNumberEntryPckg); User::WaitForRequest(status); if (ownNumberEntry.iService == RMobilePhone::EServiceUnspecified) { TBuf<1> prependstr; prependstr.Zero(); if(ownNumberEntry.iNumber.iTypeOfNumber == RMobilePhone::EInternationalNumber || ownNumberEntry.iNumber.iTelNumber.Left(2) == KUKCountryCode) { prependstr = KPlus; } iOwnVoiceNumber = prependstr; iOwnVoiceNumber += ownNumberEntry.iNumber.iTelNumber; } } } CleanupStack::PopAndDestroy(); //ownNumberStore //often fax and data numbers are blank on the SIM so if that is the case then set them to be same as voice //Hopefully attempting to dial a data/fax call using the voice number should still work if(iOwnDataNumber.Length() == 0) iOwnDataNumber = iOwnVoiceNumber; if(iOwnFaxNumber.Length() == 0) iOwnFaxNumber = iOwnVoiceNumber; RDEBUGPRINTLOGGER2(_L("RPS: iOwnVoiceNumber=%S"), &iOwnVoiceNumber); RDEBUGPRINTLOGGER2(_L("RPS: iOwnDataNumber=%S"), &iOwnDataNumber); RDEBUGPRINTLOGGER2(_L("RPS: iOwnFaxNumber=%S"), &iOwnFaxNumber); return KErrNone; }
// --------------------------------------------------------- // CFepSetupContainer::InstallFepL // --------------------------------------------------------- // void CFepSetupContainer::InstallFepL() { TBuf<KFormatBufSize> formatingBuf; TInt index( 0 ); CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &index ); dlg->PrepareLC( R_FEPSETUP_LIST_QUERY ); dlg->SetItemTextArray( iNamesOfAvailableFeps ); dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Execute the dialog TInt answer = dlg->RunLD(); if( answer == EAknSoftkeyOk ) { #ifndef __SERIES60_3X__ // Series60 1.x/2.x API iEikonEnv->InfoMsg( TParsePtrC( iFileNamesOfAvailableFeps->MdcaPoint( index )).Name()); // The code below is to check whether the selected Fep is already installed. HBufC* fepToInstall = iFileNamesOfAvailableFeps->MdcaPoint( index ).AllocL(); CleanupStack::PushL( fepToInstall ); TPtr fepToInstallPtr( fepToInstall->Des() ); fepToInstallPtr.LowerCase(); // remove case-sensitivity TPtrC fepToInstallPtrC( TParsePtrC( fepToInstallPtr ).Name()); // file name parsing HBufC* currentFep = iCoeEnv->NameOfInstalledFepL(); CleanupStack::PushL( currentFep ); TPtr currentFepPtr( currentFep->Des() ); currentFepPtr.LowerCase(); // remove case-sensitivity TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing if( fepToInstallPtrC.Compare( currentFepPtrC ) == 0) // Already installed? { formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtrC ); } else { // Loads the specified FEP DLL into all running applications. // The current loaded FEP, if any, will be unloaded. iCoeEnv->InstallFepL( iFileNamesOfAvailableFeps->MdcaPoint( index )); formatingBuf.Format( KFepInstalled, &fepToInstallPtrC ); } CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote(); confirmationDialog->ExecuteLD( formatingBuf ); CleanupStack::PopAndDestroy( 2 ); // currentFep, fepToInstall; #else // Series60 3.x API TPtrC fepToInstallPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( index )).Name()); // file name parsing iEikonEnv->InfoMsg( fepToInstallPtr ); // The code below is to check whether the selected Fep is already installed. TUid fepToInstallUid = iFepUids[index]; TUid currentFepUid = iEikonEnv->FepUid(); if( currentFepUid == fepToInstallUid ) { formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtr ); } else { // Loads the specified FEP DLL into all running applications. // The current loaded FEP, if any, will be unloaded. iCoeEnv->InstallFepL( fepToInstallUid ); formatingBuf.Format( KFepInstalled, &fepToInstallPtr ); } CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote(); confirmationDialog->ExecuteLD( formatingBuf ); #endif } else { iEikonEnv->InfoMsg( KNoFep ); } }
TVerdict RGlobalEffectMainTest::DoTestStepL() { INFO_PRINTF1(_L("Check basic API calls on TestPlugin")); TVerdict result = EPass; __MM_HEAP_MARK; CTestGlobalEffect* plugin = NULL; TRAPD(error, plugin = CTestGlobalEffect::NewL(NULL)); if (error!=KErrNone) { INFO_PRINTF2(_L("CreateImplementationL() failed - %d"), error); return EFail; } CleanupStack::PushL(plugin); { // check Capability TUint value = plugin->Capability(EFalse); if (value!=0) { INFO_PRINTF2(_L("Capability(EFalse): expected 0 got - %d"), value); result = EFail; } value = plugin->Capability(ETrue); if (value!=0xffff) { INFO_PRINTF2(_L("Capability(ETrue): expected -1 got - %d"), value); result = EFail; } } // check settings by des, uid or value HBufC8* tempDes = NULL; TUid tempUid; TInt tempInt; TPckg<TInt> tempPackage (tempInt); { // initially (stage 1) nothing set, so SettingsByUidL() and ExtractValuesL() // should leave KErrNotSupported, and SettingsByDesL() should return "1234" TRAP(error, tempDes = plugin->SettingsByDesL()); if (error==KErrNone) { CleanupStack::PushL(tempDes); if (*tempDes!=_L8("1234")) { HBufC* tempDes16 = HBufC::NewMaxLC(tempDes->Length()); tempDes16->Des().Copy(*tempDes); INFO_PRINTF2(_L("Stage1: SettingsByDesL() expected \"1234\" got \"%S\""), tempDes16); result = EFail; CleanupStack::PopAndDestroy(tempDes16); } CleanupStack::PopAndDestroy(tempDes); tempDes = NULL; } else { INFO_PRINTF2(_L("Stage1: SettingsByDesL() returned %d"), error); result = EFail; } TRAP(error, tempUid = plugin->SettingsByUidL()); if (error!=KErrNotSupported) { INFO_PRINTF3(_L("Stage1: SettingsByUidL() expected KErrNotSupported got %d(0x%x)"), error, tempUid.iUid); result = EFail; } TRAP(error, plugin->ExtractValuesL(tempPackage)); if (error!=KErrNotSupported) { INFO_PRINTF3(_L("Stage1: ExtractValuesL() expected KErrNotSupported got %d(%d)"), error, tempInt); result = EFail; } } { // at stage 2, we set a value by UID, so now SettingsByUid returns something sensible TUid sampleUid = {0x1234567}; // any silly value will do plugin->SetSettingsByUidL(sampleUid); TRAP(error, tempDes = plugin->SettingsByDesL()); if (error==KErrNone) { CleanupStack::PushL(tempDes); if (*tempDes!=_L8("1234")) { HBufC* tempDes16 = HBufC::NewMaxLC(tempDes->Length()); tempDes16->Des().Copy(*tempDes); INFO_PRINTF2(_L("Stage2: SettingsByDesL() expected \"1234\" got \"%S\""), tempDes16); result = EFail; CleanupStack::PopAndDestroy(tempDes16); } CleanupStack::PopAndDestroy(tempDes); tempDes = NULL; } else { INFO_PRINTF2(_L("Stage2: SettingsByDesL() returned %d"), error); result = EFail; } TRAP(error, tempUid = plugin->SettingsByUidL()); if (error!=KErrNone) { INFO_PRINTF3(_L("Stage2: SettingsByUidL() expected KErrNone got %d(0x%x)"), error, tempUid.iUid); result = EFail; } else if (tempUid != sampleUid) { INFO_PRINTF3(_L("Stage2: SettingsByUidL() expected return of 0x%x got 0x%x"), sampleUid.iUid, tempUid.iUid); } TRAP(error, plugin->ExtractValuesL(tempPackage)); if (error!=KErrNotSupported) { INFO_PRINTF3(_L("Stage2: ExtractValuesL() expected KErrNotSupported got %d(%d)"), error, tempInt); result = EFail; } } { // at stage 3, we set a value by des, so again only SettingsByDesL() gives valid results _LIT8(KSampleDes, "89a"); plugin->SetSettingsByDesL(KSampleDes); TRAP(error, tempDes = plugin->SettingsByDesL()); if (error==KErrNone) { CleanupStack::PushL(tempDes); if (*tempDes!=KSampleDes) { HBufC* tempDes16 = HBufC::NewMaxLC(tempDes->Length()); tempDes16->Des().Copy(*tempDes); INFO_PRINTF2(_L("Stage3: SettingsByDesL() expected \"89a\" got \"%S\""), tempDes16); result = EFail; CleanupStack::PopAndDestroy(tempDes16); } CleanupStack::PopAndDestroy(tempDes); tempDes = NULL; } else { INFO_PRINTF2(_L("Stage3: SettingsByDesL() returned %d"), error); result = EFail; } TRAP(error, tempUid = plugin->SettingsByUidL()); if (error!=KErrNotSupported) { INFO_PRINTF3(_L("Stage3: SettingsByUidL() expected KErrNotSupported got %d(0x%x)"), error, tempUid.iUid); result = EFail; } TRAP(error, plugin->ExtractValuesL(tempPackage)); if (error!=KErrNotSupported) { INFO_PRINTF3(_L("Stage3: ExtractValuesL() expected KErrNotSupported got %d(%d)"), error, tempInt); result = EFail; } } { // at stage 4, we set a value by package buffer, so only that way returns valid value const TInt sampleInt = 10; TPckgC<TInt> sampleBuffer (sampleInt); plugin->SetByValuesL(sampleBuffer); TRAP(error, tempDes = plugin->SettingsByDesL()); if (error==KErrNone) { CleanupStack::PushL(tempDes); HBufC* tempDes16 = HBufC::NewMaxLC(tempDes->Length()); tempDes16->Des().Copy(*tempDes); INFO_PRINTF2(_L("Stage4: SettingsByDesL() expected KErrNotSupported got \"%S\""), tempDes16); result = EFail; CleanupStack::PopAndDestroy(2, tempDes); tempDes = NULL; } else if (error!=KErrNotSupported) { INFO_PRINTF2(_L("Stage4: SettingsByDesL() expected KErrNotSupported returned %d"), error); result = EFail; } TRAP(error, tempUid = plugin->SettingsByUidL()); if (error!=KErrNotSupported) { INFO_PRINTF3(_L("Stage4: SettingsByUidL() expected KErrNotSupported got %d(0x%x)"), error, tempUid.iUid); result = EFail; } TRAP(error, plugin->ExtractValuesL(tempPackage)); if (error!=KErrNone) { INFO_PRINTF3(_L("Stage4: ExtractValuesL() expected KErrNone got %d(%d)"), error, tempInt); result = EFail; } else if (tempInt!=sampleInt) { INFO_PRINTF3(_L("Stage4: ExtractValuesL() expected %d got %d"), sampleInt, tempInt); result = EFail; } } { // Check for Enabled() and IsActive() - should be false to start. poke value and show have // changed. Have to use custom command for SetActive() since not really the way to drive // - this should relate to the underlying implementation TBool enabled = plugin->IsEnabled(); TBool active = plugin->IsActive(); if (enabled!=EFalse || active!=EFalse) { INFO_PRINTF3(_L("Check1: active(%d) and enabled(%d) should have been false"), active, enabled); result = EFail; } plugin->SetEnabledL(ETrue); plugin->SetActive(ETrue); enabled = plugin->IsEnabled(); active = plugin->IsActive(); if (enabled==EFalse || active==EFalse) { INFO_PRINTF3(_L("Check2: active(%d) and enabled(%d) should have been true"), active, enabled); result = EFail; } } { // check preset - for test this ties up with the test plugin const TInt KPresetsCount = 3; MMmfGlobalAudioPresetList* list = plugin->KnownPresetsL(); // reproduce what the plugin will do and check if (list->MdcaCount()!=KPresetsCount) { INFO_PRINTF3(_L("Expected %d presets, got %d"), KPresetsCount, list->MdcaCount()); result = EFail; } else { for (TInt index=0; index<KPresetsCount; index++) { TBuf<10> name; name.Num(index); TUid tempUid={index}; TUid foundUid = list->GAPUidPoint(index); const TPtrC foundName = list->MdcaPoint(index); if (foundUid!=tempUid) { INFO_PRINTF4(_L("Index %d, expected %x found %x"), index, tempUid.iUid, foundUid.iUid); result = EFail; } if (foundName != name) { INFO_PRINTF4(_L("Index %d, expected %S found %S"), index, &name, &foundName); result = EFail; } } } } CleanupStack::PopAndDestroy(plugin); __MM_HEAP_MARKEND; return result; }
// --------------------------------------------------------- // CFepSetupContainer::UnInstallFepL // --------------------------------------------------------- // void CFepSetupContainer::UnInstallFepL() { TBuf<KFormatBufSize> formatingBuf; #ifndef __SERIES60_3X__ // Series60 1.x/2.x API HBufC* currentFep = iCoeEnv->NameOfInstalledFepL(); CleanupStack::PushL( currentFep ); TPtr currentFepPtr( currentFep->Des() ); currentFepPtr.LowerCase(); // remove case-sensitivity TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing if( ConeUtils::FileExists( KAknFepFileName )) // 2ndfp2 platform and newer use aknfep.fep { if( currentFepPtrC.Compare( TParsePtrC( KAknFepFileName ).Name() ) != 0 ) // Already installed? { iCoeEnv->InstallFepL( KAknFepFileName ); // Install the default Fep formatingBuf.Format( KFepUninstalled, ¤tFepPtrC ); } else { formatingBuf.Format( KFepAlreadyInstalled, ¤tFepPtrC ); } } else // older platforms use T9fep.fep { if( currentFepPtrC.Compare( TParsePtrC( KT9FepFileName ).Name() ) != 0 ) // Already installed? { iCoeEnv->InstallFepL( KT9FepFileName ); // Install the default Fep formatingBuf.Format( KFepUninstalled, ¤tFepPtrC ); } else { formatingBuf.Format( KFepAlreadyInstalled, ¤tFepPtrC ); } } CAknConfirmationNote* dialog = new(ELeave)CAknConfirmationNote(); dialog->ExecuteLD( formatingBuf ); CleanupStack::PopAndDestroy(); // currentFep #else // Series60 3.x API TUid currentFepUid = iEikonEnv->FepUid(); TInt defaultIndex = iFepUids.Find( KAknFepUid ); TPtrC defaultFepPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( defaultIndex )).Name()); // file name parsing if( currentFepUid == KAknFepUid ) // Already installed? { formatingBuf.Format( KFepAlreadyInstalled, &defaultFepPtr ); } else { iCoeEnv->InstallFepL( KAknFepUid ); // Install the default Fep formatingBuf.Format( KFepInstalled, &defaultFepPtr ); } CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote(); confirmationDialog->ExecuteLD( formatingBuf ); #endif }
/* ------------------------------------------------------------------------------- Class: TStifUtil Method: CorrectFilePath Description: Checks if file path contains drive letter. If not file is serched on all drives and first hit is added to file name. Parameters: TDes& aFilePath: in/out: file path to correct Return Values: None Errors/Exceptions: Leaves if some of called leaving methods leaves ------------------------------------------------------------------------------- */ EXPORT_C void TStifUtil::CorrectFilePathL( TDes& aFilePath ) { _LIT( KDriveSelector, ":\\" ); _LIT( KDriveSelectorFormat_1, "%c:" ); _LIT( KDriveSelectorFormat_2, "%c:\\" ); TChar KDriveZ = EDriveZ;//'Z'; _LIT( KBackslash, "\\" ); TInt length = aFilePath.Length(); if (length == 0 ) { return; } if (length > 2 ) { // Check if file path contains drive selector if ( aFilePath.Mid( 1, 2 ) == KDriveSelector ) { // File path contains selector letter so we have nothing to do here return; } } // Check if file path contains backslash at the begining and // select proper drive selector format according to this information TInt driveSelectorFormat = 2; if ( aFilePath.Mid( 0, 1 ) == KBackslash ) { driveSelectorFormat = 1; } RFs rfs; if ( rfs.Connect() != KErrNone ) { return; } // Get available drives list, revers it order and move z drive at // the end of the list. TDriveList drivesList; rfs.DriveList(drivesList); // Set drive variable to last drive (except for Z, which will be checked at the end) char drive = 'Y' ; // Loop through all the drives in following order: YX..CBAZ while(drive >= 'A' && drive <= 'Z') { // Do further action only if drive exists TInt driveint; rfs.CharToDrive(drive, driveint); if(drivesList[driveint]) { //further checking (drive selector and file existence) // Prepare drive selector TBuf<3> driveSelector; if ( driveSelectorFormat == 1 ) { driveSelector.Format( KDriveSelectorFormat_1, drive ); } else if ( driveSelectorFormat == 2 ) { driveSelector.Format( KDriveSelectorFormat_2, drive ); } aFilePath.Insert( 0, driveSelector ); TEntry entry; if ( rfs.Entry(aFilePath, entry) == KErrNone ) { rfs.Close(); return; } // File does not exists on selected drive. Restoring orginal file path aFilePath.Delete( 0, driveSelector.Length() ); }//if(drivesList[driveint]) // Select next drive if(drive == 'Z') break; // the last driver else if(drive == 'A' ) drive = 'Z'; //after checking A check Z else drive = (TChar)(TInt(drive)-1) ; //after checking Y check X and so on in reverse alphabetical order } //while rfs.Close(); }
// --------------------------------------------------------- // CCertManUIContainerTrust::UpdateTrustListboxItemL(CCrCertEntry& aEntry, // TInt aCurrentTruster) // Updates the Trust Settings Listbox item value // Can be called only for those certificates that are // located in ECrCertLocationCertMan !!! // Cannot be called for certificates located in ECrCertLocationWIMCard, // ECrCertLocationWIMURL, // ECrCertLocationPhoneMemory // ECrCertLocationPhoneMemoryURL // Certificate formats ECrX968Certificate ECrCertificateURL // are not visible in the Trust View // --------------------------------------------------------- // void CCertManUIContainerTrust::UpdateTrustListboxItemL(CCTCertInfo& aEntry, TInt aCurrentTruster) { CERTMANUILOGGER_ENTERFN( " CCertManUIContainerTrust::UpdateTrustListboxItemL" ); MDesCArray* itemList = iListBox->Model()->ItemTextArray(); CDesCArray* itemArray = STATIC_CAST( CDesCArray*, itemList ); TCertificateFormat format = aEntry.CertificateFormat(); TUid id = KCertManUINullId; TInt poppableItems = 0; TInt index = 0; if ( format == EX509Certificate ) { id = iClientUids[ aCurrentTruster ]; index = aCurrentTruster; } if ( id != KCertManUINullId ) { TBuf<KMaxLengthTextSettListOneTwo> item; if ( id == KCertManUIViewTrustApplicationControllerId ) { item = (*iTrustedClients)[ KTrustSettingsResourceIndexAppCtrl ]; } else if ( id == KCertManUIViewTrustMailAndImageConnId ) { item = (*iTrustedClients)[ KTrustSettingsResourceIndexMailAndImageConn ]; } else if ( id == KCertManUIViewTrustJavaInstallingId ) { item = (*iTrustedClients)[ KTrustSettingsResourceIndexJavaInstall ]; } else if ( id == KCertManUIViewOCSPCheckInstallingId ) { item = (*iTrustedClients)[ KTrustSettingsResourceIndexOCSPCheck ]; } else if ( id == KCertManUIViewTrustVPNId ) { item = (*iTrustedClients)[ KTrustSettingsResourceIndexVPN ]; } else { if ( iApps.Count() > 0 ) { const TName& name = iApps[index].Name(); TInt fieldLength = name.Length(); TBuf<KMaxLengthTextSettListOneTwo> item2; if ( fieldLength >= KMaxLengthTextSettListOne ) { item2 = name.Mid( 0, KMaxLengthTextSettListOne ); } else { item2 = name; } item.Format( KCertManUIFormatDescriptorTrustSettings, &item2 ); } } if ( item.Length() ) { if ( CheckCertificateClientTrustL(id, aEntry) ) { item += (*iTrustValues)[ KTrustSettingsResourceIndexValueYes ]; } else { item += (*iTrustValues)[ KTrustSettingsResourceIndexValueNo ]; } // need to Delete first the old Yes/No entry itemArray->Delete( aCurrentTruster ); itemArray->InsertL( aCurrentTruster, item ); } } CleanupStack::PopAndDestroy( poppableItems ); iListBox->HandleItemAdditionL(); CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerTrust::UpdateTrustListboxItemL" ); }
/** * Load and initialise an audio file. */ TVerdict CTestMmfAclntFileSource::DoTestStepL( void ) { INFO_PRINTF1( _L("TestPlayerUtils : File")); TVerdict ret = EFail; iError = KErrTimedOut; TBuf<KSizeBuf> filename; TPtrC filename1; if(!GetStringFromConfig(iSectName,iKeyName,filename1)) { return EInconclusive; } GetDriveName(filename); filename.Append(filename1); // Create CMdaAudioPlayerUtility Object CMdaAudioPlayerUtility* player = NULL; player = CMdaAudioPlayerUtility::NewL(*this); // Create TMMFileSource Object TMMFileSource filesource(filename); player->OpenFileL(filesource); // Wait for initialisation callback INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility")); CActiveScheduler::Start(); // Check for expected errors. if(iError != KErrNone && (iExpectedError == iError)) { ret = EPass; // all other tests pass delete player; User::After(KOneSecond); // wait for deletion to shut down devsound ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with expected error %d"),iError ); return ret; } // Check for errors (after OPEN). if (iError == KErrNone && player != NULL) { if(iPlay) { iError = KErrTimedOut; player->Play(); // Wait for play complete callback INFO_PRINTF1(_L("Play CMdaAudioPlayerUtility")); CActiveScheduler::Start(); // Check for Callback errors if(iError == KErrNone) { ret = EPass; } } else { ret = EPass; } } // Clean up activities. delete player; User::After(KOneSecond); // wait for deletion to shut down devsound // Check for errors (final check). if(iError != KErrNone) { ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); } return ret; }
// --------------------------------------------------------------------------- // CCertManUIContainerTrust::PopupTrustChangeSettingPageL( // TInt aCertificateIndex) // Finds out which client was focused in Trust Settings view and calls // ShowTrustChangeSettingPageL This is accessed only by X509S // certificates, located in CertMan and having one or more clients // Must be public so that viewTrust can access // --------------------------------------------------------------------------- // void CCertManUIContainerTrust::PopupTrustChangeSettingPageL( TInt aCertificateIndex ) { CERTMANUILOGGER_ENTERFN( " CCertManUIContainerTrust::PopupTrustChangeSettingPageL" ); // Use certificate index from previous view CCTCertInfo* entry = iKeeper.iCALabelEntries[ aCertificateIndex ]->iCAEntry; // if the certificate is read-only, trust settings cannot be changed if( !entry->IsDeletable() ) { CERTMANUILOGGER_LEAVEFN( "- PopupTrustChangeSettingPageL - read-only" ); return; } TUid id = KCertManUINullId; TInt poppableItems = 0; TBuf<KMaxLengthTextSettListOne> clientName; // get position of the focus in the Trust Settings view TInt currentPosition = iListBox->CurrentItemIndex(); id = iClientUids[ currentPosition ]; if ( id != KCertManUINullId ) { // Native installation if ( id == KCertManUIViewTrustApplicationControllerId ) { clientName = (*iTrustedClients)[ KTrustSettingsResourceIndexAppCtrl ]; } // TLS else if ( id == KCertManUIViewTrustMailAndImageConnId ) { clientName = (*iTrustedClients)[ KTrustSettingsResourceIndexMailAndImageConn ]; } // Midlet installation else if ( id == KCertManUIViewTrustJavaInstallingId ) { clientName = (*iTrustedClients)[ KTrustSettingsResourceIndexJavaInstall ]; } // OCSP else if ( id == KCertManUIViewOCSPCheckInstallingId ) { clientName = (*iTrustedClients)[ KTrustSettingsResourceIndexOCSPCheck ]; } // VPN else if ( id == KCertManUIViewTrustVPNId ) { clientName = (*iTrustedClients)[ KTrustSettingsResourceIndexVPN ]; } else { if ( iApps.Count() > 0 ) { const TName& name = iApps[currentPosition].Name(); TInt fieldLength = name.Length(); if ( fieldLength >= KMaxLengthTextSettListOne ) { clientName = name.Mid(0, KMaxLengthTextSettListOne); } else { clientName = name; } } } } if ( id != KCertManUINullId ) { clientName.TrimLeft(); clientName.TrimRight(); ShowTrustChangeSettingPageL( id, clientName, *entry ); } CleanupStack::PopAndDestroy( poppableItems ); // clients CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerTrust::PopupTrustChangeSettingPageL" ); }
void CWordStyleGallery::FillBufferL(const CParaFormatLayer& aParaFormatLayer) { CEikGlobalTextEditor* edwin=(CEikGlobalTextEditor*)Control(EWordCidStyleInfo); TCharFormat charFormat; TCharFormatMask charMask; CParaFormat* paraFormat=CParaFormat::NewLC(); TParaFormatMask paraMask; // // iCurrentDescription=HBufC::NewL(KDescriptionGranularity); TPtr buf=iCurrentDescription->Des(); TBool isNormalStyle=(aParaFormatLayer.Type()==KNormalParagraphStyleUid); if (!isNormalStyle) { const CParagraphStyle* flayer=REINTERPRET_CAST(const CParagraphStyle*,aParaFormatLayer.SenseBase()); TUid type=flayer->Type(); if (type==KNormalParagraphStyleUid) buf.Append(iNormalName); else buf.Append(flayer->iName); buf.Append('+'); } // if (isNormalStyle) iData.iText.GlobalCharFormatLayer()->Sense(charFormat,charMask); else REINTERPRET_CAST(const CParagraphStyle&,aParaFormatLayer).CharFormatLayer()->Sense(charFormat,charMask); aParaFormatLayer.SenseL(paraFormat,paraMask); // if (!charMask.IsNull()) { if (charMask.AttribIsSet(EAttFontTypeface)) DoAppendDescriptionL(charFormat.iFontSpec.iTypeface.iName); if (charMask.AttribIsSet(EAttFontHeight)) { TInt height=charFormat.iFontSpec.iHeight; height=(height+10)/20; TBuf<20> num; num.Num(height); TBuf<10> unit; iCoeEnv->ReadResource(unit,R_WORD_FONT_UNITS); num.Append(unit); DoAppendDescriptionL(num); } if (charMask.AttribIsSet(EAttFontPosture)) { if (charFormat.iFontSpec.iFontStyle.Posture()==EPostureItalic) DoAppendDescriptionL((*iStyleDescriptor)[EDesItalic]); } if (charMask.AttribIsSet(EAttFontStrokeWeight)) { if (charFormat.iFontSpec.iFontStyle.StrokeWeight()==EStrokeWeightBold) DoAppendDescriptionL((*iStyleDescriptor)[EDesBold]); } if (charMask.AttribIsSet(EAttFontPrintPos)) { TFontPrintPosition pos=charFormat.iFontSpec.iFontStyle.PrintPosition(); switch(pos) { case EPrintPosSuperscript: DoAppendDescriptionL((*iStyleDescriptor)[EDesSuperscript]); break; case EPrintPosSubscript: DoAppendDescriptionL((*iStyleDescriptor)[EDesSubscript]); break; default: break; } } if (charMask.AttribIsSet(EAttFontUnderline)) { if (charFormat.iFontPresentation.iUnderline==EUnderlineOn) DoAppendDescriptionL((*iStyleDescriptor)[EDesUnderline]); } if (charMask.AttribIsSet(EAttFontStrikethrough)) { if (charFormat.iFontPresentation.iStrikethrough==EStrikethroughOn) DoAppendDescriptionL((*iStyleDescriptor)[EDesStrikethrough]); } } if (!paraMask.IsNull()) { AppendDescriptionL(EAttLeftMargin,paraMask); AppendDescriptionL(EAttRightMargin,paraMask); AppendDescriptionL(EAttIndent,paraMask); if (paraMask.AttribIsSet(EAttAlignment)) DoAppendDescriptionL((*iStyleDescriptor)[EDesLeftAlign+paraFormat->iHorizontalAlignment]); AppendDescriptionL(EAttLineSpacing,paraMask); AppendDescriptionL(EAttSpaceBefore,paraMask); AppendDescriptionL(EAttSpaceAfter,paraMask); AppendDescriptionL(EAttKeepTogether,paraMask); AppendDescriptionL(EAttKeepWithNext,paraMask); AppendDescriptionL(EAttStartNewPage,paraMask); AppendDescriptionL(EAttWidowOrphan,paraMask); AppendDescriptionL(EAttBorderMargin,paraMask); AppendDescriptionL(EAttTopBorder,*paraFormat,paraMask); AppendDescriptionL(EAttBottomBorder,*paraFormat,paraMask); AppendDescriptionL(EAttLeftBorder,*paraFormat,paraMask); AppendDescriptionL(EAttRightBorder,*paraFormat,paraMask); AppendDescriptionL(EAttBullet,paraMask); AppendDescriptionL(EAttTabStop,*paraFormat,paraMask); } CleanupStack::PopAndDestroy(); // paraFormat edwin->SetTextL(iCurrentDescription); delete iCurrentDescription; iCurrentDescription=NULL; DrawEdwinL(); }
LOCAL_C void privateSIDRFstest() // // // { //private/UID theprivatepath[0]=(TText)gDriveToTest; test.Printf(_L("the Private Path = %S"),&theprivatepath); mkdirname.Zero(); mkdirname.Append(theprivatepath); mkdirname.Append(KMkDirSub); r=TheFs.MkDirAll(mkdirname); test_KErrNone(r); r=TheFs.RmDir(mkdirname); test_KErrNone(r); r=TheFs.SetSubst(theprivatepath,EDriveS); test_KErrNone(r); r=TheFs.RealName(_L("S:\\File.XXX"),realName); test_KErrNone(r); r=TheFs.SetSubst(_L(""),EDriveS); test_KErrNone(r); r=TheFs.SetSessionPath(theprivatepath); test_KErrNone(r); TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); test(aStat3==KRequestPending); pritestfile=theprivatepath; pritestfile[0]=(TText)('A' + gTheDriveNum); pritestfile1=pritestfile; pritestfile.Append(KFilePri2); pritestfile1.Append(KFilePri3); oldName=KOldFile; oldName[0]=(TText)gDriveToTest; r=TheFs.GetShortName(pritestfile, shortfilename); test(r == KErrNone || KErrPathNotFound); // test_Value(r, r == KErrNone || r == KErrPathNotFound); r=TheFs.GetLongName(pritestfile1, longfilename); test(r == KErrNone || KErrPathNotFound); // test_Value(r, r == KErrNone || r == KErrPathNotFound); r=file1.Create(TheFs,oldName,EFileWrite); test_Value(r, r == KErrNone || r==KErrAlreadyExists); file1.Close(); r=TheFs.Replace(oldName,pritestfile); test_KErrNone(r); r=TheFs.Rename(pritestfile,pritestfile1); test_Value(r, r == KErrNone || r==KErrAlreadyExists); r=TheFs.Entry(pritestfile1,entry); test_KErrNone(r); r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); test_KErrNone(r); r=TheFs.Delete(pritestfile1); test_KErrNone(r); }