/*!
   This function starts the startChargerTypeChanged notification.

*/
void QDeclarativeBatteryInfo::startChargerTypeChanged(bool on)
{
    monitoringChargerTypeChanges = on;
    if(on) {
    connect(batteryInfo(),SIGNAL(chargerTypeChanged(QSystemBatteryInfo::ChargerType)),
            this,SIGNAL(chargerTypeChanged(QSystemBatteryInfo::ChargerType)),Qt::UniqueConnection);
    } else {
        disconnect(batteryInfo(),SIGNAL(chargerTypeChanged(QSystemBatteryInfo::ChargerType)),
                this,SIGNAL(chargerTypeChanged(QSystemBatteryInfo::ChargerType)));
    }
}
Пример #2
0
BatteryNotifier::BatteryNotifier(QObject *parent) :
    QObject(parent),
    lowBatteryNotifier(0),
    notificationId(0),
    touchScreenLockActive(false),
    batteryInfo(new QBatteryInfo(this)),
    qmDeviceMode(new MeeGo::QmDeviceMode(this)),
    chargerType(QBatteryInfo::UnknownCharger)
{
#ifndef UNIT_TEST
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
    connect(batteryInfo, SIGNAL(batteryStatusChanged(int,QBatteryInfo::BatteryStatus)), this, SLOT(applyBatteryStatus(int,QBatteryInfo::BatteryStatus)));
    connect(batteryInfo, SIGNAL(chargingStateChanged(int,QBatteryInfo::ChargingState)), this, SLOT(applyChargingState(int,QBatteryInfo::ChargingState)));
#else
    connect(batteryInfo, SIGNAL(levelStatusChanged(QBatteryInfo::LevelStatus)), this, SLOT(applyBatteryStatus(QBatteryInfo::LevelStatus)));
    connect(batteryInfo, SIGNAL(chargingStateChanged(QBatteryInfo::ChargingState)), this, SLOT(applyChargingState(QBatteryInfo::ChargingState)));
#endif
    connect(batteryInfo, SIGNAL(chargerTypeChanged(QBatteryInfo::ChargerType)), this, SLOT(applyChargerType(QBatteryInfo::ChargerType)));
#endif
    connect(qmDeviceMode, SIGNAL(devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState)), this, SLOT(applyPSMState(MeeGo::QmDeviceMode::PSMState)));

    notificationTimer.setInterval(5000);
    notificationTimer.setSingleShot(true);

    QTimer::singleShot(0, this, SLOT(initBattery()));
}
BatteryStatus::BatteryStatus(Cordova *cordova)
        : CPlugin(cordova),
          _scId(0) {

    connect(&_batteryInfo,
            SIGNAL(remainingCapacityChanged(int)),
            this,
            SLOT(remainingCapacityChanged(int)));

    connect(&_batteryInfo,
            SIGNAL(batteryCountChanged(int)),
            this,
            SLOT(batteryCountChanged(int)));

    connect(&_batteryInfo,
            SIGNAL(chargerTypeChanged(QBatteryInfo::ChargerType)),
            this,
            SLOT(chargerTypeChanged(QBatteryInfo::ChargerType)));
}
Пример #4
0
BatteryNotifier::BatteryNotifier(QObject *parent) :
    QObject(parent),
    lowBatteryNotifier(0),
    notificationId(0),
    touchScreenLockActive(false),
    batteryInfo(new QtMobility::QSystemBatteryInfo(this)),
    qmDeviceMode(new MeeGo::QmDeviceMode(this)),
    qmLed(new MeeGo::QmLED(this)),
    chargerType(QtMobility::QSystemBatteryInfo::UnknownCharger)
{
    connect(batteryInfo, SIGNAL(batteryStatusChanged(QSystemBatteryInfo::BatteryStatus)), this, SLOT(applyBatteryStatus(QSystemBatteryInfo::BatteryStatus)));
    connect(batteryInfo, SIGNAL(chargingStateChanged(QSystemBatteryInfo::ChargingState)), this, SLOT(applyChargingState(QSystemBatteryInfo::ChargingState)));
    connect(batteryInfo, SIGNAL(chargerTypeChanged(QSystemBatteryInfo::ChargerType)), this, SLOT(applyChargerType(QSystemBatteryInfo::ChargerType)));
    connect(qmDeviceMode, SIGNAL(devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState)), this, SLOT(applyPSMState(MeeGo::QmDeviceMode::PSMState)));

    // Init battery values delayed...
    initBattery();

    notificationTimer.setInterval(5000);
    notificationTimer.setSingleShot(true);
}