sa_sensor_proximity_qt.cpp

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

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