2 * Copyright (C) 2013 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef HIDSENSOR_SYNTHCOMPASS_H
18 #define HIDSENSOR_SYNTHCOMPASS_H
20 #include "SensorIIODev.h"
21 #include "RotVecSensor.h"
25 class SynthCompassSensor : public SensorBase {
30 void setRotVecSensor(RotVecSensor *s) { mRotVec = s; }
32 // From the RotationVector sensor
33 void setQuaternion(float q[4]);
36 virtual int open() { return mRotVec != NULL; }
37 virtual void close() {}
38 virtual int enable(int en);
39 virtual int readEvents(sensors_event_t *data, int count);
40 virtual int setDelay(int64_t ns) { return mRotVec ? mRotVec->setDelay(ns) : -1; }
42 static const struct sensor_t sSensorInfo_compass;
45 RotVecSensor *mRotVec;