Beispiel #1
0
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);
    QStringList args = app.arguments();
    int rate_place = args.indexOf("-r");
    int rate_val = 0;
    if (rate_place != -1)
        rate_val = args.at(rate_place + 1).toInt();
    QAccelerometer sensor;
    sensor.connectToBackend();
    sensor.setProperty("alwaysOn",true);

    if (rate_val > 0) {
        sensor.setDataRate(rate_val);
        check::checkRate(&sensor, rate_val);
    }

    int buffer_place = args.indexOf("-b");
    int bufferSize = buffer_place!=-1? args.at(buffer_place + 1).toInt():1;
    sensor.setProperty("bufferSize",bufferSize);

    sensor.setProperty("bufferInOneShot",args.indexOf("-bb")>-1);

    AccelerometerFilter filter(rate_val);
    sensor.addFilter(&filter);
    sensor.start();
    if (!sensor.isActive()) {
        qWarning("Accelerometersensor didn't start!");
        return 1;
    }

    return app.exec();
}
Beispiel #2
0
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    QAccelerometer sensor;
    accelerometer = &sensor;
    AccelerometerFilter filter;
    sensor.addFilter(&filter);
    sensor.start();

    if (!sensor.isActive()) {
        qWarning("Accelerometer didn't start!");
        return 1;
    }

    return app.exec();
}
Beispiel #3
0
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);
    QStringList args = app.arguments();
    int rate_place = args.indexOf("-r");
    int rate_val = 0;
    if (rate_place != -1)
        rate_val = args.at(rate_place + 1).toInt();
    QAccelerometer sensor;
    if (rate_val > 0) {
        sensor.setDataRate(rate_val);
    }
    AccelerometerFilter filter;
    sensor.addFilter(&filter);
    sensor.start();
    if (!sensor.isActive()) {
        qWarning("Accelerometersensor didn't start!");
        return 1;
    }

    return app.exec();
}