|
1 // Copyright (c) 2004-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 // Implementation of CActiveBackupClient class. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @released |
|
21 */ |
|
22 |
|
23 #include "abclient.h" |
|
24 #include "abclientsession.h" |
|
25 #include "abachandler.h" |
|
26 |
|
27 namespace conn |
|
28 { |
|
29 |
|
30 CActiveBackupClient::CActiveBackupClient() : iClientSession(NULL), iABCallbackHandler(NULL) |
|
31 /** |
|
32 Class constructor. |
|
33 */ |
|
34 { |
|
35 } |
|
36 |
|
37 |
|
38 EXPORT_C CActiveBackupClient* CActiveBackupClient::NewL() |
|
39 /** |
|
40 This method creates a CActiveBackupClient, connects to the Secure Backup Server |
|
41 and does not wish to be called back so does not supply an implementation of |
|
42 MActiveBackupDataClient. |
|
43 |
|
44 If this is called when the Secure Backup Server is not active then it will leave |
|
45 with KErrNotSupported. |
|
46 |
|
47 @return Pointer to a created CActiveBackupClient object |
|
48 */ |
|
49 { |
|
50 CActiveBackupClient* self = new (ELeave) CActiveBackupClient(); |
|
51 CleanupStack::PushL(self); |
|
52 self->ConstructL(); |
|
53 CleanupStack::Pop(self); |
|
54 return self; |
|
55 } |
|
56 |
|
57 EXPORT_C CActiveBackupClient* CActiveBackupClient::NewL(MActiveBackupDataClient* aClient) |
|
58 /** |
|
59 This method creates a CActiveBackupClient, connects to the Secure Backup Server |
|
60 and supplies a pointer to a MActiveBackupDataClient implementation. |
|
61 |
|
62 If this is called when the Secure Backup Server is not active then it will leave |
|
63 with KErrNotSupported. |
|
64 |
|
65 @param aClient pointer to an object that implements the MActiveBackupDataClient |
|
66 mixin. If this is NULL then the data owner does not take part in |
|
67 active backup or restore. |
|
68 |
|
69 @panic KErrNotFound Debug only - If an ActiveScheduler is not installed |
|
70 @leave Release only - If an ActiveScheduler is not installed |
|
71 @return Pointer to a created CActiveBackupClient object |
|
72 */ |
|
73 { |
|
74 CActiveBackupClient* self = new (ELeave) CActiveBackupClient(); |
|
75 CleanupStack::PushL(self); |
|
76 self->ConstructL(aClient); |
|
77 CleanupStack::Pop(self); |
|
78 return self; |
|
79 } |
|
80 |
|
81 void CActiveBackupClient::ConstructL() |
|
82 /** |
|
83 Construct this instance of CActiveBackupClient |
|
84 */ |
|
85 { |
|
86 iClientSession = new (ELeave) RABClientSession; |
|
87 |
|
88 User::LeaveIfError(iClientSession->Connect()); |
|
89 } |
|
90 |
|
91 void CActiveBackupClient::ConstructL(MActiveBackupDataClient* aClient) |
|
92 /** |
|
93 Construct this instance of CActiveBackupClient |
|
94 |
|
95 @param aClient Pointer to a concrete instance of MActiveBackupDataClient |
|
96 */ |
|
97 { |
|
98 ConstructL(); |
|
99 |
|
100 iABCallbackHandler = CActiveBackupCallbackHandler::NewL(aClient, *iClientSession); |
|
101 iABCallbackHandler->StartListeningForServerMessagesL(); |
|
102 } |
|
103 |
|
104 |
|
105 EXPORT_C CActiveBackupClient::~CActiveBackupClient() |
|
106 /** |
|
107 Standard destructor. |
|
108 */ |
|
109 { |
|
110 delete iABCallbackHandler; |
|
111 if (iClientSession) |
|
112 { |
|
113 iClientSession->Close(); |
|
114 } |
|
115 delete iClientSession; |
|
116 iClientSession = NULL; |
|
117 } |
|
118 |
|
119 EXPORT_C void CActiveBackupClient::BURModeInfoL(TDriveList& aDriveList, TBURPartType& aBackupType, TBackupIncType& aIncBackupType) |
|
120 /** |
|
121 This method returns the type(s) of backup / restore operation currently active |
|
122 |
|
123 @param aDriveList list of drives involved in backup and restore |
|
124 @param aBackupType enumerated type indicating whether a backup or restore |
|
125 is in progress and whether full or partial. |
|
126 @param aIncBackupType enumerated type indicating whetherr a backup is base |
|
127 or incremental. |
|
128 */ |
|
129 { |
|
130 iClientSession->BURModeInfoL(aDriveList, aBackupType, aIncBackupType); |
|
131 } |
|
132 |
|
133 |
|
134 EXPORT_C TBool CActiveBackupClient::DoesPartialBURAffectMeL() |
|
135 /** |
|
136 This method can be called when a partial backup or restore is active and will indicate |
|
137 whether the calling process is expected to take part. If a full backup or restore is |
|
138 active then this method will return ETrue for all data owners. If no backup or restore |
|
139 is active then this method will return EFalse for all data owners. |
|
140 |
|
141 @return ETrue if the calling data owner is involved in the current backup or restore |
|
142 operation. |
|
143 */ |
|
144 { |
|
145 return iClientSession->DoesPartialBURAffectMeL(); |
|
146 } |
|
147 |
|
148 |
|
149 EXPORT_C void CActiveBackupClient::ConfirmReadyForBURL(TInt aErrorCode) |
|
150 /** |
|
151 This method is called to indicate to the Secure Backup Server that the data owner is ready |
|
152 to participate in backup or restore. The data owner must call this method to indicate |
|
153 readiness or the Secure Backup Server will not request or supply backup data. |
|
154 |
|
155 N.B. The Secure Backup Server will supply snapshot data (if relevant) before a data |
|
156 owner indicates readiness as it assumes that the data owner requires snapshot data in |
|
157 order to prepare for a backp or restore. |
|
158 |
|
159 @param aErrorCode this should be set to KErrNone when the client is ready for |
|
160 backup or restore. If it is set to any other value then it indicates that the client |
|
161 cannot continue with the backup or restore and the error code will be supplied to |
|
162 the remote backup client. |
|
163 */ |
|
164 { |
|
165 iClientSession->ConfirmReadyForBURL(aErrorCode); |
|
166 } |
|
167 |
|
168 } // end of conn namespace |
|
169 |
|
170 |