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.cpp | 7 |
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 a29fa8e..c102427 100644 --- a/noncore/apps/opie-console/io_bt.cpp +++ b/noncore/apps/opie-console/io_bt.cpp | |||
@@ -1,93 +1,96 @@ | |||
1 | 1 | ||
2 | #include "io_bt.h" | 2 | #include "io_bt.h" |
3 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
4 | using namespace Opie::Core; | 6 | using namespace Opie::Core; |
7 | |||
5 | IOBt::IOBt( const Profile &config ) : IOSerial( config ) { | 8 | IOBt::IOBt( const Profile &config ) : IOSerial( config ) { |
6 | m_attach = 0; | 9 | m_attach = 0; |
7 | } | 10 | } |
8 | 11 | ||
9 | 12 | ||
10 | IOBt::~IOBt() { | 13 | IOBt::~IOBt() { |
11 | if ( m_attach ) { | 14 | if ( m_attach ) { |
12 | delete m_attach; | 15 | delete m_attach; |
13 | } | 16 | } |
14 | } | 17 | } |
15 | 18 | ||
16 | 19 | ||
17 | void IOBt::close() { | 20 | void IOBt::close() { |
18 | 21 | ||
19 | IOSerial::close(); | 22 | IOSerial::close(); |
20 | // still need error handling | 23 | // still need error handling |
21 | if ( m_attach ) { | 24 | if ( m_attach ) { |
22 | delete m_attach; | 25 | delete m_attach; |
23 | m_attach = 0; | 26 | m_attach = 0; |
24 | } | 27 | } |
25 | } | 28 | } |
26 | 29 | ||
27 | bool IOBt::open() { | 30 | bool IOBt::open() { |
28 | bool ret = false; | 31 | bool ret = false; |
29 | 32 | ||
30 | // only set up bt stuff if mac address was set, otherwise use the device set | 33 | // only set up bt stuff if mac address was set, otherwise use the device set |
31 | if ( !m_mac.isEmpty() ) { | 34 | if ( !m_mac.isEmpty() ) { |
32 | 35 | ||
33 | // now it should also be checked, if there is a connection to the device with that mac allready | 36 | // now it should also be checked, if there is a connection to the device with that mac allready |
34 | // hciattach here | 37 | // hciattach here |
35 | m_attach = new OProcess(); | 38 | m_attach = new OProcess(); |
36 | *m_attach << "hciattach /dev/ttyS2 any 57600"; | 39 | *m_attach << "hciattach /dev/ttyS2 any 57600"; |
37 | 40 | ||
38 | // then start hcid, then rcfomm handling (m_mac) | 41 | // then start hcid, then rcfomm handling (m_mac) |
39 | 42 | ||
40 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), | 43 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), |
41 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 44 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
42 | 45 | ||
43 | if ( m_attach->start() ) { | 46 | if ( m_attach->start() ) { |
44 | ret = IOSerial::open(); | 47 | ret = IOSerial::open(); |
45 | } else { | 48 | } else { |
46 | qWarning("could not attach to device"); | 49 | owarn << "could not attach to device" << oendl; |
47 | delete m_attach; | 50 | delete m_attach; |
48 | m_attach = 0; | 51 | m_attach = 0; |
49 | } | 52 | } |
50 | } else { | 53 | } else { |
51 | // directly to the normal serial | 54 | // directly to the normal serial |
52 | // TODO: look first if the connection really exists. ( is set up ) | 55 | // TODO: look first if the connection really exists. ( is set up ) |
53 | 56 | ||
54 | ret =IOSerial::open(); | 57 | ret =IOSerial::open(); |
55 | } | 58 | } |
56 | return ret; | 59 | return ret; |
57 | } | 60 | } |
58 | 61 | ||
59 | void IOBt::reload( const Profile &config ) { | 62 | void IOBt::reload( const Profile &config ) { |
60 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); | 63 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); |
61 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); | 64 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); |
62 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); | 65 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); |
63 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); | 66 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); |
64 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); | 67 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); |
65 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); | 68 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); |
66 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); | 69 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); |
67 | } | 70 | } |
68 | 71 | ||
69 | 72 | ||
70 | QString IOBt::identifier() const { | 73 | QString IOBt::identifier() const { |
71 | return "bluetooth"; | 74 | return "bluetooth"; |
72 | } | 75 | } |
73 | 76 | ||
74 | QString IOBt::name() const { | 77 | QString IOBt::name() const { |
75 | return "BLuetooth IO Layer"; | 78 | return "BLuetooth IO Layer"; |
76 | } | 79 | } |
77 | 80 | ||
78 | void IOBt::slotExited( OProcess* proc ){ | 81 | void IOBt::slotExited( OProcess* proc ){ |
79 | close(); | 82 | close(); |
80 | delete proc; | 83 | delete proc; |
81 | } | 84 | } |
82 | 85 | ||
83 | QBitArray IOBt::supports() const { | 86 | QBitArray IOBt::supports() const { |
84 | return QBitArray( 3 ); | 87 | return QBitArray( 3 ); |
85 | } | 88 | } |
86 | 89 | ||
87 | bool IOBt::isConnected() { | 90 | bool IOBt::isConnected() { |
88 | return false; | 91 | return false; |
89 | } | 92 | } |
90 | 93 | ||
91 | void IOBt::send(const QByteArray &data) { | 94 | void IOBt::send(const QByteArray &data) { |
92 | qDebug( "Please overload me..." ); | 95 | odebug << "Please overload me..." << oendl; |
93 | } | 96 | } |