void CxeCameraDeviceControlSymbian::handleReserveComplete(int error)
{
    CX_DEBUG_ENTER_FUNCTION();
    OstTrace0( camerax_performance, CXECAMERADEVICECONTROLSYMBIAN_HANDLERESERVECOMPLETE, "msg: e_CX_RESERVE 0" );

    if(state() == PendingRelease) {
        release();
    } else {
        if (!error) {
            powerOn();
        } else {
            emit initModeComplete(CxeErrorHandlingSymbian::map(error));
            setState(Idle);
        }
    }

    CX_DEBUG_EXIT_FUNCTION();
}
// ---------------------------------------------------------------------------------
// CUpnpTmClientProfileService::GetMaxNumProfilesActionL
// @param aAction pointer to action object
// @return Returns upnp error code
// ---------------------------------------------------------------------------------
//
TUpnpErrorCode CUpnpTmClientProfileService::GetMaxNumProfilesActionL( CUpnpAction* aAction )
{
    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL_ENTRY );
    TUint profileCount;
    TTerminalModeErrorCode ret = iTmServerImpl.GetMaxNumProfiles( profileCount );
    if ( ret != ETerminalModeSuccess )
    {
        OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL, "CUpnpTmClientProfileService::GetMaxNumProfilesActionL" );
        return TUpnpErrorCode( ret );
    }
    OstTrace1( TRACE_NORMAL, CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL, "CUpnpTmClientProfileService::GetMaxNumProfilesActionL;profileCount=%d", profileCount );
    TBuf8<UpnpString::KMaxTUintLength> countBuf;
    countBuf.Num(profileCount);

    aAction->SetArgumentL( KNumProfilesAllowed, countBuf );
    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL_EXIT );
    return EHttpOk;
}
/**
 * Start observing the connection stage changes.
 */
void CNcmDhcpNotifWatcher::StartL()
	{
	OstTraceFunctionEntry0( CNCMDHCPNOTIFWATCHER_START_ENTRY );
	    
	if(!IsActive())
	    {
        iNcmInteralSvr.DhcpProvisionNotify(iStatus);
        SetActive();
	    }
	else
	    {
	    // Report this to NCM connection manager
	    OstTrace0( TRACE_FATAL, CNCMDHCPNOTIFWATCHER_STARTL, "DHCP notifier already actived!" );
	    User::Leave(KErrInUse);
	    }
    
	OstTraceFunctionExit0( CNCMDHCPNOTIFWATCHER_START_EXIT );
	}
Example #4
0
void CAcmWriter::WriteCancel()
/**
 * Cancel a write.
 */
{
    OstTraceFunctionEntry0( CACMWRITER_WRITECANCEL_ENTRY );
    // Cancel any outstanding request on the LDD.
    if ( iPort.Acm() )
    {
        OstTrace0( TRACE_NORMAL, CACMWRITER_WRITECANCEL, "CAcmWriter::WriteCancel;\tiPort.Acm() exists- calling WriteCancel on it" );
        iPort.Acm()->WriteCancel();
    }

    // Reset our flag to say there's no current outstanding request. What's
    // already in our buffer can stay there.
    iCurrentRequest.iClientPtr = NULL;
    OstTraceFunctionExit0( CACMWRITER_WRITECANCEL_EXIT );
}
Example #5
0
// given a ptr to a parser, fetch a tag - or zero
TUint CParserList::TagForThisParser(const MParser *const aParser) const
	{
	TUint tagIndex = 0;
	for (TInt count = 0; count < iNumberInList; count++)
		{
		if (aParser == iParserList[count]->Parser())
			{
			tagIndex = iParserList[count]->TagIndex();
			break;
			}
		}
	if (!tagIndex)
	    {
	    OstTrace0( TRACE_DUMP, CPARSERLIST_TAGFORTHISPARSER, "EParserNoSuchTag" );
	    }
	__ASSERT_DEBUG(tagIndex, Panic(EParserNoSuchTag));
	return tagIndex;
	}
void CMTPFSEnumerator::RunL()
{
    OstTraceFunctionEntry0( CMTPFSENUMERATOR_RUNL_ENTRY );
    if(iSkipCurrentStorage)
    {
        OstTrace0( TRACE_NORMAL, CMTPFSENUMERATOR_RUNL, "RunL - iSkipCurrentStorage - ETrue." );
        iSkipCurrentStorage = EFalse;
        ScanNextStorageL();
    }
    else if (iEntries.Count() == 0)
    {
        // No entries to process, scan next dir or storage
        ScanNextL();
    }
    else if (iFirstUnprocessed < iEntries.Count())
    {
        ProcessEntriesL();

        // Complete ourselves with current TRequestStatus
        // since we need to run again to either scan a new dir or drive
        // or process more entries
        TRequestStatus* status = &iStatus;
        User::RequestComplete(status, iStatus.Int());
        SetActive();
    }
    else
    {
        switch (iStatus.Int())
        {
        case KErrNone:
            // There are still entries left to be read
            ScanDirL();
            break;

        case KErrEof:
        // There are no more entries
        default:
            // Error, ignore and continue with next dir
            ScanNextL();
            break;
        }
    }
    OstTraceFunctionExit0( CMTPFSENUMERATOR_RUNL_EXIT );
}
// ---------------------------------------------------------
// CDpDte2Tx::WriteTx
// This method puts write pending and signals itself
// (Dte2Tx).
// ---------------------------------------------------------
//
TInt CDpDte2Tx::WriteTx(
    const TAny* aClientBuffer,
    const TInt aLength)
    {
    OstTrace0( TRACE_NORMAL, CDPDTE2TX_WRITETX, "CDpDte2Tx::WriteTx" );
    OstTrace1( TRACE_NORMAL, DUP1_CDPDTE2TX_WRITETX, "CDpDte2Tx:: Port: %u", iDataPort.PortUnit() );

    LOGM1("CDpDte2Tx::WriteTx - Port %d", iDataPort.PortUnit() );

    TInt ret( KErrNone );

    if ( iWritePending )
        {
        //double write
        ret = KErrWrite;
        }
    else if ( 0 > aLength  )
        {
        //underflow
        ret = KErrArgument;
        }
    else if ( 0 != aLength )
        {
        // store pointer of client buffer
        iPendingClientBuffer = ( TAny* ) aClientBuffer;
        iPendingLength = aLength;

        iWritePending = ETrue;

        if ( !IsActive() )
            {
            iRequestActive = ETrue;
            iStatus = KRequestPending;
            SetActive();
            }
        //no else

        iDataPort.SignalDte2Tx();
        ret = KErrNotReady;
        }

    return ret;
    }
Example #8
0
/*!
    Tests if CmManagerShim has been created successfully
    earlier. If not, it retries.
 */
bool CpIapItem::isCmManagerAvailable()
{
    OstTraceFunctionEntry0(CPIAPITEM_ISCMMANAGERAVAILABLE_ENTRY);
    bool retval = false;
    if (mCmm == NULL) {
        try {
            mCmm = new CmManagerShim();
            retval = true;
        }
        catch (const std::exception&) {
            OstTrace0(TRACE_NORMAL, CPIAPITEM_ISCMMANAGERAVAILABLE, "CpIapItem::isCmManagerAvailable: Exception caught");
            mCmm = NULL;
        }
    } else {
        retval = true;
    }
    OstTraceFunctionExit0(CPIAPITEM_ISCMMANAGERAVAILABLE_EXIT);
    return retval;
}
void CUT_PBASE_T_USBDI_0479::HostRunL()
	{
	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_HOSTRUNL_ENTRY, this );
	// Obtain the completion code
	TInt completionCode(iStatus.Int());
	
	if(completionCode == KErrNone)
		{
		// Action timeout
		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_HOSTRUNL, "<Error> Action timeout");
		TestFailed(KErrTimedOut);
		}
	else
		{
		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
		TestFailed(completionCode);
		}
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_HOSTRUNL_EXIT, this );
	}
void CCdcDataInterface::NotifyDataAvailableCompleted(TInt aError)
/**
 * Called by the active data available notifier object when it completes.
 *
 * @param aError Error.
 */
	{
	OstTraceFunctionEntry0( CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_ENTRY );
	OstTrace1( TRACE_NORMAL, CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED, 
			"CCdcDataInterface::NotifyDataAvailableCompleted;aError=%d", aError );	
	
	// See comment in WriteCompleted.
	MNotifyDataAvailableObserver* temp = iNotifyDataAvailableObserver;
	iNotifyDataAvailableObserver = NULL;
	OstTrace0( TRACE_NORMAL, CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_DUP1, 
			"CCdcDataInterface::NotifyDataAvailableCompleted;\tcalled NotifyDataAvailableCompleted on observer" );
	temp->NotifyDataAvailableCompleted(aError);
	OstTraceFunctionExit0( CCDCDATAINTERFACE_NOTIFYDATAAVAILABLECOMPLETED_EXIT );
	}
//------------------------------------------------------------------------------
// CAddBuffer::AddNodeToBuffer()
//------------------------------------------------------------------------------
void CAddBuffer::AddNodeToBufferL( const TDesC8& aUri, 
                                   const TDesC8& aLUID,
                                   const TDesC8& aObject,
                                   const TInt    aStatusRef )
    {
    OstTraceExt1( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_LEAF_ENTRY, "ENTRY: CAddBuffer::AddNodeToBufferL;aUri=%s", aUri );
    
    CConnMoNodeElement* newNode = new (ELeave) CConnMoNodeElement();
    
    newNode->iUri.Copy( aUri );
    newNode->iParentLUID.Copy( aLUID );
    newNode->iObject.Copy( aObject );
    newNode->iStatusRef = aStatusRef;
    newNode->iProcessed = EFalse;
    newNode->iLeaf = ETrue;
    
    iBuffer.AppendL( newNode );
    OstTrace0( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_LEAF_EXIT, "EXIT: CAddBuffer::AddNodeToBufferL");
    }
 void CSignalIndReq::RunL() 
     {
    OstTrace0( TRACE_NORMAL, CSIGNALINDREQ_RUNL, "CSignalIndReq::RunL" );
    C_TRACE((_L("CSignalIndReq::RunL()")));
     if( iStatus.Int() == KErrNone || iStatus.Int() > 0 ) 
        {
        OstTrace1( TRACE_NORMAL, DUP1_CSIGNALINDREQ_RUNL, "CSignalIndReq::RunL - Completing with;iStatus.Int()=%d", iStatus.Int() );
        C_TRACE((_L("Completing with %d"), iStatus.Int()));
        iClient->SignalIndReceived( iStatus.Int() );
        iClient->SendReceiveSignalInd( iStatus );
        SetActive();
        }
     else
        {
        OstTrace1( TRACE_NORMAL, DUP2_CSIGNALINDREQ_RUNL, "CSignalIndReq::RunL -  delete;iStatus.Int()=%d", iStatus.Int() );
        C_TRACE((_L("CSignalIndReq RunL delete %d"), iStatus.Int()));
        delete this;
        }
     }
// -----------------------------------------------------------------------------
// CMmConferenceCallMessHandler::MapETelCallIdToISACallId
// Utility function that maps an ETel call id to a call id
// in ISA Call Server's format.
// -----------------------------------------------------------------------------
//
TUint8 CMmConferenceCallMessHandler::MapETelCallIdToISACallId(
    const TInt aETelCallId )
    {
TFLOGSTRING("TSY: CMmConferenceCallMessHandler::MapETelCallIdToISACallId");
OstTrace0( TRACE_NORMAL,  CMMCONFERENCECALLMESSHANDLER_MAPETELCALLIDTOISACALLID_TD, "CMmConferenceCallMessHandler::MapETelCallIdToISACallId" );

    TUint8 callId( CALL_MODEM_ID_NONE );

    if ( CALL_MODEM_ID_1 > aETelCallId || CALL_MODEM_ID_7 < aETelCallId )
        {
        callId = CALL_MODEM_ID_NONE;
        }
    else
        {
        callId = static_cast<TUint8>( aETelCallId );
        }

    return callId;
    }
// -----------------------------------------------------------------------------
// DDmcExtension::PowerDown
// Handles the powering down of the extension.
// -----------------------------------------------------------------------------
//
void DDmcExtension::PowerDown(TPowerState aTargetState)
    {
    OstTrace1(TRACE_ENTRY_EXIT, DDMC_POWERDOWN_ENTRY,
              "DMC:KERN_EXTEN: PowerDown() # IN - aTargetState: 0x%x", (TUint)(aTargetState));
    // TPowerState is printed only for debugging purpose. See the values in e32power.h.
    DMC_TRACE((("DMC:KERN_EXTEN: PowerDown() # IN - aTargetState: 0x%x "), aTargetState));

    if (NKern::CurrentContext() == NKern::EInterrupt)
        {
        iPowerDownDfcPtr->Add();
        }
    else
        {
        iPowerDownDfcPtr->Enque();
        }

    OstTrace0(TRACE_ENTRY_EXIT, DDMC_POWERDOWN_RETURN, "DMC:KERN_EXTEN: PowerDown() # OUT");
    DMC_TRACE(("DMC:KERN_EXTEN: PowerDown() # OUT"));
    }
Example #15
0
/*!         
   Constructor.
   
   @param[in] itemDataHelper Helper for connecting signals and slots.
   @param[in] iapId Unique ID if the access point this object represents.
   @param[in] iapName Name of the access point this object represents.
   @param[in] destId Unique ID of the destination that contains reference to 
              the access point this object represents.
   @param[in] bearerPlugin Pointer to the object that implements settings view
              for this access point.
 */
CpIapItem::CpIapItem(
    CpItemDataHelper &itemDataHelper,  
    int iapId, 
    const QString &iapName, 
    int destId,
    bool apProtected,
    CpBearerApPluginInterface *bearerPlugin) :
    CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
    mIapId(iapId), 
    mIapName(iapName),
    mDestId(destId),
    mItemDataHelper(&itemDataHelper),
    mBearerPlugin(bearerPlugin),
    mMoveOngoing(false),
    mDialog(0),
    mList(0)
{
    OstTraceFunctionEntry0(CPIAPITEM_CPIAPITEM_ENTRY);
    try {
        mCmm = new CmManagerShim();
    } catch (const std::exception&) {
        OstTrace0(TRACE_NORMAL, CPIAPITEM_CPIAPITEM, "CpIapItem::CpIapItem: Exception caught");
        mCmm = NULL;
    }
    
    // Fix connections
    itemDataHelper.removeConnection(this,SIGNAL(pressed()),this,SLOT(onLaunchView()));
    if (!apProtected) {
        itemDataHelper.addConnection(
            this,
            SIGNAL(longPress(QPointF)),
            this,
            SLOT(showItemMenu(QPointF)));
        itemDataHelper.addConnection(this,SIGNAL(clicked()),this,SLOT(onLaunchView()));
        itemDataHelper.addConnection(
            this,
            SIGNAL(visibleChanged()),
            this, 
            SLOT(updateIap()));
    }
    OstTraceFunctionExit0(CPIAPITEM_CPIAPITEM_EXIT);
}
// -----------------------------------------------------------------------------
// CMmConferenceCallMessHandler::CallReleaseResp
// Breaks a CALL_MODEM_RELEASE_RESP ISI-message. This handles the
// situation where Conference call releasing has failed.
// -----------------------------------------------------------------------------
//
void CMmConferenceCallMessHandler::CallReleaseResp(
    const TIsiReceiveC& aIsiMsg )
    {
TFLOGSTRING("TSY: CMmConferenceCallMessHandler::CallReleaseResp");
OstTrace0( TRACE_NORMAL,  CMMCONFERENCECALLMESSHANDLER_CALLRELEASERESP_TD, "CMmConferenceCallMessHandler::CallReleaseResp" );

    TUint sbStartOffSet( 0 );

    // Try to find CALL_MODEM_SB_CAUSE subblock. If found something has gone wrong
    if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
        ISI_HEADER_SIZE + SIZE_CALL_MODEM_RELEASE_RESP,
        CALL_MODEM_SB_CAUSE,
        EIsiSubBlockTypeId8Len8,
        sbStartOffSet ) )
        {
        // Get cause type
        TUint8 causeType( aIsiMsg.Get8bit(
            sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE ) );

        // Get cause value
        TUint8 causeValue( aIsiMsg.Get8bit(
            sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );

        // Get Symbian OS error value
        TInt result( CMmStaticUtility::CSCauseToEpocError(
            PN_MODEM_CALL,
            causeType,
            causeValue ) );

        // Complete conference call hangup
        if ( iReleaseCauseValueSent != causeValue )
            {
            // Error occurred. Route the error value up.
            iMessageRouter->Complete(
                EMobileConferenceCallHangUp,
                result );
            }
        // No else
        iReleaseCauseValueSent = 0;
        }
    // No else
    }
void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TUint32& aValue)
    {
    OstTraceFunctionEntry0( DUP1_CMTPPLAYBACKPROPERTY_GETDEFAULTPROPERTYVALUEL_ENTRY );
    switch(aProp)
        {
    case EMTPDevicePropCodeVolume:
        {
        if(iPlaybackVolumeData != NULL)
            {
            aValue = iPlaybackVolumeData->DefaultVolume();            
            }
        else
            {
            aValue = KMTPDefaultPlaybackVolume;
            }
        }
        break;
        
    case EMTPDevicePropCodePlaybackObject:
        {
        aValue = KMTPDefaultPlaybackObject;
        }
        break;
        
    case EMTPDevicePropCodePlaybackContainerIndex:
        {
        aValue = KMTPDefaultPlaybackIndex;
        }
        break;
        
    case EMTPDevicePropCodePlaybackPosition:
        {
        aValue = KMTPDefaultPlaybackPosition;
        }
        break;
        
    default:
        LEAVEIFERROR(KErrArgument, 
                                OstTrace0( TRACE_ERROR, DUP1_CMTPPLAYBACKPROPERTY_GETDEFAULTPROPERTYVALUEL, "Error argument" ));
        }
    OstTraceFunctionExit0( DUP1_CMTPPLAYBACKPROPERTY_GETDEFAULTPROPERTYVALUEL_EXIT );
    }
// ---------------------------------------------------------
// CDpDataBuffer::UsedBytes
// This method gets the amount of used bytes.
// Note that when virtual circular buffer has wrapped around
// there might be iTailWhenWrappedAround > 0 and therefore we
// have to notice that also in calculation. Normally
// iTailWhenWrappedAround == 0.
//
// In other words: When we have data in ebs (enhanced buffer
// space) we have to calculate it too. When
// iTailWhenWrappedAround>0 iTail==0.
//
// t     h               twr
// |     |              n |
// |-------pbs--------|--ebs--|
//
// ---------------------------------------------------------
//
TInt CDpDataBuffer::UsedBytes()
    {
    OstTrace0( TRACE_NORMAL, CDPDATABUFFER_USEDBYTES, "CDpDataBuffer::UsedBytes" );
    LOGM(" CDpDataBuffer::UsedBytes");
    TInt ret( 0 );

    if ( iHead != iTail  )
        {
        if ( iHead > ( iTail + iTailWhenWrappedAround )  )
            {
            ret = iHead - iTail;
            }
        else
            {
            ret = iEnd - iTail - iTailWhenWrappedAround + iHead;
            }
        }

    return ret;
    }
void CxeCameraDeviceControlSymbian::handlePowerOnComplete(int error)
{
    CX_DEBUG_ENTER_FUNCTION();
    OstTrace0(camerax_performance, CXECAMERADEVICECONTROLSYMBIAN_HANDLEPOWERONCOMPLETE, "msg: e_CX_POWER_ON 0");

    if(state() == PendingRelease) {
        release();
    } else {
        if (!error) {
            setState(Ready);
            emit deviceReady(); // this will trigger prepare for either still or video mode
        } else {
            setState(PendingRelease);
            release();
            emit initModeComplete(CxeErrorHandlingSymbian::map(error));
        }
    }

    CX_DEBUG_EXIT_FUNCTION();
}
    TInt CUT_PBASE_T_USBDI_1231::Interface1ResumedL(TAny* aPtr)
        {
        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_ENTRY, 0 );

        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP16, "====> Interface1ResumedL entry priority = %d", RThread().Priority());

        OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP17, "Interface 1 resumed");
        
        CUT_PBASE_T_USBDI_1231* self = reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr);
        
#ifdef OST_TRACE_COMPILER_IN_USE        
        TInt status = 
#endif        
        self->iInterface1Watcher->CompletionCode();
        
        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP18, "watcher 1 iStatus=%d",status);
                
        OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_EXIT, 0, KErrNone );
        return KErrNone;
        }
// -----------------------------------------------------------------------------
// CSatFlightModeStatus::NewL
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CSatFlightModeStatus* CSatFlightModeStatus::NewL
        (
        CSatMessHandler* aSatMessHandler,
        CTsySatMessaging* aSatMessaging
        )
    {
    OstTrace0( TRACE_NORMAL,  CSATFLIGHTMODESTATUS_NEWL_TD, "CSatFlightModeStatus::NewL" );
    TFLOGSTRING("TSY: CSatFlightModeStatus::NewL");

    CSatFlightModeStatus* self =
        new( ELeave ) CSatFlightModeStatus(
            aSatMessHandler,
            aSatMessaging );

    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );

    return self;
    }
void CMTPPbCmdParam::ConstructL(const CMTPPbCmdParam& aParam)
    {
    OstTraceFunctionEntry0( DUP4_CMTPPBCMDPARAM_CONSTRUCTL_ENTRY );
    TMTPPbDataType type(aParam.Type());

    __ASSERT_DEBUG((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), Panic(EMTPPBArgumentErr));
	__ASSERT_ALWAYS_OST((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), OstTrace0( TRACE_ERROR, CMTPPBCMDPARAM_CONSTRUCTL, "Error argument" ), User::Leave(KErrArgument));

    if(type == EMTPPbVolumeSet)
        {
        TMTPPbDataVolume* val = new (ELeave) TMTPPbDataVolume(aParam.VolumeSetL());
        CMTPPbParamBase::SetData(static_cast<TAny*>(val));
        CMTPPbParamBase::SetType(type);
        }
    else
        {
        CMTPPbParamBase::ConstructL(aParam);
        }
    OstTraceFunctionExit0( DUP4_CMTPPBCMDPARAM_CONSTRUCTL_EXIT );
    }
EXPORT_C void CHarvesterEventManager::ReleaseInstance()
    {
    WRITELOG( "CHarvesterEventManager::ReleaseInstance" );
    OstTrace0( TRACE_NORMAL, CHARVESTEREVENTMANAGER_RELEASEINSTANCE, "CHarvesterEventManager::ReleaseInstance" );
    
    CHarvesterEventManagerStaticData* data =
        static_cast<CHarvesterEventManagerStaticData*>( 
        		UserSvr::DllTls( KHarvesterEventManagerTLSKey ) );
    if ( data )
        {
        data->iRefCount--;
        if ( data->iRefCount <= 0 )
            {
            // destroy the singleton and free TLS
            delete data;
            data = NULL;
            UserSvr::DllFreeTls( KHarvesterEventManagerTLSKey );
            }
        }
    }
// -----------------------------------------------------------------------------
// CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener(
    MSAIscService& aAdaptation,
    RIscApi& aIscApi )
    : CActive( CActive::EPriorityStandard )
    , iAdaptation( aAdaptation )
    , iIscApi( aIscApi )
    {
    OstTraceExt2( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_1,
        "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener(0x%x,0x%x)",
        (TUint)&aAdaptation, (TUint)&aIscApi );
    INTERNAL_TRACE( ( 
        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener(0x%x,0x%x)" ), 
        &aAdaptation, &aIscApi ) );

    CActiveScheduler::Add( this );

    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_2,
        "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener - return void" );
    INTERNAL_TRACE( ( 
        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener - return void" ) ) );
    }
void CxeCameraDeviceControlSymbian::reserve()
{
    CX_DEBUG_ENTER_FUNCTION();
    CX_ASSERT_ALWAYS(mCameraDevice);

    if (state() == Idle) {
        setState(Initializing);
        //!@todo Temporary delay before reserving camera to avoid timing issues
        mReserveTimer.start(2000);
        OstTrace0(camerax_performance, CXECAMERADEVICECONTROLSYMBIAN_RESERVE, "msg: e_CX_RESERVE 1");
        CX_DEBUG(("HACK: Waiting for 2000ms before really doing reserve()"));
    } else if (state() == PendingRelease) {
        // if we get a reserve request and if there is a pending release
        // it is just fine to continue the init operation.
        setState(Initializing);
    } else {
        // nothing to do
    }

    CX_DEBUG_EXIT_FUNCTION();
}
TInt CNcmCommInterfaceSenderAndReceiver::Read(TRequestStatus& aStatus, TDes8& aBuf, TInt aLength)
    {
    OstTraceFunctionEntry1( CNCMCOMMINTERFACESENDERANDRECEIVER_READ_ENTRY, this );   
    OstTrace1( TRACE_NORMAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READ, "CNcmCommInterfaceSenderAndReceiver::Read length %d", aLength );
        
    iCompleteStatus = &aStatus;
    *iCompleteStatus = KRequestPending;
    if (iState != EIdle)
        {
        OstTrace0( TRACE_FATAL, CNCMCOMMINTERFACESENDERANDRECEIVER_READ_DUP1, "CNcmCommInterfaceSenderAndReceiver Read In Use" );
        OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READ_EXIT, this );
        return KErrInUse;
        }
    iReceiveBuf = &aBuf;
    iReceiveBuf->Zero();
    iToReceiveLength = aLength;
    iState = EReceiving;
    ReadData();
    OstTraceFunctionExit1( CNCMCOMMINTERFACESENDERANDRECEIVER_READ_EXIT_DUP1, this );
    return KErrNone;
    }
// ---------------------------------------------------------
// CDpMif::~CDpMif
// Destructor
// ---------------------------------------------------------
CDpMif::~CDpMif()
    {
    OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_CDPMIF, "CDpMif::~CDpMif" );
    LOGM(" CDpMif::~CDpMif");

    if ( iMsgReceiveBuffer )
        {
        delete iMsgReceiveBuffer;
        }
    //no else
    iMsgReceiveBuffer = NULL;
    iReceiveMessage.Set( NULL, 0, 0 );

    if ( iMessageSendBuffer )
        {
        delete iMessageSendBuffer;
        }
    //no else
    iMessageSendBuffer = NULL;
    iSendMessage.Set( NULL, 0, 0 );
    }
// ---------------------------------------------------------
// CDpPif::InitiatePipe
// This method registers DataPort to Name Service.
// ---------------------------------------------------------
//
TInt CDpPif::InitiatePipe(
    const TUint aUnit )
    {
    OstTrace0( TRACE_NORMAL, CDPPIF_INITIATEPIPE, "CDpPif::InitiatePipe" );
    OstTrace1( TRACE_NORMAL, DUP1_CDPPIF_INITIATEPIPE, "CDpPif:: Port: %u", aUnit );

    LOGM1(" CDpPif::InitiatePipe - Port %d", aUnit );

    TInt ret( KErrNone );

    if ( !iPepRegistered )
        {
        // pep_register

        TRAP( ret, iDataPort.Mif().SendNameAddReqL( aUnit ) );

        if ( KErrNone == ret )
            {
            // set active
            if ( !IsActive() )
                {
                iStatus = KRequestPending;
                SetActive();
                }
            //no else

            iPepRegistered = ETrue;
            // state_change
            iPifState = EDpPifRegister;
            }
        //no else
        }
    else
        {
        // registered pipe already exists
        ret = KErrAlreadyExists;
        }

    return ret;
    }
// -----------------------------------------------------------------------------
// CSatTimer::RestartTimer
// Restarts the inactive timer with specified id
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CSatTimer::RestartTimer
        (
        TInt aTimerId
        )
    {
    OstTrace0( TRACE_INTERNALS,  CSATTIMER_RESTARTTIMER_TD, "CSatTimer::RestartTimer" );
    TFLOGSTRING("TSY: CSatTimer::RestartTimer");
    TInt ret( KErrNone );

    // Find timer from TimerTable
    TTimer helper( aTimerId, 0, 0 );
    TInt index = iTimerTable->Find( helper, TTimer::CompareEntries );

    if ( KErrNotFound != index )
        {
        // Reactivate timer if proactive command is not ongoing, otherwise
        // set state to witing for terminal response
        if ( iProactiveCommandOnGoing )
            {
            ( *iTimerTable )[index].SetState( TTimer::EWaitingForTr );
            }
        else
            {
            ( *iTimerTable )[index].SetState( TTimer::ETicking );
            }

        // Start clock
        Start();
         }
    else
        {
        TFLOGSTRING2("TSY: CSatTimer::ReStart - Requested ID (%d) not found!",
            aTimerId);
        OstTrace1( TRACE_INTERNALS,  DUP1_CSATTIMER_RESTARTTIMER_TD, "CSatTimer::RestartTimer - Requested ID (%d) not found!", aTimerId );

        ret = KErrNotFound;
        }

    return ret;
    }
// ---------------------------------------------------------
// CDpMif::SendMessage
// Send ISI message, given resource, transaction id,
// message id and message.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CDpMif::SendMessage(
    TUint8 aResource,
    TUint8 aTransactionId,
    TUint8 aMessageId,
    const TDesC8& aMessage )
    {
    OstTrace0( TRACE_NORMAL, CDPMIF_SENDMESSAGE, "CDpMif::SendMessage" );
    OstTrace1( TRACE_NORMAL, DUP2_CDPMIF_SENDMESSAGE, "CDpMif:: Port: %u", iDataPort.PortUnit() );
    OstTraceExt1( TRACE_NORMAL, DUP3_CDPMIF_SENDMESSAGE, "CDpMif:: ==> resource: 0x%hhx", aResource );
    OstTraceExt1( TRACE_NORMAL, DUP4_CDPMIF_SENDMESSAGE, "CDpMif:: ==> tra id: 0x%hhx", aTransactionId );
    OstTraceExt1( TRACE_NORMAL, DUP5_CDPMIF_SENDMESSAGE, "CDpMif:: ==> msg id: 0x%hhx", aMessageId );

    LOGM1(" CDpMif::SendMessage - Port %d", iDataPort.PortUnit() );
    LOGM1("  ==> resource: 0x%x", aResource );
    LOGM1("  ==> tra id: 0x%x", aTransactionId );
    LOGM1("  ==> msg id: 0x%x", aMessageId );

    // We shall use send buffer
    iSendMessage.Zero();
    TIsiSend msg( iSendMessage );
    msg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, aResource );
    msg.Set8bit( ISI_HEADER_OFFSET_TRANSID, aTransactionId );
    msg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, aMessageId );
    // Copy message data (+2 => after msgid and traid)
    msg.CopyData( ISI_HEADER_SIZE + 2, aMessage );

    // Add paddings
    while ( iSendMessage.Length() % 4 )
        {
        iSendMessage.Append( 0x00 );
        }
    OstTrace1( TRACE_NORMAL, DUP6_CDPMIF_SENDMESSAGE, "CDpMif:: ==> message length: %d", iSendMessage.Length() );
    OstPrintIsiMessage( iSendMessage );

    LOGM1("  ==> message length: %d", iSendMessage.Length() );
    LOGMESSAGE( iSendMessage );

    return iDataPort.ISAHandle().Send( msg.Complete() );
    }