diff -r cce62ebc198e -r 93c594350b9a fmradio/fmradioengine/inc/fmradioaccessoryconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fmradio/fmradioengine/inc/fmradioaccessoryconnection.h Wed Sep 01 12:30:32 2010 +0100 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Observer of accessory connection. +* +*/ + +#ifndef CFMRADIOACCESSORYCONNECTION_H +#define CFMRADIOACCESSORYCONNECTION_H + +class TAccPolGenericIDArray; +class MFMRadioHeadsetEventObserver; + +#include // For CActive, link against: euser.lib +#include //For RAccessoryServer session +#include //For RAccessoryConnection subsession + +NONSHARABLE_CLASS( CFMRadioAccessoryConnection ) : public CActive + { +public: + // Cancel and destroy + ~CFMRadioAccessoryConnection(); + + // Two-phased constructor. + static CFMRadioAccessoryConnection* NewL(); + /** + * Sets observer. The observer will be notified when headset has been + * pressed or headset is connected/disconnected. + * + * @param aObserver Observer + */ + void SetObserver( MFMRadioHeadsetEventObserver* aObserver ); + + /** + * Public boolean getter, return ETrue if + * a wired headset is connected + */ + TBool WiredHeadsetConnected(); +private: + /** + * C++ default constructor. + */ + CFMRadioAccessoryConnection(); + + /** + * Static constructor. + */ + void ConstructL(); + + /** + * Private boolean getter, return ETrue if + * a wired headset is found in array of connected accessories + */ + TBool WiredHeadsetInArrayL(); + + /** + * Private boolean getter, return ETrue if + * a wired headset is found in first index of + * array of connected accessories. + */ + TBool WiredHeadsetFirstInArrayL(); + + /** + * From CActive + * + * @see CActive::RunL() + */ + void RunL(); + + /** + * From CActive + * + * @see CActive::DoCancel() + */ + void DoCancel(); + +private: + /** + * Instance that gets notifications of the headset state changes + */ + MFMRadioHeadsetEventObserver* iObserver; + TBool iWiredHeadsetConnected; + TInt iAccessoryCount; + RAccessoryServer iAccessoryServer; + RAccessoryConnection iAccessoryConnection; + TAccPolGenericIDArray iAccessoryArray; + }; +#endif // CFMRADIOACCESSORYCONNECTION_H +