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

tdecore

  • tdecore
  • tdehw
tdeeventdevice.h
1/* This file is part of the TDE libraries
2 Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
3 (C) 2013 Golubev Alexander <fatzer2@gmail.com>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _TDEEVENTDEVICE_H
21#define _TDEEVENTDEVICE_H
22
23#include "tdegenericdevice.h"
24
25class TDEHardwareDevices;
26
27namespace TDEEventDeviceType {
28enum TDEEventDeviceType {
29 Unknown,
30 ACPILidSwitch,
31 ACPISleepButton,
32 ACPISuspendButton,
33 ACPIPowerButton,
34 ACPIOtherInput,
35 Other = 0x80000000
36};
37};
38
39// Keep friendlySwitchList() in tdehardwaredevices.cpp in sync with this enum
40namespace TDESwitchType {
41enum TDESwitchType {
42 Null = 0x00000000,
43 Lid = 0x00000001,
44 TabletMode = 0x00000002,
45 HeadphoneInsert = 0x00000004,
46 RFKill = 0x00000008,
47 Radio = 0x00000010,
48 MicrophoneInsert = 0x00000020,
49 Dock = 0x00000040,
50 LineOutInsert = 0x00000080,
51 JackPhysicalInsert = 0x00000100,
52 VideoOutInsert = 0x00000200,
53 CameraLensCover = 0x00000400,
54 KeypadSlide = 0x00000800,
55 FrontProximity = 0x00001000,
56 RotateLock = 0x00002000,
57 LineInInsert = 0x00004000,
58 PowerButton = 0x00008000,
59 SleepButton = 0x00010000
60};
61
62inline TDESwitchType operator|(TDESwitchType a, TDESwitchType b)
63{
64 return static_cast<TDESwitchType>(static_cast<int>(a) | static_cast<int>(b));
65}
66
67inline TDESwitchType operator&(TDESwitchType a, TDESwitchType b)
68{
69 return static_cast<TDESwitchType>(static_cast<int>(a) & static_cast<int>(b));
70}
71
72inline TDESwitchType operator~(TDESwitchType a)
73{
74 return static_cast<TDESwitchType>(~static_cast<int>(a));
75}
76};
77
78class TQSocketNotifier;
79
80class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice
81{
82 TQ_OBJECT
83
84 public:
89 TDEEventDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
90
94 ~TDEEventDevice();
95
99 TDEEventDeviceType::TDEEventDeviceType eventType();
100
104 TDESwitchType::TDESwitchType providedSwitches();
105
109 TDESwitchType::TDESwitchType activeSwitches();
110
115 static TQStringList friendlySwitchList(TDESwitchType::TDESwitchType switches);
116
117 protected:
122 void internalSetEventType(TDEEventDeviceType::TDEEventDeviceType et);
123
127 void internalReadProvidedSwitches();
128
133 void internalSetProvidedSwitches(TDESwitchType::TDESwitchType sl);
134
138 void internalReadActiveSwitches();
139
144 void internalSetActiveSwitches(TDESwitchType::TDESwitchType sl);
145
150 void internalStartMonitoring(TDEHardwareDevices* hwmanager);
151
152 protected slots:
153 void eventReceived();
154 void processActiveSwitches();
155 virtual void connectNotify( const char* signal );
156
157 signals:
163 void keyPressed(unsigned int keycode, TDEEventDevice* device);
164
165 void switchChanged();
166
167 private:
168 TDEEventDeviceType::TDEEventDeviceType m_eventType;
169 TDESwitchType::TDESwitchType m_providedSwitches;
170 TDESwitchType::TDESwitchType m_switchActive;
171
172 int m_fd;
173 bool m_monitorActive;
174 TQTimer* m_watchTimer;
175 TQSocketNotifier* m_eventNotifier;
176
177 friend class TDEHardwareDevices;
178};
179
180#endif // _TDEEVENTDEVICE_H

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.