qtmobility/src/sensors/qambientlightsensor.cpp
changeset 1 2b40d63a9c3d
child 4 90517678cc4f
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include "qambientlightsensor.h"
       
    43 #include "qambientlightsensor_p.h"
       
    44 
       
    45 QTM_BEGIN_NAMESPACE
       
    46 
       
    47 IMPLEMENT_READING(QAmbientLightReading)
       
    48 
       
    49 /*!
       
    50     \class QAmbientLightReading
       
    51     \ingroup sensors_reading
       
    52 
       
    53     \preliminary
       
    54     \brief The QAmbientLightReading class represents one reading from the
       
    55            ambient light sensor.
       
    56 
       
    57     \section2 QAmbientLightReading Units
       
    58     The ambient light sensor returns the intensity of the ambient light
       
    59     using the pre-defined values found in the QAmbientLightReading::LightLevel
       
    60     enum.
       
    61 */
       
    62 
       
    63 /*!
       
    64     \enum QAmbientLightReading::LightLevel
       
    65 
       
    66     This enum represents the ambient light level.
       
    67 
       
    68     \value Undefined  The light level is unknown.
       
    69     \value Dark       It is dark.
       
    70     \value Twilight   It is darkish.
       
    71     \value Light      It is light (eg. internal lights).
       
    72     \value Bright     It is bright (eg. shade).
       
    73     \value Sunny      It is very bright (eg. direct sunlight).
       
    74 */
       
    75 
       
    76 /*!
       
    77     \property QAmbientLightReading::lightLevel
       
    78     \brief the ambient light level.
       
    79 
       
    80     The value represents the ambient light and comes from QAmbientLightReading::LightLevel.
       
    81     \sa {QAmbientLightReading Units}
       
    82 */
       
    83 
       
    84 QAmbientLightReading::LightLevel QAmbientLightReading::lightLevel() const
       
    85 {
       
    86     return static_cast<LightLevel>(d->lightLevel);
       
    87 }
       
    88 
       
    89 /*!
       
    90     Sets the ambient light level to \a lightLevel.
       
    91 */
       
    92 void QAmbientLightReading::setLightLevel(QAmbientLightReading::LightLevel lightLevel)
       
    93 {
       
    94     d->lightLevel = lightLevel;
       
    95 }
       
    96 
       
    97 // =====================================================================
       
    98 
       
    99 // begin generated code
       
   100 
       
   101 /*!
       
   102     \class QAmbientLightFilter
       
   103     \ingroup sensors_filter
       
   104 
       
   105     \preliminary
       
   106     \brief The QAmbientLightFilter class is a convenience wrapper around QSensorFilter.
       
   107 
       
   108     The only difference is that the filter() method features a pointer to QAmbientLightReading
       
   109     instead of QSensorReading.
       
   110 */
       
   111 
       
   112 /*!
       
   113     \fn QAmbientLightFilter::filter(QAmbientLightReading *reading)
       
   114 
       
   115     Called when \a reading changes. Returns false to prevent the reading from propagating.
       
   116 
       
   117     \sa QSensorFilter::filter()
       
   118 */
       
   119 
       
   120 const char *QAmbientLightSensor::type("QAmbientLightSensor");
       
   121 
       
   122 /*!
       
   123     \class QAmbientLightSensor
       
   124     \ingroup sensors_type
       
   125 
       
   126     \preliminary
       
   127     \brief The QAmbientLightSensor class is a convenience wrapper around QSensor.
       
   128 
       
   129     The only behavioural difference is that this class sets the type properly.
       
   130 
       
   131     This class also features a reading() function that returns a QAmbientLightReading instead of a QSensorReading.
       
   132 
       
   133     For details about how the sensor works, see \l QAmbientLightReading.
       
   134 
       
   135     \sa QAmbientLightReading
       
   136 */
       
   137 
       
   138 /*!
       
   139     \fn QAmbientLightSensor::QAmbientLightSensor(QObject *parent)
       
   140 
       
   141     Construct the sensor as a child of \a parent.
       
   142 */
       
   143 
       
   144 /*!
       
   145     \fn QAmbientLightSensor::~QAmbientLightSensor()
       
   146 
       
   147     Destroy the sensor. Stops the sensor if it has not already been stopped.
       
   148 */
       
   149 
       
   150 /*!
       
   151     \fn QAmbientLightSensor::reading() const
       
   152 
       
   153     Returns the reading class for this sensor.
       
   154 
       
   155     \sa QSensor::reading()
       
   156 */
       
   157 // end generated code
       
   158 
       
   159 #include "moc_qambientlightsensor.cpp"
       
   160 QTM_END_NAMESPACE
       
   161