klaptopdaemon
kpcmcia.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2001 George Staikos <staikos@kde.org> 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 as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 00022 #ifndef _KPCMCIA_H 00023 #define _KPCMCIA_H 00024 00025 class QTimer; 00026 class KPCMCIA; 00027 00028 #include <q3memarray.h> 00029 00030 #include <sys/types.h> 00031 00032 #define CARD_STATUS_PRESENT 1 00033 #define CARD_STATUS_READY 2 00034 #define CARD_STATUS_BUSY 4 00035 #define CARD_STATUS_SUSPEND 8 00036 #define CARD_STATUS_SUSPENDED 8 00037 00038 00039 class KPCMCIACard { 00040 friend class KPCMCIA; 00041 protected: 00042 KPCMCIACard(); 00043 ~KPCMCIACard(); 00044 00045 int _fd; 00046 00047 int _interrupt; 00048 QString _device, _ports; 00049 QString _module; 00050 QString _cardname; 00051 QString _type; 00052 int _vcc, _vpp, _vpp2; 00053 QString _stabPath; 00054 int _iotype; 00055 int _inttype; 00056 int _cfgbase; 00057 00058 int _status; 00059 int _num; 00060 00061 // Other fields for the future 00062 // etc look in linux/cs.h for more info 00063 00064 public: 00065 00069 inline int configBase() { return _cfgbase; } 00070 00074 inline int intType() { return _inttype; } 00075 00079 inline int busWidth() { return _iotype; } 00080 00084 inline bool present() { return _status & CARD_STATUS_PRESENT; } 00085 00089 inline int status() { return _status; } 00090 00094 int eject(); 00095 00099 int resume(); 00100 00104 int suspend(); 00105 00109 int reset(); 00110 00114 int insert(); 00115 00119 inline int num() { return _num; } 00120 00124 inline int irq() { return _interrupt; } 00125 00129 inline int vcc() { return _vcc; } 00130 00134 inline int vpp() { return _vpp; } 00135 00139 inline int vpp2() { return _vpp2; } 00140 00144 inline QString& name() { return _cardname; } 00145 00149 inline QString& ports() { return _ports; } 00150 00154 inline QString& device() { return _device; } 00155 00159 inline QString& type() { return _type; } 00160 00164 inline QString& driver() { return _module; } 00165 00170 int refresh(); 00171 00172 private: 00173 time_t _last; 00174 }; 00175 00176 00177 00178 00179 class KPCMCIA : public QObject { 00180 Q_OBJECT 00181 public: 00182 00183 KPCMCIA(int maxSlots = 8, const char *stabPath = "/var/run/stab"); 00184 ~KPCMCIA(); 00185 00186 void setRefreshSpeed(int msec); 00187 int getCardCount(); 00188 KPCMCIACard *getCard(int num); 00189 00190 bool haveCardServices(); 00191 00192 signals: 00193 void cardUpdated(int num); 00194 00195 00196 public slots: 00197 void updateCardInfo(); 00198 00199 private: 00200 int _refreshSpeed; 00201 QTimer *_timer; 00202 Q3MemArray<KPCMCIACard *> *_cards; 00203 int _cardCnt; 00204 bool _haveCardServices; 00205 int _maxSlots; 00206 QString _stabPath; 00207 00208 }; 00209 00210 00211 00212 00213 #endif 00214
KDE 4.0 API Reference