|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: IAUpdater programs main. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <f32file.h> |
|
22 |
|
23 #include "iaupdatermngr.h" |
|
24 #include "iaupdaterdefs.h" |
|
25 #include "iaupdaterparams.h" |
|
26 #include "iaupdatedebug.h" |
|
27 |
|
28 |
|
29 // ======== LOCAL FUNCTIONS ======== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // void MainL() |
|
33 // Programs main function. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 void MainL() |
|
37 { |
|
38 IAUPDATE_TRACE("[IAUpdater] MainL() begin"); |
|
39 |
|
40 // Rename thread as IAUpdater. |
|
41 User::RenameThread( IAUpdaterDefs::KIAUpdaterName ); |
|
42 |
|
43 TIAUpdaterStartParams startParams; |
|
44 startParams.iInitFilePath = IAUpdaterDefs::KInitFilePath; |
|
45 startParams.iResultFilePath = IAUpdaterDefs::KResultFilePath; |
|
46 |
|
47 CIAUpdaterMngr* updater = CIAUpdaterMngr::NewLC(); |
|
48 |
|
49 // Notice, that this function will not return |
|
50 // before all the installations are done. |
|
51 |
|
52 updater->ProcessInstallingL( startParams ); |
|
53 |
|
54 CleanupStack::PopAndDestroy( updater ); |
|
55 |
|
56 IAUPDATE_TRACE("[IAUpdater] MainL() end"); |
|
57 } |
|
58 |
|
59 |
|
60 // ======== MEMBER FUNCTIONS ======== |
|
61 |
|
62 // ======== GLOBAL FUNCTIONS ======== |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // GLDEF_C TInt E32Main() |
|
66 // Main function called by E32 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 GLDEF_C TInt E32Main() |
|
70 { |
|
71 // Start memory leak checkings. |
|
72 // This only works in debug builds. |
|
73 __UHEAP_MARK; |
|
74 |
|
75 IAUPDATE_TRACE("[IAUpdater] E32Main() begin"); |
|
76 |
|
77 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
78 |
|
79 CActiveScheduler* scheduler = new CActiveScheduler(); |
|
80 |
|
81 if ( ( !cleanup ) || ( !scheduler ) ) |
|
82 { |
|
83 delete scheduler; |
|
84 delete cleanup; |
|
85 return KErrNoMemory; |
|
86 } |
|
87 |
|
88 CActiveScheduler::Install( scheduler ); |
|
89 |
|
90 TRAPD( err, MainL() ); |
|
91 |
|
92 IAUPDATE_TRACE_1("[IAUpdater] E32Main(): MainL TRAP err = %d", err); |
|
93 |
|
94 delete scheduler; |
|
95 delete cleanup; |
|
96 |
|
97 IAUPDATE_TRACE("[IAUpdater] E32Main() end"); |
|
98 |
|
99 // End memory leak checkings. |
|
100 // This only works in debug builds. |
|
101 __UHEAP_MARKEND; |
|
102 |
|
103 // Notice, that if some applications are listening for rendezvous to complete |
|
104 // for this process, the rendezvous will be completed with the error code |
|
105 // returned here. So, if the IAD process is on and it is listening the rendezvous |
|
106 // of this process, then the rendezvous will be completed here. |
|
107 |
|
108 return err; |
|
109 } |
|
110 |
|
111 |
|
112 // EOF |