diff options
Diffstat (limited to 'tdecore/tdehardwaredevices.h')
-rw-r--r-- | tdecore/tdehardwaredevices.h | 858 |
1 files changed, 570 insertions, 288 deletions
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h index f25d80eda..c230474a1 100644 --- a/tdecore/tdehardwaredevices.h +++ b/tdecore/tdehardwaredevices.h @@ -69,6 +69,7 @@ enum TDEGenericDeviceType { Serial, Parallel, Peripheral, + Backlight, Battery, PowerSupply, Dock, @@ -214,41 +215,21 @@ class TDECORE_EXPORT TDEGenericDevice TQString &name(); /** - * @param a TQString with the device name, if any - */ - void setName(TQString dn); - - /** * @return a TQString with the vendor name, if any */ TQString &vendorName(); /** - * @param a TQString with the vendor name, if any - */ - void setVendorName(TQString vn); - - /** * @return a TQString with the vendor model, if any */ TQString &vendorModel(); /** - * @param a TQString with the vendor model, if any - */ - void setVendorModel(TQString vm); - - /** * @return a TQString with the serial number, if any */ TQString &serialNumber(); /** - * @param a TQString with the serial number, if any - */ - void setSerialNumber(TQString sn); - - /** * @return a TQString with a friendly name * * While TDE tries very hard to generate and return a friendly name for this device, @@ -262,11 +243,6 @@ class TDECORE_EXPORT TDEGenericDevice TQString &deviceBus(); /** - * @param a TQString with the device bus name, if any - */ - void setDeviceBus(TQString db); - - /** * @return a TQString with the system path, if any * * This method is non-portable, so be careful! @@ -274,167 +250,212 @@ class TDECORE_EXPORT TDEGenericDevice TQString &systemPath(); /** - * @param a TQString with the system path, if any + * @return a TQString with the system device node, if any * * This method is non-portable, so be careful! */ - void setSystemPath(TQString sp); + TQString &deviceNode(); /** - * @return a TQString with the system device node, if any - * - * This method is non-portable, so be careful! + * @return true if this device has been blacklisted for update actions */ - TQString &deviceNode(); + bool blacklistedForUpdate(); /** - * @param a TQString with the system device node, if any - * - * This method is non-portable, so be careful! + * @return a TQString containing a unique identifier for this device */ - void setDeviceNode(TQString sn); + TQString uniqueID(); /** - * @return true if this device has been blacklisted for update actions + * @return a TQString with the vendor ID, if any */ - bool blacklistedForUpdate(); + TQString &vendorID(); /** - * @param bl true if this device has been blacklisted for update actions + * @return a TQString with the model ID, if any */ - void setBlacklistedForUpdate(bool bl); + TQString &modelID(); /** - * @return a TQString containing a unique identifier for this device + * @return a TQString with the encoded vendor, if any */ - TQString uniqueID(); + TQString &vendorEncoded(); /** - * @return a TQString with the vendor ID, if any + * @return a TQString with the encoded model, if any */ - TQString &vendorID(); + TQString &modelEncoded(); /** - * @param a TQString with the vendor ID, if any + * @return a TQString with the subvendor ID, if any */ - void setVendorID(TQString id); + TQString &subVendorID(); /** - * @return a TQString with the model ID, if any + * @return a TQString with the submodel ID, if any */ - TQString &modelID(); + TQString &subModelID(); /** - * @param a TQString with the model ID, if any + * @return a TQString with the PCI device class, if any */ - void setModelID(TQString id); + TQString &PCIClass(); /** - * @return a TQString with the encoded vendor, if any + * @return a TQString with the module alias string, if any */ - TQString &vendorEncoded(); + TQString &moduleAlias(); /** - * @param a TQString with the encoded vendor, if any + * @return a TQString with the device driver, if any */ - void setVendorEncoded(TQString id); + TQString &deviceDriver(); /** - * @return a TQString with the encoded model, if any + * @return a TQString with the subsystem type, if any */ - TQString &modelEncoded(); + TQString &subsystem(); /** - * @param a TQString with the encoded model, if any + * @return a TDEGenericDevice* with the parent device, if any */ - void setModelEncoded(TQString id); + TDEGenericDevice* parentDevice(); /** - * @return a TQString with the subvendor ID, if any + * @return a TQString containing the friendly type name */ - TQString &subVendorID(); + virtual TQString friendlyDeviceType(); /** - * @param a TQString with the subvendor ID, if any + * @return a TQString containing the device bus ID, if any */ - void setSubVendorID(TQString id); + TQString busID(); /** - * @return a TQString with the submodel ID, if any + * Get an icon for this device + * @param size a KIcon::StdSizes structure specifying the desired icon size + * @return a TQPixmap containing the icon for the specified type */ - TQString &subModelID(); + virtual TQPixmap icon(KIcon::StdSizes size); + protected: /** - * @param a TQString with the submodel ID, if any + * @param a TQString with the device name, if any + * @internal */ - void setSubModelID(TQString id); + void internalSetName(TQString dn); /** - * @return a TQString with the PCI device class, if any + * @param a TQString with the vendor name, if any + * @internal */ - TQString &PCIClass(); + void internalSetVendorName(TQString vn); /** - * @param a TQString with the PCI device class, if any + * @param a TQString with the vendor model, if any + * @internal */ - void setPCIClass(TQString cl); + void internalSetVendorModel(TQString vm); /** - * @return a TQString with the module alias string, if any + * @param a TQString with the serial number, if any + * @internal */ - TQString &moduleAlias(); + void internalSetSerialNumber(TQString sn); /** - * @param a TQString with the module alias string, if any + * @param a TQString with the device bus name, if any + * @internal */ - void setModuleAlias(TQString ma); + void internalSetDeviceBus(TQString db); /** - * @return a TQString with the device driver, if any + * @param a TQString with the system path, if any + * @internal + * + * This method is non-portable, so be careful! */ - TQString &deviceDriver(); + void internalSetSystemPath(TQString sp); /** - * @param a TQString with the device driver, if any + * @param a TQString with the system device node, if any + * @internal + * + * This method is non-portable, so be careful! */ - void setDeviceDriver(TQString dr); + void internalSetDeviceNode(TQString sn); /** - * @return a TQString with the subsystem type, if any + * @param bl true if this device has been blacklisted for update actions + * @internal */ - TQString &subsystem(); + void internalSetBlacklistedForUpdate(bool bl); /** - * @param a TQString with the subsystem type, if any + * @param a TQString with the vendor ID, if any + * @internal */ - void setSubsystem(TQString ss); + void internalSetVendorID(TQString id); /** - * @param a TDEGenericDevice* with the parent device, if any + * @param a TQString with the model ID, if any + * @internal */ - void setParentDevice(TDEGenericDevice* pd); + void internalSetModelID(TQString id); /** - * @return a TDEGenericDevice* with the parent device, if any + * @param a TQString with the encoded vendor, if any + * @internal */ - TDEGenericDevice* parentDevice(); + void internalSetVendorEncoded(TQString id); /** - * @return a TQString containing the friendly type name + * @param a TQString with the encoded model, if any + * @internal */ - virtual TQString friendlyDeviceType(); + void internalSetModelEncoded(TQString id); /** - * @return a TQString containing the device bus ID, if any + * @param a TQString with the subvendor ID, if any + * @internal */ - TQString busID(); + void internalSetSubVendorID(TQString id); /** - * Get an icon for this device - * @param size a KIcon::StdSizes structure specifying the desired icon size - * @return a TQPixmap containing the icon for the specified type + * @param a TQString with the submodel ID, if any + * @internal */ - virtual TQPixmap icon(KIcon::StdSizes size); + void internalSetSubModelID(TQString id); + + /** + * @param a TQString with the PCI device class, if any + * @internal + */ + void internalSetPCIClass(TQString cl); + + /** + * @param a TQString with the module alias string, if any + * @internal + */ + void internalSetModuleAlias(TQString ma); + + /** + * @param a TQString with the device driver, if any + * @internal + */ + void internalSetDeviceDriver(TQString dr); + + /** + * @param a TQString with the subsystem type, if any + * @internal + */ + void internalSetSubsystem(TQString ss); + + /** + * @param a TDEGenericDevice* with the parent device, if any + * @internal + */ + void internalSetParentDevice(TDEGenericDevice* pd); private: TDEGenericDeviceType::TDEGenericDeviceType m_deviceType; @@ -487,101 +508,46 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice TQString &diskLabel(); /** - * @param a TQString with the disk or partition label, if any - */ - void setDiskLabel(TQString dn); - - /** * @return a TQString with the disk UUID, if any */ TQString &diskUUID(); /** - * @param a TQString with the disk UUID, if any - */ - void setDiskUUID(TQString id); - - /** * @return an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags */ TDEDiskDeviceType::TDEDiskDeviceType diskType(); /** - * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags - */ - void setDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf); - - /** - * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags - */ - bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf); - - /** * @return an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags */ TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus(); /** - * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags - */ - void setDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st); - - /** - * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags - */ - bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf); - - /** * @return true if media inserted, false if no media available */ bool mediaInserted(); /** - * @param a bool with the media status - */ - void setMediaInserted(bool inserted); - - /** * @return a TQString with the filesystem name, if any */ TQString &fileSystemName(); /** - * @param a TQString with the filesystem name, if any - */ - void setFileSystemName(TQString fn); - - /** * @return a TQString with the filesystem usage string, if any */ TQString &fileSystemUsage(); /** - * @param a TQString with the filesystem usage string, if any - */ - void setFileSystemUsage(TQString fu); - - /** * @return a TQStringList containing system paths to all devices with a lock on this device, if any */ TQStringList &holdingDevices(); /** - * @param a TQStringList containing system paths to all devices with a lock on this device, if any - */ - void setHoldingDevices(TQStringList hd); - - /** * @return a TQStringList containing system paths to all devices locked by this device, if any */ TQStringList &slaveDevices(); /** - * @param a TQStringList containing system paths to all devices locked by this device, if any - */ - void setSlaveDevices(TQStringList sd); - - /** * Mounts the device if not encrypted * * @param a TQString containing a requested mount name under /media, if desired @@ -654,6 +620,71 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice */ TQString friendlyDeviceType(); + /** + * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags + */ + bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf); + + /** + * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags + */ + bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf); + + protected: + /** + * @param a TQString with the disk or partition label, if any + * @internal + */ + void internalSetDiskLabel(TQString dn); + + /** + * @param a TQString with the disk UUID, if any + * @internal + */ + void internalSetDiskUUID(TQString id); + + /** + * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags + * @internal + */ + void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf); + + /** + * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags + * @internal + */ + void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st); + + /** + * @param a bool with the media status + * @internal + */ + void internalSetMediaInserted(bool inserted); + + /** + * @param a TQString with the filesystem name, if any + * @internal + */ + void internalSetFileSystemName(TQString fn); + + /** + * @param a TQString with the filesystem usage string, if any + * @internal + */ + void internalSetFileSystemUsage(TQString fu); + + /** + * @param a TQStringList containing system paths to all devices with a lock on this device, if any + * @internal + */ + void internalSetHoldingDevices(TQStringList hd); + + /** + * @param a TQStringList containing system paths to all devices locked by this device, if any + * @internal + */ + void internalSetSlaveDevices(TQStringList sd); + private: TDEDiskDeviceType::TDEDiskDeviceType m_diskType; TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus; @@ -665,6 +696,8 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice TQString m_mountPath; TQStringList m_holdingDevices; TQStringList m_slaveDevices; + + friend class TDEHardwareDevices; }; class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice @@ -687,79 +720,88 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice double &frequency(); /** - * @param a double with the current CPU frequency in MHz, if available + * @return a double with the minimum CPU frequency in MHz, if available */ - void setFrequency(double fr); + double &minFrequency(); /** - * @return a double with the minimum CPU frequency in MHz, if available + * @return a double with the maximum CPU frequency in MHz, if available */ - double &minFrequency(); + double &maxFrequency(); /** - * @param a double with the minimum CPU frequency in MHz, if available + * @return a double with the transition latency in ns, if available */ - void setMinFrequency(double fr); + double &transitionLatency(); /** - * @return a double with the maximum CPU frequency in MHz, if available + * @return a TQString with the current CPU governor policy, if available */ - double &maxFrequency(); + TQString &governor(); /** - * @param a double with the maximum CPU frequency in MHz, if available + * @return a TQString with the current CPU scaling driver, if available */ - void setMaxFrequency(double fr); + TQString &scalingDriver(); /** - * @return a double with the transition latency in ns, if available + * @return a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available */ - double &transitionLatency(); + TQStringList &dependentProcessors(); /** - * @param a double with the transition latency in ns, if available + * @return a TQStringList with all valid scaling frequencies in Hz, if available */ - void setTransitionLatency(double tl); + TQStringList &availableFrequencies(); + protected: /** - * @return a TQString with the current CPU governor policy, if available + * @param a double with the current CPU frequency in MHz, if available + * @internal */ - TQString &governor(); + void internalSetFrequency(double fr); /** - * @param a TQString with the current CPU governor policy, if available + * @param a double with the minimum CPU frequency in MHz, if available + * @internal */ - void setGovernor(TQString gr); + void internalSetMinFrequency(double fr); /** - * @return a TQString with the current CPU scaling driver, if available + * @param a double with the maximum CPU frequency in MHz, if available + * @internal */ - TQString &scalingDriver(); + void internalSetMaxFrequency(double fr); /** - * @param a TQString with the current CPU scaling driver, if available + * @param a double with the transition latency in ns, if available + * @internal */ - void setScalingDriver(TQString dr); + void internalSetTransitionLatency(double tl); /** - * @return a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available + * @param a TQString with the current CPU governor policy, if available + * @internal */ - TQStringList &dependentProcessors(); + void internalSetGovernor(TQString gr); /** - * @param a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available + * @param a TQString with the current CPU scaling driver, if available + * @internal */ - void setDependentProcessors(TQStringList dp); + void internalSetScalingDriver(TQString dr); /** - * @return a TQStringList with all valid scaling frequencies in Hz, if available + * @param a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available + * @internal */ - TQStringList &availableFrequencies(); + void internalSetDependentProcessors(TQStringList dp); /** * @param a TQStringList with all valid scaling frequencies in Hz, if available + * @internal */ - void setAvailableFrequencies(TQStringList af); + void internalSetAvailableFrequencies(TQStringList af); private: double m_frequency; @@ -770,6 +812,8 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice TQString m_scalingdriver; TQStringList m_tiedprocs; TQStringList m_frequencies; + + friend class TDEHardwareDevices; }; class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice @@ -792,124 +836,137 @@ class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice double voltage(); /** - * @param a double with the current battery voltage, if available + * @return a double with the minimum battery voltage, if available */ - void setVoltage(double vt); + double minimumVoltage(); /** - * @return a double with the minimum battery voltage, if available + * @return a double with the maximum battery voltage, if available */ - double minimumVoltage(); + double maximumVoltage(); /** - * @param a double with the minimum battery voltage, if available + * @return a double with the designed maximum battery voltage, if available */ - void setMinimumVoltage(double vt); + double maximumDesignVoltage(); /** - * @return a double with the maximum battery voltage, if available + * @return a double with the current battery energy in watt-hours, if available */ - double maximumVoltage(); + double energy(); /** - * @param a double with the maximum battery voltage, if available + * @return a double with the current battery alarm energy in watt-hours, if available */ - void setMaximumVoltage(double vt); + double alarmEnergy(); /** - * @return a double with the designed maximum battery voltage, if available + * @return a double with the maximum battery energy in watt-hours, if available */ - double maximumDesignVoltage(); + double maximumEnergy(); /** - * @param a double with the designed maximum battery voltage, if available + * @return a double with the designed maximum battery energy in watt-hours, if available */ - void setMaximumDesignVoltage(double vt); + double maximumDesignEnergy(); /** - * @return a double with the current battery energy in watt-hours, if available + * @return a double with the current battery discharge rate in volt-hours, if available */ - double energy(); + double dischargeRate(); /** - * @param a double with the current battery energy in watt-hours, if available + * @return a TQString with the battery technology, if available */ - void setEnergy(double vt); + TQString &technology(); /** - * @return a double with the current battery alarm energy in watt-hours, if available + * @return a TQString with the battery status, if available */ - double alarmEnergy(); + TQString &status(); /** - * @param a double with the current battery alarm energy in watt-hours, if available + * @return TRUE if the battery is installed */ - void setAlarmEnergy(double vt); + bool installed(); /** - * @return a double with the maximum battery energy in watt-hours, if available + * @return a double with the current battery charge in percent, if available */ - double maximumEnergy(); + double chargePercent(); + protected: /** - * @param a double with the maximum battery energy in watt-hours, if available + * @param a double with the current battery voltage, if available + * @internal */ - void setMaximumEnergy(double vt); + void internalSetVoltage(double vt); /** - * @return a double with the designed maximum battery energy in watt-hours, if available + * @param a double with the minimum battery voltage, if available + * @internal */ - double maximumDesignEnergy(); + void internalSetMinimumVoltage(double vt); /** - * @param a double with the designed maximum battery energy in watt-hours, if available + * @param a double with the maximum battery voltage, if available + * @internal */ - void setMaximumDesignEnergy(double vt); + void internalSetMaximumVoltage(double vt); /** - * @return a double with the current battery discharge rate in volt-hours, if available + * @param a double with the designed maximum battery voltage, if available + * @internal */ - double dischargeRate(); + void internalSetMaximumDesignVoltage(double vt); /** - * @param a double with the current battery discharge rate in volt-hours, if available + * @param a double with the current battery energy in watt-hours, if available + * @internal */ - void setDischargeRate(double vt); + void internalSetEnergy(double vt); /** - * @return a TQString with the battery technology, if available + * @param a double with the current battery alarm energy in watt-hours, if available + * @internal */ - TQString &technology(); + void internalSetAlarmEnergy(double vt); /** - * @param a TQString with the battery technology, if available + * @param a double with the maximum battery energy in watt-hours, if available + * @internal */ - void setTechnology(TQString tc); + void internalSetMaximumEnergy(double vt); /** - * @return a TQString with the battery status, if available + * @param a double with the designed maximum battery energy in watt-hours, if available + * @internal */ - TQString &status(); + void internalSetMaximumDesignEnergy(double vt); /** - * @param a TQString with the battery status, if available + * @param a double with the current battery discharge rate in volt-hours, if available + * @internal */ - void setStatus(TQString tc); + void internalSetDischargeRate(double vt); /** - * @return TRUE if the battery is installed + * @param a TQString with the battery technology, if available + * @internal */ - bool installed(); + void internalSetTechnology(TQString tc); /** - * @param TRUE if the battery is installed + * @param a TQString with the battery status, if available + * @internal */ - void setInstalled(bool tc); + void internalSetStatus(TQString tc); /** - * @return a double with the current battery charge in percent, if available + * @param TRUE if the battery is installed + * @internal */ - double chargePercent(); + void internalSetInstalled(bool tc); private: double m_currentVoltage; @@ -924,6 +981,8 @@ class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice TQString m_technology; TQString m_status; bool m_installed; + + friend class TDEHardwareDevices; }; class TDECORE_EXPORT TDEMainsPowerDevice : public TDEGenericDevice @@ -945,13 +1004,17 @@ class TDECORE_EXPORT TDEMainsPowerDevice : public TDEGenericDevice */ bool online(); + protected: /** * @param TRUE if power supply is online via mains power, FALSE if not + * @internal */ - void setOnline(bool vt); + void internalSetOnline(bool vt); private: bool m_online; + + friend class TDEHardwareDevices; }; class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice @@ -974,159 +1037,176 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice TQString macAddress(); /** - * @param ma a TQString containing the network device's MAC address + * @return a TQString containing the network device's operational state */ - void setMacAddress(TQString ma); + TQString state(); /** - * @return a TQString containing the network device's operational state + * @return TRUE if carrier is present, FALSE if not */ - TQString state(); + bool carrierPresent(); /** - * @param st a TQString containing the network device's operational state + * @return TRUE if device is dormant, FALSE if not */ - void setState(TQString st); + bool dormant(); /** - * @return TRUE if carrier is present, FALSE if not + * @return a TQString containing the network device's IPv4 address */ - bool carrierPresent(); + TQString ipV4Address(); /** - * @param TRUE if carrier is present, FALSE if not + * @return a TQString containing the network device's IPv6 address */ - void setCarrierPresent(bool cp); + TQString ipV6Address(); /** - * @return TRUE if device is dormant, FALSE if not + * @return a TQString containing the network device's IPv4 netmask */ - bool dormant(); + TQString ipV4Netmask(); /** - * @param TRUE if device is dormant, FALSE if not + * @return a TQString containing the network device's IPv6 netmask */ - void setDormant(bool dm); + TQString ipV6Netmask(); /** - * @return a TQString containing the network device's IPv4 address + * @return a TQString containing the network device's IPv4 broadcast */ - TQString ipV4Address(); + TQString ipV4Broadcast(); /** - * @param ad a TQString containing the network device's IPv4 address + * @return a TQString containing the network device's IPv6 broadcast */ - void setIpV4Address(TQString ad); + TQString ipV6Broadcast(); /** - * @return a TQString containing the network device's IPv6 address + * @return a TQString containing the network device's IPv4 destination */ - TQString ipV6Address(); + TQString ipV4Destination(); /** - * @param ad a TQString containing the network device's IPv6 address + * @return a TQString containing the network device's IPv6 destination */ - void setIpV6Address(TQString ad); + TQString ipV6Destination(); /** - * @return a TQString containing the network device's IPv4 netmask + * @return a double with the number of received bytes, if available */ - TQString ipV4Netmask(); + double rxBytes(); /** - * @param nm a TQString containing the network device's IPv4 netmask + * @return a double with the number of transmitted bytes, if available */ - void setIpV4Netmask(TQString nm); + double txBytes(); /** - * @return a TQString containing the network device's IPv6 netmask + * @return a double with the number of received packets, if available */ - TQString ipV6Netmask(); + double rxPackets(); /** - * @param nm a TQString containing the network device's IPv6 netmask + * @return a double with the number of transmitted packets, if available */ - void setIpV6Netmask(TQString nm); + double txPackets(); + protected: /** - * @return a TQString containing the network device's IPv4 broadcast + * @param ma a TQString containing the network device's MAC address + * @internal */ - TQString ipV4Broadcast(); + void internalSetMacAddress(TQString ma); /** - * @param br a TQString containing the network device's IPv4 broadcast + * @param st a TQString containing the network device's operational state + * @internal */ - void setIpV4Broadcast(TQString br); + void internalSetState(TQString st); /** - * @return a TQString containing the network device's IPv6 broadcast + * @param TRUE if carrier is present, FALSE if not + * @internal */ - TQString ipV6Broadcast(); + void internalSetCarrierPresent(bool cp); /** - * @param br a TQString containing the network device's IPv6 broadcast + * @param TRUE if device is dormant, FALSE if not + * @internal */ - void setIpV6Broadcast(TQString br); + void internalSetDormant(bool dm); /** - * @return a TQString containing the network device's IPv4 destination + * @param ad a TQString containing the network device's IPv4 address + * @internal */ - TQString ipV4Destination(); + void internalSetIpV4Address(TQString ad); /** - * @param ds a TQString containing the network device's IPv4 destination + * @param ad a TQString containing the network device's IPv6 address + * @internal */ - void setIpV4Destination(TQString ds); + void internalSetIpV6Address(TQString ad); /** - * @return a TQString containing the network device's IPv6 destination + * @param nm a TQString containing the network device's IPv4 netmask + * @internal */ - TQString ipV6Destination(); + void internalSetIpV4Netmask(TQString nm); /** - * @param ds a TQString containing the network device's IPv6 destination + * @param nm a TQString containing the network device's IPv6 netmask + * @internal */ - void setIpV6Destination(TQString ds); + void internalSetIpV6Netmask(TQString nm); /** - * @return a double with the number of received bytes, if available + * @param br a TQString containing the network device's IPv4 broadcast + * @internal */ - double rxBytes(); + void internalSetIpV4Broadcast(TQString br); /** - * @param rx a double with the number of received bytes, if available + * @param br a TQString containing the network device's IPv6 broadcast + * @internal */ - void setRxBytes(double rx); + void internalSetIpV6Broadcast(TQString br); /** - * @return a double with the number of transmitted bytes, if available + * @param ds a TQString containing the network device's IPv4 destination + * @internal */ - double txBytes(); + void internalSetIpV4Destination(TQString ds); /** - * @param tx a double with the number of transmitted bytes, if available + * @param ds a TQString containing the network device's IPv6 destination + * @internal */ - void setTxBytes(double tx); + void internalSetIpV6Destination(TQString ds); /** - * @return a double with the number of received packets, if available + * @param rx a double with the number of received bytes, if available + * @internal */ - double rxPackets(); + void internalSetRxBytes(double rx); /** - * @param rx a double with the number of received packets, if available + * @param tx a double with the number of transmitted bytes, if available + * @internal */ - void setRxPackets(double rx); + void internalSetTxBytes(double tx); /** - * @return a double with the number of transmitted packets, if available + * @param rx a double with the number of received packets, if available + * @internal */ - double txPackets(); + void internalSetRxPackets(double rx); /** * @param tx a double with the number of transmitted packets, if available + * @internal */ - void setTxPackets(double tx); + void internalSetTxPackets(double tx); private: TQString m_macAddress; @@ -1145,7 +1225,185 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice double m_txbytes; double m_rxpackets; double m_txpackets; + + friend class TDEHardwareDevices; +}; + +namespace TDEDisplayPowerLevel { +enum TDEDisplayPowerLevel { + On, + Standby, + Suspend, + Off }; +}; + +class TDECORE_EXPORT TDEBacklightDevice : public TDEGenericDevice +{ + public: + /** + * Constructor. + * @param Device type + */ + TDEBacklightDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null); + + /** + * Destructor. + */ + ~TDEBacklightDevice(); + + /** + * @return a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level + */ + TDEDisplayPowerLevel::TDEDisplayPowerLevel powerLevel(); + + /** + * @return an integer with the number of discrete control steps available + */ + int brightnessSteps(); + + /** + * @return a double with the current brightness percentage + */ + double brightnessPercent(); + + /** + * @return TRUE if permissions allow brightness can be set, FALSE if not + */ + bool canSetBrightness(); + + /** + * @return an int with the current raw brightness + */ + int rawBrightness(); + + /** + * @param br an integer with the new raw brightness value + */ + void setRawBrightness(int br); + + protected: + /** + * @param pl a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level + * @internal + */ + void internalSetPowerLevel(TDEDisplayPowerLevel::TDEDisplayPowerLevel pl); + + /** + * @param br an integer with the maximum raw brightness value + * @internal + */ + void internalSetMaximumRawBrightness(int br); + + /** + * @param br an integer with the current raw brightness value + * @internal + */ + void internalSetCurrentRawBrightness(int br); + + private: + TDEDisplayPowerLevel::TDEDisplayPowerLevel m_powerLevel; + int m_currentBrightness; + int m_maximumBrightness; + + friend class TDEHardwareDevices; +}; + +typedef TQPair<unsigned int, unsigned int> TDEResolutionPair; +typedef TQValueList< TDEResolutionPair > TDEResolutionList; + +class TDECORE_EXPORT TDEMonitorDevice : public TDEGenericDevice +{ + public: + /** + * Constructor. + * @param Device type + */ + TDEMonitorDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null); + + /** + * Destructor. + */ + ~TDEMonitorDevice(); + + /** + * @return TRUE if a monitor is connected, FALSE if not + */ + bool connected(); + + /** + * @return TRUE if this port is enabled, FALSE if not + */ + bool enabled(); + + /** + * @return a TQByteArray containing this monitor's EDID information + */ + TQByteArray edid(); + + /** + * @return a TDEResolutionList containing this monitor's supported resolutions + */ + TDEResolutionList resolutions(); + + /** + * @return a TQString containing the display port type + */ + TQString portType(); + + /** + * @return a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level + */ + TDEDisplayPowerLevel::TDEDisplayPowerLevel powerLevel(); + + protected: + /** + * @param TRUE if a monitor is connected, FALSE if not + * @internal + */ + void internalSetConnected(bool cn); + + /** + * @param TRUE if this port is enabled, FALSE if not + * @internal + */ + void internalSetEnabled(bool en); + + /** + * @param ed a TQByteArray containing this monitor's EDID information + * @internal + */ + void internalSetEdid(TQByteArray ed); + + /** + * @param rs a TDEResolutionList containing this monitor's supported resolutions + * @internal + */ + void internalSetResolutions(TDEResolutionList rs); + + /** + * @param pt a TQString containing the display port type + * @internal + */ + void internalSetPortType(TQString pt); + + /** + * @param pl a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level + * @internal + */ + void internalSetPowerLevel(TDEDisplayPowerLevel::TDEDisplayPowerLevel pl); + + private: + bool m_connected; + bool m_enabled; + TQByteArray m_edid; + TDEResolutionList m_resolutions; + TQString m_portType; + TDEDisplayPowerLevel::TDEDisplayPowerLevel m_powerLevel; + + friend class TDEHardwareDevices; +}; + typedef TQMap<TQString, TDESensorCluster> TDESensorClusterMap; @@ -1168,13 +1426,17 @@ class TDECORE_EXPORT TDESensorDevice : public TDEGenericDevice */ TDESensorClusterMap values(); + protected: /** * @param a TDESensorClusterMap with the current sensor values + * @internal */ - void setValues(TDESensorClusterMap cl); + void internalSetValues(TDESensorClusterMap cl); private: TDESensorClusterMap m_sensorValues; + + friend class TDEHardwareDevices; }; typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList; @@ -1269,6 +1531,13 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject TQString findPNPDeviceName(TQString pnpid); /** + * Look up the monitor manufacturer in the system display database + * @param pnpid a TQString containing the display manufacturer ID + * @return a TQString containing the manufacturer name, if found + */ + TQString findMonitorManufacturerName(TQString dpyid); + + /** * Get a friendly string describing a device type * @param query a TDEGenericDeviceType::TDEGenericDeviceType specifying a device type * @return a TQString containing the friendly type name @@ -1315,6 +1584,18 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject void addCoreSystemDevices(); + /** + * Get the binary monitor EDID for the specified sysfs path + * @return a TQByteArray containing the EDID + */ + TQByteArray getEDID(TQString path); + + /** + * Get the monitor EDID name for the specified sysfs path + * @return a TQPair<TQString,TQString> containing the monitor vendor and model, if available + */ + TQPair<TQString,TQString> getEDIDMonitorName(TQString path); + struct udev *m_udevStruct; struct udev_monitor *m_udevMonitorStruct; TDEGenericHardwareList m_deviceList; @@ -1332,6 +1613,7 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject TDEDeviceIDMap* pci_id_map; TDEDeviceIDMap* usb_id_map; TDEDeviceIDMap* pnp_id_map; + TDEDeviceIDMap* dpy_id_map; friend class TDEGenericDevice; friend class TDEStorageDevice; |