Esempio n. 1
0
void QmActivity::disconnectNotify(const QMetaMethod &signal) {
#else
void QmActivity::disconnectNotify(const char *signal) {
#endif
    MEEGO_PRIVATE(QmActivity)

    /* QObject::disconnect() needs to be thread-safe */
    QMutexLocker locker(&priv->connectMutex);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (signal == QMetaMethod::fromSignal(&QmActivity::activityChanged)) {
#else
    if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(activityChanged(MeeGo::QmActivity::Activity))))) {
#endif
        priv->connectCount[SIGNAL_INACTIVITY]--;

        if (0 == priv->connectCount[SIGNAL_INACTIVITY]) {
            #if HAVE_MCE
                QDBusConnection::systemBus().disconnect(MCE_SERVICE,
                                                        MCE_SIGNAL_PATH,
                                                        MCE_SIGNAL_IF,
                                                        MCE_INACTIVITY_SIG,
                                                        priv,
                                                        SLOT(slotActivityChanged(bool)));
            #endif
        }
    }
Esempio n. 2
0
void QmThermal::disconnectNotify(const QMetaMethod &signal) {
#else
void QmThermal::disconnectNotify(const char *signal) {
#endif
    MEEGO_PRIVATE(QmThermal)

    /* QObject::disconnect() needs to be thread-safe */
    QMutexLocker locker(&priv->connectMutex);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (signal == QMetaMethod::fromSignal(&QmThermal::thermalChanged)) {
#else
    if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(thermalChanged(MeeGo::QmThermal::ThermalState))))) {
#endif
        priv->connectCount[SIGNAL_THERMAL_STATE]--;

        if (0 == priv->connectCount[SIGNAL_THERMAL_STATE]) {
            QDBusConnection::systemBus().disconnect(SYS_THERMALMANAGER_SERVICE,
                                                    SYS_THERMALMANAGER_PATH,
                                                    SYS_THERMALMANAGER_INTERFACE,
                                                    SYS_THERMALMANAGER_STATE_SIG,
                                                    priv,
                                                    SLOT(thermalStateChanged(const QString&)));
        }
    }
Esempio n. 3
0
void QmCallState::disconnectNotify(const QMetaMethod &signal) {
#else
void QmCallState::disconnectNotify(const char *signal) {
#endif
    MEEGO_PRIVATE(QmCallState)

    /* QObject::disconnect() needs to be thread-safe */
    QMutexLocker locker(&priv->connectMutex);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (signal == QMetaMethod::fromSignal(&QmCallState::stateChanged)) {
#else
    if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(stateChanged(MeeGo::QmCallState::State, MeeGo::QmCallState::Type))))) {
#endif
        priv->connectCount[SIGNAL_CALL_STATE]--;

        if (0 == priv->connectCount[SIGNAL_CALL_STATE]) {
            #if HAVE_MCE
                QDBusConnection::systemBus().disconnect(MCE_SERVICE,
                                                        MCE_SIGNAL_PATH,
                                                        MCE_SIGNAL_IF,
                                                        MCE_CALL_STATE_SIG,
                                                        priv,
                                                        SLOT(callStateChanged(const QString&, const QString&)));
            #endif
        }
    }
Esempio n. 4
0
    void QmDeviceMode::connectNotify(const QMetaMethod &signal) {
#else
    void QmDeviceMode::connectNotify(const char *signal) {
#endif
        MEEGO_PRIVATE(QmDeviceMode)

        /* QObject::connect() needs to be thread-safe */
        QMutexLocker locker(&priv->connectMutex);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        if (signal == QMetaMethod::fromSignal(&QmDeviceMode::deviceModeChanged)) {
#else
        if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(deviceModeChanged(MeeGo::QmDeviceMode::DeviceMode))))) {
#endif
            if (0 == priv->connectCount[SIGNAL_DEVICE_MODE]) {
                #if HAVE_MCE
                    QDBusConnection::systemBus().connect(MCE_SERVICE,
                                                         MCE_SIGNAL_PATH,
                                                         MCE_SIGNAL_IF,
                                                         MCE_RADIO_STATES_SIG,
                                                         priv,
                                                         SLOT(deviceModeChangedSlot(const quint32)));
                #endif
            }
            priv->connectCount[SIGNAL_DEVICE_MODE]++;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        } else if (signal == QMetaMethod::fromSignal(&QmDeviceMode::devicePSMStateChanged)) {
Esempio n. 5
0
QmDisplayState::~QmDisplayState() {
    MEEGO_PRIVATE(QmDisplayState)

    disconnect(priv, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)),
               this, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)));

    MEEGO_UNINITIALIZE(QmDisplayState);
}
Esempio n. 6
0
QmCallState::~QmCallState() {
    MEEGO_PRIVATE(QmCallState)

    disconnect(priv, SIGNAL(stateChanged(MeeGo::QmCallState::State, MeeGo::QmCallState::Type)),
               this, SIGNAL(stateChanged(MeeGo::QmCallState::State,MeeGo::QmCallState::Type)));

    MEEGO_UNINITIALIZE(QmCallState);
}
Esempio n. 7
0
QmThermal::~QmThermal() {
    MEEGO_PRIVATE(QmThermal)

    disconnect(priv, SIGNAL(thermalChanged(MeeGo::QmThermal::ThermalState)),
               this, SIGNAL(thermalChanged(MeeGo::QmThermal::ThermalState)));

    MEEGO_UNINITIALIZE(QmThermal);
}
Esempio n. 8
0
QmActivity::~QmActivity() {
    MEEGO_PRIVATE(QmActivity)

    disconnect(priv, SIGNAL(activityChanged(MeeGo::QmActivity::Activity)),
               this, SIGNAL(activityChanged(MeeGo::QmActivity::Activity)));

    MEEGO_UNINITIALIZE(QmActivity);
}
Esempio n. 9
0
QmSystemState::~QmSystemState() {
    MEEGO_PRIVATE(QmSystemState)

    disconnect(priv, SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication)),
               this, SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication)));

    MEEGO_UNINITIALIZE(QmSystemState);
}
Esempio n. 10
0
    QmSensor::SessionType QmSensor::requestSession(SessionType type)
    {
        MEEGO_PRIVATE(QmSensor);

        stop();
        priv->requestSession(type);

        return sessionType();
    }
Esempio n. 11
0
    QmDeviceMode::~QmDeviceMode() {
        MEEGO_PRIVATE(QmDeviceMode)

        disconnect(priv, SIGNAL(devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState)), this,
                   SIGNAL(devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState)));
        disconnect(priv, SIGNAL(deviceModeChanged(MeeGo::QmDeviceMode::DeviceMode)), this,
                   SIGNAL(deviceModeChanged(MeeGo::QmDeviceMode::DeviceMode)));

        MEEGO_UNINITIALIZE(QmDeviceMode);
    }
Esempio n. 12
0
 bool QmSensor::start() {
     MEEGO_PRIVATE(QmSensor);
     if (priv->running_) return true;
     if (priv->start()) {
         priv->running_ = true;
         priv->setupSignals(true);
         return true;
     }
     return false;
 }
Esempio n. 13
0
    bool QmSensor::stop()
    {
        MEEGO_PRIVATE(QmSensor);
        if (!priv->running_) return true;

        if (priv->stop()) {
            priv->running_ = false;

            // Unbind signals, in case another listener keeps session open
            priv->setupSignals(false);
            return true;
        }
        return false;
    }
Esempio n. 14
0
 bool QmSensor::isRunning()
 {
     MEEGO_PRIVATE(QmSensor);
     return priv->running_;
 }
Esempio n. 15
0
 void QmSensor::setStandbyOverride(bool value)
 {
     MEEGO_PRIVATE(QmSensor);
     priv->setStandbyOverride(value);
 }
Esempio n. 16
0
 bool QmSensor::standbyOverride()
 {
     MEEGO_PRIVATE(QmSensor);
     return priv->standbyOverride();
 }
Esempio n. 17
0
 void QmSensor::setInterval(int value)
 {
     MEEGO_PRIVATE(QmSensor);
     priv->setInterval(value);
 }
Esempio n. 18
0
 int QmSensor::interval()
 {
     MEEGO_PRIVATE(QmSensor);
     return priv->interval();
 }
Esempio n. 19
0
void QmSystemState::connectNotify(const QMetaMethod &signal) {
#else
void QmSystemState::connectNotify(const char *signal) {
#endif
    MEEGO_PRIVATE(QmSystemState)

    /* QObject::connect() needs to be thread-safe */
    QMutexLocker locker(&priv->connectMutex);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (signal == QMetaMethod::fromSignal(&QmSystemState::systemStateChanged)) {
#else
    if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication))))) {
#endif
        if (0 == priv->connectCount[SIGNAL_SYSTEM_STATE]) {
            QDBusConnection::systemBus().connect(dsme_service,
                                                 dsme_sig_path,
                                                 dsme_sig_interface,
                                                 dsme_shutdown_ind,
                                                 priv,
                                                 SLOT(emitShutdown()));
            QDBusConnection::systemBus().connect(dsme_service,
                                                 dsme_sig_path,
                                                 dsme_sig_interface,
                                                 dsme_save_unsaved_data_ind,
                                                 priv,
                                                 SLOT(emitSaveData()));
            QDBusConnection::systemBus().connect(dsme_service,
                                                 dsme_sig_path,
                                                 dsme_sig_interface,
                                                 dsme_battery_empty_ind,
                                                 priv,
                                                 SLOT(emitBatteryShutdown()));
            QDBusConnection::systemBus().connect(dsme_service,
                                                 dsme_sig_path,
                                                 dsme_sig_interface,
                                                 dsme_state_req_denied_ind,
                                                 priv,
                                                 SLOT(emitShutdownDenied(QString, QString)));
            QDBusConnection::systemBus().connect(SYS_THERMALMANAGER_SERVICE,
                                                 SYS_THERMALMANAGER_PATH,
                                                 SYS_THERMALMANAGER_INTERFACE,
                                                 SYS_THERMALMANAGER_STATE_SIG,
                                                 priv,
                                                 SLOT(emitThermalShutdown(QString)));
        }
        priv->connectCount[SIGNAL_SYSTEM_STATE]++;
    }
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void QmSystemState::disconnectNotify(const QMetaMethod &signal) {
#else
void QmSystemState::disconnectNotify(const char *signal) {
#endif
    MEEGO_PRIVATE(QmSystemState)

    /* QObject::disconnect() needs to be thread-safe */
    QMutexLocker locker(&priv->connectMutex);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (signal == QMetaMethod::fromSignal(&QmSystemState::systemStateChanged)) {
#else
    if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication))))) {
#endif
        priv->connectCount[SIGNAL_SYSTEM_STATE]--;

        if (0 == priv->connectCount[SIGNAL_SYSTEM_STATE]) {
            QDBusConnection::systemBus().disconnect(dsme_service,
                                                    dsme_sig_path,
                                                    dsme_sig_interface,
                                                    dsme_shutdown_ind,
                                                    priv,
                                                    SLOT(emitShutdown()));
            QDBusConnection::systemBus().disconnect(dsme_service,
                                                    dsme_sig_path,
                                                    dsme_sig_interface,
                                                    dsme_save_unsaved_data_ind,
                                                    priv,
                                                    SLOT(emitSaveData()));
            QDBusConnection::systemBus().disconnect(dsme_service,
                                                    dsme_sig_path,
                                                    dsme_sig_interface,
                                                    dsme_battery_empty_ind,
                                                    priv,
                                                    SLOT(emitBatteryShutdown()));
            QDBusConnection::systemBus().disconnect(dsme_service,
                                                    dsme_sig_path,
                                                    dsme_sig_interface,
                                                    dsme_state_req_denied_ind,
                                                    priv,
                                                    SLOT(emitShutdownDenied(QString, QString)));
            QDBusConnection::systemBus().disconnect(SYS_THERMALMANAGER_SERVICE,
                                                    SYS_THERMALMANAGER_PATH,
                                                    SYS_THERMALMANAGER_INTERFACE,
                                                    SYS_THERMALMANAGER_STATE_SIG,
                                                    priv,
                                                    SLOT(emitThermalShutdown(QString)));
        }
    }
}

bool QmSystemState::set(NextState nextState) {
    MEEGO_PRIVATE(QmSystemState)

    QString method;
    switch (nextState) {
        case Powerup:
            method = QString(dsme_req_powerup);
            break;
        case Reboot:
            method = QString(dsme_req_reboot);
            break;
        case ShuttingDown:
            method = QString(dsme_req_shutdown);
            break;
        default:
            return false;
    }
    QmIPCInterface *requestIf = priv->dsmeRequestIf;
    requestIf->callAsynchronously(method);
    return true;
}
Esempio n. 20
0
 QmSensor::SessionType QmSensor::sessionType()
 {
     MEEGO_PRIVATE(QmSensor);
     return priv->sessionType();
 }