ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

digitaldemo.cpp
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         ReactOS BDA Proxy
00004  * FILE:            dll/directx/bdaplgin/digitaldemo.cpp
00005  * PURPOSE:         IBDA_DigitalDemodulator interface
00006  *
00007  * PROGRAMMERS:     Johannes Anderwald (janderwald@reactos.org)
00008  */
00009 
00010 #include "precomp.h"
00011 
00012 #ifndef _MSC_VER
00013 const GUID IID_IBDA_DigitalDemodulator = {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x04, 0xe1, 0xe0}};
00014 const GUID KSPROPSETID_BdaDigitalDemodulator = {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x4, 0xe1, 0xe0}};
00015 #endif
00016 
00017 class CBDADigitalDemodulator : public IBDA_DigitalDemodulator
00018 {
00019 public:
00020     STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
00021 
00022     STDMETHODIMP_(ULONG) AddRef()
00023     {
00024         InterlockedIncrement(&m_Ref);
00025         return m_Ref;
00026     }
00027     STDMETHODIMP_(ULONG) Release()
00028     {
00029         InterlockedDecrement(&m_Ref);
00030         if (!m_Ref)
00031         {
00032             delete this;
00033             return 0;
00034         }
00035         return m_Ref;
00036     }
00037     //IBDA_DigitalDemodulator methods
00038     HRESULT STDMETHODCALLTYPE put_ModulationType(ModulationType *pModulationType);
00039     HRESULT STDMETHODCALLTYPE get_ModulationType(ModulationType *pModulationType);
00040     HRESULT STDMETHODCALLTYPE put_InnerFECMethod(FECMethod *pFECMethod);
00041     HRESULT STDMETHODCALLTYPE get_InnerFECMethod(FECMethod *pFECMethod);
00042     HRESULT STDMETHODCALLTYPE put_InnerFECRate(BinaryConvolutionCodeRate *pFECRate);
00043     HRESULT STDMETHODCALLTYPE get_InnerFECRate(BinaryConvolutionCodeRate *pFECRate);
00044     HRESULT STDMETHODCALLTYPE put_OuterFECMethod(FECMethod *pFECMethod);
00045     HRESULT STDMETHODCALLTYPE get_OuterFECMethod(FECMethod *pFECMethod);
00046     HRESULT STDMETHODCALLTYPE put_OuterFECRate(BinaryConvolutionCodeRate *pFECRate);
00047     HRESULT STDMETHODCALLTYPE get_OuterFECRate(BinaryConvolutionCodeRate *pFECRate);
00048     HRESULT STDMETHODCALLTYPE put_SymbolRate(ULONG *pSymbolRate);
00049     HRESULT STDMETHODCALLTYPE get_SymbolRate(ULONG *pSymbolRate);
00050     HRESULT STDMETHODCALLTYPE put_SpectralInversion(SpectralInversion *pSpectralInversion);
00051     HRESULT STDMETHODCALLTYPE get_SpectralInversion(SpectralInversion *pSpectralInversion);
00052 
00053     CBDADigitalDemodulator(IKsPropertySet * pProperty, ULONG NodeId) : m_Ref(0), m_pProperty(pProperty), m_NodeId(NodeId){};
00054     ~CBDADigitalDemodulator(){};
00055 
00056 protected:
00057     LONG m_Ref;
00058     IKsPropertySet * m_pProperty;
00059     ULONG m_NodeId;
00060 };
00061 
00062 HRESULT
00063 STDMETHODCALLTYPE
00064 CBDADigitalDemodulator::QueryInterface(
00065     IN  REFIID refiid,
00066     OUT PVOID* Output)
00067 {
00068     *Output = NULL;
00069 
00070     if (IsEqualGUID(refiid, IID_IUnknown))
00071     {
00072         *Output = PVOID(this);
00073         reinterpret_cast<IUnknown*>(*Output)->AddRef();
00074         return NOERROR;
00075     }
00076 
00077     if (IsEqualGUID(refiid, IID_IBDA_DigitalDemodulator))
00078     {
00079         *Output = (IBDA_DigitalDemodulator*)(this);
00080         reinterpret_cast<IBDA_DigitalDemodulator*>(*Output)->AddRef();
00081         return NOERROR;
00082     }
00083 
00084 #ifdef BDAPLGIN_TRACE
00085     WCHAR Buffer[MAX_PATH];
00086     LPOLESTR lpstr;
00087     StringFromCLSID(refiid, &lpstr);
00088     swprintf(Buffer, L"CBDADigitalDemodulator::QueryInterface: NoInterface for %s", lpstr);
00089     OutputDebugStringW(Buffer);
00090     CoTaskMemFree(lpstr);
00091 DebugBreak();
00092 #endif
00093 
00094     return E_NOINTERFACE;
00095 }
00096 
00097 HRESULT
00098 STDMETHODCALLTYPE
00099 CBDADigitalDemodulator::put_ModulationType(ModulationType *pModulationType)
00100 {
00101     KSP_NODE Node;
00102     HRESULT hr;
00103 
00104     // setup request
00105     Node.NodeId = m_NodeId;
00106     Node.Reserved = 0;
00107 
00108     // perform request
00109     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_MODULATION_TYPE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pModulationType, sizeof(ModulationType));
00110 
00111 
00112 #ifdef BDAPLGIN_TRACE
00113     WCHAR Buffer[100];
00114     swprintf(Buffer, L"CBDADigitalDemodulator::put_ModulationType: pModulationType %lu hr %lx\n", *pModulationType, hr);
00115     OutputDebugStringW(Buffer);
00116 #endif
00117 
00118     return hr;
00119 }
00120 
00121 HRESULT
00122 STDMETHODCALLTYPE
00123 CBDADigitalDemodulator::get_ModulationType(ModulationType *pModulationType)
00124 {
00125     return E_NOINTERFACE;
00126 }
00127 
00128 HRESULT
00129 STDMETHODCALLTYPE
00130 CBDADigitalDemodulator::put_InnerFECMethod(FECMethod *pFECMethod)
00131 {
00132     KSP_NODE Node;
00133     HRESULT hr;
00134 
00135     // setup request
00136     Node.NodeId = m_NodeId;
00137     Node.Reserved = 0;
00138 
00139     // perform request
00140     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_INNER_FEC_TYPE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECMethod, sizeof(FECMethod));
00141 
00142 
00143 #ifdef BDAPLGIN_TRACE
00144     WCHAR Buffer[100];
00145     swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECMethod: pFECMethod %lu hr %lx\n", *pFECMethod, hr);
00146     OutputDebugStringW(Buffer);
00147 #endif
00148 
00149     return hr;
00150 }
00151 
00152 HRESULT
00153 STDMETHODCALLTYPE
00154 CBDADigitalDemodulator::get_InnerFECMethod(FECMethod *pFECMethod)
00155 {
00156     return E_NOINTERFACE;
00157 }
00158 
00159 HRESULT
00160 STDMETHODCALLTYPE
00161 CBDADigitalDemodulator::put_InnerFECRate(BinaryConvolutionCodeRate *pFECRate)
00162 {
00163     KSP_NODE Node;
00164     HRESULT hr;
00165 
00166     // setup request
00167     Node.NodeId = m_NodeId;
00168     Node.Reserved = 0;
00169 
00170     // perform request
00171     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_INNER_FEC_RATE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECRate, sizeof(BinaryConvolutionCodeRate));
00172 
00173 #ifdef BDAPLGIN_TRACE
00174     WCHAR Buffer[100];
00175     swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECRate: pFECRate %lu hr %lx\n", *pFECRate, hr);
00176     OutputDebugStringW(Buffer);
00177 #endif
00178 
00179     return hr;
00180 }
00181 
00182 HRESULT
00183 STDMETHODCALLTYPE
00184 CBDADigitalDemodulator::get_InnerFECRate(BinaryConvolutionCodeRate *pFECRate)
00185 {
00186     return E_NOINTERFACE;
00187 }
00188 
00189 HRESULT
00190 STDMETHODCALLTYPE
00191 CBDADigitalDemodulator::put_OuterFECMethod(FECMethod *pFECMethod)
00192 {
00193     KSP_NODE Node;
00194     HRESULT hr;
00195 
00196     // setup request
00197     Node.NodeId = m_NodeId;
00198     Node.Reserved = 0;
00199 
00200     // perform request
00201     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_OUTER_FEC_TYPE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECMethod, sizeof(FECMethod));
00202 
00203 #ifdef BDAPLGIN_TRACE
00204     WCHAR Buffer[100];
00205     swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECMethod: pFECMethod %lu hr %lx\n", *pFECMethod, hr);
00206     OutputDebugStringW(Buffer);
00207 #endif
00208 
00209     return hr;
00210 }
00211 
00212 
00213 HRESULT
00214 STDMETHODCALLTYPE CBDADigitalDemodulator::get_OuterFECMethod(FECMethod *pFECMethod)
00215 {
00216     return E_NOINTERFACE;
00217 }
00218 
00219 HRESULT
00220 STDMETHODCALLTYPE
00221 CBDADigitalDemodulator::put_OuterFECRate(BinaryConvolutionCodeRate *pFECRate)
00222 {
00223     KSP_NODE Node;
00224     HRESULT hr;
00225 
00226     // setup request
00227     Node.NodeId = m_NodeId;
00228     Node.Reserved = 0;
00229 
00230     // perform request
00231     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_OUTER_FEC_RATE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECRate, sizeof(BinaryConvolutionCodeRate));
00232 
00233 #ifdef BDAPLGIN_TRACE
00234     WCHAR Buffer[100];
00235     swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECRate: pFECRate %lu hr %lx\n", *pFECRate, hr);
00236     OutputDebugStringW(Buffer);
00237 #endif
00238 
00239     return hr;
00240 }
00241 
00242 HRESULT
00243 STDMETHODCALLTYPE
00244 CBDADigitalDemodulator::get_OuterFECRate(BinaryConvolutionCodeRate *pFECRate)
00245 {
00246     return E_NOINTERFACE;
00247 }
00248 
00249 HRESULT
00250 STDMETHODCALLTYPE
00251 CBDADigitalDemodulator::put_SymbolRate(ULONG *pSymbolRate)
00252 {
00253     KSP_NODE Node;
00254     HRESULT hr;
00255 
00256     // setup request
00257     Node.NodeId = m_NodeId;
00258     Node.Reserved = 0;
00259 
00260     // perform request
00261     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_SYMBOL_RATE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pSymbolRate, sizeof(ULONG));
00262 
00263 #ifdef BDAPLGIN_TRACE
00264     WCHAR Buffer[100];
00265     swprintf(Buffer, L"CBDADigitalDemodulator::put_SymbolRate: pSymbolRate %lu hr %lx\n", *pSymbolRate, hr);
00266     OutputDebugStringW(Buffer);
00267 #endif
00268 
00269     return hr;
00270 }
00271 
00272 HRESULT
00273 STDMETHODCALLTYPE
00274 CBDADigitalDemodulator::get_SymbolRate(ULONG *pSymbolRate)
00275 {
00276     return E_NOINTERFACE;
00277 }
00278 
00279 HRESULT
00280 STDMETHODCALLTYPE
00281 CBDADigitalDemodulator::put_SpectralInversion(SpectralInversion *pSpectralInversion)
00282 {
00283     KSP_NODE Node;
00284     HRESULT hr;
00285 
00286     // setup request
00287     Node.NodeId = m_NodeId;
00288     Node.Reserved = 0;
00289 
00290     // perform request
00291     hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_SPECTRAL_INVERSION, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pSpectralInversion, sizeof(SpectralInversion));
00292 
00293 #ifdef BDAPLGIN_TRACE
00294     WCHAR Buffer[100];
00295     swprintf(Buffer, L"CBDADigitalDemodulator::put_SpectralInversion: pSpectralInversion %lu hr %lx\n", *pSpectralInversion, hr);
00296     OutputDebugStringW(Buffer);
00297 #endif
00298 
00299     return hr;
00300 }
00301 
00302 HRESULT
00303 STDMETHODCALLTYPE
00304 CBDADigitalDemodulator::get_SpectralInversion(SpectralInversion *pSpectralInversion)
00305 {
00306     return E_NOINTERFACE;
00307 }
00308 
00309 
00310 HRESULT
00311 WINAPI
00312 CBDADigitalDemodulator_fnConstructor(
00313     IKsPropertySet * pProperty,
00314     ULONG NodeId,
00315     REFIID riid,
00316     LPVOID * ppv)
00317 {
00318     // construct device control
00319     CBDADigitalDemodulator * handler = new CBDADigitalDemodulator(pProperty, NodeId);
00320 
00321 #ifdef BDAPLGIN_TRACE
00322     OutputDebugStringW(L"CBDADigitalDemodulator_fnConstructor\n");
00323 #endif
00324 
00325     if (!handler)
00326         return E_OUTOFMEMORY;
00327 
00328     if (FAILED(handler->QueryInterface(riid, ppv)))
00329     {
00330         /* not supported */
00331         delete handler;
00332         return E_NOINTERFACE;
00333     }
00334 
00335     return NOERROR;
00336 }

Generated on Sun May 27 2012 04:21:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.