|
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 * : CSsServiceUtilities class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cssserviceutilities.h" |
|
22 #include "cssservicehandlergsm.h" |
|
23 #include "cssservicehandlervoice.h" |
|
24 #include "cssservicehandlervoip.h" |
|
25 |
|
26 // CONSTANTS |
|
27 _LIT( KSsValidCsNumberChars, "0123456789*#+pwPW" ); |
|
28 |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================================= |
|
31 |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CSsServiceUtilities::ServiceHandlerByCallTypeL |
|
35 // Returns handler by call type |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CServiceHandler* SsServiceUtilities::ServiceHandlerByCallTypeL |
|
39 ( |
|
40 CConvergedServiceSelector::TSsCallType aCallType, |
|
41 TBool aSendKey |
|
42 ) |
|
43 { |
|
44 CServiceHandler* handler = NULL; |
|
45 |
|
46 // Get handler by calltype |
|
47 switch( aCallType ) |
|
48 { |
|
49 case CConvergedServiceSelector::ESsVoiceCall: |
|
50 { |
|
51 /* |
|
52 * CodeScanner warning "neglected to put variable on |
|
53 * cleanup stack". Method cannot leave when handler is |
|
54 * properly initialized so warning ignored. |
|
55 */ |
|
56 if ( aSendKey ) |
|
57 { |
|
58 // If CS call is made by SendKey use |
|
59 // Voice service handler. We may have to |
|
60 // change the call type as voip (voice) call |
|
61 handler = CSsServiceHandlerVoice::NewL(); |
|
62 } |
|
63 else |
|
64 { |
|
65 // Otherwise use gsm handler |
|
66 handler = CSsServiceHandlerGsm::NewL(); |
|
67 } |
|
68 break; |
|
69 } |
|
70 case CConvergedServiceSelector::ESsVideoCall: |
|
71 { |
|
72 // Use gsm handler for video call |
|
73 handler = CSsServiceHandlerGsm::NewL(); |
|
74 break; |
|
75 } |
|
76 case CConvergedServiceSelector::ESsVoipCall: |
|
77 { |
|
78 // VoIP handler for VoIP call |
|
79 handler = CSsServiceHandlerVoip::NewL(); |
|
80 break; |
|
81 } |
|
82 default: |
|
83 { |
|
84 User::Leave( KErrNotSupported ); |
|
85 break; |
|
86 } |
|
87 } |
|
88 |
|
89 return handler; |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CSsServiceUtilities::SetServiceResult |
|
94 // Sets the results to TSsResult |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void SsServiceUtilities::SetServiceResult |
|
98 ( |
|
99 CConvergedServiceSelector::TSsResult& aResult, |
|
100 CConvergedServiceSelector::TSsCallType aCallType, |
|
101 TUint aServiceId, |
|
102 TBool aEnabled |
|
103 ) |
|
104 { |
|
105 aResult.iCallType = aCallType; |
|
106 aResult.iServiceId = aServiceId; |
|
107 aResult.iServiceEnabled = aEnabled; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CSsServiceUtilities::ServiceHandlerByCallTypeL |
|
112 // Sets the results to TSsResult |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 TBool SsServiceUtilities::IsValidCsNumber |
|
116 ( |
|
117 const TDesC& aString |
|
118 ) |
|
119 { |
|
120 if ( KErrNone == aString.Compare( KNullDesC ) ) |
|
121 { |
|
122 // Empty string |
|
123 return EFalse; |
|
124 } |
|
125 |
|
126 TLex input( aString ); |
|
127 TPtrC valid( KSsValidCsNumberChars ); |
|
128 |
|
129 while ( valid.Locate( input.Peek() ) != KErrNotFound ) |
|
130 { |
|
131 input.Inc(); |
|
132 } |
|
133 |
|
134 return !input.Remainder().Length(); |
|
135 } |
|
136 |
|
137 // ================= OTHER EXPORTED FUNCTIONS =============================== |
|
138 |
|
139 // End of File |