/*
*
* 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 HFPSETTINGS_H_
#define HFPSETTINGS_H_
#include <e32base.h>
class CHsHFPCommand;
/** HF supported features value */
const TInt32 KHsHFPBluetoothSupportedFeatures = 112;
/** Max size of indicator descriptor */
const TInt KHsHFPMaxIndicatorDescSize = 16;
/** Indicator descriptor buffer */
typedef TBuf8<KHsHFPMaxIndicatorDescSize> THFPIndicatorDes;
/** Expected indicators' descriptors */
_LIT8(KHFPCallIndicatorDes,"call");
_LIT8(KHFPServiceIndicatorDes,"service");
_LIT8(KHFPCallsetupIndicatorDes,"callsetup");
_LIT8(KHFPCall_setupIndicatorDes,"call_setup");
_LIT8(KHFPCallheldIndicatorDes,"callheld");
_LIT8(KHFPSignalIndicatorDes,"signal");
_LIT8(KHFPRoamIndicatorDes,"roam");
_LIT8(KHFPBattchgIndicatorDes,"battchg");
/**
* @brief CIEV indicator structure
*/
class THsHFPIndicatorSetting
{
public:
/**
* Constructor
*
* @param aDes descriptor of indicator
* @param aValue value of indicator
*/
THsHFPIndicatorSetting(const TDesC8& aDes, const TInt aValue = 0);
/**
* Sets value of indicator
*
* @param aDesValue new value of indicator as descriptor
*/
void SetValueL(const TDesC8& aDesValue);
/**
* Sets value of indicator
*
* @param aValue new value of indicator as number
*/
void SetValue(const TInt aValue);
/**
* Returns CIEV indicator's current value
*
* @return value of indicator
*/
TInt Int() const;
/**
* Returns CIEV indicator's descriptor
*
* @return reference to descriptor
*/
const THFPIndicatorDes& Des() const;
private:
/** CIEV indicator's descriptor */
THFPIndicatorDes iDesc;
/** CIEV indicator's current value */
TInt iValue;
};
/**
* @brief Singleton class representing profile's settings
*/
class CHsHFPSettings : public CBase
{
public:
/**
* Returns pointer to singleton class
*/
static CHsHFPSettings* InstanceL();
/**
* Decrements reference counter. Deletes singleton if there is no reference.
*/
void Release();
/**
* Finds index of settings array applicable for indicator
*
* @param aIndicatorDes CIEV indicator's descriptor
*
* @return index of array, KErrNotFound when there is no suitable value
* in array
*/
TInt FindIndicatorIndex(const TDesC8& aIndicatorDes);
private:
/**
* Destructor
*/
~CHsHFPSettings();
/**
* Constructor for performing 1st stage construction
*/
CHsHFPSettings();
/**
* Constructor for performing 2nd stage construction
*/
void ConstructL();
public:
/** CIEV indicators' array */
RArray<THsHFPIndicatorSetting> iSettingsArr;
/** VGS current value */
TInt iVgsLevel;
/** VGM current value */
TInt iVgmLevel;
private:
/** Reference counter */
TInt iReferenceCounter;
};
#endif /* HFPSETTINGS_H_ */