Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opcmciasystem.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003               =.             (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
00004             .=l.
00005            .>+-=
00006  _;:,     .>    :=|.         This program is free software; you can
00007 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00008 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00009 .="- .-=="i,     .._         License as published by the Free Software
00010  - .   .-<_>     .<>         Foundation; version 2 of the License.
00011      ._= =}       :
00012     .%`+i>       _;_.
00013     .i_,=:_.      -<s.       This program is distributed in the hope that
00014      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00015     : ..    .:,     . . .    without even the implied warranty of
00016     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00017   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00018 ..}^=.=       =       ;      Library General Public License for more
00019 ++=   -.     .`     .:       details.
00020  :     =  ...= . :.=-
00021  -.   .:....=;==+<;          You should have received a copy of the GNU
00022   -_. . .   )=.  =           Library General Public License along with
00023     --        :-=`           this library; see the file COPYING.LIB.
00024                              If not, write to the Free Software Foundation,
00025                              Inc., 59 Temple Place - Suite 330,
00026                              Boston, MA 02111-1307, USA.
00027 
00028 */
00029 
00030 #ifndef OPCMCIASYSTEM_H
00031 #define OPCMCIASYSTEM_H
00032 
00033 #include "linux_pcmcia.h"
00034 
00035 #include <qobject.h>
00036 #include <qlist.h>
00037 
00038 namespace Opie {
00039 namespace Core {
00040 
00041 class OPcmciaSocket;
00042 
00043 /*======================================================================================
00044  * OPcmciaSystem
00045  *======================================================================================*/
00046 
00054 class OPcmciaSystem : public QObject
00055 {
00056   Q_OBJECT
00057 
00058   public:
00059     typedef QList<OPcmciaSocket> CardList;
00060     typedef QListIterator<OPcmciaSocket> CardIterator;
00061 
00062   public:
00066     int count() const;
00070     int cardCount() const;
00074     static OPcmciaSystem* instance();
00078     CardIterator iterator() const;
00083     OPcmciaSocket* socket( unsigned int number );
00087     void restart();
00093     void synchronize();
00094 
00095   protected:
00096     OPcmciaSystem();
00097 
00098   private:
00099     static OPcmciaSystem* _instance;
00100     CardList _interfaces;
00101     int _major;
00102 
00103   private:
00104     class Private;
00105     Private *d;
00106 };
00107 
00108 
00109 /*======================================================================================
00110  * OPcmciaSocket
00111  *======================================================================================*/
00112 
00113 class OPcmciaSocket : public QObject
00114 {
00115   Q_OBJECT
00116   public:
00117 
00118     enum OPcmciaSocketCardStatus
00119     {
00120         Unknown             = 0,
00121         Occupied            = CS_EVENT_CARD_DETECT,
00122         OccupiedCardBus     = CS_EVENT_CB_DETECT,
00123         WriteProtected      = CS_EVENT_WRITE_PROTECT,
00124         BatteryLow          = CS_EVENT_BATTERY_LOW,
00125         BatteryDead         = CS_EVENT_BATTERY_DEAD,
00126         Ready               = CS_EVENT_READY_CHANGE,
00127         Suspended           = CS_EVENT_PM_SUSPEND,
00128         Attention           = CS_EVENT_REQUEST_ATTENTION,
00129         InsertionInProgress = CS_EVENT_CARD_INSERTION,
00130         RemovalInProgress   = CS_EVENT_CARD_REMOVAL,
00131         ThreeVolts          = CS_EVENT_3VCARD,
00132         SupportsVoltage     = CS_EVENT_XVCARD,
00133     };
00134 
00135   public:
00140     OPcmciaSocket( int major, int socket, QObject* parent, const char* name );
00144     virtual ~OPcmciaSocket();
00148     int number() const;
00152     QString identity() const;
00156     const OPcmciaSocketCardStatus status() const;
00160     bool isUnsupported() const;
00164     bool isEmpty() const;
00168     bool isSuspended() const;
00173     bool eject();
00178     bool insert();
00183     bool suspend();
00188     bool resume();
00193     bool reset();
00197     QStringList productIdentityVector() const;
00201     QString productIdentity() const;
00205     QString manufacturerIdentity() const;
00209     QString function() const;
00210 
00211   private:
00212     void init();
00213     void cleanup();
00214     bool getTuple( cisdata_t tuple ) const;
00215     int _major;
00216     int _socket;
00217     int _fd;
00218     mutable ds_ioctl_arg_t _ioctlarg;
00219 
00220   private:
00221     class Private;
00222     Private *d;
00223 };
00224 
00225 
00226 }
00227 }
00228 
00229 #endif // OPCMCIASYSTEM_H

Generated on Sat Nov 5 16:16:07 2005 for OPIE by  doxygen 1.4.2