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.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 1a8c979..35a328f 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -1,63 +1,65 @@
1 1
2#include "io_bt.h" 2#include "io_bt.h"
3 3
4using namespace Opie::Core;
5using namespace Opie::Core;
4IOBt::IOBt( const Profile &config ) : IOSerial( config ) { 6IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 7 m_attach = 0;
6} 8}
7 9
8 10
9IOBt::~IOBt() { 11IOBt::~IOBt() {
10 if ( m_attach ) { 12 if ( m_attach ) {
11 delete m_attach; 13 delete m_attach;
12 } 14 }
13} 15}
14 16
15 17
16void IOBt::close() { 18void IOBt::close() {
17 19
18 IOSerial::close(); 20 IOSerial::close();
19 // still need error handling 21 // still need error handling
20 if ( m_attach ) { 22 if ( m_attach ) {
21 delete m_attach; 23 delete m_attach;
22 m_attach = 0; 24 m_attach = 0;
23 } 25 }
24} 26}
25 27
26bool IOBt::open() { 28bool IOBt::open() {
27 bool ret = false; 29 bool ret = false;
28 30
29 // only set up bt stuff if mac address was set, otherwise use the device set 31 // only set up bt stuff if mac address was set, otherwise use the device set
30 if ( !m_mac.isEmpty() ) { 32 if ( !m_mac.isEmpty() ) {
31 33
32 // now it should also be checked, if there is a connection to the device with that mac allready 34 // now it should also be checked, if there is a connection to the device with that mac allready
33 // hciattach here 35 // hciattach here
34 m_attach = new OProcess(); 36 m_attach = new OProcess();
35 *m_attach << "hciattach /dev/ttyS2 any 57600"; 37 *m_attach << "hciattach /dev/ttyS2 any 57600";
36 38
37 // then start hcid, then rcfomm handling (m_mac) 39 // then start hcid, then rcfomm handling (m_mac)
38 40
39 connect( m_attach, SIGNAL( processExited(OProcess*) ), 41 connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
40 this, SLOT( slotExited(OProcess*) ) ); 42 this, SLOT( slotExited(OProcess*) ) );
41 43
42 if ( m_attach->start() ) { 44 if ( m_attach->start() ) {
43 ret = IOSerial::open(); 45 ret = IOSerial::open();
44 } else { 46 } else {
45 qWarning("could not attach to device"); 47 qWarning("could not attach to device");
46 delete m_attach; 48 delete m_attach;
47 m_attach = 0; 49 m_attach = 0;
48 } 50 }
49 } else { 51 } else {
50 // directly to the normal serial 52 // directly to the normal serial
51 // TODO: look first if the connection really exists. ( is set up ) 53 // TODO: look first if the connection really exists. ( is set up )
52 54
53 ret =IOSerial::open(); 55 ret =IOSerial::open();
54 } 56 }
55 return ret; 57 return ret;
56} 58}
57 59
58void IOBt::reload( const Profile &config ) { 60void IOBt::reload( const Profile &config ) {
59 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 61 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
60 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 62 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
61 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 63 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
62 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); 64 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
63 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); 65 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);