/**
   @SYMTestCaseID T-RApaLsSessionTestStep-TestServiceDiscovery5L
  
   @SYMPREQ 538
  
   @SYMTestCaseDesc Test the functionality of GetAppServicesL which gets all the service uids of a particular app 
   
   @SYMTestPriority 
  
   @SYMTestStatus Implemented
   
   @SYMTestActions Call GetAppServicesL with two parameters: the app uid and an array to put in the uid of the services 
   on z: drive.\n
   API Calls:\n	
   RApaLsSession::GetAppServicesL(TUid aAppUid, CArrayFixFlat<TUid>& aServiceUids) const
   
   @SYMTestExpectedResults Populates the array with the uids of the services offered by this particular app. 
   The returned data should be the same as that defined in the registration files. 
    
 */
void CT_ServicesTestStep::TestServiceDiscovery5L()
	{
	INFO_PRINTF1(_L("TestServiceDiscovery5 about to start..."));
	const TUid KUidServerApp = {0x10004c56};
	const TUid KUidService1234 = {0x01020304};
	const TUid KUidService2345 = {0x02030405};
	const TUid KUidService5678 = {0x05060708};
	const TUid KUidService = {0x01020333};
	// get UIDs of all services implemented by an app
	CArrayFixFlat<TUid>* uidArray = new(ELeave) CArrayFixFlat<TUid>(4);
	CleanupStack::PushL(uidArray);
	iApaLsSession.GetAppServicesL(KUidServerApp,*uidArray);
	TInt count = uidArray->Count();
	TUid uid;
	if(count>0)
		{
		TEST(count==6);	// Takes into account the open service
		uid = (*uidArray)[0];
		TEST(uid==KUidService);
		uid = (*uidArray)[1];
		TEST(uid==KUidService5678);
		uid = (*uidArray)[2];
		TEST(uid==KUidService5678);
		uid = (*uidArray)[3];
		TEST(uid==KUidService2345);
		uid = (*uidArray)[4];
		TEST(uid==KUidService1234);
		}
	CleanupStack::PopAndDestroy(uidArray);
	uidArray = NULL;
	}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestLqdlgPublishDialogL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestLqdlgPublishDialogL( CStifItemParser& /*aItem*/ )
    {
    TInt selectedOption( KZero );
    
    CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat(KTen);
    CleanupStack::PushL( mArray );
     
    TBuf< KTen > palabra;
    for (TInt num = KZero; num< KTen; num++)
        {
       palabra.Format(_L("option %d"), num);
       mArray->AppendL(palabra);
        }
     
    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
    dlg->PrepareLC( R_UPDATE_QUERY_MSG_DIALOG );
    dlg->SetItemTextArray( mArray );
    dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
    
    CArrayFixFlat< TInt >* selArray = new( ELeave )CArrayFixFlat< TInt >( KFive );
    CleanupStack::PushL( selArray );
    selArray->AppendL( KOne );
    selArray->AppendL( KThree );
    
    TInt err = KErrNone;
    TRAP( err, dlg->PublishDialogL( KOne, KNullUid, selArray ));
    
    CleanupStack::Pop( KOne );
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
TUint32 CIkev2NatT::CheckPeerNotifysL(const CArrayFixFlat<TNotifPayloadIkev2*>& aNotifys, 
                                      const TInetAddr& aLocalAddr, const  TInetAddr& aRemoteAddr, TUint16 aPort, 
									  const TDesC8& aInitiatorSpi, const TDesC8& aResponderSpi, TBool& aSupported)
{    
  //
  // Check does there exists NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP
  // Notify payload. If found compare payload data to local end NAT
  // traversal data as follows:
  // -- NAT_DETECTION_SOURCE_IP Notifys are examined against local Notify
  //    payload iDstIdentiy data: If no match found
  //    ==> Peer is behind  NAT
  // -- NAT_DETECTION_DESTINATION_IP Notify is examined against local Notify
  //    payload iSrcIdentiy data: If no match found
  //    ==> Local end behind NAT
  //
    aSupported = EFalse;
	TInt Count = aNotifys.Count();

	CIkev2NatT* RefObj = CIkev2NatT::NewL(aLocalAddr, aRemoteAddr, aPort, 
                                          aInitiatorSpi, aResponderSpi);
	 
	TNotifPayloadIkev2* PeerNotify;
	TUint32 PeerLth;
	TBool SrcMatch   = EFalse;
	TBool DstMatch   = EFalse;	
    TUint32 NatFlags = 0;
    TInt i = 0;

	while ( i < Count )
	{
		PeerNotify = aNotifys.At(i);
		if ( (PeerNotify->GetMsgType() == NAT_DETECTION_SOURCE_IP) && !SrcMatch )
		{
			NatFlags |= REMOTE_END_NAT;
			PeerLth = TPayloadIkev2::Cast(PeerNotify)->GetLength() - (TUint32)(PeerNotify->Size() + PeerNotify->GetSPISize());
			const TPtrC8 peerNotify(PeerNotify->NotifData(), PeerLth);
			if ( RefObj->DestinNofify().Compare(peerNotify) == 0)
			{
				SrcMatch  = ETrue;
				NatFlags &= ~REMOTE_END_NAT;
			}	
		}
		else if ( (PeerNotify->GetMsgType() == NAT_DETECTION_DESTINATION_IP) && !DstMatch )
		{
			aSupported = ETrue;						
			NatFlags  |= LOCAL_END_NAT;
			PeerLth = TPayloadIkev2::Cast(PeerNotify)->GetLength() - (TUint32)(PeerNotify->Size() + PeerNotify->GetSPISize()); 
			const TPtrC8 peerNotify(PeerNotify->NotifData(), PeerLth);
			if ( RefObj->SourceNofify().Compare(peerNotify) == 0 )
			{
				DstMatch  = ETrue;							
				NatFlags &= ~LOCAL_END_NAT;
			}	
		}			
	    i ++;
    }

	delete RefObj;	
    return NatFlags;     
}
TCertStatus CPolicyStore::PolicyCertificateStatusL(CIkeData* aIkeData) const
    {
    LOG(Log::Printf(_L("-> CPolicyStore::PolicyCertificateStatusL()")));
    TCertStatus status = ECertValid;

    CArrayFixFlat<TCertInfo*> *cAList = aIkeData->iCAList;
    if ((cAList == NULL || cAList->Count() == 0) && 
        !aIkeData->iOwnCert.iOwnCertExists)
        {
        status = ECertNotNeeded;
        }
    else
        {        
        RPKIServiceAPI pkiService;
        User::LeaveIfError(pkiService.Connect());
        CleanupClosePushL(pkiService);

        pkiService.SetInformational(ETrue);
                    
        CDesC8ArrayFlat* caSubjectNameArray = new (ELeave) CDesC8ArrayFlat(2);
        CleanupStack::PushL(caSubjectNameArray);                        
            
        if (cAList != NULL && cAList->Count() > 0)
            {                    
            status = PkiUtil::GetValidCaCertSubjectNameListL(pkiService, *cAList,
                                                             *caSubjectNameArray);        
            }
            
        if (status == ECertValid)
            {
			// Set store type to device store,
			// if Own_cert_type is defined as "DEVICE"            
			if ( aIkeData->iClientCertType != NULL )
			  	{
				TPtrC16 certStoreType = aIkeData->iClientCertType->GetData();
				if ( certStoreType.CompareF(_L("DEVICE")) == 0 )
					{
					LOG(Log::Printf(_L("Set store type to STORETYPE_DEVICE")));    
					pkiService.SetStoreType(EPkiStoreTypeDevice);            
					}
                else
                    {
					LOG(Log::Printf(_L("Set store type to STORETYPE_USER")));    
					pkiService.SetStoreType(EPkiStoreTypeUser);                                
                    }
				}
            else
                {
				LOG(Log::Printf(_L("Set store type to STORETYPE_USER")));    
				pkiService.SetStoreType(EPkiStoreTypeUser);                                                
                }
            status = PkiUtil::CheckUserCertValidityL(pkiService, *caSubjectNameArray,
                                                     aIkeData->iOwnCert);
            }
        CleanupStack::PopAndDestroy(caSubjectNameArray);
        CleanupStack::PopAndDestroy(); //pkiService            
        }
	LOG(Log::Printf(_L("<- CPolicyStore::PolicyCertificateStatusL()")));        
    return status;
    }
// -----------------------------------------------------------------------------
// CTestSDKLists::TestSTXLBGetColorUseListL
// -----------------------------------------------------------------------------
//
TInt CTestSDKLists::TestSTXLBGetColorUseListL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestModule, "EIKTXLBXTestModule" );
    _LIT( KTestEIKTXLBX, "In TestSTXLBGetColorUseListL" );
    TestModuleIf().Printf( 0, KTestModule, KTestEIKTXLBX );
    // Print to log file
    iLog->Log( KTestEIKTXLBX );

    TInt flags = CEikListBox::EIncrementalMatching |  EAknListBoxSelectionList | 
        EAknListBoxViewerFlags | CEikListBox::ELeftDownInViewRect;
    CDesCArray* textArray = iEikonEnvPointer->ReadDesCArrayResourceL( 
            R_TESTLIST_ITEM_SETTING );
    CleanupStack::PushL( textArray );

    CEikSnakingTextListBox* list = new( ELeave ) CEikSnakingTextListBox();
    CleanupStack::PushL( list );
    list->ConstructL( iContainer, flags );
    list->Model()->SetItemTextArray( textArray );
    list->Model()->SetOwnershipType( ELbmOwnsItemArray );
    iContainer->SetControlL( list );

    CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) 
        CArrayFixFlat<TCoeColorUse>( KFour );
    CleanupStack::PushL( colorUseList );
    list->GetColorUseListL( *colorUseList );
    colorUseList->Reset();    
    CleanupStack::PopAndDestroy( colorUseList );

    iContainer->ResetControl();
    CleanupStack::Pop( 2 );

    return KErrNone;
    }
Exemple #6
0
CGulIcon* CTap2MenuAppUi::LoadAppIconHard(TUid aUid)
	{
	RApaLsSession ls;
	ls.Connect();
	CGulIcon *retval = NULL;
	CArrayFixFlat<TSize> *array = new CArrayFixFlat<TSize>(3);
	CleanupStack::PushL(array);
	TInt err = ls.GetAppIconSizes(aUid, *array);
	if(err == KErrNone && array->Count() > 0)
		{
		CApaMaskedBitmap *bitmap = CApaMaskedBitmap::NewLC();
		err = ls.GetAppIcon(aUid, (*array)[0], *bitmap);
		if(err == KErrNone)
			{
			CFbsBitmap* bmp = new (ELeave) CFbsBitmap();
			CleanupStack::PushL(bmp);
			CFbsBitmap* bmp_mask = new (ELeave) CFbsBitmap();
			CleanupStack::PushL(bmp_mask);
			User::LeaveIfError(bmp->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()));
			User::LeaveIfError(bmp_mask->Create(bitmap->Mask()->SizeInPixels(), bitmap->Mask()->DisplayMode()));
			CopyBitmapL(bitmap, bmp);
			CopyBitmapL(bitmap->Mask(), bmp_mask);
			retval = CGulIcon::NewL(bmp, bmp_mask);
			CleanupStack::Pop(2); // bmp, bmp_mask
			}
			CleanupStack::PopAndDestroy(bitmap);
		}
		CleanupStack::PopAndDestroy(array);
		ls.Close();
		return retval;
	}
void CBCTestPtiEngine::TestLanguageL()
    {
    CArrayFixFlat<TInt>* langs = new (ELeave) CArrayFixFlat<TInt>(100);
    CleanupStack::PushL(langs);
    iEngine->GetAvailableLanguagesL(langs);

    AssertTrueL(langs->Count()>0, _L("available languages got"));
    CleanupStack::PopAndDestroy( 1 ); // cores, langs

    RArray<TInt> langRefs;
    iEngine->GetAvailableLanguagesL(langRefs);
    AssertTrueL(langRefs.Count()>0, _L("available languages got into RArray"));

    //
    //activate
    //
    if(langRefs.Count())
        {
        MPtiLanguage *lan = iEngine->GetLanguage(langRefs[0]);
        if (lan->HasInputMode(EPtiEngineMultitapping))
            {
            iEngine->ActivateLanguageL(lan->LanguageCode(), EPtiEngineMultitapping);
            AssertTrueL( ETrue, _L("activate multitapping"));
            }
        else
            {
            iEngine->ActivateLanguageL(lan->LanguageCode(), EPtiEnginePredictive);
            AssertTrueL( ETrue, _L("activate predictive"));
            }
        }

    langRefs.Close();
    }
CArrayFix<TCoeHelpContext>* CMobileOfficeAppUi::HelpContextL() const
{
	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
	CleanupStack::PushL(array);
	array->AppendL(TCoeHelpContext(KUidMobileOffice, _L("Introduction")));
	CleanupStack::Pop(array);
	return array;
}
void CFMSServer::CreateScheduledReminderL()
    {
    FLOG(_L("CFMSServer::CreateScheduledReminderL ()"));
    _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe");

    RScheduler scheduler;
    TTsTime startTime;
    TTime time;
    time.HomeTime();
    time = time + (TTimeIntervalHours(1));
    startTime.SetLocalTime(time);

    User::LeaveIfError(scheduler.Connect());
    CleanupClosePushL(scheduler);
    //Creating a persistent daily schedule
    
    TSchedulerItemRef persistentScheduleItem;
    CArrayFixFlat<TScheduleEntryInfo2>* entries = new CArrayFixFlat<TScheduleEntryInfo2> (1);
    CleanupStack::PushL(entries);
    persistentScheduleItem.iName = TUid::Uid(KFMSServerUid).Name();

    //TScheduleEntryInfo2 scentry1(startTime, EDaily, 1, 1);
    TScheduleEntryInfo2 scentry1;
    scentry1.SetStartTime(startTime);
    scentry1.SetInterval(1);
    scentry1.SetIntervalType(TIntervalType(EHourly));
    scentry1.SetValidityPeriod((TTimeIntervalMinutes) 1440); //1440 min = 24 hrs or 1 day
    
    entries->AppendL(scentry1);

    scheduler.Register(TFileName( KFotaScheduleExe ), 0 );
    TInt ret = scheduler.CreatePersistentSchedule(persistentScheduleItem, *entries);

    FLOG(_L("created schedule %d  %d:%d"), persistentScheduleItem.iHandle,
            time.DateTime().Hour(), time.DateTime().Minute());

    if (ret == KErrNone)
        {
        TTaskInfo taskInfo;
        taskInfo.iName = TUid::Uid(KFMSServerUid).Name();
        taskInfo.iRepeat = 1; //Repeat once
        taskInfo.iPriority = 1;

        TFotaScheduledUpdate fotareminder(-1, -1);
        TPckg<TFotaScheduledUpdate> fotareminderpkg(fotareminder);

        HBufC* data = HBufC::NewLC(fotareminderpkg.Length());
        data->Des().Copy(fotareminderpkg);

        TInt err = scheduler.ScheduleTask(taskInfo, *data,  persistentScheduleItem.iHandle);

        FLOG(_L("Schedule creation error %d"), err);

        CleanupStack::PopAndDestroy(data);
        }
    CleanupStack::PopAndDestroy(entries);
    CleanupStack::PopAndDestroy(&scheduler); // xx
    }
TInt CContextMediaArrayImpl::MdcaCount() const
{
	CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("MdcaCount"));

	if (iItem == ENone) {
		return iPostArray->Count();
	} else {
		return iPostArray->Count()+1;
	}
}
// ---------------------------------------------------------------------------
// Get an array of image quality levels that are in use with the current
// product with given Camera/Display ID. If the ID is zero, then all levels
// dispite of the ID value are returned.
// ---------------------------------------------------------------------------
//
TInt CImagingConfigManager::GetImageQualityLevelsL(
                                        CArrayFixFlat<TUint>& aLevels,
                                        TUint /*aCameraDisplayID*/ )
    {
    aLevels.Reset();
    for( TInt i = 0 ; i < NumberOfImageQualityLevels() ; i++ )
        {
        aLevels.AppendL(
                iImageQualitySets->At( i ).iImageQualitySetLevel );
        }
    return KErrNone;
    }
Exemple #12
0
//#pragma warning( disable : 4701 )	//local variable 'docPosError' may be used without having been initialized
TBool CLinePaginatorTest::CompareArrays()
	{
	TInt numPages=iCharsPerPage->Count();
	TInt numTestPages=iTestChars->Count();
	TInt numChars;
	TInt numTestChars;
	TBool pagesSame=EFalse;
	TBuf8<128> text;
	TInt prevDocPos=0;
	TInt docPosError=0;

	TBuf<256> buf;
	if (numPages==numTestPages)
		{
 		buf.AppendFormat(_L("Correct Number of Pages = %d\n"), numPages);
 		TESTPRINT(buf);
		pagesSame=ETrue;
		for (TInt i=0; i<numPages; i++)
			{
			numChars=(*iCharsPerPage)[i];
			numTestChars=(*iTestChars)[i]-prevDocPos;
			if(numChars!=numTestChars)
				{
				if (pagesSame)
					docPosError=(*iTestChars)[i];
				pagesSame=EFalse;
				}
			prevDocPos=(*iTestChars)[i];
			}
		if (pagesSame)
			{            
 			TESTPRINT(_L("Correct Number of Characters on Pages -- PASSED\n"));
			}
		else
			{
            TESTPRINT(_L("Incorrect Number of Characters on Pages -- FAILED\n"));            
            buf.Zero();
			buf.AppendFormat(_L("First Error Occurs at Position = %d"), docPosError);
			TESTPRINT(buf);
			}
		}
	else
		{
        TESTPRINT(_L("Incorrect Number of Pages  -- FAILED\n"));
        buf.Zero();
		buf.AppendFormat(_L("Number Calculated	by LinePaginator = %d\n"), numPages);		
		buf.AppendFormat(_L("Number Contained in File = %d\n"), numTestPages);
		TESTPRINT(buf);
		}

	iTestFile.Close();
	return pagesSame;
	}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestLqdlgConstructorLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestLqdlgConstructorLL( CStifItemParser& /*aItem*/ )
    {
    CArrayFixFlat< TInt >* selArray = new( ELeave )CArrayFixFlat< TInt >( KFive );
    CleanupStack::PushL( selArray );
    selArray->AppendL( KOne );
    selArray->AppendL( KThree );
    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( selArray );
    CleanupStack::PushL( dlg );
    STIF_ASSERT_NOT_NULL( dlg );
    CleanupStack::PopAndDestroy( dlg );
    CleanupStack::Pop( selArray );
    return KErrNone;
    }
LOCAL_C void CloseArrayOfCallObjects(TAny* aCallArray)
/**
Close and delete the call object array.
*/
	{
	CArrayFixFlat<RMobileCall>* callArray = reinterpret_cast<CArrayFixFlat<RMobileCall>*>(aCallArray);
	TInt count = callArray->Count();
	for (TInt i=count-1; i>=0; --i)
		{
		callArray->At(i).Close();
		}	
	delete callArray;
 	callArray = NULL; 	
	}
Exemple #15
0
CArrayFix<TCoeHelpContext>* CRhodesAppUi::HelpContextL() const
	{
#warning "Please see comment about help and UID3..."
	// Note: Help will not work if the application uid3 is not in the
	// protected range.  The default uid3 range for projects created
	// from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
	// can be self signed and installed on the device during testing.
	// Once you get your official uid3 from Symbian Ltd. and find/replace
	// all occurrences of uid3 in your project, the context help will
	// work.
	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
	CleanupStack::PushL(array);
	array->AppendL(TCoeHelpContext(KUidRhodesApp, KGeneral_Information));
	CleanupStack::Pop(array);
	return array;
	}
CCMPost*  CContextMediaArrayImpl::GetPostAt(TInt aIndex)
{
	CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("GetPostAt"));

	if (aIndex<0) return 0;
	if ((iItem!=ENone) && (aIndex==0)) return 0;

	if (iOrder==CPostStorage::EDescending) {
		aIndex=MdcaCount()-aIndex-1;
	}

	if (!iPostArray->At(aIndex)) {
		iPostArray->At(aIndex)=iStorage.GetByPostIdL(0, iPostIdArray->At(aIndex));
	}

	return iPostArray->At(aIndex);
}
/*!
    \brief Returns names and identifiers of supported languages in a phone.
 
    Language names are localized according the language's native presentation.
    Language ID's returned by this functions may be used as language parameter for changeLanguage(int language) function.
    Language IDs and names are OS specific and may vary across the platforms and releases.
    
    \attention Symbian specific API
    
    \deprecated HbLanguageUtil::supportedLanguages()
        is deprecated. Please use HbLocaleUtil::supportedLanguages() instead.
     
    \return Symbian - localized names and integer identifiers of languages supported in a device  
    \return other platforms - empty QHash    
*/
QHash<int, QString> HbLanguageUtil::supportedLanguages()
{
#if defined(Q_OS_SYMBIAN)   
    QHash<int, QString> languages; 
    
    QTranslator translator;
    QString path = "c:";
    path += QString(TRANSLATOR_PATH);
    if (!translator.load(path)) {
        path = "z:";
        path += QString(TRANSLATOR_PATH);
        if (!translator.load(path)) {
            return languages;
        } 
    } 

    QCoreApplication::installTranslator(&translator);
    QHash<int, QString> hashLanguageNames = readLanguageList();
 
    CArrayFixFlat<TInt>* systemEpocLanguageCodes = 0;
    TInt error = SysLangUtil::GetInstalledLanguages( systemEpocLanguageCodes );
    if ( error != KErrNone ) {
        delete systemEpocLanguageCodes;
        return languages;
    }
    
    for (int i = 0; i < systemEpocLanguageCodes->Count(); ++i) {
        int code = systemEpocLanguageCodes->At(i);
        QString id = QString(LANGUAGE_ID_PREFIX);
        id += QString::number(code);
        QString locName = hbTrId(id.toAscii().constData());
        if (locName.isEmpty() || locName == id) {
            locName = hashLanguageNames.value(code);
        }
        languages.insert(code, locName);
    }
    
    delete systemEpocLanguageCodes;
    return languages;
#else 
    QHash<int, QString> dummy;
    return dummy;
#endif
}
Exemple #18
0
CArrayFix<TCoeHelpContext>* CHelloS60AppUi::HelpContextL() const
{
#warning "Please see comment about help and UID3..."
    // Note: Help will not work if the application uid3 is not in the
    // protected range.  The default uid3 range for projects created
    // from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
    // can be self signed and installed on the device during testing.
    // Once you get your official uid3 from Symbian Ltd. and find/replace
    // all occurrences of uid3 in your project, the context help will
    // work. Alternatively, a patch now exists for the versions of
    // HTML help compiler in SDKs and can be found here along with an FAQ:
    // http://www3.symbian.com/faq.nsf/AllByDate/E9DF3257FD565A658025733900805EA2?OpenDocument
    CArrayFixFlat<TCoeHelpContext>* array = new (ELeave) CArrayFixFlat<
    TCoeHelpContext> (1);
    CleanupStack::PushL(array);
    array->AppendL(TCoeHelpContext(KUidHelloS60App, KGeneral_Information));
    CleanupStack::Pop(array);
    return array;
}
/**
Searches the scheduler for an existing conditions schedule item with a set of 
pending conditions and timeout value that matches with those supplied.

@see RScheduler::GetScheduleL

@param aScheduler
Handle to the scheduler.

@param aConditions
The set of System Agent conditions that are required to be met to trigger the
schedule.

@param aTimeout
The timeout value for the schedule.

@param aRef
On return, the schedule item.

@leave KErrNotFound
No schedule found matching the schedule conditions and timeout.
*/
EXPORT_C void CMsvScheduleSend::FindScheduleL(
								RScheduler&										aScheduler, 
								const CArrayFixFlat<TTaskSchedulerCondition>&	aConditions, 
								const TTime&									aTimeout, 
								TSchedulerItemRef& 								aRef)
	{
	CArrayFixFlat<TTaskSchedulerCondition>* schConditions = new (ELeave) CArrayFixFlat<TTaskSchedulerCondition>(KMsvSchsendArrayGrowth);
	CleanupStack::PushL(schConditions);

	CArrayFixFlat<TTaskInfo>* taskInfos = new (ELeave) CArrayFixFlat<TTaskInfo>(1);
	CleanupStack::PushL(taskInfos);

	aRef.iHandle = KErrNotFound;

	CArrayFixFlat<TSchedulerItemRef>* refs = new (ELeave) CArrayFixFlat<TSchedulerItemRef>(KMsvSchsendArrayGrowth);
	CleanupStack::PushL(refs);
	
	User::LeaveIfError(aScheduler.GetTaskRefsL(*refs, EAllSchedules, EMyTasks));

	TInt count = refs->Count();
	TScheduleState2 state;
	TTsTime nextTimeout;
	
	while( count-- && aRef.iHandle == KErrNotFound )
		{
		const TSchedulerItemRef& tempRef = (*refs)[count];

		TScheduleType type;
		User::LeaveIfError(aScheduler.GetScheduleTypeL(tempRef.iHandle, type));
		if( type == EConditionSchedule )
			{
			taskInfos->Reset();
			const TInt err = aScheduler.GetScheduleL(tempRef.iHandle, state, *schConditions, nextTimeout, *taskInfos);
			if( err == KErrNone && nextTimeout.GetUtcTime() == aTimeout && *schConditions == aConditions )
				aRef = tempRef;
			}
		}

	CleanupStack::PopAndDestroy(3, schConditions);
	if (aRef.iHandle == KErrNotFound)
		User::Leave(KErrNotFound);
	}	
// -----------------------------------------------------------------------------
// CTestSDKMiscControls::TestCGGetColorUseListL
// -----------------------------------------------------------------------------
//
TInt CTestSDKMiscControls::TestCGGetColorUseListL( CStifItemParser& /*aItem*/ )
    {

    // Print to UI
    _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" );
    _LIT( KTestCGGetColorUseListL, "In TestCGGetColorUseListL" );
    TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGGetColorUseListL );
    // Print to log file
    iLog->Log( KTestCGGetColorUseListL );
    CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) 
            CArrayFixFlat<TCoeColorUse>( 4 );
    CleanupStack::PushL( colorUseList );
    TBool err = KErrNone;
    TRAP( err, iControlGroup->GetColorUseListL( *colorUseList ) );
    colorUseList->Reset();
    CleanupStack::PopAndDestroy( colorUseList );

    return err;

    }
CArrayFixFlat<TPtrC>* CKeytoolFileView::ReadArrayArgumentsLC(TInt cmdIndex)
	{
	CArrayFixFlat<TPtrC>* currentCmd = new (ELeave) CArrayFixFlat<TPtrC> (10);
	CleanupStack::PushL(currentCmd);
	TPtr cmd = iArgs[cmdIndex]->Des();
	cmd.Trim();
	TLex arguments(cmd);
	while(!arguments.Eos())
    	{
        TPtrC token = arguments.NextToken();
        currentCmd->AppendL(token);
        }
    
    TBuf<150> string;
	string.Format(_L("Command :  %S\noutput :"), &cmd);
	KeyToolUtils::PrintInfoL(_L("================================================"));
	KeyToolUtils::PrintInfoL(_L("================================================\n"));
    DisplayErrorL(string, 0);
    return currentCmd;
	}
//Puts the existing settings and some new settings in the list of settings
//Now both will be deleted on exit.
void CPigeonScheduledSend::PopulateSettingsL()
{
    delete iSettings;
    iSettings = NULL;

    //Make some shiny new settings instead
    iSettings = CMsvScheduleSettings::NewL();
    iSettings->SetShortInterval(KShortInterval);
    iSettings->SetLongInterval(KLongInterval);

    CArrayFixFlat<TTimeIntervalSeconds>* intervals = new(ELeave)CArrayFixFlat<TTimeIntervalSeconds>(20);
    CleanupStack::PushL(intervals);
    intervals->AppendL(KFirstInterval);
    intervals->AppendL(KSecondInterval);
    intervals->AppendL(KThirdInterval);

    iSettings->SetVariableIntervalsL(*intervals);  // copies intervals

    CleanupStack::PopAndDestroy();  //intervals
//	iSettingsList->AppendL(custom);
}
void CContextMediaArrayImpl::ReleasePosts()
{
	if (iPostArray) {
		int i;
		for (i=0;i<iPostArray->Count();i++) {
			CCMPost * aPost = (*iPostArray)[i];
			if (aPost) {
				CC_TRAPD(err, iStorage.Release( aPost, 0 ));
			}
		}
	}
}
/*!
 * Store contact
 */
CArrayFixFlat<TUid>* CNsmlContactsDataStoreExtensionPrivate::ImportContactsL( const TDesC8 &contactbufbase )
{
    _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: BEGIN");    

    DBG_DUMP((void*)contactbufbase.Ptr(), contactbufbase.Length(),
        _S8("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: To DB :"));      
    
    TBool ret( ETrue );
    CArrayFixFlat<TUid>* contactItems = new(ELeave) CArrayFixFlat<TUid>(4);
    QBuffer contactsbuf;
    contactsbuf.open(QBuffer::ReadWrite);
    QByteArray bytearray((char*)contactbufbase.Ptr());
    
    contactsbuf.write(bytearray);
    contactsbuf.seek(0);
    
    mReader->setDevice(&contactsbuf);
    if (mReader->startReading() && mReader->waitForFinished()) 
        {
        DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Buffer Count: %d"), mReader->results().count() );
        
        QList<QContact> contacts;
        if ( mImporter->importDocuments( mReader->results() ) )
            {
            contacts = mImporter->contacts();
            QMap<int, QContactManager::Error> errorMap;
            ret = mContactManager->saveContacts( &contacts, &errorMap );           
            DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Import Status: %d"), ret );
            }
        if( ret )
            {
            foreach (QContact contact, contacts ) 
                {
                TUint contactid = contact.id().localId();
                
                DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Contact ID: %d"), contactid );
                
                contactItems->AppendL( TUid::Uid( contactid ) );
                }
            }
void CMsvScheduleSend::PopulateScheduleConditionsL(CArrayFixFlat<TTaskSchedulerCondition>& aSchConditions)
	{
	aSchConditions.Reset();

	TInt count = iAgentActions->Count();
	TTaskSchedulerCondition condition;
	
	// All system agent condition have a UID of KUidSystemCategory.
	condition.iCategory = KUidSystemCategory;
	
	for( TInt i = 0; i < count; ++i )
		{

		TMsvCondition agentCondition = iAgentActions->At(i).iCondition;

		condition.iKey	 = agentCondition.iVariable.iUid;
		condition.iState = agentCondition.iState;
		
		switch( agentCondition.iType )
			{
		case TMsvCondition::EMsvSchSendEquals:
			condition.iType = TTaskSchedulerCondition::EEquals;
			break;
		case TMsvCondition::EMsvSchSendNotEquals:
			condition.iType = TTaskSchedulerCondition::ENotEquals;
			break;
		case TMsvCondition::EMsvSchSendGreaterThan:
			condition.iType = TTaskSchedulerCondition::EGreaterThan;
			break;
		case TMsvCondition::EMsvSchSendLessThan:
			condition.iType = TTaskSchedulerCondition::ELessThan;
			break;
		default:
			User::Invariant();
			break;
			}
			
		aSchConditions.AppendL(condition);
		}
	}
/**
Creates a new schedule on the task scheduler with which each message can be 
associated. 

The schedule is triggered by a start time being reached.

@see RScheduler::CreatePersistentSchedule

@param aScheduler
Handle to scheduler to update.

@param aSettings
Scheduler settings.

@param aStartTime
Schedule start time.

@param aValidityPeriod
Schedule validity period.

@param aRef 
On return, the new schedule.
*/
EXPORT_C void CMsvScheduleSend::CreateScheduleL(RScheduler& aScheduler, const CMsvScheduleSettings& aSettings, const TTime& aStartTime, const TTimeIntervalMinutes& aValidityPeriod, TSchedulerItemRef& aRef)
	{
	//Determine the new schedule entry	
	TScheduleEntryInfo2 taskInfo;
	taskInfo.SetIntervalType(aSettings.IntervalType());
	taskInfo.SetInterval(1);
	TTsTime startTime(aStartTime,ETrue);
	taskInfo.SetStartTime(startTime);
	taskInfo.SetValidityPeriod(aValidityPeriod);
	
	//Create the TScheduleEntryInfo arrag that is required by CreatePersistentSchedule
	CArrayFixFlat<TScheduleEntryInfo2>* entryInfos = new (ELeave) CArrayFixFlat<TScheduleEntryInfo2>(1);
	CleanupStack::PushL(entryInfos);

	//Append the new schedule entry
	entryInfos->AppendL(taskInfo);

	//Create the schedule
	User::LeaveIfError(aScheduler.CreatePersistentSchedule(aRef, *entryInfos));

	CleanupStack::PopAndDestroy(entryInfos);
	}
Exemple #27
0
/**
Provides conversion between view indexes and contact IDs.

@param aMessage.Int0() Buffer size (from client).
@param aMessage.Ptr1() Descriptor containing indices (from client).
@param aMessage.Ptr2() Descriptor containing contact IDs (to client).
*/
void CViewSubSessionBase::GetContactIdsL(const RMessage2& aMessage)
	{
	TPckgBuf<TInt> size;
	aMessage.ReadL(0,size);
	const TInt bufferSize = size();
	
	CBufFlat* buffer = CBufFlat::NewL(bufferSize);
	CleanupStack::PushL(buffer);
	buffer->ExpandL(0,bufferSize);
	TPtr8 des(buffer->Ptr(0));
	aMessage.ReadL(1,des);

	RBufReadStream readStream(*buffer);
	CleanupClosePushL(readStream);
	const TInt count = readStream.ReadUint32L(); 

	CArrayFixFlat<TInt>* indexes = new(ELeave) CArrayFixFlat<TInt>(8);	
	CleanupStack::PushL(indexes);

	for (TInt i=0; i<count; ++i)
		{
		TInt index = readStream.ReadUint32L();
		indexes->AppendL(index);
		}

	CContactIdArray* array = CContactIdArray::NewLC();
	iView->GetContactIdsL(*indexes, *array);

	HBufC8* buf=HBufC8::NewLC(bufferSize);
	TPtr8 bufPtr(buf->Des());
	RDesWriteStream writeStream(bufPtr);
	CleanupClosePushL(writeStream);
	writeStream << *array;
	bufPtr.SetLength(bufferSize);
	aMessage.WriteL(2,*buf);

	CleanupStack::PopAndDestroy(6, buffer); // &writeStream, buf, array, indexes, &readStream, buffer
	}
void CIpsecTest4_1::TestOomPolicyListL()
/**
 * OOM helper function - implements normal usage of PolicyListL method
 */
{
    TInt ret;
    TIPSecPolicy pol;

    CIPSecAPI* api = CIPSecAPI::NewL();
    CleanupStack::PushL(api);

    CArrayFixFlat<TIPSecPolicy>* list = new (ELeave) CArrayFixFlat<TIPSecPolicy>(5);
    CleanupStack::PushL(list);

    list->AppendL(pol);
    ret = api->PolicyListL(*list);
    (void)ret; // to remove compiler warning

    TEST(api!=NULL);

    CleanupStack::PopAndDestroy(list);
    CleanupStack::PopAndDestroy(api);
}
LOCAL_C TBool operator==(const CArrayFixFlat<TTaskSchedulerCondition>& aConditions1, const CArrayFixFlat<TTaskSchedulerCondition>& aConditions2)
	{
	TInt count1 = aConditions1.Count();
	TInt count2 = aConditions2.Count();
	
	// Compare the conditions.	
	if( count1 != count2 )
		{
		// Different number of conditions - no match.
		return EFalse;
		}
		
	// Search for all the conditions in info1 are in info2
	for( TInt ii = 0; ii < count1; ++ii )
		{
		TTaskSchedulerCondition condition1 = aConditions1[ii];
		TTaskSchedulerCondition condition2;
		TBool found = EFalse;
		TInt jj = 0;
		while( !found && jj < count2 )
			{
			condition2 = aConditions2[jj];
			
			if( condition2.iKey == condition1.iKey )
				found = ETrue;
			else
				++jj;
			}
		if( !found || condition2.iState != condition1.iState || condition2.iType != condition1.iType )
			{
			// Either aConditions2 has not got this condition or it has but it 
			// does not match - no match.
			return EFalse;
			}
		}
	return ETrue;
	}
/**
This method should only be used by CImapAtomParser.
During parsing, a ReAllocL() may be required on the heap buffer that this atom and its 
descendants' string data descriptor points at.
This happens when the heap buffer needs to be expanded.
If this causes the heap buffer's address to change, then this atom and its descendants' 
pointer descriptors need updating.
@param The address of the new heap buffer
@param The address of the data within the heap buffer before the ReAllocL took place.
*/
void CImapAtom::FixupL(const HBufC8 *aNewBuffer, const TText8 *aOldBuffer)
	{
   // Fixup descriptor pointers
	CArrayFixFlat<CImapAtom*>* atomStack = new (ELeave) CArrayFixFlat<CImapAtom*>(10);
	CleanupStack::PushL(atomStack);

	atomStack->AppendL(this);
	CImapAtom* currentAtom;
	while (atomStack->Count() != 0)
   		{
		// Pop the top atom off of the stack
		currentAtom = (*atomStack)[atomStack->Count() - 1];
 		atomStack->ResizeL(atomStack->Count() - 1);
 
		// Fix up the current atom
		if (currentAtom->iAtom.Length()>0)
			{
			// Find offset from start of old buffer
			TInt start=(currentAtom->iAtom.Ptr()-aOldBuffer);

 			// Make new descriptor & assign it
			TPtrC8 bufptr(aNewBuffer->Ptr()+start,currentAtom->iAtom.Length());
			currentAtom->iAtom.Set(bufptr); // Note that we are setting the real iAtom not the copy returned by Atom()
			}
 
		// Add the first sibling to the stack,
		// subsequent siblings are added when this sibling is visited
		CImapAtom* siblingAtom = currentAtom->Next();
		if (siblingAtom)
			{
			atomStack->AppendL(siblingAtom);
			}
   
		// Add child to the stack
		CImapAtom* childAtom = currentAtom->Child();
		if (childAtom)
			{
			atomStack->AppendL(childAtom);
			}			
   		}
   
	CleanupStack::PopAndDestroy(atomStack);
   	}