|
|
|
@ -24,6 +24,10 @@
|
|
|
|
|
* \date 2006-2007
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "hardware_battery.h"
|
|
|
|
|
|
|
|
|
|
// FOR REFERENCE
|
|
|
|
@ -110,20 +114,12 @@ void Battery::initDefault() {
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! initialize this battery object with values from HAL
|
|
|
|
|
//! initialize this battery object
|
|
|
|
|
void Battery::init() {
|
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
// read battery information from HAL
|
|
|
|
|
if (resetUdi(udi)) {
|
|
|
|
|
//udi is valid
|
|
|
|
|
recheck(); //fills all values
|
|
|
|
|
//ready here for now
|
|
|
|
|
} else {
|
|
|
|
|
//udi is invalid or is no battery
|
|
|
|
|
state=BAT_HAL_ERROR;
|
|
|
|
|
kdWarning() << "Warning: Battery::init cannot make use of udi " << udi << endl;
|
|
|
|
|
}
|
|
|
|
|
// read battery information
|
|
|
|
|
recheck(); //fills all values
|
|
|
|
|
|
|
|
|
|
initialized = true;
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
@ -201,7 +197,7 @@ void Battery::recheck() {
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---> query HAL for properties SECTION : START <----
|
|
|
|
|
// ---> query for properties SECTION : START <----
|
|
|
|
|
|
|
|
|
|
//! to check battery.present
|
|
|
|
|
/*!
|
|
|
|
@ -729,11 +725,11 @@ bool Battery::checkChargingState () {
|
|
|
|
|
return _ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---> query HAL for properties SECTION : END <----
|
|
|
|
|
// ---> query for properties SECTION : END <----
|
|
|
|
|
|
|
|
|
|
//! to recheck a special value for a HAL event
|
|
|
|
|
//! to recheck a special value for an event
|
|
|
|
|
/*!
|
|
|
|
|
* Check for the given property new values from HAL and set them to
|
|
|
|
|
* Check for the given property new values and set them to
|
|
|
|
|
* the battery variables.
|
|
|
|
|
* \param device TDEGenericDevice
|
|
|
|
|
*/
|
|
|
|
@ -747,26 +743,6 @@ void Battery::updateProperty(TDEGenericDevice* device) {
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Resets the current HAL udi used by the one given
|
|
|
|
|
/*!
|
|
|
|
|
* The given TQString will be (checked and) used as new HAL udi for the battery.
|
|
|
|
|
* But don't forget to do a recheck of the battery afterwards.
|
|
|
|
|
* \param _udi TQString with the UDI to reset
|
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
|
* \retval true if reset was successfull
|
|
|
|
|
* \retval false if reset couldn't be applied
|
|
|
|
|
*/
|
|
|
|
|
bool Battery::resetUdi(TQString _udi) {
|
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
// What does this function do outside of HAL!?!? Should it even exist any more?
|
|
|
|
|
bool tmp_result=true;
|
|
|
|
|
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return tmp_result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---> write private members SECTION : START <----
|
|
|
|
|
|
|
|
|
|
//! sets the chargelevel in percent when battery should go into state warning
|
|
|
|
@ -815,7 +791,7 @@ void Battery::setCritLevel(int _crit_level) {
|
|
|
|
|
// ---> write private members SECTION : END <----
|
|
|
|
|
// ---> get private members SECTION : START <----
|
|
|
|
|
|
|
|
|
|
//! reports the HAL udi of this battery
|
|
|
|
|
//! reports the udi of this battery
|
|
|
|
|
TQString Battery::getUdi() const {
|
|
|
|
|
return TQString(udi);
|
|
|
|
|
}
|
|
|
|
@ -880,7 +856,7 @@ int Battery::getCurrentLevel() const {
|
|
|
|
|
return charge_level_current;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! reports HAL capacity_state value
|
|
|
|
|
//! reports capacity_state value
|
|
|
|
|
TQString Battery::getCapacityState() const {
|
|
|
|
|
return TQString(capacity_state);
|
|
|
|
|
}
|
|
|
|
|