/[cvs]/api/include/tune.h
ViewVC logotype

Contents of /api/include/tune.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sun Jul 1 20:47:59 2001 UTC (23 years, 4 months ago) by bearsoft
Branch: lazy, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Error occurred while calculating annotation data.
First import

1 //------------------------------------------------------------------------------
2 // File: Tune.h
3 //
4 // Desc: Additional infrastructure to extend the tuner.idl. Works nicely
5 // from C++.
6 //
7 // Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved.
8 //------------------------------------------------------------------------------
9
10
11 #pragma once
12
13 #ifndef TUNE_H
14 #define TUNE_H
15
16 #include <tuner.h>
17
18 namespace BDATuningModel {
19
20 const long DEFAULT_MIN_CHANNEL = 2;
21 const long DEFAULT_MAX_CHANNEL = 999;
22 const long DEFAULT_MIN_FREQUENCY = 535; //bottom us am
23 const long DEFAULT_MAX_FREQUENCY = 108000; // top us fm
24 const long DEFAULT_ANALOG_TUNER_COUNTRY_CODE = 1; //usa
25 const TunerInputType DEFAULT_ANALOG_TUNER_INPUT_TYPE = TunerInputCable; //usa
26
27 typedef CComQIPtr<ITuningSpaceContainer> PQTuningSpaceContainer;
28 typedef CComQIPtr<ITuningSpace> PQTuningSpace;
29 typedef CComQIPtr<IAnalogRadioTuningSpace> PQAnalogRadioTuningSpace;
30 typedef CComQIPtr<IAnalogTVTuningSpace> PQAnalogTVTuningSpace;
31 typedef CComQIPtr<IATSCTuningSpace> PQATSCTuningSpace;
32 typedef CComQIPtr<ITuneRequest> PQTuneRequest;
33 typedef CComQIPtr<IChannelTuneRequest> PQChannelTuneRequest;
34 typedef CComQIPtr<IATSCChannelTuneRequest> PQATSCChannelTuneRequest;
35 typedef CComQIPtr<ILocator> PQLocator;
36 typedef CComQIPtr<IATSCLocator> PQATSCLocator;
37 typedef CComQIPtr<IDVBTuningSpace> PQDVBTuningSpace;
38 typedef CComQIPtr<IDVBTuneRequest> PQDVBTuneRequest;
39 typedef CComQIPtr<IDVBSLocator> PQDVBSLocator;
40 typedef CComQIPtr<IDVBTLocator> PQDVBTLocator;
41
42 // tuning space container
43 class TNTuningSpaceContainer : public PQTuningSpaceContainer {
44 TNTuningSpaceContainer() {}
45 TNTuningSpaceContainer(const PQTuningSpaceContainer &a) : PQTuningSpaceContainer(a) {}
46 TNTuningSpaceContainer(ITuningSpace *p) : PQTuningSpaceContainer(p) {}
47 TNTuningSpaceContainer(IUnknown *p) : PQTuningSpaceContainer(p) {}
48 TNTuningSpaceContainer(const TNTuningSpaceContainer &a) : PQTuningSpaceContainer(a) {}
49 TNTuningSpaceContainer& operator=(TNTuningSpaceContainer& rhs) {
50 PQTuningSpaceContainer::operator=(rhs);
51 return *this;
52 }
53
54 };
55
56 // tuning spaces
57 template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNTuningSpaceHelper : public TUNINGSPACETYPE {
58 public:
59 TNTuningSpaceHelper() {}
60 TNTuningSpaceHelper(const TUNINGSPACETYPE &a) : TUNINGSPACETYPE(a) {}
61 TNTuningSpaceHelper(ITuningSpace *p) : TUNINGSPACETYPE(p) {}
62 TNTuningSpaceHelper(IUnknown *p) : TUNINGSPACETYPE(p) {}
63 TNTuningSpaceHelper(const TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TUNINGSPACETYPE(a) {}
64 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
65 TUNINGSPACETYPE::operator=(rhs);
66 return *this;
67 }
68 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
69 TUNINGSPACETYPE::operator=(rhs);
70 return *this;
71 }
72 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown *rhs) {
73 TUNINGSPACETYPE::operator=(rhs);
74 return *this;
75 }
76 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(ITuningSpace *rhs) {
77 TUNINGSPACETYPE::operator=(rhs);
78 return *this;
79 }
80 bool operator==(TUNINGSPACETYPE& rhs) {
81 CComBSTR rhsname;
82 HRESULT hr = rhs->get_UniqueName(&rhsname);
83 if (FAILED(hr)) {
84 return false;
85 }
86 CComBSTR name;
87 hr = (*this)->get_UniqueName(&name);
88 if (FAILED(hr)) {
89 return false;
90 }
91 return name == rhsname;
92 }
93 PQTuneRequest CreateTuneRequest() {
94 PQTuneRequest p;
95 HRESULT hr = (*this)->CreateTuneRequest(&p);
96 if (FAILED(hr)) {
97 return PQTuneRequest();
98 }
99 return p;
100 }
101
102 PQLocator Locator() {
103 _ASSERT(*this);
104 PQLocator ts;
105 HRESULT hr = (*this)->get_DefaultLocator(&ts);
106 if (FAILED(hr)) {
107 return PQLocator();
108 }
109 return ts;
110 }
111
112 HRESULT Locator(PQLocator& l) {
113 _ASSERT(*this);
114 return (*this)->put_Locator(l);
115 }
116
117 void Clone() {
118 PQTuningSpace t;
119 HRESULT hr = (*this)->Clone(&t);
120 if (FAILED(hr) || !t) {
121 Release(); // clone failed, clear ourselves
122 return;
123 }
124 TUNINGSPACETYPE::operator=(t);
125 }
126
127 };
128
129 typedef TNTuningSpaceHelper<PQTuningSpace, PQTuneRequest> TNTuningSpace;
130
131 template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAnalogRadioTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
132 public:
133 TNAnalogRadioTuningSpaceHelper() {}
134 TNAnalogRadioTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
135 TNAnalogRadioTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
136 TNAnalogRadioTuningSpaceHelper(const TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
137 TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
138 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
139 return *this;
140 }
141 template<class TS, class TR> TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
142 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
143 return *this;
144 }
145 TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
146 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
147 return *this;
148 }
149 TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
150 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
151 return *this;
152 }
153 long MaxFrequency() {
154 _ASSERT(*this);
155 long freq;
156 HRESULT hr = (*this)->get_MaxFrequency(&freq);
157 if (FAILED(hr)) {
158 freq = DEFAULT_MAX_FREQUENCY;
159 }
160 return freq;
161 }
162 HRESULT MaxFrequency(long freq) {
163 _ASSERT(*this);
164 return (*this)->put_MaxFrequency(freq);
165 }
166 long MinFrequency() {
167 _ASSERT(*this);
168 long freq;
169 HRESULT hr = (*this)->get_MinFrequency(&freq);
170 if (FAILED(hr)) {
171 freq = DEFAULT_MIN_FREQUENCY;
172 }
173 return freq;
174 }
175 HRESULT MinFrequency(long freq) {
176 _ASSERT(*this);
177 return (*this)->put_MinFrequency(freq);
178 }
179 };
180 typedef TNAnalogRadioTuningSpaceHelper<PQAnalogRadioTuningSpace, PQChannelTuneRequest> TNAnalogRadioTuningSpace;
181
182 template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAnalogTVTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
183 public:
184 TNAnalogTVTuningSpaceHelper() {}
185 TNAnalogTVTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
186 TNAnalogTVTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
187 TNAnalogTVTuningSpaceHelper(const TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
188 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
189 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
190 return *this;
191 }
192 template<class TS, class TR> TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
193 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
194 return *this;
195 }
196 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
197 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
198 return *this;
199 }
200 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
201 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
202 return *this;
203 }
204 TunerInputType InputType() {
205 _ASSERT(*this);
206 TunerInputType ti;
207 HRESULT hr = (*this)->get_InputType(&ti);
208 if (FAILED(hr)) {
209 ti = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
210 }
211 return ti;
212 }
213 HRESULT InputType(TunerInputType ti) {
214 _ASSERT(*this);
215 return (*this)->put_InputType(&ti);
216 }
217 long CountryCode() {
218 _ASSERT(*this);
219 long cc;
220 HRESULT hr = (*this)->get_CountryCode(&cc);
221 if (FAILED(hr)) {
222 cc = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
223 }
224 return cc;
225 }
226 HRESULT CountryCode(long cc) {
227 _ASSERT(*this);
228 return (*this)->put_CountryCode(cc);
229 }
230 long MinChannel() {
231 _ASSERT(*this);
232 long chan;
233 HRESULT hr = (*this)->get_MinChannel(&chan);
234 if (FAILED(hr)) {
235 chan = DEFAULT_MIN_CHANNEL;
236 }
237 return chan;
238 }
239 HRESULT MinChannel(long chan) {
240 _ASSERT(*this);
241 return (*this)->put_MinChannel(chan);
242 }
243 long MaxChannel() {
244 _ASSERT(*this);
245 long chan;
246 HRESULT hr = (*this)->get_MaxChannel(&chan);
247 if (FAILED(hr)) {
248 chan = DEFAULT_MAX_CHANNEL;
249 }
250 return chan;
251 }
252 HRESULT MaxChannel(long chan) {
253 _ASSERT(*this);
254 return (*this)->put_MaxChannel(chan);
255 }
256 };
257 typedef TNAnalogTVTuningSpaceHelper<PQAnalogTVTuningSpace, PQChannelTuneRequest> TNAnalogTVTuningSpace;
258
259 template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNATSCTuningSpaceHelper : public TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
260 public:
261 TNATSCTuningSpaceHelper() {}
262 TNATSCTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
263 TNATSCTuningSpaceHelper(IUnknown *p) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
264 TNATSCTuningSpaceHelper(const TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
265
266 TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
267 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
268 return *this;
269 }
270 template<class TS, class TR> TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
271 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
272 return *this;
273 }
274 TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
275 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
276 return *this;
277 }
278 TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
279 TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
280 return *this;
281 }
282 long MinMinorChannel() {
283 _ASSERT(*this);
284 long chan;
285 HRESULT hr = (*this)->get_MinMinorChannel(&chan);
286 if (FAILED(hr)) {
287 chan = DEFAULT_MIN_CHANNEL;
288 }
289 return chan;
290 }
291 HRESULT MinMinorChannel(long chan) {
292 _ASSERT(*this);
293 return (*this)->put_MinMinorChannel(chan);
294 }
295
296 long MaxMinorChannel() {
297 _ASSERT(*this);
298 long chan;
299 HRESULT hr = (*this)->get_MaxMinorChannel(&chan);
300 if (FAILED(hr)) {
301 chan = DEFAULT_MAX_CHANNEL;
302 }
303 return chan;
304 }
305 HRESULT MaxMinorChannel(long chan) {
306 _ASSERT(*this);
307 return (*this)->put_MaxMinorChannel(chan);
308 }
309 long MinPhysicalChannel() {
310 _ASSERT(*this);
311 long chan;
312 HRESULT hr = (*this)->get_MinPhysicalChannel(&chan);
313 if (FAILED(hr)) {
314 chan = DEFAULT_MIN_CHANNEL;
315 }
316 return chan;
317 }
318 HRESULT MinPhysicalChannel(long chan) {
319 _ASSERT(*this);
320 return (*this)->put_MinPhysicalChannel(chan);
321 }
322
323 long MaxPhysicalChannel() {
324 _ASSERT(*this);
325 long chan;
326 HRESULT hr = (*this)->get_MaxPhysicalChannel(&chan);
327 if (FAILED(hr)) {
328 chan = DEFAULT_MAX_CHANNEL;
329 }
330 return chan;
331 }
332
333 HRESULT MaxPhysicalChannel(long chan) {
334 _ASSERT(*this);
335 return (*this)->put_MaxPhysicalChannel(chan);
336 }
337 };
338 typedef TNATSCTuningSpaceHelper<PQATSCTuningSpace, PQATSCChannelTuneRequest> TNATSCTuningSpace;
339
340 // dvb tuning space
341 template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNDVBTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
342 public:
343 TNDVBTuningSpaceHelper() {}
344 TNDVBTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
345 TNDVBTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
346 TNDVBTuningSpaceHelper(const TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
347 TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
348 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
349 return *this;
350 }
351 template<class TS, class TR> TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
352 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
353 return *this;
354 }
355 TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
356 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
357 return *this;
358 }
359 TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
360 TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
361 return *this;
362 }
363 DVBSystemType SystemType() const {
364 DVBSystemType st;
365 HRESULT hr = (*this)->get_SystemType(&st);
366 if (FAILED(hr)) {
367 return DVB_Cable;
368 }
369 return st;
370 }
371 HRESULT SystemType(DVBSystemType st) {
372 _ASSERT(*this);
373 return (*this)->put_SystemType(st);
374 }
375 };
376 typedef TNDVBTuningSpaceHelper<PQDVBTuningSpace, PQDVBTuneRequest> TNDVBTuningSpace;
377
378 // locators
379 template<class LOCATORTYPE> class TNLocatorHelper : public LOCATORTYPE {
380 public:
381 TNLocatorHelper() {}
382 TNLocatorHelper(const LOCATORTYPE &a) : LOCATORTYPE(a) {}
383 TNLocatorHelper(IUnknown *p) : LOCATORTYPE(p) {}
384 TNLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : LOCATORTYPE(a) {}
385 TNLocatorHelper(ILocator *p) : LOCATORTYPE(p) {}
386 TNLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
387 LOCATORTYPE::operator=(rhs);
388 return *this;
389 }
390 TNLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
391 LOCATORTYPE::operator=(rhs);
392 return *this;
393 }
394 TNLocatorHelper<LOCATORTYPE>& operator=(ILocator* rhs) {
395 LOCATORTYPE::operator=(rhs);
396 return *this;
397 }
398 TNLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
399 LOCATORTYPE::operator=(rhs);
400 return *this;
401 }
402
403 void Clone() {
404 PQLocator t;
405 HRESULT hr = (*this)->Clone(&t);
406 if (FAILED(hr) || !t) {
407 Release(); // clone failed, clear ourselves
408 return;
409 }
410 LOCATORTYPE::operator=(t);
411 }
412
413 long CarrierFrequency() {
414 _ASSERT(*this);
415 long f;
416 HRESULT hr = (*this)->get_CarrierFrequency(&f);
417 if (FAILED(hr)) {
418 return -1;
419 }
420 return f;
421 }
422 HRESULT CarrierFrequency(long f) {
423 _ASSERT(*this);
424 return (*this)->put_CarrierFrequency(f);
425 }
426
427 FECMethod InnerFEC() {
428 _ASSERT(*this);
429 FECMethod f;
430 HRESULT hr = (*this)->get_InnerFEC(&f);
431 if (FAILED(hr)) {
432 return BDA_FEC_METHOD_NOT_SET;
433 }
434 return f;
435 }
436 HRESULT InnerFEC(FECMethod f) {
437 _ASSERT(*this);
438 return (*this)->put_InnerFEC(f);
439 }
440 BinaryConvolutionCodeRate InnerFECRate() {
441 _ASSERT(*this);
442 BinaryConvolutionCodeRate f;
443 HRESULT hr = (*this)->get_InnerFECRate(&f);
444 if (FAILED(hr)) {
445 return BDA_BCC_RATE_NOT_SET;
446 }
447 return f;
448 }
449 HRESULT InnerFECRate(BinaryConvolutionCodeRate f) {
450 _ASSERT(*this);
451 return (*this)->put_InnerFECRate(f);
452 }
453 FECMethod OuterFEC() {
454 _ASSERT(*this);
455 FECMethod f;
456 HRESULT hr = (*this)->get_OuterFEC(&f);
457 if (FAILED(hr)) {
458 return BDA_FEC_METHOD_NOT_SET;
459 }
460 return f;
461 }
462 HRESULT OuterFEC(FECMethod f) {
463 _ASSERT(*this);
464 return (*this)->put_OuterFEC(f);
465 }
466 BinaryConvolutionCodeRate OuterFECRate() {
467 _ASSERT(*this);
468 BinaryConvolutionCodeRate f;
469 HRESULT hr = (*this)->get_OuterFECRate(&f);
470 if (FAILED(hr)) {
471 return BDA_BCC_RATE_NOT_SET;
472 }
473 return f;
474 }
475 HRESULT OuterFECRate(BinaryConvolutionCodeRate f) {
476 _ASSERT(*this);
477 return (*this)->put_OuterFECRate(f);
478 }
479 ModulationType Modulation() {
480 _ASSERT(*this);
481 ModulationType f;
482 HRESULT hr = (*this)->get_Modulation(&f);
483 if (FAILED(hr)) {
484 return BDA_MOD_NOT_SET;
485 }
486 return f;
487 }
488 HRESULT Modulation(ModulationType f) {
489 _ASSERT(*this);
490 return (*this)->put_Modulation(f);
491 }
492
493 long SymbolRate() {
494 _ASSERT(*this);
495 long f;
496 HRESULT hr = (*this)->get_SymbolRate(&f);
497 if (FAILED(hr)) {
498 return -1;
499 }
500 return f;
501 }
502 HRESULT SymbolRate(long f) {
503 _ASSERT(*this);
504 return (*this)->put_SymbolRate(f);
505 }
506
507 };
508 typedef TNLocatorHelper<PQLocator> TNLocator;
509
510 template<class LOCATORTYPE> class TNATSCLocatorHelper : public TNLocatorHelper<LOCATORTYPE> {
511 public:
512 TNATSCLocatorHelper() {}
513 TNATSCLocatorHelper(const LOCATORTYPE &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
514 TNATSCLocatorHelper(IUnknown *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
515 TNATSCLocatorHelper(const TNATSCLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
516 TNATSCLocatorHelper(IATSCLocator *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
517 TNATSCLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
518 TNATSCLocatorHelper<LOCATORTYPE>& operator=(TNATSCLocatorHelper<LOCATORTYPE>& rhs) {
519 TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
520 return *this;
521 }
522 TNATSCLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
523 TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
524 return *this;
525 }
526 TNATSCLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
527 TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
528 return *this;
529 }
530 TNATSCLocatorHelper<LOCATORTYPE>& operator=(IATSCLocator* rhs) {
531 TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
532 return *this;
533 }
534 TNATSCLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
535 TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
536 return *this;
537 }
538
539 long PhysicalChannel() {
540 _ASSERT(*this);
541 long pc;
542 HRESULT hr = (*this)->get_PhysicalChannel(&pc);
543 if (FAILED(hr)) {
544 return -1;
545 }
546 return pc;
547 }
548 HRESULT PhysicalChannel(long pc) {
549 _ASSERT(*this);
550 return (*this)->put_PhysicalChannel(pc);
551 }
552
553 long TSID() {
554 _ASSERT(*this);
555 long pc;
556 HRESULT hr = (*this)->get_TSID(&pc);
557 if (FAILED(hr)) {
558 return -1;
559 }
560 return pc;
561 }
562 HRESULT TSID(long pc) {
563 _ASSERT(*this);
564 return (*this)->put_TSID(pc);
565 }
566
567 long ProgramNumber() {
568 _ASSERT(*this);
569 long pc;
570 HRESULT hr = (*this)->get_ProgramNumber(&pc);
571 if (FAILED(hr)) {
572 return -1;
573 }
574 return pc;
575 }
576 HRESULT ProgramNumber(long pc) {
577 _ASSERT(*this);
578 return (*this)->put_ProgramNumber(pc);
579 }
580 };
581 typedef TNATSCLocatorHelper<PQATSCLocator> TNATSCLocator;
582
583 // tune requests
584 template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNTuneRequestHelper : public TUNEREQUESTTYPE {
585 public:
586 TNTuneRequestHelper() {}
587 TNTuneRequestHelper(const TUNEREQUESTTYPE &a) : TUNEREQUESTTYPE(a) {}
588 TNTuneRequestHelper(IUnknown *p) : TUNEREQUESTTYPE(p) {}
589 TNTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TUNEREQUESTTYPE(a) {}
590 TNTuneRequestHelper(ITuneRequest *p) : TUNEREQUESTTYPE(p) {}
591 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
592 TUNEREQUESTTYPE::operator=(rhs);
593 return *this;
594 }
595 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
596 TUNEREQUESTTYPE::operator=(rhs);
597 return *this;
598 }
599 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(ITuneRequest* rhs) {
600 TUNEREQUESTTYPE::operator=(rhs);
601 return *this;
602 }
603 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
604 TUNEREQUESTTYPE::operator=(rhs);
605 return *this;
606 }
607 // this function creates a new instance of the base ITuneRequest* and copies
608 // all the values of the current ITuneRequest and sets this to the new one
609 // this provides the value semantics needed by the network providers
610 void Clone() {
611 PQTuneRequest t;
612 HRESULT hr = (*this)->Clone(&t);
613 if (FAILED(hr) || !t) {
614 Release(); // clone failed, clear ourselves
615 return;
616 }
617 TUNEREQUESTTYPE::operator=(t);
618 }
619
620 PQTuningSpace TuningSpace() {
621 _ASSERT(*this);
622 PQTuningSpace ts;
623 HRESULT hr = (*this)->get_TuningSpace(&ts);
624 if (FAILED(hr)) {
625 return PQTuningSpace();
626 }
627 return ts;
628 }
629
630 LOCATORTYPE Locator() {
631 _ASSERT(*this);
632 PQLocator pc;
633 HRESULT hr = (*this)->get_Locator(&pc);
634 if (FAILED(hr)) {
635 return PQLocator();
636 }
637 return pc;
638 }
639 HRESULT Locator(LOCATORTYPE& pc) {
640 _ASSERT(*this);
641 return (*this)->put_Locator(pc);
642 }
643 };
644
645 typedef TNTuneRequestHelper<PQTuneRequest, PQLocator> TNTuneRequest;
646
647 template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNChannelTuneRequestHelper : public TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
648 public:
649 TNChannelTuneRequestHelper() {}
650 TNChannelTuneRequestHelper(const TNTuneRequest &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
651 TNChannelTuneRequestHelper(IChannelTuneRequest *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
652 TNChannelTuneRequestHelper(IUnknown *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
653 TNChannelTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
654 TNChannelTuneRequestHelper(const TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
655 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
656 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
657 return *this;
658 }
659 template<class TR, class LOC> TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
660 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TUNEREQUESTTYPE(rhs));
661 return *this;
662 }
663 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
664 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
665 return *this;
666 }
667 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IChannelTuneRequest* rhs) {
668 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
669 return *this;
670 }
671 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
672 TUNEREQUESTTYPE::operator=(rhs);
673 return *this;
674 }
675 long Channel() {
676 _ASSERT(*this);
677 long c;
678 HRESULT hr = (*this)->get_Channel(&c);
679 if (FAILED(hr)) {
680 return -1;
681 }
682 return c;
683 }
684 HRESULT Channel(long c) {
685 _ASSERT(*this);
686 return (*this)->put_Channel(c);
687 }
688 };
689
690 typedef TNChannelTuneRequestHelper<PQChannelTuneRequest, PQLocator> TNChannelTuneRequest;
691
692 template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNATSCChannelTuneRequestHelper : public TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
693 public:
694 TNATSCChannelTuneRequestHelper() {}
695 TNATSCChannelTuneRequestHelper(const TNTuneRequest &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
696 TNATSCChannelTuneRequestHelper(IATSCChannelTuneRequest *p) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
697 TNATSCChannelTuneRequestHelper(IUnknown *p) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
698 TNATSCChannelTuneRequestHelper(const TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
699 TNATSCChannelTuneRequestHelper(const TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
700 TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
701 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
702 return *this;
703 }
704 template<class TR, class LOC>TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
705 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TR(rhs));
706 return *this;
707 }
708 TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
709 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
710 return *this;
711 }
712 TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IATSCChannelTuneRequest *rhs) {
713 TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
714 return *this;
715 }
716 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
717 TUNEREQUESTTYPE::operator=(rhs);
718 return *this;
719 }
720 long MinorChannel() {
721 _ASSERT(*this);
722 long mc;
723 HRESULT hr = (*this)->get_MinorChannel(&mc);
724 if (FAILED(hr)) {
725 return -1;
726 }
727 return mc;
728 }
729 HRESULT MinorChannel(long mc) {
730 _ASSERT(*this);
731 return (*this)->put_MinorChannel(mc);
732 }
733 };
734 typedef TNATSCChannelTuneRequestHelper<PQATSCChannelTuneRequest, PQATSCLocator> TNATSCChannelTuneRequest;
735
736 template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNDVBTuneRequestHelper : public TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
737 public:
738 TNDVBTuneRequestHelper() {}
739 TNDVBTuneRequestHelper(const TNTuneRequest &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
740 TNDVBTuneRequestHelper(IDVBTuneRequest *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
741 TNDVBTuneRequestHelper(IUnknown *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
742 TNDVBTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
743 TNDVBTuneRequestHelper(const TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
744 TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
745 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
746 return *this;
747 }
748 template<class TR, class LOC> TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
749 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TUNEREQUESTTYPE(rhs));
750 return *this;
751 }
752 TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
753 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
754 return *this;
755 }
756 TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IDVBTuneRequest* rhs) {
757 TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
758 return *this;
759 }
760 TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
761 TUNEREQUESTTYPE::operator=(rhs);
762 return *this;
763 }
764 long ONID() {
765 _ASSERT(*this);
766 long c;
767 HRESULT hr = (*this)->get_ONID(&c);
768 if (FAILED(hr)) {
769 return -1;
770 }
771 return c;
772 }
773 HRESULT ONID(long c) {
774 _ASSERT(*this);
775 return (*this)->put_ONID(c);
776 }
777 long TSID() {
778 _ASSERT(*this);
779 long c;
780 HRESULT hr = (*this)->get_TSID(&c);
781 if (FAILED(hr)) {
782 return -1;
783 }
784 return c;
785 }
786 HRESULT TSID(long c) {
787 _ASSERT(*this);
788 return (*this)->put_TSID(c);
789 }
790 long SID() {
791 _ASSERT(*this);
792 long c;
793 HRESULT hr = (*this)->get_SID(&c);
794 if (FAILED(hr)) {
795 return -1;
796 }
797 return c;
798 }
799 HRESULT SID(long c) {
800 _ASSERT(*this);
801 return (*this)->put_SID(c);
802 }
803 };
804 typedef TNDVBTuneRequestHelper<PQDVBTuneRequest, PQLocator> TNDVBTuneRequest;
805 }; // namespace
806
807 #ifndef NO_DEFAULT_BDATUNINGMODEL_NAMESPACE
808 using namespace BDATuningModel;
809 #endif
810
811 #endif
812 // end of file - tune.h

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26