summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/io_bt.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/io_bt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_bt.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
new file mode 100644
index 0000000..8bff4df
--- a/dev/null
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -0,0 +1,63 @@
1
2#include "io_bt.h"
3
4IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0;
6}
7
8
9IOBt::~IOBt() {
10 if ( m_attach ) {
11 delete m_attach;
12 }
13}
14
15
16void IOBt::close() {
17
18 IOSerial::close();
19 // still need error handling
20 delete m_attach;
21}
22
23bool IOBt::open() {
24
25 // hciattach here
26 m_attach = new OProcess();
27 *m_attach << "hciattach /dev/ttyS2 any 57600";
28
29 // then start hcid, then rcfomm handling (m_mac)
30
31 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
32 this, SLOT( slotExited( OProcess* ) ) );
33
34 if ( m_attach->start() ) {
35 IOSerial::open();
36 } else {
37 qWarning("could not attach to device");
38 delete m_attach;
39 }
40}
41
42void IOBt::reload( const Profile &config ) {
43 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
44 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
45 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
46 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
47 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
48 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
49 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
50}
51
52
53QString IOBt::identifier() const {
54 return "bluetooth";
55}
56
57QString IOBt::name() const {
58 return "BLuetooth IO Layer";
59}
60
61void IOBt::slotExited( OProcess* proc ){
62 close();
63}