contextframework/cfwplugins/cenrepsourceplugin/inc/cenrepattributes.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  CCenRepAttributes class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CENREPATTRIBUTES_H
       
    20 #define C_CENREPATTRIBUTES_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <cfcontextinterface.h>
       
    24 #include <cfcontextsourceplugin.h>
       
    25 
       
    26 #include "cfcontextsourcesettingparameter.h"
       
    27 
       
    28 class CCFContextSourceSettingArray;
       
    29 
       
    30 _LIT( KUID, "UID" );
       
    31 _LIT( KMode, "Mode" );
       
    32 _LIT( KMasked, "Masked" );
       
    33 _LIT( KNonMasked, "NonMasked" );
       
    34 
       
    35 _LIT( KKey, "Key" );
       
    36 _LIT( KValue, "Value" );
       
    37 _LIT( KContextSource, "ContextSource" );
       
    38 _LIT( KContextType, "ContextType" );
       
    39 _LIT( KContextValue, "ContextValue" );
       
    40 _LIT( KContextValueSet, "ContextValueSet" );
       
    41 _LIT( KContextValueUnSet, "ContextValueUnSet" );
       
    42 
       
    43 /**
       
    44  *  Base class for attribute and parameter handling
       
    45  *
       
    46  *  @lib CenRepSourcePlugIn.dll
       
    47  *  @since S60 5.0
       
    48  */
       
    49 NONSHARABLE_CLASS( CCenRepAttributes ) : public CBase
       
    50     {
       
    51 public:
       
    52 
       
    53     virtual ~CCenRepAttributes();
       
    54     
       
    55 public: // New methods
       
    56 
       
    57     /**
       
    58     * Pure virtual definition
       
    59     * Search context values from parameter array and updates context
       
    60     *
       
    61     * @since S60 5.0
       
    62     * @param aKeyValue Parameter key value for context values to search
       
    63     * @return void
       
    64     */
       
    65     virtual void UpdateContextL( const TInt aKeyValue ) = 0;
       
    66     
       
    67     /**
       
    68     * Converts string to hexadecimal.
       
    69     *
       
    70     * @since S60 5.0
       
    71     * @param aString The string to convert
       
    72     * @param aValue Converted value
       
    73     * @return KErrNotFound if not an int to be converted, else KErrNone
       
    74     */
       
    75     static TInt ConvertToHex( const TDesC& aString, TUint32& aValue );
       
    76 
       
    77     /**
       
    78     * Initializes object and triggers to define context.
       
    79     *
       
    80     * @since S60 5.0
       
    81     * @param aIndex Index of RContextSourceSettingArray item
       
    82     * @return Central repository key
       
    83     */
       
    84     TUint32 InitCenRepKeyL( TInt aIndex );
       
    85 
       
    86 protected:
       
    87 
       
    88     CCenRepAttributes( MCFContextInterface& aCF,
       
    89                        CCFContextSourceSettingArray& aSettings );
       
    90 
       
    91     /**
       
    92     * Converts string to integer.
       
    93     *
       
    94     * @since S60 5.0
       
    95     * @param aString The string to convert
       
    96     * @param aValue Converted value
       
    97     * @return KErrNotFound if not an int to be converted, else KErrNone
       
    98     */
       
    99     TInt ConvertToInt( const TDesC& aString, TInt& aValue ) const;
       
   100 
       
   101     /**
       
   102     * Publish context
       
   103     *
       
   104     * @since S60 5.0
       
   105     * @param
       
   106     * @return void
       
   107     */
       
   108     void PublishContext();
       
   109 
       
   110 private:
       
   111 
       
   112     void DefineContext();
       
   113 
       
   114 public:    // Data
       
   115 
       
   116 protected: // Data
       
   117 
       
   118         // Sensor source settings
       
   119         CCFContextSourceSettingArray& iSettings;
       
   120 
       
   121         // Ref: CF interface for contexts
       
   122         MCFContextInterface& iCF;
       
   123 
       
   124         // Own: Pointer to a Context object
       
   125         CCFContextObject* iContext;
       
   126 
       
   127         // Own: Parameter array of settings
       
   128         RSettingParameterArray iParamArray;
       
   129 
       
   130         // Parameter count in parameter array
       
   131         TInt iParamCount;
       
   132 
       
   133 private:   // Data
       
   134 
       
   135     };
       
   136 
       
   137 #endif // C_CENREPATTRIBUTES_H