1 /***************************************************************************
4 begin : Mon Aug 19 2002
5 copyright : (C) 2002 by Stefan Winter
6 email : mail@stefan-winter.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #ifndef INTERFACE_WIRELESS_H
19 #define INTERFACE_WIRELESS_H
21 #include "config-wifi.h"
25 #include <QStringList>
26 #include <QAbstractTableModel>
27 #include <QVarLengthArray>
30 #include <arts/iomanager.h>
31 #include <arts/dispatcher.h>
34 const int POLL_DELAY_MS
= 250; // how much time between device polls
35 const int MAX_HISTORY
= 240; // number of device states to be saved
38 { NO_CARD
, NO_CONNECTION
, AD_HOC
, AP_CONNECT
};
40 { NONE
, VALID_HEX
, VALID_STRING
, INVALID
};
42 struct NetworkParameterData
50 class NetworkParameterDataModel
:public QAbstractTableModel
53 int rowCount ( const QModelIndex
& parent
) const;
54 int columnCount ( const QModelIndex
& parent
) const;
55 QVariant
data ( const QModelIndex
& index
, int role
) const;
56 QVariant
data ( int row
, int col
);
57 QVariant
headerData ( int section
, Qt::Orientation orientation
, int role
) const;
58 QVariant
headerData ( int row
);
59 bool setData ( const QModelIndex
& index
, const QVariant
& value
, int role
);
60 bool setData ( int row
, int col
, const QVariant
& value
);
61 Qt::ItemFlags
flags ( const QModelIndex
& index
) const;
62 public slots
:void gotFinishedIndicator ( );
63 signals
:void finishedScanning ( );
65 QVarLengthArray
< struct NetworkParameterData
>dataContainer
;
66 WEP_KEY
checkWEP ( const QString
& key
) const;
69 class Interface_wireless
:public QObject
72 Interface_wireless ( );
73 virtual ~ Interface_wireless ( )
77 virtual bool get_device_freq ( long &freq
);
78 // true: device returned valid frequency (frequency in MEGAHertz)
79 virtual bool get_mode ( int &mode
);
80 // true: device returned valid mode info
81 virtual bool get_key ( QString
& key
, int &size
, int &flags
);
82 // true: device has set up a valid crypto key
83 virtual QString
get_essid ( );
84 virtual bool get_AP_info ( QString
& mac
, QString
& ip
);
85 // true: could retrieve IP, false: returned IP info invalid
86 virtual QStringList
get_IP_info ( );
87 virtual signed long get_bitrate ( );
88 virtual QString
get_interface_name ( );
89 // if no device is attached, return empty QString
90 virtual bool get_current_quality ( int &sig
, int &noi
, int &qua
);
91 // quality info is only valid when true
92 virtual long toggleFreqChannel ( long input
) = 0;
93 // converts frequency <-> channel, frequency in MEGAHertz
94 virtual NetworkParameterDataModel
*get_available_networks ( ) = 0;
95 virtual bool get_has_txpower ( );
96 virtual int get_txpower_disabled ( );
97 virtual CARDSTATES
getDeviceState ( );
98 virtual void setActiveDevice ( QString device
) = 0;
99 virtual signed long getMaxBitrate ( );
101 int sigLevel
[MAX_HISTORY
];
102 int sigLevelMin
, sigLevelMax
;
103 int noiseLevel
[MAX_HISTORY
];
104 int noiseLevelMin
, noiseLevelMax
;
105 int qual
[MAX_HISTORY
];
106 bool valid
[MAX_HISTORY
];
109 public slots
:virtual bool poll_device_info ( ) = 0;
112 void notifyInterfaceChanged ( );
113 void strengthChanged ( int, int, int );
114 void statusChanged ( );
115 void modeChanged ( CARDSTATES
);
116 void speedChanged ( signed long );
117 void essidChanged ( QString
);
118 void txPowerChanged ( );
119 void statsUpdated ( );
132 QString access_point_address
;
133 QStringList ip_addresses
;
135 signed long maxBitrate
;
136 QString interface_name
;
140 static QStringList ignoreInterfaces
;
142 int txpower_disabled
;
143 NetworkParameterDataModel
*networks
;
148 void sinus_wave ( double frequency
);
150 class MyTimeNotify
:public
154 Arts::Dispatcher
* test
;
155 MyTimeNotify ( Arts::Dispatcher
* siff
)
164 QString
whois ( const char *MAC_ADR
, QStringList APList
);
166 #endif /* INTERFACE_WIRELESS_H */