24
|
1 |
// Copyright (c) 2007-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 |
// trpfunctor.cpp
|
|
15 |
// TRpsFunctor implementation
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "trpsfunctor.h"
|
|
20 |
|
|
21 |
#
|
|
22 |
|
|
23 |
//constructor - takes pointer to the RPS master object, pointer to the RPS function to invoke and 1 paramter
|
|
24 |
template <class TRpsParam1, class TRpsParam2, class TRpsParam3>
|
|
25 |
TRpsFunctor<TRpsParam1, TRpsParam2, TRpsParam3>::TRpsFunctor(CRPSMaster* aRpsMaster, const TDesC& aDisplayToClientTxt, TEtelLine aLine, TRpsWith1ParamFptr aRpsFptr, TRpsParam1 aRpsParam1)
|
|
26 |
: iRpsFptrWith1Param(aRpsFptr),
|
|
27 |
iRpsMaster(aRpsMaster),
|
|
28 |
iRpsParam1(aRpsParam1),
|
|
29 |
iRpsCallType(EOneParam)
|
|
30 |
{
|
|
31 |
SetDisplayToClientTxt(aDisplayToClientTxt, aLine);
|
|
32 |
}
|
|
33 |
|
|
34 |
//constructor - takes pointer to the RPS master object, pointer to the RPS function to invoke and 2 paramters
|
|
35 |
template <class TRpsParam1, class TRpsParam2, class TRpsParam3>
|
|
36 |
TRpsFunctor<TRpsParam1, TRpsParam2, TRpsParam3>::TRpsFunctor(CRPSMaster* aRpsMaster, const TDesC& aDisplayToClientTxt, TEtelLine aLine, TRpsWith2ParamFptr aRpsFptr, TRpsParam1 aRpsParam1, TRpsParam2 aRpsParam2)
|
|
37 |
: iRpsFptrWith2Param(aRpsFptr),
|
|
38 |
iRpsMaster(aRpsMaster),
|
|
39 |
iRpsParam1(aRpsParam1),
|
|
40 |
iRpsParam2(aRpsParam2),
|
|
41 |
iRpsCallType(ETwoParam)
|
|
42 |
{
|
|
43 |
SetDisplayToClientTxt(aDisplayToClientTxt, aLine);
|
|
44 |
}
|
|
45 |
|
|
46 |
//constructor - takes pointer to the RPS master object, pointer to the RPS function to invoke and 3 paramters
|
|
47 |
template <class TRpsParam1, class TRpsParam2, class TRpsParam3>
|
|
48 |
TRpsFunctor<TRpsParam1, TRpsParam2, TRpsParam3>::TRpsFunctor(CRPSMaster* aRpsMaster, const TDesC& aDisplayToClientTxt, TEtelLine aLine, TRpsWith3ParamFptr aRpsFptr, TRpsParam1 aRpsParam1, TRpsParam2 aRpsParam2, TRpsParam3 aRpsParam3)
|
|
49 |
: iRpsFptrWith3Param(aRpsFptr),
|
|
50 |
iRpsMaster(aRpsMaster),
|
|
51 |
iRpsParam1(aRpsParam1),
|
|
52 |
iRpsParam2(aRpsParam2),
|
|
53 |
iRpsParam3(aRpsParam3),
|
|
54 |
iRpsCallType(EThreeParam)
|
|
55 |
{
|
|
56 |
SetDisplayToClientTxt(aDisplayToClientTxt, aLine);
|
|
57 |
}
|
|
58 |
|
|
59 |
//setup msg to display to client
|
|
60 |
template <class TRpsParam1, class TRpsParam2, class TRpsParam3>
|
|
61 |
void TRpsFunctor<TRpsParam1, TRpsParam2, TRpsParam3>::SetDisplayToClientTxt(const TDesC& aDisplayToClientTxt, TEtelLine aLine)
|
|
62 |
{
|
|
63 |
_LIT(KVoice, "voice");
|
|
64 |
_LIT(KData, "data");
|
|
65 |
_LIT(KFax, "fax");
|
|
66 |
if(aLine >=0 )
|
|
67 |
{
|
|
68 |
switch(aLine)
|
|
69 |
{
|
|
70 |
case EDataLine:
|
|
71 |
iDisplayToClientTxt.Format(aDisplayToClientTxt, &KData);
|
|
72 |
break;
|
|
73 |
case EFaxLine:
|
|
74 |
iDisplayToClientTxt.Format(aDisplayToClientTxt, &KFax);
|
|
75 |
break;
|
|
76 |
case EVoiceLine:
|
|
77 |
default:
|
|
78 |
iDisplayToClientTxt.Format(aDisplayToClientTxt, &KVoice);
|
|
79 |
}
|
|
80 |
}
|
|
81 |
else
|
|
82 |
{
|
|
83 |
iDisplayToClientTxt.Copy(aDisplayToClientTxt);
|
|
84 |
}
|
|
85 |
}
|
|
86 |
|
|
87 |
//return msg that is displayed to the client
|
|
88 |
template <class TRpsParam1, class TRpsParam2, class TRpsParam3>
|
|
89 |
const TDesC& TRpsFunctor<TRpsParam1, TRpsParam2, TRpsParam3>::DisplayToClientTxt()
|
|
90 |
{
|
|
91 |
return iDisplayToClientTxt;
|
|
92 |
}
|
|
93 |
|
|
94 |
//execute the RPS request based on the number of parameters that was passed in
|
|
95 |
template <class TRpsParam1, class TRpsParam2, class TRpsParam3>
|
|
96 |
void TRpsFunctor<TRpsParam1, TRpsParam2, TRpsParam3>::ExecuteRpsRequestL()
|
|
97 |
{
|
|
98 |
if(iRpsCallType == EOneParam)
|
|
99 |
{
|
|
100 |
(*iRpsMaster.*iRpsFptrWith1Param)(iRpsParam1);
|
|
101 |
}
|
|
102 |
else if(iRpsCallType == ETwoParam)
|
|
103 |
{
|
|
104 |
(*iRpsMaster.*iRpsFptrWith2Param)(iRpsParam1, iRpsParam2);
|
|
105 |
}
|
|
106 |
else if(iRpsCallType == EThreeParam)
|
|
107 |
{
|
|
108 |
(*iRpsMaster.*iRpsFptrWith3Param)(iRpsParam1, iRpsParam2, iRpsParam3);
|
|
109 |
}
|
|
110 |
else
|
|
111 |
{
|
|
112 |
__ASSERT_ALWAYS(EFalse, User::Panic(KPanic,KCTSYPanic_invalidrpsparameters));
|
|
113 |
}
|
|
114 |
|
|
115 |
return;
|
|
116 |
}
|
|
117 |
|
|
118 |
|