pimprotocols/phonebooksync/inc/ActiveNotifications.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2002-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 // Header file for Active Object based notification classes.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef __ACTIVENOTIFICATIONS_H__
       
    24 #define __ACTIVENOTIFICATIONS_H__
       
    25 
       
    26 #include <etelmm.h>
       
    27 
       
    28 #include "phbksyncsvr.h"
       
    29 #include "SyncEngineServer.h"
       
    30 
       
    31 
       
    32 /**
       
    33  *  This class is the base class for all the Acitve Notifications.
       
    34  */
       
    35 class CActiveNotificationBase : public CActive
       
    36 	{
       
    37 public:
       
    38 	~CActiveNotificationBase();
       
    39 
       
    40 	TInt Start();
       
    41 
       
    42 	virtual void PostNotification();
       
    43 	virtual void CompleteNotification(TInt aRetVal);
       
    44 	virtual void CancelNotification();
       
    45 
       
    46 protected:
       
    47 	CActiveNotificationBase(CPhoneBookServer& aServer);
       
    48 
       
    49 	void RunL();
       
    50 	TInt RunError(TInt aError);
       
    51 	void DoCancel();
       
    52 	
       
    53 	inline CPhoneBookServer& Server() const { return iServer; };
       
    54 
       
    55 	TBool  iIsNotificationInProgress;
       
    56 	TInt  iLastDelay;
       
    57 
       
    58 private:
       
    59 	CPhoneBookServer&  iServer;
       
    60 	RTimer  iTimer;
       
    61 	};
       
    62 
       
    63 
       
    64 /**
       
    65  *  This class is responsible for implementing the initial request of
       
    66  *  the phone store information (at the RMobilePhone level) for all
       
    67  *  supported phonebook stores from the ICC.
       
    68  *
       
    69  *  It is also responsible for triggering refresh synchronisations
       
    70  *  which require a GetPhoneStoreInfo request to be carried out before
       
    71  *  a sync request.
       
    72  */
       
    73 class CGetPhoneStoreInfo : public CActiveNotificationBase
       
    74 	{
       
    75 public:
       
    76 	static CGetPhoneStoreInfo* NewL(CPhoneBookServer& aServer,
       
    77 									CPhoneBookManager& aPhonebookManager,
       
    78 									RMobilePhone& aPhone);
       
    79 	~CGetPhoneStoreInfo();
       
    80 
       
    81 	virtual void PostNotification();
       
    82 	virtual void CompleteNotification(TInt aRetVal);
       
    83 	virtual void CancelNotification();
       
    84 	
       
    85 	void QueueGetInfoAndSync(TUid aPhonebookUid);
       
    86 
       
    87 private:
       
    88 	CGetPhoneStoreInfo(CPhoneBookServer& aServer,
       
    89 					   CPhoneBookManager& aPhonebookManager,
       
    90 					   RMobilePhone& aPhone);
       
    91 
       
    92 	void SelectNextPhonebook();
       
    93 
       
    94 	CPhoneBookManager&  iPhonebookManager;
       
    95 	RMobilePhone&  iPhone;
       
    96 	TUid  iPhonebookUid;
       
    97 	TBool  iAutoSyncRequired;
       
    98 	TInt  iPhonebookCount;
       
    99 	RMobilePhone::TPhoneStoreNameAndIccType  iStore;
       
   100 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1      iStoreInfoV1;
       
   101 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg  iStoreInfoPckgV1;
       
   102 	RMobilePhoneBookStore::TMobilePhoneBookInfoV2      iStoreInfoV2;
       
   103 	RMobilePhoneBookStore::TMobilePhoneBookInfoV2Pckg  iStoreInfoPckgV2;
       
   104 	RMobilePhoneBookStore::TMobilePhoneBookInfoV5	   iStoreInfoV5;
       
   105  	RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg  iStoreInfoPckgV5;
       
   106  	RArray<TUid>  iPhonebooksToRefresh;
       
   107 	};
       
   108 
       
   109 
       
   110 /**
       
   111  *  Responsible for implementing the initial request and notification
       
   112  *  of any phone lock state or lock info change events.
       
   113  */
       
   114 class CNotifyLockInfoChange : public CActiveNotificationBase
       
   115 	{
       
   116 public:
       
   117 	static CNotifyLockInfoChange* NewL(CPhoneBookServer& iServer,
       
   118 									   RMobilePhone& aPhone);
       
   119 	~CNotifyLockInfoChange();
       
   120 
       
   121 	virtual void PostNotification();
       
   122 	virtual void CompleteNotification(TInt aRetVal);
       
   123 	virtual void CancelNotification();
       
   124 
       
   125 private:
       
   126 	CNotifyLockInfoChange(CPhoneBookServer& iServer,
       
   127 						  RMobilePhone& aPhone);
       
   128 
       
   129 	RMobilePhone&  iPhone;
       
   130 	TInt  iLockInfosReceived;
       
   131 	RMobilePhone::TMobilePhoneLock  iLock;
       
   132 	RMobilePhone::TMobilePhoneLockInfoV1  iLockInfo;
       
   133 	RMobilePhone::TMobilePhoneLockInfoV1Pckg  iLockInfoPckg;
       
   134 	};
       
   135 
       
   136 
       
   137 /**
       
   138  *  This class is responsible for implementing the state machine required to be
       
   139  *  notified of any phone security events.
       
   140  */
       
   141 class CNotifySecurityEvent : public CActiveNotificationBase
       
   142 	{
       
   143 public:
       
   144 	static CNotifySecurityEvent* NewL(CPhoneBookServer& aServer, RMobilePhone& aPhone);
       
   145 	~CNotifySecurityEvent();
       
   146 
       
   147 	virtual void PostNotification();
       
   148 	virtual void CompleteNotification(TInt aRetVal);
       
   149 	virtual void CancelNotification();
       
   150 
       
   151 private:
       
   152 	CNotifySecurityEvent(CPhoneBookServer& aServer, RMobilePhone& aPhone);
       
   153 
       
   154 	RMobilePhone::TMobilePhoneSecurityEvent  iSecurityEvent;
       
   155 	RMobilePhone&  iPhone;
       
   156 	};
       
   157 
       
   158 
       
   159 /**
       
   160  *  This class is responsible for implementing the notification of any
       
   161  *  ETel SAT updates.
       
   162  */
       
   163 class CNotifySATUpdates : public CActiveNotificationBase
       
   164 	{
       
   165 public:
       
   166 	static CNotifySATUpdates* NewL(CPhoneBookServer& aServer, RSat& aSat);
       
   167 	~CNotifySATUpdates();
       
   168 
       
   169 	virtual void PostNotification();
       
   170 	virtual void CompleteNotification(TInt aRetVal);
       
   171 	virtual void CancelNotification();
       
   172 
       
   173 private:
       
   174 	CNotifySATUpdates(CPhoneBookServer& aServer, RSat& aSat);
       
   175 
       
   176 	RSat::TRefreshV1  iRefreshV1;
       
   177 	RSat::TRefreshV1Pckg  iRefreshPckgV1;
       
   178 	RSat::TRefreshV2  iRefreshV2;
       
   179 	RSat::TRefreshV2Pckg  iRefreshPckgV2;
       
   180 	RSat&  iSat;
       
   181 	};
       
   182 
       
   183 
       
   184 /**
       
   185  *  This class is responsible for implementing the notification of the
       
   186  *  USIM Application information change.
       
   187  */ 
       
   188 class CNotifyAppInfoChange : public CActiveNotificationBase
       
   189 	{
       
   190 public:
       
   191 	static CNotifyAppInfoChange* NewL(CPhoneBookServer&aServer,
       
   192 									  RMobilePhone& aPhone);
       
   193 	~CNotifyAppInfoChange();
       
   194 
       
   195 	virtual void PostNotification();
       
   196 	virtual void CompleteNotification(TInt aRetVal);
       
   197 	virtual void CancelNotification();
       
   198 
       
   199 private:
       
   200 	CNotifyAppInfoChange(CPhoneBookServer& aServer, RMobilePhone& aPhone);
       
   201 
       
   202 	RMobilePhone&  iPhone;
       
   203 	TBool  iReceivedInitialValue;
       
   204 	TInt  iAppCount;
       
   205 	RMobilePhone::TAID  iActiveAID;
       
   206 	};
       
   207 
       
   208 
       
   209 /**
       
   210  *  This class is responsible for implementing the secure backup and restore
       
   211  *  operation notification.
       
   212 */ 
       
   213 class CNotifyBackupAndRestore : public CActiveNotificationBase
       
   214 	{
       
   215 public:
       
   216 	static CNotifyBackupAndRestore* NewL(CPhoneBookServer& aServer);
       
   217 	~CNotifyBackupAndRestore();
       
   218 
       
   219 	virtual void PostNotification();
       
   220 	virtual void CompleteNotification(TInt aRetVal);
       
   221 	virtual void CancelNotification();
       
   222 
       
   223 private:
       
   224 	CNotifyBackupAndRestore(CPhoneBookServer& aServer);
       
   225 
       
   226 	void ConstructL();
       
   227 
       
   228 	RProperty iBackupProperty;
       
   229 	};
       
   230 
       
   231 
       
   232 
       
   233 #endif // __ACTIVENOTIFICATIONS_H__