diff -r cfcbf08528c4 -r 2b40d63a9c3d qtmobility/examples/sensors/grueapp/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/examples/sensors/grueapp/main.cpp Fri Apr 16 15:51:22 2010 +0300 @@ -0,0 +1,34 @@ +#include +#include + +QTM_USE_NAMESPACE + +class Filter : public QSensorFilter +{ +public: + bool filter(QSensorReading *reading) + { + int percent = reading->property("chanceOfBeingEaten").value() * 100; + qDebug() << "Your chance of being eaten by a Grue:" << percent << "percent."; + return false; + } +}; + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + QSensor sensor; + sensor.setType("GrueSensor"); + if (!sensor.connect()) { + qWarning("Grue sensor is not available!"); + return 1; + } + + Filter filter; + sensor.addFilter(&filter); + sensor.start(); + + return app.exec(); +} +