summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehardwaredevices.h
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-15 16:27:53 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-15 16:27:53 -0500
commit632a87af39e5d4abc909f9a63624f77fc502aee5 (patch)
tree09efaa38d65002d1adbc254ad6189749a83c892a /tdecore/tdehardwaredevices.h
parentfde8fcb186c2d1e0654bfaa684f5f16e0b1dc9f9 (diff)
downloadtdelibs-632a87af39e5d4abc909f9a63624f77fc502aee5.tar.gz
tdelibs-632a87af39e5d4abc909f9a63624f77fc502aee5.zip
Add key device monitoring support
Diffstat (limited to 'tdecore/tdehardwaredevices.h')
-rw-r--r--tdecore/tdehardwaredevices.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index 9061ad7fc..8eb21d92d 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -191,8 +191,10 @@ class TDECORE_EXPORT TDESensorCluster
double critical;
};
-class TDECORE_EXPORT TDEGenericDevice
+class TDECORE_EXPORT TDEGenericDevice : public TQObject
{
+ Q_OBJECT
+
public:
/**
* Constructor.
@@ -916,7 +918,7 @@ class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice
double maximumDesignEnergy();
/**
- * @return a double with the current battery discharge rate in volt-hours, if available
+ * @return a double with the current battery discharge rate in watt-hours, if available
*/
double dischargeRate();
@@ -1693,8 +1695,12 @@ inline TDESwitchType operator~(TDESwitchType a)
}
};
+class TQSocketNotifier;
+
class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice
{
+ Q_OBJECT
+
public:
/**
* Constructor.
@@ -1747,12 +1753,31 @@ class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice
*/
void internalSetActiveSwitches(TDESwitchType::TDESwitchType sl);
+ /**
+ * @param hwmanager the master hardware manager
+ * @internal
+ */
+ void internalStartFdMonitoring(TDEHardwareDevices* hwmanager);
+
+ protected slots:
+ void eventReceived();
+
+ signals:
+ /**
+ * @param keycode the code of the key that was pressed/released
+ * See include/linux/input.h for a complete list of keycodes
+ * @param device a TDEEventDevice* with the device that received the event
+ */
+ void keyPressed(unsigned int keycode, TDEEventDevice* device);
+
private:
TDEEventDeviceType::TDEEventDeviceType m_eventType;
TDESwitchType::TDESwitchType m_providedSwitches;
TDESwitchType::TDESwitchType m_switchActive;
int m_fd;
+ bool m_fdMonitorActive;
+ TQSocketNotifier* m_eventNotifier;
friend class TDEHardwareDevices;
};
@@ -1802,7 +1827,6 @@ class TDECORE_EXPORT TDEInputDevice : public TDEGenericDevice
typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList;
typedef TQMap<TQString, TQString> TDEDeviceIDMap;
-class TQSocketNotifier;
class KSimpleDirWatch;
class TDECORE_EXPORT TDEHardwareDevices : public TQObject
@@ -1944,11 +1968,19 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
void hardwareUpdated(TDEGenericDevice*);
void mountTableModified();
+ /**
+ * @param keycode the code of the key that was pressed/released
+ * See include/linux/input.h for a complete list of keycodes
+ * @param device a TDEEventDevice* with the device that received the event
+ */
+ void eventDeviceKeyPressed(unsigned int keycode, TDEEventDevice* device);
+
private slots:
void processHotPluggedHardware();
void processModifiedMounts();
void processModifiedCPUs();
void processStatelessDevices();
+ void processEventDeviceKeyPressed(unsigned int keycode, TDEEventDevice* edevice);
private:
void updateBlacklists(TDEGenericDevice* hwdevice, udev_device* dev);