|
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: This module contains the implementation of |
|
15 * : CSsServiceHandlerVoice class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cssservicehandlervoice.h" |
|
22 #include "cssconnectionhandler.h" |
|
23 #include "cssserviceutilities.h" |
|
24 #include "csslogger.h" |
|
25 #include <spsettingsvoiputils.h> |
|
26 |
|
27 // CONSTANTS |
|
28 // CS service id. |
|
29 const TInt KGSMServiceId = 1; |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================================= |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CSsServiceHandlerVoice::CSsServiceHandlerVoice |
|
35 // C++ constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CSsServiceHandlerVoice::CSsServiceHandlerVoice |
|
40 ( |
|
41 // None. |
|
42 ) |
|
43 { |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CSsServiceHandlerVoice::ConstructL |
|
48 // Symbian 2nd phase constructor can leave. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void CSsServiceHandlerVoice::ConstructL() |
|
52 { |
|
53 iVoipUtils = CSPSettingsVoIPUtils::NewL(); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CSsServiceHandlerVoice::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CSsServiceHandlerVoice* CSsServiceHandlerVoice::NewL |
|
62 ( |
|
63 // None. |
|
64 ) |
|
65 { |
|
66 CSsServiceHandlerVoice* self = new ( ELeave ) CSsServiceHandlerVoice(); |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop( self ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // Destructor |
|
74 CSsServiceHandlerVoice::~CSsServiceHandlerVoice |
|
75 ( |
|
76 // None. |
|
77 ) |
|
78 { |
|
79 delete iVoipUtils; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CSsServiceHandlerVoice::ExecuteServiceSelectionL |
|
84 // Gets the calling service by current call type and service id. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CSsServiceHandlerVoice::ExecuteServiceSelectionL |
|
88 ( |
|
89 CConvergedServiceSelector::TSsResult& aResult, |
|
90 CConvergedServiceSelector::TSsCallType aCallType, |
|
91 TUint /*aServiceId*/, |
|
92 TBool /*aSendKey*/, |
|
93 const TDesC& /*aString*/ |
|
94 ) |
|
95 { |
|
96 CSSLOGSTRING("CSSelector::ExecuteVoice"); |
|
97 |
|
98 TUint prefService(0); |
|
99 |
|
100 if ( iVoipUtils->IsPreferredTelephonyVoIP() && |
|
101 KErrNone == iVoipUtils->GetPreferredService( prefService ) && |
|
102 IsServiceRegistered( prefService ) ) |
|
103 { |
|
104 CSSLOGSTRING("CSSelector::VoipAsPreferred"); |
|
105 |
|
106 // Preferred telephony value as voip and preferred (voip) service |
|
107 // registered -> Change call type as voip and set correct service id. |
|
108 SsServiceUtilities::SetServiceResult( aResult, |
|
109 CConvergedServiceSelector::ESsVoipCall, |
|
110 prefService, |
|
111 ETrue ); |
|
112 } |
|
113 else |
|
114 { |
|
115 // Set (CS)voice call parameters |
|
116 // CallType, Service id and GSM service is always "enabled" |
|
117 SsServiceUtilities::SetServiceResult( aResult, |
|
118 aCallType, |
|
119 KGSMServiceId, |
|
120 ETrue ); |
|
121 } |
|
122 |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CSsServiceHandlerVoice::IsServiceRegistered |
|
127 // Checks is the service registered |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TBool CSsServiceHandlerVoice::IsServiceRegistered |
|
131 ( |
|
132 TUint aServiceId |
|
133 ) const |
|
134 { |
|
135 TBool ret( EFalse ); |
|
136 CSsConnectionHandler* connection = NULL; |
|
137 |
|
138 // Nothing to do if CCH client construction not succeed. |
|
139 // So ignore the leave and cs call will be made. |
|
140 TRAP_IGNORE( connection = CSsConnectionHandler::NewL() ); |
|
141 |
|
142 if ( connection ) |
|
143 { |
|
144 ret = connection->IsVoipServiceRegistered( aServiceId ); |
|
145 delete connection; |
|
146 } |
|
147 |
|
148 return ret; |
|
149 } |
|
150 |
|
151 // ================= OTHER EXPORTED FUNCTIONS =============================== |
|
152 |
|
153 // End of File |