|
1 /* |
|
2 * Copyright (c) 2007 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: Launching Call. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "ccacontactorheaders.h" |
|
21 |
|
22 _LIT8( KAiwContentTypeAll, "*" ); |
|
23 |
|
24 /// Unnamed namespace for local definitions |
|
25 namespace |
|
26 { |
|
27 |
|
28 #ifdef _DEBUG |
|
29 enum TPanicCode |
|
30 { |
|
31 EPanicPreCond_ExecuteL = 1, |
|
32 EPanicPreCond_ExecuteL2 |
|
33 }; |
|
34 |
|
35 void Panic(TPanicCode aReason) |
|
36 { |
|
37 _LIT(KPanicText, "CCmsPhoneCall"); |
|
38 User::Panic (KPanicText, aReason); |
|
39 } |
|
40 #endif // _DEBUG |
|
41 |
|
42 |
|
43 } /// namespace |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // --------------------------------------------------------- |
|
48 // CCCAPhoneCall::ExecuteL |
|
49 // --------------------------------------------------------- |
|
50 void CCCAPhoneCall::ExecuteL( const TDesC& aPhoneNumber, TCCAPhoneCallType aCallType, TUint32 aServiceId) |
|
51 { |
|
52 |
|
53 __ASSERT_DEBUG (NULL != &aPhoneNumber && 0 < aPhoneNumber.Size(), Panic (EPanicPreCond_ExecuteL)); |
|
54 |
|
55 #ifdef _DEBUG |
|
56 HBufC8* buf = HBufC8::NewLC ( aPhoneNumber.Length ()); |
|
57 buf->Des().Copy ( aPhoneNumber); |
|
58 TPtrC8 numberDesc( buf->Des ()); |
|
59 |
|
60 CleanupStack::PopAndDestroy (); //buf |
|
61 #endif |
|
62 |
|
63 //aPhoneNumber will be an xsp id of format "ServiceName:UserId" |
|
64 //here we need to truncate the servicename and pass only the UserId |
|
65 |
|
66 //Find if aPhoneNumber of type "ServiceName:UserId" |
|
67 //if true, then remove the service part |
|
68 TInt phoneNumberStart = aPhoneNumber.Locate(':'); |
|
69 HBufC* numBuf = NULL; |
|
70 |
|
71 if ( KErrNotFound != phoneNumberStart ) |
|
72 { |
|
73 phoneNumberStart++; //To get rid of ':' |
|
74 numBuf = aPhoneNumber.Right( |
|
75 aPhoneNumber.Length() - phoneNumberStart |
|
76 ).AllocLC(); |
|
77 } |
|
78 else |
|
79 { |
|
80 numBuf = aPhoneNumber.AllocLC(); |
|
81 } |
|
82 |
|
83 TPtr numDesc( numBuf->Des ()); |
|
84 CommonPhoneParser::ParsePhoneNumber ( numDesc, |
|
85 CommonPhoneParser::EPhoneClientNumber); |
|
86 |
|
87 CAiwDialDataExt* dialDataExt = CAiwDialDataExt::NewLC (); |
|
88 dialDataExt->SetPhoneNumberL ( numBuf->Des ()); |
|
89 switch (aCallType) |
|
90 { |
|
91 case ECCACallTypeVoice: |
|
92 dialDataExt->SetCallType ( CAiwDialData::EAIWForcedCS); |
|
93 break; |
|
94 case ECCACallTypeVoIP: |
|
95 dialDataExt->SetServiceId(aServiceId); |
|
96 dialDataExt->SetCallType ( CAiwDialData::EAIWVoiP); |
|
97 break; |
|
98 case ECCACallTypeVideo: |
|
99 dialDataExt->SetCallType ( CAiwDialData::EAIWForcedVideo); |
|
100 break; |
|
101 default: |
|
102 dialDataExt->SetCallType ( CAiwDialData::EAIWForcedCS); |
|
103 break; |
|
104 } |
|
105 |
|
106 dialDataExt->SetWindowGroup ( CCoeEnv::Static()->RootWin().Identifier ()); |
|
107 |
|
108 DoAIWCallL (*dialDataExt); |
|
109 |
|
110 CleanupStack::PopAndDestroy (dialDataExt); |
|
111 |
|
112 CleanupStack::PopAndDestroy (numBuf); |
|
113 |
|
114 return; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------- |
|
118 // CCCAPhoneCall::DoAIWCallL |
|
119 // --------------------------------------------------------- |
|
120 void CCCAPhoneCall::DoAIWCallL( CAiwDialDataExt& aDialData) |
|
121 { |
|
122 |
|
123 RCriteriaArray interest; |
|
124 CleanupClosePushL ( interest); |
|
125 CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC ( KAiwCmdCall, |
|
126 KAiwCmdCall, KAiwContentTypeAll); |
|
127 criteria->SetServiceClass ( TUid::Uid (KAiwClassBase)); |
|
128 User::LeaveIfError ( interest.Append ( criteria)); |
|
129 |
|
130 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewLC (); |
|
131 serviceHandler->AttachL ( interest); |
|
132 |
|
133 CAiwGenericParamList& paramList = serviceHandler->InParamListL (); |
|
134 aDialData.FillInParamListL ( paramList); |
|
135 |
|
136 serviceHandler->ExecuteServiceCmdL ( KAiwCmdCall, paramList, |
|
137 serviceHandler->OutParamListL (), 0, NULL); |
|
138 serviceHandler->DetachL ( interest); |
|
139 |
|
140 CleanupStack::PopAndDestroy ( serviceHandler); |
|
141 CleanupStack::PopAndDestroy ( criteria); |
|
142 CleanupStack::PopAndDestroy (); //interest |
|
143 |
|
144 return; |
|
145 } |
|
146 |
|
147 // End of File |