sa_sensor_light_qt.cpp

Go to the documentation of this file.
00001 #include "sa_sensor_light_qt.hpp"
00002 #include "sa_sensor_light_api.h"
00003 
00004 #include "er_errors.h"
00005 #include "ld_logging.h"
00006 #include "sa_sensor_list_log_db.h"
00007 
00008 #include <qambientlightsensor.h>
00009 
00010 Sensor_light::Sensor_light(ac_AppContext* aAppContext) :
00011   ClQtEventSensorBase(QAmbientLightSensor::type, aAppContext)
00012 {
00013   run();
00014 }
00015 
00016 const char* Sensor_light::Name() const
00017 {
00018   return "light";
00019 }
00020 
00021 void Sensor_light::handleReadingChanged()
00022 {
00023   QAmbientLightReading *data(static_cast<QAmbientLightReading*>(reading()));
00024   if (data) {
00025     int level = data->lightLevel();
00026     guilogf("light: %d", level);
00027     log_db_log_light(GetLogDb(), level, NULL);
00028   }
00029 }
00030 
00031 Sensor_light* new_Sensor_light(ac_AppContext* aAppContext)
00032 {
00033   return q_check_ptr(new Sensor_light(aAppContext));
00034 }
00035 
00036 void delete_Sensor_light(Sensor_light* obj)
00037 {
00038   delete obj;
00039 }
00040 
00041 /**
00042 
00043 Copyright 2010 Helsinki Institute for Information Technology (HIIT)
00044 and the authors. All rights reserved.
00045 
00046 Authors: Tero Hasu <tero.hasu@hut.fi>
00047 
00048 Permission is hereby granted, free of charge, to any person
00049 obtaining a copy of this software and associated documentation files
00050 (the "Software"), to deal in the Software without restriction,
00051 including without limitation the rights to use, copy, modify, merge,
00052 publish, distribute, sublicense, and/or sell copies of the Software,
00053 and to permit persons to whom the Software is furnished to do so,
00054 subject to the following conditions:
00055 
00056 The above copyright notice and this permission notice shall be
00057 included in all copies or substantial portions of the Software.
00058 
00059 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00060 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00061 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00062 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00063 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00064 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00065 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00066 SOFTWARE.
00067 
00068  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:56 2011 by Doxygen 1.6.1