summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/io_bt.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/io_bt.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_bt.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 0831faf..d71aacc 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -14,17 +14,25 @@ IOBt::~IOBt() {
14 14
15 15
16void IOBt::close() { 16void IOBt::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 if ( m_attach ) {
20 delete m_attach; 21 delete m_attach;
22 m_attach = 0;
23 }
21} 24}
22 25
23bool IOBt::open() { 26bool IOBt::open() {
24 27
28 // only set up bt stuff if mac address was set, otherwise use the device set
29 if ( !m_mac.isEmpty() ) {
30
31 // now it should also be checked, if there is a connection to the device with that mac allready
32
25 // hciattach here 33 // hciattach here
26 m_attach = new OProcess(); 34 m_attach = new OProcess();
27 *m_attach << "hciattach /dev/ttyS2 any 57600"; 35 *m_attach << "hciattach /dev/ttyS2 any 57600";
28 36
29 // then start hcid, then rcfomm handling (m_mac) 37 // then start hcid, then rcfomm handling (m_mac)
30 38
@@ -35,12 +43,18 @@ bool IOBt::open() {
35 IOSerial::open(); 43 IOSerial::open();
36 } else { 44 } else {
37 qWarning("could not attach to device"); 45 qWarning("could not attach to device");
38 delete m_attach; 46 delete m_attach;
39 m_attach = 0; 47 m_attach = 0;
40 } 48 }
49 } else {
50 // directly to the normal serial
51 // TODO: look first if the connection really exists. ( is set up )
52
53 IOSerial::open();
54 }
41} 55}
42 56
43void IOBt::reload( const Profile &config ) { 57void IOBt::reload( const Profile &config ) {
44 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 58 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
45 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 59 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
46 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 60 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);