summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/wlan
authorwimpie <wimpie>2005-01-04 01:35:26 (UTC)
committer wimpie <wimpie>2005-01-04 01:35:26 (UTC)
commita9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (side-by-side diff)
tree13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/settings/networksettings2/wlan
parent48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff)
downloadopie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.zip
opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.gz
opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.bz2
CONTROL files : changed version string
NS2 many changes and first release of OT2
Diffstat (limited to 'noncore/settings/networksettings2/wlan') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/wlan/opie-networksettings2plugin-wlan.control2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp12
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.h2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp22
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.h4
-rw-r--r--noncore/settings/networksettings2/wlan/wlandata.h5
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.cpp6
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.h8
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.cpp91
-rw-r--r--noncore/settings/networksettings2/wlan/wlanrun.h27
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,4 +1,4 @@
-Package: opie-networksettingsplugin2-wlan
+Package: opie-networksettings2plugin-wlan
Files: plugins/networksettings2/libwlan.so*
Priority: optional
Section: opie/settings
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,3 +1,4 @@
+#include <resources.h>
#include "wlan_NN.h"
#include "wlan_NNI.h"
@@ -5,10 +6,17 @@ static const char * WLanNeeds[] =
{ 0
};
+static const char * WLanProvides[] =
+ { "device",
+ 0
+ };
+
/**
* Constructor, find all of the possible interfaces
*/
WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) {
+ NSResources->addSystemFile(
+ "interfaces", "/etc/network/interfaces", 1 );
InstanceCount = 2;
}
@@ -34,8 +42,8 @@ const char ** WLanNetNode::needs( void ) {
return WLanNeeds;
}
-const char * WLanNetNode::provides( void ) {
- return "device";
+const char ** WLanNetNode::provides( void ) {
+ return WLanProvides;
}
QString WLanNetNode::genNic( long nr ) {
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
@@ -20,7 +20,7 @@ public:
virtual const QString nodeDescription() ;
virtual ANetNodeInstance * createInstance( void );
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
virtual long instanceCount( void )
{ return InstanceCount; }
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
@@ -79,18 +79,16 @@ void AWLan::commit( void ) {
setModified( 1 );
}
-short AWLan::generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+short AWLan::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
short rvl, rvd;
rvl = 1;
- if( ID == "interfaces" ) {
- Log(("Generate WLanNNI for %s\n", ID.latin1() ));
- TS << " wireless_essid \""
+ if( SF.name() == "interfaces" ) {
+ Log(("Generate WLanNNI for %s\n", SF.name().latin1() ));
+ SF << " wireless_essid \""
<< Data.ESSID
<< "\""
<< endl;
@@ -100,12 +98,12 @@ short AWLan::generateFileEmbedded( const QString & ID,
char Buf[100];
if( gethostname(Buf, sizeof(Buf) ) == 0 ) {
Buf[99] = '\0'; // just to make sure
- TS << " wireless_nick "
+ SF << " wireless_nick "
<< Buf
<< endl;
}
} else {
- TS << " wireless_nick \""
+ SF << " wireless_nick \""
<< Data.NodeName
<< "\""
<< endl;
@@ -124,26 +122,26 @@ short AWLan::generateFileEmbedded( const QString & ID,
break;
}
- TS << " wireless_mode "
+ SF << " wireless_mode "
<< M
<< endl;
if( Data.Encrypted ) {
for( int i = 0; i < 4; i ++ ) {
if( ! Data.Key[i].isEmpty() ) {
- TS << " wireless_key"
+ SF << " wireless_key"
<< i
<< " "
<< Data.Key[i]
<< endl;
}
}
- TS << " wireless_keymode "
+ SF << " wireless_keymode "
<< ((Data.AcceptNonEncrypted) ? "open" : "restricted")
<< endl;
}
rvl = 0;
}
- rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr);
+ rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr);
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
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
@@ -26,9 +26,7 @@ public :
virtual void * data( void )
{ return (void *)&Data; }
- virtual short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFileEmbedded( SystemFile & Sf,
long DevNr );
protected :
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
@@ -2,7 +2,8 @@
#define WLAN_DATA_H
#include <qstring.h>
-typedef struct WLanData {
+class WLanData {
+public :
QString ESSID;
QString NodeName;
short Mode;
@@ -11,6 +12,6 @@ typedef struct WLanData {
bool Encrypted;
QString Key[4];
bool AcceptNonEncrypted;
-} WLanData_t;
+} ;
#endif
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
@@ -20,7 +20,7 @@ WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
NNI = TNNI;
Dev = NNI->runtime()->device();
WE = 0;
- if( ( II = Dev->assignedInterface() ) ) {
+ if( ( II = NNI->connection()->assignedInterface() ) ) {
// show data
WE = new WExtensions( II->Name );
@@ -61,7 +61,7 @@ QString WLanEdit::acceptable( void ) {
return QString();
}
-void WLanEdit::showData( WLanData_t & Data ) {
+void WLanEdit::showData( WLanData & Data ) {
Mode_CB->setCurrentItem( Data.Mode );
ESSID_LE->setText( Data.ESSID );
NodeName_LE->setText( Data.NodeName );
@@ -76,7 +76,7 @@ void WLanEdit::showData( WLanData_t & Data ) {
Key4_LE->setText( Data.Key[3] );
}
-bool WLanEdit::commit( WLanData_t & Data ) {
+bool WLanEdit::commit( WLanData & Data ) {
bool SM = 0;
TXTM( Data.ESSID, ESSID_LE, SM );
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
@@ -4,7 +4,7 @@
#include "wlanGUI.h"
class ANetNodeInstance;
-class AsDevice;
+class RuntimeInfo;
class WExtensions;
class WLanEdit : public WLanGUI {
@@ -14,8 +14,8 @@ public :
WLanEdit( QWidget * parent, ANetNodeInstance * NNI );
~WLanEdit( void );
QString acceptable( void );
- void showData( WLanData_t & Data );
- bool commit( WLanData_t & Data );
+ void showData( WLanData & Data );
+ bool commit( WLanData & Data );
public slots :
@@ -25,7 +25,7 @@ public slots :
private :
ANetNodeInstance * NNI;
- AsDevice * Dev;
+ RuntimeInfo * Dev;
QTimer RefreshTimer;
WExtensions * WE;
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
@@ -5,12 +5,13 @@
#include <resources.h>
#include "wlanrun.h"
-void WLanRun::detectState( NodeCollection * NC ) {
+State_t WLanRun::detectState( void ) {
// unavailable : no card found
// available : card found and assigned to us or free
// up : card found and assigned to us and up
+ NodeCollection * NC = nodeCollection();
QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number());
System & Sys = NSResources->system();
InterfaceInfo * Run;
@@ -29,26 +30,23 @@ void WLanRun::detectState( NodeCollection * NC ) {
++It ) {
Run = It.current();
if( X == Run->Name ) {
- Run->assignNode( netNode() );
- assignInterface( Run );
- NC->setCurrentState( IsUp );
- return;
+ NC->assignInterface( Run );
+ return IsUp;
}
}
}
}
- if( ( Run = assignedInterface() ) ) {
+ if( ( Run = NC->assignedInterface() ) ) {
// we already have an interface assigned -> still present ?
if( ! Run->IsUp ) {
// usb is still free -> keep assignment
- NC->setCurrentState( Available );
- return;
+ return Available;
} // else interface is up but NOT us -> some other profile
}
// nothing (valid) assigned to us
- assignInterface( 0 );
+ NC->assignInterface( 0 );
// find possible interface
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
@@ -64,81 +62,18 @@ void WLanRun::detectState( NodeCollection * NC ) {
! Run->IsUp
) {
// proper type, and Not UP -> free
- NC->setCurrentState( Off );
- return;
+ return Off;
}
}
- // no free found
- NC->setCurrentState( Unavailable );
+ return Unavailable;
}
-bool WLanRun::setState( NodeCollection * NC, Action_t A, bool ) {
+QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) {
// we only handle activate and deactivate
- switch( A ) {
- case Activate :
- {
- if( NC->currentState() != Off ) {
- return 0;
- }
- InterfaceInfo * N = getInterface();
- if( ! N ) {
- // no interface available
- NC->setCurrentState( Unavailable );
- return 0;
- }
- // because we were OFF the interface
- // we get back is NOT assigned
- N->assignNode( netNode() );
- assignInterface( N );
- NC->setCurrentState( Available );
- return 1;
- }
- case Deactivate :
- if( NC->currentState() == IsUp ) {
- // bring down first
- if( ! connection()->setState( Down ) )
- // could not ...
- return 0;
- } else if( NC->currentState() != Available ) {
- return 1;
- }
- assignedInterface()->assignNode( 0 ); // release
- assignInterface( 0 );
- NC->setCurrentState( Off );
- return 1;
- default :
- // FT
- break;
- }
- return 0;
-}
-
-bool WLanRun::canSetState( State_t Curr, Action_t A ) {
- // we only handle up down activate and deactivate
- switch( A ) {
- case Activate :
- { // at least available
- if( Curr == Available ) {
- return 1;
- }
- // or we can make one available
- InterfaceInfo * N = getInterface();
- if( ! N || N->assignedNode() != 0 ) {
- // non available or assigned
- return 0;
- }
- return 1;
- }
- case Deactivate :
- return ( Curr >= Available );
- default :
- // FT
- break;
- }
- return 0;
+ return QString();
}
// get interface that is free or assigned to us
@@ -159,10 +94,10 @@ InterfaceInfo * WLanRun::getInterface( void ) {
)
) {
// this is a LAN card
- if( Run->assignedNode() == netNode() ) {
+ if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return Run;
- } else if( Run->assignedNode() == 0 ) {
+ } else if( Run->assignedConnection() == 0 ) {
// free
best = Run;
}
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
@@ -2,31 +2,30 @@
#define WLANRUN_H
#include <qregexp.h>
-#include <asdevice.h>
+#include <netnode.h>
#include "wlandata.h"
-class WLanRun : public AsDevice {
+class WLanRun : public RuntimeInfo {
public :
WLanRun( ANetNodeInstance * NNI, WLanData & Data ) :
- AsDevice( NNI ),
- Pat( "wlan[0-9]" )
- { }
+ RuntimeInfo( NNI ),
+ Pat( "wlan[0-9]" ) {
+ }
- virtual AsDevice * device( void )
- { return (AsDevice *)this; }
- virtual AsDevice * asDevice( void )
- { return (AsDevice *)this; }
+ virtual RuntimeInfo * device( void )
+ { return this; }
-protected :
-
- void detectState( NodeCollection * );
- bool setState( NodeCollection *, Action_t, bool );
- bool canSetState( State_t, Action_t );
bool handlesInterface( const QString & I );
bool handlesInterface( const InterfaceInfo & II );
+ State_t detectState( void );
+
+protected :
+
+ QString setMyState( NodeCollection * , Action_t, bool );
+
private :
InterfaceInfo * getInterface( void );