|
1 /* |
|
2 * Copyright (c) 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: Call Notify |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // Include Files |
|
21 #include <CPhCltEmergencyCall.h> // for TPhCltEmergencyNumber |
|
22 #include <mphcltdialrequestobserver.h> |
|
23 |
|
24 #include "RPhCltServer.h" |
|
25 #include "CPhCltExtPhoneDialData.h" |
|
26 #include "cphcltdialdata.h" |
|
27 #include "cphcltdialrequestmonitor.h" |
|
28 #include "RPhCltCallNotify.h" |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 // ============================= LOCAL FUNCTIONS =============================== |
|
34 |
|
35 |
|
36 |
|
37 // ============================ MEMBER FUNCTIONS =============================== |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CPhCltDialRequestMonitor::CPhCltDialRequestMonitor |
|
41 // C++ constructor can NOT contain any code, that |
|
42 // might leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CPhCltDialRequestMonitor::CPhCltDialRequestMonitor(RPhCltCallNotify& aCallNotify) |
|
46 : CActive( EPriorityStandard ), |
|
47 iCallNotify(aCallNotify), |
|
48 iDataLengthPckg ( iDialDataLength ) |
|
49 { |
|
50 CActiveScheduler::Add( this ); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CPhCltDialRequestMonitor::NewL |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CPhCltDialRequestMonitor* CPhCltDialRequestMonitor::NewL( |
|
59 RPhCltCallNotify& aCltNotify) |
|
60 { |
|
61 CPhCltDialRequestMonitor* self = new ( ELeave ) CPhCltDialRequestMonitor(aCltNotify); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // Destructor |
|
66 CPhCltDialRequestMonitor::~CPhCltDialRequestMonitor() |
|
67 { |
|
68 Cancel(); |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CPhCltDialRequestMonitor::NotifyCallAttempt |
|
73 // |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void CPhCltDialRequestMonitor::NotifyDialRequest( |
|
77 MPhCltDialRequestObserver* aObserver ) |
|
78 { |
|
79 if ( !IsActive() ) |
|
80 { |
|
81 iCallNotify.NotifyCallAttempt( iStatus, iDataLengthPckg ); |
|
82 iObserver = aObserver; |
|
83 SetActive(); |
|
84 } |
|
85 } |
|
86 |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CPhCltDialRequestMonitor::RespondClient |
|
91 // |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 TInt CPhCltDialRequestMonitor::RespondClient( const TInt aResultCode ) |
|
95 { |
|
96 return iCallNotify.RespondClient( aResultCode ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CPhCltDialRequestMonitor::RunL() |
|
101 // |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CPhCltDialRequestMonitor::RunL() |
|
105 { |
|
106 TInt error = iStatus.Int(); |
|
107 if ( !error ) |
|
108 { |
|
109 // Lazy initialization for dial data. |
|
110 CPhCltDialData *dialData = (CPhCltDialData*) CPhCltExtPhoneDialData::NewL(); |
|
111 |
|
112 CleanupStack::PushL( dialData ); |
|
113 |
|
114 HBufC8* package = HBufC8::NewLC ( iDialDataLength ); |
|
115 TPtr8 ptr ( package->Des()); |
|
116 |
|
117 //Fetch dial data from server |
|
118 iCallNotify.GetDialData( ptr ); |
|
119 ((CPhCltExtPhoneDialData*)dialData)->SetParamsL( *package ); |
|
120 CleanupStack::PopAndDestroy( package ); |
|
121 CleanupStack::Pop( dialData ); |
|
122 iObserver->DialRequest( dialData ); |
|
123 } |
|
124 |
|
125 } |
|
126 |
|
127 TInt CPhCltDialRequestMonitor::RunError(TInt /*aErr*/) |
|
128 { |
|
129 // RunL failed because of leave in SetParamsL, |
|
130 return KErrNone; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CPhCltDialRequestMonitor::DoCancel() |
|
135 // |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void CPhCltDialRequestMonitor::DoCancel() |
|
139 { |
|
140 iCallNotify.CancelNotifyCallAttempt(); |
|
141 } |
|
142 |
|
143 |
|
144 // End of File |