connectionmonitoring/connectionmonitorui/src/ActiveWrapper.cpp
branchRCL_3
changeset 57 05bc53fe583b
parent 55 fc7b30ed2058
child 58 83ca720e2b9a
equal deleted inserted replaced
55:fc7b30ed2058 57:05bc53fe583b
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CActiveWrapper implementation file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 #include "ActiveWrapper.h"
       
    22 #include "ConnectionMonitorUiLogger.h"
       
    23 
       
    24 // LOCAL CONSTANTS AND MACROS
       
    25 
       
    26 // ---------------------------------------------------------
       
    27 // CActiveWrapper::NewL
       
    28 //
       
    29 // Two-phased constructor.
       
    30 // ---------------------------------------------------------
       
    31 //
       
    32 CActiveWrapper* CActiveWrapper::NewL()
       
    33     {
       
    34     CMUILOGGER_ENTERFN( "CActiveWrapper::NewL()" );
       
    35     
       
    36     CActiveWrapper* self = new ( ELeave ) CActiveWrapper();
       
    37     CleanupStack::PushL( self );
       
    38 
       
    39     self->ConstructL();
       
    40     
       
    41     CleanupStack::Pop( self );
       
    42 
       
    43     CMUILOGGER_LEAVEFN( "CActiveWrapper::NewL()" );
       
    44     return self;
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CActiveWrapper::ConstructL
       
    49 //
       
    50 // Symbian OS default constructor can leave.
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 void CActiveWrapper::ConstructL()
       
    54     {
       
    55     CMUILOGGER_ENTERFN( "CActiveWrapper::ConstructL()" );
       
    56 
       
    57     CActiveScheduler::Add( this );
       
    58 
       
    59     CMUILOGGER_LEAVEFN( "CActiveWrapper::ConstructL()" );
       
    60     }
       
    61 
       
    62 
       
    63 // ---------------------------------------------------------
       
    64 // CActiveWrapper::CActiveWrapper
       
    65 //
       
    66 // C++ constructor can NOT contain any code, that
       
    67 // might leave.
       
    68 // ---------------------------------------------------------
       
    69 //
       
    70 CActiveWrapper::CActiveWrapper() : CActive( CActive::EPriorityStandard )
       
    71     {
       
    72     }
       
    73 
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CActiveWrapper::~CActiveWrapper
       
    77 //
       
    78 // Destructor
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 CActiveWrapper::~CActiveWrapper()
       
    82     {
       
    83     CMUILOGGER_ENTERFN( "CActiveWrapper::~CActiveWrapper()" );
       
    84     
       
    85     Cancel();
       
    86     
       
    87     CMUILOGGER_WRITE( "CActiveWrapper::~CActiveWrapper Canceled" );
       
    88     
       
    89     CMUILOGGER_LEAVEFN( "CActiveWrapper::~CActiveWrapper()" );
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------
       
    94 // CActiveWrapper::RunL
       
    95 //
       
    96 // From active object framework
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 void CActiveWrapper::RunL() 
       
   100     {
       
   101     CMUILOGGER_ENTERFN( "CActiveWrapper::RunL()" );
       
   102 
       
   103     if ( iWait.IsStarted() )
       
   104         {
       
   105         CMUILOGGER_WRITE( "AsyncStop" );
       
   106 
       
   107         iWait.AsyncStop();
       
   108         }
       
   109 
       
   110     CMUILOGGER_LEAVEFN( "CActiveWrapper::RunL()" );
       
   111     }
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------
       
   115 // CActiveWrapper::DoCancel
       
   116 //
       
   117 // From active object framework
       
   118 // ---------------------------------------------------------
       
   119 //
       
   120 void CActiveWrapper::DoCancel()
       
   121     {
       
   122     CMUILOGGER_ENTERFN( "CActiveWrapper::DoCancel()" );
       
   123 
       
   124     if ( iWait.IsStarted() )
       
   125         {
       
   126         CMUILOGGER_WRITE( "AsyncStop" );
       
   127 
       
   128         iWait.AsyncStop();
       
   129         }
       
   130 
       
   131     CMUILOGGER_LEAVEFN( "CActiveWrapper::DoCancel()" );
       
   132     }
       
   133     
       
   134 
       
   135 // ---------------------------------------------------------
       
   136 // CActiveWrapper::StartGetStringAttribute
       
   137 //
       
   138 // Starts the active object
       
   139 // ---------------------------------------------------------
       
   140 //
       
   141 void CActiveWrapper::StartGetStringAttribute( TInt const aConnectionId, 
       
   142                             RConnectionMonitor* const aConnectionMonitor,
       
   143                             TUint const aAttribute,
       
   144                             TDes& aValue )
       
   145     {
       
   146     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetStringAttribute()" );
       
   147 
       
   148     if ( IsActive() == EFalse )
       
   149         {
       
   150         CMUILOGGER_WRITE( "NOT active" );
       
   151         aConnectionMonitor->GetStringAttribute( aConnectionId, 0, aAttribute,
       
   152                                                 aValue, iStatus );
       
   153         SetActive();
       
   154         iWait.Start();
       
   155         }
       
   156     else
       
   157         {
       
   158         CMUILOGGER_WRITE( "Already active" );
       
   159         }
       
   160         
       
   161     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetStringAttribute()" );
       
   162     }
       
   163 
       
   164 
       
   165 // ---------------------------------------------------------
       
   166 // CActiveWrapper::StartGetIntAttribute
       
   167 //
       
   168 // Starts the active object
       
   169 // ---------------------------------------------------------
       
   170 //
       
   171 void CActiveWrapper::StartGetIntAttribute( TInt const aConnectionId,
       
   172                             RConnectionMonitor* const aConnectionMonitor,
       
   173                             TUint const aAttribute,
       
   174                             TInt& aValue )
       
   175     {
       
   176     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetIntAttribute()" );
       
   177 
       
   178     if ( IsActive() == EFalse )
       
   179         {
       
   180         CMUILOGGER_WRITE( "NOT active" );
       
   181         aConnectionMonitor->GetIntAttribute( aConnectionId, 
       
   182                                              0,
       
   183                                              aAttribute,
       
   184                                              aValue,
       
   185                                              iStatus );
       
   186         SetActive();
       
   187         iWait.Start();
       
   188         }
       
   189     else
       
   190         {
       
   191         CMUILOGGER_WRITE( "Already active" );
       
   192         }
       
   193         
       
   194     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetIntAttribute()" );
       
   195     }
       
   196 
       
   197 
       
   198 // ---------------------------------------------------------
       
   199 // CActiveWrapper::StartGetUintAttribute
       
   200 //
       
   201 // Starts the active object
       
   202 // ---------------------------------------------------------
       
   203 //
       
   204 void CActiveWrapper::StartGetUintAttribute( TInt const aConnectionId,
       
   205                             RConnectionMonitor* const aConnectionMonitor,
       
   206                             TUint const aAttribute,
       
   207                             TUint& aValue )
       
   208     {
       
   209     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetUintAttribute()" );
       
   210 
       
   211     if ( IsActive() == EFalse )
       
   212         {
       
   213         CMUILOGGER_WRITE( "NOT active" );
       
   214         aConnectionMonitor->GetUintAttribute( aConnectionId,
       
   215                                               0,
       
   216                                               aAttribute,
       
   217                                               aValue,
       
   218                                               iStatus );
       
   219         SetActive();
       
   220         iWait.Start();
       
   221         }
       
   222     else
       
   223         {
       
   224         CMUILOGGER_WRITE( "Already active" );
       
   225         }
       
   226         
       
   227     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetUintAttribute()" );
       
   228     }
       
   229 
       
   230 
       
   231 // ---------------------------------------------------------
       
   232 // CActiveWrapper::StartGetConnSharings
       
   233 //
       
   234 // Starts the active object
       
   235 // ---------------------------------------------------------
       
   236 //
       
   237 void CActiveWrapper::StartGetConnSharings( TInt const aConnectionId,
       
   238                             RConnectionMonitor* const aConnectionMonitor,
       
   239                             TConnMonClientEnumBuf& aValue )
       
   240     {
       
   241     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnSharings()" );
       
   242 
       
   243     if ( IsActive() == EFalse )
       
   244         {
       
   245         CMUILOGGER_WRITE( "NOT active" );   
       
   246         aConnectionMonitor->GetPckgAttribute( aConnectionId,
       
   247                                               0,
       
   248                                               KClientInfo,
       
   249                                               aValue,
       
   250                                               iStatus );
       
   251         SetActive();
       
   252         iWait.Start();
       
   253         }
       
   254     else
       
   255         {
       
   256         CMUILOGGER_WRITE( "Already active" );
       
   257         }
       
   258         
       
   259     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnSharings()" );
       
   260     }
       
   261 
       
   262 
       
   263 // ---------------------------------------------------------
       
   264 // CActiveWrapper::StartGetConnTime
       
   265 //
       
   266 // Starts the active object
       
   267 // ---------------------------------------------------------
       
   268 //
       
   269 void CActiveWrapper::StartGetConnTime( TInt const aConnectionId,
       
   270                             RConnectionMonitor* const aConnectionMonitor,
       
   271                             TConnMonTimeBuf& aValue )
       
   272     {
       
   273     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnTime()" );
       
   274 
       
   275     if ( IsActive() == EFalse )
       
   276         {
       
   277         CMUILOGGER_WRITE( "NOT active" );   
       
   278         aConnectionMonitor->GetPckgAttribute( aConnectionId,
       
   279                                               0,
       
   280                                               KStartTime,
       
   281                                               aValue,
       
   282                                               iStatus );
       
   283         SetActive();
       
   284         iWait.Start();
       
   285         }
       
   286     else
       
   287         {
       
   288         CMUILOGGER_WRITE( "Already active" );
       
   289         }
       
   290         
       
   291     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnTime()" );
       
   292     }
       
   293 
       
   294 
       
   295 // ---------------------------------------------------------
       
   296 // CActiveWrapper::StartGetBearerType
       
   297 //
       
   298 // Starts the active object
       
   299 // ---------------------------------------------------------
       
   300 //
       
   301 void CActiveWrapper::StartGetBearerType( TInt const aConnectionId,
       
   302                             RConnectionMonitor& aConnectionMonitor,
       
   303                             TUint const aAttribute,
       
   304                             TInt& aValue )
       
   305     {
       
   306     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetBearerType()" );
       
   307 
       
   308     if ( IsActive() == EFalse )
       
   309         {
       
   310         CMUILOGGER_WRITE( "NOT active" );
       
   311         aConnectionMonitor.GetIntAttribute( aConnectionId, 
       
   312                                             0,
       
   313                                             aAttribute,
       
   314                                             aValue,
       
   315                                             iStatus );
       
   316         SetActive();
       
   317         iWait.Start();
       
   318         }
       
   319     else
       
   320         {
       
   321         CMUILOGGER_WRITE( "Already active" );
       
   322         }
       
   323         
       
   324     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetBearerType()" );
       
   325     }
       
   326 
       
   327 
       
   328 // ---------------------------------------------------------
       
   329 // CActiveWrapper::StartGetConnectionCount
       
   330 //
       
   331 // Starts the active object
       
   332 // ---------------------------------------------------------
       
   333 //
       
   334 void CActiveWrapper::StartGetConnectionCount( TUint& aConnectionCount,
       
   335                             RConnectionMonitor& aConnectionMonitor )
       
   336     {
       
   337     CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnectionCount()" );
       
   338 
       
   339     if ( IsActive() == EFalse )
       
   340         {
       
   341         CMUILOGGER_WRITE( "NOT active" );
       
   342         aConnectionMonitor.GetConnectionCount( aConnectionCount, iStatus );
       
   343         SetActive();
       
   344         iWait.Start();
       
   345         }
       
   346     else
       
   347         {
       
   348         CMUILOGGER_WRITE( "Already active" );
       
   349         }
       
   350         
       
   351     CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnectionCount()" );
       
   352     }
       
   353 
       
   354 
       
   355 // End of File