summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/connection.h
Unidiff
Diffstat (limited to 'noncore/net/opietooth/lib/connection.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/connection.h150
1 files changed, 150 insertions, 0 deletions
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