37
|
1 |
/*
|
|
2 |
* Copyright (c) 2003-2008 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: Monitors AT command requests.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CPECLIENTCOMMANDHANDLERMONITOR_H
|
|
21 |
#define CPECLIENTCOMMANDHANDLERMONITOR_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <cphcltcommandhandler.h>
|
|
26 |
#include <cphcltcallnotify.h>
|
|
27 |
#include <rphcltserver.h>
|
|
28 |
#include <pevirtualengine.h>
|
|
29 |
#include <mphcltcomhandrequestobserver.h>
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
class MPEPhoneModelInternal;
|
|
33 |
class MPECallHandling;
|
|
34 |
class CPEMessageHandler;
|
|
35 |
class CPEManualCallControlHandler;
|
|
36 |
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Monitors AT command requests.
|
|
40 |
*/
|
|
41 |
NONSHARABLE_CLASS( CPEClientCommandHandlerMonitor ) : public CBase,
|
|
42 |
public MPhCltComHandRequestObserver
|
|
43 |
{
|
|
44 |
public: // Constructors and destructor
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Two-phased constructor.
|
|
48 |
* @return Pointer to created CPEClientCommandHandlerMonitor instance.
|
|
49 |
*/
|
|
50 |
static CPEClientCommandHandlerMonitor* NewL(
|
|
51 |
MPECallHandling& aCallHandling,
|
|
52 |
CPEMessageHandler& aMessageHandler,
|
|
53 |
MPEPhoneModelInternal& aModel,
|
|
54 |
RPhCltServer& aPhoneServer,
|
|
55 |
CPEManualCallControlHandler& aManualCallControlHandler );
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Destructor.
|
|
59 |
*/
|
|
60 |
virtual ~CPEClientCommandHandlerMonitor();
|
|
61 |
|
|
62 |
public: // New functions
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Start listening for AT command requests.
|
|
66 |
*/
|
|
67 |
void Start();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Sends response to AT command request
|
|
71 |
* and starts listening again.
|
|
72 |
*
|
|
73 |
* @param aErrorCode Symbian OS error code of the success of the command.
|
|
74 |
*/
|
|
75 |
void Respond( const TInt aErrorCode );
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Sends response to atd command.
|
|
79 |
*
|
|
80 |
* @param aFlag ETrue if dialing started.
|
|
81 |
*/
|
|
82 |
void DoCompleteCmdAtd( TBool aFlag );
|
|
83 |
|
|
84 |
// from MPhCltComHandRequestObserver
|
|
85 |
/**
|
|
86 |
* Handles completed request.
|
|
87 |
*/
|
|
88 |
void ComHandRequest();
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Cancels pending request.
|
|
92 |
*/
|
|
93 |
void Cancel();
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Tells whether this monitor is active.
|
|
97 |
*/
|
|
98 |
TBool IsActive();
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
private: // Constructors
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Constructor.
|
|
106 |
*/
|
|
107 |
CPEClientCommandHandlerMonitor(
|
|
108 |
MPECallHandling& aCallHandling,
|
|
109 |
CPEMessageHandler& aMessageHandler,
|
|
110 |
MPEPhoneModelInternal& aModel,
|
|
111 |
RPhCltServer& aPhoneServer,
|
|
112 |
CPEManualCallControlHandler& aManualCallControlHandler);
|
|
113 |
|
|
114 |
/**
|
|
115 |
* By default Symbian 2nd phase constructor is private.
|
|
116 |
*/
|
|
117 |
void ConstructL();
|
|
118 |
|
|
119 |
private:
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Sends response to server.
|
|
123 |
*/
|
|
124 |
void SendResponse( const TInt aResponse );
|
|
125 |
|
|
126 |
/* Handles a leave occurring in the request completion.
|
|
127 |
* @since Series60_2.7
|
|
128 |
* @param aError The leave code.
|
|
129 |
* @return KErrNone because leave has been handled.
|
|
130 |
*/
|
|
131 |
TInt RunError( TInt aError );
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Handles various BT AT commands
|
|
138 |
*
|
|
139 |
* @param aArgs command arguments, if any
|
|
140 |
* @return TNone
|
|
141 |
*/
|
|
142 |
void HandleCommandRequestL(const TPhCltComHandCommandParameters& aArgs );
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Processing ATA command.
|
|
146 |
*/
|
|
147 |
void HandleCmdAta();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Processing CHUP command.
|
|
151 |
*/
|
|
152 |
void HandleCmdChup();
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Processing VTS command
|
|
156 |
*
|
|
157 |
* @param aDtmfTone dtfm tone to be played
|
|
158 |
* @param aAction action to be done for a dtmf tone
|
|
159 |
* @return none
|
|
160 |
*/
|
|
161 |
void HandleCmdVtsL( const TPhCltDtmfTone aDtmfTone,
|
|
162 |
const TPhCltDtmfAction aAction );
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Handles ATD command.
|
|
166 |
* @param aPhoneNumber phone number.
|
|
167 |
*/
|
|
168 |
void HandleCmdAtdL( const TPhCltTelephoneNumber& aPhoneNumber );
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Handles CHLD command.
|
|
172 |
* @param aChldCommand call parameters.
|
|
173 |
* @param aCallNo Call index in GSM.
|
|
174 |
*/
|
|
175 |
void HandleCmdChldL(
|
|
176 |
const TPhCltChldCommand aChldCommand,
|
|
177 |
const TUint aCallNo );
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Handles mute ringing tone command.
|
|
181 |
*/
|
|
182 |
void HandleCmdMuteRingingTone();
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Handles mute microphone command.
|
|
186 |
* @param aMute 0 -> activate mic, 1 -> mute mic
|
|
187 |
*/
|
|
188 |
void HandleCmdMuteMic( const TBool aMute );
|
|
189 |
|
|
190 |
private: // utility method
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Finds a conference call or a single call (in that order) in specified
|
|
194 |
* state and tries to hang it up.
|
|
195 |
*
|
|
196 |
* @param aState The call state
|
|
197 |
* @return KErrNone if succesfull, otherwise an error code. Especially
|
|
198 |
* KErrNotFound if there are no calls in the specified state and
|
|
199 |
* KErrGeneral or KErrAlreadyExists if a hangup request already
|
|
200 |
* exists for a call in the specified state.
|
|
201 |
*/
|
|
202 |
TInt HangUp( TPEState aState );
|
|
203 |
|
|
204 |
private: // Data
|
|
205 |
|
|
206 |
// PhoneServer session.
|
|
207 |
RPhCltServer& iServer;
|
|
208 |
// Command handler notifier.
|
|
209 |
CPhCltCallNotify* iNotify;
|
|
210 |
// Command arguments.
|
|
211 |
TPckgBuf< TPhCltComHandCommandParameters > iArgs;
|
|
212 |
// Library loader.
|
|
213 |
RLibrary iLibrary;
|
|
214 |
// MPECallHandling handles call related commands to CallHandling subsystem.
|
|
215 |
MPECallHandling& iCallHandling;
|
|
216 |
// CPEMessageHandler object which handles messages
|
|
217 |
CPEMessageHandler& iMessageHandler;
|
|
218 |
// MPEPhoneModelInternal owns this object.
|
|
219 |
MPEPhoneModelInternal& iModel;
|
|
220 |
// Flag to indicate is the response from Phone UI is outstanding
|
|
221 |
TBool iWaitingForResponse;
|
|
222 |
// Manual call control handler
|
|
223 |
CPEManualCallControlHandler& iManualCallControlHandler;
|
|
224 |
|
|
225 |
};
|
|
226 |
|
|
227 |
#endif // CPECLIENTCOMMANDHANDLERMONITOR_H
|
|
228 |
|
|
229 |
// End of File
|