ReactOS  0.4.13-dev-249-gcba1a2f
signalstatistics.cpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS BDA Proxy
4  * FILE: dll/directx/bdaplgin/signalstatistics.cpp
5  * PURPOSE: IBDA_FrequencyFilter interface
6  *
7  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8  */
9 
10 #include "precomp.h"
11 
12 #ifndef _MSC_VER
13 const GUID IID_IBDA_SignalStatistics = {0x1347d106, 0xcf3a, 0x428a, {0xa5, 0xcb, 0xac, 0x0d, 0x9a, 0x2a, 0x43, 0x38}};
14 const GUID KSPROPSETID_BdaSignalStats = {0x1347d106, 0xcf3a, 0x428a, {0xa5, 0xcb, 0xac, 0xd, 0x9a, 0x2a, 0x43, 0x38}};
15 #endif
16 
18 {
19 public:
21 
23  {
25  return m_Ref;
26  }
28  {
30  if (!m_Ref)
31  {
32  delete this;
33  return 0;
34  }
35  return m_Ref;
36  }
37 
38  // IBDA_SignalStatistics methods
49 
52 
53 protected:
54  LONG m_Ref;
57 };
58 
59 HRESULT
62  IN REFIID refiid,
63  OUT PVOID* Output)
64 {
65  *Output = NULL;
66 
67  if (IsEqualGUID(refiid, IID_IUnknown))
68  {
69  *Output = PVOID(this);
70  reinterpret_cast<IUnknown*>(*Output)->AddRef();
71  return NOERROR;
72  }
73 
75  {
76  *Output = (IBDA_SignalStatistics*)(this);
77  reinterpret_cast<IBDA_SignalStatistics*>(*Output)->AddRef();
78  return NOERROR;
79  }
80  return E_NOINTERFACE;
81 }
82 
83 HRESULT
86 {
87  return E_NOINTERFACE;
88 }
89 
90 HRESULT
93 {
94  KSP_NODE Node;
95  HRESULT hr;
97 
98  // setup request
99  Node.NodeId = (ULONG)-1;
100  Node.Reserved = 0;
101 
103 
105 
106 
107 #ifdef BDAPLGIN_TRACE
108  WCHAR Buffer[100];
109  swprintf(Buffer, L"CBDASignalStatistics::get_SignalStrength: m_NodeId %lu hr %lx, BytesReturned %lu plDbStrength %ld\n", m_NodeId, hr, BytesReturned, *plDbStrength);
111 #endif
112 
113  return hr;
114 }
115 
116 HRESULT
119 {
120  return E_NOINTERFACE;
121 }
122 
123 HRESULT
126 {
127  KSP_NODE Node;
128  HRESULT hr;
130 
131  // setup request
132  Node.NodeId = (ULONG)-1;
133  Node.Reserved = 0;
134 
135  // perform request
136  hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SIGNAL_QUALITY, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), plPercentQuality, sizeof(LONG), &BytesReturned);
137 
138 #ifdef BDAPLGIN_TRACE
139  WCHAR Buffer[100];
140  swprintf(Buffer, L"CBDASignalStatistics::get_SignalQuality: m_NodeId %lu hr %lx, BytesReturned %lu plPercentQuality %lu\n", m_NodeId, hr, BytesReturned, *plPercentQuality);
142 #endif
143 
144  return hr;
145 }
146 
147 HRESULT
150 {
151  return E_NOINTERFACE;
152 }
153 
154 HRESULT
157 {
158  KSP_NODE Node;
159  HRESULT hr;
160  ULONG Present;
162 
163  // setup request
164  Node.NodeId = (ULONG)-1;
165  Node.Reserved = 0;
166 
167  // perform request
169 
170  // store result
171  *pfPresent = Present;
172 
173 #ifdef BDAPLGIN_TRACE
174  WCHAR Buffer[100];
175  swprintf(Buffer, L"CBDASignalStatistics::get_SignalPresent: m_NodeId %lu hr %lx, BytesReturned %lu Present %lu\n", m_NodeId, hr, BytesReturned, Present);
177 #endif
178 
179  return hr;
180 }
181 
182 HRESULT
185 {
186  return E_NOINTERFACE;
187 }
188 
189 HRESULT
192 {
193  KSP_NODE Node;
194  HRESULT hr;
195  ULONG Locked;
197 
198  // setup request
199  Node.NodeId = (ULONG)-1;
200  Node.Reserved = 0;
201 
202  // perform request
204 
205  *pfLocked = Locked;
206 
207 #ifdef BDAPLGIN_TRACE
208  WCHAR Buffer[100];
209  swprintf(Buffer, L"CBDASignalStatistics::get_SignalLocked: m_NodeId %lu hr %lx, BytesReturned %lu Locked %lu\n", m_NodeId, hr, BytesReturned, Locked);
211 #endif
212 
213  return hr;
214 }
215 
216 HRESULT
219 {
220  KSP_NODE Node;
221  HRESULT hr;
222 
223  // setup request
224  Node.NodeId = (ULONG)-1;
225  Node.Reserved = 0;
226 
227  // perform request
228  hr = m_pProperty->Set(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SAMPLE_TIME, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &lmsSampleTime, sizeof(LONG));
229 
230 #ifdef BDAPLGIN_TRACE
231  WCHAR Buffer[100];
232  swprintf(Buffer, L"CBDASignalStatistics::put_SampleTime: m_NodeId %lu hr %lx\n", m_NodeId, hr);
234 #endif
235 
236  return hr;
237 }
238 
239 HRESULT
242 {
243  KSP_NODE Node;
244  HRESULT hr;
246 
247  // setup request
248  Node.NodeId = (ULONG)-1;
249  Node.Reserved = 0;
250 
251  // perform request
252  hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SAMPLE_TIME, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), plmsSampleTime, sizeof(LONG), &BytesReturned);
253 
254 #ifdef BDAPLGIN_TRACE
255  WCHAR Buffer[100];
256  swprintf(Buffer, L"CBDASignalStatistics::get_SampleTime: m_NodeId %lu hr %lx, BytesReturned %lu \n", m_NodeId, hr, BytesReturned);
258 #endif
259 
260  return hr;
261 }
262 
263 HRESULT
264 WINAPI
267  ULONG NodeId,
268  REFIID riid,
269  LPVOID * ppv)
270 {
271  // construct device control
273 
274 #ifdef BDAPLGIN_TRACE
275  OutputDebugStringW(L"CBDASignalStatistics_fnConstructor\n");
276 #endif
277 
278  if (!handler)
279  return E_OUTOFMEMORY;
280 
281  if (FAILED(handler->QueryInterface(riid, ppv)))
282  {
283  /* not supported */
284  delete handler;
285  return E_NOINTERFACE;
286  }
287 
288  return NOERROR;
289 }
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
HRESULT STDMETHODCALLTYPE put_SignalPresent(BOOLEAN fPresent)
#define IN
Definition: typedefs.h:38
CBDASignalStatistics(IKsPropertySet *pProperty, ULONG NodeId)
#define REFIID
Definition: guiddef.h:113
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID KSPROPSETID_BdaSignalStats
HRESULT hr
Definition: shlfolder.c:183
#define NOERROR
Definition: winerror.h:2354
REFIID riid
Definition: precomp.h:44
STDMETHODIMP_(ULONG) Release()
HRESULT STDMETHODCALLTYPE put_SampleTime(LONG lmsSampleTime)
REFIID LPVOID * ppv
Definition: atlbase.h:39
STDMETHODIMP_(ULONG) AddRef()
#define assert(x)
Definition: debug.h:53
IKsPropertySet * m_pProperty
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
HRESULT STDMETHODCALLTYPE get_SampleTime(LONG *plmsSampleTime)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
union node Node
Definition: types.h:1255
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:260
#define STDMETHODIMP
Definition: basetyps.h:43
ULONG Release()
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: ks.h:2104
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
_Must_inspect_result_ _In_ KSP_BDA_NODE_PIN * pProperty
Definition: bdasup.h:156
HRESULT STDMETHODCALLTYPE get_SignalStrength(LONG *plDbStrength)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:8
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
ULONG AddRef()
HRESULT STDMETHODCALLTYPE get_SignalPresent(BOOLEAN *pfPresent)
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
HRESULT Set([in] REFGUID guidPropSet, [in] DWORD dwPropID, [in, size_is(cbInstanceData)] LPVOID pInstanceData, [in] DWORD cbInstanceData, [in, size_is(cbPropData)] LPVOID pPropData, [in] DWORD cbPropData)
#define InterlockedIncrement
Definition: armddk.h:53
const GUID IID_IBDA_SignalStatistics
HRESULT STDMETHODCALLTYPE get_SignalQuality(LONG *plPercentQuality)
HRESULT Get([in] REFGUID guidPropSet, [in] DWORD dwPropID, [in, size_is(cbInstanceData)] LPVOID pInstanceData, [in] DWORD cbInstanceData, [out, size_is(cbPropData)] LPVOID pPropData, [in] DWORD cbPropData, [out] DWORD *pcbReturned)
HRESULT WINAPI CBDASignalStatistics_fnConstructor(IKsPropertySet *pProperty, ULONG NodeId, REFIID riid, LPVOID *ppv)
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
HRESULT STDMETHODCALLTYPE put_SignalQuality(LONG lPercentQuality)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
HRESULT STDMETHODCALLTYPE get_SignalLocked(BOOLEAN *pfLocked)
HRESULT STDMETHODCALLTYPE put_SignalStrength(LONG lDbStrength)
Definition: dlist.c:348
HRESULT STDMETHODCALLTYPE put_SignalLocked(BOOLEAN fLocked)