|
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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // MSGMSGNETTESTSTUB.CPP |
|
15 // |
|
16 // |
|
17 |
|
18 #define LOCAL_INCLUDE |
|
19 #include "msgnetteststub.h" |
|
20 #undef LOCAL_INCLUDE |
|
21 #include "cmsgtestpropertywatcher.h" |
|
22 #include "cimmobilitytestframework.h" |
|
23 #include "mobilitytestpropertyvalue.h" |
|
24 |
|
25 EXPORT_C MSGNETTESTSTUB::CActiveCommsMobilityApiExt* MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewL(RCommsSubSession& aExtensionProvider,MMobilityProtocolResp& aProtocol) |
|
26 { |
|
27 CActiveCommsMobilityApiExt* self = new (ELeave) CActiveCommsMobilityApiExt(aExtensionProvider, aProtocol); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 } |
|
33 |
|
34 void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::ConstructL() |
|
35 { |
|
36 iCommsMobilityApi = NULL; |
|
37 //Try to construct the real thing, but trap the 'not supported' error: |
|
38 // TRAPD(err, iCommsMobilityApi = ::CActiveCommsMobilityApiExt::NewL(aExtensionProvider, *this)); |
|
39 |
|
40 iPropertyWatcher = CMsgTestPropertyWatcher::NewL(KPropertyCatMsgTestUtilityServer2, EMyPropertyCounter, *this); |
|
41 |
|
42 iServiceId = CImMobilityTestFramework::GetServiceId(iProtocol); |
|
43 User::LeaveIfError(iServiceId); |
|
44 } |
|
45 |
|
46 MSGNETTESTSTUB::CActiveCommsMobilityApiExt::CActiveCommsMobilityApiExt(RCommsSubSession& aExtensionProvider, MMobilityProtocolResp& aProtocol) |
|
47 : iCommsSubSession(aExtensionProvider), iProtocol(aProtocol) |
|
48 { |
|
49 } |
|
50 |
|
51 EXPORT_C MSGNETTESTSTUB::CActiveCommsMobilityApiExt::~CActiveCommsMobilityApiExt() |
|
52 { |
|
53 delete iCommsMobilityApi; |
|
54 delete iPropertyWatcher; |
|
55 } |
|
56 |
|
57 EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::MigrateToPreferredCarrier() |
|
58 { |
|
59 // Flag the call iCommsMobilityApi->MigrateToPreferredCarrier(); |
|
60 iPropertyWatcher->Property().Set(ENTSMigrateToPreferredCarrierFlag); |
|
61 } |
|
62 |
|
63 EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::IgnorePreferredCarrier() |
|
64 { |
|
65 // Flag the call iCommsMobilityApi->IgnorePreferredCarrier(); |
|
66 iPropertyWatcher->Property().Set(ENTSIgnorePreferredCarrierFlag); |
|
67 } |
|
68 |
|
69 EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierAccepted() |
|
70 { |
|
71 // Flag the call iCommsMobilityApi->NewCarrierAccepted(); |
|
72 iPropertyWatcher->Property().Set(ENTSNewCarrierAcceptedFlag); |
|
73 } |
|
74 |
|
75 EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierRejected() |
|
76 { |
|
77 // Flag the call iCommsMobilityApi->NewCarrierRejected(); |
|
78 iPropertyWatcher->Property().Set(ENTSNewCarrierRejectedFlag); |
|
79 } |
|
80 |
|
81 //Additional functionality: |
|
82 |
|
83 // from MMobilityProtocolResp |
|
84 void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::PreferredCarrierAvailable(TAccessPointInfo aOldAp, TAccessPointInfo aNewAp, TBool aIsUpgrade, TBool aIsSeamless) |
|
85 { |
|
86 iProtocol.PreferredCarrierAvailable(aOldAp, aNewAp, aIsUpgrade, aIsSeamless); |
|
87 } |
|
88 |
|
89 void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless) |
|
90 { |
|
91 iProtocol.NewCarrierActive(aNewAp, aIsSeamless); |
|
92 } |
|
93 |
|
94 void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::Error(TInt aError) |
|
95 { |
|
96 iProtocol.Error(aError); |
|
97 } |
|
98 |
|
99 // from CMsgTestPropertyWatcher |
|
100 void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::HandleEventL(RProperty& aProperty, TUint /*aKey*/) |
|
101 { |
|
102 |
|
103 TInt propertyVal = ENTSInitialValueFlag; |
|
104 User::LeaveIfError(aProperty.Get(propertyVal)); |
|
105 |
|
106 TAccessPointInfo oldAp; |
|
107 TAccessPointInfo newAp; |
|
108 oldAp.SetAccessPoint(1); |
|
109 newAp.SetAccessPoint(1); |
|
110 |
|
111 TBool isSeamless = EFalse; |
|
112 |
|
113 TInt error = 0; |
|
114 |
|
115 switch(propertyVal) |
|
116 { |
|
117 // Callbacks to production code: |
|
118 case ENTSPreferredCarrierUpgradeCall : |
|
119 PreferredCarrierAvailable(oldAp, newAp, ETrue, isSeamless); |
|
120 break; |
|
121 case ENTSPreferredCarrierDowngradeCall : |
|
122 PreferredCarrierAvailable(oldAp, newAp, EFalse, isSeamless); |
|
123 break; |
|
124 case ENTSNewCarrierActiveCall : |
|
125 NewCarrierActive(newAp, isSeamless); |
|
126 break; |
|
127 case ENTSErrorCall : |
|
128 MSGNETTESTSTUB::CActiveCommsMobilityApiExt::Error(error); |
|
129 break; |
|
130 |
|
131 // Ignore any other calls |
|
132 default : |
|
133 break; |
|
134 } |
|
135 |
|
136 } |