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