bool IoSlave::loop() { if(!mNotify->read()) { updatePowerState(); return true; } return false; }
void Dialog::setupDevice() { delete di; //! [createdi] di = new QSystemDeviceInfo(this); //! [createdi] //! [batteryLevel] batteryLevelBar->setValue(di->batteryLevel()); //! [batteryLevel] //! [sig batteryLevelChanged] connect(di,SIGNAL(batteryLevelChanged(int)), this,SLOT(updateBatteryStatus(int))); //! [sig batteryLevelChanged] connect(di,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)), this,SLOT(displayBatteryStatus(QSystemDeviceInfo::BatteryStatus))); connect(di,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)), this,SLOT(updatePowerState(QSystemDeviceInfo::PowerState))); ImeiLabel->setText(di->imei()); imsiLabel->setText(di->imsi()); //! [manuf-id] manufacturerLabel->setText(di->manufacturer()); //! [manuf-id] modelLabel->setText(di->model()); //! [productName] productLabel->setText(di->productName()); //! [productName] deviceLockPushButton->setChecked(di->isDeviceLocked()); updateSimStatus(); updateProfile(); connect(di, SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile)), this, SLOT(updateProfile(QSystemDeviceInfo::Profile))); if(di->currentPowerState() == QSystemDeviceInfo::BatteryPower) { radioButton_2->setChecked(true); } else if(di->currentPowerState() == QSystemDeviceInfo::WallPower) { radioButton_3->setChecked(true); } else if(di->currentPowerState() == QSystemDeviceInfo::WallPowerChargingBattery) { radioButton_4->setChecked(true); } else { radioButton->setChecked(true); } //! [inputMethod flags] QSystemDeviceInfo::InputMethodFlags methods = di->inputMethodType(); QStringList inputs; if((methods & QSystemDeviceInfo::Keys)){ inputs << "Keys"; } if((methods & QSystemDeviceInfo::Keypad)) { inputs << "Keypad"; } //! [inputMethod flags] if((methods & QSystemDeviceInfo::Keyboard)) { inputs << "Keyboard"; } if((methods & QSystemDeviceInfo::SingleTouch)) { inputs << "Touch Screen"; } if((methods & QSystemDeviceInfo::MultiTouch)) { inputs << "Multi touch"; } if((methods & QSystemDeviceInfo::Mouse)){ inputs << "Mouse"; } inputMethodLabel->setText(inputs.join(" ")); }
void IoSlave::begin() { updatePowerState(); }