• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • tdehw
tdehardwaredevices.h
1 /* This file is part of the TDE libraries
2  Copyright (C) 2012-2014 Timothy Pearson <kb9vqf@pearsoncomputing.net>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #ifndef _TDEHARDWAREDEVICES_H
19 #define _TDEHARDWAREDEVICES_H
20 
21 
22 // TDE includes
23 #include <tqobject.h>
24 #include <tqptrlist.h>
25 #include <tqmap.h>
26 #include <tqdict.h>
27 #include <tqstring.h>
28 #include <tqstringlist.h>
29 
30 #include "tdelibs_export.h"
31 #include "kicontheme.h"
32 
33 #include "tdehwcommontypes.h"
34 
35 // FIXME delete those headers after complete fixing everything in over modules
36 #include "tdegenericdevice.h"
37 #include "kiconloader.h"
38 extern "C" {
39 #include <libudev.h>
40 }
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <locale.h>
44 #include <unistd.h>
45 #include "tdestoragedevice.h"
46 #include "tdecpudevice.h"
47 #include "tdebatterydevice.h"
48 #include "tdemainspowerdevice.h"
49 #include "tdenetworkdevice.h"
50 #include "tdebacklightdevice.h"
51 #include "tdemonitordevice.h"
52 #include "tdesensordevice.h"
53 #include "tderootsystemdevice.h"
54 #include "tdeeventdevice.h"
55 #include "tdeinputdevice.h"
56 
62 struct udev_device;
63 
64 class KSimpleDirWatch;
65 
66 class TDEGenericDevice;
67 class TDEStorageDevice;
68 class TDENetworkDevice;
69 class TDEBacklightDevice;
70 class TDEMonitorDevice;
71 class TDESensorDevice;
72 class TDERootSystemDevice;
73 class TDEEventDevice;
74 class TDEInputDevice;
75 class TQSocketNotifier;
76 
77 typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList;
78 typedef TQMap<TQString, TQString> TDEDeviceIDMap;
79 typedef TQDict<TDECPUDevice> TDECPUDeviceCache;
80 
81 class TDECORE_EXPORT TDEHardwareDevices : public TQObject
82 {
83  Q_OBJECT
84 
85  public:
89  TDEHardwareDevices();
90 
94  ~TDEHardwareDevices();
95 
106  bool queryHardwareInformation();
107 
112  TDEGenericHardwareList listAllPhysicalDevices();
113 
119  TDEGenericHardwareList listByDeviceClass(TDEGenericDeviceType::TDEGenericDeviceType cl);
120 
125  TDEGenericDevice* findBySystemPath(TQString syspath);
126 
131  TDEGenericDevice* findByUniqueID(TQString uid);
132 
137  TDEGenericDevice* findByDeviceNode(TQString devnode);
138 
143  TDEStorageDevice* findDiskByUID(TQString uid);
144 
149  TDECPUDevice* findCPUBySystemPath(TQString syspath, bool inCache);
150 
159  TQString findPCIDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid);
160 
169  TQString findUSBDeviceName(TQString vendorid, TQString modelid, TQString subvendorid, TQString submodelid);
170 
176  TQString findPNPDeviceName(TQString pnpid);
177 
183  TQString findMonitorManufacturerName(TQString dpyid);
184 
190  TQString getFriendlyDeviceTypeStringFromType(TDEGenericDeviceType::TDEGenericDeviceType query);
191 
198  TQPixmap getDeviceTypeIconFromType(TDEGenericDeviceType::TDEGenericDeviceType query, TDEIcon::StdSizes size);
199 
204  TDERootSystemDevice* rootSystemDevice();
205 
211  void rescanDeviceInformation(TDEGenericDevice* hwdevice);
212 
221  void rescanDeviceInformation(TDEGenericDevice* hwdevice, bool regenerateDeviceTree);
222 
230  void setTriggerlessHardwareUpdatesEnabled(bool enable);
231 
239  void setBatteryUpdatesEnabled(bool enable);
240 
246  static TQString bytesToFriendlySizeString(double bytes);
247 
248  signals:
249  void hardwareAdded(TDEGenericDevice*);
250  void hardwareRemoved(TDEGenericDevice*);
251  void hardwareUpdated(TDEGenericDevice*);
252  void mountTableModified();
253  void hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString uuid);
254 
260  void eventDeviceKeyPressed(unsigned int keycode, TDEEventDevice* device);
261 
262  private slots:
263  void processHotPluggedHardware();
264  void processModifiedMounts();
265  void processModifiedCPUs();
266  void processBatteryDevices();
267  void processStatelessDevices();
268  void processEventDeviceKeyPressed(unsigned int keycode, TDEEventDevice* edevice);
269 
270  private:
271  void updateBlacklists(TDEGenericDevice* hwdevice, udev_device* dev);
272 
273  private:
274  TDEGenericDevice *classifyUnknownDevice(udev_device* dev, TDEGenericDevice* existingdevice=0, bool force_full_classification=true);
275  TDEGenericDevice *classifyUnknownDeviceByExternalRules(udev_device* dev, TDEGenericDevice* existingdevice=0, bool classifySubDevices=false);
276  void updateExistingDeviceInformation(TDEGenericDevice* existingdevice, udev_device* dev=NULL);
277 
278  void updateParentDeviceInformation();
279  void updateParentDeviceInformation(TDEGenericDevice* hwdevice);
280 
281  void addCoreSystemDevices();
282 
287  TQByteArray getEDID(TQString path);
288 
293  TQPair<TQString,TQString> getEDIDMonitorName(TQString path);
294 
295  struct udev *m_udevStruct;
296  struct udev_monitor *m_udevMonitorStruct;
297  TDEGenericHardwareList m_deviceList, m_deviceListPrc;
298  int m_procMountsFd;
299  KSimpleDirWatch* m_cpuWatch;
300  TQTimer* m_cpuWatchTimer;
301  TQTimer* m_batteryWatchTimer;
302  TQTimer* m_deviceWatchTimer;
303 
304  TQSocketNotifier* m_devScanNotifier;
305  TQSocketNotifier* m_mountScanNotifier;
306 
307  TQMap<TQString, bool> m_mountTable;
308  TQStringList m_cpuInfo;
309 
310  TDEDeviceIDMap* pci_id_map;
311  TDEDeviceIDMap* usb_id_map;
312  TDEDeviceIDMap* pnp_id_map;
313  TDEDeviceIDMap* dpy_id_map;
314 
315  TDECPUDeviceCache m_cpuByPathCache;
316 
317  TDEGenericDevice *hwdevicePrc;
318 
319  friend class TDEGenericDevice;
320  friend class TDEStorageDevice;
321  friend class TDECPUDevice;
322 };
323 
324 #endif // _TDEHARDWAREDEVICES_H
TDEIcon::StdSizes
StdSizes
These are the standard sizes for icons.
Definition: kicontheme.h:112
KSimpleDirWatch
KSimpleDirWatch is a basic copy of KDirWatch but with the TDEIO linking requirement removed...
Definition: ksimpledirwatch.h:66

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.