コード例 #1
0
// ===========================================================================
// USAGE SCENARIO:
//
// ===========================================================================
//
void T_RootServices::Test_ListProtocolsAndTheirCapabilities_L()
    {
    //Initialize XIMP client
    MXIMPClient* presClient = MXIMPClient::NewClientL();
    CleanupDeletePushL( presClient );

    RXIMPObjOwningPtrArray< MXIMPProtocolInfo > protocolList;
    CleanupClosePushL( protocolList );

    //List & dump all available protocols
    presClient->GetProtocolsL( protocolList );
    __DumpProtocolListL( protocolList );

    //Verify that atleast main test protocol exist in list
    //And for it is reported corect properties
    TBool mainTestProtocolFound( EFalse );
    for ( TInt index( 0 ); index < protocolList.Count(); index++ )
        {
        MXIMPProtocolInfo& protocol = *protocolList[ index ];
        if (protocol.DisplayName() == K_PRFW_TST_PROTOCOL_1_DISPLAY_NAME )
            {
            if ( protocol.ImplementationUid() == TUid::Uid( K_PRFW_TST_PROTOCOL_1_IMPLEMENTATION_UID ) ) 
                {
                mainTestProtocolFound = ETrue;
                break;
                }
            }
        }

    EUNIT_ASSERT_DESC( mainTestProtocolFound, "Primary test protocol not found." );

    CleanupStack::PopAndDestroy(); //protocolList
    CleanupStack::PopAndDestroy(); //presClient
    }
コード例 #2
0
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertExceptionDatesL
// Inserts exceptiondates to a parser.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertExceptionDatesL(const CArrayFix<
        TPIMDate>& aDates, CParserVCalEntity& aParser)
{
    JELOG2(EPim);
    TInt exDateCount = aDates.Count();
    if (exDateCount > 0)
    {
        CArrayPtrFlat<TVersitDateTime>* versitExDates =
            new(ELeave) CArrayPtrFlat<TVersitDateTime> (exDateCount);
        CleanupStack::PushL(versitExDates);
        CleanupResetAndDestroyPushL(*versitExDates);
        for (TInt i = 0; i < exDateCount; i++)
        {
            TVersitDateTime
            * versitDateTime =
                new(ELeave) TVersitDateTime(aDates.At(i).DateTime(), TVersitDateTime::EIsUTC);
            CleanupDeletePushL(versitDateTime);
            versitExDates->AppendL(versitDateTime);
            CleanupStack::Pop(versitDateTime); // versitDateTime
        }
        CParserPropertyValue* propertyValue =
            new(ELeave) CParserPropertyValueMultiDateTime(versitExDates);
        CleanupStack::Pop(2); // versitExDates is now owned by propertyValue
        AddPropertyToParserL(propertyValue, KVersitTokenEXDATE(), aParser);
        // Needed cleanup stack items are popped out in the AddPropretyToParserL
    }
}
コード例 #3
0
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertRepeatRuleL
// Inserts a repeat rule to a parser.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertRepeatRuleL(
    const MPIMRepeatRuleData* aRepeat, CParserVCalEntity& aParser)
{
    JELOG2(EPim);
    // First exception dates
    const CArrayFix<TPIMDate>& exceptionDates = aRepeat->GetExceptDatesL();
    ConvertExceptionDatesL(exceptionDates, aParser);

    // The interval is always set to 1 - only exception is every 2 weeks repeat
    TInt interval = 1;
    TInt frequency = 0;
    TVersitDateTime* versitEndDate = NULL;

    GetRepeatRuleFieldsL(aRepeat, &interval, &frequency, &versitEndDate);
    if (versitEndDate)
    {
        CleanupDeletePushL(versitEndDate);
    }

    CVersitRecurrence* recurrence = CreateRecurrenceL(frequency, interval,
                                    versitEndDate);

    if (versitEndDate)
    {
        CleanupStack::Pop(versitEndDate); // versitEndDate is owned by recurrence now
    }
    CleanupStack::PushL(recurrence);

    CParserPropertyValue* propertyValue =
        new(ELeave) CParserPropertyValueRecurrence(recurrence);
    // recurrence is now owned by propertyValue
    CleanupStack::Pop(recurrence);
    AddPropertyToParserL(propertyValue, KVersitTokenRRULE(), aParser);
    // Needed cleanup stack items are popped out in the AddPropretyToParserL
}
コード例 #4
0
MNcdParser* NcdParserFactory::CreateParserLC(
    MNcdProtocolDefaultObserver* aDefaultObserver )
{
    MNcdParser* p = CNcdParserImpl::NewL( aDefaultObserver );
    CleanupDeletePushL( p );
    return p;
}
コード例 #5
0
void CNcdProtocolDefaultObserver::ClientConfigurationL( 
    MNcdConfigurationProtocolClientConfiguration* aConfiguration ) 
    {
    DLTRACEIN((""));
    CleanupDeletePushL( aConfiguration );

    // Should interpret details to grab master server validity information, 
    // for example

    // pass cookies to cookie handler
    TInt cookieCount = aConfiguration->CookieCount();
    DLINFO(("cookie count=%d",cookieCount));
    
    // Get SSID
    const TDesC8& ssid( iConfigurationManager.SsidL( iContext ) );
    
    MNcdServerDetails& details( 
        iConfigurationManager.ServerDetailsL( iContext, 
        *iServerUri,
        NcdProviderDefines::KConfigNamespace ));

    
    for ( TInt i = 0; i < cookieCount; ++i ) 
        {
        const MNcdConfigurationProtocolCookie& cookie( 
            aConfiguration->CookieL( i ) );
        details.AddCookieL( cookie, ssid );
        }

    CleanupStack::PopAndDestroy( aConfiguration );
    DLTRACEOUT((""));
    }
コード例 #6
0
void CNcdProtocolDefaultObserver::ConfigurationServerDetailsL( 
    MNcdConfigurationProtocolServerDetails* aServerDetails )
    {
    DLTRACEIN((""));
    DASSERT( aServerDetails );
    DASSERT( iServerUri );
    DLINFO(("Server supports %d capabilities", 
        aServerDetails->CapabilityCount() ));
    
    CleanupDeletePushL( aServerDetails );
    
    if ( aServerDetails->CapabilityCount() )
        {
        DLTRACE(("Adding capabilities to server details"));
        MNcdServerDetails& details( 
            iConfigurationManager.ServerDetailsL( iContext, 
                *iServerUri,
                NcdProviderDefines::KConfigNamespace ));
        
        // Clear old caps so that we don't just keep on adding them.
        // AddCapabilityL does NOT check for duplicates
        details.ClearCapabilitiesL();

        for ( TInt i = 0; i < aServerDetails->CapabilityCount(); ++i )
            {
            details.AddCapabilityL( aServerDetails->CapabilityL( i ) );
            }
        iConfigurationManager.SaveConfigurationToDbL( iContext );
        }
    CleanupStack::PopAndDestroy( aServerDetails );
    }
コード例 #7
0
// ---------------------------------------------------------------------------
// Create device service.
// ---------------------------------------------------------------------------
//
EXPORT_C MNcdDeviceService*
    NcdDeviceInteractionFactory::CreateDeviceServiceLC()
    {
    MNcdDeviceService* deviceService = CNcdDeviceService::NewL();
    CleanupDeletePushL( deviceService );
    return deviceService;
    }
コード例 #8
0
EXPORT_C MPresenceBuddyInfo2* MPresenceBuddyInfo2::NewLC( )
    {
    CPresenceCacheBuddyInfo* info = CPresenceCacheBuddyInfo::NewLC( );
    CleanupStack::Pop(info);
    MPresenceBuddyInfo2* minfo = info;  
    CleanupDeletePushL(minfo);
    return minfo; 
    }
コード例 #9
0
HBufC8* CHttpController::HeaderNameLC( TInt aId )
	{
	RStringF string = iSession.StringPool().StringF( aId, RHTTPSession::GetTable() );
	CleanupClosePushL( string );
	HBufC8* buffer = string.DesC().AllocL();
	CleanupStack::PopAndDestroy( &string );
	CleanupDeletePushL( buffer );
	return buffer;
	}
コード例 #10
0
// ----------------------------------------------------------------------------
// Find from a store succeeded
// ----------------------------------------------------------------------------
void CContactMatcher::FindFromStoreSucceededL( MVPbkContactStore& /*aStore*/,
        MVPbkContactLinkArray* aResultsFromStore )
    {
    __ASSERT_DEBUG( aResultsFromStore, ContactMatcherPanics::Panic(
        ContactMatcherPanics::EPanNullPointer ));

    // Take the ownership of the result immediately
    CleanupDeletePushL( aResultsFromStore );

    CopyFindResultsL( aResultsFromStore );

    CleanupStack::PopAndDestroy(); // aResultsFromStore
    }
コード例 #11
0
void CNcdProtocolDefaultObserver::InformationL( 
    MNcdPreminetProtocolInformation* aData )
    {
    DLTRACEIN(( _L("Namespace: %S"), &aData->Namespace() ));
    CleanupDeletePushL( aData );
    

    TInt cookieCount = aData->CookieCount();
    DLINFO(("cookie count=%d",cookieCount));

    MNcdServerDetails& details( 
        iConfigurationManager.ServerDetailsL( iContext, *iServerUri,
            aData->Namespace() ));


    // Get SSID
    const TDesC8& ssid( iConfigurationManager.SsidL( iContext ) );
    
    for ( TInt i = 0; i < cookieCount; ++i ) 
        {
        const MNcdConfigurationProtocolCookie& cookie( aData->CookieL( i ) );
        details.AddCookieL( cookie, ssid );
        }
    
    
    // Handle server capabilities
    DLTRACE(("Handle server capabilities"));
    const MNcdConfigurationProtocolServerDetails* serverDetails = 
        aData->ServerDetails();
    
    DLTRACE(("ServerDetails-ptr: %x", serverDetails ));
        
    if ( serverDetails && serverDetails->CapabilityCount() )
        {
        // Clear old caps so that we don't just keep on adding them.
        // AddCapabilityL does NOT check for duplicates
        details.ClearCapabilitiesL();

        DLINFO(("Capabilities: %d", serverDetails->CapabilityCount() ));
        DLTRACE(("Adding capabilities to server details"));
        
        for ( TInt i = 0; i < serverDetails->CapabilityCount(); ++i )
            {
            details.AddCapabilityL( serverDetails->CapabilityL( i ) );
            }
        
        }
    iConfigurationManager.SaveConfigurationToDbL( iContext );
    CleanupStack::PopAndDestroy( aData );
    DLTRACEOUT(("Protocol information handled"));
    }
コード例 #12
0
// -----------------------------------------------------------------------------
// CXIMPSrvSessionAdapter::ServiceL()
// -----------------------------------------------------------------------------
//
EXPORT_C void CXIMPSrvSessionAdapter::ServiceL( const RMessage2& aMessage )
    {
    __ASSERT_ALWAYS( !iCurrentMsg,
                     User::Panic( NXIMPPrivPanic::KCategory,
                                  NXIMPPrivPanic::ECurrentMsgAlreadyExists ) );

    //Non leaving allocation must be used here to prevent OOM leave
    //to ServiceError() method, without a valid iCurrentMsg
    //==> CurrentMsg absence triggers an assert in ServiceError()
    iCurrentMsg = CXIMPSrvMessageImp::NewOrNull( aMessage,
                                                 ( MXIMPSrvMessage*& )iCurrentMsg, 
                                                 iMessage );
    iMessage = NULL;

    //Handle the message
    MXIMPSrvSession* sessionImp = DoInstantiateSessionL( *iCurrentMsg );
    
    if( sessionImp )
        {
        CleanupDeletePushL( sessionImp );

        __ASSERT_ALWAYS( !iSessionImp,
                         iCurrentMsg->PanicClientAndLeaveL(
                         NXIMPPanic::EOnSrvSessionImpAlreadyExists ) );

        iSessionImp = sessionImp;
        CleanupStack::Pop(); //sessionImp;
        iCurrentMsg->Complete( KErrNone );
        }

    else
        {                
        __ASSERT_ALWAYS( iSessionImp,
                         iCurrentMsg->PanicClientAndLeaveL(
                         NXIMPPanic::EOnSrvSessionImpNotFound ) );


        iSessionImp->TryHandleMessageL( *iCurrentMsg );


        //If current message is still not-completed, inform client
        //that it tried to do something unknown
        __ASSERT_ALWAYS( !IsCurrentMessageValid(),
                         iCurrentMsg->PanicClientAndLeaveL(
                         NXIMPPanic::EOnSrvRequestNotUnderstood) );
        }

    iMessage = iCurrentMsg;
    iCurrentMsg = NULL;
    }
コード例 #13
0
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertDateFieldL
// Converts a date field from a PIM Event Item to a CParserVCard.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertDateFieldL(const CPIMItem& aItem, // item to convert from
        CParserVCalEntity& aParser, // parser to insert the property to.
        TPIMEventField aField, // field to convert
        TInt aIndex) // index to the field
{
    JELOG2(EPim);
    const TPIMDate date = aItem.GetDateL(aField, aIndex);
    TDateTime dateTime = date.DateTime();
    TVersitDateTime* versitDateTime =
        new(ELeave) TVersitDateTime(dateTime, TVersitDateTime::EIsUTC);
    CleanupDeletePushL(versitDateTime);

    CParserPropertyValue* propertyValue =
        new(ELeave) CParserPropertyValueDateTime(versitDateTime);
    // versitDateTime is now owned by propertyValue
    CleanupStack::Pop(versitDateTime);

    switch (aField)
    {
    case EPIMEventStart:
    {
        AddPropertyToParserL(propertyValue, KVersitTokenDTSTART(), aParser);
        // Needed cleanup stack items are popped
        // out in the AddPropretyToParserL
        break;
    }
    case EPIMEventEnd:
    {
        AddPropertyToParserL(propertyValue, KVersitTokenDTEND(), aParser);
        // Needed cleanup stack items are popped
        // out in the AddPropretyToParserL
        break;
    }
    case EPIMEventRevision:
    {
        AddPropertyToParserL(propertyValue, KVersitTokenLASTMODIFIED(), aParser);
        // Needed cleanup stack items are popped
        // out in the AddPropretyToParserL
        break;
    }
    default:
    {
        __ASSERT_DEBUG(EFalse, User::Panic(KPIMPanicCategory,
                                           EPIMPanicUnsupportedDateField));
    }
    }
}
コード例 #14
0
/** 
Second stage constructor 

Outgoing messages: constructs the data encapsulation and control objects.
Incoming message: no action
*/
void CSuplMessageBase::ConstructL()
	{
	if (iIsOutgoingMessage)
		{
		iData    = new (ELeave) ASN1T_ULP_PDU();
		ASN1Context* context = new (ELeave) ASN1Context;
		CleanupDeletePushL(context);
		iControl = new (ELeave) ASN1C_ULP_PDU(*context, *iData);
		// construction of iControl successful, pop context off the cleanup stack
		CleanupStack::Pop(context);

		// set the version parameter of the outgoing message
		iData->version.maj = 1;
		iData->version.min = 0;
		iData->version.servind = 0;
		}
	}
コード例 #15
0
void CTDirectScreenBitmap::TestRefreshingTimeL()
	{
	// As other display modes have been tested in other test cases
	// Only EColor16MAP is tested here
	CFbsDrawDevice *pDev = NULL;	
	TDisplayMode aDisplayMode = EColor16MAP;
	iDispMode = aDisplayMode;
			
	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
	if (err)
		{
		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
		}
	else
		{
		INFO_PRINTF2(_L("Testing Continuous Refreshing for display mode %i"),iDispMode);
		CleanupDeletePushL(pDev);
		User::LeaveIfError(pDev->InitScreen());
		TSize screenSize = pDev->SizeInPixels();
		TRect directRect;

		// Quarter screen ENone
		INFO_PRINTF1(_L("Consecutively update frames at left bottom corner and setting ENone"));
		directRect = TRect(TPoint(0, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
		    User::LeaveIfError(HAL::Get(HALData::EFastCounterFrequency, iFreq));

			MeasureFrame(directRect);
			
			INFO_PRINTF2(_L("The total time to render 200 frames is %f"),iMeasure);

			}
		CleanupStack::PopAndDestroy(pDev);

		}
	}
コード例 #16
0
void CPolicyImporter::StateCreateVpnDestinationL()
    {
    LOG_("-> CPolicyImporter::StateCreateVpnDestinationL()");
    SetCurrState(EStateCreateVpnDestination);

        //Gets the IAP name from policy name
    TVpnPolicyInfo* policyInfo = new (ELeave) TVpnPolicyInfo;
    CleanupDeletePushL(policyInfo);

    User::LeaveIfError(iPolicyStore.GetPolicyInfo(*iNewPolicyId, *policyInfo));

    CmManagerUtils::CreateVPNConnectionMethodToIntranetL(*policyInfo,
                                                         *(iVpnApiServant.iEventLogger));

    CleanupStack::PopAndDestroy(); //policyInfo
    GotoState(EStateEndPolicyImport);

    LOG_("<- CPolicyImporter::StateCreateVpnDestinationL()");
    }
コード例 #17
0
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::AddDefaultValueTimeL
// Adds default value for time property.
// This is useful only if data type is time.
// -----------------------------------------------------------------------------
EXPORT_C void CSyncMLFilterProperty::AddDefaultValueTimeL(
                const TTime& aNewDefaultValue, const TBool aSelected )
	{
	if ( iDataTypeForDefaultValues != ESyncMLDataTypeTime )
		{
		User::Leave( KErrNotSupported );
		}
	
	TDateTime time( aNewDefaultValue.DateTime() );
	time.SetDay(0);
	time.SetMonth(EJanuary);
	time.SetYear(0);

	TTime* temp = new (ELeave) TTime( time );
	CleanupDeletePushL( temp );
	iDefaultValueDateOrTimeList.AppendL( temp );
	CleanupStack::Pop(); // temp
	iDefaultValueSelected.AppendL( aSelected );
	}
コード例 #18
0
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::AddDefaultValueDateL
// Adds default value for date property.
// This is useful only if data type is date.
// -----------------------------------------------------------------------------
EXPORT_C void CSyncMLFilterProperty::AddDefaultValueDateL(
                const TTime& aNewDefaultValue, const TBool aSelected )
	{
	if ( iDataTypeForDefaultValues != ESyncMLDataTypeDate )
		{
		User::Leave( KErrNotSupported );
		}
		
	TDateTime date( aNewDefaultValue.DateTime() );
	date.SetHour(0);
	date.SetMinute(0);
	date.SetSecond(0);
	date.SetMicroSecond(0);
		
	TTime* temp = new (ELeave) TTime( date );
	CleanupDeletePushL( temp );
	iDefaultValueDateOrTimeList.AppendL( temp );
	CleanupStack::Pop(); // temp
	iDefaultValueSelected.AppendL( aSelected );
	}
コード例 #19
0
// ----------------------------------------------------------------------------
// Called when find is complete. Callee takes ownership of the results.
// In case of an error during find, the aResults may contain only
// partial results of the find.
//
// @param aResults Array of contact links that matched the find.
// ----------------------------------------------------------------------------
void CContactMatcher::FindCompleteL( MVPbkContactLinkArray* aResults )
    {
    __ASSERT_DEBUG( aResults, ContactMatcherPanics::Panic(
        ContactMatcherPanics::EPanNullPointer ));

    // Take the ownership of the result immediately
    CleanupDeletePushL( aResults );

    CopyFindResultsL( aResults );

    CleanupStack::PopAndDestroy(); // aResults

    if (!iResultContactLinkArray)
        {
        // No need to copy links. Only interested whether found or not
        OperationComplete( iResultContactLinkCnt ? KErrNone:KErrNotFound );
        }
    else
        {
        OperationComplete();
        iResultContactLinkArray = NULL;
        }
    }
コード例 #20
0
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertAlarmFieldL
// Converts an alarm field from a PIM Event Item to a CParserVCard.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertAlarmFieldL(const CPIMItem& aItem, // item to convert from
        CParserVCalEntity& aParser, // parser to insert the property to.
        TPIMEventField aField, // field to convert
        TInt aIndex) // index to the field
{
    JELOG2(EPim);
    const TInt KAlarmInterval = aItem.getInt(aField, aIndex);
    const TTimeIntervalSeconds KTimeInterval(KAlarmInterval);

    // Check that there exists start date. If item is not written to
    // database there might not be start date present
    if (aItem.CountValuesL(EPIMEventStart) == 0)
    {
        return;
    }

    // Start date present, so conversion can be made
    const TPIMDate KStartDate = aItem.GetDateL(EPIMEventStart, 0);
    TTime alarmTime(KStartDate);
    alarmTime -= KTimeInterval;
    TDateTime dateTime = alarmTime.DateTime();
    TVersitDateTime* versitDateTime =
        new(ELeave) TVersitDateTime(dateTime, TVersitDateTime::EIsUTC);
    CleanupDeletePushL(versitDateTime);

    CVersitAlarm* versitAlarm = CVersitAlarm::NewL(versitDateTime, NULL, 0,
                                KNullDesC, KNullDesC);
    // versitDateTime is now owned by versitAlarm
    CleanupStack::Pop(versitDateTime);
    CleanupStack::PushL(versitAlarm);
    CParserPropertyValue* propertyValue =
        new(ELeave) CParserPropertyValueAlarm(versitAlarm);
    // versitAlarm is now owned by propertyValue
    CleanupStack::Pop(versitAlarm);
    AddPropertyToParserL(propertyValue, KVersitTokenDALARM(), aParser);
    // Needed cleanup stack items are popped out in the AddPropretyToParserL
}
コード例 #21
0
void CIkeV2PkiService::ImportNextCaElemFromIkeDataListL()
    {        
    __ASSERT_DEBUG(iIkeDataCAList != NULL, User::Invariant());
    __ASSERT_DEBUG(iIkeDataCAList->Count() > 0, User::Invariant());
    
    const TCertInfo certInfo = (*iIkeDataCAList)[0];        
    switch(certInfo.iFormat)
        {            
        case CA_NAME:    
            delete iSubjName;
            iSubjName = NULL;
            iSubjName = HBufC8::NewL(certInfo.iData.Length());
            iSubjName->Des().Copy(certInfo.iData);                    
        	iPkiService.ReadCertificateL(KEmptyString,
                                         *iSubjName, KEmptyString,
		                                 EPKICACertificate, 0,
		                                 EPKIRSA, iCertPtr,
		                                 &iResArray, iStatus);
            SET_ACTIVE;  
            break;                  
        case KEY_ID:
            if (!IkeParser::TextToHexOctets(certInfo.iData, iCertKeyId))
                {
                User::Leave(KErrArgument);
                }
            iPkiService.ReadCertificateL(iCertKeyId, iCertPtr,
            			                 &iResArray, iStatus);
            SET_ACTIVE;                     
            break;
       case APPL_UID:           
            {            
            //Get the list of applicable CA certs and appends it
            //to the original list, which was defined in the policy.
            //After this removes the currently handled node and
            //calls the method recursively.
            RArray<TUid>*  applUidList = IkeParser::GetApplUidListL(certInfo.iData);	
            CleanupStack::PushL(TCleanupItem(CIkeV2PkiServiceApplUidArrayCleanup,
                                 applUidList));

            CArrayFix<TCertificateListEntry>* applicableCaCertList;
            iPkiService.ListApplicableCertificatesL(*applUidList, applicableCaCertList);                                
            
            CleanupStack::PopAndDestroy(); //applUidList
                        
            if (applicableCaCertList->Count() > 0)
                {                                            
                CleanupStack::PushL(applicableCaCertList);
                TCertInfo* info = new (ELeave) TCertInfo;
                CleanupDeletePushL(info);
                for (TInt i = 0; i < applicableCaCertList->Count(); i++)
                    {
                    const TCertificateListEntry& entry = (*applicableCaCertList)[i];
                    info->iFormat = CA_NAME;
                    info->iData.Zero();
                    info->iData.Copy(entry.iIdentitySubjectName);

                    iIkeDataCAList->AppendL(*info);
                    DEBUG_LOG1(_L("Appending Applicable cert to the list (%S)"), &(info->iData));
                                                
                    }
                
                CleanupStack::PopAndDestroy(info);
                CleanupStack::PopAndDestroy(applicableCaCertList);
                
                iIkeDataCAList->Delete(0);                
                ImportNextCaElemFromIkeDataListL();
                }
            else
                {
                delete applicableCaCertList;
                applicableCaCertList = NULL;
                
                iStatus = KRequestPending;
                SET_ACTIVE;
                
                TRequestStatus* status = &iStatus;
                User::RequestComplete(status, KErrNotFound);                
                }                                                                
            }
            break;
        default:
            User::Leave(KErrArgument);                
            break;
        }
    }
コード例 #22
0
void CNcdProtocolDefaultObserver::ConfigurationActionRequestL( 
    MNcdConfigurationProtocolActionRequest* aActionRequest ) 
    {
    DLTRACEIN((""));

    CleanupDeletePushL( aActionRequest );
    
    if( aActionRequest->Type() == MNcdConfigurationProtocolActionRequest::ETypeUpdate &&
        aActionRequest->UpdateDetails() )
    	{
    	DLTRACE(( "Update" ));

    	DLINFO(( _L("Target: %S"), &aActionRequest->Target() ));
       	DLINFO(( _L("Id: %S"), &aActionRequest->UpdateDetails()->Id() ));
    	DLINFO(( _L("Version: %S"), &aActionRequest->UpdateDetails()->Version() ));
    	DLINFO(( _L("Uri: %S"), &aActionRequest->UpdateDetails()->Uri() ));
    	DLINFO(( "Forced: %d", aActionRequest->Force() ));

    	DLINFO(( "Client SID %08x", iContext.SecureId().iId ));    	
    	
    	if ( aActionRequest->Target() == KNcdActionTargetMasterServerUri && 
    	     aActionRequest->UpdateDetails()->Uri().Length() ) 
    	    {
    	    const TDesC& currentMaster( iConfigurationManager.MasterServerAddressL( 
    	        iContext ) );
    	        
    	    // Ensure that request was received from the master server
    	    if ( *iServerUri == currentMaster )
    	        {    	        
    	        /**
    	         * @ Improve this check to notice missing '/' at the end of the URIs
    	         */
    	        if ( aActionRequest->UpdateDetails()->Uri() != currentMaster )
    	            {    	            
            	    DLINFO(("Updating MasterServerUri")); 
            	       
            	    iConfigurationManager.SetMasterServerAddressL( iContext,
            	        aActionRequest->UpdateDetails()->Uri(), 0 );    	    
    	            }
    	        else
    	            {
    	            DLINFO(("MasterServerUri didn't change"));
    	            }
    	        }
    	    else
    	        {
    	        DLERROR(( _L("Invalid update request source! Request source: %S"),
    	            iServerUri ));
    	        }
    	    }
    	else if( aActionRequest->Target() == KNcdActionTargetSkin || 
    	         aActionRequest->Target() == KNcdActionTargetClient ) 
    	    {
        	HBufC* msgQueueName = HBufC::NewLC( KCatalogsUpdateQueueNameFormat().Length() + 8 );
        	msgQueueName->Des().Format( KCatalogsUpdateQueueNameFormat, iContext.SecureId().iId );
        	
        	DLINFO(( _L("Opening client's update message queue: %S"), msgQueueName ));
        	RMsgQueueBase queue;
        	
        	TInt err = queue.OpenGlobal( *msgQueueName );
        	if( err == KErrNone )
        	    {        	    
        	    CleanupClosePushL( queue );
                TInt msgSize = queue.MessageSize();

                // Prepare a buffer to write to update information P&S variable.
                CBufFlat* buffer = CBufFlat::NewL( KCatalogsUpdateInformationMaxSize + msgSize );
                CleanupStack::PushL( buffer );
                
                // Externalize the info to the buffer.
                RBufWriteStream stream( *buffer );
                CleanupClosePushL( stream );
                stream << (TInt32)(aActionRequest->Target().Size() + 
                                   aActionRequest->UpdateDetails()->Id().Size() + 
                                   aActionRequest->UpdateDetails()->Version().Size() +
                                   aActionRequest->UpdateDetails()->Uri().Size() +
                                   sizeof( TInt32 ));
                stream << aActionRequest->Target();
                stream << aActionRequest->UpdateDetails()->Id();
            	stream << aActionRequest->UpdateDetails()->Version();
                stream << aActionRequest->UpdateDetails()->Uri();
                stream << (TInt32)aActionRequest->Force();
                
                // Write the update information to the client's update message queue.
                TInt bytesToSend = buffer->Size();
                for( TInt sendPos = 0; sendPos < bytesToSend; sendPos += msgSize )
                    {
                    const TUint8* sendPtr = buffer->Ptr( sendPos ).Ptr();
                    queue.SendBlocking( sendPtr, msgSize );
                    }
                
                DLINFO(( "Update information sent to message queue" ));
                
                CleanupStack::PopAndDestroy( 3, &queue ); // stream-close, buffer, queue
        	    }
            
            // Clean up the local info buffer.
            CleanupStack::PopAndDestroy( msgQueueName ); 
    	    }
    	else
    	    {
    	    DLINFO(("Unknown Action target"));
    	    }
    	}
    // Action request no longer needed, delete it.
    CleanupStack::PopAndDestroy( aActionRequest );
    }
コード例 #23
0
/**
Perform TestRefreshingWindowsL test as describe above for individual display mode type.
@param aDisplayMode : relate to the window color mode to be displayed
**/
void CTDirectScreenBitmap::TestRefreshingWindowsPerDisplayModeL(TDisplayMode aDisplayMode)
{
	CFbsDrawDevice *pDev = NULL;	
	iDispMode = aDisplayMode;
		
	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
	if (err)
		{
		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),aDisplayMode);

		}
	else
		{
		INFO_PRINTF2(_L("Testing RefreshingWindows for display mode %i"),aDisplayMode);
		CleanupDeletePushL(pDev);
		pDev->InitScreen();

		TSize screenSize = pDev->SizeInPixels();
		TRect directRect;
		
		directRect = TRect(TPoint(), screenSize);
		//Full screen non-incremental run
		INFO_PRINTF1(_L("Full screen non-incremental"));
		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			TestOrientRefresh(pDev);
			}
	
		//Full screen double buffer
		INFO_PRINTF1(_L("Full screen double-buffer"));
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			TestOrientRefresh(pDev);
			}
			
		//Full screen incremental run
		INFO_PRINTF1(_L("Full screen incremental"));
		TRAP(err,ConstructL(directRect, CDirectScreenBitmap::EIncrementalUpdate,2));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			TestOrientRefresh(pDev);
			}
		
		//Quarter screen non-incremental run
		INFO_PRINTF1(_L("Sub region non-incremental"));
		directRect = TRect(TPoint(screenSize.iWidth/2, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
		TRAP(err,	ConstructL(directRect, CDirectScreenBitmap::ENone));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			TestOrientRefresh(pDev);
			}
	
		//Quarter screen double buffer
		INFO_PRINTF1(_L("Sub region double-buffer"));
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			TestOrientRefresh(pDev);
			}
						
		//Quarter screen incremental run
		INFO_PRINTF1(_L("Sub region incremental"));
		TRAP(err,ConstructL(directRect, CDirectScreenBitmap::EIncrementalUpdate,2));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			TestOrientRefresh(pDev);
			}
			
		CleanupStack::PopAndDestroy(pDev);
		}
}
コード例 #24
0
void CTDirectScreenBitmap::TestContinuousRefreshingPerDisplayModeL(const TDisplayMode& aDisplayMode)
	{
	
	CFbsDrawDevice *pDev = NULL;	
	iDispMode = aDisplayMode;
		
	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
	if (err)
		{
		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);

		}
	else
		{
		INFO_PRINTF2(_L("Testing Continuous Refreshing for display mode %i"),iDispMode);
		CleanupDeletePushL(pDev);
		User::LeaveIfError(pDev->InitScreen());

		TSize screenSize = pDev->SizeInPixels();
		TRect directRect;

		// Quarter screen ENone
		INFO_PRINTF1(_L("Consecutively update frames at left bottom corner and setting ENone"));
		directRect = TRect(TPoint(0, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
			UpdateFrame();
			}
		// Quarter screen EDoubleBuffer
		INFO_PRINTF1(_L("Consecutively update frames at up right corner and setting EDoubleBuffer"));
		directRect = TRect(TPoint(screenSize.iWidth/2, 0), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
			UpdateFrame();
			}
		// Quarter screen EIncremental
		INFO_PRINTF1(_L("Consecutively update frames at right bottom corner and setting EIncremental"));
		directRect = TRect(TPoint(screenSize.iWidth/2, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EIncrementalUpdate,2));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
			UpdateFrame();
			}
		
		// Full screen EIncremental
		INFO_PRINTF1(_L("Consecutively update frames at full screen and setting EIncremental"));
		directRect = TRect(TPoint(0,0), screenSize);
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EIncrementalUpdate,2));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
			UpdateFrame();
			}
		
		// Full screen ENone
		INFO_PRINTF1(_L("Consecutively update frames at full screen and setting ENone"));
		directRect = TRect(TPoint(0,0), screenSize);
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::ENone));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
			UpdateFrame();
			}
		
		// Full screen EDoubleBuffering
		INFO_PRINTF1(_L("Consecutively update frames at full screen and setting EDoubleBuffering"));
		directRect = TRect(TPoint(0,0), screenSize);
		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
			UpdateFrame();
			}
		CleanupStack::PopAndDestroy(pDev);
		}
	}
コード例 #25
0
// -----------------------------------------------------------------------------
// CPIMSerializer::FromSerialFormatL
// forwards the request to the versit module
// -----------------------------------------------------------------------------
//
jintArray CPIMSerializer::FromSerialFormatL(JNIEnv* aJniEnv,
        const TDesC8& aBuffer, TEncoding aEncoding)
{
    JELOG2(EPim);
    Versit::TVersitCharSet charSet = MapEncodingL(aEncoding);
    RPointerArray<CPIMItem>* itemArray = iVersit->StringToItemL(aBuffer,
                                         charSet);
    CleanupDeletePushL(itemArray);
    CleanupClosePushL(*itemArray);

    // calculate the length of the needed array
    TInt arrayLength = 0;
    TInt itemCount = itemArray->Count();
    TInt i = 0;
    for (i = 0; i < itemCount; i++)
    {
        switch ((*itemArray)[i]->ItemType())
        {
        case EPIMContactList:
        case EPIMToDoList:
        {
            arrayLength += 2;
            break;
        }
        case EPIMEventList:
        {
            arrayLength += 4;
            break;
        }
        default:
        {
            User::Leave(KErrNoMemory);
        }
        }
    }

    jintArray itemHandles = aJniEnv->NewIntArray(arrayLength);
    if (!itemHandles)
    {
        User::Leave(KErrNoMemory);
    }
    jint* handles = aJniEnv->GetIntArrayElements(itemHandles, 0);
    jint* handlePointer = handles;
    for (i = 0; i < itemCount; i++)
    {
        pimbaseitem* item = (*itemArray)[i];
        TInt itemHandle(reinterpret_cast<int>(item));
        TInt itemType = ((*itemArray)[i])->ItemType();
        *handlePointer++ = itemType;
        *handlePointer++ = itemHandle;
        if (itemType == EPIMEventList)
        {

            int baseRepeatRuleHandle = item->getRepeatHandle();
            if (baseRepeatRuleHandle < KErrNone)
                throw baseRepeatRuleHandle;

            *handlePointer++ = baseRepeatRuleHandle;
            handlePointer++;
        }
    }
    aJniEnv->ReleaseIntArrayElements(itemHandles, handles, 0);

    CleanupStack::PopAndDestroy(2);
    return itemHandles;
}
コード例 #26
0
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// create a watcher list event with given arrays
//
CPresenceWatcherListEventImp* T_PresenceWatcherListManagement::CreateWatcherListEventLCX(
        const TDesC& aUri,
        const TDesC& aDispName,
            MXIMPDataSubscriptionState::TSubscriptionState aSubscriptionState,
            MXIMPDataSubscriptionState::TDataState aDataState,
            TTestPWlOperation aOperation,
            RPrWatLstInfoImpArray* aCurrentList)
    {
    // create the arrays


    // new list
    RPrWatLstInfoImpArray* newList = new ( ELeave ) RPrWatLstInfoImpArray;
    CleanupDeletePushL( newList );

    // current list, created by caller
    if(!aCurrentList) // if client didnt created the list
        aCurrentList = new ( ELeave ) RPrWatLstInfoImpArray;
    CleanupDeletePushL( aCurrentList );

    // disappeared list
    RPrWatLstInfoImpArray* disappearedList = new ( ELeave ) RPrWatLstInfoImpArray;
    CleanupDeletePushL( disappearedList );

    // create the watcher info
    CPresenceWatcherInfoImp* watcherInfoForEvent1 = NULL; 
            {
            CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( aUri );
            watcherInfoForEvent1 = CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, aDispName );
            CleanupStack::Pop( watcherInfoForEvent1 );        
            CleanupStack::PopAndDestroy( idForEvent ); 
            CleanupStack::PushL( watcherInfoForEvent1 );        
            }
    
    CPresenceWatcherInfoImp* watcherInfoForEvent2 = 
            TXIMPObjectCloner< CPresenceWatcherInfoImp >::CloneLC( *watcherInfoForEvent1 );
    
    TInt count(0);
    TBool found(EFalse);
    TInt i(0);
    
    // put the given watcher info into the specified array
    switch ( aOperation )
        {
        case ETestPWlNew:
            {
            newList->AppendL( watcherInfoForEvent2 );
            CleanupStack::Pop( watcherInfoForEvent2 );
            
            aCurrentList->AppendL( watcherInfoForEvent1 );
            CleanupStack::Pop( watcherInfoForEvent1 );
            }
            break;
        case ETestPWlCurrent:
            {
            // don't add, thus return what user has given
            CleanupStack::PopAndDestroy( watcherInfoForEvent2 ); // watcherInfoForEvent2
            CleanupStack::PopAndDestroy( watcherInfoForEvent1 ); // watcherInfoForEvent1
            }
            break;
        case ETestPWlDisappeared:
            {
            // search the given id in current list
            count = aCurrentList->Count();
            for(i=0;i<count;i++)
                {
                // if dispname and id are same
                if (( ((((*aCurrentList)[i])->WatcherId()).Identity()) == aUri )
                    && ( (((*aCurrentList)[i])->WatcherDisplayName()) == aDispName ))
                    {
                    found = ETrue;
            break;            
                    }
                }
            if(found) // do we need to leave if error? Waqas
            {
                delete (*aCurrentList)[i];
                aCurrentList->Remove(i);
                disappearedList->AppendL( watcherInfoForEvent2 );
                CleanupStack::Pop( watcherInfoForEvent2 );
                }
            else
                CleanupStack::PopAndDestroy( watcherInfoForEvent2 );
            
            CleanupStack::PopAndDestroy( watcherInfoForEvent1 );
            }
            break;
        default:
            {
            User::Leave( KErrArgument );
            }
            break;            
        };

    CXIMPDataSubscriptionStateImp* stateImp = CXIMPDataSubscriptionStateImp::NewLC();
    stateImp->SetDataStateL( aDataState );
    stateImp->SetSubscriptionStateL( aSubscriptionState );
    CleanupStack::Pop( stateImp );

    // create the actual event
    CPresenceWatcherListEventImp* tmp =
        CPresenceWatcherListEventImp::NewLC(
                newList,
                aCurrentList,
                disappearedList,
                stateImp );
     

    /*
     * In cleanupstack there are 4 items, FIFO
     *   - new list
     *   - current list
     *   - disappeared list
     *   - event imp
     */

    return tmp;
    }
コード例 #27
0
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::NewLC
// Symbian two-phased constructor.
// -----------------------------------------------------------------------------
EXPORT_C CSyncMLFilterProperty*
                CSyncMLFilterProperty::NewLC( RReadStream& aStream )
	{
	CSyncMLFilterProperty* self = new (ELeave) CSyncMLFilterProperty();
	CleanupStack::PushL( self );
	
	self->iQueryValueText16 = NULL;
	self->iQueryValueText8 = NULL;
	
	// Create filter from stream
	//  name
	TInt tempLength( aStream.ReadUint32L() );
	if ( tempLength )
		{
		// name
		self->iDisplayName = HBufC::NewL( aStream, tempLength );
		}
	
	// data type for default values
	self->iDataTypeForDefaultValues = 
	                ( TSyncMLFilterPropertyDataType )aStream.ReadInt8L();
	
	// data type for query value
	self->iDataTypeForQueryValue = 
	                ( TSyncMLFilterPropertyDataType )aStream.ReadInt8L();

    // max text length
	self->iMaxTextLength = aStream.ReadUint32L();
	
	// default values
	switch( self->iDataTypeForDefaultValues )
		{
		case ESyncMLDataTypeBool:
		case ESyncMLDataTypeNumber:
			{
			TInt count = aStream.ReadInt32L();
			for ( TInt i = 0; i < count; i++ )
				{
				self->iDefaultValueIntOrBoolList.AppendL( 
				                aStream.ReadInt32L() );
				}
			break;
			}
		case ESyncMLDataTypeTime:
		case ESyncMLDataTypeDate:
			{
			TInt count = aStream.ReadInt32L();
			for ( TInt i = 0; i < count; i++ )
				{
				TTime* temp = new ( ELeave ) TTime( aStream.ReadReal64L() );
				CleanupDeletePushL( temp );
				self->iDefaultValueDateOrTimeList.AppendL( temp );
				CleanupStack::Pop(); // temp
				}
			break;
			}
			
		case ESyncMLDataTypeText8:
			{
			TInt count = aStream.ReadInt32L();
			for ( TInt i = 0; i < count; i++ )
				{
				TInt length( aStream.ReadUint32L() );
				if ( length )
					{
					self->iDefaultValueText8List.AppendL( 
					                HBufC8::NewLC( aStream, length ) );
					CleanupStack::Pop(); // text
					}
				}
			break;
			}
		case ESyncMLDataTypeText16:
			{
			TInt count = aStream.ReadInt32L();
			for ( TInt i = 0; i < count; i++ )
				{
				TInt length( aStream.ReadUint32L() );
				if ( length )
					{
					self->iDefaultValueText16List.AppendL( 
					                HBufC::NewLC( aStream, length ) );
					CleanupStack::Pop(); // text
					}
				}
			break;
			}
		case ESyncMLDataTypeNull:
			{
			aStream.ReadInt32L();
			break;
			}
		default:
			{
			break;
			}
		}
		
	// query values
	switch( self->iDataTypeForQueryValue )
		{
		case ESyncMLDataTypeBool:
		case ESyncMLDataTypeNumber:
			{
			self->iQueryValueIntOrBool = aStream.ReadInt32L();
			break;
			}
		case ESyncMLDataTypeTime:	
		case ESyncMLDataTypeDate:
			{	
			TTime tempTime( aStream.ReadReal64L() );
			self->iQueryValueDateOrTime = tempTime;
			break;
			}
			
		case ESyncMLDataTypeText8:
			{
			TInt length( aStream.ReadUint32L() );
			if (length)
				{
				self->iQueryValueText8 = HBufC8::NewL( aStream, length );
				}
			break;
			}
		case ESyncMLDataTypeText16:
			{
			TInt length( aStream.ReadUint32L() );
			if (length)
				{
				self->iQueryValueText16 = HBufC::NewL( aStream, length );
				}
				
			break;
			}
		case ESyncMLDataTypeNull:
			{
			aStream.ReadInt32L();
			break;
			}
		default:
			{
			break;
			}
		}

    // default value selection
	tempLength = aStream.ReadInt32L();
	for ( TInt i = 0; i < tempLength; i++ )
		{
		self->iDefaultValueSelected.AppendL( aStream.ReadInt32L() );
		}

    // can use query
	if ( aStream.ReadInt8L() > 0 )
		{
		self->iCanUseQueryValue = ETrue;
		}
	
	// supports multiple selection
	if ( aStream.ReadInt8L() > 0 )
		{
		self->iSupportsMultpleSelection = ETrue;
		}
	
	// supports empty selection
	if ( aStream.ReadInt8L() > 0 )
		{
		self->iSupportsEmptySelection = ETrue;
		}
	
	// query value selected
	if ( aStream.ReadInt8L() > 0 )
		{
		self->iQueryValueSelected = ETrue;
		}

	return self;
	}
コード例 #28
0
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::NewLC
// Symbian two-phased constructor.
// -----------------------------------------------------------------------------
EXPORT_C CSyncMLFilterProperty*
                CSyncMLFilterProperty::NewLC( TResourceReader& aReader )
	{
	CSyncMLFilterProperty* self = new (ELeave) CSyncMLFilterProperty();
	CleanupStack::PushL( self );
	
	// Create filter property from resource file
	// BYTE version
	TInt version( aReader.ReadInt8() );
	
	// LTEXT name
	self->iDisplayName = aReader.ReadHBufC16L();

    // LONG data type for default values
	TInt32 tmpDataTypeForDefaultValues = aReader.ReadInt32();
	switch( tmpDataTypeForDefaultValues )
		{
		case KSyncMLFilterDataTypeNumber:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeNumber;
			break;
			}
		case KSyncMLFilterDataTypeBoolean:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeBool;
			break;
			}
		case KSyncMLFilterDataTypeDate:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeDate;
			break;
			}
		case KSyncMLFilterDataTypeTime:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeTime;
			break;
			}			
		case KSyncMLFilterDataTypeText8:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeText8;
			break;
			}
		case KSyncMLFilterDataTypeText16:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeText16;
			break;
			}
		default:
			{
			self->iDataTypeForDefaultValues = ESyncMLDataTypeNull;
			break;
			}
		}
	
	// LONG data type for query value
	TInt32 tmpDataTypeForQueryValue = aReader.ReadInt32();
	switch( tmpDataTypeForQueryValue )
		{
		case KSyncMLFilterDataTypeNumber:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeNumber;
			break;
			}
		case KSyncMLFilterDataTypeBoolean:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeBool;
			break;
			}
		case KSyncMLFilterDataTypeDate:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeDate;
			break;
			}
		case KSyncMLFilterDataTypeTime:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeTime;
			break;
			}			
		case KSyncMLFilterDataTypeText8:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeText8;
			break;
			}
		case KSyncMLFilterDataTypeText16:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeText16;
			break;
			}
		default:
			{
			self->iDataTypeForQueryValue = ESyncMLDataTypeNull;
			break;
			}
		}
	
	// WORD max text length
	self->iMaxTextLength = aReader.ReadInt16();

    // LTEXT[] default text16 values
	TInt number = aReader.ReadInt16();
	for ( TInt i = 0; i < number; i++ )
		{
		HBufC16* text = aReader.ReadHBufC16L();
		CleanupStack::PushL( text );
		self->iDefaultValueText16List.AppendL( text );
		CleanupStack::Pop(); // text
		}
	
	// LTEXT[] default text8 values
	number = aReader.ReadInt16();
	for ( TInt i = 0; i < number; i++ )
		{
		HBufC8* text = aReader.ReadHBufC8L();
		CleanupStack::PushL( text );
		self->iDefaultValueText8List.AppendL( text );
		CleanupStack::Pop(); // text
		}
	
	// WORD[] default integer/boolean values
	number = aReader.ReadInt16();
	for ( TInt i = 0; i < number; i++ )
		{
		self->iDefaultValueIntOrBoolList.AppendL( aReader.ReadInt16() );
		}
	
	// LTEXT default time values
	number = aReader.ReadInt16();
	for ( TInt i = 0; i < number; i++ )
		{
		HBufC* timeStr = aReader.ReadHBufCL();
		CleanupStack::PushL( timeStr );
		TTime* temp = new (ELeave) TTime( *timeStr );
		CleanupStack::PopAndDestroy(); //timeStr
		CleanupDeletePushL( temp );
		TDateTime dt( temp->DateTime() );
		
		switch( self->iDataTypeForDefaultValues )
			{
			case ESyncMLDataTypeDate:
				dt.SetHour(0);
				dt.SetMinute(0);
				dt.SetSecond(0);
				dt.SetMicroSecond(0);
				break;
			case ESyncMLDataTypeTime:
				dt.SetDay(0);
				dt.SetMonth(EJanuary);
				dt.SetYear(0);
				break;
			default:
				break;
			}
		*temp = dt;

		self->iDefaultValueDateOrTimeList.AppendL( temp );
		CleanupStack::Pop(); // temp
		}
	
	// BYTE[] default value selection
	number = aReader.ReadInt16();
	for ( TInt i = 0; i < number; i++ )
		{
		self->iDefaultValueSelected.AppendL( aReader.ReadInt8() );
		}
	
	// LTEXT query text16
	self->iQueryValueText16 = aReader.ReadHBufC16L();
	
	// LTEXT query text8
	self->iQueryValueText8 = aReader.ReadHBufC8L();
	
	// WORD query integer/boolean
	self->iQueryValueIntOrBool = aReader.ReadInt16();
	
	// LTEXT query time
	HBufC* timeStr = aReader.ReadHBufCL();
	
	if ( timeStr )
		{
		CleanupStack::PushL( timeStr );
		
		self->iQueryValueDateOrTime.Set( *timeStr );
		TDateTime dt( self->iQueryValueDateOrTime.DateTime() );
		
		switch( self->iDataTypeForQueryValue )
			{
			case ESyncMLDataTypeDate:
				dt.SetHour(0);
				dt.SetMinute(0);
				dt.SetSecond(0);
				dt.SetMicroSecond(0);
				break;
			case ESyncMLDataTypeTime:
				dt.SetDay(0);
				dt.SetMonth(EJanuary);
				dt.SetYear(0);
				break;
			default:
				break;
			}
		self->iQueryValueDateOrTime = dt;
		CleanupStack::PopAndDestroy(); //timeStr
		}

    // BYTE query value selected
	if ( aReader.ReadInt8() > 0 )
		{
		self->iQueryValueSelected = ETrue;
		}
	
	// BYTE can use query
	if ( aReader.ReadInt8() > 0 )
		{
		self->iCanUseQueryValue = ETrue;
		}
	
	// BYTE multiple selection
	if ( aReader.ReadInt8() > 0 )
		{
		self->iSupportsMultpleSelection = ETrue;
		}
		
	// BYTE empty selection
	if ( aReader.ReadInt8() > 0 )
		{
		self->iSupportsEmptySelection = ETrue;
		}

	return self;
	}
コード例 #29
0
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
void T_PresenceWatcherListManagement::T_HandlePresenceWatcherList_L()
    {
    EUNIT_PRINT( _L("Handle presence watcher list.") );

    BindL();
    SubscribeL();

    // ------------------------------------------------------
    // some startup stuff
    CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 );
    MXIMPContext* context = wrapper->GetContext();

    CXIMPTestListener* listener2 = CXIMPTestListener::NewL( context );
    CleanupStack::PushL( listener2 );
    // ------------------------------------------------------

    // Tell the protocol it should act normally
    wrapper->GetMessenger()->SetNoError();

    // ------------------------------------------------------
    // 1. Create faked server message about watcher list (empty)
    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );

    // ------------------------------------------------------
    // expect empty MPresencewatcherList event.

    RPrWatLstInfoImpArray* currentList(NULL);
    CPresenceWatcherListEventImp* event = CreateWatcherListEventLCX(
            KNullDesC, KNullDesC,
        MXIMPDataSubscriptionState::ESubscriptionActive,
        MXIMPDataSubscriptionState::EDataAvailable,
        ETestPWlCurrent, currentList);

    listener2->ExpectL( event );
    CleanupStack::Pop( event ); // 3 more items in cleanupstack

    //Waqas: Fixed task Ticket#22
    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
    CleanupStack::PopAndDestroy( 3 ); // lists
    // ------------------------------------------------------


    // ------------------------------------------------------
    // 2. Create faked server message about watcher list (new)
    listener2->Reset();

    _LIT16( KWatcherUri1,      "http://carpe.diem.com" );
    _LIT16( KWatcherDispName1, "DispnameA, LoremI" );

    SendSrvMsgL( KWatcherUri1,
                 KWatcherDispName1,
                 CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );

    // ------------------------------------------------------
    // MPresencewatcherList event.

    currentList = NULL; // previous one was destroyed
    //Now create the actual event
    event = CreateWatcherListEventLCX(  // previous event was destroyed
            KWatcherUri1, KWatcherDispName1,
        MXIMPDataSubscriptionState::ESubscriptionActive,
        MXIMPDataSubscriptionState::EDataAvailable,
        ETestPWlNew, currentList);
    

    listener2->ExpectL( event );
    CleanupStack::Pop( event ); // 3 more items in cleanupstack

    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );
    CleanupStack::PopAndDestroy( 3 ); // lists


    // ------------------------------------------------------
    // 3. Create faked server message about watcher list (disappeared)
    listener2->Reset();

    SendSrvMsgL( CXIMPTestFileSrvMsg::ETestSrvMsgPresenceWatcherList );
    // ------------------------------------------------------
    // MPresencewatcherList event.

    CXIMPIdentityImp* idForEvent = CXIMPIdentityImp::NewLC( KWatcherUri1 );
    // we need to create current list to give to the event
    currentList = new ( ELeave ) RPrWatLstInfoImpArray; // previous is destroyed
    CleanupDeletePushL( currentList );
            // create the group info
    CPresenceWatcherInfoImp* watcherInfoForEvent = 
                            CPresenceWatcherInfoImp::NewLC( (MPresenceWatcherInfo::TWatcherType)0, *idForEvent, KWatcherDispName1);
    currentList->AppendL( watcherInfoForEvent );
    CleanupStack::Pop( watcherInfoForEvent );
    CleanupStack::Pop( currentList );
    CleanupStack::PopAndDestroy( idForEvent );    


    //Now create the actual event
    event = CreateWatcherListEventLCX(
            KWatcherUri1, KWatcherDispName1,
        MXIMPDataSubscriptionState::ESubscriptionActive,
        MXIMPDataSubscriptionState::EDataAvailable,
        ETestPWlDisappeared, currentList);

    listener2->ExpectL( event );
    CleanupStack::Pop( event ); // 3 more items in cleanupstack

    //Waqas: Fixed task Ticket#22
    EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );

    CleanupStack::PopAndDestroy( 3 ); // lists


    // clean it up
    UnsubscribeL();
    
    /* TODO later on better time.
    // ------------------------------------------------------
    // 4. Create faked server message about watcher list (no subscribers to list)
    //    Make sure no event is 
    listener2->Reset();
    
    event = CreateWatcherListEventLCX(
            KNullDesC, KNullDesC,
            ETestPWlEmpty );

    //EUNIT_ASSERT_DESC( KErrNone == listener2->WaitAndAssertL(), "HandlePresenceWatcherListL failed" );

    */
    CleanupStack::PopAndDestroy( listener2 );
    
    UnbindL();
    }
コード例 #30
0
void CHttpController::ParseHeadersL( RHTTPTransaction& aTransaction )
	{
	const TInt KMaxNumericLen = 32;

	RStringPool stringPool = aTransaction.Session().StringPool();
	RHTTPHeaders header = aTransaction.Response().GetHeaderCollection();
	THTTPHdrFieldIter iterator = header.Fields();

	HBufC8* fieldName8 = NULL;
	HBufC8* fieldVal8 = NULL;
	CHttpHeaders* headers = CHttpHeaders::NewLC();
	while ( !iterator.AtEnd() )
		{
		RStringTokenF fieldName = iterator();
		RStringF fieldNameStr = stringPool.StringF( fieldName );
		THTTPHdrVal fieldVal;
		if ( header.GetField( fieldNameStr, 0, fieldVal ) == KErrNone )
			{
			fieldName8 = fieldNameStr.DesC().AllocLC();
			switch ( fieldVal.Type() )
				{
				case THTTPHdrVal::KTIntVal:
					{
					fieldVal8 = HBufC8::NewLC( KMaxNumericLen );
					TPtr8 ptr( fieldVal8->Des() );
					ptr.Num( fieldVal.Int() );
					break;
					}
				case THTTPHdrVal::KStrFVal:
					{
					RStringF fieldValStr = stringPool.StringF( fieldVal.StrF() );
					fieldVal8 = fieldValStr.DesC().AllocLC();
					break;
					}
				case THTTPHdrVal::KStrVal:
					{
					RString fieldValStr = stringPool.String( fieldVal.Str() );
					fieldVal8 = fieldValStr.DesC().AllocLC();
					break;
					}
				case THTTPHdrVal::KDateVal:
					{
					_LIT(KDateFormat,"%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S.%C%:3");
					TDateTime date = fieldVal.DateTime();
					const TInt KMaxDateBuferLength = 100;
					TBuf< KMaxDateBuferLength > dateBuffer;
					TTime time( date );
					time.FormatL( dateBuffer, KDateFormat );
					fieldVal8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( dateBuffer );
					CleanupDeletePushL( fieldVal8 );
					break;
					}
				default:
					User::Leave( KErrNotSupported );//new field types will be added in future
					break;
				}
			if ( !fieldVal8 )
				{
				CleanupStack::PopAndDestroy( fieldName8 );
				}
			else
				{
				headers->AddL( *fieldName8, *fieldVal8 );
				CleanupStack::PopAndDestroy( 2, fieldName8 );
				}
			fieldVal8 = NULL;
			fieldName8 = NULL;
			}
		++iterator;
		}

	iObserver->HeadersReceivedL( headers );
	CleanupStack::Pop( headers );
	}