1 /* |
|
2 * Copyright (c) 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 the License "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: This file contains testclass implementation.* |
|
15 */ |
|
16 |
|
17 |
|
18 // [INCLUDE FILES] |
|
19 |
|
20 #include "VCXTestSmClient.h" |
|
21 #include "CIptvService.h" |
|
22 #include "CIptvServiceManagementClient.h" |
|
23 #include "VCXTestLog.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ---------------------------------------------------------------------------- |
|
28 // CVCXTestSmClient::NewL |
|
29 // ---------------------------------------------------------------------------- |
|
30 // |
|
31 CVCXTestSmClient* CVCXTestSmClient::NewL() |
|
32 { |
|
33 CVCXTestSmClient* self = new ( ELeave ) CVCXTestSmClient(); |
|
34 CleanupStack::PushL( self ); |
|
35 self->ConstructL(); |
|
36 CleanupStack::Pop( self ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // ---------------------------------------------------------------------------- |
|
41 // CVCXTestSmClient::~CVCXTestSmClient |
|
42 // ---------------------------------------------------------------------------- |
|
43 // |
|
44 CVCXTestSmClient::~CVCXTestSmClient() |
|
45 { |
|
46 delete iIptvServiceManagementClient; |
|
47 iIptvServiceManagementClient = NULL; |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------------------------------- |
|
51 // CVCXTestSmClient::CVCXTestSmClient |
|
52 // ---------------------------------------------------------------------------- |
|
53 // |
|
54 CVCXTestSmClient::CVCXTestSmClient() |
|
55 { |
|
56 |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // CVCXTestSmClient::CVCXTestSmClient |
|
61 // ---------------------------------------------------------------------------- |
|
62 // |
|
63 void CVCXTestSmClient::ConstructL() |
|
64 { |
|
65 iIptvServiceManagementClient = CIptvServiceManagementClient::NewL( *this ); |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // CVCXTestSmClient::CVCXTestSmClient |
|
70 // ---------------------------------------------------------------------------- |
|
71 // |
|
72 void CVCXTestSmClient::GetServiceIdL( TUint32& aServiceId, const TDesC& aName ) |
|
73 { |
|
74 CDesC8ArraySeg* servicesArray( NULL ); |
|
75 MIptvServiceManagementClientObserver::TRespStatus resp; |
|
76 TInt ret( KErrNone ); |
|
77 |
|
78 TRAPD( err, ret = iIptvServiceManagementClient->GetServicesL( |
|
79 0, CIptvServiceManagementClient::EDateAscending, servicesArray, resp ) ); |
|
80 |
|
81 CleanupStack::PushL( servicesArray ); |
|
82 |
|
83 VCXLOGLO4("CVCXTestSmClient:: GetServicesL err: %d, ret: %d, resp: %d", err, ret, resp ); |
|
84 |
|
85 err = ( err != KErrNone ) ? err : ret; |
|
86 err = ( err == KErrNone && resp != MIptvServiceManagementClientObserver::ESucceeded ) ? KErrGeneral : KErrNone; |
|
87 |
|
88 if( err == KErrNone ) |
|
89 { |
|
90 err = KErrNotFound; |
|
91 CIptvService* iptvService; |
|
92 for(TInt i = 0; i < servicesArray->MdcaCount(); i++) |
|
93 { |
|
94 iptvService = CIptvService::NewL(); |
|
95 CleanupStack::PushL( iptvService ); |
|
96 iptvService->SetL( servicesArray->MdcaPoint(i) ); |
|
97 VCXLOGLO3("CVCXTestSmClient:: service id: %d, name: %S", iptvService->GetId(), &(iptvService->GetName()) ); |
|
98 |
|
99 if( iptvService->GetName().CompareF( aName ) == KErrNone ) |
|
100 { |
|
101 aServiceId = iptvService->GetId(); |
|
102 CleanupStack::PopAndDestroy( iptvService ); |
|
103 iptvService = NULL; |
|
104 err = KErrNone; |
|
105 break; |
|
106 } |
|
107 |
|
108 CleanupStack::PopAndDestroy( iptvService ); |
|
109 iptvService = NULL; |
|
110 } |
|
111 } |
|
112 CleanupStack::PopAndDestroy( servicesArray ); |
|
113 |
|
114 User::LeaveIfError( err ); |
|
115 } |
|
116 |
|
117 // ---------------------------------------------------------------------------- |
|
118 // CVCXTestSmClient::CVCXTestSmClient |
|
119 // ---------------------------------------------------------------------------- |
|
120 // |
|
121 void CVCXTestSmClient::GetAnyServiceIdL( TUint32& aServiceId ) |
|
122 { |
|
123 CDesC8ArraySeg* servicesArray( NULL ); |
|
124 MIptvServiceManagementClientObserver::TRespStatus resp; |
|
125 TInt ret( KErrNone ); |
|
126 |
|
127 TRAPD( err, ret = iIptvServiceManagementClient->GetServicesL( |
|
128 0, CIptvServiceManagementClient::EDateAscending, servicesArray, resp ) ); |
|
129 |
|
130 CleanupStack::PushL( servicesArray ); |
|
131 |
|
132 VCXLOGLO4("CVCXTestSmClient:: GetServicesL err: %d, ret: %d, resp: %d", err, ret, resp ); |
|
133 |
|
134 err = ( err != KErrNone ) ? err : ret; |
|
135 err = ( err == KErrNone && resp != MIptvServiceManagementClientObserver::ESucceeded ) ? KErrGeneral : KErrNone; |
|
136 |
|
137 TBool found( EFalse ); |
|
138 |
|
139 if( err == KErrNone ) |
|
140 { |
|
141 for( TInt i=0; i<servicesArray->MdcaCount(); i++ ) |
|
142 { |
|
143 CIptvService* iptvService = CIptvService::NewL(); |
|
144 CleanupStack::PushL( iptvService ); |
|
145 iptvService->SetL( servicesArray->MdcaPoint( i ) ); |
|
146 if( iptvService->GetType() == CIptvService::EVod || iptvService->GetType() == CIptvService::EVodCast ) |
|
147 { |
|
148 aServiceId = iptvService->GetId(); |
|
149 VCXLOGLO3("CVCXTestSmClient:: service id: %d, name: %S", iptvService->GetId(), &(iptvService->GetName()) ); |
|
150 found = ETrue; |
|
151 } |
|
152 CleanupStack::PopAndDestroy( iptvService ); |
|
153 } |
|
154 } |
|
155 CleanupStack::PopAndDestroy( servicesArray ); |
|
156 |
|
157 if( !found ) |
|
158 { |
|
159 err = KErrNotFound; |
|
160 } |
|
161 |
|
162 User::LeaveIfError( err ); |
|
163 } |
|
164 |
|
165 // ---------------------------------------------------------------------------- |
|
166 // CVCXTestSmClient::NewL |
|
167 // ------------------AddServiceResp--------------------------------------------------------- |
|
168 // |
|
169 void CVCXTestSmClient::AddServiceResp(TRespStatus /*aRespStatus*/) |
|
170 { |
|
171 |
|
172 } |
|
173 |
|
174 // ---------------------------------------------------------------------------- |
|
175 // CVCXTestSmClient::UpdateServiceResp |
|
176 // ---------------------------------------------------------------------------- |
|
177 // |
|
178 void CVCXTestSmClient::UpdateServiceResp(TRespStatus /*aRespStatus*/) |
|
179 { |
|
180 |
|
181 } |
|
182 |
|
183 // ---------------------------------------------------------------------------- |
|
184 // CVCXTestSmClient::DeleteServiceResp |
|
185 // ---------------------------------------------------------------------------- |
|
186 // |
|
187 void CVCXTestSmClient::DeleteServiceResp(TRespStatus /*aRespStatus*/) |
|
188 { |
|
189 |
|
190 } |
|
191 |
|
192 // ---------------------------------------------------------------------------- |
|
193 // CVCXTestSmClient::GetServicesResp |
|
194 // ---------------------------------------------------------------------------- |
|
195 // |
|
196 void CVCXTestSmClient::GetServicesResp(TRespStatus /*aRespStatus*/, CDesC8ArraySeg* /*aServicesArray*/) |
|
197 { |
|
198 |
|
199 } |
|
200 |
|
201 // ---------------------------------------------------------------------------- |
|
202 // CVCXTestSmClient::GetUsedIapResp |
|
203 // ---------------------------------------------------------------------------- |
|
204 // |
|
205 void CVCXTestSmClient::GetUsedIapResp(TUint32 /*aIapId*/, |
|
206 const TDesC& /*aIapName*/, |
|
207 CIptvNetworkSelection::TConnectionPermission /*aConnectionPermission*/, |
|
208 TBool /*aWlanWhenGPRS*/, |
|
209 CIptvNetworkSelection::TRespStatus /*aRespStatus*/ |
|
210 ) |
|
211 { |
|
212 |
|
213 } |
|
214 |
|
215 // ---------------------------------------------------------------------------- |
|
216 // CVCXTestSmClient::ServerShutdownResp |
|
217 // ---------------------------------------------------------------------------- |
|
218 // |
|
219 void CVCXTestSmClient::ServerShutdownResp(TRespStatus /*aRespStatus*/) |
|
220 { |
|
221 |
|
222 } |
|
223 |
|
224 // ---------------------------------------------------------------------------- |
|
225 // CVCXTestSmClient::HandleSmEvent |
|
226 // ---------------------------------------------------------------------------- |
|
227 // |
|
228 void CVCXTestSmClient::HandleSmEvent(CIptvSmEvent& /*aEvent*/) |
|
229 { |
|
230 |
|
231 } |
|