summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/linux/opcmciasystem.h
Unidiff
Diffstat (limited to 'libopie2/opiecore/linux/opcmciasystem.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/linux/opcmciasystem.h74
1 files changed, 58 insertions, 16 deletions
diff --git a/libopie2/opiecore/linux/opcmciasystem.h b/libopie2/opiecore/linux/opcmciasystem.h
index 694bf16..4b445aa 100644
--- a/libopie2/opiecore/linux/opcmciasystem.h
+++ b/libopie2/opiecore/linux/opcmciasystem.h
@@ -22,108 +22,150 @@
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#ifndef OPCMCIASYSTEM_H 30#ifndef OPCMCIASYSTEM_H
31#define OPCMCIASYSTEM_H 31#define OPCMCIASYSTEM_H
32 32
33#include <qobject.h> 33#include <qobject.h>
34#include <qdict.h> 34#include <qlist.h>
35#include <qmap.h>
36 35
37namespace Opie { 36namespace Opie {
38namespace Core { 37namespace Core {
39 38
40class OPcmciaCard; 39class OPcmciaSocket;
41 40
42/*====================================================================================== 41/*======================================================================================
43 * OPcmciaSystem 42 * OPcmciaSystem
44 *======================================================================================*/ 43 *======================================================================================*/
45 44
46/** 45/**
47 * @brief A container class for the linux pcmcia subsystem 46 * @brief A container class for the linux pcmcia subsystem
48 * 47 *
49 * This class provides access to all available pcmcia/cf cards on your device. 48 * This class provides access to all available pcmcia/cf cards on your device.
50 * 49 *
51 * @author Michael 'Mickey' Lauer <mickey@Vanille.de> 50 * @author Michael 'Mickey' Lauer <mickey@Vanille.de>
52 */ 51 */
53class OPcmciaSystem : public QObject 52class OPcmciaSystem : public QObject
54{ 53{
55 Q_OBJECT 54 Q_OBJECT
56 55
57 public: 56 public:
58 typedef QDict<OPcmciaCard> CardMap; 57 typedef QList<OPcmciaSocket> CardList;
59 typedef QDictIterator<OPcmciaCard> CardIterator; 58 typedef QListIterator<OPcmciaSocket> CardIterator;
60 59
61 public: 60 public:
62 /** 61 /**
63 * @returns the number of available interfaces 62 * @returns the number of available sockets
64 */ 63 */
65 int count() const; 64 int count() const;
66 /** 65 /**
66 * @returns the number of populated sockets
67 */
68 int cardCount() const;
69 /**
67 * @returns a pointer to the (one and only) @ref OSystem instance. 70 * @returns a pointer to the (one and only) @ref OSystem instance.
68 */ 71 */
69 static OPcmciaSystem* instance(); 72 static OPcmciaSystem* instance();
70 /** 73 /**
71 * @returns an iterator usable for iterating through all sound cards. 74 * @returns an iterator usable for iterating through all sound cards.
72 */ 75 */
73 CardIterator iterator() const; 76 CardIterator iterator() const;
74 /** 77 /**
75 * @returns a pointer to the @ref OAudioInterface object for the specified @a interface or 0, if not found 78 * @returns a pointer to the @ref OPcmciaSocket object correspinding to socket number n, or 0, if not found
76 * @see OAudioInterface 79 * @see OPcmciaSocket
77 */ 80 */
78 OPcmciaCard* card( const QString& interface ) const; 81 OPcmciaSocket* socket( unsigned int number );
79 /** 82 /**
80 * @internal Rebuild the internal interface database 83 * @internal Rebuild the internal database
81 * @note Sometimes it might be useful to call this from client code, 84 * @note Sometimes it might be useful to call this from client code,
82 * e.g. after issuing a cardctl insert 85 * e.g. after issuing a cardctl insert
83 */ 86 */
84 void synchronize(); 87 void synchronize();
85 88
86 protected: 89 protected:
87 OPcmciaSystem(); 90 OPcmciaSystem();
88 91
89 private: 92 private:
90 static OPcmciaSystem* _instance; 93 static OPcmciaSystem* _instance;
91 CardMap _interfaces; 94 CardList _interfaces;
92 class Private; 95 class Private;
93 Private *d; 96 Private *d;
94}; 97};
95 98
96 99
97/*====================================================================================== 100/*======================================================================================
98 * OPcmciaCard 101 * OPcmciaSocket
99 *======================================================================================*/ 102 *======================================================================================*/
100 103
101class OPcmciaCard : public QObject 104class OPcmciaSocket : public QObject
102{ 105{
103 Q_OBJECT 106 Q_OBJECT
104 107
105 public: 108 public:
106 /** 109 /**
107 * Constructor. Normally you don't create @ref OPcmciaCard objects yourself, 110 * Constructor. Normally you don't create @ref OPcmciaSocket objects yourself,
108 * but access them via @ref OPcmciaSystem::card(). 111 * but access them via @ref OPcmciaSystem::card().
109 */ 112 */
110 OPcmciaCard( QObject* parent, const char* name ); 113 OPcmciaSocket( int socket, QObject* parent, const char* name );
111 /** 114 /**
112 * Destructor. 115 * Destructor.
113 */ 116 */
114 virtual ~OPcmciaCard(); 117 virtual ~OPcmciaSocket();
118 /**
119 * @returns the corresponding socket number
120 */
121 int number() const;
122 /**
123 * @returns the identification string of the card in this socket, or "<Empty Socket>"
124 */
125 QString identity() const;
126 /**
127 * @returns true, if the socket is empty
128 */
129 bool isEmpty() const;
130 /**
131 * @returns true, if the socket is suspended
132 */
133 bool isSuspended() const;
134 /**
135 * Eject card. @returns true, if operation succeeded
136 * @note: This operation needs root privileges
137 */
138 bool eject();
139 /**
140 * Insert card. @returns true, if operation succeeded
141 * @note: This operation needs root privileges
142 */
143 bool insert();
144 /**
145 * Suspend card. @returns true, if operation succeeded
146 * @note: This operation needs root privileges
147 */
148 bool suspend();
149 /**
150 * Resume card. @returns true, if operation succeeded
151 * @note: This operation needs root privileges
152 */
153 bool resume();
115 154
116 protected: 155 protected:
117 156
118 private: 157 private:
119 void init(); 158 void init();
159 bool command( const QString& cmd );
160 int _socket;
161
120 private: 162 private:
121 class Private; 163 class Private;
122 Private *d; 164 Private *d;
123}; 165};
124 166
125 167
126} 168}
127} 169}
128 170
129#endif // OPCMCIASYSTEM_H 171#endif // OPCMCIASYSTEM_H