wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/wllddpowerhandler.cpp
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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 the License "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:   Implementation of the DWlanPowerHandler class
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 6 %
       
    20 */
       
    21 
       
    22 #include "wllddpowerhandler.h"
       
    23 #include "wllddpowerindicator.h"
       
    24 
       
    25 _LIT(KWlanPowerHandlerName,"WLAN power handler");
       
    26 
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // C++ constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 DWlanPowerHandler::DWlanPowerHandler( 
       
    36     MWlanPowerIndicator& aWlanLdd ,
       
    37     TDynamicDfcQue& aDfcQ ):
       
    38     DPowerHandler( KWlanPowerHandlerName ),
       
    39     iWlanLdd( &aWlanLdd ),
       
    40     iPowerUpDfc( PowerUpDfcFn, this, NULL, 0 ),
       
    41     iPowerDownDfc( PowerDownDfcFn, this, NULL, 0 )
       
    42     {
       
    43     iPowerUpDfc.SetDfcQ( &aDfcQ );
       
    44     iPowerDownDfc.SetDfcQ( &aDfcQ );
       
    45     }
       
    46     
       
    47 // ---------------------------------------------------------------------------
       
    48 // 
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 DWlanPowerHandler::~DWlanPowerHandler()
       
    52     {
       
    53     iWlanLdd = NULL;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 //  
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void DWlanPowerHandler::PowerDownDfcFn( TAny *aPtr )
       
    61     {
       
    62     DWlanPowerHandler *pwrHandler = static_cast<DWlanPowerHandler*>(aPtr);
       
    63     pwrHandler->PowerDownOperation();
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 //  
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 void DWlanPowerHandler::PowerUpDfcFn( TAny *aPtr )
       
    71     {
       
    72     DWlanPowerHandler *pwrHandler = static_cast<DWlanPowerHandler*>(aPtr);
       
    73     pwrHandler->PowerUpOperation();
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // 
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void DWlanPowerHandler::PowerDown( TPowerState ) 
       
    81     {
       
    82     iPowerDownDfc.Enque();
       
    83     }
       
    84     
       
    85 // ---------------------------------------------------------------------------
       
    86 // 
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void DWlanPowerHandler::PowerUp() 
       
    90     {
       
    91     iPowerUpDfc.Enque();
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // 
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 void DWlanPowerHandler::OnPowerDownDone() 
       
    99     {
       
   100     // Acknowledge back to power manager that power down has been done
       
   101     PowerDownDone();
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // 
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 void DWlanPowerHandler::OnPowerUpDone() 
       
   109     {
       
   110     // Acknowledge back to power manager that power up handling has been done
       
   111     PowerUpDone();
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // 
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 void DWlanPowerHandler::PowerDownOperation()
       
   119     {
       
   120     // Forward the request
       
   121     iWlanLdd->OnPowerDown();
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 //  
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 void DWlanPowerHandler::PowerUpOperation()
       
   129     {
       
   130     // Forward the indication
       
   131     iWlanLdd->OnPowerUp();
       
   132     }