@@ -30,8 +30,6 @@ DEFINE_GUID(GUID_SimpleDeviceOrientationDevice_UniqueID,
3030typedef enum
3131{
3232 LINEAR_ACCELEROMETER_DATA_X = 0 ,
33- LINEAR_ACCELEROMETER_DATA_Y,
34- LINEAR_ACCELEROMETER_DATA_Z,
3533 LINEAR_ACCELEROMETER_DATA_TIMESTAMP,
3634 LINEAR_ACCELEROMETER_DATA_SHAKE,
3735 LINEAR_ACCELEROMETER_DATA_COUNT
@@ -177,8 +175,6 @@ SimpleDeviceOrientationDevice::Initialize(
177175
178176 m_pSupportedDataFields->List [LINEAR_ACCELEROMETER_DATA_TIMESTAMP] = PKEY_SensorData_Timestamp;
179177 m_pSupportedDataFields->List [LINEAR_ACCELEROMETER_DATA_X] = PKEY_SensorData_AccelerationX_Gs;
180- m_pSupportedDataFields->List [LINEAR_ACCELEROMETER_DATA_Y] = PKEY_SensorData_AccelerationY_Gs;
181- m_pSupportedDataFields->List [LINEAR_ACCELEROMETER_DATA_Z] = PKEY_SensorData_AccelerationZ_Gs;
182178 m_pSupportedDataFields->List [LINEAR_ACCELEROMETER_DATA_SHAKE] = PKEY_SensorData_Shake;
183179 }
184180
@@ -216,23 +212,13 @@ SimpleDeviceOrientationDevice::Initialize(
216212 m_pData->List [LINEAR_ACCELEROMETER_DATA_X].Key = PKEY_SensorData_AccelerationX_Gs;
217213 InitPropVariantFromFloat (0.0 , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_X].Value ));
218214
219- m_pData->List [LINEAR_ACCELEROMETER_DATA_Y].Key = PKEY_SensorData_AccelerationY_Gs;
220- InitPropVariantFromFloat (0.0 , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_Y].Value ));
221-
222- m_pData->List [LINEAR_ACCELEROMETER_DATA_Z].Key = PKEY_SensorData_AccelerationZ_Gs;
223- InitPropVariantFromFloat (0.0 , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_Z].Value ));
224-
225215 m_pData->List [LINEAR_ACCELEROMETER_DATA_SHAKE].Key = PKEY_SensorData_Shake;
226216 InitPropVariantFromBoolean (FALSE , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_SHAKE].Value ));
227217
228- m_CachedData.Axis .X = 0 .0f ;
229- m_CachedData.Axis .Y = 0 .0f ;
230- m_CachedData.Axis .Z = -1 .0f ;
218+ m_CachedData.X = 0 .0f ;
231219 m_CachedData.Shake = FALSE ;
232220
233- m_LastSample.Axis .X = 0 .0f ;
234- m_LastSample.Axis .Y = 0 .0f ;
235- m_LastSample.Axis .Z = 0 .0f ;
221+ m_LastSample.X = 0 .0f ;
236222 m_LastSample.Shake = FALSE ;
237223 }
238224
@@ -351,17 +337,7 @@ SimpleDeviceOrientationDevice::Initialize(
351337 InitPropVariantFromFloat (SimpleDeviceOrientationDevice_Default_Axis_Threshold,
352338 &(m_pThresholds->List [LINEAR_ACCELEROMETER_DATA_X].Value ));
353339
354- m_pThresholds->List [LINEAR_ACCELEROMETER_DATA_Y].Key = PKEY_SensorData_AccelerationY_Gs;
355- InitPropVariantFromFloat (SimpleDeviceOrientationDevice_Default_Axis_Threshold,
356- &(m_pThresholds->List [LINEAR_ACCELEROMETER_DATA_Y].Value ));
357-
358- m_pThresholds->List [LINEAR_ACCELEROMETER_DATA_Z].Key = PKEY_SensorData_AccelerationZ_Gs;
359- InitPropVariantFromFloat (SimpleDeviceOrientationDevice_Default_Axis_Threshold,
360- &(m_pThresholds->List [LINEAR_ACCELEROMETER_DATA_Z].Value ));
361-
362- m_CachedThresholds.Axis .X = SimpleDeviceOrientationDevice_Default_Axis_Threshold;
363- m_CachedThresholds.Axis .Y = SimpleDeviceOrientationDevice_Default_Axis_Threshold;
364- m_CachedThresholds.Axis .Z = SimpleDeviceOrientationDevice_Default_Axis_Threshold;
340+ m_CachedThresholds.X = SimpleDeviceOrientationDevice_Default_Axis_Threshold;
365341
366342 m_FirstSample = TRUE ;
367343 }
@@ -414,9 +390,7 @@ SimpleDeviceOrientationDevice::GetData(
414390 {
415391 // Compare the change of data to threshold, and only push the data back to
416392 // clx if the change exceeds threshold. This is usually done in HW.
417- if ( (abs (m_CachedData.Axis .X - m_LastSample.Axis .X ) >= m_CachedThresholds.Axis .X ) ||
418- (abs (m_CachedData.Axis .Y - m_LastSample.Axis .Y ) >= m_CachedThresholds.Axis .Y ) ||
419- (abs (m_CachedData.Axis .Z - m_LastSample.Axis .Z ) >= m_CachedThresholds.Axis .Z ))
393+ if ( (abs (m_CachedData.X - m_LastSample.X ) >= m_CachedThresholds.X ))
420394 {
421395 DataReady = TRUE ;
422396 }
@@ -425,16 +399,12 @@ SimpleDeviceOrientationDevice::GetData(
425399 if (DataReady != FALSE )
426400 {
427401 // update last sample
428- m_LastSample.Axis .X = m_CachedData.Axis .X ;
429- m_LastSample.Axis .Y = m_CachedData.Axis .Y ;
430- m_LastSample.Axis .Z = m_CachedData.Axis .Z ;
402+ m_LastSample.X = m_CachedData.X ;
431403
432404 m_LastSample.Shake = m_CachedData.Shake ;
433405
434406 // push to clx
435- InitPropVariantFromFloat (m_LastSample.Axis .X , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_X].Value ));
436- InitPropVariantFromFloat (m_LastSample.Axis .Y , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_Y].Value ));
437- InitPropVariantFromFloat (m_LastSample.Axis .Z , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_Z].Value ));
407+ InitPropVariantFromFloat (m_LastSample.X , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_X].Value ));
438408
439409 InitPropVariantFromBoolean (m_LastSample.Shake , &(m_pData->List [LINEAR_ACCELEROMETER_DATA_SHAKE].Value ));
440410
@@ -477,31 +447,13 @@ SimpleDeviceOrientationDevice::UpdateCachedThreshold(
477447
478448 Status = PropKeyFindKeyGetFloat (m_pThresholds,
479449 &PKEY_SensorData_AccelerationX_Gs,
480- &m_CachedThresholds.Axis . X );
450+ &m_CachedThresholds.X );
481451 if (!NT_SUCCESS (Status))
482452 {
483453 TraceError (" COMBO %!FUNC! LAC PropKeyFindKeyGetFloat for X failed! %!STATUS!" , Status);
484454 goto Exit;
485455 }
486456
487- Status = PropKeyFindKeyGetFloat (m_pThresholds,
488- &PKEY_SensorData_AccelerationY_Gs,
489- &m_CachedThresholds.Axis .Y );
490- if (!NT_SUCCESS (Status))
491- {
492- TraceError (" COMBO %!FUNC! LAC PropKeyFindKeyGetFloat for Y failed! %!STATUS!" , Status);
493- goto Exit;
494- }
495-
496- Status = PropKeyFindKeyGetFloat (m_pThresholds,
497- &PKEY_SensorData_AccelerationZ_Gs,
498- &m_CachedThresholds.Axis .Z );
499- if (!NT_SUCCESS (Status))
500- {
501- TraceError (" COMBO %!FUNC! LAC PropKeyFindKeyGetFloat for Z failed! %!STATUS!" , Status);
502- goto Exit;
503- }
504-
505457Exit:
506458 SENSOR_FunctionExit (Status);
507459 return Status;
0 commit comments