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

tdecore

tdeeventdevice.h

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 #ifndef _TDEEVENTDEVICE_H
00021 #define _TDEEVENTDEVICE_H
00022 
00023 #include "tdegenericdevice.h"
00024 
00025 class TDEHardwareDevices;
00026 
00027 namespace TDEEventDeviceType {
00028 enum TDEEventDeviceType {
00029     Unknown,
00030     ACPILidSwitch,
00031     ACPISleepButton,
00032     ACPISuspendButton,
00033     ACPIPowerButton,
00034     ACPIOtherInput,
00035     Other = 0x80000000
00036 };
00037 };
00038 
00039 // Keep friendlySwitchList() in tdehardwaredevices.cpp in sync with this enum
00040 namespace TDESwitchType {
00041 enum TDESwitchType {
00042     Null            = 0x00000000,
00043     Lid         = 0x00000001,
00044     TabletMode      = 0x00000002,
00045     HeadphoneInsert     = 0x00000004,
00046     RFKill          = 0x00000008,
00047     Radio           = 0x00000010,
00048     MicrophoneInsert    = 0x00000020,
00049     Dock            = 0x00000040,
00050     LineOutInsert       = 0x00000080,
00051     JackPhysicalInsert  = 0x00000100,
00052     VideoOutInsert      = 0x00000200,
00053     CameraLensCover     = 0x00000400,
00054     KeypadSlide     = 0x00000800,
00055     FrontProximity      = 0x00001000,
00056     RotateLock      = 0x00002000,
00057     LineInInsert        = 0x00004000,
00058     PowerButton     = 0x00008000,
00059     SleepButton     = 0x00010000
00060 };
00061 
00062 inline TDESwitchType operator|(TDESwitchType a, TDESwitchType b)
00063 {
00064     return static_cast<TDESwitchType>(static_cast<int>(a) | static_cast<int>(b));
00065 }
00066 
00067 inline TDESwitchType operator&(TDESwitchType a, TDESwitchType b)
00068 {
00069     return static_cast<TDESwitchType>(static_cast<int>(a) & static_cast<int>(b));
00070 }
00071 
00072 inline TDESwitchType operator~(TDESwitchType a)
00073 {
00074     return static_cast<TDESwitchType>(~static_cast<int>(a));
00075 }
00076 };
00077 
00078 class TQSocketNotifier;
00079 
00080 class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice
00081 {
00082     Q_OBJECT
00083 
00084     public:
00089         TDEEventDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
00090         
00094         ~TDEEventDevice();
00095 
00099         TDEEventDeviceType::TDEEventDeviceType eventType();
00100 
00104         TDESwitchType::TDESwitchType providedSwitches();
00105 
00109         TDESwitchType::TDESwitchType activeSwitches();
00110 
00115         static TQStringList friendlySwitchList(TDESwitchType::TDESwitchType switches);
00116 
00117     protected:
00122         void internalSetEventType(TDEEventDeviceType::TDEEventDeviceType et);
00123 
00127         void internalReadProvidedSwitches();
00128 
00133         void internalSetProvidedSwitches(TDESwitchType::TDESwitchType sl);
00134 
00138         void internalReadActiveSwitches();
00139 
00144         void internalSetActiveSwitches(TDESwitchType::TDESwitchType sl);
00145 
00150         void internalStartMonitoring(TDEHardwareDevices* hwmanager);
00151 
00152     protected slots:
00153         void eventReceived();
00154         void processActiveSwitches();
00155         virtual void connectNotify( const char* signal );
00156 
00157     signals:
00163         void keyPressed(unsigned int keycode, TDEEventDevice* device);
00164 
00165         void switchChanged();
00166 
00167     private:
00168         TDEEventDeviceType::TDEEventDeviceType m_eventType;
00169         TDESwitchType::TDESwitchType m_providedSwitches;
00170         TDESwitchType::TDESwitchType m_switchActive;
00171 
00172         int m_fd;
00173         bool m_monitorActive;
00174         TQTimer* m_watchTimer;
00175         TQSocketNotifier* m_eventNotifier;
00176 
00177     friend class TDEHardwareDevices;
00178 };
00179 
00180 #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.7.1
This website is maintained by Timothy Pearson.