Diffstat (limited to 'noncore/settings/networksettings2/bluetooth') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | 10 |
2 files changed, 30 insertions, 2 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 3d1aa69..4579e37 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -1,123 +1,143 @@ | |||
1 | #include "bluetooth_NN.h" | 1 | #include "bluetooth_NN.h" |
2 | #include "bluetoothBNEP_NNI.h" | 2 | #include "bluetoothBNEP_NNI.h" |
3 | #include "bluetoothRFCOMM_NNI.h" | 3 | #include "bluetoothRFCOMM_NNI.h" |
4 | 4 | ||
5 | // | 5 | // |
6 | // | 6 | // |
7 | // BLUETOOTH PAN/NAP node | 7 | // BLUETOOTH PAN/NAP node |
8 | // | 8 | // |
9 | // | 9 | // |
10 | 10 | ||
11 | static const char * BluetoothBNEPNeeds[] = | 11 | static const char * BluetoothBNEPNeeds[] = |
12 | { 0 | 12 | { 0 |
13 | }; | 13 | }; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Constructor, find all of the possible interfaces | 16 | * Constructor, find all of the possible interfaces |
17 | */ | 17 | */ |
18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { | 18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { |
19 | InstanceCount = 7; // default | ||
19 | } | 20 | } |
20 | 21 | ||
21 | /** | 22 | /** |
22 | * Delete any interfaces that we own. | 23 | * Delete any interfaces that we own. |
23 | */ | 24 | */ |
24 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ | 25 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ |
25 | } | 26 | } |
26 | 27 | ||
27 | const QString BluetoothBNEPNetNode::nodeDescription(){ | 28 | const QString BluetoothBNEPNetNode::nodeDescription(){ |
28 | return tr("\ | 29 | return tr("\ |
29 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ | 30 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ |
30 | <p>Use this to connect two computing devices.</p>\ | 31 | <p>Use this to connect two computing devices.</p>\ |
31 | " | 32 | " |
32 | ); | 33 | ); |
33 | } | 34 | } |
34 | 35 | ||
35 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { | 36 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { |
36 | return new ABluetoothBNEP( this ); | 37 | return new ABluetoothBNEP( this ); |
37 | } | 38 | } |
38 | 39 | ||
39 | const char ** BluetoothBNEPNetNode::needs( void ) { | 40 | const char ** BluetoothBNEPNetNode::needs( void ) { |
40 | return BluetoothBNEPNeeds; | 41 | return BluetoothBNEPNeeds; |
41 | } | 42 | } |
42 | 43 | ||
43 | const char * BluetoothBNEPNetNode::provides( void ) { | 44 | const char * BluetoothBNEPNetNode::provides( void ) { |
44 | return "device"; | 45 | return "device"; |
45 | } | 46 | } |
46 | 47 | ||
47 | bool BluetoothBNEPNetNode::generateProperFilesFor( | 48 | bool BluetoothBNEPNetNode::generateProperFilesFor( |
48 | ANetNodeInstance * ) { | 49 | ANetNodeInstance * ) { |
49 | return 1; | 50 | return 1; |
50 | } | 51 | } |
51 | 52 | ||
52 | bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) { | 53 | bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) { |
53 | return S == "interfaces"; | 54 | return S == "interfaces"; |
54 | } | 55 | } |
55 | 56 | ||
56 | bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( | 57 | bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( |
57 | SystemFile & , | 58 | SystemFile & , |
58 | long ) { | 59 | long ) { |
59 | return 1; | 60 | return 1; |
60 | } | 61 | } |
61 | 62 | ||
62 | QString BluetoothBNEPNetNode::genNic( long nr ) { | 63 | QString BluetoothBNEPNetNode::genNic( long nr ) { |
63 | QString S; | 64 | QString S; |
64 | return S.sprintf( "bnep%ld", nr ); | 65 | return S.sprintf( "bnep%ld", nr ); |
65 | } | 66 | } |
66 | 67 | ||
68 | |||
69 | void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { | ||
70 | if( A == "interfacecount" ) { | ||
71 | InstanceCount = V.toLong(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { | ||
76 | TS << "interfacecount=" | ||
77 | << InstanceCount | ||
78 | << endl; | ||
79 | } | ||
80 | |||
67 | // | 81 | // |
68 | // | 82 | // |
69 | // BLUETOOTH PAN/NAP node | 83 | // BLUETOOTH RFCOMM |
70 | // | 84 | // |
71 | // | 85 | // |
72 | 86 | ||
73 | static const char * BluetoothRFCOMMNeeds[] = | 87 | static const char * BluetoothRFCOMMNeeds[] = |
74 | { 0 | 88 | { 0 |
75 | }; | 89 | }; |
76 | 90 | ||
77 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { | 91 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { |
78 | } | 92 | } |
79 | 93 | ||
80 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ | 94 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ |
81 | } | 95 | } |
82 | 96 | ||
83 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ | 97 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ |
84 | return tr("\ | 98 | return tr("\ |
85 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ | 99 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ |
86 | <p>Use this to connect to a GSM.</p>\ | 100 | <p>Use this to connect to a GSM.</p>\ |
87 | " | 101 | " |
88 | ); | 102 | ); |
89 | } | 103 | } |
90 | 104 | ||
91 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { | 105 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { |
92 | return new ABluetoothRFCOMM( this ); | 106 | return new ABluetoothRFCOMM( this ); |
93 | } | 107 | } |
94 | 108 | ||
95 | const char ** BluetoothRFCOMMNetNode::needs( void ) { | 109 | const char ** BluetoothRFCOMMNetNode::needs( void ) { |
96 | return BluetoothRFCOMMNeeds; | 110 | return BluetoothRFCOMMNeeds; |
97 | } | 111 | } |
98 | 112 | ||
99 | const char * BluetoothRFCOMMNetNode::provides( void ) { | 113 | const char * BluetoothRFCOMMNetNode::provides( void ) { |
100 | return "line"; | 114 | return "line"; |
101 | } | 115 | } |
102 | 116 | ||
103 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( | 117 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( |
104 | ANetNodeInstance * ) { | 118 | ANetNodeInstance * ) { |
105 | return 0; | 119 | return 0; |
106 | } | 120 | } |
107 | 121 | ||
108 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { | 122 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { |
109 | return 0; | 123 | return 0; |
110 | } | 124 | } |
111 | 125 | ||
112 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( | 126 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( |
113 | SystemFile & , | 127 | SystemFile & , |
114 | long ) { | 128 | long ) { |
115 | return 0; | 129 | return 0; |
116 | } | 130 | } |
117 | 131 | ||
132 | void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { | ||
133 | } | ||
134 | |||
135 | void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) { | ||
136 | } | ||
137 | |||
118 | extern "C" { | 138 | extern "C" { |
119 | void create_plugin( QList<ANetNode> & PNN ) { | 139 | void create_plugin( QList<ANetNode> & PNN ) { |
120 | PNN.append( new BluetoothBNEPNetNode() ); | 140 | PNN.append( new BluetoothBNEPNetNode() ); |
121 | PNN.append( new BluetoothRFCOMMNetNode() ); | 141 | PNN.append( new BluetoothRFCOMMNetNode() ); |
122 | } | 142 | } |
123 | } | 143 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index 5cd6c52..882d2e3 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -12,68 +12,76 @@ class BluetoothBNEPNetNode : public ANetNode { | |||
12 | public: | 12 | public: |
13 | 13 | ||
14 | BluetoothBNEPNetNode(); | 14 | BluetoothBNEPNetNode(); |
15 | virtual ~BluetoothBNEPNetNode(); | 15 | virtual ~BluetoothBNEPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/bluetooth"; } | 18 | { return "Devices/bluetooth"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Bluetooth PAN/NAP"); } | 21 | { return tr("Bluetooth PAN/NAP"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDeviceDataForCommonFile( | 32 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & , long DevNr ); | 33 | SystemFile & , long DevNr ); |
34 | 34 | ||
35 | virtual long instanceCount( void ) | 35 | virtual long instanceCount( void ) |
36 | { return 7; } | 36 | { return InstanceCount; } |
37 | virtual QString genNic( long ); | 37 | virtual QString genNic( long ); |
38 | 38 | ||
39 | private: | 39 | private: |
40 | 40 | ||
41 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
42 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
43 | |||
44 | // number of interfaces for this device | ||
45 | long InstanceCount; | ||
46 | |||
41 | }; | 47 | }; |
42 | 48 | ||
43 | class BluetoothRFCOMMNetNode : public ANetNode { | 49 | class BluetoothRFCOMMNetNode : public ANetNode { |
44 | 50 | ||
45 | Q_OBJECT | 51 | Q_OBJECT |
46 | 52 | ||
47 | public: | 53 | public: |
48 | 54 | ||
49 | BluetoothRFCOMMNetNode(); | 55 | BluetoothRFCOMMNetNode(); |
50 | virtual ~BluetoothRFCOMMNetNode(); | 56 | virtual ~BluetoothRFCOMMNetNode(); |
51 | 57 | ||
52 | virtual const QString pixmapName() | 58 | virtual const QString pixmapName() |
53 | { return "Devices/bluetooth"; } | 59 | { return "Devices/bluetooth"; } |
54 | 60 | ||
55 | virtual const QString nodeName() | 61 | virtual const QString nodeName() |
56 | { return tr("Bluetooth serial link"); } | 62 | { return tr("Bluetooth serial link"); } |
57 | 63 | ||
58 | virtual const QString nodeDescription() ; | 64 | virtual const QString nodeDescription() ; |
59 | 65 | ||
60 | virtual ANetNodeInstance * createInstance( void ); | 66 | virtual ANetNodeInstance * createInstance( void ); |
61 | 67 | ||
62 | virtual const char ** needs( void ); | 68 | virtual const char ** needs( void ); |
63 | virtual const char * provides( void ); | 69 | virtual const char * provides( void ); |
64 | 70 | ||
65 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 71 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
66 | virtual bool hasDataFor( const QString & S ); | 72 | virtual bool hasDataFor( const QString & S ); |
67 | virtual bool generateDeviceDataForCommonFile( | 73 | virtual bool generateDeviceDataForCommonFile( |
68 | SystemFile & , long ); | 74 | SystemFile & , long ); |
69 | 75 | ||
70 | private: | 76 | private: |
71 | 77 | ||
78 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
79 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
72 | }; | 80 | }; |
73 | 81 | ||
74 | extern "C" | 82 | extern "C" |
75 | { | 83 | { |
76 | void create_plugin( QList<ANetNode> & PNN ); | 84 | void create_plugin( QList<ANetNode> & PNN ); |
77 | }; | 85 | }; |
78 | 86 | ||
79 | #endif | 87 | #endif |