sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Example implementation of RDvbhReceiver
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
@internalComponent
|
sl@0
|
21 |
@prototype
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#include "dvbhreceiver.h"
|
sl@0
|
25 |
#include "dvbhreceiverbody.h"
|
sl@0
|
26 |
#include <in_sock.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
EXPORT_C RDvbhReceiver::RDvbhReceiver()
|
sl@0
|
30 |
: iBody(NULL) //Not a C-class so no free initialisation
|
sl@0
|
31 |
{
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
EXPORT_C TInt RDvbhReceiver::GetSupportedReceiverTypes( RArray<TDvbhReceiverType>& aReceiverTypes )
|
sl@0
|
35 |
{
|
sl@0
|
36 |
//RBody::GetSupportedReceiverTypes is static.
|
sl@0
|
37 |
return RBody::GetSupportedReceiverTypes(aReceiverTypes);
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
EXPORT_C TInt RDvbhReceiver::GetDriverVersion( TVersion& aVersion )
|
sl@0
|
41 |
{
|
sl@0
|
42 |
//RBody::GetDriverVersion is static.
|
sl@0
|
43 |
return RBody::GetDriverVersion(aVersion);
|
sl@0
|
44 |
}
|
sl@0
|
45 |
|
sl@0
|
46 |
EXPORT_C TInt RDvbhReceiver::Open( const TDvbhReceiverType aReceiverType )
|
sl@0
|
47 |
{
|
sl@0
|
48 |
//Delegate to OpenL
|
sl@0
|
49 |
TRAPD(err, OpenL( aReceiverType ));
|
sl@0
|
50 |
return err;
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
EXPORT_C void RDvbhReceiver::Close()
|
sl@0
|
54 |
{
|
sl@0
|
55 |
if (iBody != NULL)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
iBody->Close();
|
sl@0
|
58 |
delete iBody;
|
sl@0
|
59 |
iBody = NULL;
|
sl@0
|
60 |
}
|
sl@0
|
61 |
else
|
sl@0
|
62 |
{
|
sl@0
|
63 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
64 |
}
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
EXPORT_C TInt RDvbhReceiver::PowerOn( TRequestStatus& aStatus )
|
sl@0
|
68 |
{
|
sl@0
|
69 |
if (iBody != NULL)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
return iBody->PowerOn(aStatus);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
else
|
sl@0
|
74 |
{
|
sl@0
|
75 |
return KErrNotReady;
|
sl@0
|
76 |
}
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
EXPORT_C void RDvbhReceiver::CancelPowerOn()
|
sl@0
|
80 |
{
|
sl@0
|
81 |
if (iBody != NULL)
|
sl@0
|
82 |
{
|
sl@0
|
83 |
return iBody->CancelPowerOn();
|
sl@0
|
84 |
}
|
sl@0
|
85 |
else
|
sl@0
|
86 |
{
|
sl@0
|
87 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
88 |
}
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
EXPORT_C void RDvbhReceiver::PowerOff( TRequestStatus& aStatus )
|
sl@0
|
92 |
{
|
sl@0
|
93 |
if (iBody != NULL)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
iBody->PowerOff(aStatus);
|
sl@0
|
96 |
}
|
sl@0
|
97 |
else
|
sl@0
|
98 |
{
|
sl@0
|
99 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
100 |
}
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
EXPORT_C void RDvbhReceiver::CancelPowerOff()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
if (iBody != NULL)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
iBody->CancelPowerOff();
|
sl@0
|
108 |
}
|
sl@0
|
109 |
else
|
sl@0
|
110 |
{
|
sl@0
|
111 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
112 |
}
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
EXPORT_C void RDvbhReceiver::SetDisabled( TBool aDisable, TRequestStatus& aStatus )
|
sl@0
|
116 |
{
|
sl@0
|
117 |
if (iBody != NULL)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
iBody->SetDisabled(aDisable, aStatus);
|
sl@0
|
120 |
}
|
sl@0
|
121 |
else
|
sl@0
|
122 |
{
|
sl@0
|
123 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
124 |
}
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
EXPORT_C void RDvbhReceiver::CancelSetDisabled()
|
sl@0
|
128 |
{
|
sl@0
|
129 |
if (iBody != NULL)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
iBody->CancelSetDisabled();
|
sl@0
|
132 |
}
|
sl@0
|
133 |
else
|
sl@0
|
134 |
{
|
sl@0
|
135 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
136 |
}
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
EXPORT_C TInt RDvbhReceiver::SetScanConfiguration( const TDvbhScanConfiguration& aScanConfiguration )
|
sl@0
|
140 |
{
|
sl@0
|
141 |
if (iBody != NULL)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
return iBody->SetScanConfiguration(aScanConfiguration);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
else
|
sl@0
|
146 |
{
|
sl@0
|
147 |
return KErrNotReady;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
EXPORT_C TInt RDvbhReceiver::GetScanConfiguration( TDvbhScanConfiguration& aScanConfiguration )
|
sl@0
|
152 |
{
|
sl@0
|
153 |
if (iBody != NULL)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
return iBody->GetScanConfiguration(aScanConfiguration);
|
sl@0
|
156 |
}
|
sl@0
|
157 |
else
|
sl@0
|
158 |
{
|
sl@0
|
159 |
return KErrNotReady;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
EXPORT_C TInt RDvbhReceiver::GetDvbhVersion( TVersion& aVersion )
|
sl@0
|
164 |
{
|
sl@0
|
165 |
if (iBody != NULL)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
return iBody->GetDvbhVersion(aVersion);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
else
|
sl@0
|
170 |
{
|
sl@0
|
171 |
return KErrNotReady;
|
sl@0
|
172 |
}
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|
sl@0
|
175 |
EXPORT_C TInt RDvbhReceiver::GetHardwareInfo( TDvbhHardwareInfo& aHardwareInfo )
|
sl@0
|
176 |
{
|
sl@0
|
177 |
if (iBody != NULL)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
return iBody->GetHardwareInfo(aHardwareInfo);
|
sl@0
|
180 |
}
|
sl@0
|
181 |
else
|
sl@0
|
182 |
{
|
sl@0
|
183 |
return KErrNotReady;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
EXPORT_C TInt RDvbhReceiver::Scan( MDvbhScanObserver& aObserver, TRequestStatus& aStatus )
|
sl@0
|
188 |
{
|
sl@0
|
189 |
if (iBody != NULL)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
return iBody->Scan(aObserver, aStatus);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
else
|
sl@0
|
194 |
{
|
sl@0
|
195 |
return KErrNotReady;
|
sl@0
|
196 |
}
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
EXPORT_C void RDvbhReceiver::CancelScan()
|
sl@0
|
200 |
{
|
sl@0
|
201 |
if (iBody != NULL)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
iBody->CancelScan();
|
sl@0
|
204 |
}
|
sl@0
|
205 |
else
|
sl@0
|
206 |
{
|
sl@0
|
207 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
208 |
}
|
sl@0
|
209 |
}
|
sl@0
|
210 |
|
sl@0
|
211 |
EXPORT_C TInt RDvbhReceiver::SetPlatform( const TDvbhNetwork& aNetwork, const TDvbhPlatform& aPlatform, TRequestStatus& aStatus )
|
sl@0
|
212 |
{
|
sl@0
|
213 |
if (iBody != NULL)
|
sl@0
|
214 |
{
|
sl@0
|
215 |
return iBody->SetPlatform(aNetwork, aPlatform, aStatus);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
else
|
sl@0
|
218 |
{
|
sl@0
|
219 |
return KErrNotReady;
|
sl@0
|
220 |
}
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
EXPORT_C void RDvbhReceiver::CancelSetPlatform()
|
sl@0
|
224 |
{
|
sl@0
|
225 |
if (iBody != NULL)
|
sl@0
|
226 |
{
|
sl@0
|
227 |
iBody->CancelSetPlatform();
|
sl@0
|
228 |
}
|
sl@0
|
229 |
else
|
sl@0
|
230 |
{
|
sl@0
|
231 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
232 |
}
|
sl@0
|
233 |
}
|
sl@0
|
234 |
|
sl@0
|
235 |
EXPORT_C TInt RDvbhReceiver::CreateFilter( const TIp6Addr& aDestAddress, TInt& aFilterId, TRequestStatus& aStatus )
|
sl@0
|
236 |
{
|
sl@0
|
237 |
if (iBody != NULL)
|
sl@0
|
238 |
{
|
sl@0
|
239 |
return iBody->CreateFilter(aDestAddress, aFilterId, aStatus);
|
sl@0
|
240 |
}
|
sl@0
|
241 |
else
|
sl@0
|
242 |
{
|
sl@0
|
243 |
return KErrNotReady;
|
sl@0
|
244 |
}
|
sl@0
|
245 |
}
|
sl@0
|
246 |
|
sl@0
|
247 |
EXPORT_C TInt RDvbhReceiver::CancelFilter( TInt aFilterId )
|
sl@0
|
248 |
{
|
sl@0
|
249 |
if (iBody != NULL)
|
sl@0
|
250 |
{
|
sl@0
|
251 |
return iBody->CancelFilter(aFilterId);
|
sl@0
|
252 |
}
|
sl@0
|
253 |
else
|
sl@0
|
254 |
{
|
sl@0
|
255 |
return KErrNotReady;
|
sl@0
|
256 |
}
|
sl@0
|
257 |
}
|
sl@0
|
258 |
|
sl@0
|
259 |
EXPORT_C TInt RDvbhReceiver::ReceiveIPData( MDvbhDataObserver& aObserver )
|
sl@0
|
260 |
{
|
sl@0
|
261 |
if (iBody != NULL)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
return iBody->ReceiveIPData(aObserver);
|
sl@0
|
264 |
}
|
sl@0
|
265 |
else
|
sl@0
|
266 |
{
|
sl@0
|
267 |
return KErrNotReady;
|
sl@0
|
268 |
}
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
EXPORT_C void RDvbhReceiver::CancelReceiveIPData()
|
sl@0
|
272 |
{
|
sl@0
|
273 |
if (iBody != NULL)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
iBody->CancelReceiveIPData();
|
sl@0
|
276 |
}
|
sl@0
|
277 |
else
|
sl@0
|
278 |
{
|
sl@0
|
279 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
280 |
}
|
sl@0
|
281 |
}
|
sl@0
|
282 |
|
sl@0
|
283 |
EXPORT_C TInt RDvbhReceiver::UpdateNetworkTime( TRequestStatus& aStatus )
|
sl@0
|
284 |
{
|
sl@0
|
285 |
if (iBody != NULL)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
return iBody->UpdateNetworkTime(aStatus);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
else
|
sl@0
|
290 |
{
|
sl@0
|
291 |
return KErrNotReady;
|
sl@0
|
292 |
}
|
sl@0
|
293 |
}
|
sl@0
|
294 |
|
sl@0
|
295 |
EXPORT_C void RDvbhReceiver::CancelUpdateNetworkTime()
|
sl@0
|
296 |
{
|
sl@0
|
297 |
if (iBody != NULL)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
iBody->CancelUpdateNetworkTime();
|
sl@0
|
300 |
}
|
sl@0
|
301 |
else
|
sl@0
|
302 |
{
|
sl@0
|
303 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
304 |
}
|
sl@0
|
305 |
}
|
sl@0
|
306 |
|
sl@0
|
307 |
EXPORT_C TInt RDvbhReceiver::CustomCommand(
|
sl@0
|
308 |
TInt aCommand,
|
sl@0
|
309 |
const TDesC8& aInputData,
|
sl@0
|
310 |
TDes8& aOutputBuffer,
|
sl@0
|
311 |
TRequestStatus& aStatus )
|
sl@0
|
312 |
{
|
sl@0
|
313 |
if (iBody != NULL)
|
sl@0
|
314 |
{
|
sl@0
|
315 |
return iBody->CustomCommand(aCommand, aInputData, aOutputBuffer, aStatus);
|
sl@0
|
316 |
}
|
sl@0
|
317 |
else
|
sl@0
|
318 |
{
|
sl@0
|
319 |
return KErrNotReady;
|
sl@0
|
320 |
}
|
sl@0
|
321 |
}
|
sl@0
|
322 |
|
sl@0
|
323 |
EXPORT_C void RDvbhReceiver::CancelCustomCommand( TRequestStatus& aStatus )
|
sl@0
|
324 |
{
|
sl@0
|
325 |
if (iBody != NULL)
|
sl@0
|
326 |
{
|
sl@0
|
327 |
iBody->CancelCustomCommand(aStatus);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
else
|
sl@0
|
330 |
{
|
sl@0
|
331 |
ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation.
|
sl@0
|
332 |
}
|
sl@0
|
333 |
}
|
sl@0
|
334 |
|
sl@0
|
335 |
EXPORT_C TInt RDvbhReceiver::CustomCommand( TInt aCommand, const TDesC8& aInputData )
|
sl@0
|
336 |
{
|
sl@0
|
337 |
if (iBody != NULL)
|
sl@0
|
338 |
{
|
sl@0
|
339 |
return iBody->CustomCommand(aCommand, aInputData);
|
sl@0
|
340 |
}
|
sl@0
|
341 |
else
|
sl@0
|
342 |
{
|
sl@0
|
343 |
return KErrNotReady;
|
sl@0
|
344 |
}
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
void RDvbhReceiver::OpenL( const TDvbhReceiverType aReceiverType )
|
sl@0
|
348 |
{
|
sl@0
|
349 |
if (iBody == NULL)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
iBody = new (ELeave) RBody;
|
sl@0
|
352 |
}
|
sl@0
|
353 |
User::LeaveIfError(iBody->Open( aReceiverType ));
|
sl@0
|
354 |
}
|
sl@0
|
355 |
|