| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/sensors/data_fetcher_shared_memory.h" | 5 #include "device/sensors/data_fetcher_shared_memory.h" |
| 6 | 6 |
| 7 #include <GuidDef.h> | 7 #include <GuidDef.h> |
| 8 #include <InitGuid.h> | 8 #include <InitGuid.h> |
| 9 #include <PortableDeviceTypes.h> | 9 #include <PortableDeviceTypes.h> |
| 10 #include <Sensors.h> | 10 #include <Sensors.h> |
| 11 #include <objbase.h> |
| 11 | 12 |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/win/iunknown_impl.h" | 16 #include "base/win/iunknown_impl.h" |
| 16 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 const double kMeanGravity = 9.80665; | 21 const double kMeanGravity = 9.80665; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 if (SUCCEEDED(device_values.CreateInstance(CLSID_PortableDeviceValues))) { | 395 if (SUCCEEDED(device_values.CreateInstance(CLSID_PortableDeviceValues))) { |
| 395 if (SUCCEEDED(device_values->SetUnsignedIntegerValue( | 396 if (SUCCEEDED(device_values->SetUnsignedIntegerValue( |
| 396 SENSOR_PROPERTY_CURRENT_REPORT_INTERVAL, | 397 SENSOR_PROPERTY_CURRENT_REPORT_INTERVAL, |
| 397 GetInterval().InMilliseconds()))) { | 398 GetInterval().InMilliseconds()))) { |
| 398 base::win::ScopedComPtr<IPortableDeviceValues> return_values; | 399 base::win::ScopedComPtr<IPortableDeviceValues> return_values; |
| 399 (*sensor)->SetProperties(device_values.Get(), return_values.Receive()); | 400 (*sensor)->SetProperties(device_values.Get(), return_values.Receive()); |
| 400 } | 401 } |
| 401 } | 402 } |
| 402 | 403 |
| 403 base::win::ScopedComPtr<ISensorEvents> sensor_events; | 404 base::win::ScopedComPtr<ISensorEvents> sensor_events; |
| 404 hr = event_sink->QueryInterface(__uuidof(ISensorEvents), | 405 hr = event_sink->QueryInterface(IID_PPV_ARGS(&sensor_events)); |
| 405 sensor_events.ReceiveVoid()); | |
| 406 if (FAILED(hr) || !sensor_events.Get()) | 406 if (FAILED(hr) || !sensor_events.Get()) |
| 407 return false; | 407 return false; |
| 408 | 408 |
| 409 hr = (*sensor)->SetEventSink(sensor_events.Get()); | 409 hr = (*sensor)->SetEventSink(sensor_events.Get()); |
| 410 if (FAILED(hr)) | 410 if (FAILED(hr)) |
| 411 return false; | 411 return false; |
| 412 | 412 |
| 413 return true; | 413 return true; |
| 414 } | 414 } |
| 415 | 415 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 motion_buffer_->data.all_available_sensors_are_active = enabled; | 473 motion_buffer_->data.all_available_sensors_are_active = enabled; |
| 474 motion_buffer_->seqlock.WriteEnd(); | 474 motion_buffer_->seqlock.WriteEnd(); |
| 475 } | 475 } |
| 476 break; | 476 break; |
| 477 default: | 477 default: |
| 478 NOTREACHED(); | 478 NOTREACHED(); |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace device | 482 } // namespace device |
| OLD | NEW |