24
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "T_RMobileConferenceCallData.h"
|
|
19 |
#include <e32property.h>
|
|
20 |
|
|
21 |
|
|
22 |
_LIT( KNumOfCalls, "NumOfCalls" );
|
|
23 |
|
|
24 |
_LIT(KMobilePhoneKey, "RMobilePhone");
|
|
25 |
|
|
26 |
_LIT(KCmdClose, "Close");
|
|
27 |
_LIT(KCmdCreateConference, "CreateConference");
|
|
28 |
_LIT(KCmdEnumerateCalls, "EnumerateCalls");
|
|
29 |
_LIT(KCmdOpen, "Open");
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Two phase constructor
|
|
33 |
*
|
|
34 |
* @leave system wide error
|
|
35 |
*/
|
|
36 |
CT_RMobileConferenceCallData* CT_RMobileConferenceCallData::NewL()
|
|
37 |
{
|
|
38 |
CT_RMobileConferenceCallData* ret=new (ELeave) CT_RMobileConferenceCallData();
|
|
39 |
CleanupStack::PushL(ret);
|
|
40 |
ret->ConstructL();
|
|
41 |
CleanupStack::Pop(ret);
|
|
42 |
return ret;
|
|
43 |
}
|
|
44 |
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Protected constructor. First phase construction
|
|
48 |
*/
|
|
49 |
CT_RMobileConferenceCallData::CT_RMobileConferenceCallData()
|
|
50 |
: iActiveCallback(NULL),
|
|
51 |
iMobileConferenceCall(NULL)
|
|
52 |
{
|
|
53 |
}
|
|
54 |
|
|
55 |
void CT_RMobileConferenceCallData::ConstructL()
|
|
56 |
{
|
|
57 |
iMobileConferenceCall = new (ELeave) RMobileConferenceCall();
|
|
58 |
iActiveCallback = CActiveCallback::NewL(*this);
|
|
59 |
}
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Public destructor
|
|
63 |
*/
|
|
64 |
CT_RMobileConferenceCallData::~CT_RMobileConferenceCallData()
|
|
65 |
{
|
|
66 |
delete iMobileConferenceCall;
|
|
67 |
iMobileConferenceCall = NULL;
|
|
68 |
delete iActiveCallback;
|
|
69 |
iActiveCallback=NULL;
|
|
70 |
}
|
|
71 |
|
|
72 |
TAny* CT_RMobileConferenceCallData::GetObject()
|
|
73 |
{
|
|
74 |
return iMobileConferenceCall;
|
|
75 |
}
|
|
76 |
|
|
77 |
void CT_RMobileConferenceCallData::RunL(CActive* aActive, TInt aIndex)
|
|
78 |
{
|
|
79 |
DecOutstanding(); // One of the async calls has completed
|
|
80 |
TInt err = aActive->iStatus.Int();
|
|
81 |
if( err != KErrNone )
|
|
82 |
{
|
|
83 |
ERR_PRINTF2(_L("RunL Error %d"), err);
|
|
84 |
SetAsyncError( aIndex, err );
|
|
85 |
}
|
|
86 |
else
|
|
87 |
{
|
|
88 |
INFO_PRINTF1(_L("RunL completed successfully"));
|
|
89 |
}
|
|
90 |
}
|
|
91 |
|
|
92 |
TBool CT_RMobileConferenceCallData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
|
93 |
{
|
|
94 |
TBool ret = ETrue;
|
|
95 |
|
|
96 |
if ( aCommand==KCmdClose )
|
|
97 |
{
|
|
98 |
DoCmdClose();
|
|
99 |
}
|
|
100 |
else if ( aCommand==KCmdCreateConference)
|
|
101 |
{
|
|
102 |
DoCmdCreateConference(aAsyncErrorIndex);
|
|
103 |
}
|
|
104 |
else if ( aCommand==KCmdEnumerateCalls)
|
|
105 |
{
|
|
106 |
DoCmdEnumerateCalls(aSection);
|
|
107 |
}
|
|
108 |
else if ( aCommand==KCmdOpen)
|
|
109 |
{
|
|
110 |
DoCmdOpen(aSection);
|
|
111 |
}
|
|
112 |
else
|
|
113 |
{
|
|
114 |
ERR_PRINTF1(_L("Unknown command"));
|
|
115 |
ret = EFalse;
|
|
116 |
}
|
|
117 |
|
|
118 |
return ret;
|
|
119 |
}
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
void CT_RMobileConferenceCallData::DoCmdClose()
|
|
124 |
{
|
|
125 |
INFO_PRINTF1(_L("*START*CT_VoiceCallDriverData::DoCmdCloseConferenceCall"));
|
|
126 |
|
|
127 |
iMobileConferenceCall->Close();
|
|
128 |
|
|
129 |
INFO_PRINTF1(_L("*END*CT_VoiceCallDriverData::DoCmdCloseConferenceCall"));
|
|
130 |
}
|
|
131 |
|
|
132 |
|
|
133 |
void CT_RMobileConferenceCallData::DoCmdCreateConference(const TInt aAsyncErrorIndex)
|
|
134 |
{
|
|
135 |
INFO_PRINTF1(_L("*START*CT_VoiceCallDriverData::DoCmdCreateConferenceCall"));
|
|
136 |
|
|
137 |
iMobileConferenceCall->CreateConference(iActiveCallback->iStatus);
|
|
138 |
iActiveCallback->Activate(aAsyncErrorIndex);
|
|
139 |
IncOutstanding();
|
|
140 |
|
|
141 |
INFO_PRINTF1(_L("*END*CT_VoiceCallDriverData::DoCmdCreateConferenceCall"));
|
|
142 |
}
|
|
143 |
|
|
144 |
|
|
145 |
void CT_RMobileConferenceCallData::DoCmdEnumerateCalls(const TTEFFunction& aSection)
|
|
146 |
{
|
|
147 |
INFO_PRINTF1(_L("*START*CT_VoiceCallDriverData::DoCmdEnumerateCallsOnConference"));
|
|
148 |
|
|
149 |
TInt expectedCalls;
|
|
150 |
if( !GetIntFromConfig(aSection, KNumOfCalls, expectedCalls) )
|
|
151 |
{
|
|
152 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KNumOfCalls);
|
|
153 |
SetBlockResult(EFail);
|
|
154 |
}
|
|
155 |
else
|
|
156 |
{
|
|
157 |
INFO_PRINTF2(_L("Expecting conference call to contain [%d] calls"), expectedCalls);
|
|
158 |
TInt calls(0);
|
|
159 |
TRAPD( error, iMobileConferenceCall->EnumerateCalls(calls) );
|
|
160 |
if(error != KErrNone)
|
|
161 |
{
|
|
162 |
ERR_PRINTF2(_L("Failed to enumerate calls with error %d"), error);
|
|
163 |
SetError(error);
|
|
164 |
}
|
|
165 |
else
|
|
166 |
{
|
|
167 |
INFO_PRINTF2(_L("Conference contained [%d] calls"), calls);
|
|
168 |
if (expectedCalls != calls)
|
|
169 |
{
|
|
170 |
ERR_PRINTF3(_L("Obtained number of calls %d is different from expected number of calls %d"), calls, expectedCalls);
|
|
171 |
SetBlockResult(EFail);
|
|
172 |
}
|
|
173 |
else
|
|
174 |
{
|
|
175 |
INFO_PRINTF1(_L("DoCmdEnumerateCallsOnConference succeeded"));
|
|
176 |
}
|
|
177 |
}
|
|
178 |
}
|
|
179 |
INFO_PRINTF1(_L("*END*CT_VoiceCallDriverData::DoCmdEnumerateCallsOnConference"));
|
|
180 |
}
|
|
181 |
|
|
182 |
void CT_RMobileConferenceCallData::DoCmdOpen(const TTEFFunction& aSection)
|
|
183 |
{
|
|
184 |
INFO_PRINTF1(_L("*START*CT_VoiceCallDriverData::DoCmdOpenConferenceCall"));
|
|
185 |
|
|
186 |
TPtrC mobilePhoneName;
|
|
187 |
if( !GetStringFromConfig(aSection, KMobilePhoneKey, mobilePhoneName))
|
|
188 |
{
|
|
189 |
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMobilePhoneKey);
|
|
190 |
SetBlockResult(EFail);
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
RMobilePhone* MobilePhoneObject = static_cast<RMobilePhone*>(GetDataObjectL(mobilePhoneName));
|
|
195 |
TRAPD( error, iMobileConferenceCall->Open(*MobilePhoneObject) );
|
|
196 |
if (error != KErrNone)
|
|
197 |
{
|
|
198 |
ERR_PRINTF2(_L("Conference call open failed [%d]"), error);
|
|
199 |
SetError(error);
|
|
200 |
}
|
|
201 |
else
|
|
202 |
{
|
|
203 |
INFO_PRINTF1(_L("DoCmdOpenConferenceCall succeeded"));
|
|
204 |
}
|
|
205 |
}
|
|
206 |
INFO_PRINTF1(_L("*END*CT_VoiceCallDriverData::DoCmdOpenConferenceCall"));
|
|
207 |
}
|
|
208 |
|
|
209 |
|