33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2010 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: Base class for SAT commands
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CSATCOMMANDHANDLER_H
|
|
19 |
#define CSATCOMMANDHANDLER_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <etelsat.h>
|
|
24 |
#include <SecondaryDisplay/secondarydisplaysatapi.h>
|
|
25 |
#include "MSatUtils.h"
|
|
26 |
#include "MSatEventObserver.h"
|
|
27 |
#include "MSatCommand.h"
|
|
28 |
|
|
29 |
// CLASS DECLARATION
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Base class for SAT commands.
|
|
33 |
*
|
|
34 |
* @lib SatServer
|
|
35 |
* @since Series 60 3.0
|
|
36 |
*/
|
|
37 |
class CSatCommandHandler : public CActive, public MSatEventObserver,
|
|
38 |
public MSatCommand
|
|
39 |
{
|
|
40 |
public: // Constructors and destructor
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Two-phased constructor.
|
|
44 |
* @param aImplUid Uid for derived class's plugin
|
|
45 |
* @param aUtils Utils interface
|
|
46 |
*/
|
|
47 |
static CSatCommandHandler* NewL(
|
|
48 |
const TUid& aImplUid,
|
|
49 |
MSatUtils* aUtils );
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Destructor.
|
|
53 |
*/
|
|
54 |
IMPORT_C virtual ~CSatCommandHandler();
|
|
55 |
|
|
56 |
public: // New fucntions
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Start the waiting of SAT command from USAT API.
|
|
60 |
*/
|
|
61 |
IMPORT_C void Start();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Gives a panic.
|
|
65 |
* @param aCategory A category for this panic
|
|
66 |
* @param aReason Reason for this panic
|
|
67 |
*/
|
|
68 |
IMPORT_C void Panic( const TDesC& aCategory, TInt aReason ) const;
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Indicates is this command handler currently executing a command.
|
|
72 |
* @return ETrue if executing.
|
|
73 |
*/
|
|
74 |
IMPORT_C TBool IsCommandExecuting() const ;
|
|
75 |
|
|
76 |
public: // Functions from base classes
|
|
77 |
|
|
78 |
/**
|
|
79 |
* From MSatEventObserver Notification of event.
|
|
80 |
* @param aEvent An event that has been notified
|
|
81 |
*/
|
|
82 |
IMPORT_C void Event( TInt aEvent );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* From MSatCommand Response from client.
|
|
86 |
* Default implementation will cause panic.
|
|
87 |
*/
|
|
88 |
IMPORT_C virtual void ClientResponse();
|
|
89 |
|
|
90 |
protected: // New functions
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Start of the command handling. Asks from derived class whether the
|
|
94 |
* command is allowed to execute by calling AllowCommand.
|
|
95 |
* If command is allowed to execute then the need of ui session
|
|
96 |
* is queried by calling NeedUiSession. If ui session is needed and
|
|
97 |
* its not available, ui is launcehd and this class registers itself
|
|
98 |
* to listen the event of ui launch. After the ui is launched,
|
|
99 |
* HandleCommand is called. If the derived class does not need the ui
|
|
100 |
* session or ui session is available, HandleCommand is called
|
|
101 |
* immediatly.
|
|
102 |
*/
|
|
103 |
IMPORT_C virtual void DoHandleCommand();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Derived class needs to make the request from USatApi.
|
|
107 |
* @param aStatus Status of request.
|
|
108 |
*/
|
|
109 |
virtual void IssueUSATRequest( TRequestStatus& aStatus ) = 0;
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Command has to check the state of the system and make the
|
|
113 |
* desision of allowing the command to perform. If desision
|
|
114 |
* is not to allow the command, then the terminal response has to
|
|
115 |
* sent from this method.
|
|
116 |
* @return TBool indicating is this command allowed or not
|
|
117 |
*/
|
|
118 |
virtual TBool CommandAllowed() = 0;
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Queries need of ui session in order to
|
|
122 |
* execute the command. If ui session is needed, the ui client
|
|
123 |
* launched and this class will register it self for the notification
|
|
124 |
* of ui request.
|
|
125 |
* @return ETrue if ui session is needed.
|
|
126 |
*/
|
|
127 |
virtual TBool NeedUiSession() = 0;
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Called when USAT API notifies that command
|
|
131 |
* data is available.
|
|
132 |
*/
|
|
133 |
virtual void HandleCommand() = 0;
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Called if launch of a Sat Ui application failed.
|
|
137 |
* Every derived class, which needs a ui session in order to
|
|
138 |
* execute command, needs to send a terminal
|
|
139 |
* response from this method.
|
|
140 |
*/
|
|
141 |
virtual void UiLaunchFailed() = 0;
|
|
142 |
|
|
143 |
protected:
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Sends terminal response and renews the usat request of the command.
|
|
147 |
* @param aPCmd Identifies the command, which is sending
|
|
148 |
* terminal response.
|
|
149 |
* @param aRsp Terminal response data package.
|
|
150 |
*/
|
|
151 |
IMPORT_C void TerminalRsp( RSat::TPCmd aPCmd, const TDesC8& aRsp );
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Calls SatSystemState's IsPhoneInIdleState if not using Dummy TSY,
|
|
155 |
* otherwise returns ETrue
|
|
156 |
* @return ETrue if using Dymmy TSY, otherwise asks status
|
|
157 |
* from SatSystemState and returns it.
|
|
158 |
*/
|
|
159 |
IMPORT_C TBool IsPhoneInIdleState();
|
|
160 |
|
|
161 |
protected: // From CActive
|
|
162 |
|
|
163 |
/**
|
|
164 |
* From CActive base class
|
|
165 |
*/
|
|
166 |
IMPORT_C void RunL();
|
|
167 |
|
|
168 |
protected:
|
|
169 |
|
|
170 |
/**
|
|
171 |
* C++ default constructor.
|
|
172 |
*/
|
|
173 |
IMPORT_C CSatCommandHandler();
|
|
174 |
|
|
175 |
/**
|
|
176 |
* By default Symbian 2nd phase constructor is private.
|
|
177 |
* @param aPtr Pointer to Utils interface
|
|
178 |
*/
|
|
179 |
IMPORT_C void BaseConstructL( MSatUtils* aPtr );
|
|
180 |
|
|
181 |
protected: // Data
|
|
182 |
|
|
183 |
// Utils interface
|
|
184 |
MSatUtils* iUtils;
|
|
185 |
|
|
186 |
// Indicates that command is pending for UI to launch
|
|
187 |
TBool iWaitingUiLaunch;
|
|
188 |
|
|
189 |
private: // Data
|
|
190 |
|
|
191 |
// Requiered attribute for the ECOM framework.
|
|
192 |
TUid iDtorIDKey;
|
|
193 |
|
|
194 |
// Indicates is this command handler executing
|
|
195 |
TBool iIsExecuting;
|
|
196 |
|
|
197 |
// Timer to get UI Launch notification released before
|
|
198 |
// starting to handle pending proactive command.
|
|
199 |
RTimer iDelayTimer;
|
|
200 |
|
|
201 |
};
|
|
202 |
|
|
203 |
#endif // CSATCOMMANDHANDLER_H
|
|
204 |
|
|
205 |
// End of File
|