summaryrefslogtreecommitdiffstats
path: root/wifi/interface_wireless.h
blob: ecb693ca54a8066841fe31cfbdd52755a8666338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/***************************************************************************
                          stuff.h  -  description
                             -------------------
    begin                : Mon Aug 19 2002
    copyright            : (C) 2002 by Stefan Winter
    email                : mail@stefan-winter.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef INTERFACE_WIRELESS_H
#define INTERFACE_WIRELESS_H

#include "config.h"

#include <tqobject.h>
#include <tqstring.h>
#include <tqtable.h>

#ifndef WITHOUT_ARTS
#include <arts/iomanager.h>
#include <arts/dispatcher.h>
#endif

const int POLL_DELAY_MS = 250;	// how much time between device polls
const int MAX_HISTORY = 240;	// number of device states to be saved

class Interface_wireless:public TQObject
{
  Q_OBJECT
  

public:
  Interface_wireless (TQStringList * ignoreInterfaces);
  virtual ~ Interface_wireless() { };

  virtual bool get_device_freq (double &freq);
  // true: device returned valid frequency
  virtual bool get_mode (int &mode);
  // true: device returned valid mode info
  virtual bool get_key (TQString & key, int &size, int &flags);
  // true: device has set up a valid crypto key
  virtual TQString get_essid ();
  virtual bool get_AP_info (TQString & mac, TQString & ip);
  // true: could retrieve IP, false: returned IP info invalid
  virtual TQString get_IP_info ();
  virtual double get_bitrate ();
  virtual TQString get_interface_name ();
  // if no device is attached, return empty TQString
  virtual bool get_current_quality (int &sig, int &noi, int &qua);
  // quality info is only valid when true
  virtual TQTable* get_available_networks () = 0;
  virtual bool get_has_txpower();
  virtual int get_txpower_disabled();
  virtual void setActiveDevice( TQString device ) = 0;
  // stats
  int sigLevel[MAX_HISTORY];
  int sigLevelMin, sigLevelMax;
  int noiseLevel[MAX_HISTORY];
  int noiseLevelMin, noiseLevelMax;
  int qual[MAX_HISTORY];
  bool valid[MAX_HISTORY];
  int current;
  
public slots:
  virtual bool poll_device_info () = 0;

signals:
  void interfaceChanged ();
  void strengthChanged ();
  void statusChanged ();
  void modeChanged ();
  void speedChanged ();
  void essidChanged (TQString essid);
  void txPowerChanged ();
  void statsUpdated ();
protected:
  bool already_warned;
  // device info
  bool has_frequency;
  float frequency;
  bool has_mode;
  int mode;
  bool has_key;
  TQString key;
  int key_size;
  int key_flags;
  TQString essid;
  TQString access_point_address;
  TQString ip_address;
  double bitrate;
  TQString interface_name;
  int socket;
  bool has_range;
  int range;
  TQStringList * ignoreInterfaces;
  bool has_txpower;
  int txpower_disabled;
};

#ifndef WITHOUT_ARTS

void sinus_wave (double frequency);

class MyTimeNotify:public
  Arts::TimeNotify
{
public:
  Arts::Dispatcher * test;
  MyTimeNotify (Arts::Dispatcher * siff)
  {
    test = siff;
  };
  void notifyTime ();
};

#endif

TQString whois (const char *MAC_ADR, TQStringList APList);

#endif /*  INTERFACE_WIRELESS_H */