|
1 /* |
|
2 * Copyright (c) 1020 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: application class. |
|
15 */ |
|
16 |
|
17 #ifndef __HS_LAUNCH_ |
|
18 #define __HS_LAUNCH_ |
|
19 |
|
20 #include <e32base.h> |
|
21 #include "hsprocessmonitor.h" |
|
22 #include "hsshutdownmonitor.h" |
|
23 |
|
24 /** |
|
25 * CHsLaunch |
|
26 * |
|
27 * application class. |
|
28 * |
|
29 * @since S60 5.2 |
|
30 */ |
|
31 class CHsLaunch : public CActive, |
|
32 MHsProcessMonitorObserver, |
|
33 MHsShutdownMonitorObserver |
|
34 { |
|
35 public: |
|
36 /** |
|
37 * Create new launcher |
|
38 * |
|
39 * @since S60 5.2 |
|
40 */ |
|
41 static CHsLaunch* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 * |
|
46 * @since S60 5.2 |
|
47 */ |
|
48 virtual ~CHsLaunch(); |
|
49 |
|
50 /** |
|
51 * Set active object to be ran |
|
52 * |
|
53 * @since S60 5.2 |
|
54 */ |
|
55 void Activate(); |
|
56 |
|
57 /** |
|
58 * Get application return value |
|
59 * |
|
60 * @return TInt Application return value |
|
61 * @since S60 5.2 |
|
62 */ |
|
63 TInt ApplicationReturnValue(); |
|
64 |
|
65 protected: |
|
66 /** |
|
67 * C++ constructor. |
|
68 * |
|
69 * @since S60 5.2 |
|
70 */ |
|
71 CHsLaunch(); |
|
72 |
|
73 /** |
|
74 * Symbian 2nd phase constructor |
|
75 * |
|
76 * @since S60 5.2 |
|
77 */ |
|
78 void ConstructL(); |
|
79 |
|
80 private: // From CActive. |
|
81 /** |
|
82 * From CActive |
|
83 */ |
|
84 void RunL(); |
|
85 |
|
86 /** |
|
87 * From CActive |
|
88 * |
|
89 * @since S60 5.2 |
|
90 */ |
|
91 void DoCancel(); |
|
92 |
|
93 /** |
|
94 * From CActive |
|
95 * |
|
96 * @since S60 5.2 |
|
97 */ |
|
98 TInt RunError( TInt aError ); |
|
99 |
|
100 private: // From MHsProcessMonitorObserver |
|
101 /** |
|
102 * From MHsProcessMonitorObserver |
|
103 */ |
|
104 void ProcessEnded( const TExitType& aExitType, |
|
105 const TInt aExitReason, |
|
106 const TExitCategoryName& aExitCategory ); |
|
107 |
|
108 /** |
|
109 * From MHsProcessMonitorObserver |
|
110 */ |
|
111 void ProcessMonitoringError( TInt aError ); |
|
112 |
|
113 private: // From MHsShutdownMonitorObserver |
|
114 /** |
|
115 * From MHsShutdownMonitorObserver |
|
116 */ |
|
117 void SystemShutdownEvent(); |
|
118 |
|
119 private: |
|
120 /** |
|
121 * Initialize process monitor |
|
122 * |
|
123 * @param aProcessId Id of process to monitor |
|
124 */ |
|
125 void InitProcessMonitorL( const TInt aProcessId ); |
|
126 |
|
127 /** |
|
128 * Shut down application |
|
129 * |
|
130 * @param aApplicationReturnValue Application return value. |
|
131 */ |
|
132 void ShutdownApp( const TInt aApplicationReturnValue ); |
|
133 |
|
134 private: // data. |
|
135 // Process monitor. Owned. |
|
136 CHsProcessMonitor* iProcessMonitor; |
|
137 |
|
138 // Shutdown monitor. Owned. |
|
139 CHsShutdownMonitor* iShutdownMonitor; |
|
140 |
|
141 // Application return value |
|
142 TInt iApplicationReturnValue; |
|
143 }; |
|
144 |
|
145 #endif // __HS_LAUNCH_ |