qtmobility/plugins/sensors/n900/n900lightsensor.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    42 #include "n900lightsensor.h"
    42 #include "n900lightsensor.h"
    43 #include <QFile>
    43 #include <QFile>
    44 #include <QDebug>
    44 #include <QDebug>
    45 #include <time.h>
    45 #include <time.h>
    46 
    46 
    47 const char *n900lightsensor::id("n900.ambientlight");
    47 char const * const n900lightsensor::id("n900.ambientlight");
    48 const char *n900lightsensor::filename("/sys/class/i2c-adapter/i2c-2/2-0029/lux");
    48 char const * const n900lightsensor::filename("/sys/class/i2c-adapter/i2c-2/2-0029/lux");
    49 
    49 
    50 n900lightsensor::n900lightsensor(QSensor *sensor)
    50 n900lightsensor::n900lightsensor(QSensor *sensor)
    51     : n900filebasedsensor(sensor)
    51     : n900filebasedsensor(sensor)
    52 {
    52 {
    53     setReading<QAmbientLightReading>(&m_reading);
    53     setReading<QAmbientLightReading>(&m_reading);
    54     // Sensor takes 12-400ms to complete one reading and is triggered by
    54     // Sensor takes 12-400ms to complete one reading and is triggered by
    55     // a read of the /sys file (no interrupt/timing loop/etc. is used).
    55     // a read of the /sys file (no interrupt/timing loop/etc. is used).
    56     // Since no continuous operation is possible, don't set a data rate.
    56     // Since no continuous operation is possible, don't set a data rate.
    57     addDataRate(2, 2); // Close enough to 2 Hz
    57     addDataRate(2, 2); // Close enough to 2 Hz
    58     sensor->setDataRate(2);
       
    59     setDescription(QLatin1String("tsl2563"));
    58     setDescription(QLatin1String("tsl2563"));
    60 }
    59 }
    61 
    60 
    62 void n900lightsensor::start()
    61 void n900lightsensor::start()
    63 {
    62 {