|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: |
|
15 * Implementation of Scheme handler interface implementation for wtai:// scheme |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "SchemeDispLogger.h" |
|
24 #include "TelHandler.h" |
|
25 #include <ECom.h> // For REComSession |
|
26 #include <eikenv.h> |
|
27 #include <apparc.h> |
|
28 #include <apgcli.h> |
|
29 |
|
30 // ================= CONSTANTS ======================= |
|
31 _LIT( KPattern,"tel:"); |
|
32 _LIT( KSIPPattern,"sip:"); |
|
33 |
|
34 // ================= MEMBER FUNCTIONS ======================= |
|
35 |
|
36 // --------------------------------------------------------- |
|
37 // CTelHandler::NewL() |
|
38 // --------------------------------------------------------- |
|
39 // |
|
40 CTelHandler* CTelHandler::NewL( const TDesC& aUrl ) |
|
41 { |
|
42 CLOG_ENTERFN( "CTelHandler::NewL()" ); |
|
43 |
|
44 CTelHandler* self=new(ELeave) CTelHandler(); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL( aUrl ); |
|
47 CleanupStack::Pop(self); |
|
48 |
|
49 CLOG_LEAVEFN( "CTelHandler::NewL()" ); |
|
50 |
|
51 return self; |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------- |
|
55 // CTelHandler::~CTelHandler() |
|
56 // --------------------------------------------------------- |
|
57 // |
|
58 CTelHandler::~CTelHandler() |
|
59 { |
|
60 CLOG_ENTERFN( "CTelHandler::~CTelHandler()" ); |
|
61 |
|
62 if( iTelService != NULL ) |
|
63 { |
|
64 iTelService->RemoveObserver(this); |
|
65 delete iTelService; |
|
66 iTelService = NULL; |
|
67 } |
|
68 |
|
69 CLOG_LEAVEFN( "CTelHandler::~CTelHandler()" ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CTelHandler::CTelHandler() |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 CTelHandler::CTelHandler() : CBaseHandler() |
|
77 { |
|
78 // Deliberately do nothing here : See ConstructL() for initialisation |
|
79 // completion. |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------- |
|
83 // CTelHandler::ConstructL() |
|
84 // --------------------------------------------------------- |
|
85 // |
|
86 void CTelHandler::ConstructL( const TDesC& aUrl ) |
|
87 { |
|
88 CLOG_ENTERFN( "CTelHandler::ConstructL()" ); |
|
89 |
|
90 BaseConstructL( aUrl ); |
|
91 |
|
92 CLOG_LEAVEFN( "CTelHandler::ConstructL()" ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------- |
|
96 // CTelHandler::HandleUrlEmbeddedL() |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 void CTelHandler::HandleUrlEmbeddedL() |
|
100 { |
|
101 CLOG_ENTERFN( "CTelHandler::HandleUrlEmbeddedL()" ); |
|
102 |
|
103 TPtrC path; |
|
104 TInt err; |
|
105 |
|
106 iTelService = CBrowserTelService::NewL(); |
|
107 iTelService->AddObserver(this); |
|
108 |
|
109 TRAP( err, path.Set( RemoveSchemeFromUrlL( KPattern ) ) ); |
|
110 if( err == KErrNone ) |
|
111 { |
|
112 TBool confirmDtmfValue = ReadSdConfirmDtmfValueL(); |
|
113 CLOG_WRITE_FORMAT( "CTelHandler::HandleUrlEmbeddedL: path: %S", &path ); |
|
114 |
|
115 if( 0 != path.Length() ) |
|
116 { |
|
117 err = iTelService->MakeCall(path, confirmDtmfValue); |
|
118 } |
|
119 else |
|
120 { |
|
121 err = KErrCancel; |
|
122 } |
|
123 } |
|
124 else |
|
125 { |
|
126 TRAP( err, path.Set( RemoveSchemeFromUrlL( KSIPPattern ) ) ); |
|
127 if( err == KErrNone ) |
|
128 { |
|
129 TBool confirmDtmfValue = ReadSdConfirmDtmfValueL(); |
|
130 CLOG_WRITE_FORMAT( "CTelHandler::HandleUrlEmbeddedL: path: %S", &path ); |
|
131 |
|
132 if( 0 != path.Length() ) |
|
133 { |
|
134 err = iTelService->MakeVOIPCall(path, confirmDtmfValue); |
|
135 } |
|
136 else |
|
137 { |
|
138 err = KErrCancel; |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 |
|
144 NotifyClient(); |
|
145 |
|
146 ErrorHandlerL( err ); |
|
147 |
|
148 CLOG_LEAVEFN( "CTelHandler::HandleUrlEmbeddedL()" ); |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------- |
|
152 // CTelHandler::HandleUrlStandaloneL() |
|
153 // --------------------------------------------------------- |
|
154 // |
|
155 void CTelHandler::HandleUrlStandaloneL() |
|
156 { |
|
157 CLOG_ENTERFN( "CTelHandler::HandleUrlStandaloneL()" ); |
|
158 |
|
159 LaunchSchemeAppWithCommandLineL(); |
|
160 |
|
161 CLOG_LEAVEFN( "CTelHandler::HandleUrlStandaloneL()" ); |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------- |
|
165 // CTelHandler::BrowserTelServiceEvent() |
|
166 // --------------------------------------------------------- |
|
167 // |
|
168 void CTelHandler::BrowserTelServiceEvent( TBrowserTelServiceState aEvent ) |
|
169 { |
|
170 if( ( EIdle == aEvent ) && ( NULL !=iSchemeDoc ) ) |
|
171 { |
|
172 iSchemeDoc->HandleServerAppExit( KErrNone ); |
|
173 } |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------- |
|
177 // CTelHandler::BrowserTelServiceError() |
|
178 // --------------------------------------------------------- |
|
179 // |
|
180 void CTelHandler::BrowserTelServiceError( TBrowserTelServiceError /*aError*/) |
|
181 { |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------- |
|
185 // CTelHandler::BrowserTelServiceError() |
|
186 // --------------------------------------------------------- |
|
187 // |
|
188 void CTelHandler::NotifyClient() |
|
189 { |
|
190 if( NULL !=iSchemeDoc ) |
|
191 { |
|
192 iSchemeDoc->HandleServerAppExit( KErrNone ); |
|
193 } |
|
194 } |