epoc32/include/mw/biodb.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 // BIODB.H
       
    15 // 
       
    16 /**
       
    17  * @file 
       
    18  * BIO information file (BIF) database.
       
    19  *
       
    20  * @publishedAll
       
    21  * @released
       
    22  */
    15 
    23 
    16 #ifndef __BIODB_H__
    24 #ifndef __BIODB_H__
    17 #define __BIODB_H__
    25 #define __BIODB_H__
    18 
    26 
    19 #include <bif.h>				// the bif reader
    27 #include <bif.h>				// the bif reader
    20 #include <f32file.h>
    28 #include <f32file.h>
    21 
    29 
       
    30 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS 
       
    31 #include <bifchangeobserver.h>
       
    32 #endif
       
    33 
    22 class CBifEntry;
    34 class CBifEntry;
    23 
       
    24 /** UID of the BIODB.DLL. */
       
    25 const TUid KUidBioDBDll ={0x10005542};	
       
    26 
       
    27 /** Buffer to hold BIF identification text. */
       
    28 typedef TBuf<KMaxBioIdText> TBioMsgIdText;
       
    29 
    35 
    30 /** BIO information file (BIF) database.
    36 /** BIO information file (BIF) database.
    31 
    37 
    32 This class reads the installed BIF files and allows information from them 
    38 This class reads the installed BIF files and allows information from them 
    33 to be easily extracted.
    39 to be easily extracted.
   144 private:
   150 private:
   145 	CArrayPtrFlat<CBioInfoFileReader>* iBifReaders;
   151 	CArrayPtrFlat<CBioInfoFileReader>* iBifReaders;
   146 
   152 
   147 };
   153 };
   148 
   154 
   149 /** Callback interface implemented by classes to receive notifications of BIF files 
       
   150 changes from CBifChangeObserver. 
       
   151 
       
   152 @publishedPartner
       
   153 @released
       
   154 */
       
   155 class MBifChangeObserver 
       
   156 	{
       
   157 public:
       
   158 	/** BIF change events. */
       
   159 	enum TBifChangeEvent
       
   160 		{
       
   161 		/** Unknown change. */
       
   162 		EBifChangeUnknown = 0,
       
   163 		/** BIF added. */
       
   164 		EBifAdded,
       
   165 		/** BIF deleted. */
       
   166 		EBifDeleted,
       
   167 		/** BIF changed. */
       
   168 		EBifChanged
       
   169 		};
       
   170 
       
   171 public: 
       
   172 	/** Called when a BIF change occurs.
       
   173 	
       
   174 	@param aEvent Change event type
       
   175 	@param aBioID BIO message type of changed BIF */
       
   176 	virtual void HandleBifChangeL(TBifChangeEvent aEvent, TUid aBioID)=0;
       
   177 	};
       
   178 
       
   179 /** Active object that watches for changes made to the installed BIF files. 
       
   180 
       
   181 @publishedPartner
       
   182 @released
       
   183 */
       
   184 class CBifChangeObserver : public CActive
       
   185 	{
       
   186 public: 
       
   187 	IMPORT_C static CBifChangeObserver* NewL(MBifChangeObserver& aObserver, RFs& aFs);
       
   188 	IMPORT_C void Start();
       
   189 	~CBifChangeObserver();
       
   190 	
       
   191 	static void CleanupBifArray(TAny* aBifArray);
       
   192 
       
   193 private:
       
   194 	// from CActive
       
   195 	virtual void RunL();
       
   196 	virtual void DoCancel();
       
   197 
       
   198 private:
       
   199 	CBifChangeObserver(MBifChangeObserver& aObserver, RFs& aFs);
       
   200 	void ConstructL();
       
   201 	
       
   202 	void NotifyObserverL();
       
   203 	void WaitForFileNotification();
       
   204 	void DoRunL();
       
   205 	void CopyEntriesL(const CDir& aDir, CArrayFixFlat<TEntry>& aEntries);
       
   206 	TBool CompareReaders(const CBioInfoFileReader& aReader1, const CBioInfoFileReader& aReader2) const;
       
   207 	
       
   208 	TInt FindEntry(const CBifEntry& aBifEntry, const RPointerArray<CBifEntry>& aEntries, TInt& aIndex) const;
       
   209 	
       
   210 private:
       
   211 	MBifChangeObserver&	iChangeObserver;
       
   212 	RFs&			iFs;
       
   213 
       
   214 	RPointerArray<CBifEntry> iEntries;
       
   215 
       
   216 	CBIODatabase*	iBioDB;
       
   217 	RTimer	iTimer;
       
   218 	TInt iRetryCount;
       
   219 	};
       
   220 
       
   221 #endif	// __BIODB_H__
   155 #endif	// __BIODB_H__