tdebatterydevice.cpp
00001 /* This file is part of the TDE libraries 00002 Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net> 00003 (C) 2013 Golubev Alexander <fatzer2@gmail.com> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "tdebatterydevice.h" 00021 00022 #include "config.h" 00023 00024 TDEBatteryDevice::TDEBatteryDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { 00025 } 00026 00027 TDEBatteryDevice::~TDEBatteryDevice() { 00028 } 00029 00030 double TDEBatteryDevice::voltage() { 00031 return m_currentVoltage; 00032 } 00033 00034 void TDEBatteryDevice::internalSetVoltage(double vt) { 00035 m_currentVoltage = vt; 00036 } 00037 00038 double TDEBatteryDevice::maximumVoltage() { 00039 return m_maximumVoltage; 00040 } 00041 00042 void TDEBatteryDevice::internalSetMaximumVoltage(double vt) { 00043 m_maximumVoltage = vt; 00044 } 00045 00046 double TDEBatteryDevice::minimumVoltage() { 00047 return m_minimumVoltage; 00048 } 00049 00050 void TDEBatteryDevice::internalSetMinimumVoltage(double vt) { 00051 m_minimumVoltage = vt; 00052 } 00053 00054 double TDEBatteryDevice::maximumDesignVoltage() { 00055 return m_maximumDesignVoltage; 00056 } 00057 00058 void TDEBatteryDevice::internalSetMaximumDesignVoltage(double vt) { 00059 m_maximumDesignVoltage = vt; 00060 } 00061 00062 double TDEBatteryDevice::energy() { 00063 return m_currentEnergy; 00064 } 00065 00066 void TDEBatteryDevice::internalSetEnergy(double vt) { 00067 m_currentEnergy = vt; 00068 } 00069 00070 double TDEBatteryDevice::alarmEnergy() { 00071 return m_alarmEnergy; 00072 } 00073 00074 void TDEBatteryDevice::internalSetAlarmEnergy(double vt) { 00075 m_alarmEnergy = vt; 00076 } 00077 00078 double TDEBatteryDevice::maximumEnergy() { 00079 return m_maximumEnergy; 00080 } 00081 00082 void TDEBatteryDevice::internalSetMaximumEnergy(double vt) { 00083 m_maximumEnergy = vt; 00084 } 00085 00086 double TDEBatteryDevice::maximumDesignEnergy() { 00087 return m_maximumDesignEnergy; 00088 } 00089 00090 void TDEBatteryDevice::internalSetMaximumDesignEnergy(double vt) { 00091 m_maximumDesignEnergy = vt; 00092 } 00093 00094 double TDEBatteryDevice::dischargeRate() { 00095 return m_dischargeRate; 00096 } 00097 00098 void TDEBatteryDevice::internalSetDischargeRate(double vt) { 00099 m_dischargeRate = vt; 00100 } 00101 00102 double TDEBatteryDevice::timeRemaining() { 00103 return m_timeRemaining; 00104 } 00105 00106 void TDEBatteryDevice::internalSetTimeRemaining(double tr) { 00107 m_timeRemaining = tr; 00108 } 00109 00110 TQString TDEBatteryDevice::technology() { 00111 return m_technology; 00112 } 00113 00114 void TDEBatteryDevice::internalSetTechnology(TQString tc) { 00115 m_technology = tc; 00116 } 00117 00118 TDEBatteryStatus::TDEBatteryStatus TDEBatteryDevice::status() { 00119 return m_status; 00120 } 00121 00122 void TDEBatteryDevice::internalSetStatus(TQString tc) { 00123 tc = tc.lower(); 00124 00125 if (tc == "charging") { 00126 m_status = TDEBatteryStatus::Charging; 00127 } 00128 else if (tc == "discharging") { 00129 m_status = TDEBatteryStatus::Discharging; 00130 } 00131 else if (tc == "full") { 00132 m_status = TDEBatteryStatus::Full; 00133 } 00134 else { 00135 m_status = TDEBatteryStatus::Unknown; 00136 } 00137 } 00138 00139 bool TDEBatteryDevice::installed() { 00140 return m_installed; 00141 } 00142 00143 void TDEBatteryDevice::internalSetInstalled(bool tc) { 00144 m_installed = tc; 00145 } 00146 00147 double TDEBatteryDevice::chargePercent() { 00148 return (m_currentEnergy/m_maximumEnergy)*100.0; 00149 } 00150 00151 #include "tdebatterydevice.moc"
Trinity API Reference