summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth.pro2
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp16
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp4
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h5
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h5
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp4
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h5
-rw-r--r--noncore/settings/networksettings2/cable/cable.pro2
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/gprs/GPRS.pro2
-rw-r--r--noncore/settings/networksettings2/gprs/GPRS_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/irda/irda.pro2
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/lancard/lancard.pro2
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/modem/modem.pro2
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/network/network.pro2
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnodeinterface.h139
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp179
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h65
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDevice.h6
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDriver.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTGateway.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTHCISocket.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTIcons.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTInquiry.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTPeer.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPService.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTUUID.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.h14
-rw-r--r--noncore/settings/networksettings2/ppp/ppp.pro2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/profile/profile.pro2
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/usb/usb.pro2
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp2
-rw-r--r--noncore/settings/networksettings2/vpn/vpn.pro2
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp15
45 files changed, 576 insertions, 77 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth.pro b/noncore/settings/networksettings2/bluetooth/bluetooth.pro
index 2e3b5bb..053a6cb 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth.pro
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth.pro
@@ -1,26 +1,26 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = bluetoothBNEP_NN.h \
bluetoothBNEP_NNI.h \
bluetoothRFCOMM_NN.h \
bluetoothRFCOMM_NNI.h \
bluetoothBNEPedit.h \
bluetoothRFCOMMrun.h \
bluetoothRFCOMMedit.h
SOURCES = bluetoothBNEP_NN.cpp \
bluetoothBNEP_NNI.cpp \
bluetoothRFCOMM_NN.cpp \
bluetoothRFCOMM_NNI.cpp \
bluetoothBNEPedit.cpp \
bluetoothBNEPrun.cpp \
bluetoothRFCOMMrun.cpp \
bluetoothRFCOMMedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
LIBS += -lqpe -lopietooth2
INTERFACES = bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui
TARGET = bluetooth
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp
index ee3e92b..5e4d951 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp
@@ -1,78 +1,94 @@
#include "bluetoothBNEP_NN.h"
#include "bluetoothBNEP_NNI.h"
#include "bluetoothRFCOMM_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
//
//
// BLUETOOTH PAN/NAP node
//
//
static const char * BluetoothBNEPNeeds[] =
{ 0
};
static const char * BluetoothBNEPProvides[] =
{ "device",
0
};
/**
* Constructor, find all of the possible interfaces
*/
BluetoothBNEPNetNode::BluetoothBNEPNetNode() :
ANetNode(tr("Bluetooth PAN/NAP")) {
InstanceCount = 7; // default
}
/**
* Delete any interfaces that we own.
*/
BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){
}
const QString BluetoothBNEPNetNode::nodeDescription(){
return tr("\
<p>Sets up a bluetooth link using the bluetooth Network profile.</p>\
<p>Use this to connect two computing devices.</p>\
"
);
}
ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) {
return new ABluetoothBNEP( this );
}
const char ** BluetoothBNEPNetNode::needs( void ) {
return BluetoothBNEPNeeds;
}
const char ** BluetoothBNEPNetNode::provides( void ) {
return BluetoothBNEPProvides;
}
QString BluetoothBNEPNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "bnep%ld", nr );
}
void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) {
if( A == "interfacecount" ) {
InstanceCount = V.toLong();
}
}
void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) {
TS << "interfacecount="
<< InstanceCount
<< endl;
}
+#ifndef MYPLUGIN
+
extern "C" {
// create plugin registers both BT functions
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new BluetoothBNEPNetNode() );
PNN.append( new BluetoothRFCOMMNetNode() );
}
+
+#else
+
+typedef Opie::Core::MakeTypelist<BluetoothBNEPNetNode, BluetoothRFCOMMNetNode>::Result BluetoothTypes;
+OPIE_NS2_PLUGIN( NetNodeInterface<BluetoothTypes> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
index 9d4ae97..5c937a1 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
@@ -1,54 +1,58 @@
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <resources.h>
#include "bluetoothBNEPrun.h"
+using Opietooth2::OTGateway;
+using Opietooth2::OTPANConnection;
+using Opietooth2::PANConnectionVector;
+
BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI,
BluetoothBNEPData & D ) :
RuntimeInfo( NNI ),
Data( D),
Pat( "bnep[0-6]" ) {
OT = 0;
}
BluetoothBNEPRun::~BluetoothBNEPRun( void ) {
if( OT ) {
OTGateway::releaseOTGateway();
}
}
State_t BluetoothBNEPRun::detectState( void ) {
/*
need to detect
1. for any PAN connection that is found if that
PAN is connected.
if it is connected it is not available (since we do
not manage IP settings and we are called to detect
the state we knwo that we do not have an UP connection)
2. if it not connected and we allow any connection we
are available or if that PAN connection is to a device
with a correct address
3. if it is not connected and the address do not match or
we do not accept any address, we are Unavailable but
not DOWN. I.e a new connection could perhaps be created
*/
if( ! OT ) {
OT = OTGateway::getOTGateway();
}
if( ! OT->isEnabled() ) {
return Unavailable;
}
// if there is a PAN connection that is UP but not
// yet configured (no ifup) the we are available
return ( hasFreePANConnection() ) ? Available : Unknown;
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
index a05a7a2..8551a2e 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
@@ -1,35 +1,34 @@
#include <netnode.h>
#include "bluetoothBNEPdata.h"
#include <OTGateway.h>
-using namespace Opietooth2;
class BluetoothBNEPRun : public RuntimeInfo {
public :
BluetoothBNEPRun( ANetNodeInstance * NNI,
BluetoothBNEPData & D );
virtual ~BluetoothBNEPRun( void );
// i am a device
virtual RuntimeInfo * device( void )
{ return this; }
bool handlesInterface( const QString & );
bool handlesInterface( InterfaceInfo * );
State_t detectState( void );
protected :
QString setMyState( NodeCollection * , Action_t, bool );
private :
bool hasFreePANConnection( bool Grab = 0 );
BluetoothBNEPData & Data;
- OTGateway * OT;
- QRegExp Pat;
+ Opietooth2::OTGateway * OT;
+ QRegExp Pat;
};
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
index 9ad8f2a..fe474fc 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
@@ -1,27 +1,26 @@
#include "bluetoothRFCOMMdata.h"
#include "bluetoothRFCOMMGUI.h"
#include <Opietooth.h>
-using namespace Opietooth2;
class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI {
public :
BluetoothRFCOMMEdit( QWidget * parent );
virtual ~BluetoothRFCOMMEdit( void );
QString acceptable( void );
void showData( BluetoothRFCOMMData & Data );
bool commit( BluetoothRFCOMMData & Data );
- bool Modified;
- OTGateway * OT;
+ bool Modified;
+ Opietooth2::OTGateway * OT;
public slots :
void SLOT_AddServer( void );
void SLOT_RemoveServer( void );
void SLOT_FindDevice( void );
};
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
index 1e91ed1..ef6878a 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
@@ -1,55 +1,57 @@
#include <qapplication.h>
#include <resources.h>
#include <OTDevice.h>
#include <OTGateway.h>
#include "bluetoothRFCOMMrun.h"
-using namespace Opietooth2;
+using Opietooth2::OTGateway;
+using Opietooth2::OTDevice;
+using Opietooth2::OTDeviceAddress;
BluetoothRFCOMMRun::~BluetoothRFCOMMRun( void ) {
if( OT ) {
OTGateway::releaseOTGateway();
}
}
State_t BluetoothRFCOMMRun::detectState( void ) {
if( ! OT ) {
OT = OTGateway::getOTGateway();
}
if( deviceNrOfConnection() >= 0 ) {
return Available;
}
owarn << "Bluetooth "
<< OT->isEnabled()
<< oendl;
return ( OT->isEnabled() ) ? Off : Unavailable;
}
QString BluetoothRFCOMMRun::setMyState( NodeCollection *,
Action_t A,
bool ) {
if( OT ) {
OTGateway::getOTGateway();
}
if( A == Activate ) {
// from OFF to Available
RFCOMMChannel * Ch = getChannel( );
System & Sys = NSResources->system();
if( Ch ) {
// connect to this peer
DeviceNr = OT->getFreeRFCommDevice();
QStringList S;
S << "rfcomm"
<< "bind"
<< QString().setNum( DeviceNr )
<< Ch->BDAddress
<< QString().setNum( Ch->Channel );
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
index 24e3dae..5a31a94 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
@@ -1,33 +1,32 @@
#include <netnode.h>
#include "bluetoothRFCOMMdata.h"
#include <OTGateway.h>
-using namespace Opietooth2;
class BluetoothRFCOMMRun : public RuntimeInfo {
public :
BluetoothRFCOMMRun( ANetNodeInstance * NNI,
BluetoothRFCOMMData & D ) : RuntimeInfo( NNI )
{ DeviceNr = -1; Data = &D; OT = 0; }
virtual ~BluetoothRFCOMMRun( void );
virtual RuntimeInfo * line( void )
{ return this; }
virtual QString deviceFile( void );
State_t detectState( void );
protected :
QString setMyState( NodeCollection * , Action_t, bool );
private :
int deviceNrOfConnection( void );
RFCOMMChannel * getChannel( void );
- BluetoothRFCOMMData * Data;
+ BluetoothRFCOMMData * Data;
Opietooth2::OTGateway * OT;
- int DeviceNr; // cached from detection
+ int DeviceNr; // cached from detection
};
diff --git a/noncore/settings/networksettings2/cable/cable.pro b/noncore/settings/networksettings2/cable/cable.pro
index 8a046b7..660f95e 100644
--- a/noncore/settings/networksettings2/cable/cable.pro
+++ b/noncore/settings/networksettings2/cable/cable.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = cable_NN.h \
cable_NNI.h \
cableedit.h
SOURCES = cable_NN.cpp \
cable_NNI.cpp \
cableedit.cpp \
cablerun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = cableGUI.ui
TARGET = cable
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index dc4205c..20299e4 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -1,54 +1,69 @@
#include "cable_NN.h"
#include "cable_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * CableNeeds[] =
{ 0
};
static const char * CableProvides[] =
{ "line",
0
};
/**
* Constructor, find all of the possible interfaces
*/
CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) {
}
/**
* Delete any interfaces that we own.
*/
CableNetNode::~CableNetNode(){
}
const QString CableNetNode::nodeDescription(){
return tr("\
<p>Sets up a wired serial or parallel.</p>\
"
);
}
ANetNodeInstance * CableNetNode::createInstance( void ) {
return new ACable( this );
}
const char ** CableNetNode::needs( void ) {
return CableNeeds;
}
const char ** CableNetNode::provides( void ) {
return CableProvides;
}
void CableNetNode::setSpecificAttribute( QString & , QString & ) {
}
void CableNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new CableNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<CableNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/gprs/GPRS.pro b/noncore/settings/networksettings2/gprs/GPRS.pro
index 7818415..480c872 100644
--- a/noncore/settings/networksettings2/gprs/GPRS.pro
+++ b/noncore/settings/networksettings2/gprs/GPRS.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = GPRS_NN.h \
GPRS_NNI.h \
GPRSedit.h
SOURCES = GPRS_NN.cpp \
GPRS_NNI.cpp \
GPRSedit.cpp \
GPRSrun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = GPRSGUI.ui
TARGET = GPRS
VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp
index 5393324..4415739 100644
--- a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp
+++ b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp
@@ -1,80 +1,95 @@
#include <resources.h>
#include <qpe/qpeapplication.h>
#include <netnode.h>
#include "GPRS_NN.h"
#include "GPRS_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * GPRSNeeds[] =
{ "GPRS",
0
};
static const char * GPRSProvides[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) {
NSResources->addSystemFile(
"pap-secrets", "/etc/ppp/pap-secrets", 0 );
}
/**
* Delete any interfaces that we own.
*/
GPRSNetNode::~GPRSNetNode(){
}
const QString GPRSNetNode::nodeDescription(){
return tr("\
<p>provides access to a GPRS capable device.</p>\
"
);
}
ANetNodeInstance * GPRSNetNode::createInstance( void ) {
return new AGPRSDevice( this );
}
bool GPRSNetNode::hasDataForFile( SystemFile & S ) {
return S.name() == "pap-secrets";
}
short GPRSNetNode::generateFile( SystemFile & ,
ANetNodeInstance * ,
long ) {
return 0;
}
const char ** GPRSNetNode::needs( void ) {
return GPRSNeeds;
}
const char ** GPRSNetNode::provides( void ) {
return GPRSProvides;
}
void GPRSNetNode::setSpecificAttribute( QString & , QString & ) {
}
void GPRSNetNode::saveSpecificAttribute( QTextStream & ) {
}
QStringList GPRSNetNode::properFiles( void ) {
QStringList SL;
SL << "peers";
SL << "chatscripts";
SL << "extra";
return SL;
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new GPRSNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<GPRSNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/irda/irda.pro b/noncore/settings/networksettings2/irda/irda.pro
index 4613abe..87f7a62 100644
--- a/noncore/settings/networksettings2/irda/irda.pro
+++ b/noncore/settings/networksettings2/irda/irda.pro
@@ -1,17 +1,17 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = irda_NN.h \
irda_NNI.h \
irdaedit.h
SOURCES = irda_NN.cpp \
irda_NNI.cpp \
irdaedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = irdaGUI.ui
TARGET = irda
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 485cad3..6858157 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -1,54 +1,69 @@
#include "irda_NN.h"
#include "irda_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * IRDANeeds[] =
{ 0
};
static const char * IRDAProvides[] =
{ "line",
0
};
/**
* Constructor, find all of the possible interfaces
*/
IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) {
}
/**
* Delete any interfaces that we own.
*/
IRDANetNode::~IRDANetNode(){
}
const QString IRDANetNode::nodeDescription(){
return tr("\
<p>Sets up a infra red serial link.</p>\
"
);
}
ANetNodeInstance * IRDANetNode::createInstance( void ) {
return new AIRDA( this );
}
const char ** IRDANetNode::needs( void ) {
return IRDANeeds;
}
const char ** IRDANetNode::provides( void ) {
return IRDAProvides;
}
void IRDANetNode::setSpecificAttribute( QString & , QString & ) {
}
void IRDANetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new IRDANetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<IRDANetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/lancard/lancard.pro b/noncore/settings/networksettings2/lancard/lancard.pro
index 6f04e01..05f0fa0 100644
--- a/noncore/settings/networksettings2/lancard/lancard.pro
+++ b/noncore/settings/networksettings2/lancard/lancard.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = lancard_NN.h \
lancard_NNI.h \
lancardedit.h
SOURCES = lancard_NN.cpp \
lancard_NNI.cpp \
lancardedit.cpp \
lancardrun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = lancardGUI.ui
TARGET = lancard
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index e36f757..fce3d29 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -1,77 +1,92 @@
#include "lancard_NN.h"
#include "lancard_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * LanCardNeeds[] =
{ 0
};
static const char * LanCardProvides[] =
{ "device",
0
};
/**
* Constructor, find all of the possible interfaces
*/
LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() {
InstanceCount = 2;
}
/**
* Delete any interfaces that we own.
*/
LanCardNetNode::~LanCardNetNode(){
}
const QString LanCardNetNode::nodeDescription(){
return tr("\
<p>Sets up a wired regular LAN card.</p>\
<p>Use this to set up 10/100/1000 MBit LAN cards.</p>\
"
);
}
ANetNodeInstance * LanCardNetNode::createInstance( void ) {
return new ALanCard( this );
}
const char ** LanCardNetNode::needs( void ) {
return LanCardNeeds;
}
const char ** LanCardNetNode::provides( void ) {
return LanCardProvides;
}
QString LanCardNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "eth%ld", nr );
}
void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
if( A == "interfacecount" ) {
InstanceCount = V.toLong();
} else if ( A == "macaddress" ) {
NICMACAddresses.append( V );
}
}
void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
TS << "interfacecount="
<< InstanceCount
<< endl;
for( QStringList::Iterator it = NICMACAddresses.begin();
it != NICMACAddresses.end();
++it ) {
TS << "macaddress="
<< (*it)
<< endl;
}
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new LanCardNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<LanCardNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/modem/modem.pro b/noncore/settings/networksettings2/modem/modem.pro
index 25e29d4..4511e07 100644
--- a/noncore/settings/networksettings2/modem/modem.pro
+++ b/noncore/settings/networksettings2/modem/modem.pro
@@ -1,17 +1,17 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = modem_NN.h \
modem_NNI.h \
modemedit.h
SOURCES = modem_NN.cpp \
modem_NNI.cpp \
modemedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = modemGUI.ui
TARGET = modem
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index 06f417c..c7f6e78 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -1,55 +1,70 @@
#include "modem_NN.h"
#include "modem_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * ModemNeeds[] =
{ "line",
0
};
static const char * ModemProvides[] =
{ "modem",
0
};
/**
* Constructor, find all of the possible interfaces
*/
ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) {
}
/**
* Delete any interfaces that we own.
*/
ModemNetNode::~ModemNetNode(){
}
const QString ModemNetNode::nodeDescription(){
return tr("\
<p>Sets up a dialing procedures.</p>\
<p>Use this to dial up over modems, ISDN, GSM, ...</p>\
"
);
}
ANetNodeInstance * ModemNetNode::createInstance( void ) {
return new AModem( this );
}
const char ** ModemNetNode::needs( void ) {
return ModemNeeds;
}
const char ** ModemNetNode::provides( void ) {
return ModemProvides;
}
void ModemNetNode::setSpecificAttribute( QString & , QString & ) {
}
void ModemNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new ModemNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<ModemNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/network/network.pro b/noncore/settings/networksettings2/network/network.pro
index 05df007..5ca78b9 100644
--- a/noncore/settings/networksettings2/network/network.pro
+++ b/noncore/settings/networksettings2/network/network.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = network_NN.h \
network_NNI.h \
networkedit.h
SOURCES = network_NN.cpp \
network_NNI.cpp \
networkedit.cpp \
networkrun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = networkGUI.ui
TARGET = network
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index 23b3d44..82d0c29 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -1,97 +1,112 @@
#include <qpe/qpeapplication.h>
#include <resources.h>
#include <netnode.h>
#include "network_NN.h"
#include "network_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * NetworkNeeds[] =
{ "device",
0
};
static const char * NetworkProvides[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) {
NSResources->addSystemFile(
"interfaces", "/etc/network/interfaces", 1 );
}
/**
* Delete any interfaces that we own.
*/
NetworkNetNode::~NetworkNetNode(){
}
const QString NetworkNetNode::nodeDescription(){
return tr("\
<p>Sets up TCP/IP options.</p>\
<p>Use this to configure the TCP/IP protocol</p>\
"
);
}
ANetNodeInstance * NetworkNetNode::createInstance( void ) {
return new ANetwork( this );
}
bool NetworkNetNode::hasDataForFile( SystemFile & S ) {
return S.name() == "interfaces";
}
short NetworkNetNode::generateFile( SystemFile & SF,
ANetNodeInstance * NNI,
long DevNr ) {
if( DevNr < 0 ) {
// generate device specific but common part
return 1;
}
QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
if( SF.name() == "interfaces" ) {
Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() ));
// generate mapping stanza for this interface
SF << "# check if "
<< NIC
<< " can be brought UP"
<< endl;
SF << "mapping "
<< NIC
<< endl;
SF << " script "
<< QPEApplication::qpeDir()
<< "bin/networksettings2-request"
<< endl
<< endl;
return 0;
}
return 1;
}
const char ** NetworkNetNode::needs( void ) {
return NetworkNeeds;
}
const char ** NetworkNetNode::provides( void ) {
return NetworkProvides;
}
void NetworkNetNode::setSpecificAttribute( QString & , QString & ) {
}
void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new NetworkNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<NetworkNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/networksettings2/netnodeinterface.h b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h
new file mode 100644
index 0000000..34f3bb5
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h
@@ -0,0 +1,139 @@
+/*
+                 This file is part of the Opie Project
+
+ Copyright (C) 2005 Holger Hans Peter Freyther <freyther@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef ANET_NODE_INTERFACE_H
+#define ANET_NODE_INTERFACE_H
+
+#include <opie2/oapplicationfactory.h>
+#include <qpe/qcom.h>
+
+// {A215A785-FB73-4F74-84B0-053BCC77DB87}
+#ifndef IID_NetworkSettings2
+
+#define IID_NetworkSettings2 QUuid( 0xa215a785, 0xfb73, 0x4f74, 0x84, 0xb0, 0x05, 0x3b, 0xcc, 0x77, 0xdb, 0x87)
+
+#endif
+
+
+
+/**
+ * Multiple Types
+ */
+template <class Node >
+struct NS2PrivateFactory {
+
+ inline static void createPlugins( QList<ANetNode> & PNN) {
+ PNN.append( new Node());
+ }
+
+};
+
+/*
+ * Stop recursion here
+ */
+template <>
+struct NS2PrivateFactory<Opie::Core::NullType> {
+
+ inline static void createPlugins( QList<ANetNode> &) {
+
+ }
+
+};
+
+template <class Node, class Tail>
+struct NS2PrivateFactory<Opie::Core::Typelist<Node, Tail> > {
+
+ inline static void createPlugins( QList<ANetNode> & PNN ) {
+ NS2PrivateFactory<Node>::createPlugins(PNN);
+ NS2PrivateFactory<Tail>::createPlugins(PNN);
+ }
+
+};
+
+template<class Node>
+struct NetNodeInterface : public QUnknownInterface {
+
+ QRESULT queryInterface(const QUuid& uuid, QUnknownInterface **iface) {
+ *iface = 0;
+
+ if( uuid == IID_QUnknown )
+ *iface = this;
+ else if( uuid == IID_NetworkSettings2 )
+ *iface = this;
+ else
+ return QS_FALSE;
+
+ (*iface)->addRef();
+
+ return QS_OK;
+
+ }
+
+ void create_plugin( QList<ANetNode> & PNN ) {
+
+ PNN.append( new Node());
+
+ }
+
+ Q_REFCOUNT
+};
+
+template<class Node, class Tail>
+struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> >
+ : public QUnknownInterface {
+
+ QRESULT queryInterface( const QUuid& uuid,
+ QUnknownInterface **iface) {
+
+ *iface = 0;
+
+ if( uuid == IID_QUnknown ) *iface = this;
+ else if( uuid == IID_NetworkSettings2 ) *iface = this;
+ else return QS_FALSE;
+
+ (*iface)->addRef();
+ return QS_OK;
+
+ }
+
+ void create_plugin( QList<ANetNode> & PNN ) {
+ NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugin( PNN );
+ }
+
+ Q_REFCOUNT
+
+};
+
+#define OPIE_NS2_PLUGIN( factory ) \
+ Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory) }
+
+#endif
+
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp
index 50fb15a..79d41ea 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.cpp
+++ b/noncore/settings/networksettings2/networksettings2/resources.cpp
@@ -1,277 +1,414 @@
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <qpixmap.h>
#include <qdir.h>
+#include <qmessagebox.h>
+
#include <qpe/qlibrary.h>
#include <qpe/qpeapplication.h>
+
#include <opie2/odebug.h>
+#include <opie2/opluginloader.h>
+
#include <qtopia/resource.h>
#include "netnode.h"
#include "resources.h"
+#include "netnodeinterface.h"
#define PLUGINDIR "plugins/networksettings2"
#define ICONDIR "/pics/networksettings2/"
// single resources instance
TheNSResources * _NSResources = 0;
TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
ConnectionsMap() {
_NSResources = this;
detectCurrentUser();
// load available netnodes
+
+#ifdef MYPLUGIN
+
findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR );
// compile provides and needs lists
{ const char ** NeedsRun;
QDictIterator<NetNode_t> OuterIt( AllNodeTypes );
bool Done;
for ( ; OuterIt.current(); ++OuterIt ) {
// find needs list
ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList;
ANetNode::NetNodeList & NNL = *(NNLP);
// must iterate this way to avoid duplication pointers
for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes );
InnerIt.current(); ++InnerIt ) {
if( InnerIt.current() == OuterIt.current() )
// avoid recursive
continue;
const char ** Provides = InnerIt.current()->NetNode->provides();
NeedsRun = OuterIt.current()->NetNode->needs();
for( ; *NeedsRun; NeedsRun ++ ) {
const char ** PRun;
PRun = Provides;
for( ; *PRun; PRun ++ ) {
if( strcmp( *PRun, *NeedsRun ) == 0 ) {
// inner provides what outer needs
NNL.resize( NNL.size() + 1 );
NNL[NNL.size()-1] = InnerIt.current()->NetNode;
Done = 1; // break from 2 loops
break;
}
}
}
}
OuterIt.current()->NetNode->setAlternatives( NNLP );
}
}
+#else
+
+ Plugins = 0;
+ findAvailableNetNodes();
+
+ // compile provides and needs lists
+ { const char ** NeedsRun;
+ QDictIterator<ANetNode> OuterIt( AllNodeTypes );
+ bool Done;
+
+ for ( ; OuterIt.current(); ++OuterIt ) {
+ // find needs list
+ ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList;
+ ANetNode::NetNodeList & NNL = *(NNLP);
+
+ // must iterate this way to avoid duplication pointers
+ for ( QDictIterator<ANetNode> InnerIt( AllNodeTypes );
+ InnerIt.current(); ++InnerIt ) {
+
+ if( InnerIt.current() == OuterIt.current() )
+ // avoid recursive
+ continue;
+
+ const char ** Provides = InnerIt.current()->provides();
+ NeedsRun = OuterIt.current()->needs();
+
+ for( ; *NeedsRun; NeedsRun ++ ) {
+ const char ** PRun;
+ PRun = Provides;
+ for( ; *PRun; PRun ++ ) {
+ if( strcmp( *PRun, *NeedsRun ) == 0 ) {
+ // inner provides what outer needs
+ NNL.resize( NNL.size() + 1 );
+ NNL[NNL.size()-1] = InnerIt.current();
+ Done = 1; // break from 2 loops
+ break;
+ }
+ }
+ }
+ }
+ OuterIt.current()->setAlternatives( NNLP );
+ }
+ }
+
+#endif
+
// define built in Node types to Description map
addNodeType( "device", tr( "Network Device" ),
tr( "<p>Devices that can handle IP packets</p>" ) );
addNodeType( "line", tr( "Character device" ),
tr( "<p>Devices that can handle single bytes</p>" ) );
addNodeType( "connection", tr( "IP Connection" ),
tr( "<p>Nodes that provide working IP connections</p>" ) );
addNodeType( "fullsetup", tr( "Connection Profile" ),
tr( "<p>Fully configured connection profile</p>" ) );
addNodeType( "GPRS", tr( "Connection to GPRS device" ),
tr( "<p>Connection to a GPRS capable device</p>" ) );
// get access to the system
TheSystem = new System();
}
TheNSResources::~TheNSResources( void ) {
+
+#ifndef MYPLUGINS
+ if( Plugins ) {
+ delete Plugins;
+ delete PluginManager;
+ }
+#endif
delete TheSystem;
+
}
void TheNSResources::addNodeType( const QString & ID,
const QString & Name,
const QString & Descr ) {
if( NodeTypeNameMap[ID].isEmpty() ) {
NodeTypeNameMap.insert( ID, Name );
NodeTypeDescriptionMap.insert( ID, Descr );
}
}
void TheNSResources::addSystemFile( const QString & ID,
const QString & P,
bool KDI ) {
if( ! SystemFiles.find( ID ) ) {
// new system file
SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) );
} // else existed
}
void TheNSResources::busy( bool ) {
/*
if( B ) {
ShowWait->show();
qApp->process
} else {
ShowWait->hide();
}
*/
}
+#ifdef MYPLUGIN
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void TheNSResources::findAvailableNetNodes(const QString &path){
Log(("Locate plugins in %s\n", path.latin1() ));
QDir d(path);
if(!d.exists())
return;
QString lang = ::getenv("LANG");
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) ) {
if( fi->fileName().contains(".so")){
/* if loaded install translation */
if( loadNetNode(path + "/" + fi->fileName()) ) {
Log(( "Loading plugin %s\n", fi->fileName().latin1()));
QTranslator *trans = new QTranslator(qApp);
QString fn = QPEApplication::qpeDir()+
"/i18n/"+lang+"/"+
fi->fileName().left( fi->fileName().find(".") )+
".qm";
if( trans->load( fn ) )
qApp->installTranslator( trans );
else
delete trans;
} else {
Log(( "Error loading plugin %s\n", fi->fileName().latin1()));
}
}
++it;
}
}
-// used to find unique connection number
-int TheNSResources::assignConnectionNumber( void ) {
- bool found = 1;
- for( int trial = 0; ; trial ++ ) {
- found = 1;
- for( QDictIterator<NodeCollection> it(ConnectionsMap);
- it.current();
- ++it ) {
- if( it.current()->number() == trial ) {
- found = 0;
- break;
- }
- }
-
- if( found ) {
- Log(("Assign profile number %d\n", trial ));
- return trial;
- }
- }
-}
-
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return true of loading is successful
*/
bool TheNSResources::loadNetNode(
const QString &pluginFileName, const QString &resolveString){
QLibrary *lib = new QLibrary(pluginFileName);
void * res = lib->resolve(resolveString);
if( ! res ){
delete lib;
return 0;
}
GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res;
// Try to get an object.
QList<ANetNode> PNN;
getNetNodeList( PNN );
if( PNN.isEmpty() ) {
delete lib;
return 0;
}
ANetNode * NNP;
for( QListIterator<ANetNode> it(PNN);
it.current();
++it ) {
NetNode_t * NN;
NNP = it.current();
NN = new NetNode_t;
NN->NetNode = NNP;
NN->TheLibrary = lib;
NN->NodeCountInLib = PNN.count();
// store mapping
AllNodeTypes.insert( NN->NetNode->name(), NN );
}
return 1;
}
+#else
+
+void TheNSResources::findAvailableNetNodes( void ){
+
+ Plugins = new OPluginLoader( "networksettings2" );
+ Plugins->setAutoDelete( true );
+
+ PluginManager = new OPluginManager( Plugins );
+ PluginManager->load();
+
+ if( Plugins->isInSafeMode() ) {
+ QMessageBox::information(
+ 0,
+ tr( "Today Error"),
+ tr( "<qt>The plugin '%1' caused Today to crash."
+ " It could be that the plugin is not properly"
+ " installed.<br>Today tries to continue loading"
+ " plugins.</qt>" )
+ .arg( PluginManager->crashedPlugin().name()));
+ }
+
+ // Get All Plugins
+ OPluginLoader::List allplugins = Plugins->filtered();
+
+ for( OPluginLoader::List::Iterator it = allplugins.begin();
+ it != allplugins.end();
+ ++it ) {
+
+ // check if this plugin supports the proper interface
+ NetNodeInterface * interface =
+ Plugins->load<NetNodeInterface>( *it, IID_NetworkSettings2 );
+
+ if( ! interface ) {
+ Log(( "Plugin %s from %s does not support proper interface\n",
+ it->name().latin1(), it->path().latin1() ));
+ continue;
+ }
+
+ // add the nodes in this plugin to the dictionary
+ { QList<ANetNode> PNN;
+
+ interface->create_plugin( PNN );
+
+ if( PNN.isEmpty() ) {
+ Log(( "Plugin %s from %s does offer any nodes\n",
+ it->name().latin1(), it->path().latin1() ));
+ delete interface;
+ continue;
+ }
+
+ // merge this node with global node
+ for( QListIterator<ANetNode> it(PNN);
+ it.current();
+ ++it ) {
+ AllNodeTypes.insert( it->current()->name(), it->current() );
+ }
+ }
+
+ // load the translation
+ QTranslator *trans = new QTranslator(qApp);
+ QString fn = QPEApplication::qpeDir()+
+ "/i18n/"+lang+"/"+ it->name() + ".qm";
+
+ if( trans->load( fn ) )
+ qApp->installTranslator( trans );
+ else
+ delete trans;
+ }
+
+}
+
+#endif
+
+// used to find unique connection number
+int TheNSResources::assignConnectionNumber( void ) {
+ bool found = 1;
+ for( int trial = 0; ; trial ++ ) {
+ found = 1;
+ for( QDictIterator<NodeCollection> it(ConnectionsMap);
+ it.current();
+ ++it ) {
+ if( it.current()->number() == trial ) {
+ found = 0;
+ break;
+ }
+ }
+
+ if( found ) {
+ Log(("Assign profile number %d\n", trial ));
+ return trial;
+ }
+ }
+}
+
QPixmap TheNSResources::getPixmap( const QString & QS ) {
QPixmap P;
QString S("networksettings2/");
S += QS;
P = Resource::loadPixmap( S );
if( P.isNull() ) {
Log(( "Cannot load %s\n", S.latin1() ));
}
return ( P.isNull() ) ? QPixmap() : P;
}
QString TheNSResources::tr( const char * s ) {
return qApp->translate( "resource", s );
}
const QString & TheNSResources::netNode2Name( const char * s ) {
return NodeTypeNameMap[s];
}
const QString & TheNSResources::netNode2Description( const char * s ) {
return NodeTypeDescriptionMap[s];
}
void TheNSResources::addConnection( NodeCollection * NC ) {
ANetNodeInstance * NNI;
ConnectionsMap.insert( NC->name(), NC );
// add (new) nodes to NodeList
for( QListIterator<ANetNodeInstance> it(*NC);
it.current();
++it ) {
NNI = it.current();
if( findNodeInstance( NNI->name() ) == 0 ) {
// new item
addNodeInstance( NNI );
}
}
}
void TheNSResources::removeConnection( const QString & N ) {
NodeCollection * NC = findConnection( N );
if( ! NC )
return;
// delete netnodes in this connection
ANetNodeInstance * NNI;
for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) {
removeNodeInstance( NNI->name() );
}
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
index 5d90286..421a433 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.h
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -1,144 +1,183 @@
#ifndef __RESOURCES__H
#define __RESOURCES__H
#include <qstring.h>
#include <qdict.h>
#include <qmap.h>
#include <qlist.h>
#include "netnode.h"
#include "systemfile.h"
#include "system.h"
class QLibrary;
class QPixmap;
class ANetNode;
class ANetNodeInstance;
-typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN );
+namespace Opie {
+ namespace Core {
+ class OPluginLoader;
+ class OPluginManager;
+ }
+}
-typedef struct NetNode_S {
- ANetNode * NetNode;
- QLibrary * TheLibrary;
- long NodeCountInLib;
-} NetNode_t;
+typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN );
class CurrentQPEUser {
public :
CurrentQPEUser() : UserName(), HomeDir(), EnvList() {}
inline bool known( void )
{ return ! HomeDir.isEmpty() && ! UserName.isEmpty(); }
QString UserName;
QString HomeDir;
int Uid;
int Gid;
QArray<char *> EnvList;
};
+#ifdef MYPLUGIN
+
+typedef struct NetNode_S {
+ ANetNode * NetNode;
+ QLibrary * TheLibrary;
+ long NodeCountInLib;
+} NetNode_t;
typedef QDict<NetNode_t> Name2NetNode_t;
+
+#else
+
+typedef QDict<ANetNode> Name2NetNode_t;
+
+#endif
+
typedef QDict<ANetNodeInstance > Name2Instance_t;
typedef QDict<NodeCollection> Name2Connection_t;
typedef QDict<SystemFile> Name2SystemFile_t;
class TheNSResources {
public :
TheNSResources( void );
~TheNSResources( );
// give busy feedback
void busy( bool B );
System & system()
{ return *TheSystem; }
int assignConnectionNumber(void);
QPixmap getPixmap( const QString & Name );
Name2NetNode_t & netNodes( void )
{ return AllNodeTypes; }
bool netNodeExists( const QString & X )
{ return AllNodeTypes.find(X)!=0; }
+#ifdef MYPLUGIN
ANetNode * findNetNode( const QString & N )
{ NetNode_t * NNT = AllNodeTypes.find(N);
return (NNT) ? NNT->NetNode : 0;
}
-
+#else
+ ANetNode * findNetNode( const QString & N )
+ { return AllNodeTypes.find(N);
+ }
+#endif
// define new plugin (=node)
void addNodeType( const QString & ID,
const QString & LongName,
const QString & Description );
Name2SystemFile_t & systemFiles( void )
{ return SystemFiles; }
void addSystemFile( const QString & ID,
const QString & P,
bool KDI );
ANetNodeInstance * createNodeInstance( const QString & S )
{ ANetNodeInstance * NNI = 0;
printf( "Find node type %s\n", S.latin1() );
+#ifdef MYPLUGIN
NetNode_t * NNT = AllNodeTypes[S];
if( ! NNT ) {
return 0;
}
NNI = NNT->NetNode->createInstance();
+#else
+ ANetNode * NNT = AllNodeTypes[S];
+ if( ! NNT ) {
+ return 0;
+ }
+ NNI = NNT->createInstance();
+#endif
NNI->initialize();
return NNI;
}
Name2Instance_t & netNodeInstances( void )
{ return AllNodes; }
void addNodeInstance( ANetNodeInstance * I )
{ AllNodes.insert( I->name(), I ); }
void removeNodeInstance( const QString & N )
{ AllNodes.remove( N );}
ANetNodeInstance * findNodeInstance( const QString & S )
{ return AllNodes[S]; }
const QString & netNode2Name( const char * Type );
const QString & netNode2Description( const char * Type );
void addConnection( NodeCollection * NC );
void removeConnection( const QString & N );
NodeCollection * findConnection( const QString & N );
NodeCollection * getConnection( int nr );
Name2Connection_t & connections( void )
{ return ConnectionsMap; }
inline bool userKnown( void )
{ return CurrentUser.known(); }
CurrentQPEUser & currentUser( void )
{ return CurrentUser; }
private :
void detectCurrentUser( void );
QString tr( const char * path );
+
+#ifdef MYPLUGIN
void findAvailableNetNodes( const QString &path );
bool loadNetNode(
const QString &pluginFileName,
const QString &resolveString = "create_plugin");
+#else
+ void findAvailableNetNodes( void );
+#endif
QMap< QString, QString> NodeTypeNameMap;
QMap< QString, QString> NodeTypeDescriptionMap;
- Name2Connection_t ConnectionsMap;
- System * TheSystem;
- Name2SystemFile_t SystemFiles;
+ Name2Connection_t ConnectionsMap;
+ System * TheSystem;
+ Name2SystemFile_t SystemFiles;
// all node type classes
- Name2NetNode_t AllNodeTypes;
+ Name2NetNode_t AllNodeTypes;
// all nodes
- Name2Instance_t AllNodes;
+ Name2Instance_t AllNodes;
+
+ CurrentQPEUser CurrentUser;
+
+#ifndef MYPLUGIN
+ Opie::Core::OPluginLoader * Plugins;
+ Opie::Core::OPluginManager * PluginManager;
+#endif
- CurrentQPEUser CurrentUser;
};
extern TheNSResources * _NSResources;
#define NSResources _NSResources
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDevice.h b/noncore/settings/networksettings2/opietooth2/OTDevice.h
index cf1c4b6..09de7ee 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDevice.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDevice.h
@@ -1,116 +1,116 @@
#ifndef OTDEVICE_H
#define OTDEVICE_H
#include <qobject.h>
#include <qstring.h>
#include <bluezlib.h>
#include <OTGateway.h>
// define if you want to use the process hciattach for detection
// #define USEHCIPROC
class QTimerEvent;
namespace Opie {
namespace Core {
class OProcess;
- };
-};
+ }
+}
namespace Opietooth2 {
/**
* Device takes care of attaching serial
* devices to the blueZ stack.
* After attaching it hciconfig ups it
*/
class OTDevice : public QObject {
Q_OBJECT
public:
/**
* Brings up the device.
* will detech which device is needed
* Usage example: new Device(/dev/ttySB0, csr)
*
*/
OTDevice( OTGateway * _OT );
/**
* unloads the device
*/
~OTDevice();
inline OTGateway * gateway() const
{ return OT; }
inline bool needsAttach( void ) const
{ return NeedsAttach; }
inline int deviceNr() const
{ return m_deviceNr; }
/**
* attach the device
* @return bool which is TRUE if command started sucessfully
*/
bool attach();
/**
* detach the device
* @return bool which is TRUE if command started sucessfully
*/
bool detach();
/**
* Is the device loaded?
* @return bool, if the device is loaded
*/
bool isAttached()const;
// check current state of attachment
bool checkAttach();
// returns pattern that points to the proper
// RFCOMM device file. Put %1 where device nr should be put
// e.g. : /dev/bluetooth/rfcomm/%1 or /def/rfcomm%1
QString getRFCommDevicePattern();
signals:
/**
* Signals if the attach/detach of the device produced
* errors
* @param Mesg contains an error message
*/
void error( const QString & mesg );
void isEnabled( int devnr, bool );
private slots:
void slotStdOut(Opie::Core::OProcess*, char*, int );
void slotStdErr(Opie::Core::OProcess*, char*, int );
private:
void detectDeviceType( QString & Device,
QString & Mode,
unsigned long & Speed );
pid_t getPidOfHCIAttach( void );
Opie::Core::OProcess* m_hciattach; // ptr to hciattach proces
int m_deviceNr; // x as in hci(x)
pid_t m_hciattachPid; // pid of hciattach program
// backpointer
OTGateway * OT;
bool NeedsAttach;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
index 50f28fc..8395f37 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
@@ -58,51 +58,51 @@ public:
/** Converts the DeviceAddress into a BlueZ bdaddr_t.
@param networkbyteorder if true, the address is returned
in network byte order.
@return the address as bdaddr_t
*/
inline const bdaddr_t & getBDAddr( void ) const
{ return BDaddr; }
bdaddr_t getBDAddrInNetworkByteOrder() const;
void setBDAddr( const bdaddr_t& bdaddr,
bool networkbyteorder = false
);
/** Less-than-operator.
Mainly there to use DeviceAddress inside STL containers,
like STL sets or as a key in a STL map.
@param b the DeviceAddress to compare to (right hand side)
@return true if this < b, false otherwise.
*/
bool operator<(const OTDeviceAddress& b) const;
/** Equality operator.
Tests two device addresses for equality.
@param b the DeviceAddress to compare to (right hand side)
@return true if this and b have the same address or
if both are invalid, false otherwise
*/
bool operator==(const OTDeviceAddress& b) const;
inline bool operator!=(const OTDeviceAddress& b) const
{ return ! ( *this == b ); }
/** The address 00:00:00:FF:FF:FF */
static const OTDeviceAddress local;
/** The address 00:00:00:00:00:00 */
static const OTDeviceAddress any;
/** An address tagged as invalid */
static const OTDeviceAddress invalid;
protected:
bdaddr_t BDaddr;
bool IsValid;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.h b/noncore/settings/networksettings2/opietooth2/OTDriver.h
index f249cf7..b54ffdf 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDriver.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDriver.h
@@ -183,50 +183,50 @@ public:
void changeClass( unsigned char service,
unsigned char major,
unsigned char minor);
QString getPeerName( const OTDeviceAddress & PAddr );
// address must be connected to this driver
long getLinkQuality( const OTDeviceAddress & Address );
signals :
void error( const QString & );
void stateChange( OTDriver * , bool );
void driverDisappeared( OTDriver * );
private slots :
/*
* Reinitializes the device, obtaining a fresh
* hci_dev_info structure.
*/
void reinit();
void SLOT_CloseFd();
private:
QString getRevEricsson();
QString getRevCsr(unsigned short rev);
QString Name;
QString Dev;
QString Revision;
QString Manufacturer;
OTDeviceAddress Address;
QString Features;
QTimer * AutoClose;
int Dev_id,Fd,Type;
bool IsUp;
int Iscan,Pscan,Auth,Encrypt;
// socket bound to this device
OTHCISocket * Socket;
// backpointer to opietooth system
OTGateway * OT;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.h b/noncore/settings/networksettings2/opietooth2/OTGateway.h
index a47cefb..d97ef35 100644
--- a/noncore/settings/networksettings2/opietooth2/OTGateway.h
+++ b/noncore/settings/networksettings2/opietooth2/OTGateway.h
@@ -150,51 +150,51 @@ signals :
void error( const QString & );
// signal state of bluetooth driver
void stateChange( OTDriver * D, bool State );
// sent when list of drivers changees
void driverListChanged();
// sent when bluetooth on device is enabled
void deviceEnabled( bool );
// sent when a (new if bool = TRUE) peer is detected
void detectedPeer( OTPeer *, bool );
// end of detection process
void finishedDetecting();
protected :
void connectNotify( const char * Signal );
void disconnectNotify( const char * Signal );
void timerEvent( QTimerEvent * );
private :
void loadActiveConnections( void );
void loadKnownPeers( void );
void saveKnownPeers( void );
bool isConnectedTo( int devid,
const OTDeviceAddress & Address );
void readLinkKeys();
static OTGateway * SingleGateway;
static int UseCount;
OTDriver * ScanWith;
OTDriverList AllDrivers;
OTDevice * TheOTDevice;
int HciCtl;
int ErrorConnectCount;
int RefreshTimer;
OTInquiry * Scanning;
bool AllPeersModified;
PeerVector AllPeers;
LinkKeyArray AllKeys;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTHCISocket.h b/noncore/settings/networksettings2/opietooth2/OTHCISocket.h
index d508078..a004989 100644
--- a/noncore/settings/networksettings2/opietooth2/OTHCISocket.h
+++ b/noncore/settings/networksettings2/opietooth2/OTHCISocket.h
@@ -66,51 +66,51 @@ public:
@return true if successful
*/
/*bool readEvent(unsigned char &packetType,
unsigned char &eventCode, unsigned char &buflen,
char* paramBuf);*/
enum Error { ErrSocket = 1 };
/** Forces reading the next event packet. */
void readEvent( void );
/** Returns the internal socket */
int socket( void );
inline QSocketDevice & socketDevice()
{ return HCISocket; }
inline OTDriver * driver() const
{ return Driver; }
signals:
void event( unsigned char eventCode, QByteArray buf);
void error( QString message );
void connectionClosed( );
private:
void updateStatus( const QByteArray& data );
//QSocketDevice hciSocket;
QGuardedPtr<QSocketNotifier> HCIReadNotifier;
QSocketDevice HCISocket;
OTDriver * Driver ;
bool BStatusSet;
unsigned short LastStatusOcf;
unsigned char LastStatusOgf;
int LastStatus;
private slots:
void slotSocketActivated();
void slotSocketError(int);
void slotConnectionClosed();
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTIcons.h b/noncore/settings/networksettings2/opietooth2/OTIcons.h
index 966ed24..ee10831 100644
--- a/noncore/settings/networksettings2/opietooth2/OTIcons.h
+++ b/noncore/settings/networksettings2/opietooth2/OTIcons.h
@@ -4,51 +4,51 @@
#include <OTUUID.h>
#include <qpixmap.h>
#include <qmap.h>
namespace Opietooth2 {
class OTIcons {
public:
OTIcons();
~OTIcons();
/**
* Returns an icon depending on device class
* @param deviceClass the device class name
* @return the pixmap
*/
QPixmap deviceIcon( const QString & );
/**
* Returns an icon depending on service id
* @param serviceClass the service id
* @return the pixmap
* @return true if found
*/
QPixmap serviceIcon( int, bool & );
// returns all UUID that represent channels with modem function
const UUIDVector & modems()
{ return Modems; }
// returns all UUID that represent channels with network
const UUIDVector & network()
{ return Networks; }
// set Sub to find icons in .../Icons dir
QPixmap loadPixmap( const QString &, bool Sub = 0 );
private:
// first ist id, second is icon name
QMap<QString,QString> deviceIcons;
QMap<int,QString> serviceIcons;
UUIDVector Modems;
UUIDVector Networks;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.h b/noncore/settings/networksettings2/opietooth2/OTInquiry.h
index 2682499..f7bdeec 100644
--- a/noncore/settings/networksettings2/opietooth2/OTInquiry.h
+++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.h
@@ -129,50 +129,50 @@ protected:
*/
virtual void onPeerFound( OTPeer * Peer, bool );
enum ErrorCode {
InquiryFinishedTimeout = 0x0100
};
signals :
void peerFound( OTPeer *, bool );
/** Emitted after an inquiry has finished successfully.
If the inquiry was canceled, no finished signals is emitted.
This signal can be emitted without having called inquiry, since
other processes may have started an inquiry.
*/
void finished();
/** Emitted instead of finished if an error occured after
calling inquiry() or periodicInquiryMode()
@param code error code.
@param message Error message
*/
void error( QString message );
private:
// std::set<DeviceAddress> addrCache;
// double currentTimeout;
// QByteArray* buf;
// QSocket* hciSocket;
QGuardedPtr<OTHCISocket> Socket;
OTDriver * Driver;
//QDateTime *startTime;
QTimer *InquiryTimeoutTimer;
// std::deque<InquiryInfo> infoQueue;
bool SuccessfullyStarted;
bool SuccessfullyEnded;
private slots:
void slotInquiryTimeout();
void slotHCIEvent(unsigned char eventCode, QByteArray buf);
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTPeer.h b/noncore/settings/networksettings2/opietooth2/OTPeer.h
index 9cd0dc7..c09af15 100644
--- a/noncore/settings/networksettings2/opietooth2/OTPeer.h
+++ b/noncore/settings/networksettings2/opietooth2/OTPeer.h
@@ -85,51 +85,51 @@ public :
{ State = S; }
inline PeerState_t state( void )
{ return State; }
// go and find out state
// will report back with signal
void findOutState( int timeoutInSec = 1, bool Force = 0 );
void stopFindingOutState( void );
// return driver to which this peer is connected to
// if it is connected
inline OTDriver * connectedTo( void ) const
{ return ConnectedTo; }
inline void setConnectedTo( OTDriver * D )
{ ConnectedTo = D; }
void save( QTextStream& TS );
void load( QTextStream& TS );
signals :
// report back state
void peerStateReport( OTPeer *);
void error( const QString & );
protected :
// while polling for result of ping
void timerEvent( QTimerEvent * ev );
private:
void updateServices();
OTGateway * OT;
OTDeviceAddress Addr;
QString Name;
int Class;
ServiceVector serviceList;
// -1 : don't know, 0 no, 1 yes
PeerState_t State;
OTDriver * ConnectedTo;
int ProbeFD;
int ProbePhase; // see OTDriver
long ProbeTimeout;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
index 86b5623..e79e33d 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
@@ -90,51 +90,51 @@ public:
OTSDPAttribute();
OTSDPAttribute( sdp_data_t * D );
~OTSDPAttribute();
QString toString( void );
void setNil();
void setInt(const OTSDPAttribute::int128_t & val);
void setUInt(const OTSDPAttribute::uint128_t & val);
void setUUID( const OTUUID & val);
void setBool(bool val);
void setString(const QString & val);
void setURL(const QString & val);
void setSequence(const AttributeVector& val);
void setAlternative(const AttributeVector& val);
QString getString();
QString getURL();
const OTSDPAttribute::int128_t & getInt();
const OTSDPAttribute::uint128_t & getUInt();
const OTUUID & getUUID();
bool getBool();
AttributeVector * getSequence();
AttributeVector * getAlternative();
UUIDVector getAllUUIDs();
inline AttrType getType()
{ return type; }
//QString getValString();
const char * getTypeString();
private:
AttrType type;
union {
OTSDPAttribute::int128_t * intVal;
OTSDPAttribute::uint128_t * uintVal;
OTUUID * uuidVal;
bool boolVal;
QString * stringVal; // strings and urls
AttributeVector * sequenceVal; // sequences and alternatives
} Value;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPService.h b/noncore/settings/networksettings2/opietooth2/OTSDPService.h
index 21d7344..4831df0 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPService.h
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPService.h
@@ -25,51 +25,51 @@ class OTSDPService {
public:
OTSDPService();
virtual ~OTSDPService();
void addAttribute(int id, OTSDPAttribute * attr);
const OTSDPAttribute & attribute( int index );
int attributeID( int index );
AttributeVector subAttributes( OTSDPAttribute * attr);
OTSDPAttribute * attributeByID( int id );
// See Bluetooth Core Spec Sec. 5.1
bool recordHandle(uint32_t *handle); // 0x00
//bool getServiceClassIDList(vector<uuid_t> *classIDList); // 0x01
//bool getServiceRecordState(uint32_t *state); // 0x02
//bool getServiceID(uuid_t *id); // 0x03;
//bool getProtocolDescriptorList(SDP::Attribute *attribute); // 0x04
//bool getBrowseGroupList(vector<uuid_t> *browseGroupList); // 0x05
QString name(void); // langBase + 0x00
QString description(void); // langBase + 0x01
UUIDVector allUUIDs();
// return list of classes this service belongs to
UUIDVector classIDList();
/** Retrieves the Rfcomm channel.
This function is provided just for conveniance.
@param n The Rfcomm channel.
@ret true if an rfcomm channel was found, false otherwise. */
bool rfcommChannel(unsigned int &n);
bool hasClassID(const OTUUID & uuid);
private:
struct AttributeEntry {
int id;
OTSDPAttribute * attr;
};
QArray<AttributeEntry> attributeList;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTUUID.h b/noncore/settings/networksettings2/opietooth2/OTUUID.h
index 97df114..aebd9b9 100644
--- a/noncore/settings/networksettings2/opietooth2/OTUUID.h
+++ b/noncore/settings/networksettings2/opietooth2/OTUUID.h
@@ -9,50 +9,50 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef OTUUID_H
#define OTUUID_H
#include <qstring.h>
#include <qarray.h>
#include <bluezlib.h>
namespace Opietooth2 {
class OTUUID;
typedef QArray<OTUUID> UUIDVector;
class OTUUID {
public :
OTUUID( QString s );
OTUUID( uint64_t l=0, uint64_t h=0);
OTUUID( const OTUUID & O );
bool fromString(QString s);
void setUUID128(uint64_t hi, uint64_t lo);
void setUUID32(uint32_t v);
uint16_t toShort()
{ return ((hi>>32) & 0xffff); }
uint32_t toLong()
{ return ((hi>>32) & 0xffffffff); }
uint64_t toLongLong()
{ return hi; }
QString toString() const ;
operator QString() const;
operator ::uuid_t() const;
OTUUID & operator=( const OTUUID & other ) ;
bool operator<( const OTUUID & other ) const;
bool operator==(const OTUUID & uuid) const;
uint64_t hi;
uint64_t lo;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.h b/noncore/settings/networksettings2/opietooth2/Opietooth.h
index e66787f..f077dd7 100644
--- a/noncore/settings/networksettings2/opietooth2/Opietooth.h
+++ b/noncore/settings/networksettings2/opietooth2/Opietooth.h
@@ -1,238 +1,238 @@
#ifndef OPIETOOTH_H
#define OPIETOOTH_H
#include <OTIcons.h>
class MyProcess;
namespace Opie {
namespace Ui {
class OLedBox;
- };
+ }
-};
+}
#include <OTSniffGUI.h>
namespace Opietooth2 {
class OTGateway;
class OTDriver;
class OTInquiry;
class OTPeer;
class PeerLVI;
class OTSniffing : public OTSniffGUI {
Q_OBJECT
public :
OTSniffing( QWidget * parent );
~OTSniffing();
private slots :
void SLOT_Trace( bool );
void SLOT_ClearLog( void );
void SLOT_Load( void );
void SLOT_Save( void );
void SLOT_ProcessExited( MyProcess * );
void SLOT_Show( const QString & );
signals :
protected :
private :
OTGateway * OT;
MyProcess * HciDump;
};
-};
+}
#include <OTPairingGUI.h>
namespace Opietooth2 {
class OTPairing : public OTPairingGUI {
Q_OBJECT
public :
OTPairing( QWidget * parent,
OTIcons * _Ic = 0 );
~OTPairing();
private slots :
void SLOT_Unpair( void );
signals :
protected :
private :
bool MyIcons;
OTIcons * Icons;
OTGateway * OT;
};
-};
+}
#include <OTScanGUI.h>
namespace Opietooth2 {
class OTGateway;
class OTDriver;
class OTInquiry;
class OTPeer;
class OTScan : public OTScanGUI {
Q_OBJECT
public :
OTScan( QWidget * parent,
OTIcons * _Ic = 0 );
~OTScan();
// static function to return a device and a channel
static int getDevice( OTPeer *& Peer,
int & Channel,
OTGateway * OT,
const UUIDVector & Filter = 0,
QWidget* Parent = 0);
// show only services that match any of the filter
void setScanFilter( const UUIDVector & Filter );
void resetScanFilter( void );
inline OTPeer * selectedPeer( void )
{ return SelectedPeer; }
inline int selectedChannel( void )
{ return SelectedChannel; }
public slots :
private slots :
void SLOT_DoScan( bool );
void SLOT_NewPeer( OTPeer *, bool );
void SLOT_FinishedDetecting();
void SLOT_Show( QListViewItem *);
void SLOT_RefreshServices( void );
void SLOT_RefreshState( void );
void SLOT_CleanupOld( void );
void SLOT_UpdateStrength( void );
void SLOT_PeerState( OTPeer * );
void SLOT_Selected( QListViewItem * );
signals :
void selected( void );
protected :
private :
void refreshState( PeerLVI *, bool );
void scanMode( bool );
// load scanned devices
bool MyIcons;
OTIcons * Icons;
OTGateway * OT;
OTInquiry * Scanning;
UUIDVector Filter;
Opie::Ui::OLedBox * Paired_Led;
QTimer * StrengthTimer;
PeerLVI * Current;
OTPeer * SelectedPeer;
int SelectedChannel;
};
-};
+}
#include <OTManageGUI.h>
namespace Opietooth2 {
class OTManage : public OTManageGUI {
Q_OBJECT
public :
OTManage( QWidget * parent,
OTIcons * _IC = 0 );
~OTManage();
public slots :
private slots :
void SLOT_ShowDriver( QListViewItem * );
void SLOT_UpDriver( bool );
void SLOT_StateChange( OTDriver * , bool );
void SLOT_DriverListChanged();
void SLOT_SetRefreshTimer( int );
signals :
protected :
private :
// load scanned devices
bool MyIcons;
OTIcons * Icons;
OTGateway * OT;
OTInquiry * Scanning;
};
-};
+}
#include <OTMainGUI.h>
namespace Opietooth2 {
class OTMain : public OTMainGUI {
Q_OBJECT
public :
OTMain( QWidget * parent );
~OTMain();
public slots :
private slots :
void SLOT_Pairing( void );
void SLOT_Manage( void );
void SLOT_Sniffing( void );
void SLOT_Scan( void );
void SLOT_EnableBluetooth( bool );
void SLOT_DriverListChanged();
void SLOT_DeviceIsEnabled( bool );
void SLOT_StateChange( OTDriver * , bool );
signals :
protected :
private :
// load scanned devices
OTIcons * Icons;
OTGateway * OT;
QDialog * SnifWindow;
};
-};
+}
#endif
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro
index dd3408c..10d0f1b 100644
--- a/noncore/settings/networksettings2/ppp/ppp.pro
+++ b/noncore/settings/networksettings2/ppp/ppp.pro
@@ -1,33 +1,33 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = ppp_NN.h \
ppp_NNI.h \
PPPedit.h \
PPPAuthedit.h \
PPPDNSedit.h \
PPPRunedit.h \
PPPDialingedit.h \
PPPIPedit.h
SOURCES = ppp_NN.cpp \
ppp_NNI.cpp \
PPPedit.cpp \
PPPDNSedit.cpp \
PPPRunedit.cpp \
PPPDialingedit.cpp \
PPPAuthedit.cpp \
ppprun.cpp \
PPPIPedit.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = PPPGUI.ui \
PPPAuthGUI.ui \
PPPIPGUI.ui \
PPPDNSGUI.ui \
PPPDialingGUI.ui \
PPPRunGUI.ui
TARGET = ppp
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index 51ba27d..bd13ab9 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1,85 +1,100 @@
#include <qfile.h>
#include <resources.h>
#include <qtextstream.h>
#include "ppp_NN.h"
#include "ppp_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
QStringList * PPPNetNode::ProperFiles = 0;
static const char * PPPNeeds[] =
{ "modem",
0
};
static const char * PPPProvides[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
NSResources->addSystemFile(
"pap-secrets", "/etc/ppp/pap-secrets", 0 );
NSResources->addSystemFile(
"chap-secrets", "/etc/ppp/chap-secrets", 0 );
}
/**
* Delete any interfaces that we own.
*/
PPPNetNode::~PPPNetNode(){
}
const QString PPPNetNode::nodeDescription(){
return tr("\
<p>Sets up IP using PPP.</p>\
<p>Use this for dialup devices or serial setups</p>\
"
);
}
ANetNodeInstance * PPPNetNode::createInstance( void ) {
return new APPP( this );
}
const char ** PPPNetNode::needs( void ) {
return PPPNeeds;
}
const char ** PPPNetNode::provides( void ) {
return PPPProvides;
}
QStringList PPPNetNode::properFiles( void ) {
QStringList SL;
SL << "peers" << "chatscripts";
return SL;
}
// need to generate :
// /etc/ppp/pap-secrets
// /etc/ppp/pap-secrets
bool PPPNetNode::hasDataForFile( SystemFile & S ) {
return S.name() == "pap-secrets" ||
S.name() == "chap-secrets" ;
}
QString PPPNetNode::genNic( long NicNr ) {
QString S;
return S.sprintf( "ppp%ld", NicNr );
}
void PPPNetNode::setSpecificAttribute( QString & , QString & ) {
}
void PPPNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new PPPNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<PPPNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/profile/profile.pro b/noncore/settings/networksettings2/profile/profile.pro
index f980034..4db7a5d 100644
--- a/noncore/settings/networksettings2/profile/profile.pro
+++ b/noncore/settings/networksettings2/profile/profile.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = profile_NN.h \
profile_NNI.h \
profileedit.h
SOURCES = profile_NN.cpp \
profile_NNI.cpp \
profileedit.cpp \
profilerun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = profileGUI.ui
TARGET = profile
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index b7d8aa0..6028ea5 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -1,60 +1,75 @@
#include <resources.h>
#include "profile_NN.h"
#include "profile_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * ProfileNeeds[] =
{ "connection",
0
};
static const char * ProfileProvides[] =
{ "fullsetup",
0
};
/**
* Constructor, find all of the possible interfaces
*/
ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
NSResources->addSystemFile(
"interfaces", "/etc/network/interfaces", 1 );
}
/**
* Delete any interfaces that we own.
*/
ProfileNetNode::~ProfileNetNode(){
}
const QString ProfileNetNode::nodeDescription(){
return tr("\
<p>Define use of an IP connection.</p>\
<p>Configure if and when this connection needs to be established</p>\
"
);
}
ANetNodeInstance * ProfileNetNode::createInstance( void ) {
return new AProfile( this );
}
const char ** ProfileNetNode::needs( void ) {
return ProfileNeeds;
}
const char ** ProfileNetNode::provides( void ) {
return ProfileProvides;
}
void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
}
void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new ProfileNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<ProfileNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/usb/usb.pro b/noncore/settings/networksettings2/usb/usb.pro
index 37c1bde..d9890b6 100644
--- a/noncore/settings/networksettings2/usb/usb.pro
+++ b/noncore/settings/networksettings2/usb/usb.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = usb_NN.h \
usb_NNI.h \
usbedit.h
SOURCES = usb_NN.cpp \
usb_NNI.cpp \
usbedit.cpp \
usbrun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = usbGUI.ui
TARGET = usb
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index bd9ae2b..9c07b82 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -1,62 +1,77 @@
#include <resources.h>
#include "usb_NN.h"
#include "usb_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * USBNeeds[] =
{ 0
};
static const char * USBProvides[] =
{ "device",
0
};
/**
* Constructor, find all of the possible interfaces
*/
USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) {
NSResources->addSystemFile(
"interfaces", "/etc/network/interfaces", 1 );
}
/**
* Delete any interfaces that we own.
*/
USBNetNode::~USBNetNode(){
}
const QString USBNetNode::nodeDescription(){
return tr("\
<p>Configure Ethernet over USB.</p>\
<p>Use this for a computer to computer USB cable connection</p>\
"
);
}
ANetNodeInstance * USBNetNode::createInstance( void ) {
return new AUSB( this );
}
const char ** USBNetNode::needs( void ) {
return USBNeeds;
}
const char ** USBNetNode::provides( void ) {
return USBProvides;
}
QString USBNetNode::genNic( long ) {
return QString( "usbf" );
}
void USBNetNode::setSpecificAttribute( QString & , QString & ) {
}
void USBNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new USBNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<USBNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
index 600b771..424845c 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -1,59 +1,59 @@
#include <qpe/qpeapplication.h>
#include "usbedit.h"
#include "usb_NNI.h"
#include "usb_NN.h"
AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) {
GUI = 0;
RT = 0;
}
void AUSB::setSpecificAttribute( QString & , QString & ) {
}
void AUSB::saveSpecificAttribute( QTextStream & ) {
}
QWidget * AUSB::edit( QWidget * parent ) {
GUI = new USBEdit( parent );
GUI->showData( Data );
return GUI;
}
QString AUSB::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void AUSB::commit( void ) {
if( GUI && GUI->commit( Data ) ) {
setModified( 1 );
}
}
short AUSB::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
short rvl, rvd;
rvl = 1;
if( SF.name() == "interfaces" ) {
Log(("Generate USB for %s\n", SF.name().latin1() ));
// generate mapping stanza for this interface
SF << " pre-up "
<< QPEApplication::qpeDir()
- << "bin/setmacaddress.sh "
+ << "bin/NS2SetMac.sh "
<< NIC
<< " || true"
<< endl;
rvl = 0;
}
rvd = ANetNodeInstance::generateFileEmbedded(SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
(rvd == 0 || rvl == 0 ) ? 0 : 1;
}
diff --git a/noncore/settings/networksettings2/vpn/vpn.pro b/noncore/settings/networksettings2/vpn/vpn.pro
index a131a1f..349571e 100644
--- a/noncore/settings/networksettings2/vpn/vpn.pro
+++ b/noncore/settings/networksettings2/vpn/vpn.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = vpn_NN.h \
vpn_NNI.h \
vpnedit.h
SOURCES = vpn_NN.cpp \
vpn_NNI.cpp \
vpnedit.cpp \
vpnrun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = vpnGUI.ui
TARGET = vpn
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index 23ec04a..6dd5332 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -1,54 +1,69 @@
#include "vpn_NN.h"
#include "vpn_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
static const char * VPNNeeds[] =
{ 0
};
static const char * VPNProvides[] =
{ "connection",
0
};
/**
* Constructor, find all of the possible interfaces
*/
VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) {
}
/**
* Delete any interfaces that we own.
*/
VPNNetNode::~VPNNetNode(){
}
const QString VPNNetNode::nodeDescription(){
return tr("\
<p>Configure private IP connection.</p>\
<p>Defines Secure tunnels over non secure IP sessions</p>\
"
);
}
ANetNodeInstance * VPNNetNode::createInstance( void ) {
return new AVPN( this );
}
const char ** VPNNetNode::needs( void ) {
return VPNNeeds;
}
const char ** VPNNetNode::provides( void ) {
return VPNProvides;
}
void VPNNetNode::setSpecificAttribute( QString & , QString & ) {
}
void VPNNetNode::saveSpecificAttribute( QTextStream & ) {
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new VPNNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<VPNNetNode> )
+
+#endif
+
}
diff --git a/noncore/settings/networksettings2/wlan/wlan.pro b/noncore/settings/networksettings2/wlan/wlan.pro
index f4c55df..a08cbbb 100644
--- a/noncore/settings/networksettings2/wlan/wlan.pro
+++ b/noncore/settings/networksettings2/wlan/wlan.pro
@@ -1,18 +1,18 @@
TEMPLATE = lib
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release plugin
DESTDIR = $(OPIEDIR)/plugins/networksettings2
HEADERS = wlan_NN.h \
wlan_NNI.h \
wlanedit.h
SOURCES = wlan_NN.cpp \
wlan_NNI.cpp \
wlanedit.cpp \
wlanrun.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
LIBS += -lqpe
INTERFACES = wlanGUI.ui
TARGET = wlan
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index 36a5c33..c56da06 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -1,70 +1,85 @@
#include <resources.h>
#include "wlan_NN.h"
#include "wlan_NNI.h"
+#ifndef MYPLUGIN
+
+#include "netnodeinterface.h"
+
+#endif
+
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;
}
/**
* Delete any interfaces that we own.
*/
WLanNetNode::~WLanNetNode(){
}
const QString WLanNetNode::nodeDescription(){
return tr("\
<p>Configure Wi/Fi or WLan network cards.</p>\
<p>Defines Wireless options for those cards</p>\
"
);
}
ANetNodeInstance * WLanNetNode::createInstance( void ) {
return new AWLan( this );
}
const char ** WLanNetNode::needs( void ) {
return WLanNeeds;
}
const char ** WLanNetNode::provides( void ) {
return WLanProvides;
}
QString WLanNetNode::genNic( long nr ) {
QString S;
return S.sprintf( "wlan%ld", nr );
}
void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) {
if( A == "interfacecount" ) {
InstanceCount = V.toLong();
}
}
void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) {
TS << "interfacecount="
<< InstanceCount
<< endl;
}
+#ifdef MYPLUGIN
+
extern "C" {
void create_plugin( QList<ANetNode> & PNN ) {
PNN.append( new WLanNetNode() );
}
+
+#else
+
+OPIE_NS2_PLUGIN( NetNodeInterface<WLanNetNode> )
+
+#endif
+
}