Пример #1
0
Rotation::Rotation(bool updateInternally, QObject *parent)
    : Sensor(Sensor::Rotation, parent)
{
    m_sensor = new QRotationSensor(this);
    m_logBaseName = "rotation";

    if(updateInternally) {
        QObject::connect(m_sensor, SIGNAL(readingChanged()), this, SLOT(refresh()));
    }

    QObject::connect(m_sensor, SIGNAL(readingChanged()), this, SLOT(logValues()));
}
Пример #2
0
void ScreenProvider::setRotate(bool value)
{
    if(value) {
        orientationSensor_ = new QOrientationSensor(this);
        connect(orientationSensor_, SIGNAL(readingChanged()), this, SLOT(orientationChanged()));
        orientationSensor_->start();
    } else {
        orientationSensor_->stop();
        disconnect(orientationSensor_, SIGNAL(readingChanged()), this, SLOT(orientationChanged()));
        delete orientationSensor_;
        orientationSensor_ = 0;
        orientation_ = QOrientationReading::TopUp;
    }
}
void CCAccelerometer::setEnable(bool bEnable)
{
    if (!bEnable)
    {
        delete m_pAccelFilter;
        m_pAccelFilter = NULL;
    }
    else if (!m_pAccelFilter)
    {
        m_pAccelFilter = new AccelerometerFilter;
        connect(m_pAccelFilter, SIGNAL(readingChanged(QVariant, QVariant, QVariant)),
                this, SLOT(readingChanged(QVariant, QVariant, QVariant)));
    }
}
Пример #4
0
LipstickCompositor::LipstickCompositor()
: QWaylandCompositor(this), m_totalWindowCount(0), m_nextWindowId(1), m_homeActive(true), m_shaderEffect(0),
  m_fullscreenSurface(0), m_directRenderingActive(false), m_topmostWindowId(0), m_screenOrientation(Qt::PrimaryOrientation), m_displayState(new MeeGo::QmDisplayState(this)), m_retainedSelection(0)
{
    setColor(Qt::black);
    setRetainedSelectionEnabled(true);

    if (m_instance) qFatal("LipstickCompositor: Only one compositor instance per process is supported");
    m_instance = this;

    QObject::connect(this, SIGNAL(frameSwapped()), this, SLOT(windowSwapped()));
    QObject::connect(this, SIGNAL(beforeSynchronizing()), this, SLOT(clearUpdateRequest()));
    connect(m_displayState, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)), this, SLOT(reactOnDisplayStateChanges(MeeGo::QmDisplayState::DisplayState)));
    QObject::connect(HomeApplication::instance(), SIGNAL(aboutToDestroy()), this, SLOT(homeApplicationAboutToDestroy()));

    m_orientationSensor = new QOrientationSensor(this);
    QObject::connect(m_orientationSensor, SIGNAL(readingChanged()), this, SLOT(setScreenOrientationFromSensor()));
    if (!m_orientationSensor->connectToBackend()) {
        qWarning() << "Could not connect to the orientation sensor backend";
    } else {
        if (!m_orientationSensor->start())
            qWarning() << "Could not start the orientation sensor";
    }
    emit HomeApplication::instance()->homeActiveChanged();

    QDesktopServices::setUrlHandler("http", this, "openUrl");
    QDesktopServices::setUrlHandler("https", this, "openUrl");
    QDesktopServices::setUrlHandler("mailto", this, "openUrl");

    connect(QGuiApplication::clipboard(), SIGNAL(dataChanged()), SLOT(clipboardDataChanged()));
}
Пример #5
0
void Mouse_Dialog::setAddr(QString addrip, int addrport)
{
    ip = addrip;
    port = addrport;

    isStarted = false;
    udpSocket = new QUdpSocket(this);
    address.setAddress(ip);


    //----------------------------触摸设置------------------------------
    this->grabGesture(Qt::PanGesture);  //使能Pan,调用这个函数pan(捏)滑动手势被允许,这将使Udpserver作为QGestureEvents的目标。
    this->grabGesture(Qt::PinchGesture);//调用这个函数pinch(捏)手势被允许,这将使Udpserver作为QGestureEvents的目标。
    this->grabGesture(Qt::SwipeGesture);
    this->grabGesture(Qt::TapAndHoldGesture);   //点拖
    this->grabGesture(Qt::TapGesture);  //点击
        //qDebug() << "-----------------";

    //----------------------------重力传感器------------------------------
    this->m_sensor = new QAccelerometer(this);
    this->m_sensor->addFilter(this);
    connect(this->m_sensor, SIGNAL(readingChanged()), this, SLOT(checkReading()));
    this->m_sensor->start();
    qDebug() << "availableDataRates = " << this->m_sensor->availableDataRates();
    qDebug() << "bufferSize = " << this->m_sensor->bufferSize();
    qDebug() << "outputRange = " << this->m_sensor->outputRange();

}
Пример #6
0
void Compass::init() {
    m_azymuth = 0;
    m_accuracy = 0;
    m_compassSource = new QCompass(this);
    m_compassSource->connectToBackend();
    m_compassSource->start();
    connect(m_compassSource,SIGNAL(readingChanged()), SLOT(updateSensor()));
}
Пример #7
0
OrientationWatcher::OrientationWatcher (QObject *parent)
  :QOrientationSensor(parent),
   lastSetting (QOrientationReading::Undefined),
   watching (true)
{
  connect (this, SIGNAL (readingChanged()), this, SLOT (changeHappened()));
  // starting it from here is too fast, the client will miss the
  // first signal
}
Пример #8
0
Compass::Compass(QObject *parent) : QObject(parent),
  m_azimuth(0),
  m_calibrationLevel(0)
{
  m_compass = new QCompass (this);
  m_compass->connectToBackend ();
  m_compass->start ();

  connect (m_compass, SIGNAL(readingChanged()), SLOT(updateSensor()));
}
Пример #9
0
Accelerometer::Accelerometer(QObject *parent) : QObject(parent),
    m_x(0),
    m_y(0),
    m_z(0)
{
    m_accelerometer = new QAccelerometer (this);
    m_accelerometer->connectToBackend ();
    m_accelerometer->start ();

    connect (m_accelerometer, SIGNAL(readingChanged()), SLOT(updateSensor()));
}
Пример #10
0
AndroidSensorDialog::AndroidSensorDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AndroidSensorDialog)
{
    ui->setupUi(this);
#ifdef Q_OS_ANDROID
    this->setWindowState(Qt::WindowMaximized);
#else
    this->resize(1000,750);
#endif

    //  mAndroidGpsSource = new androidGps(this);
        mAndroidAccelerometer = new androidAccelerometer(this);
        connect(mAndroidAccelerometer->accmeter, SIGNAL(readingChanged()), this, SLOT(accSensorData()));

        mCompass = new androidCompass(this);
        connect(mCompass->mCompass, SIGNAL(readingChanged()), this, SLOT(headingData()));

        mLightSensor = new lightSensor(this);
        connect(mLightSensor->mLightSensor, SIGNAL(readingChanged()), this, SLOT(lightSensorData()));

}
Пример #11
0
OrientationForm::OrientationForm(QWidget *parent)
    : QWidget(parent)
{
    setupUi(this);
    connect(&m_orientation, SIGNAL(readingChanged()), this, SLOT(orientationChanged()));
  
    // Copy-pasted from documentation
    horizontalSliderX->setRange(-90, 90);
    horizontalSliderY->setRange(-180, 180);
    horizontalSliderZ->setRange(-180, 180);
    
    m_rotation.addFilter(this);
    m_rotation.start();
    m_orientation.start();    
}
Пример #12
0
QTM_USE_NAMESPACE
#endif

// Orientation code adapted from http://cdumez.blogspot.com/2010/12/screen-orientation-detection-for-qml.html

Utility::Utility(QObject *parent, QmlApplicationViewer *viewerRef) :
    QObject(parent), m_state("Portrait")
{
    viewer = viewerRef;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
    m_sensor = new QOrientationSensor(this);
    connect(m_sensor, SIGNAL(readingChanged()), SLOT(onReadingChanged()));
    m_sensor->start();
#endif
}
Пример #13
0
Accelerometer::Accelerometer(QObject *parent) : QObject(parent) {
    qDebug("Accelerometer Construct");
    this->accelerometer = new QtMobility::QAccelerometer(this);
    this->accelerometer->start();
    this->accelerometer->setOutputRange(-1);
    connect(this->accelerometer, SIGNAL(readingChanged()), this, SLOT(accelerometerTimeout()));

    this->x = 0;
    this->y = 0;
    this->z = 0;

    this->xdelta = 0;
    this->ydelta = 0;
    this->zdelta = 0;

    this->deltaLength = 0;
}
Пример #14
0
ProximitySocket::ProximitySocket(QObject *parent) :
    _isEnabled(false),
    _callActive(false),
    _proxClose(false),
    QObject(parent)
{
    sensor = new QProximitySensor(this);
    connect(sensor, SIGNAL(readingChanged()), this, SLOT(sensorRead()));

    QDBusConnection::systemBus().connect("", "", "org.ofono.VoiceCall",
                                         "PropertyChanged", this, SIGNAL(ofonoPropertyChanged(QString,QDBusVariant)));

    QDBusConnection::sessionBus().registerService(SERVICE_NAME);
    QDBusConnection::sessionBus().registerObject(OBJECT_NAME,
                                                 this,
                                                 QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
}
Пример #15
0
LocationProvider::LocationProvider() : QObject(), 
		       m_location(NULL), m_compass(NULL) {
  qDebug() << __FUNCTION__;

  m_location = QGeoPositionInfoSource::createDefaultSource(this);
  if(!m_location) {
    qWarning() << __FUNCTION__ << "no default position source found";

#ifdef GPSDPOSITIONINFOSOURCE
    qDebug() << __FUNCTION__ << "using gpsd";
    m_location = new GpsdPositionInfoSource(this);
#else
    qDebug() << __FUNCTION__ << "running simulation from nmea log";

    // if everything fails: try to load nmealog.txt from parent dir
    QNmeaPositionInfoSource *nmeaLocation = 
      new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
    nmeaLocation->setDevice(new QFile(QApplication::applicationDirPath() + 
				      + "/../nmealog.txt", this));
    m_location = nmeaLocation;
#endif
  }

  if(m_location) {
    m_location->setUpdateInterval(1000);
  
    connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)),
	    this, SLOT(positionHasBeenUpdated(QGeoPositionInfo)));  

    m_location->startUpdates();
  } else
    qWarning() << __FUNCTION__ << ": Position reporting finally failed!";

  m_compass = new QCompass(this);
  connect(m_compass, SIGNAL(readingChanged()), 
	  this, SLOT(checkCompassReading()));

  if(!m_compass->start()) {
    qDebug() << __FUNCTION__ << "failed to start compass";

    // and forget aboout it
    delete m_compass;
    m_compass = NULL;
  }
}
Пример #16
0
void QShakeSensorGestureRecognizer::create()
{
    accel = new QAccelerometer(this);
    accel->connectToBackend();
    accel->setDataRate(50);

    qoutputrangelist outputranges = accel->outputRanges();

    if (outputranges.count() > 0)
        accelRange = (int)(outputranges.at(0).maximum *2) / 9.8; //approx range in g's
    else
        accelRange = 4; //this should never happen

    connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
    timer = new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(timeout()));
    timer->setSingleShot(true);
    timer->setInterval(timerTimeout);
}
void MagnetometerController::doStart(){
    m_magnetometer.start();
    connect(&m_magnetometer, SIGNAL(readingChanged()), this, SLOT(update()));
}
Пример #18
0
CompassController::CompassController(): m_width(View::m_imageWidth){
    m_compass.connectToBackend();
    m_compass.start();
    connect(&m_compass, SIGNAL(readingChanged()), this, SLOT(update()));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    this->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    ui->setupUi(this);
    mPacState = 0;
    xAxis = yAxis = 0;
    mLastPt.setX(0);
    mLastPt.setY(0);
    mPause = false;

    // declare the accelerometer
    mAccelerometer = new QAccelerometer(this);
    mAccelerometer->start();

    QSize screenSize = this->size();
    mScene = new QGraphicsScene();

    QRect sceneRect = ui->mainGraphicsView->rect();
    mScene->setSceneRect(sceneRect);
   // scene->setBackgroundBrush (QBrush(Qt::blue));

    // now set up the boundries
    setupBoundries();

    QPixmap mazeImage(":/media/maze.jpg");
    int width = screenSize.width();
    mazeImage = mazeImage.scaledToWidth(width);
    QGraphicsPixmapItem *backGround = mScene->addPixmap(mazeImage);
    backGround->setPos(-140,-200);

    mPacCollider = new QGraphicsEllipseItem(0, 0, 18, 18);
    mPacCollider->setBrush(QBrush(Qt::transparent));
    mScene->addItem(mPacCollider);

    mPacman = new QGraphicsEllipseItem(0, 0, 18, 18);
    mPacman->setBrush(QBrush(Qt::yellow));
    mPacman->setSpanAngle(4500);
    mScene->addItem(mPacman);

    // lets place a pause button in the view
    pauseButton = new QPushButton("Pause");
    connect(pauseButton, SIGNAL(clicked()), this, SLOT(pause()));
    pauseButton->setMaximumHeight(40);
    QGraphicsProxyWidget *buttonProxy = mScene->addWidget(pauseButton);
    buttonProxy->setPos(0, -220);

    ui->mainGraphicsView->setScene(mScene);
    ui->mainGraphicsView->show();

    mPacman->setPos(20,-8);
    mPacCollider->setPos(20, -8);
    // declare our update timer
    mUpdateTimer = new QTimer(this);
    connect(mUpdateTimer, SIGNAL(timeout()), this, SLOT(updateGraphics()));
    mUpdateTimer->start(250);

    // connect the accelerometer to the readingChanged signal
    connect(mAccelerometer, SIGNAL(readingChanged()), this, SLOT(updateReading()));
    mNumHits = 1;

}
Пример #20
0
DeviceOrientation::DeviceOrientation(Cordova *cordova): CPlugin(cordova), _validData(false) {
    _compass.connectToBackend();
    connect(&_compass, SIGNAL(readingChanged()), SLOT(updateSensor()));
    connect(&_compass, SIGNAL(sensorError(int)), SLOT(sensorError(int)));
}
Пример #21
0
bool QtSensorGestureSensorHandler::startSensor(SensorGestureSensors sensor)
{
    bool ok = true;
    switch (sensor) {
    case Accel:
        //accel
        if (accel == 0x0) {
            accel = new QAccelerometer(this);
            ok = accel->connectToBackend();
//            qrangelist rangeList = accel->availableDataRates();

//            QStringList ranges;
//            foreach (const qrange &range, rangeList) {
//                if (range.first == range.second)
//                    ranges << QString("%1 Hz").arg(range.first);
//                else
//                    ranges << QString("%1-%2 Hz").arg(range.first).arg(range.second);
//            }
            accel->setDataRate(100);
            qoutputrangelist outputranges = accel->outputRanges();

            if (outputranges.count() > 0)
                accelRange = (int)(outputranges.at(0).maximum);//39
            else
                accelRange = 39; //this should never happen
            connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
        }
        if (ok && !accel->isActive())
            accel->start();
        break;
    case Orientation:
        //orientation
        if (orientation == 0x0) {
            orientation = new QOrientationSensor(this);
            ok = orientation->connectToBackend();
            orientation->setDataRate(100);
            connect(orientation,SIGNAL(readingChanged()),this,SLOT(orientationChanged()));
        }
        if (ok && !orientation->isActive()) {
            orientation->start();
            QTimer::singleShot(100,this,SLOT(orientationChanged()));
        }
        break;
    case Proximity:
        //proximity
        if (proximity == 0x0) {
            proximity = new QProximitySensor(this);
            ok = proximity->connectToBackend();
            connect(proximity,SIGNAL(readingChanged()),this,SLOT(proximityChanged()));
        }
        if (ok && !proximity->isActive()) {
            proximity->start();
        }
        break;
    case IrProximity:
//        //irproximity
//        if (irProx == 0x0) {
//            irProx = new QIRProximitySensor(this);
//            ok = irProx->connectToBackend();
//            connect(irProx,SIGNAL(readingChanged()),this,SLOT(irProximityChanged()));
//        }
//        if (ok && !irProx->isActive())
//            irProx->start();
//        break;
    case Tap:
//        //dtap
//        if (tapSensor == 0x0) {
//            tapSensor = new QTapSensor(this);
//            ok = tapSensor->connectToBackend();
//            connect(tapSensor,SIGNAL(readingChanged()),this,SLOT(doubletap()));
//        }
//        if (ok && !tapSensor->isActive())
//            tapSensor->start();
        break;
    };
    int val = usedSensorsMap.value(sensor);
    usedSensorsMap.insert(sensor,++val);

    return ok;
}
bool QtSensorGestureSensorHandler::startSensor(SensorGestureSensors sensor)
{
    bool ok = true;
    switch (sensor) {
    case Accel:
        //accel
        if (accel == 0x0) {
            accel = new QAccelerometer(this);
            ok = accel->connectToBackend();
            accel->setDataRate(100);
            qoutputrangelist outputranges = accel->outputRanges();

            if (outputranges.count() > 0)
                accelRange = (int)(outputranges.at(0).maximum);//39
            else
                accelRange = 39; //this should never happen
            connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
        }
        if (ok && !accel->isActive())
            accel->start();
        break;
    case Orientation:
        //orientation
        if (orientation == 0x0) {
            orientation = new QOrientationSensor(this);
            ok = orientation->connectToBackend();
            orientation->setDataRate(50);
            connect(orientation,SIGNAL(readingChanged()),this,SLOT(orientationChanged()));
        }
        if (ok && !orientation->isActive())
            orientation->start();
        break;
    case Proximity:
        //proximity
        if (proximity == 0x0) {
            proximity = new QProximitySensor(this);
            ok = proximity->connectToBackend();
            connect(proximity,SIGNAL(readingChanged()),this,SLOT(proximityChanged()));
        }
        if (ok && !proximity->isActive())
            proximity->start();
        break;
    case IrProximity:
        //irproximity
        if (irProx == 0x0) {
            irProx = new QIRProximitySensor(this);
            irProx->setDataRate(50);
            ok = irProx->connectToBackend();
            connect(irProx,SIGNAL(readingChanged()),this,SLOT(irProximityChanged()));
        }
        if (ok && !irProx->isActive())
            irProx->start();
        break;
    case Tap:
        //dtap
        if (tapSensor == 0x0) {
            tapSensor = new QTapSensor(this);
            ok = tapSensor->connectToBackend();
            connect(tapSensor,SIGNAL(readingChanged()),this,SLOT(doubletap()));
        }
        if (ok && !tapSensor->isActive())
            tapSensor->start();
        break;
    };
    int val = usedSensorsMap.value(sensor);
    usedSensorsMap.insert(sensor,++val);

    return ok;
}
AccelerometerController::AccelerometerController(): InputController(){
    m_accelerometer.connectToBackend();
    m_accelerometer.start();
    connect(&m_accelerometer, SIGNAL(readingChanged()), this, SLOT(update()));
}
RotationController::RotationController(): InputController(), m_factor(0.5){
    m_rotationSensor.connectToBackend();
    m_rotationSensor.start();
    connect(&m_rotationSensor, SIGNAL(readingChanged()), this, SLOT(update()));
}
Пример #25
0
MyProximitySensor::MyProximitySensor(QObject *parent) :
    QProximitySensor(parent)
{

    QObject::connect(this,SIGNAL(readingChanged()),this,SLOT(changeNotifier()));
}
Пример #26
0
LipstickCompositor::LipstickCompositor()
    : QWaylandQuickCompositor(this, 0, (QWaylandCompositor::ExtensionFlags)QWaylandCompositor::DefaultExtensions & ~QWaylandCompositor::QtKeyExtension)
    , m_totalWindowCount(0)
    , m_nextWindowId(1)
    , m_homeActive(true)
    , m_shaderEffect(0)
    , m_fullscreenSurface(0)
    , m_directRenderingActive(false)
    , m_topmostWindowId(0)
    , m_topmostWindowProcessId(0)
    , m_screenOrientation(Qt::PrimaryOrientation)
    , m_sensorOrientation(Qt::PrimaryOrientation)
    , m_displayState(0)
    , m_retainedSelection(0)
    , m_currentDisplayState(MeeGo::QmDisplayState::Unknown)
    , m_updatesEnabled(true)
    , m_completed(false)
    , m_onUpdatesDisabledUnfocusedWindowId(0)
    , m_keymap(0)
    , m_fakeRepaintTriggered(false)
{
    setColor(Qt::black);
    setRetainedSelectionEnabled(true);
    addDefaultShell();

    if (m_instance) qFatal("LipstickCompositor: Only one compositor instance per process is supported");
    m_instance = this;

    m_orientationLock = new MGConfItem("/lipstick/orientationLock", this);
    connect(m_orientationLock, SIGNAL(valueChanged()), SIGNAL(orientationLockChanged()));

    // Load legacy settings from the config file and delete it from there
    QSettings legacySettings("nemomobile", "lipstick");
    QString legacyOrientationKey("Compositor/orientationLock");
    if (legacySettings.contains(legacyOrientationKey)) {
        m_orientationLock->set(legacySettings.value(legacyOrientationKey));
        legacySettings.remove(legacyOrientationKey);
    }

    connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(onVisibleChanged(bool)));
    QObject::connect(this, SIGNAL(afterRendering()), this, SLOT(windowSwapped()));
    QObject::connect(HomeApplication::instance(), SIGNAL(aboutToDestroy()), this, SLOT(homeApplicationAboutToDestroy()));
    connect(this, &QQuickWindow::afterRendering, this, &LipstickCompositor::readContent, Qt::DirectConnection);

    m_orientationSensor = new QOrientationSensor(this);
    QObject::connect(m_orientationSensor, SIGNAL(readingChanged()), this, SLOT(setScreenOrientationFromSensor()));
    if (!m_orientationSensor->connectToBackend()) {
        qWarning() << "Could not connect to the orientation sensor backend";
    } else {
        if (!m_orientationSensor->start())
            qWarning() << "Could not start the orientation sensor";
    }
    emit HomeApplication::instance()->homeActiveChanged();

    QDesktopServices::setUrlHandler("http", this, "openUrl");
    QDesktopServices::setUrlHandler("https", this, "openUrl");
    QDesktopServices::setUrlHandler("mailto", this, "openUrl");

    connect(QGuiApplication::clipboard(), SIGNAL(dataChanged()), SLOT(clipboardDataChanged()));

    m_recorder = new LipstickRecorderManager;
    addGlobalInterface(m_recorder);
    addGlobalInterface(new AlienManagerGlobal);

    HwcRenderStage::initialize(this);

    setUpdatesEnabled(false);
    QTimer::singleShot(0, this, SLOT(initialize()));
}
void RotationController::doStart() {
    m_rotationSensor.start();
    connect(&m_rotationSensor, SIGNAL(readingChanged()), this, SLOT(update()));

}
Пример #28
0
MyMoveServer::MyMoveServer(QObject *parent) :
    QObject(parent),
#ifndef ANN_TRAINING
    m_state(IDLE),
#else
    m_state(COLLECTING_DATA),
    m_gestureFile(),
#endif
    m_eh(this),
    m_gesture(),
    m_gesturesDouble(),
    m_gesturesTriple(),
    m_orientation(),
    m_portrait(true),
    m_gestureNN2(NULL),
    m_gestureNN3(NULL),
    m_featureVector(),
    m_featureMatrix(),
    m_diffMatrix(),
    m_f11(),
    m_f12(),
    m_f21(),
    m_f22()
{
    m_orientation.start();

    resetFeatureVector();

    QOrientationReading* reading = m_orientation.reading();
    if (reading->orientation() == QOrientationReading::TopUp)
    {
        m_portrait = true;
    }
    else if (reading->orientation() == QOrientationReading::RightUp)
    {
        m_portrait = false;
    }
#ifndef ANN_TRAINING
    qDebug("MyMoveServer, portrait: %d", m_portrait);
#else
    qDebug("Starting in the data collecting mode");
    QString fname("/home/user/MyDocs/gesturedata");
    fname.append(QVariant(m_gestureNum).toString());
    m_gestureFile.setFileName(fname);
    m_gestureCount = 0;
#endif
    connect(&m_orientation, SIGNAL(readingChanged()), this, SLOT(orientationChanged()));

    qRegisterMetaType<QPoint>("QPoint");
    qRegisterMetaType<QList<QPoint> >("QList<QPoint>");

    connect(&m_eh, SIGNAL(touchPress(QList<QPoint>)), this, SLOT(touchPress(QList<QPoint>)));
    connect(&m_eh, SIGNAL(touchMove(QList<QPoint>)), this, SLOT(touchMove(QList<QPoint>)));
    connect(&m_eh, SIGNAL(touchRelease(QList<QPoint>)), this, SLOT(touchRelease(QList<QPoint>)));

    QDBusConnection bus = QDBusConnection::sessionBus();
    bus.registerObject("/sandst1/mymoves", this, QDBusConnection::ExportAllSlots);
    bus.registerService("org.sandst1.mymoves");
    m_eh.start();

    m_gestureNN2 = fann_create_from_file("/opt/mymoves/mymoves_nn2.net");
    m_gestureNN3 = fann_create_from_file("/opt/mymoves/mymoves_nn3.net");

#ifndef ANN_TRAINING
    observeGestures();
#endif
}
Пример #29
0
DeviceMotion::DeviceMotion(Cordova *cordova): CPlugin(cordova), _scId(0), _ecId(0) {
    _accelerometerSource = QSharedPointer<QAccelerometer>(new QAccelerometer());
    _sensorAvaliable = _accelerometerSource->start();
    connect(_accelerometerSource.data(), SIGNAL(readingChanged()), SLOT(updateSensor()));
}