bluetoothengine/btaudioman/inc/basrvpowercontrolagent.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     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:  Baseband power mode control agent for plugins
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_BASRVPOWERCONTROLAGENT_H
       
    20 #define C_BASRVPOWERCONTROLAGENT_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <bt_sock.h>  // RBTPhysicalLinkAdapter
       
    24 #include "basrvactive.h"
       
    25 
       
    26 NONSHARABLE_CLASS(CBasrvPowerControlAgent) : public CBase, public MBasrvActiveObserver
       
    27 	{
       
    28 public:
       
    29     static CBasrvPowerControlAgent* NewL(const TBTDevAddr& aAddr);
       
    30     
       
    31     ~CBasrvPowerControlAgent();
       
    32     
       
    33     void RequestSniffMode();
       
    34 
       
    35     void RequestActiveMode();
       
    36 
       
    37     void CancelPowerModeControl();
       
    38     
       
    39     void PreventLowPowerMode();
       
    40     
       
    41     void AllowLowPowerMode();
       
    42     
       
    43 private:
       
    44     // From MBasrvActiveObserver
       
    45     
       
    46     /**
       
    47      * Handles the request completion event.
       
    48      *
       
    49      * @since S60 v3.1
       
    50      * @param aActive the Active Object to which the request is assigned to.
       
    51      */
       
    52     void RequestCompletedL(CBasrvActive& aActive);
       
    53     
       
    54     /**
       
    55      * Handles the cancellation of an outstanding request.
       
    56      *
       
    57      * @since S60 v3.1
       
    58      * @param aActive the Active Object to which the request is assigned to.
       
    59      */
       
    60     void CancelRequest(CBasrvActive& aActive);
       
    61     
       
    62     
       
    63 private:
       
    64     CBasrvPowerControlAgent(const TBTDevAddr& aAddr);
       
    65     
       
    66     void ConstructL();
       
    67     
       
    68     void DoPowerControl();
       
    69 
       
    70     void DosniffRequest();
       
    71 
       
    72 private:    
       
    73     enum TPowerControlState
       
    74         {
       
    75         EPowerModeDefault,
       
    76         ESniffModeTiming,
       
    77         ESniffModeRequested,
       
    78         EActiveModeRequested,
       
    79         };
       
    80 private:
       
    81     RSocketServ iSockServ;
       
    82     TBTDevAddr iAddr;
       
    83     TPowerControlState iState;
       
    84     RBTPhysicalLinkAdapter iPlAda;
       
    85     TBTBasebandEvent iBbEvent;
       
    86     RTimer iTimer;
       
    87     CBasrvActive* iSniffDelayTimer;
       
    88     CBasrvActive* iBbEventer;
       
    89     };
       
    90 	
       
    91 #endif	// C_BASRVPOWERCONTROLAGENT_H