60
|
1 |
/*
|
|
2 |
*
|
|
3 |
* Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies).
|
|
4 |
* All rights reserved.
|
|
5 |
* This component and the accompanying materials are made available
|
|
6 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
7 |
* which accompanies this distribution, and is available
|
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
9 |
*
|
|
10 |
* Original Contributors:
|
|
11 |
* Comarch S.A. - original contribution.
|
|
12 |
*
|
|
13 |
* Contributors:
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include "hspcalltermination.h"
|
|
20 |
#include "hspcommand.h"
|
|
21 |
#include "hspsettings.h"
|
|
22 |
#include "debug.h"
|
|
23 |
|
|
24 |
CHsHSPCallTerminationProc* CHsHSPCallTerminationProc::NewL(
|
|
25 |
MHsHSPFeatureProviderObserver* aObserver )
|
|
26 |
{
|
|
27 |
CHsHSPCallTerminationProc *self = CHsHSPCallTerminationProc::NewLC(
|
|
28 |
aObserver );
|
|
29 |
CleanupStack::Pop( self );
|
|
30 |
|
|
31 |
return self;
|
|
32 |
}
|
|
33 |
|
|
34 |
CHsHSPCallTerminationProc* CHsHSPCallTerminationProc::NewLC(
|
|
35 |
MHsHSPFeatureProviderObserver* aObserver )
|
|
36 |
{
|
|
37 |
CHsHSPCallTerminationProc *self = new ( ELeave ) CHsHSPCallTerminationProc(
|
|
38 |
aObserver );
|
|
39 |
CleanupStack::PushL( self );
|
|
40 |
self->ConstructL();
|
|
41 |
return self;
|
|
42 |
}
|
|
43 |
|
|
44 |
CHsHSPCallTerminationProc::~CHsHSPCallTerminationProc()
|
|
45 |
{
|
|
46 |
}
|
|
47 |
|
|
48 |
TInt CHsHSPCallTerminationProc::ProcessCommand( const CHsHSPCommand* aInputCmd,
|
|
49 |
CHsHSPCommand &aOutputCmd )
|
|
50 |
{
|
|
51 |
TRACE_FUNC_ENTRY
|
|
52 |
|
|
53 |
TInt res = KErrNone;
|
|
54 |
if ( aInputCmd->FromAG() )
|
|
55 |
{
|
|
56 |
if ( iWaitingForOK && aInputCmd->Type() == EHSPCmdOK )
|
|
57 |
{
|
|
58 |
iWaitingForOK = EFalse;
|
|
59 |
iObserver->HandleProcedureCompleted( KErrNone, EHSPCallTerminate );
|
|
60 |
}
|
|
61 |
else
|
|
62 |
{
|
|
63 |
res = KErrArgument;
|
|
64 |
}
|
|
65 |
}
|
|
66 |
else
|
|
67 |
{
|
|
68 |
if ( IsCKPD200( aInputCmd ) )
|
|
69 |
{
|
|
70 |
iWaitingForOK = ETrue;
|
|
71 |
TRAP(res,CHsHSPCommand::CopyL( aInputCmd, aOutputCmd ));
|
|
72 |
}
|
|
73 |
else
|
|
74 |
{
|
|
75 |
res = KErrArgument;
|
|
76 |
}
|
|
77 |
}
|
|
78 |
|
|
79 |
TRACE_FUNC_EXIT
|
|
80 |
return res;
|
|
81 |
}
|
|
82 |
|
|
83 |
CHsHSPCallTerminationProc::CHsHSPCallTerminationProc(
|
|
84 |
MHsHSPFeatureProviderObserver* aObserver ) :
|
|
85 |
iObserver( aObserver )
|
|
86 |
{
|
|
87 |
|
|
88 |
}
|
|
89 |
|
|
90 |
void CHsHSPCallTerminationProc::ConstructL()
|
|
91 |
{
|
|
92 |
}
|
|
93 |
|
|
94 |
TBool CHsHSPCallTerminationProc::IsCKPD200( const CHsHSPCommand* aCommand )
|
|
95 |
{
|
|
96 |
TBool res = EFalse;
|
|
97 |
|
|
98 |
if ( ( EHSPCmdCKPD == aCommand->Type() )
|
|
99 |
&& ( aCommand->Params().Count() == 1 )
|
|
100 |
&& ( ( aCommand->Params()[0].Des().Compare( _L8("200") ) ) == 0 ) )
|
|
101 |
{
|
|
102 |
res = ETrue;
|
|
103 |
}
|
|
104 |
|
|
105 |
return res;
|
|
106 |
}
|
|
107 |
|
|
108 |
void CHsHSPCallTerminationProc::InformObserver( TInt aErr )
|
|
109 |
{
|
|
110 |
__ASSERT_ALWAYS(iObserver, User::Panic(_L("Observer missing"),KErrGeneral));
|
|
111 |
iObserver->HandleProcedureCompleted( aErr, iHSPProc );
|
|
112 |
}
|