summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth
authorzecke <zecke>2002-06-28 20:41:55 (UTC)
committer zecke <zecke>2002-06-28 20:41:55 (UTC)
commit545d7b51d67e4c1fa6be40436103b0a6b237a3a7 (patch) (unidiff)
tree7a40a66ef8798e51a23ac362254788609f818f17 /noncore/net/opietooth
parent8a34a47d873d8d767d0a84a828e6724b73295b8d (diff)
downloadopie-545d7b51d67e4c1fa6be40436103b0a6b237a3a7.zip
opie-545d7b51d67e4c1fa6be40436103b0a6b237a3a7.tar.gz
opie-545d7b51d67e4c1fa6be40436103b0a6b237a3a7.tar.bz2
hcitool con additions ( not done yet )
Diffstat (limited to 'noncore/net/opietooth') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/connection.cpp90
-rw-r--r--noncore/net/opietooth/lib/connection.h150
-rw-r--r--noncore/net/opietooth/lib/lib.pro4
-rw-r--r--noncore/net/opietooth/lib/manager.h19
4 files changed, 260 insertions, 3 deletions
diff --git a/noncore/net/opietooth/lib/connection.cpp b/noncore/net/opietooth/lib/connection.cpp
new file mode 100644
index 0000000..1f9baaf
--- a/dev/null
+++ b/noncore/net/opietooth/lib/connection.cpp
@@ -0,0 +1,90 @@
1
2#include "connection.h"
3
4using namespace OpieTooth;
5
6Connection::Connection() {
7 m_direction = Incoming;
8 m_handle = -1;
9 m_state = -1;
10 m_linkMode = -1;
11};
12
13Connection::Connection( const Connection& con1 ) {
14 (*this) = con1;
15}
16
17
18Connection::Connection( bool in,
19 const QString& conType,
20 const QString& mac,
21 int handle,
22 int state,
23 int linkMode ) {
24 m_direction = in;
25 m_contype = conType;
26 m_mac = mac;
27 m_handle = handle;
28 m_state = state;
29 m_linkMode = linkMode;
30
31}
32
33void Connection::setDirection( bool incoming ) {
34 m_direction = incoming;
35}
36
37bool Connection::direction() const {
38 return m_direction;
39}
40
41void Connection::setConnectionMode( const QString& conType ) {
42 m_contype = conType;
43}
44
45QString Connection::connectionMode() const {
46 return m_contype;
47}
48
49void Connection::setMac( const QString& mac ) {
50 m_mac = mac;
51}
52
53QString Connection::mac() const{
54 return m_mac;
55}
56
57void Connection::setHandle( int handle ) {
58 m_handle = handle;
59}
60
61int Connection::handle() const{
62 return m_handle;
63}
64
65void Connection::setState( int state ) {
66 m_state = state;
67}
68
69int Connection::state()const {
70 return m_state;
71}
72
73void Connection::setLinkMode( int linkMode ) {
74 m_linkMode = linkMode;
75}
76
77int Connection::linkMode()const{
78 return m_linkMode;
79}
80
81Connection &Connection::operator=( const Connection& con1 ) {
82 m_direction = con1.m_direction;
83 m_contype = con1.m_contype;
84 m_mac = con1.m_mac;
85 m_handle = con1.m_handle;
86 m_state = con1.m_state;
87 m_linkMode = con1.m_linkMode;
88
89 return (*this);
90}
diff --git a/noncore/net/opietooth/lib/connection.h b/noncore/net/opietooth/lib/connection.h
new file mode 100644
index 0000000..37090ce
--- a/dev/null
+++ b/noncore/net/opietooth/lib/connection.h
@@ -0,0 +1,150 @@
1
2#ifndef OpieTooth_Connection_H
3#define OpieTooth_Connection_H
4
5#include <qstring.h>
6#include <qvaluelist.h>
7
8namespace OpieTooth {
9
10 enum LinkDirection { Incoming= true, Outgoing = false };
11 enum LinkMode { Master =0, Client };
12
13
14 /**
15 * The Connection class stores
16 * the output of hcitool con
17 * in a OO way
18 */
19
20 class Connection {
21 public:
22 /**
23 * typedef for a list of
24 * Connections
25 */
26 typedef QValueList<Connection> ValueList;
27
28 /**
29 * Copy c'tor.
30 */
31 Connection( const Connection& );
32
33 /**
34 * Main c'tor
35 * Basicly it holds all values
36 * a blueZ connections can have
37 * @param in If the connection is either incoming or outgoing
38 * @param conType Either ACL or SCO for connection type
39 * @param mac The BD Address( mac ) of the peer
40 * @param handle the blueZ handle
41 * @param state the State of the connection
42 * @param linkMode the linkmode of the connection MASTER or not
43 *
44 * < ACL 00:02:C7:09:2B:53 handle 1 state 1 lm MASTER
45 *
46 */
47 Connection( bool in,
48 const QString& conType,
49 const QString& mac,
50 int handle,
51 int state,
52 int linkMode );
53
54 /**
55 * C'tor for compability with QValueList
56 * QValueList needs this c'tor.
57 */
58 Connection();
59
60 /**
61 * Set if the connection is incoming or
62 * outgoing
63 * @param in Whether or not the connection is ingoing or not.
64 * for param use either Incoming or Outgoing
65 *
66 */
67 void setDirection( bool incoming = Incoming );
68
69 /**
70 * direction() will return Incoming( true )
71 * if the direction is incomoning or Outgoing( false)
72 * if outgoing
73 */
74 bool direction() const;
75
76 /**
77 * sets the ConnectionMode
78 * @param comMode I know that SCO and ACL exists so far
79 */
80 void setConnectionMode( const QString& comMode );
81
82 /**
83 * linkMode returns the linkMode
84 * MASTER for example
85 */
86 QString connectionMode() const;
87
88 /**
89 * The Bluetooth Address or mac
90 * is set by this function
91 * @param mac the BluetoothAddress( mac)
92 */
93 void setMac( const QString& mac);
94
95 /**
96 * returns the mac
97 */
98 QString mac() const;
99
100
101 /**
102 * Set the handle of the bt connection
103 */
104 void setHandle(int handle );
105
106 /**
107 * @return the handle of the connection
108 */
109 int handle() const;
110
111 /**
112 * sets the state
113 */
114 void setState( int state );
115
116 /**
117 * return the state
118 */
119 int state() const;
120
121 /**
122 * Sets the link mode of the Connection
123 */
124 void setLinkMode( int linkMode = Master );
125
126 /**
127 * returns the linkMode
128 */
129 int linkMode()const;
130
131 /**
132 * copy c'tor
133 */
134 Connection &operator=( const Connection& );
135
136 private:
137 class ConnectionPrivate;
138 ConnectionPrivate *d;
139 bool m_direction : 1;
140 QString m_contype;
141 QString m_mac;
142 int m_handle;
143 int m_state;
144 int m_linkMode;
145
146 };
147};
148
149
150#endif
diff --git a/noncore/net/opietooth/lib/lib.pro b/noncore/net/opietooth/lib/lib.pro
index ecf2e6c..dde6c2a 100644
--- a/noncore/net/opietooth/lib/lib.pro
+++ b/noncore/net/opietooth/lib/lib.pro
@@ -2,4 +2,4 @@ TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3 HEADERS = parser.h device.h manager.h remotedevice.h services.h 3 HEADERS = connection.h parser.h device.h manager.h remotedevice.h services.h
4 SOURCES = parser.cc device.cc manager.cc remotedevice.cc services.cc 4 SOURCES = connection.cpp parser.cc device.cc manager.cc remotedevice.cc services.cc
5 TARGET = opietooth 5 TARGET = opietooth
diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h
index 415ec72..2589e9b 100644
--- a/noncore/net/opietooth/lib/manager.h
+++ b/noncore/net/opietooth/lib/manager.h
@@ -16,3 +16,3 @@ namespace OpieTooth {
16 /** Manager manages a blueZ device (hci0 for example) 16 /** Manager manages a blueZ device (hci0 for example)
17 * with Manager you can control the things you 17 * without Manager you can control the things you
18 * could do from command line in a OO and asynchronus 18 * could do from command line in a OO and asynchronus
@@ -28,2 +28,3 @@ Q_OBJECT
28 Manager( const QString &device ); 28 Manager( const QString &device );
29
29 /** c'tor 30 /** c'tor
@@ -33,2 +34,3 @@ Q_OBJECT
33 Manager( Device* dev ); 34 Manager( Device* dev );
35
34 /** 36 /**
@@ -37,2 +39,3 @@ Q_OBJECT
37 Manager(); 39 Manager();
40
38 ~Manager(); 41 ~Manager();
@@ -43,2 +46,3 @@ Q_OBJECT
43 void setDevice( const QString& device ); 46 void setDevice( const QString& device );
47
44 /** 48 /**
@@ -47,2 +51,3 @@ Q_OBJECT
47 void setDevice( Device *dev ); 51 void setDevice( Device *dev );
52
48 /** 53 /**
@@ -56,2 +61,3 @@ Q_OBJECT
56 void isAvailable(const QString& device= QString::null ); 61 void isAvailable(const QString& device= QString::null );
62
57 /** 63 /**
@@ -77,2 +83,3 @@ Q_OBJECT
77 void addService(const QString &name ); 83 void addService(const QString &name );
84
78 /** 85 /**
@@ -83,2 +90,3 @@ Q_OBJECT
83 void addServices( const QStringList& names ); 90 void addServices( const QStringList& names );
91
84 /** 92 /**
@@ -87,2 +95,3 @@ Q_OBJECT
87 void removeService(const QString &name ); 95 void removeService(const QString &name );
96
88 /** 97 /**
@@ -97,2 +106,3 @@ Q_OBJECT
97 void searchServices( const QString& remDevice ); 106 void searchServices( const QString& remDevice );
107
98 /** 108 /**
@@ -112,2 +122,3 @@ Q_OBJECT
112 void foundDevices( const QString& device, RemoteDevice::ValueList ); 122 void foundDevices( const QString& device, RemoteDevice::ValueList );
123 void connections( Connection::ValueList );
113 124
@@ -115,6 +126,11 @@ private slots:
115 void slotProcessExited(OProcess* ); 126 void slotProcessExited(OProcess* );
127
116 void slotSDPExited(OProcess*); 128 void slotSDPExited(OProcess*);
117 void slotSDPOut(OProcess*, char*, int); 129 void slotSDPOut(OProcess*, char*, int);
130
118 void slotHCIExited(OProcess* ); 131 void slotHCIExited(OProcess* );
119 void slotHCIOut(OProcess*, char*, int ); 132 void slotHCIOut(OProcess*, char*, int );
133
134 void slotConnectionExited(OProcess* );
135 void slotConnectionOutput(OProcess*, char*, int );
120 private: 136 private:
@@ -127,2 +143,3 @@ private slots:
127 QMap<QString, QString> m_devices; 143 QMap<QString, QString> m_devices;
144 QString m_hcitoolCon;
128 }; 145 };