35
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Class responsible for application exit.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_VTUIAPPSHUTTER_H
|
|
20 |
#define C_VTUIAPPSHUTTER_H
|
|
21 |
|
|
22 |
#include <babitflags.h>
|
|
23 |
|
|
24 |
#include <MPhCltEmergencyCallObserver.h>
|
|
25 |
#include <CPhCltEmergencyCall.h>
|
|
26 |
#include <RPhCltServer.h>
|
|
27 |
|
|
28 |
class CAsyncCallBack;
|
|
29 |
class MVtUiShutterObserver;
|
|
30 |
class MVtUiStateContext;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Shutdown service for the application. This is singleton
|
|
34 |
* which deletes itself when shutdown is complete.
|
|
35 |
*
|
|
36 |
* @since S60 v3.2
|
|
37 |
*/
|
|
38 |
class CVtUiAppShutter : public CBase
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Returns the instance of application shutter.
|
|
44 |
*
|
|
45 |
* @param aComms for sending call ending related commands to Phone.
|
|
46 |
* @param aObserver observer informed when shutdown is completed.
|
|
47 |
* @return the application shutter
|
|
48 |
*/
|
|
49 |
static CVtUiAppShutter* InstanceL(
|
|
50 |
MVtUiShutterObserver& aObserver );
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Starts shutdown.
|
|
54 |
*/
|
|
55 |
void StartShutdown();
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Starts shutdown because emergency call was requested by the user.
|
|
59 |
* If supplied number is detected other than emergency number this method
|
|
60 |
* leaves KErrArgument.
|
|
61 |
* @param aStateContext for accessing emergency number and local
|
|
62 |
* variation.
|
|
63 |
*/
|
|
64 |
void ShutdownWithEmergencyCallL( MVtUiStateContext& aStateContext );
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Callback from emergency caller.
|
|
68 |
*/
|
|
69 |
void EmergencyCallDoneL();
|
|
70 |
|
|
71 |
private:
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Exits the application if no pending shutdown preparation
|
|
75 |
* is ongoing. Deletes itself as last action.
|
|
76 |
*/
|
|
77 |
void ShutdownIfReadyAndDestroy();
|
|
78 |
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Enques async callback.
|
|
82 |
*/
|
|
83 |
void EnqueCallbackL( TCallBack& aCallback );
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Asynch callback handling response to emergency call creation.
|
|
87 |
*/
|
|
88 |
static TInt EmergencyResponseCallback( TAny* aAny );
|
|
89 |
|
|
90 |
/** C++ constructor */
|
|
91 |
CVtUiAppShutter( MVtUiShutterObserver& aObserver );
|
|
92 |
|
|
93 |
/** destructor */
|
|
94 |
~CVtUiAppShutter();
|
|
95 |
|
|
96 |
private: // for making shutdown with emergency call
|
|
97 |
class CEmergencyCaller : public CBase, private MPhCltEmergencyCallObserver
|
|
98 |
{
|
|
99 |
public:
|
|
100 |
/**
|
|
101 |
* Dials emergency call. Object destroys itself when
|
|
102 |
* response is received.
|
|
103 |
*/
|
|
104 |
static CEmergencyCaller* DialEmergencyL(
|
|
105 |
CVtUiAppShutter& aObserver,
|
|
106 |
MVtUiStateContext& aStateContext );
|
|
107 |
|
|
108 |
// Destructor
|
|
109 |
~CEmergencyCaller();
|
|
110 |
|
|
111 |
private: // C++ constructor
|
|
112 |
|
|
113 |
CEmergencyCaller(
|
|
114 |
CVtUiAppShutter& aObserver,
|
|
115 |
MVtUiStateContext& aStateContext );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* 2nd phase constructor
|
|
119 |
*/
|
|
120 |
void ConstructL();
|
|
121 |
|
|
122 |
private: // from MPhCltEmergencyCallObserver
|
|
123 |
/**
|
|
124 |
* @see MPhCltEmergencyCallObserver::HandleEmergencyDialL
|
|
125 |
*/
|
|
126 |
virtual void HandleEmergencyDialL( const TInt aStatus );
|
|
127 |
|
|
128 |
private: // Data
|
|
129 |
|
|
130 |
// Emergency number
|
|
131 |
TPhCltTelephoneNumber iNumber;
|
|
132 |
|
|
133 |
// Phone Server session
|
|
134 |
RPhCltServer iServer;
|
|
135 |
|
|
136 |
// Emergency call handler
|
|
137 |
CPhCltEmergencyCall* iEmergency;
|
|
138 |
|
|
139 |
// Observer for callback
|
|
140 |
CVtUiAppShutter& iObserver;
|
|
141 |
|
|
142 |
// State context for gettin entered numbers and local variation
|
|
143 |
MVtUiStateContext& iStateContext;
|
|
144 |
};
|
|
145 |
private: // Data
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Guard flags for completing shutdown.
|
|
149 |
* All must be cleared before shutdown
|
|
150 |
* can be completed.
|
|
151 |
*/
|
|
152 |
enum TShutterFlags
|
|
153 |
{
|
|
154 |
/** Waiting for call on StartShutdown() */
|
|
155 |
EShutterWaitingStart,
|
|
156 |
/** Waiting for callback on emegency call request */
|
|
157 |
EShutterWaitingEmergencyCallback,
|
|
158 |
};
|
|
159 |
|
|
160 |
// Asynch callback
|
|
161 |
CAsyncCallBack* iCallback;
|
|
162 |
|
|
163 |
// guard flags
|
|
164 |
TBitFlags8 iPendingStateFlags;
|
|
165 |
|
|
166 |
// Observer to notify when application exit
|
|
167 |
// is allowed.
|
|
168 |
MVtUiShutterObserver& iObserver;
|
|
169 |
|
|
170 |
// Handles emergency call dialling
|
|
171 |
CEmergencyCaller* iEmergencyCaller;
|
|
172 |
|
|
173 |
};
|
|
174 |
|
|
175 |
#endif // C_VTUIAPPSHUTTER_H
|