summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib
Unidiff
Diffstat (limited to 'noncore/net/opietooth/lib') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/connection.cpp32
-rw-r--r--noncore/net/opietooth/lib/connection.h16
-rw-r--r--noncore/net/opietooth/lib/manager.cc10
-rw-r--r--noncore/net/opietooth/lib/manager.h4
4 files changed, 31 insertions, 31 deletions
diff --git a/noncore/net/opietooth/lib/connection.cpp b/noncore/net/opietooth/lib/connection.cpp
index 1f9baaf..ef7d925 100644
--- a/noncore/net/opietooth/lib/connection.cpp
+++ b/noncore/net/opietooth/lib/connection.cpp
@@ -1,24 +1,24 @@
1 1
2#include "connection.h" 2#include "connection.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6Connection::Connection() { 6ConnectionState::ConnectionState() {
7 m_direction = Incoming; 7 m_direction = Incoming;
8 m_handle = -1; 8 m_handle = -1;
9 m_state = -1; 9 m_state = -1;
10 m_linkMode = -1; 10 m_linkMode = -1;
11}; 11};
12 12
13Connection::Connection( const Connection& con1 ) { 13ConnectionState::ConnectionState( const ConnectionState& con1 ) {
14 (*this) = con1; 14 (*this) = con1;
15} 15}
16 16
17 17
18Connection::Connection( bool in, 18ConnectionState::ConnectionState( bool in,
19 const QString& conType, 19 const QString& conType,
20 const QString& mac, 20 const QString& mac,
21 int handle, 21 int handle,
22 int state, 22 int state,
23 int linkMode ) { 23 int linkMode ) {
24 m_direction = in; 24 m_direction = in;
@@ -27,61 +27,61 @@ Connection::Connection( bool in,
27 m_handle = handle; 27 m_handle = handle;
28 m_state = state; 28 m_state = state;
29 m_linkMode = linkMode; 29 m_linkMode = linkMode;
30 30
31} 31}
32 32
33void Connection::setDirection( bool incoming ) { 33void ConnectionState::setDirection( bool incoming ) {
34 m_direction = incoming; 34 m_direction = incoming;
35} 35}
36 36
37bool Connection::direction() const { 37bool ConnectionState::direction() const {
38 return m_direction; 38 return m_direction;
39} 39}
40 40
41void Connection::setConnectionMode( const QString& conType ) { 41void ConnectionState::setConnectionMode( const QString& conType ) {
42 m_contype = conType; 42 m_contype = conType;
43} 43}
44 44
45QString Connection::connectionMode() const { 45QString ConnectionState::connectionMode() const {
46 return m_contype; 46 return m_contype;
47} 47}
48 48
49void Connection::setMac( const QString& mac ) { 49void ConnectionState::setMac( const QString& mac ) {
50 m_mac = mac; 50 m_mac = mac;
51} 51}
52 52
53QString Connection::mac() const{ 53QString ConnectionState::mac() const{
54 return m_mac; 54 return m_mac;
55} 55}
56 56
57void Connection::setHandle( int handle ) { 57void ConnectionState::setHandle( int handle ) {
58 m_handle = handle; 58 m_handle = handle;
59} 59}
60 60
61int Connection::handle() const{ 61int ConnectionState::handle() const{
62 return m_handle; 62 return m_handle;
63} 63}
64 64
65void Connection::setState( int state ) { 65void ConnectionState::setState( int state ) {
66 m_state = state; 66 m_state = state;
67} 67}
68 68
69int Connection::state()const { 69int ConnectionState::state()const {
70 return m_state; 70 return m_state;
71} 71}
72 72
73void Connection::setLinkMode( int linkMode ) { 73void ConnectionState::setLinkMode( int linkMode ) {
74 m_linkMode = linkMode; 74 m_linkMode = linkMode;
75} 75}
76 76
77int Connection::linkMode()const{ 77int ConnectionState::linkMode()const{
78 return m_linkMode; 78 return m_linkMode;
79} 79}
80 80
81Connection &Connection::operator=( const Connection& con1 ) { 81ConnectionState &ConnectionState::operator=( const ConnectionState& con1 ) {
82 m_direction = con1.m_direction; 82 m_direction = con1.m_direction;
83 m_contype = con1.m_contype; 83 m_contype = con1.m_contype;
84 m_mac = con1.m_mac; 84 m_mac = con1.m_mac;
85 m_handle = con1.m_handle; 85 m_handle = con1.m_handle;
86 m_state = con1.m_state; 86 m_state = con1.m_state;
87 m_linkMode = con1.m_linkMode; 87 m_linkMode = con1.m_linkMode;
diff --git a/noncore/net/opietooth/lib/connection.h b/noncore/net/opietooth/lib/connection.h
index 37090ce..76e5dad 100644
--- a/noncore/net/opietooth/lib/connection.h
+++ b/noncore/net/opietooth/lib/connection.h
@@ -14,24 +14,24 @@ namespace OpieTooth {
14 /** 14 /**
15 * The Connection class stores 15 * The Connection class stores
16 * the output of hcitool con 16 * the output of hcitool con
17 * in a OO way 17 * in a OO way
18 */ 18 */
19 19
20 class Connection { 20 class ConnectionState {
21 public: 21 public:
22 /** 22 /**
23 * typedef for a list of 23 * typedef for a list of
24 * Connections 24 * Connections
25 */ 25 */
26 typedef QValueList<Connection> ValueList; 26 typedef QValueList<ConnectionState> ValueList;
27 27
28 /** 28 /**
29 * Copy c'tor. 29 * Copy c'tor.
30 */ 30 */
31 Connection( const Connection& ); 31 ConnectionState( const ConnectionState& );
32 32
33 /** 33 /**
34 * Main c'tor 34 * Main c'tor
35 * Basicly it holds all values 35 * Basicly it holds all values
36 * a blueZ connections can have 36 * a blueZ connections can have
37 * @param in If the connection is either incoming or outgoing 37 * @param in If the connection is either incoming or outgoing
@@ -41,24 +41,24 @@ namespace OpieTooth {
41 * @param state the State of the connection 41 * @param state the State of the connection
42 * @param linkMode the linkmode of the connection MASTER or not 42 * @param linkMode the linkmode of the connection MASTER or not
43 * 43 *
44 * < ACL 00:02:C7:09:2B:53 handle 1 state 1 lm MASTER 44 * < ACL 00:02:C7:09:2B:53 handle 1 state 1 lm MASTER
45 * 45 *
46 */ 46 */
47 Connection( bool in, 47 ConnectionState( bool in,
48 const QString& conType, 48 const QString& conType,
49 const QString& mac, 49 const QString& mac,
50 int handle, 50 int handle,
51 int state, 51 int state,
52 int linkMode ); 52 int linkMode );
53 53
54 /** 54 /**
55 * C'tor for compability with QValueList 55 * C'tor for compability with QValueList
56 * QValueList needs this c'tor. 56 * QValueList needs this c'tor.
57 */ 57 */
58 Connection(); 58 ConnectionState();
59 59
60 /** 60 /**
61 * Set if the connection is incoming or 61 * Set if the connection is incoming or
62 * outgoing 62 * outgoing
63 * @param in Whether or not the connection is ingoing or not. 63 * @param in Whether or not the connection is ingoing or not.
64 * for param use either Incoming or Outgoing 64 * for param use either Incoming or Outgoing
@@ -128,17 +128,17 @@ namespace OpieTooth {
128 */ 128 */
129 int linkMode()const; 129 int linkMode()const;
130 130
131 /** 131 /**
132 * copy c'tor 132 * copy c'tor
133 */ 133 */
134 Connection &operator=( const Connection& ); 134 ConnectionState &operator=( const ConnectionState& );
135 135
136 private: 136 private:
137 class ConnectionPrivate; 137 class ConnectionStatePrivate;
138 ConnectionPrivate *d; 138 ConnectionStatePrivate *d;
139 bool m_direction : 1; 139 bool m_direction : 1;
140 QString m_contype; 140 QString m_contype;
141 QString m_mac; 141 QString m_mac;
142 int m_handle; 142 int m_handle;
143 int m_state; 143 int m_state;
144 int m_linkMode; 144 int m_linkMode;
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index e07f9da..1281116 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -251,30 +251,30 @@ void Manager::searchConnections() {
251 connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), 251 connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ),
252 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); 252 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) );
253 *proc << "hcitool"; 253 *proc << "hcitool";
254 *proc << "con"; 254 *proc << "con";
255 255
256 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 256 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
257 Connection::ValueList list; 257 ConnectionState::ValueList list;
258 emit connections( list ); 258 emit connections( list );
259 delete proc; 259 delete proc;
260 } 260 }
261} 261}
262void Manager::slotConnectionExited( OProcess* /*proc*/ ) { 262void Manager::slotConnectionExited( OProcess* /*proc*/ ) {
263 qWarning("exited"); 263 qWarning("exited");
264 Connection::ValueList list; 264 ConnectionState::ValueList list;
265 list = parseConnections( m_hcitoolCon ); 265 list = parseConnections( m_hcitoolCon );
266 emit connections(list ); 266 emit connections(list );
267} 267}
268void Manager::slotConnectionOutput(OProcess* proc, char* cha, int len) { 268void Manager::slotConnectionOutput(OProcess* proc, char* cha, int len) {
269 QCString str(cha, len ); 269 QCString str(cha, len );
270 m_hcitoolCon.append( str ); 270 m_hcitoolCon.append( str );
271 delete proc; 271 delete proc;
272} 272}
273Connection::ValueList Manager::parseConnections( const QString& out ) { 273ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
274 Connection::ValueList list2; 274 ConnectionState::ValueList list2;
275 QStringList list = QStringList::split('\n', out ); 275 QStringList list = QStringList::split('\n', out );
276 QStringList::Iterator it; 276 QStringList::Iterator it;
277 for (it = list.begin(); it != list.end(); ++it ) { 277 for (it = list.begin(); it != list.end(); ++it ) {
278 QString row = (*it).stripWhiteSpace(); 278 QString row = (*it).stripWhiteSpace();
279 QStringList value = QStringList::split(' ', row ); 279 QStringList value = QStringList::split(' ', row );
280 qWarning("0: %s", value[0].latin1() ); 280 qWarning("0: %s", value[0].latin1() );
@@ -283,13 +283,13 @@ Connection::ValueList Manager::parseConnections( const QString& out ) {
283 qWarning("3: %s", value[3].latin1() ); 283 qWarning("3: %s", value[3].latin1() );
284 qWarning("4: %s", value[4].latin1() ); 284 qWarning("4: %s", value[4].latin1() );
285 qWarning("5: %s", value[5].latin1() ); 285 qWarning("5: %s", value[5].latin1() );
286 qWarning("6: %s", value[6].latin1() ); 286 qWarning("6: %s", value[6].latin1() );
287 qWarning("7: %s", value[7].latin1() ); 287 qWarning("7: %s", value[7].latin1() );
288 qWarning("8: %s", value[8].latin1() ); 288 qWarning("8: %s", value[8].latin1() );
289 Connection con; 289 ConnectionState con;
290 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); 290 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
291 con.setConnectionMode( value[1] ); 291 con.setConnectionMode( value[1] );
292 con.setMac( value[2] ); 292 con.setMac( value[2] );
293 con.setHandle( value[4].toInt() ); 293 con.setHandle( value[4].toInt() );
294 con.setState( value[6].toInt() ); 294 con.setState( value[6].toInt() );
295 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); 295 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client );
diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h
index b32327c..0ebe1b3 100644
--- a/noncore/net/opietooth/lib/manager.h
+++ b/noncore/net/opietooth/lib/manager.h
@@ -134,13 +134,13 @@ namespace OpieTooth {
134 // the first device is the device which you access 134 // the first device is the device which you access
135 void available( const QString& device, bool connected ); 135 void available( const QString& device, bool connected );
136 void addedService( const QString& service, bool added ); 136 void addedService( const QString& service, bool added );
137 void removedService( const QString& service, bool removed ); 137 void removedService( const QString& service, bool removed );
138 void foundServices( const QString& device, Services::ValueList ); 138 void foundServices( const QString& device, Services::ValueList );
139 void foundDevices( const QString& device, RemoteDevice::ValueList ); 139 void foundDevices( const QString& device, RemoteDevice::ValueList );
140 void connections( Connection::ValueList ); 140 void connections( ConnectionState::ValueList );
141 141
142private slots: 142private slots:
143 void slotProcessExited(OProcess* ); 143 void slotProcessExited(OProcess* );
144 144
145 void slotSDPExited(OProcess*); 145 void slotSDPExited(OProcess*);
146 void slotSDPOut(OProcess*, char*, int); 146 void slotSDPOut(OProcess*, char*, int);
@@ -150,13 +150,13 @@ private slots:
150 150
151 void slotConnectionExited(OProcess* ); 151 void slotConnectionExited(OProcess* );
152 void slotConnectionOutput(OProcess*, char*, int ); 152 void slotConnectionOutput(OProcess*, char*, int );
153 private: 153 private:
154 Services::ValueList parseSDPOutput( const QString& ); 154 Services::ValueList parseSDPOutput( const QString& );
155 RemoteDevice::ValueList parseHCIOutput( const QString& ); 155 RemoteDevice::ValueList parseHCIOutput( const QString& );
156 Connection::ValueList parseConnections( const QString& ); 156 ConnectionState::ValueList parseConnections( const QString& );
157 OProcess *m_hcitool; 157 OProcess *m_hcitool;
158 OProcess *m_sdp; // not only one 158 OProcess *m_sdp; // not only one
159 QString m_device; 159 QString m_device;
160 QMap<QString, QString> m_out; 160 QMap<QString, QString> m_out;
161 QMap<QString, QString> m_devices; 161 QMap<QString, QString> m_devices;
162 QString m_hcitoolCon; 162 QString m_hcitoolCon;