|
|
@ -24,6 +24,10 @@
|
|
|
|
* \date 2006-2007
|
|
|
|
* \date 2006-2007
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "hardware_battery.h"
|
|
|
|
#include "hardware_battery.h"
|
|
|
|
|
|
|
|
|
|
|
|
// FOR REFERENCE
|
|
|
|
// FOR REFERENCE
|
|
|
@ -110,20 +114,12 @@ void Battery::initDefault() {
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! initialize this battery object with values from HAL
|
|
|
|
//! initialize this battery object
|
|
|
|
void Battery::init() {
|
|
|
|
void Battery::init() {
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
|
|
// read battery information from HAL
|
|
|
|
// read battery information
|
|
|
|
if (resetUdi(udi)) {
|
|
|
|
recheck(); //fills all values
|
|
|
|
//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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialized = true;
|
|
|
|
initialized = true;
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
@ -201,7 +197,7 @@ void Battery::recheck() {
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---> query HAL for properties SECTION : START <----
|
|
|
|
// ---> query for properties SECTION : START <----
|
|
|
|
|
|
|
|
|
|
|
|
//! to check battery.present
|
|
|
|
//! to check battery.present
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
@ -729,11 +725,11 @@ bool Battery::checkChargingState () {
|
|
|
|
return _ret;
|
|
|
|
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.
|
|
|
|
* the battery variables.
|
|
|
|
* \param device TDEGenericDevice
|
|
|
|
* \param device TDEGenericDevice
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -747,26 +743,6 @@ void Battery::updateProperty(TDEGenericDevice* device) {
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
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 <----
|
|
|
|
// ---> write private members SECTION : START <----
|
|
|
|
|
|
|
|
|
|
|
|
//! sets the chargelevel in percent when battery should go into state warning
|
|
|
|
//! 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 <----
|
|
|
|
// ---> write private members SECTION : END <----
|
|
|
|
// ---> get private members SECTION : START <----
|
|
|
|
// ---> get private members SECTION : START <----
|
|
|
|
|
|
|
|
|
|
|
|
//! reports the HAL udi of this battery
|
|
|
|
//! reports the udi of this battery
|
|
|
|
TQString Battery::getUdi() const {
|
|
|
|
TQString Battery::getUdi() const {
|
|
|
|
return TQString(udi);
|
|
|
|
return TQString(udi);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -880,7 +856,7 @@ int Battery::getCurrentLevel() const {
|
|
|
|
return charge_level_current;
|
|
|
|
return charge_level_current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! reports HAL capacity_state value
|
|
|
|
//! reports capacity_state value
|
|
|
|
TQString Battery::getCapacityState() const {
|
|
|
|
TQString Battery::getCapacityState() const {
|
|
|
|
return TQString(capacity_state);
|
|
|
|
return TQString(capacity_state);
|
|
|
|
}
|
|
|
|
}
|
|
|
|