1 /* |
|
2 * Copyright (c) 2004-2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 @released |
|
23 */ |
|
24 |
|
25 #ifndef __DAEMONBEHAVIOUR_H__ |
|
26 #define __DAEMONBEHAVIOUR_H__ |
|
27 |
|
28 #include <e32base.h> |
|
29 #include <f32file.h> |
|
30 #include <apgcli.h> |
|
31 |
|
32 #include "daemon.h" |
|
33 #include "daemoninstaller.h" |
|
34 #include <swidaemonplugin.h> |
|
35 |
|
36 namespace Swi |
|
37 { |
|
38 /** |
|
39 * This class implements the specific behaviour when a media insertion |
|
40 * or removal is detected, or the daemon is started. |
|
41 */ |
|
42 class CDaemonBehaviour : public CBase, public MDaemonBehaviour, public MDaemonInstallBehaviour |
|
43 { |
|
44 public: |
|
45 static CDaemonBehaviour* NewL(); |
|
46 static CDaemonBehaviour* NewLC(); |
|
47 ~CDaemonBehaviour(); |
|
48 |
|
49 // from MDaemonBahviour |
|
50 public: |
|
51 /** |
|
52 * Function called on startup of the daemon. |
|
53 * This currently performs no opeartions. |
|
54 */ |
|
55 TBool StartupL(); |
|
56 |
|
57 /** |
|
58 * Function called on a media change. |
|
59 * If media is inserted, then this processes pre-installed files on |
|
60 * the card, and notifies IAR. On removal IAR is notified only. |
|
61 */ |
|
62 void MediaChangeL(TInt aDrive, TChangeType aChangeType); |
|
63 |
|
64 // Accessor functions |
|
65 RApaLsSession& ApaSession(); |
|
66 |
|
67 // from MDaemonInstallBehaviour |
|
68 public: |
|
69 /** |
|
70 * Verifies that the application architecture server has a cached list of applications |
|
71 * and return next state of install |
|
72 */ |
|
73 MDaemonInstallBehaviour::TSisInstallState VerifyAppCacheListL(); |
|
74 |
|
75 /** |
|
76 * Verifies that the Software Installer property has been defined |
|
77 * and return next state of install |
|
78 */ |
|
79 MDaemonInstallBehaviour::TSisInstallState VerifySwisPropertyL(); |
|
80 |
|
81 /** |
|
82 * Checks the software installer property, to see if busy |
|
83 * and return next state of install |
|
84 */ |
|
85 MDaemonInstallBehaviour::TSisInstallState VerifySwisIdleL(); |
|
86 |
|
87 /// See MDaemonInstallBehaviour::DoInstallRequestL |
|
88 void DoInstallRequestL(const TDesC& aFileName); |
|
89 |
|
90 /// See MDaemonInstallBehaviour::DoNotifyMediaProcessingComplete |
|
91 void DoNotifyMediaProcessingComplete(); |
|
92 |
|
93 private: |
|
94 void ConstructL(); |
|
95 |
|
96 /** |
|
97 * Processes any pre-installed files present on the drive. |
|
98 * |
|
99 * @param aDrive The drive to check for pre-installed SISX files. |
|
100 */ |
|
101 void ProcessPreinstalledFilesL(TInt aDrive); |
|
102 |
|
103 /** |
|
104 * Processes any pre-installed files in the given directory on the drive. |
|
105 @param aDrive The drive to check for pre-installed SISX files. |
|
106 @param aDirectory The directory to search for PreInstalled Files |
|
107 |
|
108 */ |
|
109 void ProcessPreinstalledFilesL(TInt aDrive, const TDesC& aDirectory); |
|
110 |
|
111 void ReadSymbianHeaderL(RFile& aFile, TUid& aUid1, TUid& aUid2, TUid& aUid3); |
|
112 |
|
113 /// Invoke Installation |
|
114 void DoInstallL(RFile &aFile,const TUid &appUid); |
|
115 |
|
116 private: |
|
117 RFs iFs; |
|
118 |
|
119 // The RApaLsSession instance |
|
120 RApaLsSession iApaSession; |
|
121 |
|
122 // The sisx file processor |
|
123 CSisInstaller* iSisInstaller; |
|
124 |
|
125 CSwiDaemonPlugin* iSwiDaemonPlugin; |
|
126 |
|
127 // Drive currently being processed |
|
128 TInt iDrive; |
|
129 |
|
130 // Has MediaProcessingStart already been called? |
|
131 TBool iStartNotified; |
|
132 }; |
|
133 |
|
134 // inline functions |
|
135 inline RApaLsSession& CDaemonBehaviour::ApaSession() |
|
136 { |
|
137 return iApaSession; |
|
138 } |
|
139 |
|
140 |
|
141 } // namespace Swi |
|
142 |
|
143 #endif // #ifndef __DAEMONBEHAVIOUR_H__ |
|
144 |
|