void BatteryNotifier::applyBatteryStatus(int, QBatteryInfo::BatteryStatus status) { switch(status) { case QBatteryInfo::BatteryFull: stopLowBatteryNotifier(); removeNotification(QStringList() << "x-nemo.battery"); sendNotification(NotificationChargingComplete); break; case QBatteryInfo::BatteryOk: stopLowBatteryNotifier(); break; case QBatteryInfo::BatteryLow: if (batteryInfo->chargingState(0) != QBatteryInfo::Charging) { // The low battery notifications should be sent only if the battery is not charging startLowBatteryNotifier(); } break; case QBatteryInfo::BatteryEmpty: sendNotification(NotificationRechargeBattery); break; default: break; } }
void BatteryNotifier::batteryStateChanged(MeeGo::QmBattery::BatteryState state) { switch(state) { case MeeGo::QmBattery::StateFull: stopLowBatteryNotifier(); removeNotification(QStringList() << "x-nemo.battery"); sendNotification(NotificationChargingComplete); break; case MeeGo::QmBattery::StateOK: stopLowBatteryNotifier(); break; case MeeGo::QmBattery::StateLow: if (qmBattery->getChargingState() != MeeGo::QmBattery::StateCharging) { // The low battery notifications should be sent only if the battery is not charging startLowBatteryNotifier(); } break; case MeeGo::QmBattery::StateEmpty: sendNotification(NotificationRechargeBattery); break; case MeeGo::QmBattery::StateError: break; } }
void BatteryNotifier::applyChargingState(int, QBatteryInfo::ChargingState state) { switch(state) { case QBatteryInfo::Charging: if (batteryInfo->chargerType() == QBatteryInfo::USBCharger && batteryInfo->currentFlow(0) <= 100) { sendNotification(NotificationNoEnoughPower); } else { // The low battery notifications should not be sent when the battery is charging stopLowBatteryNotifier(); removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery"); sendNotification(NotificationCharging); } break; case QBatteryInfo::NotCharging: sendNotification(NotificationChargingNotStarted); break; default: removeNotification(QStringList() << "x-nemo.battery"); break; } }
void BatteryNotifier::applyChargingState(QtMobility::QSystemBatteryInfo::ChargingState state) { switch(state) { case QtMobility::QSystemBatteryInfo::Charging: if (batteryInfo->chargerType() == QtMobility::QSystemBatteryInfo::USB_100mACharger) { sendNotification(NotificationNoEnoughPower); } else { // The low battery notifications should not be sent when the battery is charging stopLowBatteryNotifier(); removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery"); sendNotification(NotificationCharging); } break; case QtMobility::QSystemBatteryInfo::NotCharging: removeNotification(QStringList() << "x-nemo.battery"); utiliseLED(false, QString("PatternBatteryCharging")); break; case QtMobility::QSystemBatteryInfo::ChargingError: sendNotification(NotificationChargingNotStarted); break; } }
void BatteryNotifier::chargingStateChanged(MeeGo::QmBattery::ChargingState state) { switch(state) { case MeeGo::QmBattery::StateCharging: if (qmBattery->getChargerType() == MeeGo::QmBattery::USB_100mA) { sendNotification(NotificationNoEnoughPower); } else { // The low battery notifications should not be sent when the battery is charging stopLowBatteryNotifier(); removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery"); sendNotification(NotificationCharging); } break; case MeeGo::QmBattery::StateNotCharging: removeNotification(QStringList() << "x-nemo.battery"); utiliseLED(false, QString("PatternBatteryCharging")); break; case MeeGo::QmBattery::StateChargingFailed: sendNotification(NotificationChargingNotStarted); break; } }
void BatteryNotifier::applyChargingState(QBatteryInfo::ChargingState state) { switch(state) { case QBatteryInfo::Charging: if (batteryInfo->chargerType() == QBatteryInfo::USBCharger && batteryInfo->currentFlow() <= 100) { sendNotification(NotificationNoEnoughPower); } else { // The low battery notifications should not be sent when the battery is charging stopLowBatteryNotifier(); removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery"); sendNotification(NotificationCharging); } break; case QBatteryInfo::IdleChargingState: if (batteryInfo->levelStatus() != QBatteryInfo::LevelFull) { sendNotification(NotificationChargingNotStarted); return; } // otherwise fallthrough, not charging because capacity is full default: removeNotification(QStringList() << "x-nemo.battery"); break; } }