messagingappbase/ncnlist/inc/NcnCRHandler.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004 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:   Defines class CNcnCRHandler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef NCNSCRHANDLER_H
       
    21 #define NCNSCRHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <cenrepnotifyhandler.h>
       
    26 #include "NcnSubscribeHandler.h"
       
    27 #include "MNcnCRRepositoryHandlerCallback.h"
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KNcnSDReconnectingDelay  = 50000;
       
    31 const TInt KNcnSDReconnectingTrials = 10;
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KVoiceMailWaiting = 0x0001;
       
    35 const TInt KVoiceMailWaitingOnLine1 = 0x0002;
       
    36 const TInt KVoiceMailWaitingOnLine2 = 0x0004;
       
    37 const TInt KVoiceMailWaitingOnBothLines = 0x0008;
       
    38 
       
    39 const TInt KEmailMessageWaiting = 0x0010;
       
    40 const TInt KFaxMessageWaiting = 0x0020;
       
    41 const TInt KFaxOtherMessageWaiting = 0x0040;
       
    42 
       
    43 
       
    44 const TInt KCallsFwdActivated = 0x0100;
       
    45 const TInt KCallsFwdActivatedToVmbx = 0x0200;
       
    46 const TInt KCallsFwdActivatedOnLine1 = 0x0400;
       
    47 const TInt KCallsFwdActivatedOnLine2 = 0x0800;
       
    48 const TInt KCallsFwdActivatedOnBothLines = 0x1000;
       
    49 
       
    50 const TInt KVoiceMailWaitingBitMask = 0xfff0;
       
    51 const TInt KCallsFwdStatusBitMask = 0x00ff;
       
    52 
       
    53 const TInt KAllBitsOn = 0xffff;
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 class CNcnModelBase;
       
    57 class CRepository;
       
    58 class CNcnSubscriber;
       
    59 class CNcnCRRepositoryHandler;
       
    60 
       
    61 // CLASS DECLARATION
       
    62 
       
    63 /**
       
    64 *  Observes the value of the shared data missed calls variable.
       
    65 */
       
    66 class CNcnCRHandler :
       
    67     public CBase,
       
    68     //public MCenRepNotifyHandlerCallback,
       
    69     public MNcnCRRepositoryHandlerCallback,
       
    70     public MNcnSubscribeHandler
       
    71     {
       
    72     public:  // Constructors and destructor
       
    73 
       
    74         /**
       
    75         * C++ default constructor.
       
    76         */
       
    77         CNcnCRHandler( CNcnModelBase* aModel );
       
    78 
       
    79         /**
       
    80         * Two-phased constructor.
       
    81         */
       
    82         static CNcnCRHandler* NewL( CNcnModelBase* aModel );
       
    83 
       
    84         /**
       
    85         * Destructor.
       
    86         */
       
    87         virtual ~CNcnCRHandler();
       
    88 
       
    89 
       
    90     public: // From MNcnCRRepositoryHandlerCallback
       
    91         void HandleRepositoryNotifyInt(
       
    92             CRepository& aRepository,
       
    93             TUint32 aId,
       
    94             TInt aNewValue );
       
    95             
       
    96     public: // Functions from base classes
       
    97 
       
    98         /**
       
    99          * Through this method the Property subscribers notify of Property changes
       
   100          * @param aCategory The category of the property to be observed
       
   101 		 * @param aKey The subkey of the property to be observed
       
   102 		 */
       
   103         void HandlePropertyChangedL( const TUid& aCategory, TInt aKey );
       
   104 
       
   105     public:  // Other public methods
       
   106 
       
   107         /**
       
   108         * Resets the missed calls to zero.
       
   109         */
       
   110         void ResetMissedCalls();
       
   111 
       
   112         /**
       
   113         * Sets the sms initialisation flag in the shared data.
       
   114         */
       
   115         void SetSmumFlag( const TInt aNewFlagValue );
       
   116 
       
   117         /**
       
   118         * Sets the state of message tone playing -flag
       
   119         */
       
   120         void MsgReceivedTonePlaying( const TUint aPlaying );
       
   121 
       
   122         /**
       
   123         * Fetches the string from CR with given keys
       
   124         * @param aUid Uid to be used
       
   125         * @param aKey Which value is to be fetched
       
   126         * @param aValue Variable to store fetched value
       
   127         * @return KErrNone, when no errors happened
       
   128         */
       
   129         TInt GetString(
       
   130             const TUid&     aUid,
       
   131             const TUint32   aKey,
       
   132             TDes&           aString ) const;
       
   133 
       
   134         /**
       
   135         * Fetches the string from P&S with given keys
       
   136         * @param aUid Uid to be used
       
   137         * @param aKey Which value is to be fetched
       
   138         * @param aValue Variable to store fetched value
       
   139         * @return KErrNone, when no errors happened
       
   140         */
       
   141         TInt GetPSString(
       
   142             const TUid&     aUid,
       
   143             const TUint32   aKey,
       
   144             TDes&           aString ) const;
       
   145 
       
   146 		/**
       
   147         * Fetches the integer from CR with given keys
       
   148         * @param aUid Uid to be used
       
   149         * @param aKey Which value is to be fetched
       
   150         * @param aValue Variable to store fetched value
       
   151         * @return KErrNone, when no errors happened
       
   152         */
       
   153         TInt GetCRInt(
       
   154             const TUid&     aUid,
       
   155             const TUint32   aKey,
       
   156             TInt&           aValue ) const;
       
   157 
       
   158         /**
       
   159         * Fetches the string from CR with given keys
       
   160         * @param aUid Uid to be used
       
   161         * @param aKey Which value is to be fetched
       
   162         * @param aValue Variable that contains value to be stored
       
   163         * @return KErrNone, when no errors happened
       
   164         */
       
   165         TInt SetCRInt(
       
   166             const TUid&     aUid,
       
   167             const TUint32   aKey,
       
   168             const TInt      aValue,
       
   169             const TBool     aSave = EFalse ) const;
       
   170 
       
   171         /**
       
   172         * Checks the count of missed calls and 
       
   173         * updates notification if needed.
       
   174         */    
       
   175 	    void UpdateMissedCallsNotification();      
       
   176 	    
       
   177     protected:
       
   178 
       
   179         /**
       
   180         * By default Symbian OS constructor.
       
   181         */
       
   182         virtual void ConstructL();
       
   183 
       
   184     private:
       
   185  
       
   186         /**
       
   187         * Gets the CR client according to Uid to be used
       
   188         * @param aUid Uid to be used
       
   189         * @param aClient Variable to client shall be stored
       
   190         * @return KErrNone, when succesful
       
   191         */
       
   192         TInt GetClientForUid(
       
   193             const TUid&		aUid,
       
   194             CRepository*&	aClient ) const;
       
   195 	              
       
   196     protected:
       
   197 
       
   198         /**
       
   199         * Stores the current indicator status flags to the shared data file.
       
   200         */
       
   201         void StoreIndicatorStatusFlags();
       
   202 
       
   203     protected: // Data
       
   204 
       
   205         // A pointer to the model.
       
   206         CNcnModelBase* iModel;
       
   207         // A CR session & notifier for logs
       
   208         CRepository* iLogsSession;
       
   209         
       
   210         // Repository handler for logs, owned
       
   211 		CNcnCRRepositoryHandler* iLogsNotifyHandler;
       
   212 		
       
   213         // A CR session for ncnlist
       
   214         CRepository* iNcnSession;
       
   215 		// A CR session for Muiu
       
   216         CRepository* iMuiuSession;
       
   217 		// A CR session & notifier for Smum
       
   218         CRepository* iSmumSession;
       
   219         
       
   220         // Repository handler for Smum, owned
       
   221 		CNcnCRRepositoryHandler* iSmumNotifyHandler;
       
   222         
       
   223         // Repository handler for Muiu, owned
       
   224 		CNcnCRRepositoryHandler*  iMuiuSettingsNotifyHandler;
       
   225 		
       
   226 		// A CR session for profiles
       
   227 		CRepository* iProfileSession;
       
   228 		// A CR session for telephony
       
   229 		CRepository* iTelephonySession;
       
   230 
       
   231 		// Property subscribers
       
   232 		CNcnSubscriber* iAlertToneSubscriber;
       
   233 		CNcnSubscriber* iMsgToneSubscriber;
       
   234 
       
   235         // Tells whether the Shared Data logs file is assigned succesfully.
       
   236         TBool iLogsSDAssignedOk;
       
   237 
       
   238         TBool iSysApSDAssignedOk;
       
   239 
       
   240     };
       
   241 
       
   242 #endif      // NCNCRHANDLER_H
       
   243 
       
   244 // End of File