blob: 1f6c7713404b529929aef37455588f95a7970f68 [file] [log] [blame]
JP Abgrall5dcc6c92012-05-31 20:39:43 -07001/*
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
22LightSensor::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
31void LightSensor::handleData(int value) {
JP Abgralldb7bdef2012-06-21 15:04:34 -070032 ALOGV("LightSensor::handleData value %d", value);
Veeren Mandalia0f445a82012-06-27 15:29:07 -070033
34 /* Measured raw values are 8.9 times lower than actual values*/
35 mPendingEvent.light = value * 8.9;
JP Abgrall5dcc6c92012-05-31 20:39:43 -070036}