/*! \brief Changes the device system language. \attention Symbian specific API \deprecated HbLanguageUtil::changeLanguage( int language ) is deprecated. Please use HbLocaleUtil::changeLanguage( const QString &language ) instead. \param language identifier of language to set active \return true for Symbian if succesfull and false for other platforms */ bool HbLanguageUtil::changeLanguage( int language ) { #if defined(Q_OS_SYMBIAN) if ( !HbFeatureManager::instance()->featureStatus(HbFeatureManager::LanguageSwitch) ) { return false; } CRepository* commonEngineRepository = 0; TRAPD( err1, commonEngineRepository = CRepository::NewL( KCRUidCommonEngineKeys ) ); if ( err1 != KErrNone ) { return false; } if (!setLocale(language)) { delete commonEngineRepository; return false; } // Never set Language code 0 to HAL if ( language !=0 ) { if ( HAL::Set( HAL::ELanguageIndex, language ) != KErrNone ) { delete commonEngineRepository; return false; } } if ( commonEngineRepository->Set( KGSDisplayTxtLang, language ) != KErrNone ) { delete commonEngineRepository; return false; } delete commonEngineRepository; return true; #else Q_UNUSED(language); return false; #endif }
// ----------------------------------------------------------------------------- // CTCStateTiltListenData::GetCenrepValue // ----------------------------------------------------------------------------- // void CTCStateTiltListenData::GetCenrepValue( CRepository& aCenRep, TUint32 aKey, TInt aIndex ) { FUNC_LOG; TReal value; TInt err = aCenRep.Get( aKey, value ); ERROR_1( err, "CTCStateTiltListenData::GetCenrepValue: get err %d", err ); if( err == KErrNone && ( aIndex >= 0 && aIndex < iParamsArray.Count() ) ) { iParamsArray[aIndex] = value; } }
// --------------------------------------------------------- // TXdmSettingsApi::RemoveCollectionL // // --------------------------------------------------------- // EXPORT_C void TXdmSettingsApi::RemoveCollectionL( TInt aSettingsId ) { #ifdef _DEBUG WriteToLog( _L8( "TXdmSettingsApi::RemoveCollectionL() - ID: %d" ), aSettingsId ); #endif CRepository* repository = CRepository::NewL( KCRUidXdmEngine ); CleanupStack::PushL( repository ); TInt row = FindRowL( aSettingsId, repository ); if( row >= KErrNone ) { TInt32 key = -1; TInt error = KErrNone; for( TInt i = 0; i < KXdmPropertyCount; i++ ) { key = ( row * 0x100 ) | i; error = repository->Delete( key ); #ifdef _DEBUG WriteToLog( _L8( " Key %x deleted - Error: %d" ), key, error ); #endif } } else User::Leave( KErrNotFound ); CleanupStack::PopAndDestroy(); }
void DataMethodsTests::TestServeReceivedMessageChangeMinimumToExecution() { CReceiverWrapper vReceiver; vReceiver.ForTestSetSocket(new QTcpSocket()); char vMessage[] {">>1876<"}; size_t vMessageSize {sizeof(vMessage) - 1}; vReceiver.ForTestSetMessageSize(vMessageSize); vReceiver.ForTestSetMessage(vMessage); vReceiver.ForTestSetReceiveBuffer(new QByteArray("Test data")); gRepository.RefreshChecksums(); vReceiver.ForTestServeReceivedMessage(); QCOMPARE(vReceiver.ForTestGetMessageSize(), 0); QCOMPARE(*vReceiver.ForTestGetReveiveBuffer(), QByteArray()); }
void CHttpCacheManager::CreateVssCacheL( CRepository& aRepository, const TDesC& aVssCacheFolder, const TInt& aVssCacheSize, const TInt& aCriticalLevel, const THttpCachePostponeParameters& aPostpone ) { //Get the white list TBuf<2048> whiteList; if (aRepository.Get(KPhoneSpecificCacheDomainUrl, whiteList) == KErrNone) { iVSSWhiteList = HBufC8::NewL(whiteList.Length()); iVSSWhiteList->Des().Append(whiteList); } else { iVSSWhiteList = NULL; } // create cache handler iphoneSpecificCache = CHttpCacheHandler::NewL(aVssCacheSize, aVssCacheFolder, KDefaultVSSIndexFile(), aCriticalLevel, aPostpone); }
void DataMethodsTests::TestServeReceivedMessageChangeAllParam() { CReceiverWrapper vReceiver; vReceiver.ForTestSetSocket(new QTcpSocket()); char vMessage[] {">>645<"}; size_t vMessageSize {sizeof(vMessage) - 1}; vReceiver.ForTestSetMessageSize(vMessageSize); vReceiver.ForTestSetMessage(vMessage); vReceiver.ForTestSetReceiveBuffer(new QByteArray("Test data")); gRepository.RefreshChecksums(); vReceiver.ForTestSetDataSize(new int32_t(50)); vReceiver.ForTestSetReceiveByteCount(100); vReceiver.ForTestServeReceivedMessage(); QCOMPARE(*vReceiver.ForTestGetDataSize(), 0); QCOMPARE(vReceiver.ForTestGetMessageSize(), 0); QCOMPARE(vReceiver.ForTestGetReceiveByteCount(), 0); QCOMPARE(*vReceiver.ForTestGetReveiveBuffer(), QByteArray()); }
void CHttpCacheManager::CreateOperatorCacheL( CRepository& aRepository, const TDesC& aOpCacheFolder, const TInt& aOpCacheSize, const TInt& aCriticalLevel, const THttpCachePostponeParameters& aPostpone ) { TBuf<512> url; // if domain is missing, then no need to read further if (aRepository.Get(KOperatorDomainUrl, url) == KErrNone) { HBufC8* opDomain8 = HBufC8::NewL(url.Length()); CleanupStack::PushL(opDomain8); opDomain8->Des().Append(url); TInt slashPos = opDomain8->LocateReverse('/'); if (slashPos == -1) { slashPos = 0; } TPtrC8 temp = opDomain8->Left(slashPos); iOpDomain = temp.AllocL(); CleanupStack::PopAndDestroy(opDomain8); // create op cache iOperatorCache = CHttpCacheHandler::NewL( aOpCacheSize, aOpCacheFolder, KDefaultOpIndexFile(), aCriticalLevel, aPostpone); } }
/** @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4056 @SYMTestCaseDesc Test to confirm that keyspace files of mixed types (txt and cre) can be used to make up a keyspace @SYMTestPriority High @SYMTestActions Open keyspace 0x10286555. This keyspace is represented by one cre file and one txt files. The keyspace file names in the source have been mangled in a similar way to that which would be expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc. @SYMTestExpectedResults Ensure that the final value of the setting is as specified in the final ROFS layer that touched that setting. @SYMREQ REQ11282 */ LOCAL_C void MixedFileTypesL() { TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4056 " )); CRepository* rep; User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace6)); TInt settingValueInt = 0; TBuf<20> settingValueStr; TUint32 settingMeta = 0; TInt rtn = 0; // tests that the core value is not modified rtn = rep->Get(KKeyOne, settingValueInt); TEST2(settingValueInt, KKeyspace6Setting1Value); // tests that the core value is modified by the ROFS layer rtn = rep->Get(KKeyTwo, settingValueInt); TEST2(settingValueInt, KKeyspace6Setting2Value); // tests that the core metadata value is not modified rep->GetMeta(KKeyThree, settingMeta); TEST2(settingMeta, KKeyspace6Setting3Meta); // tests that the core metadata value is modified by the ROFS layer rep->GetMeta(KKeyFour, settingMeta); TEST2(settingMeta, KKeyspace6Setting4Meta); // tests that the platsec details have not been modified rtn = rep->Get(KKeyFive, settingValueStr); TEST2(rtn, KErrNone); // tests that the platsec details were modified in the ROFS layer rtn = rep->Get(KKeySix, settingValueStr); TEST2(rtn, KErrPermissionDenied); CleanupStack::PopAndDestroy(rep); }
/** Overrides pure virtual CTe_BaseStep::ReallyDoTestStepL. The test code is run here. @leave If a error happens, it leaves with one of the system error codes or EFail. */ void CTe_LbsSuplSmsTriggerIntegStep::ReallyDoTestStepL() { // Get the CategoryUid from the cenrep file owned by LbsRoot. TInt category; CRepository* rep = CRepository::NewLC(KLbsCenRepUid); User::LeaveIfError(rep->Get(KSuplPushAPIKey, category)); CleanupStack::PopAndDestroy(rep); TUid propOwnerSecureId = TUid::Uid(category); //Reset the values set by previous tests User::LeaveIfError(RProperty::Set(propOwnerSecureId, KLbsSuplPushSmsBusyKey, 1)); User::LeaveIfError(RProperty::Set(propOwnerSecureId, KLbsSuplPushSmsAckKey, 0)); User::LeaveIfError(RProperty::Set(propOwnerSecureId, KLbsSuplPushSmsInitKey, KNullDesC8)); iMsgMaxCount = 1; //Successfuly send/receive a single message CLbsSuplWdpWatcher* wdpWatcher = CLbsSuplWdpWatcher::NewLC(iWatcherLog); CTe_LbsSuplWdpWatcher::DisableAsserts(); wdpWatcher->OnTimerError(0, KErrGeneral); //Just to improve code coverage CTe_LbsSuplWdpWatcher::EnableAsserts(); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); SendMessage(iSendFillDigit++); iSchedulerWait->Start(); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); User::LeaveIfError(iUnexpectedError); CleanupStack::PopAndDestroy(wdpWatcher); //Successfuly send/receive several messages wdpWatcher = CLbsSuplWdpWatcher::NewLC(iWatcherLog); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); for(TInt i=0;i<10;i++) { SendMessage(iSendFillDigit++); iSchedulerWait->Start(); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); User::LeaveIfError(iUnexpectedError); } CleanupStack::PopAndDestroy(wdpWatcher); //Memory allocation failure test - creation of WdpWatcher User::__DbgSetAllocFail(EFalse ,RAllocator::EFailNext, 1); TInt* marker = new TInt(0); delete marker; if(!marker) //We only do memory failure tests for the udeb build of the OS { marker = new TInt(0); delete marker; for(TInt i=1; marker; i++) { User::__DbgSetAllocFail(EFalse ,RAllocator::EFailNext, i); TRAPD(err, wdpWatcher = CLbsSuplWdpWatcher::NewLC(iWatcherLog); CleanupStack::Pop(wdpWatcher)); marker = new TInt(0); delete marker; if(!marker || (marker && err==KErrNone)) { if(wdpWatcher==0) { User::Leave(KErrGeneral); } CleanupStack::PushL(wdpWatcher); User::LeaveIfError(err); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EDisconnected | CLbsSuplWdpWatcher::EAwaitingDataSize); CleanupStack::PopAndDestroy(wdpWatcher); } } //Memory allocation failure test - CLbsSuplWdpWatcher::RunL method marker = new TInt(0); delete marker; for(TInt i=1; marker; i++) { //reset the previous errors and reset the message counter iUnexpectedError = KErrNone; iRecvFillDigit=iSendFillDigit; wdpWatcher = CLbsSuplWdpWatcher::NewLC(iWatcherLog); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); SendMessage(iSendFillDigit++); User::__DbgSetAllocFail(EFalse ,RAllocator::EFailNext, i); //we have to set time limitation here if leave occurs and the msg is not processed iSchedulerWait->Start(15000000); marker = new TInt(0); delete marker; if(marker) //memory leak occurs in our code or in the ActiveScheduler { TRAPD(err, wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize)); if(err!=KErrNone) { iSchedulerWait->Start(11000000); wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); } } else //memory leak does not occur in our code { wdpWatcher->CheckStateL(CLbsSuplWdpWatcher::EAwaitingDataSize); User::LeaveIfError(iUnexpectedError); } CleanupStack::PopAndDestroy(wdpWatcher); } }
/** @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-3341 @SYMTestCaseDesc Restore factory Settings from Rom file. @SYMTestPriority High @SYMTestActions Ensure that the repository file only exists on the Rom. Open the repository and modify a setting. Force RFS and check that the repository is restored against the ROM file @SYMTestExpectedResults The test repository should be reset against the ROM file @SYMDEF PDEF099108 */ LOCAL_C void RFSRomOnlyL() { //restore all test files - this ensures we have a repository file //only on the z: RestoreRFSTestFilesL(ERomOnly); TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3341 ResetAllRepositoriesTestL ")); TInt r, intVal; TReal realVal; TheTest.Next(_L("Open repository to ensure server is running")); CRepository* repository = CRepository::NewLC(KUidRfsRepository); TheTest.Next(_L("Modify a Setting")); r = repository->Set(KInt1, KInt1_UpdatedValue); TEST2(r, KErrNone); //verify the update r = repository->Get(KInt1, intVal); TEST2(r, KErrNone); TEST(intVal == KInt1_UpdatedValue); TheTest.Next(_L("Modify a Setting")); r = repository->Set(KReal1, KReal1_UpdatedValue); TEST2(r, KErrNone); //verify the update r = repository->Get(KReal1, realVal); TEST2(r, KErrNone); TEST(realVal == KReal1_UpdatedValue); // Close repository CleanupStack::PopAndDestroy(repository); //Kill the server TheTest.Next(_L("Kill the server process")); _LIT( KCentralRepositoryServerName, "Centralrepositorysrv"); r = KillProcess(KCentralRepositoryServerName); TEST2(r,KErrNone); User::After(KGeneralDelay); //Restart the server in soft reset mode to force a //repository reset TheTest.Next(_L("Manually start central respository")); ReStartServerInSoftResetMode(); //Open the repository repository = CRepository::NewLC(KUidRfsRepository); //Verify that the real value is reset against the value in the Rom version of //the repository file TheTest.Next(_L("Get 'Modified' value")); r = repository->Get(KReal1, realVal); TEST2(r, KErrNone); TEST(realVal == KReal1_InitialValue); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.End(); }
LOCAL_C void RestoreFactorySettingsTestL() { TheTest.Start(_L("ResetAllRepositoriesTestL")); TInt r; TInt i; TBuf<20> str; TheTest.Next(_L("Open repository to ensure server is running")); CRepository* repository = CRepository::NewLC(KUidRfsRepository); TheTest.Next(_L("Add a Setting")); const TInt KIntValue = 1234; r = repository->Create(KNewInt, KIntValue); TEST2(r, KErrNone); TheTest.Next(_L("Delete a Setting")); r = repository->Delete(KReal1); TEST2(r, KErrNone); TheTest.Next(_L("Modify a Setting")); r = repository->Set(KInt1, KInt1_UpdatedValue); TEST2(r, KErrNone); TheTest.Next(_L("Modify a String Setting")); r = repository->Set(KString1, KString1_UpdatedValue); TEST2(r, KErrNone); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.Next(_L("Kill the server process")); _LIT( KCentralRepositoryServerName, "Centralrepositorysrv"); r = KillProcess(KCentralRepositoryServerName); TEST2(r,KErrNone); User::After(KGeneralDelay); TheTest.Next(_L("Manually start central respository")); ReStartServerInSoftResetMode(); TheTest.Next(_L("Re-create the repository to ensure server is running")); repository = CRepository::NewLC(KUidRfsRepository); TheTest.Next(_L("Get 'Added' value")); r = repository->Get(KNewInt, i); TEST2(r, KErrNone); TReal real; TheTest.Next(_L("Get 'Deleted' value")); r = repository->Get(KReal1, real); TEST2(r, KErrNone); TEST(real == KReal1_InitialValue); TheTest.Next(_L("Get 'Modified' value")); r = repository->Get(KInt1, i); TEST2(r, KErrNone); TEST(i == KInt1_UpdatedValue); r = repository->Get(KString1, str); TEST2(r, KErrNone); TEST(str==KString1_InitialValue); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.End(); }
// ----------------------------------------------------------------------------- // CWPPushMessage::AuthenticateL // The method first checks if there is security information in the message // with aMessage.SEC(). If yes, the authentication code described in OMA // Provisioning Bootstrap specification is calculated and compared to the // one in message header. If the codes match, authentication has been // performed succesfully. // ----------------------------------------------------------------------------- // EXPORT_C TInt CWPPushMessage::AuthenticateL( const TDesC& aIMSI, const TDesC& aPIN ) { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL:" ) ); TInt result( KWPAuthResultAuthenticated ); // Retrieve the MAC from message ParseHeaderL(); // The HMAC is in ASCII HEX format. Convert to binary. HBufC8* headerMac = PackLC( MAC() ); // Create space for key HBufC8* key = HBufC8::NewLC( Max( 1, aIMSI.Length() + aPIN.Length() ) ); TPtr8 keyPtr( key->Des() ); // Check if only NETWPIN authentication is allowed, from central repository. TInt value( 0 ); CRepository* repository = CRepository::NewLC( KOMAProvAuthenticationLV ); User::LeaveIfError( repository->Get( KOMAProvAuthenticationLVFlag, value ) ); CleanupStack::PopAndDestroy(); // repository // We support only security type NETWPIN switch( SEC() ) { case KSECNETWPIN: { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KSECNETWPIN" ) ); // Get the key to be used in HMAC calculation ConvertIMSIL( aIMSI, keyPtr ); break; } case KSECUSERPIN: { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KSECUSERPIN" ) ); if (EAuthNETWPINOnly != value) { if( aPIN.Length() == 0 ) { result = KWPAuthResultPinRequired; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultPinRequired" ) ); } keyPtr.Copy( aPIN ); } else { result = KWPAuthResultAuthenticationFailed; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultAuthenticationFailed" ) ); } break; } case KSECUSERNETWPIN: { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KSECUSERNETWPIN" ) ); if (EAuthNETWPINOnly != value) { if( aPIN.Length() == 0 ) { result = KWPAuthResultPinRequired; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultPinRequired" ) ); } ConvertIMSIL( aIMSI, keyPtr ); keyPtr.Append( aPIN ); } else { result = KWPAuthResultAuthenticationFailed; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultAuthenticationFailed" ) ); } break; } case KSECUSERPINMAC: { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KSECUSERPINMAC" ) ); if (EAuthNETWPINOnly != value) { if( aPIN.Length() == 0 ) { result = KWPAuthResultPinRequired; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultPinRequired" ) ); } keyPtr.Copy( aPIN ); } else { result = KWPAuthResultAuthenticationFailed; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultAuthenticationFailed" ) ); } break; } default: { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: default" ) ); if (EAuthNETWPINOnly == value || EAuthNoSecurity == value ) { result = KWPAuthResultAuthenticationFailed; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultAuthenticationFailed" ) ); } else { result = KWPAuthResultNoAuthentication; FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultNoAuthentication" ) ); } break; } } if( result == KWPAuthResultAuthenticated ) { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: KWPAuthResultAuthenticated" ) ); CMessageDigest* digest = CSHA1::NewL(); CleanupStack::PushL( digest ); if( SEC() == KSECUSERPINMAC ) { // key C is a concatenation of pin K and digest m TPtrC8 K( key->Left( key->Length()/2 ) ); TPtrC8 m( key->Right( key->Length()/2 ) ); // M' = HMAC-SHA(K, A) CHMAC* hmac = CHMAC::NewL( K, digest ); CleanupStack::Pop( digest ); CleanupStack::PushL( hmac ); TPtrC8 MM( hmac->Hash( Body() ) ); // Create m' (renamed to mm) HBufC8* mm = HBufC8::NewLC( m.Length() ); TPtr8 ptr( mm->Des() ); for( TInt i( 0 ); i < m.Length(); i++ ) { ptr.Append( (MM[i]%10)+KZero ); } // Compare the MACs and mark the message as authenticated if( *mm != m ) { result = KWPAuthResultAuthenticationFailed; } CleanupStack::PopAndDestroy(); // mm } else { FLOG( _L( "[Provisioning] CWPPushMessage::AuthenticateL: not KWPAuthResultAuthenticated" ) ); // Create the HMAC from body CHMAC* hmac = CHMAC::NewL( *key, digest ); CleanupStack::Pop( digest ); CleanupStack::PushL( hmac ); // Compare the MACs and mark the message as authenticated if( headerMac->Length() == 0 || hmac->Hash( Body() ) != *headerMac ) { result = KWPAuthResultAuthenticationFailed; } } CleanupStack::PopAndDestroy(); // hmac } CleanupStack::PopAndDestroy( 2 ); // key, headerMac return result; }
void CHttpCacheManager::ApplyCacheOverridesL(CRepository& aRepository, const TUint32& aSecIdInt, TBool& aCacheEnabled, TInt& aCacheSize, TBool& aOpCacheEnabled, TBool& aVssCacheEnabled, TDes& aPath, const TDesC& aDefaultDrive) { TDriveUnit drive(aDefaultDrive); // set defaults if(aSecIdInt == KUIDBROWSERNG) // for the browser, force use of Operator and VSS caches { aOpCacheEnabled = ETrue; aVssCacheEnabled = ETrue; } // read override string from centrep HBufC16 *overrideBuf = HBufC16::NewLC(64); TPtr overrideStr(overrideBuf->Des()); TInt strLen; TInt err = aRepository.Get(KCacheManagerHttpCacheProcessOverride, overrideStr, strLen); if(strLen > overrideBuf->Length()) { overrideBuf = overrideBuf->ReAllocL(strLen); // make sure cleanup stack contains correct pointer since ReAllocL always allocates a new des for larger space. CleanupStack::Pop(); CleanupStack::PushL(overrideBuf); // reassign the TPtr overrideStr.Set(overrideBuf->Des()); // pull in the whole string aRepository.Get(KCacheManagerHttpCacheProcessOverride, overrideStr, strLen); } // if we failed to load an override string, use the default. if( overrideStr.Length() == 0 ) { CleanupStack::PopAndDestroy( overrideBuf ); overrideBuf = KDefaultOverrideString().AllocLC(); overrideStr.Set( overrideBuf->Des() ); } // Built in Lex likes white space to separate strings, but easier to enter with ; separators. Replace all ; with spaces. TInt pos=0; do{ if(overrideStr[pos] == ';') { overrideStr[pos] = ' '; } pos++; }while(pos < overrideStr.Length()); TLex overrideLex(overrideStr); do{ TUint32 tempId; User::LeaveIfError(overrideLex.BoundedVal(tempId,EHex,KMaxTUint32)); if(overrideLex.TokenLength() != 8) // if we're not pointing at an SID in the string, we are incorrect and the override is broken. User::Leave(KErrCorrupt); overrideLex.SkipSpace(); TInt32 tempCacheEnabled; User::LeaveIfError(overrideLex.BoundedVal(tempCacheEnabled,KMaxTInt32)); overrideLex.SkipSpace(); TInt32 tempCacheSize; User::LeaveIfError(overrideLex.BoundedVal(tempCacheSize,KMaxTInt32)); overrideLex.SkipSpace(); TDriveUnit tempDrive(overrideLex.NextToken()); overrideLex.SkipSpaceAndMark(); // found a hex SID matching ours, use the parameters. if(tempId == aSecIdInt) { aCacheEnabled = tempCacheEnabled; aCacheSize = tempCacheSize * 1024; // conf is in KB drive = tempDrive; break; } }while(!overrideLex.Eos()); // Modify drive letter on aPath to match TParsePtr parsePath(aPath); TPtrC pathStr(parsePath.Path()); TPath tempPath; tempPath.Format(_L("%c:%S"), TInt(drive)+'A', &pathStr); aPath.Copy(tempPath); HttpCacheUtil::EnsureTrailingSlash( aPath ); CleanupStack::PopAndDestroy(overrideBuf); }
void CNsmlNetworkStatusEngine::EventL( const CConnMonEventBase& aConnMonEvent ) { DBG_FILE(_S8("CNsmlNetworkStatusEngine::EventL, BEGIN")); DBG_ARGS8(_S8("CNsmlNetworkStatusEngine::EventL event is == %d"), aConnMonEvent.EventType() ); switch ( aConnMonEvent.EventType() ) { case EConnMonNetworkStatusChange: { const CConnMonNetworkStatusChange* eventNetworkStatus; eventNetworkStatus = ( const CConnMonNetworkStatusChange* ) &aConnMonEvent; iNetwStatus = eventNetworkStatus->NetworkStatus(); DBG_ARGS8(_S8("CNsmlNetworkStatusEngine::EventL EConnMonNetworkStatusChange: Network status event is == %d"), iNetwStatus ); switch( eventNetworkStatus->NetworkStatus() ) { case EConnMonStatusActive: DBG_FILE(_S8("Network status ACTIVE")); if(iTimerOn) { iTimerOn = EFalse; iSuspendDuration.HomeTime(); TTimeIntervalSeconds duration; iSuspendDuration.SecondsFrom(iSuspendedTime,duration); DBG_FILE_CODE(duration.Int(), _S8("CNsmlNetworkStatusEngine::EventL suspendDuration is ")); if ( iTimedExecuteStopSession ) { iTimedExecuteStopSession->Cancel(); delete iTimedExecuteStopSession; iTimedExecuteStopSession = NULL; } if(duration.Int() >= KDMMaxHttpAutoResumeDurationSec) { iAgent->CompleteRequest(); } } // if itimerOn break; case EConnMonStatusSuspended: DBG_FILE(_S8("HTTP Network status SUSPEND and Timer will be set ON ")); if(!iTimerOn) { CRepository *rep = NULL; TRAPD( err1, rep = CRepository::NewL( KCRUidDeviceManagementInternalKeys )) iDMSmlSessionTimeout = -1; if(err1 == KErrNone) { TInt dmsessionTimeout = -1; rep->Get( KDevManDMSessionTimeout, dmsessionTimeout ); delete rep; DBG_FILE_CODE(dmsessionTimeout, _S8("CNsmlNetworkStatusEngine::EventL session timeout duration from cenrep is ")); if( dmsessionTimeout < KNSmlDMMinSessionTimeout || dmsessionTimeout > KNSmlDMMaxSessionTimeout ) { dmsessionTimeout = -1; iDMSmlSessionTimeout = -1; } else { iDMSmlSessionTimeout = dmsessionTimeout * 60* 1000000; iTimerOn = ETrue; iSuspendedTime.HomeTime(); iTimedExecuteStopSession = CPeriodic::NewL (EPriorityNormal) ; iTimedExecuteStopSession->Start ( TTimeIntervalMicroSeconds32(iDMSmlSessionTimeout) , TTimeIntervalMicroSeconds32(iDMSmlSessionTimeout) , TCallBack(StaticDoStopDMSession,this) ) ; } } // if KErrnone } //if !iTimerON break; default: //for eventNetworkStatus->NetworkStatus() break; } break; } default: // for EConnMonNetworkStatusChange break; } }
/** @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4053 @SYMTestCaseDesc Test that settings information can be selectively overridden in a ROFS layer @SYMTestPriority High @SYMTestActions Open keyspace 0x10286550. This keyspace is represented by two txt files. The keyspace file names in the source have been mangled in a similar way to that which would be expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc. @SYMTestExpectedResults Ensure that the value of each setting specified in ROFS 1 has been modified to the values specified in ROFS 1 and that each value not specified in ROFS 1 remains as it was defined in the CORE layer. @SYMREQ REQ11283 */ LOCAL_C void REQ11283L() { TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4053 " )); CRepository* rep; User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace1)); TInt settingValueInt = 0; TReal settingValueReal = 0.0; TBuf<20> settingValueStr; TUint32 settingMeta = 0; TInt rtn = 0; //check every single setting and meta and access policy User::LeaveIfError(rep->Get(1,settingValueInt)); TEST(settingValueInt==1); User::LeaveIfError(rep->GetMeta(1,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(2,settingValueInt)); TEST(settingValueInt==3); User::LeaveIfError(rep->GetMeta(2,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(3,settingValueReal)); TEST(settingValueReal==3.1); User::LeaveIfError(rep->GetMeta(3,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(4,settingValueReal)); TEST(settingValueReal==4.2); User::LeaveIfError(rep->GetMeta(4,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(5,settingValueStr)); TEST(settingValueStr.Compare(_L("test 1"))==0); User::LeaveIfError(rep->GetMeta(5,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(6,settingValueStr)); TEST(settingValueStr.Compare(_L("test 3"))==0); User::LeaveIfError(rep->GetMeta(6,settingMeta)); TEST(settingMeta==0); //check value and meta combination User::LeaveIfError(rep->Get(7,settingValueInt)); TEST(settingValueInt==8); User::LeaveIfError(rep->GetMeta(7,settingMeta)); TEST(settingMeta==88); User::LeaveIfError(rep->Get(8,settingValueReal)); TEST(settingValueReal==8.2); User::LeaveIfError(rep->GetMeta(8,settingMeta)); TEST(settingMeta==888); User::LeaveIfError(rep->Get(9,settingValueStr)); TEST(settingValueStr.Compare(_L("test 4"))==0); User::LeaveIfError(rep->GetMeta(9,settingMeta)); TEST(settingMeta==888); //check value and platsec combination rtn=rep->Get(10,settingValueInt); TEST(rtn==KErrPermissionDenied); rtn=rep->Get(11,settingValueReal); TEST(rtn==KErrPermissionDenied); rtn=rep->Get(12,settingValueStr); TEST(rtn==KErrPermissionDenied); User::LeaveIfError(rep->Get(13,settingValueInt)); TEST(settingValueInt==14); User::LeaveIfError(rep->GetMeta(13,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(14,settingValueInt)); TEST(settingValueInt==15); User::LeaveIfError(rep->GetMeta(14,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Get(15,settingValueInt)); TEST(settingValueInt==16); User::LeaveIfError(rep->GetMeta(15,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Set(15,150)); User::LeaveIfError(rep->Get(16,settingValueInt)); TEST(settingValueInt==16); User::LeaveIfError(rep->GetMeta(16,settingMeta)); TEST(settingMeta==0); rtn=rep->Set(16,160); TEST(rtn==KErrPermissionDenied); //range meta User::LeaveIfError(rep->Get(0x20,settingValueInt)); TEST(settingValueInt==16); User::LeaveIfError(rep->GetMeta(0x20,settingMeta)); TEST(settingMeta==100); User::LeaveIfError(rep->Get(0x21,settingValueInt)); TEST(settingValueInt==17); User::LeaveIfError(rep->GetMeta(0x21,settingMeta)); TEST(settingMeta==101); //range platsec User::LeaveIfError(rep->Get(0x30,settingValueInt)); TEST(settingValueInt==18); User::LeaveIfError(rep->GetMeta(0x30,settingMeta)); TEST(settingMeta==0); rtn=rep->Set(0x30,0x31); TEST(rtn==KErrPermissionDenied); User::LeaveIfError(rep->Get(0x31,settingValueInt)); TEST(settingValueInt==19); User::LeaveIfError(rep->GetMeta(0x31,settingMeta)); TEST(settingMeta==0); User::LeaveIfError(rep->Set(0x31,0x32)); //new settings User::LeaveIfError(rep->Get(0x50,settingValueInt)); TEST(settingValueInt==50); User::LeaveIfError(rep->GetMeta(0x50,settingMeta)); TEST(settingMeta==505); User::LeaveIfError(rep->Get(0x51,settingValueReal)); TEST(settingValueReal==51.51); rtn=rep->Set(0x51,1.234); TEST(rtn==KErrPermissionDenied); User::LeaveIfError(rep->Get(0x52,settingValueStr)); TEST(settingValueStr.Compare(_L("test 6"))==0); CleanupStack::PopAndDestroy(rep); }
LOCAL_C void CreateDeleteL() { CRepository* repository; User::LeaveIfNull(repository = CRepository::NewLC(KUidPlatsecTestRepository)); // Remember that this repository need to be reset ::AddRepositoryToReset(KUidPlatsecTestRepository); TInt x; TInt r = repository->Get(KNewInt, x); TEST2(r, KErrNotFound); const TInt KIntValue = 1234; r = repository->Create(KNewInt, KIntValue); TEST2(r, KErrNone); r = repository->Get(KNewInt, x); TEST2(r, KErrNone); TEST(x==KIntValue); r = repository->Delete(KNewInt); TEST2(r, KErrNone); r = repository->Get(KNewInt, x); TEST2(r, KErrNotFound); r = repository->Create(KNewInt, KIntValue); TEST2(r, KErrNone); r = repository->Get(KNewInt, x); TEST2(r, KErrNone); TEST(x==KIntValue); r = repository->Get(KNewInt, x); TEST2(r, KErrNone); TEST(x==KIntValue); TReal y; r = repository->Get(KNewReal, y); TEST2(r, KErrNotFound); const TReal KRealValue = 5678.0; r = repository->Create(KNewReal, KRealValue); TEST2(r, KErrNone); r = repository->Get(KNewReal, y); TEST2(r, KErrNone); TEST(y==KRealValue); r = repository->Delete(KNewReal); TEST2(r, KErrNone); r = repository->Get(KNewReal, y); TEST2(r, KErrNotFound); r = repository->Create(KNewReal, KRealValue); TEST2(r, KErrNone); r = repository->Get(KNewReal, y); TEST2(r, KErrNone); TEST(y==KRealValue); r = repository->Get(KNewReal, y); TEST2(r, KErrNone); TEST(y==KRealValue); TBuf8<20> z8; r = repository->Get(KNewString8, z8); TEST2(r, KErrNotFound); _LIT8(KString8Value, "ABCDEF"); r = repository->Create(KNewString8, KString8Value); TEST2(r, KErrNone); r = repository->Get(KNewString8, z8); TEST2(r, KErrNone); TEST(z8==KString8Value); r = repository->Delete(KNewString8); TEST2(r, KErrNone); r = repository->Get(KNewString8, z8); TEST2(r, KErrNotFound); r = repository->Create(KNewString8, KString8Value); TEST2(r, KErrNone); r = repository->Get(KNewString8, z8); TEST2(r, KErrNone); TEST(z8==KString8Value); r = repository->Get(KNewString8, z8); TEST2(r, KErrNone); TEST(z8==KString8Value); TBuf16<20> z16; r = repository->Get(KNewString16, z16); TEST2(r, KErrNotFound); _LIT(KString16Value, "ghijklmn"); r = repository->Create(KNewString16, KString16Value); TEST2(r, KErrNone); r = repository->Get(KNewString16, z16); TEST2(r, KErrNone); TEST(z16==KString16Value); r = repository->Delete(KNewString16); TEST2(r, KErrNone); r = repository->Get(KNewString16, z16); TEST2(r, KErrNotFound); r = repository->Create(KNewString16, KString16Value); TEST2(r, KErrNone); r = repository->Get(KNewString16, z16); TEST2(r, KErrNone); TEST(z16==KString16Value); r = repository->Get(KNewString16, z16); TEST2(r, KErrNone); TEST(z16==KString16Value); CleanupStack::PopAndDestroy(repository); }
/** @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-3435 @SYMTestCaseDesc PDEF105203: Start-up Settings: New access point remains after restoring factory setting @SYMTestPriority High @SYMTestActions Create a new setting inside a range with range meta RFS bit set, create another setting outside the range, restart server in RFS mode, check to see the setting created outside the range still exists, check to see the setting created inside the range has been deleted. Repeat same steps with another repository which has default meta having RFS on and range meta having RFS off, check to see the setting created outside the range has been deleted, check to see the setting created inside the range still exists. @SYMTestExpectedResults Test must not fail @SYMDEF PDEF105203 */ LOCAL_C void PDEF105203() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3435 PDEF105203: Start-up Settings: New access point remains after restoring factory setting ")); TInt r; TInt i; TheTest.Next(_L("Open repository to ensure server is running")); CRepository* repository = CRepository::NewLC(KUidRfsRepository); TheTest.Next(_L("Create a new setting outside RFSable range meta area")); const TInt KIntValue = 999; r = repository->Create(KNewInt2, KIntValue); TEST2(r, KErrNone); TheTest.Next(_L("Create a new setting in RFSable range meta area")); r = repository->Create(KNewInt3, KIntValue); TEST2(r, KErrNone); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.Next(_L("Kill the server process")); _LIT( KCentralRepositoryServerName, "Centralrepositorysrv"); r = KillProcess(KCentralRepositoryServerName); TEST2(r,KErrNone); User::After(KGeneralDelay); TheTest.Next(_L("Manually start central respository")); ReStartServerInSoftResetMode(); TheTest.Next(_L("Re-create the repository to ensure server is running")); repository = CRepository::NewLC(KUidRfsRepository); TheTest.Next(_L("Get 'created' value outside range meta")); r = repository->Get(KNewInt2, i); TEST2(r, KErrNone); // should still exist TEST(i == KIntValue); TheTest.Next(_L("Get 'created' value inside range meta")); r = repository->Get(KNewInt3, i); TEST2(r, KErrNotFound); // should have been deleted // Close repository CleanupStack::PopAndDestroy(repository); repository = CRepository::NewLC(KUidRfsRepositoryDefaultRfsOn); TheTest.Next(_L("Create a new setting in RFSable default meta area")); const TInt KIntValue2 = 990; r = repository->Create(KNewInt2, KIntValue2); TEST2(r, KErrNone); TheTest.Next(_L("Create a new setting in non-RFSable range meta area")); r = repository->Create(KNewInt3, KIntValue2); TEST2(r, KErrNone); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.Next(_L("Kill the server process")); r = KillProcess(KCentralRepositoryServerName); TEST2(r,KErrNone); User::After(KGeneralDelay); TheTest.Next(_L("Manually start central respository")); ReStartServerInSoftResetMode(); TheTest.Next(_L("Re-create the repository to ensure server is running")); repository = CRepository::NewLC(KUidRfsRepositoryDefaultRfsOn); TheTest.Next(_L("Get 'created' value outside range meta")); r = repository->Get(KNewInt2, i); TEST2(r, KErrNotFound); // should have been deleted TheTest.Next(_L("Get 'created' value inside range meta")); r = repository->Get(KNewInt3, i); TEST2(r, KErrNone); // should still exist TEST(i == KIntValue2); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.End(); }
/** @SYMTestCaseID BA-CTSY-ALLS-MSL-0001 @SYMComponent telephony_ctsy @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetALSLine @SYMTestPriority High @SYMTestActions Invokes RMobilePhone::SetALSLine @SYMTestExpectedResults Pass @SYMTestType CT */ void CCTsyAlternateLineServiceFU::TestSetALSLine0001L() { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RBuf8 data; CleanupClosePushL(data); TInt ret(-1); TRequestStatus requestStatus; //------------------------------------------------------------------------- // TEST B: failure on completion of pending request from LTSY->CTSY //------------------------------------------------------------------------- // create centRep to change repository CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); CleanupStack::PushL(centRep); // setting environment (set KCtsyMEAlsSupported in repository to ETrue) ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); ASSERT_EQUALS(KErrNone, ret); // test setting and execute RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary); TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine > alsLineData( alsLine ); alsLineData.SerialiseL(data); iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrGeneral); iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST C: Successful completion request of // RMobilePhone::SetALSLine when result is not cached. // Case CtsyMEAlsSupported ETrue //------------------------------------------------------------------------- iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone); iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST C: Successful completion request of // RMobilePhone::SetALSLine when result is not cached. // Case ÑtsyMEAlsSupported EFalse //------------------------------------------------------------------------- // setting environment (set KCtsyMEAlsSupported in repository to EFalse) ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); ASSERT_EQUALS(KErrNone, ret); // test setting and execute alsLine = RMobilePhone::EAlternateLinePrimary; iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // check test results ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); //check AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TESTs for coverage increasing with different values of alsLine //------------------------------------------------------------------------- // test execute alsLine = RMobilePhone::EAlternateLineAuxiliary; iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // check test results ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineAuxiliary); //check AssertMockLtsyStatusL(); // test execute alsLine = RMobilePhone::EAlternateLineUnknown; iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // check test results ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineUnknown); //check AssertMockLtsyStatusL(); // test execute alsLine = RMobilePhone::EAlternateLineNotAvailable; iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // check test results ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineNotAvailable); //check AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST E: Unsolicited completion of RMobilePhone::SetALSLine // from LTSY. //------------------------------------------------------------------------- iMockLTSY.NotifyTerminated(requestStatus); iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST A: failure to dispatch request to LTSY //------------------------------------------------------------------------- // setting environment (set KCtsyMEAlsSupported in repository to ETrue) ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); ASSERT_EQUALS(KErrNone, ret); // test setting and execute data.Close(); alsLineData.SerialiseL(data); // serialise data here because alsLine variable is changed iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data, KErrNotSupported); iPhone.SetALSLine(requestStatus, alsLine); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); AssertMockLtsyStatusL(); // Done ! // return repository KCtsyMEAlsSupported to EFalse (initial state) ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); ASSERT_EQUALS(KErrNone, ret); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(1); // iCentRep CleanupStack::PopAndDestroy(2, this); // data, this }
/** @SYMTestCaseID BA-CTSY-ALLS-MSL-0004 @SYMComponent telephony_ctsy @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetALSLine @SYMTestPriority High @SYMTestActions Invokes multiple client requests to RMobilePhone::SetALSLine @SYMTestExpectedResults Pass @SYMTestType CT */ void CCTsyAlternateLineServiceFU::TestSetALSLine0004L() { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RBuf8 data; CleanupClosePushL(data); // Open second client RTelServer telServer2; TInt ret = telServer2.Connect(); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(telServer2); RMobilePhone phone2; ret = phone2.Open(telServer2,KMmTsyPhoneName); ASSERT_EQUALS(KErrNone, ret); CleanupClosePushL(phone2); // create centRep to change repository CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); CleanupStack::PushL(centRep); // setting environment (set KCtsyMEAlsSupported in repository to ETrue) ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); ASSERT_EQUALS(KErrNone, ret); TRequestStatus requestStatus; TRequestStatus requestStatus2; //------------------------------------------------------------------------- // Test A: Test multiple clients requesting RMobilePhone::SetALSLine //------------------------------------------------------------------------- // setting and execute 1st request RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary); TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine > alsLineData( alsLine ); alsLineData.SerialiseL(data); iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone); iPhone.SetALSLine(requestStatus, alsLine); // setting and execute 2nd request RMobilePhone::TMobilePhoneALSLine alsLine2(RMobilePhone::EAlternateLineAuxiliary); phone2.SetALSLine(requestStatus2, alsLine2); // wait for completion and check results User::WaitForRequest(requestStatus2); ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int()); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // setting environment (set KCtsyMEAlsSupported in repository to ETrue) ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); ASSERT_EQUALS(KErrNone, ret); // setting and execute the test for the case when // KCtsyMEAlsSupported in repository is set to ETrue alsLine = RMobilePhone::EAlternateLinePrimary; iPhone.SetALSLine(requestStatus, alsLine); alsLine2 = RMobilePhone::EAlternateLineAuxiliary; phone2.SetALSLine(requestStatus2, alsLine2); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); User::WaitForRequest(requestStatus2); ASSERT_EQUALS(KErrNone, requestStatus2.Int()); AssertMockLtsyStatusL(); //Done! CleanupStack::PopAndDestroy(1); // iCentRep CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this }
// ----------------------------------------------------------------------------- // CPsmSession::ServiceL // ----------------------------------------------------------------------------- // void CPsmSession::ServiceL( const RMessage2& aMessage ) { COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession::ServiceL()" ) ) ); switch ( aMessage.Function() ) { case EPsmServerNotifyModeChange: // For power save mode change { TInt mode = aMessage.Int0(); if ( !iNotifyModeMessage ) { // Create message wrapper if not yet created CPsmMessage* notifyModeMessage = CPsmMessage::NewL( iPsmManager ); CleanupStack::PushL(notifyModeMessage); iPsmManager.RegisterObserverL( notifyModeMessage ); CleanupStack::Pop(notifyModeMessage); iNotifyModeMessage = notifyModeMessage; } //Check whether the mode is already set . TInt cenrepMode( 0 ); CRepository* cenrep = CRepository::NewLC( KCRUidPowerSaveMode ); User::LeaveIfError(cenrep->Get( KPsmCurrentMode, cenrepMode )); CleanupStack::PopAndDestroy( cenrep ); // Check that mode to be set is valid, otherwise error code. if( mode == cenrepMode ) { User::Leave( KErrAlreadyExists ); } if( ( mode > EPsmsrvPartialMode ) || ( mode < EPsmsrvModeNormal ) ) { User::Leave( KErrArgument ); } TInt keyVal = -1; User::LeaveIfError( RProperty::Get( KUidSystemCategory, conn::KUidBackupRestoreKey, keyVal ) ); //if backup or restore is in progress, change in power save mode //is not allowed�as it will not be possible to do write //operation in cenrep and it would leave the device in unstable power saving mode state if( (( keyVal & conn::KBURPartTypeMask ) != conn::EBURNormal ) && (( keyVal & conn::KBURPartTypeMask ) != conn::EBURUnset )) { User::Leave( KErrNotSupported ); } iNotifyModeMessage->Initialize( aMessage ); iPsmManager.NotifyPowerSaveModeChangeL( mode ); break; } case EPsmServerChangeSettings: // For PSM settings case EPsmServerGetSettings: // For PSM settings case EPsmServerBackupSettings: // For PSM settings { // Handle settings requests in different function HandleSettingsRequestL( aMessage ); break; } case EPsmServerCancelModeChange: // For cancelling PSM change { // Cancel PSM change and return previous mode if ( iNotifyModeMessage ) { // Unregister observer from manager iPsmManager.UnregisterObserver( iNotifyModeMessage ); // Cancel pending message iNotifyModeMessage->Complete( KErrCancel ); // Finally delete message delete iNotifyModeMessage; iNotifyModeMessage = NULL; } // Call PsmManager to stop mode change and to go back to previous iPsmManager.CancelPowerSaveModeChangeL(); // Complete message aMessage.Complete( KErrNone ); break; } case EPsmServerModeChangeNotificationRequest: // PSM Change notification request { if ( !iNotifyModeMessage ) { // Create message wrapper if not yet created CPsmMessage* notifyModeMessage = CPsmMessage::NewL( iPsmManager ); CleanupStack::PushL(notifyModeMessage); iPsmManager.RegisterObserverL( notifyModeMessage ); CleanupStack::Pop(notifyModeMessage); iNotifyModeMessage = notifyModeMessage; } iNotifyModeMessage->Initialize( aMessage ); break; } case EPsmServerCancelModeChangeNotificationRequest: // For cancelling PSM change notification { // Cancel PSM change notification request if ( iNotifyModeMessage ) { // Unregister observer from manager iPsmManager.UnregisterObserver( iNotifyModeMessage ); // Cancel pending message iNotifyModeMessage->Complete( KErrCancel ); // Finally delete message delete iNotifyModeMessage; iNotifyModeMessage = NULL; } // Complete message aMessage.Complete( KErrNone ); break; } #ifdef _DEBUG case EDebugHeapMark: { COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession - EDebugMarkHeap: Alloc Cells: %d."), User::CountAllocCells())); __UHEAP_MARK; aMessage.Complete(KErrNone); break; } case EDebugHeapMarkEnd: { COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession - EDebugMarkHeapEnd: Alloc Cells: %d."), User::CountAllocCells())); if ( iNotifyModeMessage ) { // Unregister observer from manager iPsmManager.UnregisterObserver( iNotifyModeMessage ); // Compress the observer array iPsmManager.CompressModeObserversArray(); // Finally delete message delete iNotifyModeMessage; iNotifyModeMessage = NULL; } iPsmManager.ClosePluginLoader(); __UHEAP_MARKEND; aMessage.Complete(KErrNone); break; } case EDebugSetHeapFailure: { COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession - EDebugSetHeapFailure: Value of Failure Rate: %d."), aMessage.Int0())); __UHEAP_SETFAIL(RAllocator::EFailNext,aMessage.Int0()); aMessage.Complete(KErrNone); break; } case EDebugHeapReset: { COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession - EDebugHeapReset "))); __UHEAP_RESET; aMessage.Complete(KErrNone); break; } #endif default: { COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession::ServiceL() - unknown request: %i - ERROR" ), aMessage.Function() ) ); User::Leave( KErrUnknown ); } } COMPONENT_TRACE( ( _L( "PSM Server - CPsmSession::ServiceL - return" ) ) ); }
void CRequestInfoTable::GetRequestInfo(int requestID, REQ_INFO& rReqInfo) { RIL_LOG_VERBOSE("CRequestInfoTable::GetRequestInfo() - Enter\r\n"); // Set defaults if we can't find the request id rReqInfo.uiTimeout = CTE::GetTE().GetTimeoutAPIDefault(); if (m_rgpRequestInfos == NULL) { RIL_LOG_INFO("CRequestInfoTable::GetRequestInfo() - m_rgpRequestInfos is NULL\r\n"); goto Error; } else if (REQ_ID_NONE == requestID) { RIL_LOG_INFO("CRequestInfoTable::GetRequestInfo() - Request ID NONE given; assigning" " default values.\r\n"); goto Error; } else if ((requestID >= REQ_ID_TOTAL && requestID < INTERNAL_REQ_ID_START) || (requestID < 0)) { RIL_LOG_CRITICAL("CRequestInfoTable::GetRequestInfo() - Invalid request ID [0x%x]\r\n", requestID); goto Error; } // Internal request if (requestID >= INTERNAL_REQ_ID_START) { int index = requestID - INTERNAL_REQ_ID_START; CRepository repository; int iTemp = 0; memset(&rReqInfo, 0, sizeof(rReqInfo)); rReqInfo.uiTimeout = CTE::GetTE().GetTimeoutAPIDefault(); if (index < INTERNAL_REQ_ID_TOTAL) { if (repository.Read(g_szGroupInternalRequestTimeouts, g_ReqInternal[index].reqInfo.szName, iTemp)) { rReqInfo.uiTimeout = (UINT32)iTemp; } } } // Request from ril else if (NULL == m_rgpRequestInfos[requestID]) { CRepository repository; int iTemp = 0; memset(&rReqInfo, 0, sizeof(rReqInfo)); if (repository.Read(g_szGroupRequestTimeouts, g_pReqInfo[requestID].szName, iTemp)) { rReqInfo.uiTimeout = (UINT32)iTemp; } else { rReqInfo.uiTimeout = CTE::GetTE().GetTimeoutAPIDefault(); } // Use WAIT_FOREVER timeout if given time was 0 if (!rReqInfo.uiTimeout) { rReqInfo.uiTimeout = WAIT_FOREVER; } else if (CHardwareConfig::GetInstance().IsMultiSIM()) { // Timeout values need to be extended for Multi SIM capable modems, // depending on type of command (ie. network/non-network) switch (requestID) { case RIL_REQUEST_SETUP_DATA_CALL: // +CGACT, +CGDATA, +CGDCONT, +CGPADDR, +XDNS case RIL_REQUEST_DEACTIVATE_DATA_CALL: rReqInfo.uiTimeout = 2 * rReqInfo.uiTimeout + 50000; break; // network commands case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: // +CCFC case RIL_REQUEST_SET_CALL_FORWARD: // +CCFC case RIL_REQUEST_QUERY_CALL_WAITING: // +CCWA case RIL_REQUEST_SET_CALL_WAITING: // +CCWA case RIL_REQUEST_RADIO_POWER: // +CFUN case RIL_REQUEST_DATA_CALL_LIST: // +CGACT? case RIL_REQUEST_HANGUP: // +CHLD case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: // +CHLD case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: // +CHLD case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: // +CHLD case RIL_REQUEST_CONFERENCE: // +CHLD case RIL_REQUEST_UDUB: // +CHLD case RIL_REQUEST_SEPARATE_CONNECTION: // +CHLD case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: // +CHLD case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: // +CLCK case RIL_REQUEST_QUERY_FACILITY_LOCK: // +CLCK case RIL_REQUEST_SET_FACILITY_LOCK: // +CLCK case RIL_REQUEST_GET_CLIR: // +CLIR? case RIL_REQUEST_SET_CLIR: // +CLIR case RIL_REQUEST_SEND_SMS: // +CMGS case RIL_REQUEST_SMS_ACKNOWLEDGE: // +CNMA case RIL_REQUEST_OPERATOR: // +XCOPS case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: // +COPS? case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS: // +COPS=? case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: // +COPS case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: // +COPS case RIL_REQUEST_SEND_USSD: // +CUSD case RIL_REQUEST_CANCEL_USSD: // +CUSD case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: // +SATD case RIL_REQUEST_DTMF_START: // +XVTS case RIL_REQUEST_DTMF_STOP: // +XVTS case RIL_REQUEST_DIAL: // ATD // non-network cmds requiring response case RIL_REQUEST_DELETE_SMS_ON_SIM: // +CMGD case RIL_REQUEST_SEND_SMS_EXPECT_MORE: // +CMMS, +CMGS case RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG: // +CSCB? case RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION: // +CSCB case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: // +XCELLINFO case RIL_REQUEST_GET_CELL_INFO_LIST: // +XCELLINFO case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: // +XTESM rReqInfo.uiTimeout = 2 * rReqInfo.uiTimeout + 10000; break; } } // Cache the data we just read (taking the cache access lock) if (m_pCacheAccessMutex) { CMutex::Lock(m_pCacheAccessMutex); } // Recheck if the cache is still empty if (NULL == m_rgpRequestInfos[requestID]) { REQ_INFO* pNewReqInfo = new REQ_INFO; if (NULL != pNewReqInfo) { *pNewReqInfo = rReqInfo; m_rgpRequestInfos[requestID] = pNewReqInfo; } } if (m_pCacheAccessMutex) { CMutex::Unlock(m_pCacheAccessMutex); } } else { rReqInfo = *m_rgpRequestInfos[requestID]; } Error: RIL_LOG_INFO("CRequestInfoTable::GetRequestInfo() - RequestID %d: Timeout [%u]\r\n", requestID, rReqInfo.uiTimeout); RIL_LOG_VERBOSE("CRequestInfoTable::GetRequestInfo() - Exit\r\n"); }
// --------------------------------------------------------------------------- // Check feature is supported or not // --------------------------------------------------------------------------- // TBool CSPSettingsEngine::IsFeatureSupportedL( TSPServiceFeature aFeature, TBool aWriteAllowed ) { XSPSLOGSTRING( "CSPSettingsEngine::IsFeatureSupportedL() - IN" ); TBool ret = EFalse; // First check P&S key, if P&S key is defined, use the value from P&S key. // if not defined, then walk through all the sevices and check there is any service match TInt mask = 0; TInt value = 0; TInt psFlag = 0; TInt retProperty = 0; switch( aFeature ) { case ESupportInternetCallFeature: { retProperty = RProperty::Get( KUidSystemCategory, KSPSupportInternetCallKey, psFlag ); if( retProperty == KErrNone && psFlag != KSPInitFeatureValue ) { ret = psFlag; } else { mask = ESupportsInternetCall | ESupportsAlphanumericAddressing | EIsVisibleInCallMenu; value = mask; ret = CheckFeatureL( mask, value ); if ( aWriteAllowed ) { User::LeaveIfError( RProperty::Set( KUidSystemCategory, KSPSupportInternetCallKey, ret ) ); } } break; } case ESupportCallOutFeature: { retProperty = RProperty::Get( KUidSystemCategory, KSPSupportCallOutKey, psFlag ); if( retProperty == KErrNone && psFlag != KSPInitFeatureValue ) { ret = psFlag; } else { mask = ESupportsInternetCall | ESupportsMSISDNAddressing | EIsVisibleInCallMenu; value = mask; ret = CheckFeatureL( mask, value ); if ( aWriteAllowed ) { User::LeaveIfError( RProperty::Set( KUidSystemCategory, KSPSupportCallOutKey, ret ) ); } } break; } case ESupportVoIPSSFeature: { retProperty = RProperty::Get( KUidSystemCategory, KSPSupportVoIPSSKey, psFlag ); if( retProperty == KErrNone && psFlag != KSPInitFeatureValue ) { ret = psFlag; } else { mask = ESupportVoIPSS; value = mask; ret = CheckFeatureL( mask, value ); if ( aWriteAllowed ) { User::LeaveIfError( RProperty::Set( KUidSystemCategory, KSPSupportVoIPSSKey, ret ) ); } } break; } case ESupportVoIPFeature: { TBool bFeatureMgr = EFalse; TBool bDynVoIP = EFalse; TBool bSubVoIP = EFalse; //check FeatureManager FeatureManager::InitializeLibL(); bFeatureMgr = FeatureManager::FeatureSupported( KFeatureIdCommonVoip ); FeatureManager::UnInitializeLib(); //check dynamic voip flag CRepository* repository = CRepository::NewLC( KCRUidTelephonySettings ); TInt value = 0; TInt err = repository->Get( KDynamicVoIP, value ); if( value != 0 ) { bDynVoIP = ETrue; } CleanupStack::PopAndDestroy( repository ); //check subservice voip RIdArray serviceIds; CleanupClosePushL( serviceIds ); FindServiceIdsL( serviceIds ); CSPProperty* property = CSPProperty::NewLC(); for( TInt i = 0; i < serviceIds.Count(); i++ ) { TServiceId serviceId = serviceIds[i]; TInt retProperty = FindPropertyL( serviceId, EPropertyVoIPSubServicePluginId, *property ); if( retProperty == KErrNone ) { bSubVoIP = ETrue; break; } } CleanupStack::PopAndDestroy( property ); CleanupStack::PopAndDestroy( &serviceIds ); ret = bFeatureMgr && bDynVoIP && bSubVoIP; break; } default: { User::Leave( KErrNotSupported ); } } XSPSLOGSTRING( "CSPSettingsEngine::IsFeatureSupportedL() - OUT" ); return ret; }
// ---------------------------------------------------------------------------- // CSysApFeatureManager::ConstructL() // ---------------------------------------------------------------------------- void CSysApFeatureManager::ConstructL() { TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL()") ) ); FeatureManager::InitializeLibL(); iFeatMgrActive = ETrue; iSimSupported = FeatureManager::FeatureSupported( KFeatureIdSimCard ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: SIM card supported=%d"), iSimSupported ) ); iOfflineModeSupported = FeatureManager::FeatureSupported( KFeatureIdOfflineMode ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Offline mode supported=%d"), iOfflineModeSupported ) ); iCoverDisplaySupported = FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Cover display supported=%d"), iCoverDisplaySupported ) ); iGripNotSupported = FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: iGripNotSupported=%d"), iGripNotSupported ) ); iLocationPrivacySupported = FeatureManager::FeatureSupported( KFeatureIdPrivacyFramework ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Location Privacy supported=%d"), iLocationPrivacySupported ) ); iMMCSupported = FeatureManager::FeatureSupported( KFeatureIdMmc ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: MMC supported=%d"), iMMCSupported ) ); iMMCHotSwapSupported = FeatureManager::FeatureSupported( KFeatureIdMmcHotswap ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: MMC HotSwap supported=%d"), iMMCHotSwapSupported ) ); iStarterExtensionsSupported = FeatureManager::FeatureSupported( KFeatureIdExtendedStartup ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Starter Extensions supported=%d"), iStarterExtensionsSupported ) ); iCameraSupported = FeatureManager::FeatureSupported( KFeatureIdCamera ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Camera supported=%d"), iCameraSupported ) ); iBtSupported = FeatureManager::FeatureSupported( KFeatureIdBt ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Bluetooth supported=%d"), iBtSupported ) ); iLockSupported = FeatureManager::FeatureSupported( KFeatureIdMmcLock ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Memory card lock supported=%d"), iLockSupported ) ); iEject = FeatureManager::FeatureSupported( KFeatureIdMmcEject ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Memory card sw eject supported=%d"), iEject ) ); iPowerSaveSupported = FeatureManager::FeatureSupported( KFeatureIdPowerSave ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Power save supported=%d"), iPowerSaveSupported ) ); iNoPowerKeySupported = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: No power key supported=%d"), iNoPowerKeySupported ) ); // iFmTxSupported = FeatureManager::FeatureSupported( KFeatureIdFmtx ); // TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: FM TX supported=%d"), iFmTxSupported ) ); // iPenEnabled = AknLayoutUtils::PenEnabled(); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Pen enabled=%d"), iPenEnabled ) ); iVmbxCallDivertIconSupported = FeatureManager::FeatureSupported( KFeatureIdVmbxCallDivertIcon ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: VMBX call divert icon supported=%d"), iVmbxCallDivertIconSupported ) ); iTouchUnlockStrokeSupported = FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ); TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Touch unlock stroke supported=%d"), iTouchUnlockStrokeSupported ) ); // iFmTxRdsTextSupported = FeatureManager::FeatureSupported( KFeatureIdFfFmtxRdsText ); // TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: FM TX RDS-TEXT supported=%d"), iFmTxRdsTextSupported ) ); CRepository* repository = NULL; TRAPD( err, repository = CRepository::NewL( KCRUidCoreApplicationUIsConf ) ); if ( err == KErrNone ) { err = repository->Get( KCoreAppUIsSysAp, iSysApFeatures ); if ( err != KErrNone || iSysApFeatures < 0 ) // ERROR { TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsSysAp=%d"), err, iSysApFeatures ) ); iSysApFeatures = 0; } TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: KCoreAppUIsSysAp=%d"), iSysApFeatures ) ); err = repository->Get( KCoreAppUIsHotSwapMemoryCardHatch, iHatchSupported ); if ( err != KErrNone || iHatchSupported < 0 ) // ERROR { TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsHotSwapMemoryCardHatch=%d"), err, iHatchSupported ) ); iHatchSupported = EFalse; } err = repository->Get( KCoreAppUIsLockedStateLights, iLockedStateLightsSupported ); if ( err != KErrNone || iLockedStateLightsSupported < 0 ) // ERROR { TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsLightsLocked=%d"), err, iLockedStateLightsSupported ) ); iLockedStateLightsSupported = EFalse; iLockedStateLightsIntensity = KHWRMDefaultIntensity; } if ( iLockedStateLightsSupported ) // get intensity only if configuration is supported { err = repository->Get( KCoreAppUIsLockedStateLightsIntensity, iLockedStateLightsIntensity ); if ( err != KErrNone || iLockedStateLightsIntensity < KHWRMLightMinIntensity || iLockedStateLightsIntensity > KHWRMLightMaxIntensity ) { TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsLightsLockedIntensity=%d"), err, iLockedStateLightsIntensity ) ); iLockedStateLightsIntensity = KHWRMDefaultIntensity; } } } else { TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: open KCRUidCoreApplicatinUIsConf failed, err=%d"), err ) ); } delete repository; }
/** @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-3342 @SYMTestCaseDesc Restore factory Settings from merged repository. @SYMTestPriority High @SYMTestActions Ensure that the repository file exists in both the Rom and install directories. Open the repository and modify a setting. Force RFS and check that the repository is restored against the merged repository @SYMTestExpectedResults The test repository should be reset against the merged repository @SYMDEF PDEF099108 */ LOCAL_C void RFSRomAndInstallL() { //restore all test files - this ensures we have a c: and z: file //for the test repository which causes a repository merge RestoreRFSTestFilesL(ERomAndInstall); TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3342 ResetAllRepositoriesTestL ")); TInt r; TReal realVal; TBuf<20> strVal; TheTest.Next(_L("Open repository to ensure server is running")); CRepository* repository = CRepository::NewLC(KUidRfsRepository); TheTest.Next(_L("Modify a Setting")); r = repository->Set(KReal1, KReal1_UpdatedValue); TEST2(r, KErrNone); //verify the update r = repository->Get(KReal1, realVal); TEST2(r, KErrNone); TEST(realVal == KReal1_UpdatedValue); // Close repository CleanupStack::PopAndDestroy(repository); //Kill the server TheTest.Next(_L("Kill the server process")); _LIT( KCentralRepositoryServerName, "Centralrepositorysrv"); r = KillProcess(KCentralRepositoryServerName); TEST2(r,KErrNone); User::After(KGeneralDelay); //Restart the server in soft reset mode to force a //repository reset TheTest.Next(_L("Manually start central respository")); ReStartServerInSoftResetMode(); //Open the repository repository = CRepository::NewLC(KUidRfsRepository); //Verify that the string value, which is only found in the ROM file is //present in the merged repository r = repository->Get(KString1, strVal); TEST2(r, KErrNone); TEST(strVal==KString1_InitialValue); //verify that the Real value has been reset against the value in the install //repository file TheTest.Next(_L("Get 'Modified' value")); r = repository->Get(KReal1, realVal); TEST2(r, KErrNone); TEST(realVal == KReal1_InstallValue); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.End(); }
void RLbsNetworkPositionUpdates::SetCategoryUidL(TUint32 aKey, TUid aCategoryUid) { CRepository* rep = CRepository::NewLC(KLbsCenRepUid); User::LeaveIfError(rep->Set(aKey, TInt(aCategoryUid.iUid))); CleanupStack::PopAndDestroy(rep); }
void CTe_LbsRootApiTestSuiteStepBase::SetTestRepositorySettingsL(TInt aTestStep) { CRepository* rep = CRepository::NewL(KLbsCenRepUid); CleanupStack::PushL(rep); // clean out any existing entries TUint32 errorKey; User::LeaveIfError(rep->Delete(KLbsSystemTransientKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessTransientKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessNameFirstKey, 0xFFFFF000, errorKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessUidFirstKey, 0xFFFFF000, errorKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessIsServerFirstKey, 0xFFFFF000, errorKey)); // For testing, set LbsRoot to 'transient' mode User::LeaveIfError(rep->Set(KLbsRootProcessTransientKey, EFalse)); User::LeaveIfError(rep->Set(KLbsSystemTransientKey, ETrue)); // set the entries for the 'dummy' processes to // be used for the test TUint nameKey = KLbsRootProcessNameFirstKey; TUint uidKey = KLbsRootProcessUidFirstKey; TUint isProcessKey = KLbsRootProcessIsServerFirstKey; switch(aTestStep) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: default: { User::LeaveIfError(rep->Set(nameKey++, KNrhName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNrhUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KAgpsName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KAgpsUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KNgName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNgUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); break; } // cases 10-18 yet to be ported case 19: { // Force a panic on the first process to be started User::LeaveIfError(rep->Set(nameKey++, KPanickingProcessName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KPanickingUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KAgpsName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KAgpsUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KNgName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNgUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); break; } case 20: { // Force a panic on the second process to be started User::LeaveIfError(rep->Set(nameKey++, KNrhName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNrhUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KPanickingProcessName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KPanickingUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KNgName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNgUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); break; } } CleanupStack::PopAndDestroy(rep); }
// ----------------------------------------------------------------------------- // CWPMessage::ProcessL // ----------------------------------------------------------------------------- // void CWPMessage::ProcessL() { FLOG( _L( "CWPMessage::ProcessL: Started" ) ); // Create a phone if one does not already exist if( !iPhone ) { iPhone = WPPhoneFactory::CreateL(); } FLOG( _L( "CWPMessage::ProcessL: Creating engine" ) ); // Read the message into the engine CWPEngine* engine = CWPEngine::NewLC(); // on CS FLOG( _L( "CWPMessage::ProcessL: Importing document" ) ); engine->ImportDocumentL( iMessage->Body() ); FLOG( _L( "CWPMessage::ProcessL: Populating adapters" ) ); engine->PopulateL(); FTRACE(RDebug::Print(_L(" WPMessage::ProcessL: Number of settings: (%d)"), engine->ItemCount())); // Check if the sender can be trusted TPtrC8 orig8( iMessage->Originator() ); HBufC* originator = HBufC::NewLC( orig8.Length() ); TPtr orig16( originator->Des() ); orig16.Copy( orig8 ); if( engine->ContextExistsL( orig16 ) ) { iMessage->SetAuthenticated( ETrue ); } CleanupStack::PopAndDestroy(); // originator // Try bootstrapping FLOG( _L( "CWPMessage::ProcessL: Bootstrapping" ) ); CWPBootstrap* bootstrap = CWPBootstrap::NewL( iPhone->SubscriberId() ); CleanupStack::PushL( bootstrap ); CWPBootstrap::TBootstrapResult result( bootstrap->BootstrapL( *iMessage, *engine, KNullDesC ) ); CleanupStack::PopAndDestroy(); // bootstrap FTRACE(RDebug::Print(_L(" WPMessage::ProcessL: Bootstrap result: (%d)"), result)); // See UI specs figure 1 TBool haveSettings( engine->ItemCount() > 0 ); switch( result ) { case CWPBootstrap::ENoBootstrap: { FLOG( _L( "CWPMessage::ProcessL: Bootstrapping ENoBootstrap" ) ); // If there's no bootstrap, just save the message if( haveSettings ) { StoreMsgL(); } else { User::Leave( KErrCorrupt ); } break; } case CWPBootstrap::ENotAuthenticated: { FLOG( _L( "CWPMessage::ProcessL: Bootstrapping ENotAuthenticated" ) ); if( haveSettings ) { StoreMsgL(); } else { // Message is ignored and an information SMs is put to Inbox. //Information SMs can be Class0, based on operator requirement. TInt auth_value; CRepository * rep = 0; TRAPD( err, rep = CRepository::NewL( KCRUidOMAProvisioningLV )); if(err == KErrNone) { rep->Get( KOMAProvAuthFailMsgHandling, auth_value ); delete rep; /*if(auth_value == 1) StoreMsgclass0L(R_TEXT_AUTHENTICATION_FAILED); else StoreMsgL(R_TEXT_AUTHENTICATION_FAILED);*/ User::Leave( KErrAccessDenied ); } else { //StoreMsgL(R_TEXT_AUTHENTICATION_FAILED); User::Leave( KErrAccessDenied ); } } break; } case CWPBootstrap::EPinRequired: { FLOG( _L( "CWPMessage::ProcessL: Bootstrapping EPinRequired" ) ); // If PIN is required, defer authentication to ProvisioningBC if( haveSettings ) { StoreMsgL(); } else { User::Leave( KErrCorrupt ); } break; } case CWPBootstrap::EAuthenticationFailed: { FLOG( _L( "CWPMessage::ProcessL: Bootstrapping EAuthenticationFailed" ) ); // Bootstrap is ignored and an information SMS is put to Inbox. //Information SMs can be Class0, based on operator requirement. TInt auth_value; CRepository * rep = 0; TRAPD( err, rep = CRepository::NewL( KCRUidOMAProvisioningLV )); if(err == KErrNone) { rep->Get( KOMAProvAuthFailMsgHandling, auth_value ); delete rep; /*if(auth_value == 1) StoreMsgclass0L(R_TEXT_AUTHENTICATION_FAILED); else StoreMsgL(R_TEXT_AUTHENTICATION_FAILED);*/ User::Leave( KErrAccessDenied ); } else { //StoreMsgL(R_TEXT_AUTHENTICATION_FAILED); User::Leave( KErrAccessDenied ); } break; } case CWPBootstrap::EBootstrapExists: { FLOG( _L( "CWPMessage::ProcessL: Bootstrapping EBootstrapExists" ) ); if( haveSettings ) { StoreMsgL(); } else { // Bootstrap is ignored and an information SMS is put to Inbox StoreMsgL( R_TEXT_BOOTSTRAP_EXISTS ); User::Leave( KErrAlreadyExists ); } break; } case CWPBootstrap::ESucceeded: { FLOG( _L( "CWPMessage::ProcessL: Bootstrapping ESucceeded" ) ); if( haveSettings ) { StoreMsgL(); } else { StoreMsgL( R_TEXT_BOOTSTRAPPED ); } break; } default: { break; } } CleanupStack::PopAndDestroy(); // engine FLOG( _L( "CWPMessage::ProcessL: Finished" ) ); }
// --------------------------------------------------------------------------- // T_NATFWTraversalAdapter::GetDomainSettingsL // Gets one domain settings entry // --------------------------------------------------------------------------- // void T_NATFWTraversalAdapter::GetDomainSettingsL( TUint32 aDomainKeyId, CNATFWDomainSpecificItem& aItem ) { // Central Repository for NAT-FW Traversal settings CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols ); // CS:1 TUint32 key( KErrNone ); // select domain key = ( KUNSAFProtocolsDomainMask^( aDomainKeyId ) ); key |= KUNSAFProtocolsDomainTableMask; // set key id aItem.SetDomainKey( aDomainKeyId ); // set domain TInt actualLength = 0; TBuf8<1> tmp; rep->Get( KUNSAFProtocolsDomainMask|key, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* domainName = HBufC8::NewLC( actualLength ); TPtr8 ptr( domainName->Des() ); TInt err = rep->Get( KUNSAFProtocolsDomainMask|key, ptr ); if( KErrNone == err ) { aItem.SetDomainL( domainName->Des() ); } else { aItem.SetDomainL( KNullDesC8() ); } CleanupStack::PopAndDestroy( domainName ); actualLength = 0; } // set STUN server address rep->Get( KUNSAFProtocolsSTUNServerMask|key, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* stunServerAddr = HBufC8::NewLC( actualLength ); TPtr8 ptr ( stunServerAddr->Des() ); TInt err = rep->Get( KUNSAFProtocolsSTUNServerMask|key, ptr ); if( err == KErrNone ) { aItem.SetSTUNServerAddrL( stunServerAddr->Des() ); } else { aItem.SetSTUNServerAddrL( KNullDesC8() ); } CleanupStack::PopAndDestroy( stunServerAddr ); } // STUN server port TInt tmpValue( 0 ); rep->Get( KUNSAFProtocolsSTUNServerPortMask|key, tmpValue ); aItem.SetSTUNServerPort( tmpValue ); // STUN server username rep->Get( KUNSAFProtocolsSTUNUsernameMask|key, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* stunUsername = HBufC8::NewLC( actualLength ); TPtr8 ptr ( stunUsername->Des() ); TInt err = rep->Get( KUNSAFProtocolsSTUNUsernameMask|key, ptr ); if( err == KErrNone ) { aItem.SetSTUNUsernameL( stunUsername->Des() ); } else { aItem.SetSTUNUsernameL( KNullDesC8() ); } CleanupStack::PopAndDestroy( stunUsername ); } // STUN server password rep->Get( KUNSAFProtocolsSTUNPasswordMask|key, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* stunPassword = HBufC8::NewLC( actualLength ); TPtr8 ptr ( stunPassword->Des() ); TInt err = rep->Get( KUNSAFProtocolsSTUNPasswordMask|key, ptr ); if( err == KErrNone ) { aItem.SetSTUNPasswordL( stunPassword->Des() ); } else { aItem.SetSTUNPasswordL( KNullDesC8() ); } CleanupStack::PopAndDestroy( stunPassword ); } // NAT refresh interval for UDP tmpValue = KErrNotFound; rep->Get( KUNSAFProtocolsDomainIntervalUDPMask|key, tmpValue ); aItem.SetNATRefreshUDP( tmpValue ); // NAT refresh interval for TCP tmpValue = KErrNotFound; rep->Get( KUNSAFProtocolsDomainIntervalTCPMask|key, tmpValue ); aItem.SetNATRefreshTCP( tmpValue ); // CRLF-based NAT binding refresh tmpValue = KErrNotFound; rep->Get( KUNSAFProtocolsDomainEnableCRLFRefresh|key, tmpValue ); aItem.SetEnableCRLFRefresh( tmpValue ); TUint32 tempKey = aDomainKeyId|KUNSAFProtocolsFieldTypeMask; tempKey ^= KUNSAFProtocolsFieldTypeMask; RArray<TUint32> stunKeys; CleanupClosePushL( stunKeys ); // CS:2 rep->FindL( tempKey|KUNSAFProtocolsSTUNAddressMask, KUNSAFProtocolsSubTableFieldTypeMask, stunKeys ); TInt stunKeyCount = stunKeys.Count(); // STUN server items start from CenRep table index 1. for ( TInt counter = 1; counter < stunKeyCount; counter++ ) { CWPStunServerItem* stunItem = CWPStunServerItem::NewLC(); // CS:3 // Remove STUN server address mask from key. TUint32 tmpKey = KUNSAFProtocolsSTUNAddressMask^stunKeys[counter]; // STUNSrvAddr actualLength = 0; rep->Get( tmpKey|KUNSAFProtocolsSTUNAddressMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* stunSrvAddr = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( stunSrvAddr->Des() ); TInt err = rep->Get( tmpKey|KUNSAFProtocolsSTUNAddressMask, ptr ); if ( KErrNone == err ) { stunItem->SetStunSrvAddrL( stunSrvAddr->Des() ); } else { stunItem->SetStunSrvAddrL( KNullDesC8 ); } CleanupStack::PopAndDestroy( stunSrvAddr ); // CS:3 } else if ( 0 == actualLength ) { stunItem->SetStunSrvAddrL( KNullDesC8 ); } // STUNSrvPort TInt tmpValue( KErrNotFound ); rep->Get( tmpKey|KUNSAFProtocolsSTUNPortMask, tmpValue ); stunItem->SetStunSrvPort( tmpValue ); // STUNSrvUsername actualLength = 0; rep->Get( tmpKey|KUNSAFProtocolsSTUNUsernameMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* stunUsername = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( stunUsername->Des() ); TInt err = rep->Get( tmpKey|KUNSAFProtocolsSTUNUsernameMask, ptr ); if ( KErrNone == err ) { stunItem->SetStunUsernameL( stunUsername->Des() ); } else { stunItem->SetStunUsernameL( KNullDesC8 ); } CleanupStack::PopAndDestroy( stunUsername ); // CS:3 } else if ( 0 == actualLength ) { stunItem->SetStunUsernameL( KNullDesC8 ); } // STUNSrvPassword actualLength = 0; rep->Get( tmpKey|KUNSAFProtocolsSTUNPasswordMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* stunPassword = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( stunPassword->Des() ); TInt err = rep->Get( tmpKey|KUNSAFProtocolsSTUNPasswordMask, ptr ); if ( KErrNone == err ) { stunItem->SetStunPasswordL( stunPassword->Des() ); } else { stunItem->SetStunPasswordL( KNullDesC8 ); } CleanupStack::PopAndDestroy( stunPassword ); // CS:3 } else if ( 0 == actualLength ) { stunItem->SetStunPasswordL( KNullDesC8 ); } aItem.AddStunServerItemL( stunItem ); // Ownership transfer. CleanupStack::Pop( stunItem ); // CS:2 } stunKeys.Close(); CleanupStack::PopAndDestroy( &stunKeys ); // CS:1 // STUNSharedSecret tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsDomainSharedSecretNotSupported, tmpValue ); aItem.SetDisableStunSharedSecret( tmpValue ); // PortPoolStartPort tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsPortPoolStartPortMask, tmpValue ); aItem.SetStartPortRange( tmpValue ); // PortPoolEndPort tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsPortPoolEndPortMask, tmpValue ); aItem.SetEndPortRange( tmpValue ); // UsedNATProtocol actualLength = 0; rep->Get( key|KUNSAFProtocolsUsedNATProtocolMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* natProtocol = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( natProtocol->Des() ); TInt err = rep->Get( key|KUNSAFProtocolsUsedNATProtocolMask, ptr ); if ( KErrNone == err ) { aItem.SetNatProtocolL( natProtocol->Des() ); } else { aItem.SetNatProtocolL( KNullDesC8 ); } CleanupStack::PopAndDestroy( natProtocol ); // CS:3 } else if ( 0 == actualLength ) { aItem.SetNatProtocolL( KNullDesC8 ); } // ICESpecific/NATUtilities actualLength = 0; rep->Get( key|KUNSAFProtocolsNATUtilities, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* natUtils = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( natUtils->Des() ); TInt err = rep->Get( key|KUNSAFProtocolsNATUtilities, ptr ); if ( KErrNone == err ) { aItem.SetNatUtilitiesL( natUtils->Des() ); } else { aItem.SetNatUtilitiesL( KNullDesC8 ); } CleanupStack::PopAndDestroy( natUtils ); // CS:3 } else if ( 0 == actualLength ) { aItem.SetNatUtilitiesL( KNullDesC8 ); } // ICESpecific/HostPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsHostPref, tmpValue ); aItem.SetHostPref( tmpValue ); // ICESpecific/ServerRefPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsServerRefPref, tmpValue ); aItem.SetServerRefPref( tmpValue ); // ICESpecific/RelayPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsRelayPref, tmpValue ); aItem.SetRelayPref( tmpValue ); // ICESpecific/PeerRefPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsPeerRefPref, tmpValue ); aItem.SetPeerRefPref( tmpValue ); // ICESpecific/IPv4Pref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsIPV4Pref, tmpValue ); aItem.SetIPv4Pref( tmpValue ); // ICESpecific/IPv6Pref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsIPV6Pref, tmpValue ); aItem.SetIPv6Pref( tmpValue ); // ICESpecific/VpnPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsVPNPref, tmpValue ); aItem.SetVpnPref( tmpValue ); // ICESpecific/UdpPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsUDPPref, tmpValue ); aItem.SetUdpPref( tmpValue ); // ICESpecific/TcpPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsTCPPref, tmpValue ); aItem.SetTcpPref( tmpValue ); // ICESpecific/TcpActivePref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsTCPActivePref, tmpValue ); aItem.SetTcpActivePref( tmpValue ); // ICESpecific/TcpPassivePref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsTCPPassivePref, tmpValue ); aItem.SetTcpPassivePref( tmpValue ); // ICESpecific/TCPSimultPref tmpValue = KErrNotFound; rep->Get( key|KUNSAFProtocolsTCPSimultPref, tmpValue ); aItem.SetTcpSimultPref( tmpValue ); // TURN server tempKey = aDomainKeyId|KUNSAFProtocolsFieldTypeMask; tempKey ^= KUNSAFProtocolsFieldTypeMask; RArray<TUint32> turnKeys; CleanupClosePushL( turnKeys ); // CS:2 rep->FindL( tempKey|KUNSAFProtocolsTURNAddressMask, KUNSAFProtocolsSubTableFieldTypeMask, turnKeys ); TInt turnKeyCount = turnKeys.Count(); for ( TInt counter = 0; counter < turnKeyCount; counter++ ) { CWPTurnServerItem* turnItem = CWPTurnServerItem::NewLC(); // CS:3 // Remove TURN server address mask from key. TUint32 tmpKey = KUNSAFProtocolsTURNAddressMask^turnKeys[counter]; // TURNSrvAddr actualLength = 0; rep->Get( tmpKey|KUNSAFProtocolsTURNAddressMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* turnSrvAddr = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( turnSrvAddr->Des() ); TInt err = rep->Get( tmpKey|KUNSAFProtocolsTURNAddressMask, ptr ); if ( KErrNone == err ) { turnItem->SetTurnSrvAddrL( turnSrvAddr->Des() ); } else { turnItem->SetTurnSrvAddrL( KNullDesC8 ); } CleanupStack::PopAndDestroy( turnSrvAddr ); // CS:3 } else if ( 0 == actualLength ) { turnItem->SetTurnSrvAddrL( KNullDesC8 ); } // TURNSrvPort TInt tmpValue( KErrNotFound ); rep->Get( tmpKey|KUNSAFProtocolsTURNPortMask, tmpValue ); turnItem->SetTurnSrvPort( tmpValue ); // TURNUsername actualLength = 0; rep->Get( tmpKey|KUNSAFProtocolsTURNUsernameMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* turnUsername = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( turnUsername->Des() ); TInt err = rep->Get( tmpKey|KUNSAFProtocolsTURNUsernameMask, ptr ); if ( KErrNone == err ) { turnItem->SetTurnUsernameL( turnUsername->Des() ); } else { turnItem->SetTurnUsernameL( KNullDesC8 ); } CleanupStack::PopAndDestroy( turnUsername ); // CS:3 } else { turnItem->SetTurnUsernameL( KNullDesC8 ); } // TURNPassword actualLength = 0; rep->Get( tmpKey|KUNSAFProtocolsTURNPasswordMask, tmp, actualLength ); if ( actualLength > 0 ) { HBufC8* turnPassword = HBufC8::NewLC( actualLength ); // CS:4 TPtr8 ptr( turnPassword->Des() ); TInt err = rep->Get( tmpKey|KUNSAFProtocolsTURNPasswordMask, ptr ); if ( KErrNone == err ) { turnItem->SetTurnPasswordL( turnPassword->Des() ); } else { turnItem->SetTurnPasswordL( KNullDesC8 ); } CleanupStack::PopAndDestroy( turnPassword ); // CS:3 } else { turnItem->SetTurnPasswordL( KNullDesC8 ); } aItem.AddTurnServerItemL( turnItem ); // Ownership transfer. CleanupStack::Pop( turnItem ); // CS:2 } turnKeys.Close(); CleanupStack::PopAndDestroy( &turnKeys ); // CS:1 CleanupStack::PopAndDestroy( rep ); // CS:0 }
/** @SYMTestCaseID BA-CTSY-ALLS-MGAL-0001 @SYMComponent telephony_ctsy @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetALSLine @SYMTestPriority High @SYMTestActions Invokes RMobilePhone::GetALSLine @SYMTestExpectedResults Pass @SYMTestType CT */ void CCTsyAlternateLineServiceFU::TestGetALSLine0001L() { OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); RBuf8 data; CleanupClosePushL(data); TInt ret(KErrGeneral); TRequestStatus requestStatus; // dont change the tests order in order to preserve the environment state // at the beginig of every test //------------------------------------------------------------------------- // TEST E: Unsolicited completion of RMobilePhone::GetALSLine // from LTSY. //------------------------------------------------------------------------- // create centRep to change repository CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); CleanupStack::PushL(centRep); // setting environment (set KCtsyMEAlsSupported in repository to EFalse) ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); ASSERT_EQUALS(KErrNone, ret); // Unsolicited completion with new value EAlternateLineAuxiliary that is not yet cached in CTSY iMockLTSY.NotifyTerminated(requestStatus); RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLineAuxiliary); TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine); alsLineData.SerialiseL(data); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); User::WaitForRequest(requestStatus); AssertMockLtsyStatusL(); ASSERT_EQUALS(KErrNone, requestStatus.Int()); // Unsolicited completion with the same value EAlternateLineAuxiliary that is cached in CTSY iMockLTSY.NotifyTerminated(requestStatus); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST C: Successful completion request of // RMobilePhone::GetALSLine when result is not cached. //------------------------------------------------------------------------- // test setting and execute ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TESTs for coverage increasing with different values of alsLine and // of KCtsyMEAlsSupported from repository //------------------------------------------------------------------------- // setting environment (set alsLine to EAlternateLineUnknown) iMockLTSY.NotifyTerminated(requestStatus); alsLine = RMobilePhone::EAlternateLineUnknown; data.Close(); alsLineData.SerialiseL(data); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // test setting and execute ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); AssertMockLtsyStatusL(); // setting environment (set KCtsyMEAlsSupported in repository to ETrue) ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); ASSERT_EQUALS(KErrNone, ret); // test setting and execute alsLine = RMobilePhone::EAlternateLinePrimary; data.Close(); alsLineData.SerialiseL(data); iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST D: RMobilePhone::GetALSLine again, this time CTSY // will get result from the cache. //------------------------------------------------------------------------- ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNone, ret); ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST B: failure on completion of pending request from LTSY->CTSY //------------------------------------------------------------------------- // change alsLine to EAlternateLineUnknown again iMockLTSY.NotifyTerminated(requestStatus); alsLine = RMobilePhone::EAlternateLineUnknown; data.Close(); alsLineData.SerialiseL(data); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // test setting and execute iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrGeneral, data); ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrGeneral, ret); AssertMockLtsyStatusL(); //------------------------------------------------------------------------- // TEST A: failure to dispatch request to LTSY //------------------------------------------------------------------------- //change alsLine to EAlternateLineUnknown again iMockLTSY.NotifyTerminated(requestStatus); alsLine = RMobilePhone::EAlternateLineUnknown; data.Close(); alsLineData.SerialiseL(data); iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNone, requestStatus.Int()); AssertMockLtsyStatusL(); // test setting and execute iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNotSupported); ret = iPhone.GetALSLine(alsLine); ASSERT_EQUALS(KErrNotSupported, ret); AssertMockLtsyStatusL(); //Done! // return repository KCtsyMEAlsSupported to EFalse (initial state) ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); ASSERT_EQUALS(KErrNone, ret); AssertMockLtsyStatusL(); CleanupStack::PopAndDestroy(1); // iCentRep CleanupStack::PopAndDestroy(2, this); // data, this }
// ----------------------------------------------------------------------------- // ShowTypedQueryL // Shows list query and returns the user selection. // ----------------------------------------------------------------------------- // TUid CSendUiImpl::ShowTypedQueryL( CSendUi::TSendUiMenuType aMenuType, const CMessageData* aMessageData, TSendingCapabilities aRequiredCapabilities, CArrayFix<TUid>* aServicesToDim, const TDesC& aTitleText ) { // Implemented for CR # 401-1806 >> // This section to enable/disable features (supported by feature manager) at run time, is to be revised, // once an observer class is available from feature manager side to intimate about feature state CRepository* repository = CRepository::NewLC( KCRUidSendUi ); TInt oldFeatures(0); TInt newFeatures(0); TBool updateNeeded( EFalse ); if ( repository->Get( KKeySendUiFeatureManagerServices, oldFeatures ) != KErrNone ) { updateNeeded = ETrue; } FeatureManager::InitializeLibL(); FeatureStatus( KFeatureIdMmsPostcard, newFeatures, KSendUiPostcard ); FeatureStatus( KFeatureIdAudioMessaging, newFeatures, KSendUiAudioMessage ); FeatureStatus( KFeatureIdSenduiMmsUpload, newFeatures, KSendUiMmsUpload ); FeatureManager::UnInitializeLib(); if ( newFeatures != oldFeatures ) { repository->Set( KKeySendUiFeatureManagerServices, newFeatures ); updateNeeded = ETrue; } CleanupStack::PopAndDestroy( repository ); RProperty propertyUpdateOperation; TRequestStatus status; if ( updateNeeded ) { RProperty::Set( KPSUidSendUiProperty, KSendUiUpdateRequest, KSendUiUpdateRequested ); User::LeaveIfError( propertyUpdateOperation.Attach( KPSUidSendUiProperty, KSendUiUpdateRequest )); propertyUpdateOperation.Subscribe( status ); User::WaitForRequest(status); TInt value = KErrNone; if(propertyUpdateOperation.Get( value ) !=KErrNotFound && value == KSendUiUpdated ) { TRAPD( err, GetServicesL() ); if ( err ) { #ifdef _DEBUG TBuf<256> buf; buf.Format(_L("SendUi err")); User::InfoPrint(buf); #endif TUid serviceId( KNullUid ); return serviceId; } } propertyUpdateOperation.Close(); } // Implemented for CR # 401-1806 << // List items for list query. CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat( KArrayGranularity ); CleanupStack::PushL( listItems); // This array is used to map user selection to correct service. CArrayFix<TUid>* listItemUids = new ( ELeave ) CArrayFixFlat<TUid>( KArrayGranularity ); CleanupStack::PushL( listItemUids ); iServicesToDim->Reset(); TInt i = 0; if ( aServicesToDim ) { for ( i = 0; i < aServicesToDim->Count(); i++ ) { iServicesToDim->AppendL( (*aServicesToDim)[i] ); } } // Get and filter ECom based services. FilterServicesL( *listItems, *listItemUids, aRequiredCapabilities, aMessageData, aMenuType ); TUid serviceId( KNullUid ); if ( listItems->Count() > 0 ) { // Show list query. SortListL( *listItems, *listItemUids ); serviceId = ShowListQueryL( listItems, *listItemUids, aTitleText, aMenuType ); } CleanupStack::PopAndDestroy( 2, listItems ); // listItemUids, listItems return serviceId; }