accessoryservices/headsetstatusapi/Inc/CHeadsetStatusContainer.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2005 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: 
       
    15 *     CHeadsetStatusContainer functionality.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __HEADSETCONTAINER_H__
       
    21 #define __HEADSETCONTAINER_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #ifdef __ACCESSORY_FW
       
    26 #include <AccessoryServer.h>
       
    27 #include <AccessoryMode.h>
       
    28 #endif
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MHeadsetStatusObserver;
       
    32 class CHeadsetStatusObserver;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /** 
       
    37 *  This implementation is a wrapper that encapsulates internal interfaces 
       
    38 *  from extended SDK.
       
    39 *  Construction will leave with KErrNotSupported unless __ACCESSORY_FW flag
       
    40 *  is not defined.
       
    41 */ 
       
    42 NONSHARABLE_CLASS( CHeadsetStatusContainer ): public CBase 
       
    43     {
       
    44     public:     // Constructors & destructors
       
    45        
       
    46         /**
       
    47         * Destructor 
       
    48         */
       
    49         ~CHeadsetStatusContainer();
       
    50 
       
    51         /**
       
    52         * Symbian two phased constructor.
       
    53         */
       
    54         static CHeadsetStatusContainer* NewL();
       
    55 
       
    56     public:     // New methods
       
    57     
       
    58         /**
       
    59         * Used to query the headset connectivity status. 
       
    60         * @param    aState: Boolean value of headset status
       
    61         * @return   KErrNone if query succeeded, otherwise one of the
       
    62         *           system wide error codes.
       
    63         */
       
    64         TInt QueryHeadsetStatus( TBool& aState );
       
    65          
       
    66         /**
       
    67         * Sets observer through headset status notifications are received.
       
    68         * @param    aObserver: Observer
       
    69         * @return   None
       
    70         */
       
    71         void SetObserver( MHeadsetStatusObserver* aObserver );
       
    72         
       
    73         /**
       
    74         * Starts observing headset status changes.
       
    75         * @param    None
       
    76         * @return   None
       
    77         */
       
    78         void StartObserving();
       
    79         
       
    80         /**
       
    81         * Stops observing.
       
    82         * @param    None
       
    83         * @return   None
       
    84         */
       
    85         void StopObserving();
       
    86         
       
    87         /**
       
    88         * Checks whether already observing.
       
    89         * @param    None
       
    90         * @return   ETrue if observing
       
    91         */
       
    92         TBool IsObserving() const;
       
    93         
       
    94     private: 
       
    95         
       
    96         /**
       
    97         * Default Constructor 
       
    98         */
       
    99         CHeadsetStatusContainer( );
       
   100         
       
   101         /**
       
   102         * Symbian OS 2nd phase constructor 
       
   103         */
       
   104         void ConstructL();  
       
   105                
       
   106     private:
       
   107     
       
   108         #ifdef __ACCESSORY_FW
       
   109         RAccessoryServer    iAccSrv;
       
   110         RAccessoryMode      iAccMode;
       
   111         // headset status observer, owned
       
   112         CHeadsetStatusObserver* iObserver;
       
   113         #endif
       
   114     };
       
   115 
       
   116 #endif //__HEADSETCONTAINER_H__
       
   117 
       
   118 // End of File