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.cpp38
1 files changed, 26 insertions, 12 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
@@ -17,26 +17,40 @@ void IOBt::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 delete m_attach; 20 if ( m_attach ) {
21 delete m_attach;
22 m_attach = 0;
23 }
21} 24}
22 25
23bool IOBt::open() { 26bool IOBt::open() {
24 27
25 // hciattach here 28 // only set up bt stuff if mac address was set, otherwise use the device set
26 m_attach = new OProcess(); 29 if ( !m_mac.isEmpty() ) {
27 *m_attach << "hciattach /dev/ttyS2 any 57600";
28 30
29 // then start hcid, then rcfomm handling (m_mac) 31 // now it should also be checked, if there is a connection to the device with that mac allready
30 32
31 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 33 // hciattach here
32 this, SLOT( slotExited( OProcess* ) ) ); 34 m_attach = new OProcess();
35 *m_attach << "hciattach /dev/ttyS2 any 57600";
33 36
34 if ( m_attach->start() ) { 37 // then start hcid, then rcfomm handling (m_mac)
35 IOSerial::open(); 38
39 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
40 this, SLOT( slotExited( OProcess* ) ) );
41
42 if ( m_attach->start() ) {
43 IOSerial::open();
44 } else {
45 qWarning("could not attach to device");
46 delete m_attach;
47 m_attach = 0;
48 }
36 } else { 49 } else {
37 qWarning("could not attach to device"); 50 // directly to the normal serial
38 delete m_attach; 51 // TODO: look first if the connection really exists. ( is set up )
39 m_attach = 0; 52
53 IOSerial::open();
40 } 54 }
41} 55}
42 56