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.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 4486eea..8dd8151 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -15,63 +15,66 @@ IOBt::~IOBt() {
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 if ( m_attach ) {
21 delete m_attach; 21 delete m_attach;
22 m_attach = 0; 22 m_attach = 0;
23 } 23 }
24} 24}
25 25
26bool IOBt::open() { 26bool IOBt::open() {
27 bool ret = false;
27 28
28 // only set up bt stuff if mac address was set, otherwise use the device set 29 // only set up bt stuff if mac address was set, otherwise use the device set
29 if ( !m_mac.isEmpty() ) { 30 if ( !m_mac.isEmpty() ) {
30 31
31 // now it should also be checked, if there is a connection to the device with that mac allready 32 // now it should also be checked, if there is a connection to the device with that mac allready
32 // hciattach here 33 // hciattach here
33 m_attach = new OProcess(); 34 m_attach = new OProcess();
34 *m_attach << "hciattach /dev/ttyS2 any 57600"; 35 *m_attach << "hciattach /dev/ttyS2 any 57600";
35 36
36 // then start hcid, then rcfomm handling (m_mac) 37 // then start hcid, then rcfomm handling (m_mac)
37 38
38 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 39 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
39 this, SLOT( slotExited( OProcess* ) ) ); 40 this, SLOT( slotExited( OProcess* ) ) );
40 41
41 if ( m_attach->start() ) { 42 if ( m_attach->start() ) {
42 IOSerial::open(); 43 ret = IOSerial::open();
43 } else { 44 } else {
44 qWarning("could not attach to device"); 45 qWarning("could not attach to device");
45 delete m_attach; 46 delete m_attach;
46 m_attach = 0; 47 m_attach = 0;
47 } 48 }
48 } else { 49 } else {
49 // directly to the normal serial 50 // directly to the normal serial
50 // TODO: look first if the connection really exists. ( is set up ) 51 // TODO: look first if the connection really exists. ( is set up )
51 52
52 IOSerial::open(); 53 ret =IOSerial::open();
53 } 54 }
55 return ret;
54} 56}
55 57
56void IOBt::reload( const Profile &config ) { 58void IOBt::reload( const Profile &config ) {
57 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 59 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
58 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 60 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
59 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 61 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
60 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); 62 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
61 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); 63 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
62 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); 64 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
63 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); 65 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
64} 66}
65 67
66 68
67QString IOBt::identifier() const { 69QString IOBt::identifier() const {
68 return "bluetooth"; 70 return "bluetooth";
69} 71}
70 72
71QString IOBt::name() const { 73QString IOBt::name() const {
72 return "BLuetooth IO Layer"; 74 return "BLuetooth IO Layer";
73} 75}
74 76
75void IOBt::slotExited( OProcess* proc ){ 77void IOBt::slotExited( OProcess* proc ){
76 close(); 78 close();
79 delete proc;
77} 80}