|
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,const TDesC8& aContactLinkArray, 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 dialDataExt->SetContactLinkL( aContactLinkArray ); |
|
90 switch (aCallType) |
|
91 { |
|
92 case ECCACallTypeVoice: |
|
93 dialDataExt->SetCallType ( CAiwDialData::EAIWForcedCS); |
|
94 break; |
|
95 case ECCACallTypeVoIP: |
|
96 dialDataExt->SetServiceId(aServiceId); |
|
97 dialDataExt->SetCallType ( CAiwDialData::EAIWVoiP); |
|
98 break; |
|
99 case ECCACallTypeVideo: |
|
100 dialDataExt->SetCallType ( CAiwDialData::EAIWForcedVideo); |
|
101 break; |
|
102 default: |
|
103 dialDataExt->SetCallType ( CAiwDialData::EAIWForcedCS); |
|
104 break; |
|
105 } |
|
106 |
|
107 dialDataExt->SetWindowGroup ( CCoeEnv::Static()->RootWin().Identifier ()); |
|
108 |
|
109 DoAIWCallL (*dialDataExt); |
|
110 |
|
111 CleanupStack::PopAndDestroy (dialDataExt); |
|
112 |
|
113 CleanupStack::PopAndDestroy (numBuf); |
|
114 |
|
115 return; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------- |
|
119 // CCCAPhoneCall::DoAIWCallL |
|
120 // --------------------------------------------------------- |
|
121 void CCCAPhoneCall::DoAIWCallL( CAiwDialDataExt& aDialData) |
|
122 { |
|
123 |
|
124 RCriteriaArray interest; |
|
125 CleanupClosePushL ( interest); |
|
126 CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC ( KAiwCmdCall, |
|
127 KAiwCmdCall, KAiwContentTypeAll); |
|
128 criteria->SetServiceClass ( TUid::Uid (KAiwClassBase)); |
|
129 User::LeaveIfError ( interest.Append ( criteria)); |
|
130 |
|
131 CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewLC (); |
|
132 serviceHandler->AttachL ( interest); |
|
133 |
|
134 CAiwGenericParamList& paramList = serviceHandler->InParamListL (); |
|
135 aDialData.FillInParamListL ( paramList); |
|
136 |
|
137 serviceHandler->ExecuteServiceCmdL ( KAiwCmdCall, paramList, |
|
138 serviceHandler->OutParamListL (), 0, NULL); |
|
139 serviceHandler->DetachL ( interest); |
|
140 |
|
141 CleanupStack::PopAndDestroy ( serviceHandler); |
|
142 CleanupStack::PopAndDestroy ( criteria); |
|
143 CleanupStack::PopAndDestroy (); //interest |
|
144 |
|
145 return; |
|
146 } |
|
147 |
|
148 // End of File |