phonebookengines/contactsmodel/tsrc/TestSyncPlugIn/cntsyncchecker.h
changeset 0 e686773b3f54
child 24 0ba2181d7c28
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2001-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 CNTSYNCCHECKER_H
       
    17 #define CNTSYNCCHECKER_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <cntsync.h>
       
    21 #include <cntdb.h>
       
    22 
       
    23 /*
       
    24 const TUid KUidIccGlobalAdnPhonebook	= { 0x10001111 };
       
    25 const TUid KUidIccGlobalSdnPhonebook	= { 0x10002222 };
       
    26 const TUid KUidIccGlobalLdnPhonebook	= { 0x10003333 };
       
    27 const TUid KUidUsimAppAdnPhonebook		= { 0x10004444 };
       
    28 */
       
    29 
       
    30 const TUid KPropertyCategory = { 0x1020384e };
       
    31 
       
    32 const TUid KUidIccPhonebookNotFound		= {-0x00000001 };
       
    33 
       
    34 class TLookupPhonebookEntry
       
    35 	{
       
    36 	public:
       
    37 		TLookupPhonebookEntry(TUid aPhonebookUid,TInt aPhonebookTemplateId,TInt aPhonebookGroupId);
       
    38 	public:
       
    39 		TUid iPhonebookUid;
       
    40 		TInt iPhonebookTemplateId;
       
    41 		TInt iPhonebookGroupId;
       
    42 	};
       
    43 
       
    44 namespace SyncNotification
       
    45     {
       
    46     const TUid KPropertyCategory = { 0x1020384E };
       
    47 
       
    48     enum TPropertyKeys
       
    49         {
       
    50         ESyncChangeNotification
       
    51         };    
       
    52     }
       
    53 
       
    54 /** 
       
    55  Simulated Phonebook Synchronisation - to test the MContactSynchroniser interface is called correctly.
       
    56 
       
    57  Steps:
       
    58  1. Choose which ICC phonebooks should be present
       
    59 	TInt SetGsmPhonebookL();
       
    60 	TInt SetUsimPhonebookL();
       
    61 	TInt SetPhonebookListL(const RArray<TUid> aNewPhonebookList);
       
    62  
       
    63  2. Define zero or more contacts in the phonebook(s)
       
    64 	TInt AddContactToPhonebookL(TUid aPhonebookUid, const TDesC& aName, const TDesC& aNumber);
       
    65  
       
    66  3. Perform the synchronisation, optionally one phonebook at a time, optionally with an error code
       
    67 	TInt SynchroniseIccPhonebookL(CContactDatabase& aDb, TUid aPhonebookUid, TInt aCompletionError, TInt aSyncError=KErrNone);
       
    68 	TInt SynchroniseIccAllPhonebooksL(CContactDatabase& aDb, TInt aCompletionError, TInt aSyncError=KErrNone);
       
    69 
       
    70 	These methods simulate a real phonebook synchronisation taking place,
       
    71 	(though without ICC read delays):
       
    72 	+ completing all queued notifications for the phonebook.
       
    73 	+ creating a template & group for each phonebook, if none exists,
       
    74 	  or finds the current template & group id so that the ICCtemplateIdL() &
       
    75 	  GroupIdL() methods work
       
    76  
       
    77  4. Reset for next test
       
    78 	TInt ResetSyncIccPhonebookL(TUid aPhonebookUid);
       
    79 	TInt ResetSyncIccAllPhonebooksL();
       
    80 
       
    81  5. At any time set or change the response to ICC Validate requests
       
    82 	TInt ValidateResponseL(MContactSynchroniser::TValidateOperation aOp);
       
    83 	TInt ValidateWriteResponseL();
       
    84 	TInt DeleteContactResponseL();
       
    85 
       
    86  6. At any time track the number of calls to MContactSynchroniser interface
       
    87 	void ResetMethodCallCount();
       
    88 	TInt MethodCallCount();
       
    89   
       
    90  */
       
    91 class CContactSyncChecker : public CBase
       
    92 	{
       
    93 public:
       
    94 	IMPORT_C static CContactSyncChecker* NewL();
       
    95 	IMPORT_C ~CContactSyncChecker();
       
    96 
       
    97 	IMPORT_C static TInt ValidateResponseL(MContactSynchroniser::TValidateOperation aOp);
       
    98 	IMPORT_C static TInt ValidateWriteResponseL();
       
    99 	IMPORT_C static TInt DeleteContactResponseL();
       
   100 	IMPORT_C static TContactItemId ICCTemplateIdL(TUid aPhonebookUid);
       
   101 	IMPORT_C static TContactItemId GroupIdL(TUid aPhonebookUid);
       
   102 	IMPORT_C static TUid PhonebookUidL(TContactItemId aTemplateId);
       
   103 
       
   104 	IMPORT_C static void SetValidateResponseL(MContactSynchroniser::TValidateOperation aOp, TInt aError);
       
   105 	IMPORT_C static void SetValidateWriteResponseL(TInt aError);
       
   106 	IMPORT_C static void SetDeleteContactResponseL(TInt aError);
       
   107 	
       
   108 	
       
   109 	IMPORT_C static TInt UpdatePhonebookTemplateIdL(TUid aPhonebookUid, TInt aPhonebookTemplateId);
       
   110 	IMPORT_C static TInt UpdatePhonebookGroupIdL(TUid aPhonebookUid, TInt aPhonebookGroupId);
       
   111 	
       
   112 	//SetPhonebookEntryL does not exist
       
   113 	IMPORT_C static void SetPhonebookEntryL(TUid aPhonebookUid,TInt aPhonebookTemplateId,TInt aPhonebookGroupId);
       
   114 	IMPORT_C static TInt UpdatePhonebookEntryL(TUid aPhonebookUid,TInt aPhonebookTemplateId,TInt aPhonebookGroupId);
       
   115 
       
   116 	IMPORT_C static TInt SynchroniseIccPhonebookL(CContactDatabase& aDb, TUid aPhonebookUid, TInt aCompletionError, TInt aSyncError);
       
   117 	IMPORT_C static TInt SynchroniseIccAllPhonebooksL(CContactDatabase& aDb, TInt aCompletionError, TInt aSyncError);
       
   118 	IMPORT_C static TInt AddContactToPhonebookL(TUid aPhonebookUid, const TDesC& aName, const TDesC& aNumber);
       
   119 
       
   120 
       
   121 	IMPORT_C static void EnableVerboseLoggingL();
       
   122 	IMPORT_C static TBool VerboseLoggingEnabledL();
       
   123 
       
   124 
       
   125 	IMPORT_C TInt ResetSyncIccPhonebookL(TUid aPhonebookUid, TBool aResetTemplateAndGroupIds);
       
   126 	IMPORT_C TInt ResetSyncIccAllPhonebooksL(TBool aResetTemplateAndGroupIds);
       
   127 
       
   128 
       
   129 	/*
       
   130 	Reset Synchronisation state for all phonebooks, reset plug-in call count and set all validate 
       
   131 	responses to KErrNotFound.
       
   132 	*/
       
   133 
       
   134 	// count the phbksync plug-in method calls
       
   135 	IMPORT_C static void ValidateMethodCalledL();
       
   136 	IMPORT_C static void SyncMethodCalledL();
       
   137 	IMPORT_C static void PluginLoadedL();
       
   138 	IMPORT_C static void PluginUnloadedL();
       
   139 	IMPORT_C static void ResetMethodCallCountsL();
       
   140 	IMPORT_C static TInt ValidateMethodCallCountL();
       
   141 	IMPORT_C static TInt SyncMethodCallCountL();
       
   142 	IMPORT_C static TInt PluginLoadedCountL();
       
   143 	
       
   144 	IMPORT_C static void ResetL();
       
   145 	IMPORT_C static void ResetEverythingL();
       
   146 	IMPORT_C static TInt TotalNotificationPendingCountL();
       
   147 	IMPORT_C static TInt FetchNotificationErrorL(TUid aPhoneBookUid);
       
   148 	IMPORT_C static void SetSynchronisedL(TBool aIsSynchronised, TUid aPhonebookUid); 
       
   149 	IMPORT_C static void StoreNotificationRequestL(TRequestStatus& aStatus, TUid aPhonebookUid);
       
   150 	IMPORT_C TBool IsSynchronisedL(TUid aPhonebookUid);
       
   151 	IMPORT_C static void CompleteNotificationRequestL(TInt aError, TUid aPhonebookUid); 
       
   152 	IMPORT_C static void SetSynchronisedLeaveCodeL(TInt aLeave, TUid aPhonebookUid); 
       
   153  	IMPORT_C static TInt NotificationPendingCountL(TUid aPhonebookUid); 
       
   154 
       
   155 	/*
       
   156 	Configure simulation for GSM Phonebook.
       
   157 	*/
       
   158 	IMPORT_C static TInt SetGsmPhonebookL();
       
   159 
       
   160 	/*
       
   161 	Configure simulation for USIM (UMTS/WCDMA) Phonebook.
       
   162 	*/
       
   163 	IMPORT_C static TInt SetUsimPhonebookL();
       
   164 
       
   165 	/*
       
   166 	Configure custom Phonebook simulation.
       
   167 	*/
       
   168 	IMPORT_C static TInt SetPhonebookListL(const RArray<TUid> aNewPhonebookList);
       
   169 	/*
       
   170 	Get phonebook list
       
   171 	*/
       
   172 	IMPORT_C static TInt PhonebookListL(RArray<TUid>& aPhonebookList);
       
   173 
       
   174  	
       
   175 	};
       
   176 
       
   177 #endif