radioengine/utils/src/cradioenginetls.cpp
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 14 63aabac4416d
parent 28 075425b8d9a4
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
    40 
    40 
    41 // ---------------------------------------------------------------------------
    41 // ---------------------------------------------------------------------------
    42 //
    42 //
    43 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
    44 //
    44 //
    45 void CRadioEngineTls::InitializeL( CCoeEnv* aEnv, RFs* aFs )
    45 void CRadioEngineTls::InitializeL( RFs* aFs )
    46     {
    46     {
    47     if ( !UserSvr::DllTls( KUidRadioEngineTls ) )
    47     if ( !UserSvr::DllTls( KUidRadioEngineTls ) )
    48         {
    48         {
    49         CRadioEngineTls* self = new ( ELeave ) CRadioEngineTls( aEnv, aFs );
    49         CRadioEngineTls* self = new ( ELeave ) CRadioEngineTls( aFs );
    50         CleanupStack::PushL( self );
    50         CleanupStack::PushL( self );
    51         self->ConstructL();
    51         self->ConstructL();
    52         User::LeaveIfError( UserSvr::DllSetTls( KUidRadioEngineTls, self ) );
    52         User::LeaveIfError( UserSvr::DllSetTls( KUidRadioEngineTls, self ) );
    53         CleanupStack::Pop( self );
    53         CleanupStack::Pop( self );
    54         }
    54         }
    57 
    57 
    58 // ---------------------------------------------------------------------------
    58 // ---------------------------------------------------------------------------
    59 //
    59 //
    60 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
    61 //
    61 //
    62 CRadioEngineTls::CRadioEngineTls( CCoeEnv* aEnv, RFs* aFs )
    62 CRadioEngineTls::CRadioEngineTls( RFs* aFs )
    63     : iEnv( aEnv )
    63     : iFs( aFs )
    64     , iFs( aFs )
       
    65     {
    64     {
    66     }
    65     }
    67 
    66 
    68 
    67 
    69 // ---------------------------------------------------------------------------
    68 // ---------------------------------------------------------------------------
    70 //
    69 //
    71 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    72 //
    71 //
    73 void CRadioEngineTls::ConstructL()
    72 void CRadioEngineTls::ConstructL()
    74     {
    73     {
    75     if ( !iEnv )
    74     if ( !iFs || !iFs->Handle() )
    76         {
       
    77         iEnv = CCoeEnv::Static();
       
    78         }
       
    79 
       
    80     if ( !iFs )
       
    81         {
    75         {
    82         iFsOwned = ETrue;
    76         iFsOwned = ETrue;
    83         iFs = new ( ELeave ) RFs;
    77         iFs = new ( ELeave ) RFs;
    84         User::LeaveIfError( iFs->Connect() );
    78         User::LeaveIfError( iFs->Connect() );
    85         }
    79         }
    86 
    80 
       
    81     
    87 #ifdef LOGGING_ENABLED
    82 #ifdef LOGGING_ENABLED
    88     iLogger = CRadioEngineLogger::NewL( *iFs );
    83     iLogger = CRadioEngineLogger::NewL( *iFs );
    89 #endif // LOGGING_ENABLED
    84 #endif // LOGGING_ENABLED
    90 
    85 
    91     }
    86     }
   124 #endif
   119 #endif
   125     }
   120     }
   126 
   121 
   127 
   122 
   128 // ---------------------------------------------------------------------------
   123 // ---------------------------------------------------------------------------
   129 // Return the eikon environment
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 CCoeEnv* CRadioEngineTls::Env()
       
   133     {
       
   134     return CRadioEngineTls::Instance().iEnv;
       
   135     }
       
   136 
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // Returns the file server session
   124 // Returns the file server session
   140 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   141 //
   126 //
   142 RFs& CRadioEngineTls::FsSession()
   127 RFs& CRadioEngineTls::FsSession()
   143     {
   128     {