24
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
#include "CAnswerIncomingCall.h"
|
|
17 |
|
|
18 |
/**
|
|
19 |
Factory constructor.
|
|
20 |
|
|
21 |
@param aController Pointer to MExecAsync object passed to constructor of
|
|
22 |
CISVAPIBase
|
|
23 |
@return Instance of CAnswerIncomingCall class
|
|
24 |
*/
|
|
25 |
CAnswerIncomingCall* CAnswerIncomingCall::NewL(MExecAsync* aController)
|
|
26 |
{
|
|
27 |
CAnswerIncomingCall* self = new(ELeave) CAnswerIncomingCall(aController);
|
|
28 |
CleanupStack::PushL(self);
|
|
29 |
self->ConstructL();
|
|
30 |
CleanupStack::Pop(self);
|
|
31 |
return self;
|
|
32 |
}
|
|
33 |
|
|
34 |
/**
|
|
35 |
Destructor.
|
|
36 |
Cancels outstanding requests.
|
|
37 |
*/
|
|
38 |
CAnswerIncomingCall::~CAnswerIncomingCall()
|
|
39 |
{
|
|
40 |
Cancel();
|
|
41 |
}
|
|
42 |
|
|
43 |
/**
|
|
44 |
Answers the call specified in iCallId.
|
|
45 |
*/
|
|
46 |
void CAnswerIncomingCall::DoStartRequestL()
|
|
47 |
{
|
|
48 |
_LIT( KNotifyPanic, "CAnswerIncomingCall Get Method" );
|
|
49 |
__ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
|
|
50 |
iRequestNotify = EFalse;
|
|
51 |
|
|
52 |
// Answers an incoming new voice call
|
|
53 |
iTelephony->AnswerIncomingCall(iStatus, iCallId);
|
|
54 |
SetActive();
|
|
55 |
}
|
|
56 |
|
|
57 |
/**
|
|
58 |
Constructor.
|
|
59 |
|
|
60 |
@param aController Pointer to an MExecAsync object passed to constructor of
|
|
61 |
CISVAPIBase
|
|
62 |
*/
|
|
63 |
CAnswerIncomingCall::CAnswerIncomingCall(MExecAsync* aController)
|
|
64 |
: CISVAPIAsync(aController, KAnswerIncomingCall),
|
|
65 |
iCallStatusV1Pckg( iCallStatusV1 )
|
|
66 |
{
|
|
67 |
// Empty method
|
|
68 |
}
|
|
69 |
|
|
70 |
/**
|
|
71 |
Second phase constructor.
|
|
72 |
*/
|
|
73 |
void CAnswerIncomingCall::ConstructL()
|
|
74 |
{
|
|
75 |
iRequestNotify = EFalse;
|
|
76 |
}
|
|
77 |
|
|
78 |
/**
|
|
79 |
Checks the status of the active object and if there is no error, tells the user
|
|
80 |
via the console that the call has been answered.
|
|
81 |
*/
|
|
82 |
void CAnswerIncomingCall::RunL()
|
|
83 |
{
|
|
84 |
if(iStatus != KErrNone)
|
|
85 |
{
|
|
86 |
iConsole->Printf(KError);
|
|
87 |
|
|
88 |
// print the error status code
|
|
89 |
iConsole->Printf(_L("%d\n"), iStatus.Int());
|
|
90 |
}
|
|
91 |
else
|
|
92 |
{
|
|
93 |
// Print the console output message if there is no error
|
|
94 |
iConsole->Printf(_L("Call Answered ....\n"));
|
|
95 |
ExampleNotify();
|
|
96 |
}
|
|
97 |
}
|
|
98 |
|
|
99 |
/**
|
|
100 |
Cancels asynchronous request to CTelephony::AnswerIncomingCall()
|
|
101 |
*/
|
|
102 |
void CAnswerIncomingCall::DoCancel()
|
|
103 |
{
|
|
104 |
// Cancels an outstanding asynchronous request.
|
|
105 |
iTelephony->CancelAsync(CTelephony::EAnswerIncomingCallCancel);
|
|
106 |
}
|