33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004 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: Call Request Manager.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDES
|
|
21 |
#include "cphsrvemergencyrequestmanager.h"
|
|
22 |
#include "cphsrvsubsessionbase.h"
|
|
23 |
#include "phsrvutils.h"
|
|
24 |
|
|
25 |
|
|
26 |
// CONSTANTS
|
|
27 |
|
|
28 |
// The size of the Notification manager storage.
|
|
29 |
//const TInt KPhSrvNotificationManagerPendingCallGranularity = 4;
|
|
30 |
|
|
31 |
|
|
32 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
33 |
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
// CPhSrvEmergencyRequestManager::CPhSrvEmergencyRequestManager
|
|
36 |
//
|
|
37 |
// C++ constructor.
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CPhSrvEmergencyRequestManager::CPhSrvEmergencyRequestManager()
|
|
41 |
: iIsRequestPending( EFalse )
|
|
42 |
{
|
|
43 |
}
|
|
44 |
|
|
45 |
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
// CPhSrvEmergencyRequestManager::~CPhSrvEmergencyRequestManager
|
|
48 |
//
|
|
49 |
// C++ destructor.
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
CPhSrvEmergencyRequestManager::~CPhSrvEmergencyRequestManager()
|
|
53 |
{
|
|
54 |
}
|
|
55 |
|
|
56 |
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
// CPhSrvEmergencyRequestManager::ConstructL
|
|
59 |
//
|
|
60 |
// Complete construction.
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
void CPhSrvEmergencyRequestManager::ConstructL()
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
// -----------------------------------------------------------------------------
|
|
69 |
// CPhSrvEmergencyRequestManager::EmergencyDialL
|
|
70 |
//
|
|
71 |
// Initiate a dial request - called by the external call
|
|
72 |
// interface. Checks if emergency initiator is ready and sets request pending if
|
|
73 |
// emergency initiator hasn't been registered yet
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
void CPhSrvEmergencyRequestManager::EmergencyDialL(
|
|
77 |
const RMessage2& aMessage )
|
|
78 |
{
|
|
79 |
// If we have no registered initiator then we can't make a call.
|
|
80 |
if ( !iEmergencyInitiator )
|
|
81 |
{
|
|
82 |
if( iIsRequestPending )
|
|
83 |
{
|
|
84 |
User::Leave( KErrAlreadyExists );
|
|
85 |
}
|
|
86 |
else
|
|
87 |
{
|
|
88 |
iPendingRequest = aMessage;
|
|
89 |
iIsRequestPending = ETrue;
|
|
90 |
}
|
|
91 |
}
|
|
92 |
else
|
|
93 |
{
|
|
94 |
DoMakeEmergencyDial( aMessage );
|
|
95 |
}
|
|
96 |
}
|
|
97 |
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// CPhSrvEmergencyRequestManager::DoMakeEmergencyDial
|
|
101 |
//
|
|
102 |
// Do the actual emergency dial request for emergency initiator.
|
|
103 |
// -----------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
void CPhSrvEmergencyRequestManager::DoMakeEmergencyDial( const RMessage2& aMessage )
|
|
106 |
{
|
|
107 |
iPendingRequestPointer= aMessage;
|
|
108 |
|
|
109 |
// Clear pending request status
|
|
110 |
iIsRequestPending = EFalse;
|
|
111 |
|
|
112 |
// Now see if the call notifier (initiator) is ready
|
|
113 |
if ( iEmergencyInitiator ->InitiatorIsReadyToMakeEmergencyCall() )
|
|
114 |
{
|
|
115 |
// Ask the call initiator to make the call (basically completes the
|
|
116 |
//phone app engine's outstanding call notifier request).
|
|
117 |
iEmergencyInitiator ->InitiatorMakeEmergencyCall( aMessage );
|
|
118 |
}
|
|
119 |
}
|
|
120 |
|
|
121 |
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
// CPhSrvEmergencyRequestManager::EmergencyDialCancel
|
|
124 |
//
|
|
125 |
// Cancel a pending dial request.
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void CPhSrvEmergencyRequestManager::EmergencyDialCancel()
|
|
129 |
{
|
|
130 |
if ( !iPendingRequestPointer.IsNull() )
|
|
131 |
{
|
53
|
132 |
// Clear pending request status
|
|
133 |
iIsRequestPending = EFalse;
|
33
|
134 |
iPendingRequestPointer.Complete( KErrCancel );
|
|
135 |
}
|
|
136 |
}
|
|
137 |
|
|
138 |
|
|
139 |
// -----------------------------------------------------------------------------
|
|
140 |
// CPhSrvEmergencyRequestManager::SetNegotiatorReadyCall
|
|
141 |
//
|
|
142 |
// Updates the negotiator so that it knows if the notifier
|
|
143 |
// session is able to make a call.
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
void CPhSrvEmergencyRequestManager::SetNegotiatorReadyCall(
|
|
147 |
MPhSrvEmergencyCall& aInitiator )
|
|
148 |
{
|
|
149 |
// There mustn't already be a call initiator, or the existing call
|
|
150 |
// initiator must be the same as the new one (otherwise, panic).
|
|
151 |
__ASSERT_ALWAYS( !iEmergencyInitiator || &aInitiator == iEmergencyInitiator,
|
|
152 |
PhoneServerUtils::Panic(
|
|
153 |
EPhoneServerPanicExistingCallInitiatorFault ) );
|
|
154 |
|
|
155 |
// Update our pointer
|
|
156 |
iEmergencyInitiator = &aInitiator;
|
|
157 |
|
|
158 |
if( iIsRequestPending )
|
|
159 |
{
|
|
160 |
DoMakeEmergencyDial( iPendingRequest );
|
|
161 |
}
|
|
162 |
}
|
|
163 |
|
|
164 |
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
// CPhSrvEmergencyRequestManager::SetNegotiatorReadyCallCancel
|
|
167 |
//
|
|
168 |
// Indicates that the initiator is no longer available
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
void CPhSrvEmergencyRequestManager::SetNegotiatorReadyCallCancel(
|
|
172 |
MPhSrvEmergencyCall& aInitiator )
|
|
173 |
{
|
|
174 |
if ( iEmergencyInitiator && iEmergencyInitiator == &aInitiator )
|
|
175 |
{
|
|
176 |
iEmergencyInitiator = NULL;
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
|
|
181 |
// -----------------------------------------------------------------------------
|
|
182 |
// CPhSrvEmergencyRequestManager::SetNegotiatorAttemptedCallResponseValue
|
|
183 |
//
|
|
184 |
// Handle a response from the phone app engine - this is the
|
|
185 |
// result of attempting to make a call (based upon a previous
|
|
186 |
// clients external call request)
|
|
187 |
// -----------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
void CPhSrvEmergencyRequestManager::SetNegotiatorAttemptedCallResponseValue(
|
|
190 |
TPhCltPhoneResults aResult )
|
|
191 |
{
|
|
192 |
if ( !iPendingRequestPointer.IsNull() )
|
|
193 |
{
|
|
194 |
iPendingRequestPointer.Complete( aResult );
|
|
195 |
}
|
|
196 |
}
|
|
197 |
|
|
198 |
|
|
199 |
// End of File
|
|
200 |
|