|
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 "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 #ifndef __DAEMONBEHAVIOUR_H__ |
|
19 #define __DAEMONBEHAVIOUR_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <f32file.h> |
|
23 |
|
24 #include "daemon.h" |
|
25 #include "daemoninstaller.h" |
|
26 #include "programstatus.h" //For uninstaller |
|
27 #include "swidaemonplugin.h" //For SWI plugin support |
|
28 |
|
29 class CSwiDaemonPlugin; |
|
30 |
|
31 namespace Swi |
|
32 { |
|
33 /** |
|
34 * This class implements the specific behaviour when a media insertion |
|
35 * or removal is detected, or the daemon is started. |
|
36 */ |
|
37 class CDaemonBehaviour : public CBase, public MDaemonBehaviour, public MDaemonInstallBehaviour |
|
38 { |
|
39 public: |
|
40 static CDaemonBehaviour* NewL( CProgramStatus& aMainStatus ); //For uninstaller |
|
41 static CDaemonBehaviour* NewLC( CProgramStatus& aMainStatus ); //For uninstaller |
|
42 ~CDaemonBehaviour(); |
|
43 |
|
44 // from MDaemonBahviour |
|
45 public: |
|
46 /** |
|
47 * Function called on startup of the daemon. |
|
48 * This currently performs no opeartions. |
|
49 */ |
|
50 TBool StartupL(); |
|
51 |
|
52 /** |
|
53 * Function called on a media change. |
|
54 * If media is inserted, then this processes pre-installed files on |
|
55 * the card, and notifies IAR. On removal IAR is notified only. |
|
56 */ |
|
57 void MediaChangeL(TInt aDrive, TChangeType aChangeType); |
|
58 |
|
59 // Uninstaller help functions |
|
60 /** |
|
61 * Returns current process status. Process status is used for communication |
|
62 * between installer and uninstaller. |
|
63 * @return TInt Process status. |
|
64 */ |
|
65 TInt& GetProcessStatus(); |
|
66 |
|
67 /** |
|
68 * Change current process status. Program status is used for communication |
|
69 * between installer and uninstaller. |
|
70 * |
|
71 * @param TInt Current program status. |
|
72 */ |
|
73 void SetProcessStatus( TInt aStatus ); |
|
74 |
|
75 // Plug-in support help functions |
|
76 /** |
|
77 * Returns ETure is SWI Daemon plug-in is created. |
|
78 * |
|
79 * @return TBool ETure if plug-in is created, EFalse if not plug-in. |
|
80 */ |
|
81 TBool IsPlugin(); |
|
82 |
|
83 /** |
|
84 * This function does check if plugin is all ready notified that media |
|
85 * processing is started. If not it calls MediaProcessingStart for plug-in. |
|
86 */ |
|
87 void NotifyPlugin(); |
|
88 |
|
89 /** |
|
90 * Reguest plug-in to install given package. |
|
91 * |
|
92 * @param aDrive aSisFile Package file. |
|
93 */ |
|
94 void RequestPluginInstall( TDesC& aSisFile ); |
|
95 |
|
96 // from MDaemonInstallBehaviour |
|
97 public: |
|
98 |
|
99 // See MDaemonInstallBehaviour::DoNotifyMediaProcessingComplete |
|
100 void DoNotifyMediaProcessingComplete(); |
|
101 |
|
102 |
|
103 private: |
|
104 void ConstructL( CProgramStatus& aMainStatus ); |
|
105 |
|
106 /** |
|
107 * Processes any pre-installed files present on the drive. |
|
108 * |
|
109 * @param aDrive The drive to check for pre-installed SISX files. |
|
110 */ |
|
111 void ProcessPreinstalledFilesL(TInt aDrive); |
|
112 |
|
113 /** |
|
114 * Processes any pre-installed files in the given directory on the drive. |
|
115 @param aDrive The drive to check for pre-installed SISX files. |
|
116 @param aDirectory The directory to search for PreInstalled Files |
|
117 */ |
|
118 void ProcessPreinstalledFilesL(TInt aDrive, const TDesC& aDirectory); |
|
119 |
|
120 |
|
121 private: |
|
122 |
|
123 RFs iFs; |
|
124 // The sisx file processor |
|
125 CSisInstaller* iSisInstaller; |
|
126 // Plug-in instance if found by the ECOM. |
|
127 CSwiDaemonPlugin* iSwiDaemonPlugin; |
|
128 // Has MediaProcessingStart already been called? |
|
129 TBool iStartNotified; |
|
130 TInt iDrive; |
|
131 |
|
132 #ifdef RD_MULTIPLE_DRIVE |
|
133 // Contains inserted drives. |
|
134 RArray<TInt> iDriveArray; |
|
135 #endif |
|
136 // General program status. Note this do not affect to plug-in. |
|
137 TInt iGeneralProcessStatus; //For uninstaller |
|
138 }; |
|
139 |
|
140 } // namespace Swi |
|
141 |
|
142 #endif //__DAEMONBEHAVIOUR_H__ |
|
143 |
|
144 //EOF |