|
|
|
@ -43,7 +43,7 @@ dbusHAL::dbusHAL(){
|
|
|
|
|
|
|
|
|
|
dbus_is_connected = false;
|
|
|
|
|
hal_is_connected = false;
|
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
|
hal_ctx = NULL;
|
|
|
|
|
|
|
|
|
|
// add pointer to this for filter_function()
|
|
|
|
@ -93,11 +93,11 @@ bool dbusHAL::isConnectedToHAL() {
|
|
|
|
|
* This function return information if the org.freedesktop.Policy.Power
|
|
|
|
|
* interface was claimed.
|
|
|
|
|
* \return boolean with the status of claim the interface
|
|
|
|
|
* \retval true if aquired
|
|
|
|
|
* \retval true if acquired
|
|
|
|
|
* \retval false if not
|
|
|
|
|
*/
|
|
|
|
|
bool dbusHAL::aquiredPolicyPowerInterface() {
|
|
|
|
|
return aquiredPolicyPower;
|
|
|
|
|
bool dbusHAL::acquiredPolicyPowerInterface() {
|
|
|
|
|
return acquiredPolicyPower;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
@ -161,7 +161,7 @@ bool dbusHAL::initDBUS(){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
aquirePolicyPowerIface();
|
|
|
|
|
acquirePolicyPowerIface();
|
|
|
|
|
|
|
|
|
|
dbus_connection_set_exit_on_disconnect( dbus_connection, false );
|
|
|
|
|
|
|
|
|
@ -205,12 +205,12 @@ bool dbusHAL::initDBUS(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* This function aquire the org.freedesktop.Policy.Power interface
|
|
|
|
|
* This function acquire the org.freedesktop.Policy.Power interface
|
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
|
* \retval true if successful aquired the interface
|
|
|
|
|
* \retval true if successful acquired the interface
|
|
|
|
|
* \retval false if unsuccessful
|
|
|
|
|
*/
|
|
|
|
|
bool dbusHAL::aquirePolicyPowerIface(){
|
|
|
|
|
bool dbusHAL::acquirePolicyPowerIface(){
|
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
if (dbus_connection == NULL) {
|
|
|
|
@ -222,26 +222,26 @@ bool dbusHAL::aquirePolicyPowerIface(){
|
|
|
|
|
DBUS_NAME_FLAG_REPLACE_EXISTING, NULL)) {
|
|
|
|
|
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
|
|
|
|
|
kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
|
aquiredPolicyPower = true;
|
|
|
|
|
acquiredPolicyPower = true;
|
|
|
|
|
break;
|
|
|
|
|
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
|
|
|
|
kdWarning() << "Queued to aquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
|
kdWarning() << "Queued to acquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
kdWarning() << "Unknown error while aquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
|
kdWarning() << "Unknown error while acquire org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return aquiredPolicyPower;
|
|
|
|
|
return acquiredPolicyPower;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* This function release the org.freedesktop.Policy.Power interface
|
|
|
|
|
* \return boolean with the result of the operation
|
|
|
|
|
* \retval true if successful aquired the interface
|
|
|
|
|
* \retval true if successful acquired the interface
|
|
|
|
|
* \retval false if unsuccessful
|
|
|
|
|
*/
|
|
|
|
|
bool dbusHAL::releasePolicyPowerIface(){
|
|
|
|
@ -268,7 +268,7 @@ bool dbusHAL::releasePolicyPowerIface(){
|
|
|
|
|
case DBUS_RELEASE_NAME_REPLY_RELEASED:
|
|
|
|
|
kdDebug() << "Released org.freedesktop.Policy.Power interface" << endl;
|
|
|
|
|
retval = true;
|
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
|
break;
|
|
|
|
|
case DBUS_RELEASE_NAME_REPLY_NOT_OWNER:
|
|
|
|
|
kdWarning() << "Couldn't release org.freedesktop.Policy.Power, not the owner" << endl;
|
|
|
|
@ -1072,9 +1072,9 @@ void dbusHAL::emitMsgReceived( msg_type type, TQString message, TQString string
|
|
|
|
|
|
|
|
|
|
if (type == POLICY_POWER_OWNER_CHANGED) {
|
|
|
|
|
if (message.startsWith("NOW_OWNER"))
|
|
|
|
|
aquiredPolicyPower = true;
|
|
|
|
|
acquiredPolicyPower = true;
|
|
|
|
|
else
|
|
|
|
|
aquiredPolicyPower = false;
|
|
|
|
|
acquiredPolicyPower = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit msgReceived_withStringString( type, message, string );
|
|
|
|
|