diff -r 02103bf20ee5 -r 90dbfc0435e3 bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/features/hfpconnectionmanagement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/features/hfpconnectionmanagement.h Wed Sep 15 15:59:44 2010 +0200 @@ -0,0 +1,137 @@ +/* + * + * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Original Contributors: + * Comarch S.A. - original contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef HFPCONNECTIONMANAGEMENT_H +#define HFPCONNECTIONMANAGEMENT_H + +#include "hfpfeaturecommons.h" + +class CHsHFPSettings; + +/** + * @brief Represents "Connection management" feature + */ +class CHsHFPConnectionManagement : public CBase + { +public: + + /** + * Two-phased constructor. + * + * @param aObserver feature observer + * + * @return instance of class + */ + static CHsHFPConnectionManagement* NewL( + MHsHFPFeatureProviderObserver* aObserver); + + /** + * Two-phased constructor. + * + * @param aObserver feature observer + * + * @return instance of class + */ + static CHsHFPConnectionManagement* NewLC( + MHsHFPFeatureProviderObserver* aObserver); + + /** + * Destructor. + */ + ~CHsHFPConnectionManagement(); + +public: + + /** + * Establishes service level connection + * + * @param aInputCmd input AT command + * @param aOutputCmd response + * + * @return KErrNone if successful, otherwise one of the system-wide error + * codes + */ + TInt EstablishServiceLevelConnection(const CHsHFPCommand &aInputCmd, + CHsHFPCommand &aOutputCmd); + + /** + * Handles connection release after AG's disconnection + * + * @param aErr reason of connection release + */ + void HandleServiceLevelConnectionRelease(TInt aErr); + +private: + + /** + * Constructor for performing 1st stage construction + * + * @param aObserver feature observer + */ + CHsHFPConnectionManagement(MHsHFPFeatureProviderObserver* aObserver); + + /** + * Constructor for performing 2nd stage construction + */ + void ConstructL(); + +private: + /** + * Initializes settings array by retrieving the mapping between each + * indicator supported by the AG and its corresponding order index. + * + * @param aCommand AT command + */ + void InitializeIndicatorsL(const CHsHFPCommand* aCommand); + + /** + * Saves current status of the AG indicators. + * + * @param aCommand input AT command + */ + void SetupIndicatorsL(const CHsHFPCommand* aCommand); + +private: + + /** + * Service level connection establishment state + */ + enum THsHFPServiceLevelEstablishmentState + { + EHFPNotConnected, + EHFPWaitingForBrsfAndOk, + EHFPWaitingForCindTestAndOk, + EHFPWaitingForCindReadAndOk, + EHFPWaitingForOk, + EHFPConnected + }; + + /** Current state of connection establishment */ + THsHFPServiceLevelEstablishmentState iEstablishmentState; + + /** Pointer to observer */ + MHsHFPFeatureProviderObserver* iObserver; + + /** Denotes if OK command is expected */ + TBool iWaitingForOK; + + /** Profile setting */ + CHsHFPSettings* iSettings; + }; + +#endif // HFPCONNECTIONMANAGEMENT_H