author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:20:42 +0300 | |
branch | RCL_3 |
changeset 73 | 79647526f98c |
parent 70 | e8965914fac7 |
child 81 | 42552535c1ac |
permissions | -rw-r--r-- |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
66 | 14 |
* Description: This module contains the implementation of RIAUpdateClient |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* class member functions. |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
* |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
//INCLUDES |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <eikenv.h> |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <apgcli.h> |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <e32math.h> |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "iaupdateclient.h" |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include "iaupdateclientdefines.h" |
66 | 27 |
#include "iaupdatetools.h" |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include "iaupdatedebug.h" |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
// ----------------------------------------------------------------------------- |
66 | 32 |
// RIAUpdateClient::RIAUpdateClient |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
// |
66 | 36 |
RIAUpdateClient::RIAUpdateClient() |
37 |
: iPtr1( NULL, 0 ), |
|
38 |
iPtr2( NULL, 0 ), |
|
39 |
iPtr3( NULL, 0 ) |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
{ |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
} |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
// ----------------------------------------------------------------------------- |
66 | 45 |
// RIAUpdateClient::Open |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
// |
66 | 49 |
TInt RIAUpdateClient::Open() |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
{ |
66 | 51 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::Open() begin"); |
52 |
TInt error( KErrNone ); |
|
53 |
||
54 |
if ( !iConnected ) |
|
65
7333d7932ef7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
55 |
{ |
66 | 56 |
TRAP( error, ConnectNewAppL( ServiceUid() ) ); |
57 |
if ( error == KErrNone ) |
|
58 |
{ |
|
59 |
iConnected = ETrue; |
|
60 |
CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
61 |
if ( eikEnv ) |
|
62 |
{ |
|
63 |
RWindowGroup owngroup; |
|
64 |
iOwnWgId = eikEnv->RootWin().Identifier(); |
|
65 |
||
66 |
TPckg<TInt> wgId( iOwnWgId ); |
|
67 |
delete iData; |
|
68 |
iData = NULL; |
|
69 |
TRAP_IGNORE( iData = wgId.AllocL() ); |
|
70 |
||
71 |
TIpcArgs args; |
|
72 |
args.Set( 0, iData ); |
|
73 |
SendReceive( IAUpdateClientDefines::EIAUpdateServerSendWgId, args ); |
|
74 |
} |
|
75 |
} |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
} |
66 | 77 |
IAUPDATE_TRACE_1("[IAUPDATE] RIAUpdateClient::Open() end error code: %d", error ); |
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
return error; |
66 | 79 |
} |
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
|
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
// ----------------------------------------------------------------------------- |
66 | 82 |
// RIAUpdateClient::OpenToBackroundAsync |
83 |
// |
|
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
TInt RIAUpdateClient::OpenToBackroundAsync( TRequestStatus& aStatus ) |
|
87 |
{ |
|
88 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::OpenToBackroundAsync() begin"); |
|
89 |
TInt error( KErrNone ); |
|
90 |
if ( !iConnected ) |
|
91 |
{ |
|
92 |
TRAP( error, StartNewAppToBackgroundL( ServiceUid(), aStatus ) ); |
|
93 |
} |
|
73
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
94 |
else |
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
95 |
{ |
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
96 |
error = KErrAlreadyExists; |
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
97 |
} |
66 | 98 |
IAUPDATE_TRACE_1("[IAUPDATE] RIAUpdateClient::OpenToBackroundAsync() end error code: %d", error ); |
99 |
return error; |
|
100 |
} |
|
101 |
||
102 |
// ----------------------------------------------------------------------------- |
|
103 |
// RIAUpdateClient::ConnectToApp |
|
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
104 |
// |
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
// ----------------------------------------------------------------------------- |
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
// |
66 | 107 |
TInt RIAUpdateClient::ConnectToApp() |
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
{ |
66 | 109 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::ConnectToApp() begin"); |
110 |
TInt error( KErrNone ); |
|
73
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
111 |
if ( iConnected ) |
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
112 |
{ |
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
113 |
return error; |
79647526f98c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
70
diff
changeset
|
114 |
} |
66 | 115 |
TName serverName; |
116 |
ServerName(serverName, ServiceUid(), iDifferentiator); |
|
117 |
TRAP( error,ConnectExistingByNameL( serverName ) ); |
|
118 |
||
119 |
if ( error == KErrNone ) |
|
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
{ |
66 | 121 |
iConnected = ETrue; |
122 |
CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
123 |
if ( eikEnv ) |
|
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
{ |
66 | 125 |
RWindowGroup owngroup; |
126 |
iOwnWgId = eikEnv->RootWin().Identifier(); |
|
127 |
||
128 |
TPckg<TInt> wgId( iOwnWgId ); |
|
129 |
delete iData; |
|
130 |
iData = NULL; |
|
131 |
TRAP_IGNORE( iData = wgId.AllocL() ); |
|
132 |
||
133 |
TIpcArgs args; |
|
134 |
args.Set( 0, iData ); |
|
135 |
SendReceive( IAUpdateClientDefines::EIAUpdateServerSendWgId, args ); |
|
136 |
} |
|
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
137 |
} |
66 | 138 |
IAUPDATE_TRACE_1("[IAUPDATE] RIAUpdateClient::ConnectToApp() end error code: %d", error ); |
139 |
return error; |
|
140 |
} |
|
141 |
||
142 |
||
143 |
||
144 |
||
145 |
// ----------------------------------------------------------------------------- |
|
146 |
// RIAUpdateClient::Close |
|
147 |
// |
|
148 |
// ----------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
void RIAUpdateClient::Close() |
|
151 |
{ |
|
152 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::Close() begin"); |
|
153 |
// Let the parent handle closing. |
|
70
e8965914fac7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
154 |
REikAppServiceBase::Close(); |
66 | 155 |
iConnected = EFalse; |
156 |
delete iData; |
|
157 |
iData = NULL; |
|
158 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::Close() end"); |
|
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
} |
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
|
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
// ----------------------------------------------------------------------------- |
66 | 162 |
// RIAUpdateClient::CheckUpdates |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
// |
66 | 166 |
TInt RIAUpdateClient::CheckUpdates( const CIAUpdateParameters& aUpdateParameters, |
167 |
TInt& aAvailableUpdates, |
|
168 |
TRequestStatus& aStatus ) |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
{ |
66 | 170 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::CheckUpdates()"); |
171 |
// Inform the caller about the success of the request initializing. |
|
172 |
return SendCheckUpdatesRequest( IAUpdateClientDefines::EIAUpdateServerCheckUpdates, |
|
173 |
aUpdateParameters, |
|
174 |
aAvailableUpdates, |
|
175 |
aStatus ); |
|
176 |
} |
|
177 |
||
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// RIAUpdateClient::ShowUpdates |
|
180 |
// |
|
181 |
// ----------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
TInt RIAUpdateClient::ShowUpdates( const CIAUpdateParameters& aUpdateParameters, |
|
184 |
TInt& aNumberOfSuccessfullUpdates, |
|
185 |
TInt& aNumberOfFailedUpdates, |
|
186 |
TInt& aNumberOfCancelledUpdates, |
|
187 |
TRequestStatus& aStatus ) |
|
188 |
{ |
|
189 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::ShowUpdates()"); |
|
190 |
// Inform the caller about the success of the request initializing. |
|
191 |
return SendUpdateRequest( IAUpdateClientDefines::EIAUpdateServerShowUpdates, |
|
192 |
aUpdateParameters, |
|
193 |
aNumberOfSuccessfullUpdates, |
|
194 |
aNumberOfFailedUpdates, |
|
195 |
aNumberOfCancelledUpdates, |
|
196 |
aStatus ); |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
} |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
// ----------------------------------------------------------------------------- |
66 | 201 |
// RIAUpdateClient::UpdateQuery |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
// |
66 | 205 |
TInt RIAUpdateClient::UpdateQuery( TBool& aUpdateNow, TRequestStatus& aStatus ) |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
{ |
66 | 207 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::UpdateQuery() begin"); |
208 |
TPckg<TBool> updateNow( aUpdateNow ); |
|
209 |
iPtr1.Set( updateNow ); |
|
210 |
||
211 |
TIpcArgs args; |
|
212 |
args.Set( 1, &iPtr1 ); |
|
213 |
||
214 |
SendReceive( IAUpdateClientDefines::EIAUpdateServerShowUpdateQuery, |
|
215 |
args, |
|
216 |
aStatus ); |
|
217 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::UpdateQuery() begin"); |
|
218 |
return KErrNone; |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
} |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
// ----------------------------------------------------------------------------- |
66 | 222 |
// RIAUpdateClient::BroughtToForeground |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
// |
66 | 226 |
void RIAUpdateClient::BroughtToForeground() |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
{ |
66 | 228 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::BroughtToForeground() begin"); |
229 |
if ( iConnected ) |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
{ |
66 | 231 |
SendReceive( IAUpdateClientDefines::EIAUpdateServerToForeground ); |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
232 |
} |
66 | 233 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::BroughtToForeground() end"); |
234 |
} |
|
235 |
||
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
// ----------------------------------------------------------------------------- |
66 | 238 |
// RIAUpdateClient::CancelAsyncRequest |
239 |
// |
|
240 |
// ----------------------------------------------------------------------------- |
|
241 |
// |
|
242 |
void RIAUpdateClient::CancelAsyncRequest() |
|
243 |
{ |
|
244 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::CancelAsyncRequest() begin"); |
|
245 |
// We suppose that an active object will |
|
246 |
// wait for the cancellation to complete. |
|
247 |
// So, let the server know that operation is cancelled. |
|
248 |
// The server should set the correct status and complete |
|
249 |
// the request of the active object. So, the cancellation |
|
250 |
// can proceed to the end. |
|
251 |
if ( iConnected ) |
|
252 |
{ |
|
253 |
SendReceive( IAUpdateClientDefines::EIAUpdateServerCancel ); |
|
254 |
} |
|
255 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::CancelAsyncRequest() end"); |
|
256 |
} |
|
257 |
||
258 |
||
259 |
||
260 |
// ----------------------------------------------------------------------------- |
|
261 |
// RIAUpdateClient::ServiceUid() |
|
262 |
// |
|
263 |
// ----------------------------------------------------------------------------- |
|
264 |
// |
|
265 |
TUid RIAUpdateClient::ServiceUid() const |
|
266 |
{ |
|
267 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::ServiceUid()"); |
|
268 |
return IAUpdateClientDefines::KIAUpdateServiceUid; |
|
269 |
} |
|
270 |
||
271 |
// ----------------------------------------------------------------------------- |
|
272 |
// RIAUpdateClient::SendCheckUpdatesRequest |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
// |
66 | 276 |
TInt RIAUpdateClient::SendCheckUpdatesRequest( TInt aUpdateFunction, |
277 |
const CIAUpdateParameters& aUpdateParameters, |
|
278 |
TInt& aCount, |
|
279 |
TRequestStatus& aStatus ) |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
{ |
66 | 281 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::SendCheckUpdatesRequest() begin"); |
282 |
||
283 |
aStatus = KRequestPending; |
|
284 |
||
285 |
delete iData; |
|
286 |
iData = NULL; |
|
287 |
||
288 |
TInt error( KErrNone ); |
|
289 |
TRAP( error, |
|
290 |
IAUpdateTools::ExternalizeParametersL( iData, |
|
291 |
aUpdateParameters ) ); |
|
292 |
IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", error ); |
|
293 |
||
294 |
// Because this function does not leave, |
|
295 |
// use error value to check if request can be done. |
|
296 |
if ( error == KErrNone ) |
|
65
7333d7932ef7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
297 |
{ |
66 | 298 |
TPckg<TInt> count( aCount ); |
299 |
iPtr1.Set( count ); |
|
300 |
||
301 |
TIpcArgs args; |
|
302 |
args.Set( 0, iData ); |
|
303 |
args.Set( 1, &iPtr1 ); |
|
304 |
||
305 |
// Start the asynchronous operation in the server side. |
|
306 |
SendReceive( aUpdateFunction, args, aStatus ); |
|
65
7333d7932ef7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
307 |
} |
66 | 308 |
|
309 |
// Inform the caller about the success of the request initializing. |
|
310 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::SendCheckUpdatesRequest() begin"); |
|
311 |
return error; |
|
65
7333d7932ef7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
312 |
} |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
313 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
// ----------------------------------------------------------------------------- |
66 | 315 |
// RIAUpdateClient::SendUpdateRequest |
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
// |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
317 |
// ----------------------------------------------------------------------------- |
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
// |
66 | 319 |
TInt RIAUpdateClient::SendUpdateRequest( TInt aUpdateFunction, |
320 |
const CIAUpdateParameters& aUpdateParameters, |
|
321 |
TInt& aNumberOfSuccessfullUpdates, |
|
322 |
TInt& aNumberOfFailedUpdates, |
|
323 |
TInt& aNumberOfCancelledUpdates, |
|
324 |
TRequestStatus& aStatus ) |
|
65
7333d7932ef7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
325 |
{ |
66 | 326 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::SendUpdateRequest() begin"); |
327 |
aStatus = KRequestPending; |
|
328 |
||
329 |
delete iData; |
|
330 |
iData = NULL; |
|
331 |
||
332 |
TInt error( KErrNone ); |
|
333 |
TRAP( error, |
|
334 |
IAUpdateTools::ExternalizeParametersL( iData, |
|
335 |
aUpdateParameters ) ); |
|
336 |
IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", error ); |
|
337 |
// Because this function does not leave, |
|
338 |
// use error value to check if request can be done. |
|
339 |
if ( error == KErrNone ) |
|
340 |
{ |
|
341 |
TPckg<TInt> successCount( aNumberOfSuccessfullUpdates ); |
|
342 |
iPtr1.Set( successCount ); |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
|
66 | 344 |
TPckg<TInt> failCount( aNumberOfFailedUpdates ); |
345 |
iPtr2.Set( failCount ); |
|
346 |
||
347 |
TPckg<TInt> cancelCount( aNumberOfCancelledUpdates ); |
|
348 |
iPtr3.Set( cancelCount ); |
|
349 |
||
350 |
TIpcArgs args; |
|
351 |
args.Set( 0, iData ); |
|
352 |
args.Set( 1, &iPtr1 ); |
|
353 |
args.Set( 2, &iPtr2 ); |
|
354 |
args.Set( 3, &iPtr3 ); |
|
355 |
||
356 |
// Start the asynchronous operation in the server side. |
|
357 |
SendReceive( aUpdateFunction, args, aStatus ); |
|
358 |
} |
|
359 |
||
360 |
// Inform the caller about the success of the request initializing. |
|
361 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::SendUpdateRequest() end"); |
|
362 |
return error; |
|
363 |
} |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
364 |
|
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
// ----------------------------------------------------------------------------- |
66 | 366 |
// RIAUpdateClient::StartNewAppToBackgroundL |
36
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
367 |
// |
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
// ----------------------------------------------------------------------------- |
f9033e605ee2
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
369 |
// |
66 | 370 |
void RIAUpdateClient::StartNewAppToBackgroundL( TUid aAppUid, TRequestStatus& aStatus ) |
371 |
{ |
|
372 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::StartNewAppToBackgroundL() begin"); |
|
373 |
TName notUsed; |
|
374 |
iDifferentiator = GenerateServerDifferentiatorAndName(notUsed, aAppUid); |
|
375 |
||
376 |
RApaLsSession apa; |
|
377 |
User::LeaveIfError(apa.Connect()); |
|
378 |
CleanupClosePushL(apa); |
|
379 |
||
380 |
TApaAppInfo info; |
|
381 |
User::LeaveIfError(apa.GetAppInfo(info, aAppUid)); |
|
382 |
||
383 |
CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
384 |
cmdLine->SetExecutableNameL(info.iFullName); |
|
385 |
cmdLine->SetServerRequiredL( iDifferentiator ); |
|
386 |
cmdLine->SetCommandL(EApaCommandBackground); |
|
387 |
||
388 |
TThreadId notUsedId; |
|
389 |
User::LeaveIfError(apa.StartApp(*cmdLine, notUsedId, &aStatus)); |
|
390 |
||
391 |
CleanupStack::PopAndDestroy(2, &apa); // cmdLine and apa |
|
392 |
IAUPDATE_TRACE("[IAUPDATE] RIAUpdateClient::StartNewAppToBackgroundL() end"); |
|
393 |
} |
|
0
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
394 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
395 |
|
ba25891c3a9e
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
396 |
|
66 | 397 |
void RIAUpdateClient::ServerName(TName& aServerName, TUid aAppServerUid, TUint aServerDifferentiator) |
398 |
{ |
|
399 |
_LIT(KServerNameFormat, "%08x_%08x_AppServer"); |
|
400 |
aServerName.Format(KServerNameFormat, aServerDifferentiator, aAppServerUid); |
|
401 |
} |
|
402 |
||
403 |
TUint RIAUpdateClient::GenerateServerDifferentiatorAndName(TName& aServerName, TUid aAppServerUid) |
|
404 |
{ |
|
405 |
TUint r; |
|
406 |
FOREVER |
|
407 |
{ |
|
408 |
r = Math::Random(); |
|
409 |
if (r==0) |
|
410 |
continue; |
|
411 |
ServerName(aServerName, aAppServerUid, r); |
|
412 |
TFindServer find(aServerName); |
|
413 |
TFullName fullName; |
|
414 |
if (find.Next(fullName) == KErrNone) |
|
415 |
continue; |
|
416 |
break; |
|
417 |
} |
|
418 |
return r; |
|
419 |
} |