示例#1
0
/**
Function to initialize the phone settings
@return TBool
*/
TBool CMBMSEngine::InitialisePhoneL()
	{
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
	CMDBSession* dbSession = CMDBSession::NewL(KCDVersion1_2);
#else
	CMDBSession* dbSession = CMDBSession::NewL(KCDVersion1_1);
#endif
    CleanupStack::PushL(dbSession);

	CMDBRecordSet<CCDGlobalSettingsRecord> globalSettingsRecord(KCDTIdGlobalSettingsRecord);
    TRAPD(err, globalSettingsRecord.LoadL(*dbSession));
    if(err != KErrNone)
      {
      User::Leave(KErrNotFound);
      }

    CCDModemBearerRecord *modemBearerRecord = static_cast<CCDModemBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord));
    CleanupStack::PushL(modemBearerRecord);

    modemBearerRecord->SetRecordId(((CCDGlobalSettingsRecord*)globalSettingsRecord.iRecords[0])->iModemForPhoneServicesAndSMS);
    TRAPD(err1,modemBearerRecord->LoadL(*dbSession));

    if(err1 != KErrNone)
      {
      User::Leave(KErrNotFound);
      }

    TName tsyName;
    tsyName = modemBearerRecord->iTsyName;
    //leave if not able to read Tsy name.
    if(tsyName.Length() == 0)
	  {
      User::Leave(KErrNotFound);
	  }

    CleanupStack::PopAndDestroy(modemBearerRecord);
    CleanupStack::PopAndDestroy(dbSession);

    User::LeaveIfError(iTelServer.Connect());
	User::LeaveIfError(iTelServer.LoadPhoneModule(tsyName));
	User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended));

	//Open telephony server
	GetPhoneInfoL(iTelServer,tsyName,iPhoneInfo);

	//Open phone
	User::LeaveIfError(iPhone.Open(iTelServer,iPhoneInfo.iName));
	//Get phone status
	User::LeaveIfError(iPhone.GetStatus(iPhoneStatus));

	SetActive();
	iPhoneState = EInitialising;

	TRequestStatus* status = &iStatus;
	User::RequestComplete(status, KErrNone);

	return ETrue;
	}
TMemSpyDriverChunkType DMemSpyDriverLogChanChunks::IdentifyChunkType( DChunk& aChunk )
    {
    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - START" ) );

    TMemSpyDriverChunkType ret = EMemSpyDriverChunkTypeUnknown;

    TName name;
    aChunk.Name( name );
    TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - name: %S", &name ) );

    DMemSpyDriverOSAdaptionDChunk& chunkAdaption = OSAdaption().DChunk();
    const TChunkType type = chunkAdaption.GetType( aChunk );

    if  ( name == KMemSpyLitDllDollarData )
        {
        // This chunk contains Dll Global Data for the process
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeGlobalData" ) );
        ret = EMemSpyDriverChunkTypeGlobalData;
        }
    else if ( type == ERamDrive )
        {
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeRamDrive" ) );
        ret = EMemSpyDriverChunkTypeRamDrive;
        }
    else if ( type == EKernelStack )
        {
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeStackKernel" ) );
        ret = EMemSpyDriverChunkTypeStackKernel;
        }
    else if ( name == KMemSpyLitDollarDat )
        {
        // This chunk contains process global data as well as user-side stacks for
        // the process. 
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeStackAndProcessGlobalData" ) );
        ret = EMemSpyDriverChunkTypeStackAndProcessGlobalData;
        }
    else if ( name == KMemSpyLitDollarGlobalCode && type == EDll )
        {
        // GLOBAL$CODE is used for RAM loaded code which is globally visible. This
        // basically means locale DLLs - these must be visible to every process, even
        // those which haven't loaded them.        
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCodeGlobal" ) );
        ret = EMemSpyDriverChunkTypeCodeGlobal;
        }
    else if ( name == KMemSpyLitDollarCode || type == EKernelCode || type == EDll || type == EUserCode )
        {
        // RAM-loaded code, which on the multiple memory model at least means that the code chunk is eseentially just a mapping
        // artifact. The RAM itself is owned by the code segment, therefore counting the size of these CODE elements may result
        // in inaccurate results if the code is shared amongst multiple processes.
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCode" ) );
        ret = EMemSpyDriverChunkTypeCode;
        }
    else if ( type == EUserSelfModCode )
        {
        // Dynamically create code chunk
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeCodeSelfModifiable" ) );
        ret = EMemSpyDriverChunkTypeCodeSelfModifiable;
        }
    else if ( IsHeapChunk( aChunk, name ) )
        {
        // Catch kernel heap too
        if  ( type == EKernelData )
            {
            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeHeapKernel" ) );
            ret = EMemSpyDriverChunkTypeHeapKernel;
            }
        else
            {
            TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeHeap" ) );
            ret = EMemSpyDriverChunkTypeHeap;
            }
        }
    else if ( type == EUserData && chunkAdaption.GetOwningProcess( aChunk ) == NULL )
        {
        // Global shared chunks match this pattern. Of course, we could check the memory model mapping attributes
        // as that would give us the info in a heartbeat, but it's too specific.
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeGlobal" ) );
        ret = EMemSpyDriverChunkTypeGlobal;
        }
    else if ( type == EUserData && chunkAdaption.GetOwner( aChunk ) != NULL && name.Length() > KMemSpyLitLocalObject().Length() && name.Left( KMemSpyLitLocalObject().Length() ) == KMemSpyLitLocalObject )
        {
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeLocal" ) );
        ret = EMemSpyDriverChunkTypeLocal;
        }
    else
        {
        TRACE( Kern::Printf("DMemSpyDriverLogChanChunks::IdentifyChunkType() - EMemSpyDriverChunkTypeUnknown" ) );
        TRACE( PrintChunkInfo( aChunk ) );
        ret = EMemSpyDriverChunkTypeUnknown;
        }

    return ret;
    }