idlefw/plugins/profileplugin/inc/caiprofileengine.h
changeset 0 79c6a41cd166
child 8 d0529222e3f0
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Header file for the CAiProfileEngine class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAIPROFILEENGINE_H
       
    20 #define CAIPROFILEENGINE_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include <ConeResLoader.h>
       
    26 #include <MSSSettingsObserver.h>
       
    27 #include <MProfileChangeObserver.h>
       
    28 #include "maiprofilepluginnotifier.h"
       
    29 
       
    30 class MProfileEngine;
       
    31 class CProfileChangeNotifyHandler;
       
    32 class MProfilesNamesArray;
       
    33 class RSSSettings;
       
    34 
       
    35 /**
       
    36  *  @ingroup group_profileplugin
       
    37  *
       
    38  *  CAiProfileEngine
       
    39  *
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 class CAiProfileEngine : public CBase, 
       
    43 						 public MSSSettingsObserver,
       
    44 						 public MProfileChangeObserver					 
       
    45 {
       
    46 
       
    47 public:  // Constructors and destructor
       
    48 
       
    49     /**
       
    50     * Constructor to use in the object creation. Initializes the necessary data.
       
    51     *
       
    52     * @param MAiProfilePluginNotifier* aNotifier a pointer to a object implementing MAiProfilePluginNotifier
       
    53             (the object ordering a notification of the content status change)
       
    54     * @return none
       
    55     */
       
    56     CAiProfileEngine( MAiProfilePluginNotifier* aProfilePluginNotifier );
       
    57 
       
    58     /**
       
    59     * Part of the two phased constuction
       
    60     *
       
    61     * @param MAiProfilePluginNotifier* aNotifier a pointer to a object implementing MAiProfilePluginNotifier
       
    62             (the object ordering a notification of the content status change)
       
    63     * @return Pointer to the created CAiProfileEngine object
       
    64     */
       
    65     static CAiProfileEngine* NewL( MAiProfilePluginNotifier* aProfilePluginNotifier );
       
    66 
       
    67     /**
       
    68     * Destructor
       
    69     *
       
    70     * @param none
       
    71     * @return none
       
    72     */
       
    73     ~CAiProfileEngine();
       
    74     
       
    75     /**
       
    76     * Resumes the engine
       
    77     *
       
    78     * @param void
       
    79     * @return void
       
    80     */
       
    81     void ResumeL();
       
    82 
       
    83     /**
       
    84     * Suspends the engine
       
    85     *
       
    86     * @param void
       
    87     * @return void
       
    88     */
       
    89     void Suspend();
       
    90 
       
    91 public:
       
    92 
       
    93 	const TDesC& ActiveProfileName() const;
       
    94 	
       
    95 	const TDesC& SwapProfileName() const;
       
    96 		
       
    97 	TInt NumberOfProfiles();
       
    98 	
       
    99 	const TDesC& ProfileNameByIndex( TInt aIndex ) const;
       
   100 	
       
   101 	void HandleAiEventL( TInt aEvent, const TDesC& aParam );
       
   102 	
       
   103 	void SetActiveProfileL( const TInt aProfileId );
       
   104 	
       
   105 	TBool IsActiveProfileSilentL();
       
   106 	
       
   107 	TBool IsActiveProfileTimedL();
       
   108 	
       
   109 	void UpdateProfileNamesL();
       
   110 	
       
   111 	TBool IsOffline();
       
   112    
       
   113 private:
       
   114 
       
   115     void ConstructL();
       
   116     
       
   117     void SetActiveProfileNameL( const TDesC& aName );
       
   118     
       
   119     void SetSwapProfileNameL( const TDesC& aName );
       
   120     
       
   121     void SetProfileNameListL( const MProfilesNamesArray& aArray );
       
   122     
       
   123     void HandleSwitchByNameL( const TDesC& aParam );
       
   124     
       
   125     void HandleSwitchByIndexL( const TDesC& aParam );
       
   126     
       
   127     void HandleSwapL( const TDesC& aParam );
       
   128     
       
   129     void HandleEditActiveProfileL();
       
   130     
       
   131     TBool ShowOfflineMessageL();
       
   132            
       
   133   
       
   134 protected:
       
   135 
       
   136 // from base class MSSSettingsObserver
       
   137 
       
   138     /**
       
   139      * Called when SS Settings changes.
       
   140      */
       
   141     void PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue );
       
   142 
       
   143 
       
   144 // from base class MProfileChangeObserver
       
   145 
       
   146     /**
       
   147      * Called when active profile changes.
       
   148      */
       
   149     void HandleActiveProfileEventL( TProfileEvent aProfileEvent, TInt aProfileId );
       
   150     
       
   151 private:
       
   152     /**
       
   153      * Pointer to the class implementing the MAiProfilePluginNotifier interface
       
   154      */
       
   155     MAiProfilePluginNotifier* iProfilePluginNotifier;
       
   156     
       
   157     /**
       
   158      * Client to listen SS setting changes.
       
   159      */
       
   160     RSSSettings iSSSettings;
       
   161 
       
   162     /**
       
   163      * Profile engine.
       
   164      * Own.
       
   165      */
       
   166     MProfileEngine* iProfileEngine;
       
   167 
       
   168     /**
       
   169      * Profile change notifier.
       
   170      * Own
       
   171      */
       
   172     CProfileChangeNotifyHandler* iProfileNotifier;
       
   173     
       
   174     /*
       
   175      * Active profile name
       
   176      * Own
       
   177      */    
       
   178     HBufC* iActiveProfileName;
       
   179     
       
   180     /*
       
   181      * Swap profile name
       
   182      * Own
       
   183      */    
       
   184     HBufC* iSwapProfileName;
       
   185     
       
   186     /**
       
   187      * Array of Profile Name Pointer.
       
   188      * Own.
       
   189      */
       
   190     RPointerArray<HBufC> iProfileNamePointerArray;
       
   191     
       
   192     /**
       
   193      * Resource loader for own resources.
       
   194      */
       
   195     RConeResourceLoader iResourceLoader;
       
   196 
       
   197 };
       
   198 
       
   199 #endif // CAIPROFILEENGINE_H
       
   200 
       
   201