idlefw/plugins/devicestatus/inc/aiprofilepublisher.h
changeset 0 79c6a41cd166
child 16 b276298d5729
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Profile publisher
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AIPROFILEPUBLISHER_H
       
    20 #define C_AIPROFILEPUBLISHER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <RSSSettings.h>
       
    24 #include <MSSSettingsObserver.h>
       
    25 #include <MProfileChangeObserver.h>
       
    26 #include "aidevicestatuspublisher.h"
       
    27 #include "aidevicestatuscontentmodel.h"
       
    28 
       
    29 class MProfileEngine;
       
    30 class MAiDeviceStatusContentObserver;
       
    31 class MAiPropertyExtension;
       
    32 class CProfileChangeNotifyHandler;
       
    33 
       
    34 /**
       
    35  *  @ingroup group_devicestatusplugin
       
    36  *
       
    37  *  Observers profile changes and publishes profile name when profile
       
    38  *  has been changed or if ALS status changes.
       
    39  *
       
    40  *  @since S60 3.2
       
    41  */
       
    42 class CAiProfilePublisher : public CBase, public MAiDeviceStatusPublisher,
       
    43                             public MSSSettingsObserver, public MProfileChangeObserver
       
    44     {
       
    45 public:
       
    46 
       
    47     static CAiProfilePublisher* NewL();
       
    48 
       
    49     virtual ~CAiProfilePublisher();
       
    50 
       
    51 protected:
       
    52 
       
    53 // from base class MAiDeviceStatusPublisher
       
    54 
       
    55     void ResumeL();
       
    56     void Subscribe( MAiContentObserver& aObserver, 
       
    57                     MAiPropertyExtension& aExtension,
       
    58                     MAiPublishPrioritizer& aPrioritizer,
       
    59                     MAiPublisherBroadcaster& aBroadcaster );
       
    60     void RefreshL( TBool aClean );
       
    61     TBool RefreshL( TInt aContentId, TBool aClean );
       
    62     TBool RefreshContentWithPriorityL( TInt aContentId, TInt aPriority );
       
    63     
       
    64     
       
    65 protected:
       
    66 
       
    67 // from base class MSSSettingsObserver
       
    68 
       
    69     /**
       
    70      * Called when SS Settings changes.
       
    71      */
       
    72     void PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue );
       
    73 
       
    74 // from base class MProfileChangeObserver
       
    75 
       
    76     /**
       
    77      * Called when active profile changes.
       
    78      */
       
    79     void HandleActiveProfileEventL( TProfileEvent aProfileEvent, TInt aProfileId );
       
    80 
       
    81 private:
       
    82 
       
    83     CAiProfilePublisher();
       
    84 
       
    85     void ConstructL();
       
    86 
       
    87     /**
       
    88      * Clean last published profile.
       
    89      */
       
    90     void CleanLastProfileL();
       
    91 
       
    92     /**
       
    93      * Get active profile from profile engine and publish it.
       
    94      */
       
    95     void RefreshProfileL(TBool aClean);
       
    96 
       
    97 
       
    98 protected: // data
       
    99 
       
   100     /**
       
   101      * Client to listen SS setting changes.
       
   102      */
       
   103     RSSSettings iSSSettings;
       
   104 
       
   105     /**
       
   106      * Profile engine.
       
   107      * Own.
       
   108      */
       
   109     MProfileEngine* iProfileEngine;
       
   110 
       
   111     /**
       
   112      * Profile change notifier.
       
   113      * Own.
       
   114      */
       
   115     CProfileChangeNotifyHandler* iProfileNotifier;
       
   116 
       
   117     /**
       
   118      * Content observer.
       
   119      * Not own.
       
   120      */
       
   121     MAiContentObserver* iContentObserver;
       
   122 
       
   123     /**
       
   124      * Property extension.
       
   125      * Not own.
       
   126      */
       
   127     MAiPropertyExtension* iExtension;
       
   128 
       
   129 	/**
       
   130 	 * Content prioritizer.
       
   131 	 * Not own.
       
   132 	 */
       
   133 	MAiPublishPrioritizer* iPrioritizer;
       
   134 	
       
   135 	/**
       
   136 	 * Publish broadcaster.
       
   137 	 * Not own.
       
   138 	 */
       
   139 	MAiPublisherBroadcaster* iBroadcaster;
       
   140     
       
   141     enum TLastPublishedProfile
       
   142         {
       
   143         ENothingPublished = -1,        
       
   144         EGeneralProfilePublished = 0,
       
   145         EOfflineProfilePublished = 5,
       
   146         EOtherProfilePublished = 10
       
   147         };
       
   148     
       
   149     /**
       
   150      * Last published profile.
       
   151      */
       
   152     TLastPublishedProfile iLastPublishedProfileId;
       
   153     
       
   154     /**
       
   155      * True if last published profile was silent.
       
   156      */
       
   157     TBool iLastPublishedProfileSilent;
       
   158     
       
   159     /**
       
   160      * True if last published profile was timed.
       
   161      */    
       
   162     TBool iLastPublishedProfileTimed;
       
   163 
       
   164     /**
       
   165      * True if publish was successful.
       
   166      */
       
   167     TBool iSuccess;
       
   168     
       
   169     /**
       
   170      * True if active profile is changed or modified.
       
   171      */
       
   172     TBool iActiveProfilePublish;
       
   173     };
       
   174 
       
   175 
       
   176 #endif // C_AIPROFILEPUBLISHER_H