• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
LightSensor()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 
handleData(int value)31 void LightSensor::handleData(int value) {
32     ALOGV("LightSensor::handleData value %d", value);
33 
34     /* Measured raw values are 8.9 times lower than actual values*/
35     mPendingEvent.light = value * 8.9;
36 }
37