diff options
Diffstat (limited to 'tdecore/tdehw/tdehardwaredevices.cpp')
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 325 |
1 files changed, 0 insertions, 325 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index aaba9e4ed..3cf62e8af 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -109,190 +109,6 @@ TDESensorCluster::TDESensorCluster() { critical = -1; } -TDECPUDevice::TDECPUDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { - m_frequency = -1; - m_minfrequency = -1; - m_maxfrequency = -1; - m_corenumber = -1; - m_transitionlatency = -1; -} - -TDECPUDevice::~TDECPUDevice() { -} - -double TDECPUDevice::frequency() { - return m_frequency; -} - -void TDECPUDevice::internalSetFrequency(double fr) { - m_frequency = fr; -} - -double TDECPUDevice::minFrequency() { - return m_minfrequency; -} - -void TDECPUDevice::internalSetMinFrequency(double fr) { - m_minfrequency = fr; -} - -double TDECPUDevice::maxFrequency() { - return m_maxfrequency; -} - -void TDECPUDevice::internalSetMaxFrequency(double fr) { - m_maxfrequency = fr; -} - -double TDECPUDevice::transitionLatency() { - return m_transitionlatency; -} - -void TDECPUDevice::internalSetTransitionLatency(double tl) { - m_transitionlatency = tl; -} - -TQString TDECPUDevice::governor() { - return m_governor; -} - -void TDECPUDevice::internalSetGovernor(TQString gr) { - m_governor = gr; -} - -TQString TDECPUDevice::scalingDriver() { - return m_scalingdriver; -} - -void TDECPUDevice::internalSetScalingDriver(TQString dr) { - m_scalingdriver = dr; -} - -TQStringList TDECPUDevice::dependentProcessors() { - return m_tiedprocs; -} - -void TDECPUDevice::internalSetDependentProcessors(TQStringList dp) { - m_tiedprocs = dp; -} - -TQStringList TDECPUDevice::availableFrequencies() { - return m_frequencies; -} - -void TDECPUDevice::internalSetAvailableFrequencies(TQStringList af) { - m_frequencies = af; -} - -TQStringList TDECPUDevice::availableGovernors() { - return m_governers; -} - -void TDECPUDevice::internalSetAvailableGovernors(TQStringList gp) { - m_governers = gp; -} - -void TDECPUDevice::internalSetCoreNumber(int cn) { - m_corenumber = cn; -} - -bool TDECPUDevice::canSetGovernor() { - TQString governornode = systemPath() + "/cpufreq/scaling_governor"; - int rval = access (governornode.ascii(), W_OK); - if (rval == 0) { - return TRUE; - } - else { -#ifdef WITH_UPOWER - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy hardwareControl("org.trinitydesktop.hardwarecontrol", "/org/trinitydesktop/hardwarecontrol", "org.trinitydesktop.hardwarecontrol.CPUGovernor", dbusConn); - if (hardwareControl.canSend()) { - // can set CPU governor? - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromInt32(coreNumber()); - TQT_DBusMessage reply = hardwareControl.sendWithReply("CanSetCPUGovernor", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - return reply[0].toVariant().value.toBool(); - } - else { - return FALSE; - } - } - else { - return FALSE; - } - } - else { - return FALSE; - } -#else // WITH_UPOWER - return FALSE; -#endif// WITH_UPOWER - } -} - -void TDECPUDevice::setGovernor(TQString gv) { - TQString governornode = systemPath() + "/cpufreq/scaling_governor"; - TQFile file( governornode ); - if ( file.open( IO_WriteOnly ) ) { - TQTextStream stream( &file ); - stream << gv.lower(); - file.close(); - } -#ifdef WITH_UPOWER - else { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy hardwareControl("org.trinitydesktop.hardwarecontrol", "/org/trinitydesktop/hardwarecontrol", "org.trinitydesktop.hardwarecontrol.CPUGovernor", dbusConn); - if (hardwareControl.canSend()) { - // set CPU governor - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromInt32(coreNumber()) << TQT_DBusData::fromString(gv.lower()); - hardwareControl.sendWithReply("SetCPUGovernor", params); - } - else { - return; - } - } - else { - return; - } - } -#endif // WITH_UPOWER - - // Force update of the device information object - TDEGlobal::hardwareDevices()->processModifiedCPUs(); -} - -bool TDECPUDevice::canSetMaximumScalingFrequency() { - TQString freqnode = systemPath() + "/cpufreq/scaling_max_freq"; - int rval = access (freqnode.ascii(), W_OK); - if (rval == 0) { - return TRUE; - } - else { - return FALSE; - } -} - -void TDECPUDevice::setMaximumScalingFrequency(double fr) { - TQString freqnode = systemPath() + "/cpufreq/scaling_max_freq"; - TQFile file( freqnode ); - if ( file.open( IO_WriteOnly ) ) { - TQTextStream stream( &file ); - stream << TQString("%1").arg(fr*1000000.0, 0, 'f', 0); - file.close(); - } - - // Force update of the device information object - TDEGlobal::hardwareDevices()->processModifiedCPUs(); -} - -int TDECPUDevice::coreNumber() { - return m_corenumber; -} - TDESensorDevice::TDESensorDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { } @@ -708,147 +524,6 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState return false; } -TDEBatteryDevice::TDEBatteryDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { -} - -TDEBatteryDevice::~TDEBatteryDevice() { -} - -double TDEBatteryDevice::voltage() { - return m_currentVoltage; -} - -void TDEBatteryDevice::internalSetVoltage(double vt) { - m_currentVoltage = vt; -} - -double TDEBatteryDevice::maximumVoltage() { - return m_maximumVoltage; -} - -void TDEBatteryDevice::internalSetMaximumVoltage(double vt) { - m_maximumVoltage = vt; -} - -double TDEBatteryDevice::minimumVoltage() { - return m_minimumVoltage; -} - -void TDEBatteryDevice::internalSetMinimumVoltage(double vt) { - m_minimumVoltage = vt; -} - -double TDEBatteryDevice::maximumDesignVoltage() { - return m_maximumDesignVoltage; -} - -void TDEBatteryDevice::internalSetMaximumDesignVoltage(double vt) { - m_maximumDesignVoltage = vt; -} - -double TDEBatteryDevice::energy() { - return m_currentEnergy; -} - -void TDEBatteryDevice::internalSetEnergy(double vt) { - m_currentEnergy = vt; -} - -double TDEBatteryDevice::alarmEnergy() { - return m_alarmEnergy; -} - -void TDEBatteryDevice::internalSetAlarmEnergy(double vt) { - m_alarmEnergy = vt; -} - -double TDEBatteryDevice::maximumEnergy() { - return m_maximumEnergy; -} - -void TDEBatteryDevice::internalSetMaximumEnergy(double vt) { - m_maximumEnergy = vt; -} - -double TDEBatteryDevice::maximumDesignEnergy() { - return m_maximumDesignEnergy; -} - -void TDEBatteryDevice::internalSetMaximumDesignEnergy(double vt) { - m_maximumDesignEnergy = vt; -} - -double TDEBatteryDevice::dischargeRate() { - return m_dischargeRate; -} - -void TDEBatteryDevice::internalSetDischargeRate(double vt) { - m_dischargeRate = vt; -} - -double TDEBatteryDevice::timeRemaining() { - return m_timeRemaining; -} - -void TDEBatteryDevice::internalSetTimeRemaining(double tr) { - m_timeRemaining = tr; -} - -TQString TDEBatteryDevice::technology() { - return m_technology; -} - -void TDEBatteryDevice::internalSetTechnology(TQString tc) { - m_technology = tc; -} - -TDEBatteryStatus::TDEBatteryStatus TDEBatteryDevice::status() { - return m_status; -} - -void TDEBatteryDevice::internalSetStatus(TQString tc) { - tc = tc.lower(); - - if (tc == "charging") { - m_status = TDEBatteryStatus::Charging; - } - else if (tc == "discharging") { - m_status = TDEBatteryStatus::Discharging; - } - else if (tc == "full") { - m_status = TDEBatteryStatus::Full; - } - else { - m_status = TDEBatteryStatus::Unknown; - } -} - -bool TDEBatteryDevice::installed() { - return m_installed; -} - -void TDEBatteryDevice::internalSetInstalled(bool tc) { - m_installed = tc; -} - -double TDEBatteryDevice::chargePercent() { - return (m_currentEnergy/m_maximumEnergy)*100.0; -} - -TDEMainsPowerDevice::TDEMainsPowerDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { -} - -TDEMainsPowerDevice::~TDEMainsPowerDevice() { -} - -bool TDEMainsPowerDevice::online() { - return m_online; -} - -void TDEMainsPowerDevice::internalSetOnline(bool tc) { - m_online = tc; -} - TDENetworkDevice::TDENetworkDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { m_rxbytes = -1; m_txbytes = -1; |