LinearAccelerationSensor.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2010 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef ANDROID_LINEAR_ACCELERATION_SENSOR_H
  17. #define ANDROID_LINEAR_ACCELERATION_SENSOR_H
  18. #include <stdint.h>
  19. #include <sys/types.h>
  20. #include <gui/Sensor.h>
  21. #include "SensorInterface.h"
  22. #include "GravitySensor.h"
  23. // ---------------------------------------------------------------------------
  24. namespace android {
  25. // ---------------------------------------------------------------------------
  26. class SensorDevice;
  27. class SensorFusion;
  28. class LinearAccelerationSensor : public SensorInterface {
  29. SensorDevice& mSensorDevice;
  30. GravitySensor mGravitySensor;
  31. virtual bool process(sensors_event_t* outEvent,
  32. const sensors_event_t& event);
  33. public:
  34. LinearAccelerationSensor(sensor_t const* list, size_t count);
  35. virtual status_t activate(void* ident, bool enabled);
  36. virtual status_t setDelay(void* ident, int handle, int64_t ns);
  37. virtual Sensor getSensor() const;
  38. virtual bool isVirtual() const { return true; }
  39. };
  40. // ---------------------------------------------------------------------------
  41. }; // namespace android
  42. #endif // ANDROID_LINEAR_ACCELERATION_SENSOR_H