00001 #include "sa_qt_sensors.hpp" 00002 00003 #include "er_errors.h" 00004 #include "ld_logging.h" 00005 00006 // http://doc.qt.nokia.com/qtmobility-1.1.0/qtsensors.html 00007 00008 ClQtEventSensorBase::ClQtEventSensorBase(const QByteArray & type, 00009 ac_AppContext* aAppContext) : 00010 QSensor(type), iAppContext(aAppContext) 00011 { 00012 } 00013 00014 void ClQtEventSensorBase::run() 00015 { 00016 // Signals cannot be "overridden" directly like methods, but we can 00017 // connect to slots locally. 00018 connect(this, SIGNAL(activeChanged()), this, SLOT(handleActiveChanged())); 00019 connect(this, SIGNAL(busyChanged()), this, SLOT(handleBusyChanged())); 00020 connect(this, SIGNAL(readingChanged()), this, SLOT(handleReadingChanged())); 00021 connect(this, SIGNAL(sensorError(int)), this, SLOT(handleSensorError(int))); 00022 00023 if (!isBusy()) 00024 start(); 00025 } 00026 00027 void ClQtEventSensorBase::handleActiveChanged() 00028 { 00029 const char* status = (isActive() ? "activated" : "disactivated"); 00030 log_db_log_status(GetLogDb(), NULL, 00031 "STATUS: %s sensor %s", Name(), status); 00032 } 00033 00034 void ClQtEventSensorBase::handleBusyChanged() 00035 { 00036 const char* status = (isBusy() ? "busy" : "available"); 00037 log_db_log_status(GetLogDb(), NULL, 00038 "STATUS: %s sensor hardware %s", Name(), status); 00039 if (!isActive() && !isBusy()) 00040 start(); 00041 } 00042 00043 void ClQtEventSensorBase::handleSensorError(int errCode) 00044 { 00045 log_db_log_status(GetLogDb(), NULL, 00046 "ERROR: error in %s sensor: %d", 00047 Name(), errCode); 00048 } 00049 00050 /* 00051 void ClQtEventSensorBase::handleReadingChanged() 00052 { 00053 logt("ClQtEventSensorBase: reading changed"); 00054 }*/ 00055 00056 /** 00057 00058 Copyright 2010 Helsinki Institute for Information Technology (HIIT) 00059 and the authors. All rights reserved. 00060 00061 Authors: Tero Hasu <tero.hasu@hut.fi> 00062 00063 Permission is hereby granted, free of charge, to any person 00064 obtaining a copy of this software and associated documentation files 00065 (the "Software"), to deal in the Software without restriction, 00066 including without limitation the rights to use, copy, modify, merge, 00067 publish, distribute, sublicense, and/or sell copies of the Software, 00068 and to permit persons to whom the Software is furnished to do so, 00069 subject to the following conditions: 00070 00071 The above copyright notice and this permission notice shall be 00072 included in all copies or substantial portions of the Software. 00073 00074 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00075 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00076 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00077 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00078 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00079 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00080 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00081 SOFTWARE. 00082 00083 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:56 2011 by Doxygen 1.6.1