|
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 // Defines the object that waits for notification of |
|
15 // Backup/Restore events from the EPOC OS |
|
16 // |
|
17 // |
|
18 |
|
19 #ifndef __BACKUPNOTIFIER_H__ |
|
20 #define __BACKUPNOTIFIER_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <babackup.h> |
|
24 #include "BackupNotifierObserver.h" |
|
25 |
|
26 /** |
|
27 @internalComponent |
|
28 @since 7.0 |
|
29 The notification object which waits for a signal that backup has begun/ended. |
|
30 When its RunL method is called, it notifies its owning CRegistrar class |
|
31 object to suspend/resume persistant storage of the Interface Implementation |
|
32 registration details. |
|
33 */ |
|
34 |
|
35 class CBackupNotifier : public CBase, private MBackupOperationObserver |
|
36 { |
|
37 public: |
|
38 /** |
|
39 @fn NewL(MBackupNotifierObserver& aObserver) |
|
40 Intended Usage : Standardised safe construction which leaves nothing |
|
41 on the cleanup stack. |
|
42 Error Condition : Cannot fully construct because of memory limitations. |
|
43 @leave KErrNoMemory |
|
44 @since 7.0 |
|
45 @param aRegistrar A reference to its owning class instance. |
|
46 @return CBackupNotifier* A pointer to the new class |
|
47 @pre None |
|
48 @post CBackupNotifier is fully constructed, and initialised. |
|
49 */ |
|
50 |
|
51 static CBackupNotifier* NewL(MBackupNotifierObserver& aObserver); |
|
52 |
|
53 /** |
|
54 @fn ~CBackupNotifier() |
|
55 Intended Usage : Standard default d'tor |
|
56 Error Condition : None |
|
57 @since 7.0 |
|
58 @pre CBackupNotifier is fully constructed. |
|
59 @post CBackupNotifier is totally destroyed |
|
60 */ |
|
61 |
|
62 virtual ~CBackupNotifier(); |
|
63 |
|
64 private: |
|
65 /** |
|
66 @fn CBackupNotifier(MBackupNotifierObserver& aObserver) |
|
67 Intended Usage : Default c'tor |
|
68 Error Condition : None |
|
69 @since 7.0 |
|
70 @param aRegistrar A reference to its owning class instance. |
|
71 @pre None |
|
72 @post CBackupNotifier is fully constructed |
|
73 */ |
|
74 |
|
75 CBackupNotifier(MBackupNotifierObserver& aObserver); |
|
76 |
|
77 /** |
|
78 @fn void ConstructL() |
|
79 Intended Usage : Initialisation phase of two phase construction. |
|
80 Error Condition : None |
|
81 @leave None |
|
82 @since 7.0 |
|
83 @pre CBackupNotifier is fully constructed. |
|
84 @post CBackupNotifier is fully initialised. |
|
85 */ |
|
86 |
|
87 void ConstructL(); |
|
88 |
|
89 /** |
|
90 @fn HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes) |
|
91 Intended Usage : To allow a response to be made by an interested party fo a change in state of the |
|
92 backup operation. |
|
93 @leave : @see CBaBackupSessionWrapper::NewL |
|
94 @leave : @see CBaBackupSessionWrapper::RegisterBackupOperationObserverL |
|
95 @since 7.0 |
|
96 @param aBackupOperationAttributes The current state of the backup operation. |
|
97 @return void |
|
98 @pre CBackupNotifier is fully constructed. |
|
99 @post The aBackupOperationAttributes value will have been used |
|
100 to drive the suspend and restore behaviours of the ECOM Server. |
|
101 */ |
|
102 |
|
103 void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes); |
|
104 |
|
105 /** |
|
106 @fn RegisterForNotificationsL() |
|
107 Intended Usage : To allow registration for notifications from the backup operation. |
|
108 Error Condition : None |
|
109 @since 7.0 |
|
110 @pre CBackupNotifier is fully constructed. |
|
111 @post CBackupNotifier is registered for notification messages. |
|
112 */ |
|
113 |
|
114 void RegisterForNotificationsL(); |
|
115 |
|
116 private: |
|
117 /** A reference to its observer instance */ |
|
118 |
|
119 MBackupNotifierObserver& iObserver; |
|
120 /** The owned notification control object */ |
|
121 |
|
122 CBaBackupSessionWrapper* iBackupSession; |
|
123 // Forward declare the retry controller as a friend |
|
124 class CRetryTimer; |
|
125 friend class CRetryTimer; |
|
126 /** The friendly timer for connection retries */ |
|
127 |
|
128 CRetryTimer* iRetryTimer; |
|
129 |
|
130 /** The flag indicating that registration occurred sucessfully */ |
|
131 |
|
132 TBool iIsRegistered; |
|
133 /** Friendship declaration for testing purposes */ |
|
134 friend class TBackupNotifier_StateAccessor; |
|
135 }; |
|
136 |
|
137 #endif // __BACKUPNOTIFIER_H__ |