Diffstat (limited to 'noncore/settings/networksettings2/wlan') (more/less context) (ignore whitespace changes)
10 files changed, 59 insertions, 120 deletions
diff --git a/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control b/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control index 14afd21..90f195a 100644 --- a/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control +++ b/noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control | |||
@@ -1,2 +1,2 @@ | |||
1 | Package: opie-networksettingsplugin2-wlan | 1 | Package: opie-networksettings2plugin-wlan |
2 | Files: plugins/networksettings2/libwlan.so* | 2 | Files: plugins/networksettings2/libwlan.so* |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index e4c3f60..36a5c33 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -1 +1,2 @@ | |||
1 | #include <resources.h> | ||
1 | #include "wlan_NN.h" | 2 | #include "wlan_NN.h" |
@@ -7,2 +8,7 @@ static const char * WLanNeeds[] = | |||
7 | 8 | ||
9 | static const char * WLanProvides[] = | ||
10 | { "device", | ||
11 | 0 | ||
12 | }; | ||
13 | |||
8 | /** | 14 | /** |
@@ -11,2 +17,4 @@ static const char * WLanNeeds[] = | |||
11 | WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { | 17 | WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { |
18 | NSResources->addSystemFile( | ||
19 | "interfaces", "/etc/network/interfaces", 1 ); | ||
12 | InstanceCount = 2; | 20 | InstanceCount = 2; |
@@ -36,4 +44,4 @@ const char ** WLanNetNode::needs( void ) { | |||
36 | 44 | ||
37 | const char * WLanNetNode::provides( void ) { | 45 | const char ** WLanNetNode::provides( void ) { |
38 | return "device"; | 46 | return WLanProvides; |
39 | } | 47 | } |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index c13c05c..4bffd3d 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -22,3 +22,3 @@ public: | |||
22 | virtual const char ** needs( void ); | 22 | virtual const char ** needs( void ); |
23 | virtual const char * provides( void ); | 23 | virtual const char ** provides( void ); |
24 | 24 | ||
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp index 0e4fc4c..d5b1014 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp | |||
@@ -81,5 +81,3 @@ void AWLan::commit( void ) { | |||
81 | 81 | ||
82 | short AWLan::generateFileEmbedded( const QString & ID, | 82 | short AWLan::generateFileEmbedded( SystemFile & SF, |
83 | const QString & Path, | ||
84 | QTextStream & TS, | ||
85 | long DevNr ) { | 83 | long DevNr ) { |
@@ -90,5 +88,5 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
90 | 88 | ||
91 | if( ID == "interfaces" ) { | 89 | if( SF.name() == "interfaces" ) { |
92 | Log(("Generate WLanNNI for %s\n", ID.latin1() )); | 90 | Log(("Generate WLanNNI for %s\n", SF.name().latin1() )); |
93 | TS << " wireless_essid \"" | 91 | SF << " wireless_essid \"" |
94 | << Data.ESSID | 92 | << Data.ESSID |
@@ -102,3 +100,3 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
102 | Buf[99] = '\0'; // just to make sure | 100 | Buf[99] = '\0'; // just to make sure |
103 | TS << " wireless_nick " | 101 | SF << " wireless_nick " |
104 | << Buf | 102 | << Buf |
@@ -107,3 +105,3 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
107 | } else { | 105 | } else { |
108 | TS << " wireless_nick \"" | 106 | SF << " wireless_nick \"" |
109 | << Data.NodeName | 107 | << Data.NodeName |
@@ -126,3 +124,3 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
126 | 124 | ||
127 | TS << " wireless_mode " | 125 | SF << " wireless_mode " |
128 | << M | 126 | << M |
@@ -132,3 +130,3 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
132 | if( ! Data.Key[i].isEmpty() ) { | 130 | if( ! Data.Key[i].isEmpty() ) { |
133 | TS << " wireless_key" | 131 | SF << " wireless_key" |
134 | << i | 132 | << i |
@@ -139,3 +137,3 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
139 | } | 137 | } |
140 | TS << " wireless_keymode " | 138 | SF << " wireless_keymode " |
141 | << ((Data.AcceptNonEncrypted) ? "open" : "restricted") | 139 | << ((Data.AcceptNonEncrypted) ? "open" : "restricted") |
@@ -145,3 +143,3 @@ short AWLan::generateFileEmbedded( const QString & ID, | |||
145 | } | 143 | } |
146 | rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr); | 144 | rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr); |
147 | 145 | ||
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h index a9be65f..e3251c7 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.h +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h | |||
@@ -28,5 +28,3 @@ public : | |||
28 | 28 | ||
29 | virtual short generateFileEmbedded( const QString & ID, | 29 | virtual short generateFileEmbedded( SystemFile & Sf, |
30 | const QString & Path, | ||
31 | QTextStream & TS, | ||
32 | long DevNr ); | 30 | long DevNr ); |
diff --git a/noncore/settings/networksettings2/wlan/wlandata.h b/noncore/settings/networksettings2/wlan/wlandata.h index 36990a9..f3cc1ab 100644 --- a/noncore/settings/networksettings2/wlan/wlandata.h +++ b/noncore/settings/networksettings2/wlan/wlandata.h | |||
@@ -4,3 +4,4 @@ | |||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct WLanData { | 5 | class WLanData { |
6 | public : | ||
6 | QString ESSID; | 7 | QString ESSID; |
@@ -13,3 +14,3 @@ typedef struct WLanData { | |||
13 | bool AcceptNonEncrypted; | 14 | bool AcceptNonEncrypted; |
14 | } WLanData_t; | 15 | } ; |
15 | 16 | ||
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.cpp b/noncore/settings/networksettings2/wlan/wlanedit.cpp index 8d3979e..74174bf 100644 --- a/noncore/settings/networksettings2/wlan/wlanedit.cpp +++ b/noncore/settings/networksettings2/wlan/wlanedit.cpp | |||
@@ -22,3 +22,3 @@ WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | |||
22 | WE = 0; | 22 | WE = 0; |
23 | if( ( II = Dev->assignedInterface() ) ) { | 23 | if( ( II = NNI->connection()->assignedInterface() ) ) { |
24 | // show data | 24 | // show data |
@@ -63,3 +63,3 @@ QString WLanEdit::acceptable( void ) { | |||
63 | 63 | ||
64 | void WLanEdit::showData( WLanData_t & Data ) { | 64 | void WLanEdit::showData( WLanData & Data ) { |
65 | Mode_CB->setCurrentItem( Data.Mode ); | 65 | Mode_CB->setCurrentItem( Data.Mode ); |
@@ -78,3 +78,3 @@ void WLanEdit::showData( WLanData_t & Data ) { | |||
78 | 78 | ||
79 | bool WLanEdit::commit( WLanData_t & Data ) { | 79 | bool WLanEdit::commit( WLanData & Data ) { |
80 | bool SM = 0; | 80 | bool SM = 0; |
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.h b/noncore/settings/networksettings2/wlan/wlanedit.h index e550c14..8f219d9 100644 --- a/noncore/settings/networksettings2/wlan/wlanedit.h +++ b/noncore/settings/networksettings2/wlan/wlanedit.h | |||
@@ -6,3 +6,3 @@ | |||
6 | class ANetNodeInstance; | 6 | class ANetNodeInstance; |
7 | class AsDevice; | 7 | class RuntimeInfo; |
8 | class WExtensions; | 8 | class WExtensions; |
@@ -16,4 +16,4 @@ public : | |||
16 | QString acceptable( void ); | 16 | QString acceptable( void ); |
17 | void showData( WLanData_t & Data ); | 17 | void showData( WLanData & Data ); |
18 | bool commit( WLanData_t & Data ); | 18 | bool commit( WLanData & Data ); |
19 | 19 | ||
@@ -27,3 +27,3 @@ private : | |||
27 | ANetNodeInstance * NNI; | 27 | ANetNodeInstance * NNI; |
28 | AsDevice * Dev; | 28 | RuntimeInfo * Dev; |
29 | QTimer RefreshTimer; | 29 | QTimer RefreshTimer; |
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp index 3f1d4a9..fe49c4e 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.cpp +++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp | |||
@@ -7,3 +7,3 @@ | |||
7 | 7 | ||
8 | void WLanRun::detectState( NodeCollection * NC ) { | 8 | State_t WLanRun::detectState( void ) { |
9 | 9 | ||
@@ -13,2 +13,3 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
13 | 13 | ||
14 | NodeCollection * NC = nodeCollection(); | ||
14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 15 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
@@ -31,6 +32,4 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
31 | if( X == Run->Name ) { | 32 | if( X == Run->Name ) { |
32 | Run->assignNode( netNode() ); | 33 | NC->assignInterface( Run ); |
33 | assignInterface( Run ); | 34 | return IsUp; |
34 | NC->setCurrentState( IsUp ); | ||
35 | return; | ||
36 | } | 35 | } |
@@ -40,3 +39,3 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
40 | 39 | ||
41 | if( ( Run = assignedInterface() ) ) { | 40 | if( ( Run = NC->assignedInterface() ) ) { |
42 | // we already have an interface assigned -> still present ? | 41 | // we already have an interface assigned -> still present ? |
@@ -44,4 +43,3 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
44 | // usb is still free -> keep assignment | 43 | // usb is still free -> keep assignment |
45 | NC->setCurrentState( Available ); | 44 | return Available; |
46 | return; | ||
47 | } // else interface is up but NOT us -> some other profile | 45 | } // else interface is up but NOT us -> some other profile |
@@ -50,3 +48,3 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
50 | // nothing (valid) assigned to us | 48 | // nothing (valid) assigned to us |
51 | assignInterface( 0 ); | 49 | NC->assignInterface( 0 ); |
52 | 50 | ||
@@ -66,9 +64,7 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
66 | // proper type, and Not UP -> free | 64 | // proper type, and Not UP -> free |
67 | NC->setCurrentState( Off ); | 65 | return Off; |
68 | return; | ||
69 | } | 66 | } |
70 | } | 67 | } |
71 | // no free found | ||
72 | 68 | ||
73 | NC->setCurrentState( Unavailable ); | 69 | return Unavailable; |
74 | 70 | ||
@@ -76,67 +72,6 @@ void WLanRun::detectState( NodeCollection * NC ) { | |||
76 | 72 | ||
77 | bool WLanRun::setState( NodeCollection * NC, Action_t A, bool ) { | 73 | QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) { |
78 | 74 | ||
79 | // we only handle activate and deactivate | 75 | // we only handle activate and deactivate |
80 | switch( A ) { | 76 | return QString(); |
81 | case Activate : | ||
82 | { | ||
83 | if( NC->currentState() != Off ) { | ||
84 | return 0; | ||
85 | } | ||
86 | InterfaceInfo * N = getInterface(); | ||
87 | if( ! N ) { | ||
88 | // no interface available | ||
89 | NC->setCurrentState( Unavailable ); | ||
90 | return 0; | ||
91 | } | ||
92 | // because we were OFF the interface | ||
93 | // we get back is NOT assigned | ||
94 | N->assignNode( netNode() ); | ||
95 | assignInterface( N ); | ||
96 | NC->setCurrentState( Available ); | ||
97 | return 1; | ||
98 | } | ||
99 | case Deactivate : | ||
100 | if( NC->currentState() == IsUp ) { | ||
101 | // bring down first | ||
102 | if( ! connection()->setState( Down ) ) | ||
103 | // could not ... | ||
104 | return 0; | ||
105 | } else if( NC->currentState() != Available ) { | ||
106 | return 1; | ||
107 | } | ||
108 | assignedInterface()->assignNode( 0 ); // release | ||
109 | assignInterface( 0 ); | ||
110 | NC->setCurrentState( Off ); | ||
111 | return 1; | ||
112 | default : | ||
113 | // FT | ||
114 | break; | ||
115 | } | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | bool WLanRun::canSetState( State_t Curr, Action_t A ) { | ||
120 | // we only handle up down activate and deactivate | ||
121 | switch( A ) { | ||
122 | case Activate : | ||
123 | { // at least available | ||
124 | if( Curr == Available ) { | ||
125 | return 1; | ||
126 | } | ||
127 | // or we can make one available | ||
128 | InterfaceInfo * N = getInterface(); | ||
129 | if( ! N || N->assignedNode() != 0 ) { | ||
130 | // non available or assigned | ||
131 | return 0; | ||
132 | } | ||
133 | return 1; | ||
134 | } | ||
135 | case Deactivate : | ||
136 | return ( Curr >= Available ); | ||
137 | default : | ||
138 | // FT | ||
139 | break; | ||
140 | } | ||
141 | return 0; | ||
142 | } | 77 | } |
@@ -161,6 +96,6 @@ InterfaceInfo * WLanRun::getInterface( void ) { | |||
161 | // this is a LAN card | 96 | // this is a LAN card |
162 | if( Run->assignedNode() == netNode() ) { | 97 | if( Run->assignedConnection() == netNode()->connection() ) { |
163 | // assigned to us | 98 | // assigned to us |
164 | return Run; | 99 | return Run; |
165 | } else if( Run->assignedNode() == 0 ) { | 100 | } else if( Run->assignedConnection() == 0 ) { |
166 | // free | 101 | // free |
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h index 25d5b96..fd325d4 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.h +++ b/noncore/settings/networksettings2/wlan/wlanrun.h | |||
@@ -4,6 +4,6 @@ | |||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asdevice.h> | 5 | #include <netnode.h> |
6 | #include "wlandata.h" | 6 | #include "wlandata.h" |
7 | 7 | ||
8 | class WLanRun : public AsDevice { | 8 | class WLanRun : public RuntimeInfo { |
9 | 9 | ||
@@ -12,16 +12,9 @@ public : | |||
12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : | 12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : |
13 | AsDevice( NNI ), | 13 | RuntimeInfo( NNI ), |
14 | Pat( "wlan[0-9]" ) | 14 | Pat( "wlan[0-9]" ) { |
15 | { } | 15 | } |
16 | 16 | ||
17 | virtual AsDevice * device( void ) | 17 | virtual RuntimeInfo * device( void ) |
18 | { return (AsDevice *)this; } | 18 | { return this; } |
19 | virtual AsDevice * asDevice( void ) | ||
20 | { return (AsDevice *)this; } | ||
21 | 19 | ||
22 | protected : | ||
23 | |||
24 | void detectState( NodeCollection * ); | ||
25 | bool setState( NodeCollection *, Action_t, bool ); | ||
26 | bool canSetState( State_t, Action_t ); | ||
27 | bool handlesInterface( const QString & I ); | 20 | bool handlesInterface( const QString & I ); |
@@ -29,2 +22,8 @@ protected : | |||
29 | 22 | ||
23 | State_t detectState( void ); | ||
24 | |||
25 | protected : | ||
26 | |||
27 | QString setMyState( NodeCollection * , Action_t, bool ); | ||
28 | |||
30 | private : | 29 | private : |