pimappservices/calendar/server/inc/agsmain.h
changeset 0 f979ecb2b13e
child 31 97232defd20e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 1997-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 
       
    17 #ifndef __AGSMAIN_H__
       
    18 #define __AGSMAIN_H__
       
    19 
       
    20 #include <f32file.h>
       
    21 #include <asclisession.h>
       
    22 #include "agsbackuprestoreagent.h"
       
    23 
       
    24 class CAgnTlsProxy;
       
    25 class RFs;
       
    26 class CAgnServerSession;
       
    27 class CAgnServer;
       
    28 
       
    29 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    30 class CCAgnSystemStateObserver;
       
    31 #endif
       
    32 
       
    33 // Set server priority
       
    34 const TInt KServerPriority = 0;  // EStandard Priority
       
    35 
       
    36 const TUid KUidAgnGeneralPrefs=			{0x10000235};
       
    37 const TUid KUidAgnModel=				{0x100000f1};
       
    38 const TUid KUidAgnPrintSetup=			{0x1000010D};
       
    39 const TUid KUidAgnApp=					{0x10003A5C};
       
    40 
       
    41 enum TAgnServerMode
       
    42 	{
       
    43 	ETransientServer,
       
    44 	ENonTransientServer
       
    45 	};
       
    46 
       
    47 /**
       
    48 Agenda Server - Server Close Timer:
       
    49 An active timer class adding delay before shutting down the agenda server to prevent a cold reboot
       
    50 */
       
    51 class CAgnServUndertaker : public CActive
       
    52 	{
       
    53 public:
       
    54 	static CAgnServUndertaker* NewL();
       
    55 	void ConstructL();
       
    56 	void DestroyServer();
       
    57 	void CancelUndertaker();
       
    58 private:
       
    59 	inline CAgnServUndertaker(TInt aPriority = EPriorityStandard) : CActive(aPriority){};
       
    60 	void DoCancel();
       
    61 	void RunL();
       
    62 private:
       
    63 	TBool	iCancelled;	// set this to cancel the undertaker after it has been started
       
    64 public:
       
    65 	CAgnServer* iServer;
       
    66 	};
       
    67 
       
    68 // CAgnAlarmServerChangeListener
       
    69 //
       
    70 
       
    71 class CAgnAlarmServerChangeListener : public CActive
       
    72     {
       
    73 public:
       
    74     static CAgnAlarmServerChangeListener* NewL(RASCliSession& iAlarmServer, CAgnServFileMgr& iFileMgr);
       
    75     ~CAgnAlarmServerChangeListener();
       
    76     
       
    77 private:
       
    78     CAgnAlarmServerChangeListener(RASCliSession& iAlarmServer, CAgnServFileMgr& iFileMgr);
       
    79     void ConstructL();
       
    80    
       
    81 private:
       
    82     void RunL();
       
    83     void DoCancel();
       
    84     TInt RunError(TInt aError);
       
    85     
       
    86 private:
       
    87     RASCliSession& iAlarmServer;
       
    88     CAgnServFileMgr& iFileMgr;
       
    89     
       
    90     // not used
       
    91     TAlarmId iAlarmId;
       
    92     };
       
    93 
       
    94 // CAgnServer
       
    95 
       
    96 class CAgnServer : public CPolicyServer
       
    97 	{
       
    98 public:
       
    99 	static CAgnServer* NewL();
       
   100 	void ConstructL();
       
   101 	~CAgnServer();
       
   102 
       
   103 	static CAgnServer* InitL(CAgnServUndertaker* aUndertaker);
       
   104 
       
   105 	virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
   106 	inline CAgnServFileMgr* FileMgr();
       
   107 	void SessionClosed();
       
   108 	void SessionAdded();
       
   109 	RFs* FsSession();
       
   110 	void FetchSessionsL(RPointerArray<CAgnServerSession>& aSessions);
       
   111 
       
   112 	TAgnServerMode ServerMode();
       
   113 	CAgnTlsProxy* TimeZoneConverter();
       
   114 	void ShutdownServer();
       
   115 	const CAgnServBackupRestoreAgent& BackupRestoreAgent() const;
       
   116 	RASCliSession& AlarmServer();
       
   117 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
   118 	const CCAgnSystemStateObserver& SystemStateObserver() const;
       
   119 #endif
       
   120 protected:
       
   121 	CAgnServer(TInt aPriority);
       
   122 private:
       
   123 	CAgnServFileMgr* iFileMgr;
       
   124 	CAgnServBackupRestoreAgent* iBackupRestoreAgent;
       
   125 	RFs iFs;
       
   126 	TInt iSessionCount;
       
   127 	CAgnServUndertaker* iUndertaker;	// used to clear itself up
       
   128 	CAgnTlsProxy* iProxy;
       
   129 	TAgnServerMode iServerMode;
       
   130     RASCliSession  iAlarmServer;
       
   131     CAgnAlarmServerChangeListener* iAlarmServerChangeListener;
       
   132 
       
   133 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
   134 	CCAgnSystemStateObserver* iSystemStateObserver;
       
   135 #endif
       
   136 	};
       
   137 
       
   138 // inline functions
       
   139 
       
   140 CAgnServFileMgr* CAgnServer::FileMgr() {return iFileMgr;}
       
   141 
       
   142 #endif