JP Abgrall | 5dcc6c9 | 2012-05-31 20:39:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Samsung |
| 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 | |
| 17 | #include <cutils/log.h> |
| 18 | #include <pthread.h> |
| 19 | |
| 20 | #include "LightSensor.h" |
| 21 | |
| 22 | LightSensor::LightSensor() |
| 23 | : IioSensorBase(NULL, "lightsensor-level", |
| 24 | "events/in_illuminance0_thresh_either_en", |
| 25 | "in_illuminance0_input", IIO_LIGHT) |
| 26 | { |
| 27 | mPendingEvent.sensor = ID_L; |
| 28 | mPendingEvent.type = SENSOR_TYPE_LIGHT; |
| 29 | } |
| 30 | |
| 31 | void LightSensor::handleData(int value) { |
JP Abgrall | db7bdef | 2012-06-21 15:04:34 -0700 | [diff] [blame] | 32 | ALOGV("LightSensor::handleData value %d", value); |
Veeren Mandalia | 0f445a8 | 2012-06-27 15:29:07 -0700 | [diff] [blame] | 33 | |
| 34 | /* Measured raw values are 8.9 times lower than actual values*/ |
| 35 | mPendingEvent.light = value * 8.9; |
JP Abgrall | 5dcc6c9 | 2012-05-31 20:39:43 -0700 | [diff] [blame] | 36 | } |