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