// from CJavaEvent
void CMMADCRepaintEvent::Dispatch(JNIEnv& aJni)
{
    // create method id if not allready created
    if (!iHandleEventMethod)
    {
        iHandleEventMethod = aJni.GetMethodID(aJni.GetObjectClass(iListenerObject),
                                              "repaint",
                                              "()V");
    }

    // There is internal error if method cannot be found
    __ASSERT_DEBUG(iHandleEventMethod, User::Invariant());

    // IsSameObject method will return true if iListenerObject has disappeared
    if (iHandleEventMethod &&
            aJni.IsSameObject(iListenerObject, 0) == JNI_FALSE)
    {
        aJni.CallVoidMethod(iListenerObject,
                            iHandleEventMethod);
    }

    // IsActive will return EFalse after this
    iEventData = KErrNone;
}
Example #2
0
EXPORT_C TInt CMsvServerEntry::MoveEntriesWithinService(CMsvEntrySelection& aSelection, TMsvId aDestination)
//
//
//
/** Moves a child of the context to under another entry. All descendants will be
moved as well. The destination must belong to the same service as the context.

@param aSelection The entries to move. On return, contains the children that
could not be fully moved.
@param aDestination The ID of new parent
@return KErrNone if successful, KErrArgument if the destination is a child
of aSelection entry, KErrInUse if the store or a file associated with an entry
is open, KErrNotFound if an aSelection entry is not a child of the context
the, or KErrPathNotFound if the destination does not exist. */
	{
	__ASSERT_DEBUG(iEntry.Id()!=KMsvNullIndexEntryId, PanicServer(EMsvEntryWithNoContext10));

	CMsvEntrySelection* moved = NULL;

	TRAPD(error, DoMoveEntriesL(aSelection, aDestination, moved));

	if (moved && moved->Count())
		{
		iServer.NotifyChanged(EMsvEntriesMoved, *moved, aDestination, iEntry.Id());

		// need to remove owner flag if has no children
		TMsvEntry* pEntry;
		TInt err = KErrNone;
		err = iServer.IndexAdapter().GetEntry(iEntry.Id(), pEntry);
		if (err==KErrNone)
			iEntry.SetOwner(pEntry->Owner());
		}

	delete moved;
	return error;
	}
/**
Connect the session to the server

@param aClientStatus Client status to be completed
*/
void CImSmtpSession::ConnectL(TRequestStatus& aClientStatus)
	{
	__ASSERT_DEBUG(!iSocketIsConnected, gPanic(EImsmSocketAlreadyConnected));

	if (!iSocketIsConnected)
		{
		if(iSettings.SecureSockets())
			iThisSession = ESecureSession;		 // if the user has chosen to use TLS then we have to use ESMTP+TLS
		else if(iSettings.SMTPAuth())
			iThisSession = EEnhancedSmtpSession; // if the user has chosen to use AUTH, when we have to use ESMTP
		else
			iThisSession = ESmtpSession;		 // use SMTP session for now

		iCompleted = KErrNone;
		iState = EConnectingToSmtp;		// Initialise to 1st state of state machine
		DoStateL();						// Here we go...
		Queue(aClientStatus);		
		}
	else
		{
		// Nothing to do so just complete the caller
		RequestComplete(aClientStatus, KErrNone);
		}
	}
	void CStorageManager::GetPIDFileNameL(CSBPackageTransferType* aTransferType, TFileName& aFileName)
		/**
		Generates file name for the PID

		@param aTransferType - A CSBPackageTransferType contains info about Package Type
		@param aFileName - Reference to a filename

		*/
		{
		__ASSERT_DEBUG(aTransferType != NULL, User::Panic(KBURTestPanicText, ENullTargetPointer));
		TUid id;
		TChar drive;
		TDriveNumber driveNumber;
		TPackageDataType pkgType;

		id = aTransferType->PackageIdL();
		pkgType = aTransferType->DataTypeL();
		driveNumber = aTransferType->DriveNumberL();

		//Get the drive letter
		iTestStep->Fs().DriveToChar(driveNumber, drive);

		switch(pkgType)
			{
			case ESystemData:
				GetSIDPrivateDirName(drive, id, aFileName);
				aFileName.Append(KData);
				aFileName.Append(KBackupExtn);
				break;
			case ESystemSnapshotData:
				GetSIDPrivateDirName(drive, id, aFileName);
				aFileName.Append(KSnapshot);
				aFileName.Append(KBackupExtn);
				break;
			}
		}
Example #5
0
/**
    Close all objects that were created in the main file server thread.
    For sync. drives all objects must be closed in the main file server thread, because
    they are created in this thread, as soon as all synch. requests are processed there.
*/
void CFsObjectIx::CloseMainThreadObjects()
	{
	__ASSERT_DEBUG(FsThreadManager::IsMainThread(),Fault(EObjectIxMainThread));
	__PRINT(_L("CFsObjectIx::CloseThreadObjects()"));
    
	Lock();
	// We have to be very careful here. Calling Close() on the objects in the array
	// may result in other entries being removed from the array before we delete
	// them here, and may result in the array being ReAlloc()ed, corrupting the removed
	// entries, hence we must check the iHighWaterMark value each time round the loop.
	TInt i=-1;
	while(++i<iHighWaterMark)
		{
		SFsObjectIxRec* pS=iObjects+i;
		CFsObject *pO=pS->obj;
		if (pO && pO->IsCorrectThread())
			{
			// invalidate entry before closing it
			pS->obj=NULL;
			pO->Close();	
			}
		}
	Unlock();
	}
Example #6
0
void CTPointerCapture::TestFailed()
	{
	if (iFailed)
		{
		_LIT(KLog,"Test Failed  State=%d  SubState=%d");
		LOG_MESSAGE3(KLog,iTest->iState,iSubState);
		}
	__ASSERT_DEBUG(iFailed==EFalse,AutoPanic(ETManPanicPcFailed));
	TInt dRet=1;
#if !defined(DISABLE_FAIL_DIALOG)
	Client()->iGroup->GroupWin()->SetOrdinalPosition(0,10);	// Put error dialog on top of test windows
	TRAPD(err,dRet=doTestFailedL());
	Client()->iGroup->GroupWin()->SetOrdinalPosition(0,0);
#endif
	switch(dRet)
		{
		case 0:
			break;
		case 1:
			iFailed=ETrue;
			NextTest();
			break;
		}
	}
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertClassFieldL
// Converts Event.CLASS field to a vCalendar.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertClassFieldL(const CPIMItem& aItem,
        CParserVCalEntity& aParser, TPIMEventField aField, TInt aIndex)
{
    JELOG2(EPim);
    const TInt classVal = aItem.getInt(aField, aIndex);
    TPtrC classString(KPIMClassStringConfidential);

    switch (classVal)
    {
    case EPIMEventClassConfidential:
    {
        classString.Set(KPIMClassStringConfidential);
        break;
    }
    case EPIMEventClassPrivate:
    {
        classString.Set(KPIMClassStringPrivate);
        break;
    }
    case EPIMEventClassPublic:
    {
        classString.Set(KPIMClassStringPublic);
        break;
    }
    default:
    {
        __ASSERT_DEBUG(EFalse, User::Invariant());
        break;
    }
    }

    CParserPropertyValue* propertyValue = CParserPropertyValueHBufC::NewL(
                                              classString);
    AddPropertyToParserL(propertyValue, KVersitTokenCLASS(), aParser);
    // Needed cleanup stack items are popped out in the AddPropretyToParserL
}
Example #8
0
TUint CIpcStreamProvd::Write(const TDesC8& aDesc,TUint /*options*/, TSockAddr* /*anAddr*/)
	{
	__ASSERT_DEBUG(iSocket,Panic(EBadWriteCall));
	if (!iConnection)
		{
		iSocket->Error(KErrDisconnected);
		// error occured, the only possible error for this protocol is KErrNoMemory
		return 0;
		}
	TInt len=Min(aDesc.Size(),iBuffer.Length()-iBuffer.Count());
	if (len)
		{
		iBuffer.Add(aDesc.Ptr(),len);
		iConnection->NewData(len);
		}
	else
		{
		// error occured on attempt to send data, the only possible error for 
		// this protocol is KErrNoMemory
		return 0;
		}
		
	return len;
	}
Example #9
0
/**
 *  cancel the modem notification
 */
void CSmsModemNotification::DoCancel()
	{
	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMODEMNOTIFICATION_DOCANCEL_1, "CSmsModemNotification::DoCancel()");

	__ASSERT_DEBUG(iState==ESmsModemNotificationWaitingForNotification,SmspPanic(KSmspPanicUnexpectedState));
	
	//
	// Cancel the request...
	//
	iPhonePowerProperty.Cancel();

	//
	// Handle completion of this Active Object. Note that the object
	// may well still be active at this point...
	//
	if (TimedOut())
		{
		Complete(KErrTimedOut);
		}
	else
		{
		Complete(KErrCancel);
		}
	} // CSmsModemNotification::DoCancel
Example #10
0
// ---------------------------------------------------------
// TDdParser::ObjUriElementNodeL()
// ---------------------------------------------------------
//
void TDdParser::ObjUriElementNodeL( NW_DOM_ElementNode_t* aElmtNode, CMediaObjectData *& aMediaObject )
    {
	CLOG(( EParse, 2, _L("-> TDdParser::ObjUriElementNodeL") ));
    __ASSERT_DEBUG( aElmtNode, CodPanic( ECodInternal ) );
    NW_String_t str;
    LeaveIfNwErrorL( NW_DOM_Node_getNodeName( aElmtNode, &str ) );
    CleanupNwStringStoragePushL( &str );
    NW_Ucs2* ucs2;
    LeaveIfNwErrorL( NW_String_stringToUCS2Char( &str, iEncoding, &ucs2 ) );
    CleanupNwUcs2PushL( ucs2 );

    TPtrC attrName( ucs2 );
    TDdAttr attr = ObjUriAttribute( attrName );
	CleanupStack::PopAndDestroy( 2 );   // Clean up ucs2, str->storage
	TInt ok( EFalse );
    if ( attr != EDdUnknownAttr )   // Unknown attribute is ignored.
		{
        ucs2 = PcDataLC( aElmtNode );
        if ( ucs2 )
            {
			/* composite objects (multiple server elements) are not supported in 3.2
			   So, it takes last ObjectUri
			*/
			if ( (attr == EDdUrl))
				{
				ok = aMediaObject->SetUrlL( TPtrC ( ucs2 ));
				}
            }
        CleanupStack::PopAndDestroy();  // Clean up ucs2.
        }
		if ( !ok )
			{
			Error( KErrCodInvalidDescriptor );
			}
		CLOG(( EParse, 2, _L("<- TDdParser::ObjUriElementNodeL") ));
    }
Example #11
0
// ---------------------------------------------------------
// TDdParser::ProductElementNodeL()
// ---------------------------------------------------------
//
void TDdParser::ProductElementNodeL( NW_DOM_ElementNode_t* aElmtNode )
    {
	CLOG(( EParse, 2, _L("-> TDdParser::ProductElementNodeL") ));
	__ASSERT_DEBUG( aElmtNode, CodPanic( ECodInternal ) );
	NW_String_t str;
	LeaveIfNwErrorL( NW_DOM_Node_getNodeName( aElmtNode, &str ) );
	CleanupNwStringStoragePushL( &str );
	NW_Ucs2* ucs2;
	LeaveIfNwErrorL( NW_String_stringToUCS2Char( &str, iEncoding, &ucs2 ) );
	CleanupNwUcs2PushL( ucs2 );
	TPtrC attrName( ucs2 );
	TDdAttr attr = ProductAttribute( attrName );
	CLOG(( EParse, 4, _L("  attribute <%S> (%d)"), &attrName, attr ));
	CleanupStack::PopAndDestroy( 2 );   // Clean up ucs2, str->storage
	if ( attr == EDdMeta )
	{
		ParseMetaElementsL(aElmtNode);
	}
	if ( attr == EDdMediaObject )
	{
		ParseMediaObjectElementsL(aElmtNode);
	}
	CLOG(( EParse, 2, _L("<- TDdParser::ProductElementNodeL") ));
    }
/**
@return Represents the content of the current flat buffer field as real value.
		If the current flat buffer field type does not refer to a real, then 
		the function will do a data conversion as described in the table which can be found
		in SqlBufIterator.h file.
*/
TReal TSqlBufRIterator::Real() const
	{
	__ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError));
	switch(Type())
		{
		case ESqlInt:
		case ESqlZeroBlob:
			{
			TRealX val(AsInt());	
			return static_cast <TReal> (val);
			}
		case ESqlInt64:
			{
			TRealX val(AsInt64());	
			return static_cast <TReal> (val);
			}
		case ESqlNull:
		case ESqlText:
		case ESqlBinary:
			return 0.0;
		default:
			return AsReal();
		}
	}
Example #13
0
void CALLBACK CWin32Socket::ReceiveCompletion(DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD /*dwFlags*/)
	{
	if (dwError == WSAEINVAL)
		{
		// Ignore - probably a completion on a closed socket due to cancellation.
		// Also, might not be a valid context from which to call Emulator::Reenter().
		return;
		}

	Emulator::Reenter(); // This is a win32 callback so we're outside of the emulator at this point
	WSP_LOG(WspLog::Printf(_L("CWin32Socket::ReceiveCompletion: error: %d, object: 0x%x"), dwError, lpOverlapped->hEvent));
	switch (dwError)
		{
		case 0:
			{
			CWin32Socket* socket = reinterpret_cast<CWin32Socket*>(lpOverlapped->hEvent);
			if (socket && socket->iReceiveMessage) // May have been cancelled.
				{
				socket->iReceiveMessage->WriteBuffer().SetLength(cbTransferred);
				socket->Complete(socket->iReceiveMessage, KErrNone);
				}
			break;
			}
		case WSAECONNRESET:
			{
			// Remote host has reset the connection.
			// Ignore - seen these after Opera gets asked to receive a cookie.
			break;
			}
		default:
			{
			__ASSERT_DEBUG(EFalse, Panic(EWinSockPrtUnexpectedWSAReceiveCompletionError));
			}
		}
	Emulator::Escape(); // And return to how we were
	}
Example #14
0
/**
 *  Adds an event to the log database.
 *  
 *  @param aStatus Asynchronous status word to signal when the operation is complete
 *  @param aSmsMessage The SMS message that the event concerns
 *  @param aData SMS PDU information for the event
 *  @param aStatusId Optional string to include in the log message, specified by
 *  resource ID
 *  @capability WriteUserData
 */
EXPORT_C void CSmsEventLogger::AddEvent(TRequestStatus& aStatus,const CSmsMessage& aSmsMessage,const TLogSmsPduData& aData,TInt* aStatusId)
	{
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSEVENTLOGGER_ADDEVENT_1, "CSmsEventLogger::AddEvent");

	__ASSERT_DEBUG(iState==ESmsEventLoggerIdle,SmsuPanic(KSmsuPanicUnexpectedState));
	
	iState=ESmsEventLoggerAddingEvent;

	Queue(aStatus);

	iSmsPDUData=aData;
	iSmsPDUData.iType=aSmsMessage.Type();

	TRAPD(ret,DoAddEventL(aSmsMessage,aStatusId));
	if (ret!=KErrNone)
		{
		CompleteMyself(ret);
		}
	else
		{
		iLogWrapper->Log().AddEvent(*iLogEvent,iStatus);
		SetActive();
		}
	} // CSmsEventLogger::AddEvent
Example #15
0
/**
Send contact view event.

@leave KErrNotFound In debug mode only, if there is a queue error.
@leave KErrNotReady In debug mode only, if there is already an existing request still pending.
@leave KErrBadDescriptor If there is a error writing aEvent to the RMessage2 to be sent.
*/
void CViewSubSessionQueue::SendEventL(const TContactViewEvent& aEvent)
	{
	__ASSERT_DEBUG(!iQueueError,User::Leave(KErrNotFound));

	if (!iRequestPending)
		{
		return;
		}

   DEBUG_PRINTVN2(__VERBOSE_DEBUG__,_L("[CNTMODEL] CViewSubSessionQueue::SendEventL(): Q->:"), aEvent);

	TRAPD(err,iMessage.WriteL(KSlot0,TPckgC<TContactViewEvent>(aEvent)));
	if (err)
		{
		iRequestPending=EFalse;
		User::Leave(KErrBadDescriptor);//iMessage is completed in CCntSession::ServiceError()
		}
	else
		{
		iMessage.Complete(KErrNone);
		}

	iRequestPending=EFalse;
	}
Example #16
0
EXPORT_C void CEikScrollBarFrame::SetScrollBarVisibilityL(TScrollBarVisibility aHVisibility, TScrollBarVisibility aVVisibility)
// Set the visibility state for both scrollbars to be used when tiling
	{
	__ASSERT_DEBUG(this, SbfPanic(ENoScrollBarFrame));

    // Vertical scrollbar
	iV.iVisibility=aVVisibility;
    if (iV.iBar && TypeOfVScrollBar() == EDoubleSpan && aVVisibility==EOff)
        {
       	iScrollBarFrameFlags&=(~EDisplayVScrollBar);
        MakeSBarVisible(iV, EFalse);
        }

    // Horizontal scrollbar
    if (iExtension)
        {
    	iExtension->iH.iVisibility=aHVisibility;
        if (iExtension->iH.iBar && TypeOfHScrollBar() == EDoubleSpan && aHVisibility==EOff)
            {
       	    iScrollBarFrameFlags&=(~EDisplayHScrollBar);
            MakeSBarVisible(iExtension->iH, EFalse);
            }
        }
	}
void CATSmsReadPDU::Start(TTsyReqHandle /*aTsyReqHandle*/, TAny* aParams)	
/**
 * Virtual from CATSmsCommands.
 * This method called by CATBase::ExecuteCommand, therefore iEventSignalActive 
 * flow control is handled for us.
 *
 * Note that this class is not started as the result of a TSY client request but
 * started internally to the TSY. As a result the aTsyReqHandle will be 0 and invalid.
 * This class should never complete a client request.
 */
 	{
	LOCAL_LOGTEXT("Start","Enter function");
	__ASSERT_DEBUG(aParams,Panic(ESmsRxQueuePduReadNullParameter));

	// Save the parameter
	iClientItem=static_cast<CReceiveSmsQueue::TItem*>(aParams);

	// Request that the ETEL Server buffer up requests from the client
	// so that we can process them later, as opposed to them all completing with 
	// KErrInUse.
	iTelObject->FlowControlSuspend();


	// Send the first AT command to phone
	// Request that the phone select use the appropriate memory store

	// Have to convert the unicode string to a 8bit string.
	// KMaxMobileNameSize from EtelMM so this buffer will be big enough
	// for what we need.
//	TBuf8<RMobilePhone::KMaxMobileNameSize> buf8;		
	CATSmsUtils::ConvertStoreNameToPhoneVersion(iClientItem->iAttr.iStore,iStoreName);
	iTxBuffer.Format(KSetPrefMemCommandWithString,&iStoreName,&iStoreName); 
	iIo->Write(this,iTxBuffer);
	iIo->SetTimeOut(this,KATWriteTimeout);
	iState=ESetPhonesPrefMemory;
	}
// ---------------------------------------------------------------------------
// From class CActive
// Handles completion of receive. 
// ---------------------------------------------------------------------------
//
void CIkev1Receiver::RunL()
    {
    if ( iStatus.Int() == KErrNone )
        {
        __ASSERT_DEBUG( iUdpData != NULL,
                        User::Invariant() );
        
        const ThdrISAKMP* ikeHdr = ThdrISAKMP::Ptr( iUdpData->Des() );
        TInt msgLth = iUdpData->Length();
        
        // Ignore possible <non-ESP marker> in the beginning of IKE message.
        TUint32 ikeMsgHdrOctets = GET32( ikeHdr );
        if ( ikeMsgHdrOctets == NON_ESP_MARKER )
            {
            ikeHdr  = ikeHdr->GotoOffset( NON_ESP_MARKER_SIZE );
            msgLth -= NON_ESP_MARKER_SIZE;
            }
        
        iCallback.IkeMsgReceivedL( *ikeHdr, iSrcAddr, iLocalPort );                
        }
    else
        {
        iReceiving = EFalse;
        iCallback.ReceiveError( iStatus.Int() );
        }
    
    delete iUdpData;
    iUdpData = NULL;
    
    if ( iReceiving &&
         iStatus.Int() == KErrNone )
        {
        // Continue receiving.
        DoReceive();
        }
    }
TInt CSecurityDispatcher::DispatchAbortSecurityCodeL(const CMmDataPackage* aDataPackage)
/**
 * Unpack data related to EMobilePhoneAbortSecurityCode
 * and pass request on to Licensee LTSY.
 *
 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if
 * the Licensee LTSY does not support this request.
 */
	{
	TSYLOGENTRYEXIT;
	TInt ret = KErrNotSupported;

   __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr));

	// Call Handle... method in Licensee LTSY
	if (iLtsyDispatchSecurityAbortSecurityCode)
		{
		RMobilePhone::TMobilePhoneSecurityCode secCode;
		aDataPackage->UnPackData(secCode);
		ret = iLtsyDispatchSecurityAbortSecurityCode->HandleAbortSecurityCodeReqL(secCode);				
		}

	return TSYLOGSETEXITERR(ret);
	} // CSecurityDispatcher::DispatchAbortSecurityCodeL
TInt CBulkOnlyTransport::ProcessOutTransferL(TUint32& aDataReceived)
{
    __MSFNLOG
    aDataReceived = 0;
    // process 13 cases

    __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataOut, User::Invariant());

    // Ho - Host expects to send data to the device
    if (!iCsw.IsValidCsw(iCbw.iTag))
    {
        __BOTPRINT(_L("BOT CSW Invalid"));
        DoResetRecovery();
        User::Leave(KErrGeneral);
    }
    if (!iCsw.IsMeaningfulCsw(iCbw.iDataTransferLength))
    {
        __BOTPRINT(_L("BOT CSW not meaningful"));
        DoResetRecovery();
        User::Leave(KErrGeneral);
    }

    if (iCsw.iStatus == TBotCsw::EPhaseError)
    {
        __BOTPRINT(_L("BOT Phase Error"));
        // Case (10) or (13)
        // Reset Recovery
        DoResetRecovery();
        User::Leave(KErrGeneral);
    }

    // all ok if here
    // Case (9), (11) or (12)
    aDataReceived = iCbw.iDataTransferLength - iCsw.iDataResidue;
    return (iCsw.iStatus == TBotCsw::ECommandPassed) ? KErrNone : KErrCommandFailed;
}
// ---------------------------------------------------------
//  CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL
// ---------------------------------------------------------
//
void CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL( 
        TInt aResourceId, TBool aNotificationDialog )
    {
    __LOGMETHODSTARTEND( EPhoneUIStates, 
        "CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL()" );
    __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
    TPhoneCmdParamBoolean globalNotifierParam;
    globalNotifierParam.SetBoolean( EFalse );
    iViewCommandHandle.ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
        &globalNotifierParam );
        
    TPhoneCmdParamGlobalNote globalNoteParam;
    TPhoneNotificationType type = aNotificationDialog ? 
            EPhoneNotificationDialog : EPhoneMessageBoxInformation;
    globalNoteParam.SetType( type );
    globalNoteParam.SetTextResourceId( 
        CPhoneMainResourceResolver::Instance()->
        ResolveResourceID( aResourceId ) );
    globalNoteParam.SetNotificationDialog( aNotificationDialog );
    globalNoteParam.SetToneType( EPhoneErrorTone );
    iViewCommandHandle.ExecuteCommandL( 
        EPhoneViewShowGlobalNote, &globalNoteParam );

    }
//-----------------------------------------------------------------------------
// CCFContextSubscriptionImpl::EvaluateContextChangeL
//-----------------------------------------------------------------------------
//
EXPORT_C void CCFContextSubscriptionImpl::EvaluateContextChangeL(
    const CCFContextObject& aNewContext,
    CCFContextDataObject& aData,
    TBool aValueChanged ) const
{
    FUNC_LOG;

    __ASSERT_DEBUG( iSubscriptionListener, Panic( ENoListenerSet ) );

    if( NotificationNeeded( aNewContext, aValueChanged ) )
    {
        CCFContextIndicationImpl* indication =
            CCFContextIndicationImpl::NewLC( aData.Uid() );
        indication->SetContextL( aNewContext );

        // If data object associated and it is required by the subscriber, add
        // it in the context indication.
        if( iDataObjectEnabled )
        {
            // Stream data object
            HBufC8* data = HBufC8::NewLC( aData.Size() );
            TPtr8 dataPtr( data->Des() );
            RDesWriteStream writeStream( dataPtr );
            writeStream.PushL();
            aData.ExternalizeL( writeStream );
            writeStream.CommitL();
            indication->SetDataObject( data );

            // Clean up
            CleanupStack::PopAndDestroy( &writeStream );
            CleanupStack::Pop( data );
        }
        iSubscriptionListener->ContextIndicationL( indication );
        CleanupStack::Pop( indication );
    }
}
Example #23
0
EXPORT_C TInt RSoundPlugIn::Construct(TUid aUid)
/** Second phase constructor. 

Creates the server side resource and initialises the client's handle to it. 

This function always causes a flush of the window server buffer.

@param aUid Optional UID. This can be ignored unless you intend to use the CommandReply() 
function. If you do intend to use CommandReply(), this should be the plug-in DLL's third 
UID. CommandReply() will return the value ESoundWrongPlugIn if the plug-in DLL identified 
by this UID is not loaded.
@return KErrNone if the function was successful, otherwise one of the system wide error 
codes. 
@panic TW32Panic 17 in debug builds if called on an already constructed object.*/
	{
	__ASSERT_DEBUG(iWsHandle == KNullHandle, Panic(EW32PanicGraphicDoubleConstruction));
	TInt ret;
	if ((ret=iBuffer->WriteReplyWs(&aUid,sizeof(aUid),EWsClOpCreateClick))>=0)
		{
		iWsHandle=ret;
		ret=KErrNone;
		}
	return(ret);
	}
TPtrC8 CIPSecDialogNotifier::UpdateL( const TDesC8& /*aBuffer*/ )
	{
	__ASSERT_DEBUG( EFalse, User::Panic( _L( "UpdateL not used" ), 0 ) );
	return NULL;
	}
Example #25
0
void CActiveConsole::RequestCharacter()
	{
	__ASSERT_DEBUG(!IsActive(), User::Panic(_L("CActiveConsole::RequestCharacter()"), KRequestPending));
	iConsole->Read(iStatus);
	SetActive();
	}
TPtrC8 CIPSecDialogNotifier::StartL( const TDesC8& /*aBuffer*/ )
	{
	__ASSERT_DEBUG( EFalse, User::Panic( _L( "Synchronous StartL not used" ), 0 ) );
	return NULL;
	}
void CWspCOTransaction::MethodAbortInd(TWspReason aReason)
	{
	__ASSERT_DEBUG( iMethodState != ENullMethod, Panic(KWspPanicBadMethodState) );

	__LOG1(_L("Trans %d - Received S-MethodAbort.ind"), Transaction().Id());
	__LOG1(_L("---Abort reason : %d"), aReason);

	// Cancel any pending primitives that are waiting to be sent
	iPrimitiveSender->Cancel();
	if( iFinalResPending )
		{
		// Reset the final .res pending flag
		iFinalResPending = EFalse;

		// Need to inform observer that this method has sent the final .res 
		// primitive.
		iObserver.NotifyMethodComplete();
		}

	// The method has been aborted - check to see if the client initiated the 
	// abort or not.
	if( !iClientMethodAbort )
		{
		__LOG(_L("---Method was aborted by the proxy - need to  inform the client."));

		// The method was NOT aborted by the client - need to fail the 
		// transaction. Check the abort reason for EOutOfMemory.
		THTTPEvent event = THTTPEvent::EFailed;
		if( aReason == EOutOfMemory )
			{
			// Send KErrNoMemory event - the validation filter will ensure an 
			// EFailed event is also sent.
			event = KErrNoMemory;
			}
		TRAPD(err, Transaction().SendEventL(event,
											THTTPEvent::EIncoming,
											THTTPFilterHandle::EProtocolHandler));

		// Get the protocol handler to deal with the method abort.
		iObserver.HandleMethodAbort(*this);				

		// If the event could not be sent, we must take more drastic action.  Note that
		// this _must_ follow the observer's handling of method abort, since the use
		// of RHTTPTransaction::Fail() is drastic, and could result in the whole
		// transaction having been deleted by the time we get back here.
		if (err != KErrNone)
			Transaction().Fail(THTTPFilterHandle::EProtocolHandler);
		}

	// WSP method transaction is now Null - update state
	iMethodState = ENullMethod;

	__LOG(_L("---Method in Null state"));

	// Check to see if the client has closed the transaction. In this case the
	// suicide flag is set and need to self-destruct.
	if( iSuicide )
		{
		__LOG(_L("---Transaction has been closed - suiciding!"));

		// Transaction is closed - self-destruct
		delete this;
		}
	}
void CWspCOTransaction::CreateRxDataL(MRxDataObserver& aObserver)
	{
	__ASSERT_DEBUG( iRxData == NULL, Panic(KWspPanicRxDataObjectNotReset) );

	iRxData = CWspCORxData::NewL(*this, aObserver, *this);	
	}
void CWspCOTransaction::CreateTxDataL()
	{
	__ASSERT_DEBUG( iTxData == NULL, Panic(KWspPanicTxDataObjectNotReset) );

	iTxData = CWspCOTxData::NewL(*this, *this, iNegotiatedCapInfo);
	}
Example #30
0
EXPORT_C void CImOperationQueueList::ExpungeDeletedOperationsL()
//
// Remove the queued operations that were marked as deleted from the folder stores.
//
	{
    // First sort so that each store only has to be visited once, and queued operations
    // can be deleted back-to-front. Starting at the back leaves the other delete commands
    // valid.
    TQueuedOperationKey key(*iDeletedList);
	TQueuedOperationSwap swap(*iDeletedList);
	User::QuickSort(iDeletedList->CountOperations(),key,swap);

    // Current folder being updated
    TMsvId lastFolderRead = KMsvNullIndexEntryId;
    // list holds the list of queued operations for the current folder
    CImQueuedList *list = CImQueuedList::NewL();
	CleanupStack::PushL(list);

	TInt line;

	TInt nr = iDeletedList->CountOperations();
	for ( line = 0 ; line < nr; line ++ )
		{
		// Get item to delete
		TQueuedOperation toDelete;
        toDelete.CopyL((*iDeletedList)[ 0 ]);
		iDeletedList->Delete(0);

		// See if item belongs to different folder.
		if (lastFolderRead != toDelete.FolderId())
			{
			// Store changes to previous list
			if (lastFolderRead != KMsvNullIndexEntryId)
				{
				StoreQueuedListL(*list);
				}
 
			// go to folder to delete item from.
			iServiceEntry->SetEntryL(toDelete.FolderId());
			__ASSERT_DEBUG( iServiceEntry->Entry().iMtm  == KUidMsgTypeIMAP4, gPanic(EOffOpBadMtmTypeUid));
			__ASSERT_DEBUG(iServiceEntry->Entry().iType == KUidMsvFolderEntry, gPanic(EOffOpEntryShouldBeFolder));

            // Initialise for the next folder
			lastFolderRead = toDelete.FolderId();
			// Get the list of queued operations
			list->Reset();
			RestoreQueuedListL(*list);
			}

        // Sanity check: the data contained in toDelete should be EXACTLY the same as 
        // the queued operation it refers to (as retrieved from the folder)
        if (toDelete != (*list)[ toDelete.OperationIndex() ])
			{
			gPanic(EOffOpListOutOfSync);
			continue;
			}

        // Undo changes made in server to reflect the disconnected operation.
		iUndoOffline->UndoOffLineChangesL(toDelete.Operation(), toDelete.FolderId());
		// Delete queued operation from list
        list->Delete(toDelete.OperationIndex());
		}

	// Store changes to last folder.
	if (lastFolderRead != KMsvNullIndexEntryId)
		{
		StoreQueuedListL(*list);
		}
	CleanupStack::PopAndDestroy(); //list
    }