Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h

Issue 9844020: Move the Sudden Motion Sensor library into third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DEPS: convert line endings Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file is based on the SMSLib library. 5 // This file is based on the SMSLib library.
6 // 6 //
7 // SMSLib Sudden Motion Sensor Access Library 7 // SMSLib Sudden Motion Sensor Access Library
8 // Copyright (c) 2010 Suitable Systems 8 // Copyright (c) 2010 Suitable Systems
9 // All rights reserved. 9 // All rights reserved.
10 // 10 //
11 // Developed by: Daniel Griscom 11 // Developed by: Daniel Griscom
(...skipping 29 matching lines...) Expand all
41 // 41 //
42 // For more information about SMSLib, see 42 // For more information about SMSLib, see
43 // <http://www.suitable.com/tools/smslib.html> 43 // <http://www.suitable.com/tools/smslib.html>
44 // or contact 44 // or contact
45 // Daniel Griscom 45 // Daniel Griscom
46 // Suitable Systems 46 // Suitable Systems
47 // 1 Centre Street, Suite 204 47 // 1 Centre Street, Suite 204
48 // Wakefield, MA 01880 48 // Wakefield, MA 01880
49 // (781) 665-0053 49 // (781) 665-0053
50 50
51 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ 51 #ifndef SUDDEN_MOTION_SENSOR_H_
52 #define CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ 52 #define SUDDEN_MOTION_SENSOR_H_
53 #pragma once 53 #pragma once
54 54
55 #include <vector> 55 #include <vector>
56 56
57 #include <IOKit/IOKitLib.h> 57 #include <IOKit/IOKitLib.h>
58 58
59 #include "base/compiler_specific.h"
60 #include "content/browser/device_orientation/data_fetcher.h"
61
62 namespace device_orientation {
63
64 // Provides an easy-to-use interface to retrieve data 59 // Provides an easy-to-use interface to retrieve data
65 // from the MacBook family accelerometer. 60 // from the MacBook family accelerometer.
66 class AccelerometerMac : public DataFetcher { 61 class SuddenMotionSensor {
67 public: 62 public:
68 static DataFetcher* Create(); 63 static SuddenMotionSensor* Create();
69 64 bool ReadSensorValues(float axes[3]);
70 // Implement DataFetcher. 65 ~SuddenMotionSensor();
71 virtual bool GetOrientation(Orientation* orientation) OVERRIDE;
72
73 virtual ~AccelerometerMac();
74 66
75 private: 67 private:
76 AccelerometerMac(); 68 SuddenMotionSensor();
77 bool Init(); 69 bool Init();
78 70
79 // Extend the sign of an integer of size bytes to a 32-bit one. 71 // Extend the sign of an integer of size bytes to a 32-bit one.
80 static int ExtendSign(int value, size_t size); 72 static int ExtendSign(int value, size_t size);
81 73
82 struct GenericMacbookSensor; 74 struct GenericMacbookSensor;
83 struct SensorDescriptor; 75 struct SensorDescriptor;
84 struct AxisData; 76 struct AxisData;
85 77
86 // Generic sensor data and list of supported sensors. 78 // Generic sensor data and list of supported sensors.
87 static const GenericMacbookSensor kGenericSensor; 79 static const GenericMacbookSensor kGenericSensor;
88 static const SensorDescriptor kSupportedSensors[]; 80 static const SensorDescriptor kSupportedSensors[];
89 81
90 // Local sensor if supported, else NULL. 82 // Local sensor if supported, else NULL.
91 const SensorDescriptor* sensor_; 83 const SensorDescriptor* sensor_;
92 84
93 // IOKit connection to the local sensor. 85 // IOKit connection to the local sensor.
94 io_connect_t io_connection_; 86 io_connect_t io_connection_;
95 87
96 // Input memory used for sensor I/O. 88 // Input memory used for sensor I/O.
97 std::vector<char> input_record_; 89 std::vector<char> input_record_;
98 90
99 // Output memory used for sensor I/O. 91 // Output memory used for sensor I/O.
100 std::vector<char> output_record_; 92 std::vector<char> output_record_;
101 }; 93 };
102 94
103 } // namespace device_orientation 95 #endif // SUDDEN_MOTION_SENSOR_H_
104
105 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698