00001 /* 00002 * ============================================================================ 00003 * Name : ActiveApDb.h 00004 * Part of : Access Point Settings Handler UI 00005 * 00006 * Description: Declaration of classes CActiveApDb 00007 * and MActiveApDbObserver. 00008 * Version: 00009 * 00010 * Copyright (C) 2002 Nokia Corporation. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia Corporation. All rights are reserved. Copying, 00014 * including reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia Corporation. This material also contains confidential 00017 * information which may not be disclosed to others without the 00018 * prior written consent of Nokia Corporation. 00019 * 00020 * ============================================================================ 00021 */ 00022 00023 #ifndef ACTIVE_APDB_H 00024 #define ACTIVE_APDB_H 00025 00026 // INCLUDES 00027 #include <commdb.h> 00028 #include <ApEngineVer.h> 00029 00030 /* 00031 // Enum for DATABASE_TYPE field 00032 // Will be deprecated in 7.0 00033 enum TCommDbDatabaseType 00034 { 00035 EUnspecified = 0, // not specifying which type it is - any type of 00036 // database can be opened with this parameter 00037 EIAP, 00038 EISP 00039 }; 00040 */ 00041 00042 // CONSTANTS 00043 const TInt KErrActiveApDbObserverNotFound = -500; 00044 00045 // FORWARD DECLARATION 00046 class CActiveApDbNotifier; 00047 00048 // CLASS DECLARATION 00049 00054 class MActiveApDbObserver 00055 { 00056 public: // types 00057 enum TEvent 00058 { 00059 EDbChanged, 00060 EDbClosing, 00061 EDbAvailable 00062 }; 00063 00064 public: // new methods 00065 00072 IMPORT_C virtual void HandleApDbEventL( TEvent anEvent ) = 0; 00073 00074 }; 00075 00084 NONSHARABLE_CLASS( CActiveApDb ) : public CBase 00085 { 00086 00087 public: // Constructors and destructor 00095 IMPORT_C static CActiveApDb* NewL 00096 ( TCommDbDatabaseType aType = EDatabaseTypeIAP ); 00097 00098 00099 00104 IMPORT_C virtual ~CActiveApDb(); 00105 00106 protected: // Constructors 00107 00113 void ConstructL(); 00114 00115 public: // new methods 00125 IMPORT_C void AddObserverL( MActiveApDbObserver* anObserver ); 00126 00127 00133 IMPORT_C void RemoveObserver( MActiveApDbObserver* anObserver ); 00134 00135 00141 IMPORT_C CCommsDatabase* Database(); 00142 00143 private: 00150 void HandleDbEventL( TInt anEvent ); 00151 00152 00157 void NotifyObserversL( MActiveApDbObserver::TEvent anEvent ); 00158 00159 friend class CActiveApDbNotifier; 00160 00161 private: // types 00165 CActiveApDb(); 00166 00167 00168 enum TState 00169 { 00170 EClosed, 00171 EReady, 00172 EWaitClose, 00173 EWaitBackupRestore, 00174 EWaitShutdown 00175 }; 00176 00177 private: // Data 00178 CArrayPtrFlat<MActiveApDbObserver>* iObservers; 00179 00180 CCommsDatabase* iDb; // Creates & owns it ! 00181 // CommsDb has its own RDbNotifier... 00182 TState iState; 00183 CActiveApDbNotifier* iDbNotifier; 00184 }; 00185 00186 #endif 00187 00188 // End of File