commonappservices/alarmserver/Server/Include/ASSrvServerWideData.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __ASSRVSERVERWIDEDATA_H__
       
    17 #define __ASSRVSERVERWIDEDATA_H__
       
    18 
       
    19 // System Includes
       
    20 #include <f32file.h>
       
    21 
       
    22 // User Includes
       
    23 #include "ASSrvAnyEventManager.h"
       
    24 #include "ASSrvSessionCollection.h"
       
    25 
       
    26 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    27     #include "assrvsystemstateobserver.h"
       
    28 #endif
       
    29 
       
    30 // Classes Referenced
       
    31 class CASSrvDataPool;
       
    32 class CASSrvAlarmQueue;
       
    33 class CASSrvAlarmStore;
       
    34 class CASSrvAlarmTimer;
       
    35 class CASSrvSoundSettings;
       
    36 class CASSrvSoundController;
       
    37 class MASSrvAnyEventManager;
       
    38 class MASSrvSessionCollection;
       
    39 class CASSrvNotificationCoordinator;
       
    40 class CASSrvEnvironmentChangeManager;
       
    41 
       
    42 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    43     class CASSrvSystemState;
       
    44 #endif
       
    45 
       
    46 
       
    47 /**
       
    48  * The Alarm-Server wide data object which owns most of the worker classes. Split out
       
    49  * from the server so that each of these objects can be tested in isolation from
       
    50  * the server (i.e. the Alarm Server can be tested in a single EXE configuration).
       
    51  */
       
    52 class CASSrvServerWideData : public CBase, public MASSrvAnyEventManager, public MASSrvSessionCollection
       
    53 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    54 , public MASSrvSystemStateObserver
       
    55 #endif
       
    56 	{
       
    57 public:										
       
    58 	static CASSrvServerWideData* NewL();
       
    59 	~CASSrvServerWideData();
       
    60 
       
    61 private:									
       
    62 	CASSrvServerWideData();
       
    63 	void ConstructL();
       
    64 	TTimeIntervalSeconds iCachedUtcOffset;
       
    65 	
       
    66 public:										
       
    67     // Access
       
    68 	RFs& FsSession() const;
       
    69 	CASSrvAlarmQueue& Queue() const;
       
    70 	CASSrvSoundController& SoundController() const;
       
    71 	CASSrvSoundSettings& SoundSettings() const;
       
    72 	CASSrvDataPool& DataPool() const;
       
    73 	CASSrvAlarmTimer& Timer() const;
       
    74 	MASSrvAnyEventManager& AnyEventManager() const;
       
    75 	CASSrvEnvironmentChangeManager& EnvironmentChangeManager() const;
       
    76 	CASSrvNotificationCoordinator& NotificationCoordinator() const;
       
    77 	MASSrvSessionCollection& SessionCollection() const;
       
    78 	/**
       
    79 	 * The previous UTC offset for checking whether it has changed while the Alarm
       
    80 	 * Server was down.
       
    81 	 */
       
    82 	inline TTimeIntervalSeconds& CachedUtcOffset() { return iCachedUtcOffset; }
       
    83 	
       
    84 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    85 	TBool ServerIsReadOnly();
       
    86 #endif
       
    87 
       
    88 private:									
       
    89     // from MASSrvAnyEventManager
       
    90 	void MASAnyEventManagerObserverAddL(MASSrvAnyEventObserver& aObserver);
       
    91 	void MASAnyEventManagerObserverRemove(const MASSrvAnyEventObserver& aObserver);
       
    92 	void MASAnyEventManagerObserverNotifyChanges(TAlarmChangeEvent aEvent, TAlarmId aAlarmId);
       
    93 
       
    94 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    95 private: 
       
    96     // from MASSrvSystemStateObserver
       
    97 	void MHandleSystemStateChange(TState aState);
       
    98 #endif
       
    99 	
       
   100 private:									
       
   101     // from MASSrvSessionCollection
       
   102 	TASSrvSessionId MASSessionCollectionAttachL(const MASSrvSession& aSession);
       
   103 	void MASSessionCollectionDetach(const MASSrvSession& aSession);
       
   104 	TInt MASSessionCollectionAlarmOwner(TAlarmId aAlarmId, TDes& aFullName) const;
       
   105 
       
   106 private:
       
   107 
       
   108 	/**
       
   109 	 * The file server session
       
   110 	 */
       
   111 	RFs iFsSession;
       
   112 	
       
   113 	/**
       
   114 	 * The sound settings
       
   115 	 */
       
   116 	CASSrvSoundSettings* iSoundSettings;
       
   117 	
       
   118 	/**
       
   119 	 * The alarm queue
       
   120 	 */
       
   121 	CASSrvAlarmQueue* iQueue;
       
   122 
       
   123 	/**
       
   124 	 * The alarm timer
       
   125 	 */
       
   126 	CASSrvAlarmTimer* iTimer;
       
   127 
       
   128 	/**
       
   129 	 * The sound controller
       
   130 	 */
       
   131 	CASSrvSoundController* iSoundCountroller;
       
   132 
       
   133 	/**
       
   134 	 * The data pool
       
   135 	 */
       
   136 	CASSrvDataPool* iDataPool;
       
   137 
       
   138 	/**
       
   139 	 * The environment change manager
       
   140 	 */
       
   141 	CASSrvEnvironmentChangeManager* iEnvironmentChangeManager;
       
   142 
       
   143 	/**
       
   144 	 * The notification co-ordinator
       
   145 	 */
       
   146 	CASSrvNotificationCoordinator* iNotificationCoordinator;
       
   147 
       
   148 	/**
       
   149 	 * The alarm store
       
   150 	 */
       
   151 	CASSrvAlarmStore* iStore;
       
   152 
       
   153 	/**
       
   154 	 * The collection of "any event observers"
       
   155 	 */
       
   156 	RPointerArray<MASSrvAnyEventObserver> iAnyEventObservers;
       
   157 
       
   158 	/**
       
   159 	 * The collection of sessions
       
   160 	 */
       
   161 	RPointerArray<const MASSrvSession> iActiveSessions;
       
   162 
       
   163 	/**
       
   164 	 * The next free session identifier
       
   165 	 */
       
   166 	TASSrvSessionId iNextFreeSessionId;
       
   167 	
       
   168 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
   169 	/**
       
   170 	 * Listens to changes in system state such as shutdown.
       
   171 	 **/
       
   172 	CASSrvSystemState* iASSrvSystemState;
       
   173 	
       
   174 	/**
       
   175 	 * A flag to state if the alarm server is in a read only state.
       
   176 	 */
       
   177 	TBool iServerIsReadOnly;
       
   178 #endif
       
   179 	};
       
   180 
       
   181 #endif