bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/hfpsettings.h
branchheadsetsimulator
changeset 60 90dbfc0435e3
equal deleted inserted replaced
59:02103bf20ee5 60:90dbfc0435e3
       
     1 /* 
       
     2  *
       
     3  * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies).
       
     4  * All rights reserved.
       
     5  * This component and the accompanying materials are made available
       
     6  * under the terms of the License "Eclipse Public License v1.0"
       
     7  * which accompanies this distribution, and is available
       
     8  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9  *
       
    10  * Original Contributors:
       
    11  * Comarch S.A. - original contribution.
       
    12  *
       
    13  * Contributors:
       
    14  *
       
    15  * Description:
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef HFPSETTINGS_H_
       
    20 #define HFPSETTINGS_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CHsHFPCommand;
       
    25 
       
    26 /** HF supported features value */
       
    27 const TInt32 KHsHFPBluetoothSupportedFeatures = 112;
       
    28 
       
    29 /** Max size of indicator descriptor */
       
    30 const TInt KHsHFPMaxIndicatorDescSize = 16;
       
    31 
       
    32 /** Indicator descriptor buffer */
       
    33 typedef TBuf8<KHsHFPMaxIndicatorDescSize> THFPIndicatorDes;
       
    34 /** Expected indicators' descriptors */
       
    35 _LIT8(KHFPCallIndicatorDes,"call");
       
    36 _LIT8(KHFPServiceIndicatorDes,"service");
       
    37 _LIT8(KHFPCallsetupIndicatorDes,"callsetup");
       
    38 _LIT8(KHFPCall_setupIndicatorDes,"call_setup");
       
    39 _LIT8(KHFPCallheldIndicatorDes,"callheld");
       
    40 _LIT8(KHFPSignalIndicatorDes,"signal");
       
    41 _LIT8(KHFPRoamIndicatorDes,"roam");
       
    42 _LIT8(KHFPBattchgIndicatorDes,"battchg");
       
    43 
       
    44 /**
       
    45  * @brief CIEV indicator structure
       
    46  */
       
    47 class THsHFPIndicatorSetting
       
    48     {
       
    49 public:
       
    50     /**
       
    51      * Constructor
       
    52      * 
       
    53      * @param aDes descriptor of indicator
       
    54      * @param aValue value of indicator
       
    55      */
       
    56     THsHFPIndicatorSetting(const TDesC8& aDes, const TInt aValue = 0);
       
    57 
       
    58     /**
       
    59      * Sets value of indicator
       
    60      * 
       
    61      * @param aDesValue new value of indicator as descriptor
       
    62      */
       
    63     void SetValueL(const TDesC8& aDesValue);
       
    64 
       
    65     /**
       
    66      * Sets value of indicator
       
    67      * 
       
    68      * @param aValue new value of indicator as number
       
    69      */
       
    70     void SetValue(const TInt aValue);
       
    71 
       
    72     /**
       
    73      * Returns CIEV indicator's current value
       
    74      * 
       
    75      * @return value of indicator
       
    76      */
       
    77     TInt Int() const;
       
    78 
       
    79     /**
       
    80      * Returns CIEV indicator's descriptor
       
    81      * 
       
    82      * @return reference to descriptor
       
    83      */
       
    84     const THFPIndicatorDes& Des() const;
       
    85 
       
    86 private:
       
    87     /** CIEV indicator's descriptor */
       
    88     THFPIndicatorDes iDesc;
       
    89 
       
    90     /** CIEV indicator's current value */
       
    91     TInt iValue;
       
    92     };
       
    93 
       
    94 /**
       
    95  * @brief Singleton class representing profile's settings
       
    96  */
       
    97 class CHsHFPSettings : public CBase
       
    98     {
       
    99 public:
       
   100     /**
       
   101      * Returns pointer to singleton class
       
   102      */
       
   103     static CHsHFPSettings* InstanceL();
       
   104 
       
   105     /**
       
   106      * Decrements reference counter. Deletes singleton if there is no reference.
       
   107      */
       
   108     void Release();
       
   109 
       
   110     /**
       
   111      * Finds index of settings array applicable for indicator
       
   112      * 
       
   113      * @param aIndicatorDes CIEV indicator's descriptor
       
   114      * 
       
   115      * @return index of array, KErrNotFound when there is no suitable value 
       
   116      * in array 
       
   117      */
       
   118     TInt FindIndicatorIndex(const TDesC8& aIndicatorDes);
       
   119 
       
   120 private:
       
   121     /**
       
   122      * Destructor
       
   123      */
       
   124     ~CHsHFPSettings();
       
   125 
       
   126     /**
       
   127      * Constructor for performing 1st stage construction
       
   128      */
       
   129     CHsHFPSettings();
       
   130 
       
   131     /**
       
   132      * Constructor for performing 2nd stage construction
       
   133      */
       
   134     void ConstructL();
       
   135 
       
   136 public:
       
   137     /** CIEV indicators' array */
       
   138     RArray<THsHFPIndicatorSetting> iSettingsArr;
       
   139 
       
   140     /** VGS current value */
       
   141     TInt iVgsLevel;
       
   142 
       
   143     /** VGM current value */
       
   144     TInt iVgmLevel;
       
   145 
       
   146 private:
       
   147     /** Reference counter */
       
   148     TInt iReferenceCounter;
       
   149     };
       
   150 #endif /* HFPSETTINGS_H_ */