fmradio/fmradioengine/inc/fmradioaccessoryconnection.h
branchRCL_3
changeset 19 cce62ebc198e
parent 18 1a6714c53019
child 20 93c594350b9a
equal deleted inserted replaced
18:1a6714c53019 19:cce62ebc198e
     1 /*
       
     2 * Copyright (c) 2008 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:  Observer of accessory connection.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CFMRADIOACCESSORYCONNECTION_H
       
    19 #define CFMRADIOACCESSORYCONNECTION_H
       
    20 
       
    21 class TAccPolGenericIDArray;
       
    22 class MFMRadioHeadsetEventObserver;
       
    23 
       
    24 #include <e32base.h> // For CActive, link against: euser.lib
       
    25 #include <AccessoryServer.h> //For RAccessoryServer session
       
    26 #include <AccessoryConnection.h> //For RAccessoryConnection subsession
       
    27 
       
    28 NONSHARABLE_CLASS( CFMRadioAccessoryConnection ) : public CActive
       
    29     {
       
    30 public:
       
    31     // Cancel and destroy
       
    32     ~CFMRadioAccessoryConnection();
       
    33     
       
    34     // Two-phased constructor.
       
    35     static CFMRadioAccessoryConnection* NewL();
       
    36     /**
       
    37      * Sets observer. The observer will be notified when headset has been 
       
    38      * pressed or headset is connected/disconnected.
       
    39      *
       
    40      * @param aObserver Observer
       
    41      */
       
    42     void SetObserver( MFMRadioHeadsetEventObserver* aObserver );
       
    43     
       
    44     /**
       
    45      * Public boolean getter, return ETrue if 
       
    46      * a wired headset is connected
       
    47      */
       
    48     TBool WiredHeadsetConnected();
       
    49 private:
       
    50     /**
       
    51      * C++ default constructor.
       
    52      */
       
    53     CFMRadioAccessoryConnection();
       
    54     
       
    55     /**
       
    56      * Static constructor.
       
    57      */
       
    58     void ConstructL();
       
    59     
       
    60     /**
       
    61      * Private boolean getter, return ETrue if 
       
    62      * a wired headset is found in array of connected accessories
       
    63      */
       
    64     TBool WiredHeadsetInArrayL();
       
    65     
       
    66     /**
       
    67      * Private boolean getter, return ETrue if 
       
    68      * a wired headset is found in first index of
       
    69      * array of connected accessories.
       
    70      */
       
    71     TBool WiredHeadsetFirstInArrayL();
       
    72     
       
    73     /**
       
    74      * From CActive
       
    75      *
       
    76      * @see CActive::RunL()
       
    77      */
       
    78     void RunL();
       
    79     
       
    80     /**
       
    81      * From CActive
       
    82      *
       
    83      * @see CActive::DoCancel()
       
    84      */        
       
    85     void DoCancel();
       
    86     
       
    87 private:
       
    88     /** 
       
    89      * Instance that gets notifications of the headset state changes 
       
    90      */
       
    91     MFMRadioHeadsetEventObserver* iObserver;
       
    92     TBool iWiredHeadsetConnected;
       
    93     TInt iAccessoryCount;
       
    94     RAccessoryServer iAccessoryServer;
       
    95     RAccessoryConnection iAccessoryConnection;
       
    96     TAccPolGenericIDArray iAccessoryArray;
       
    97     };
       
    98 #endif // CFMRADIOACCESSORYCONNECTION_H
       
    99