author | harlekin <harlekin> | 2002-10-17 14:16:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 14:16:03 (UTC) |
commit | 6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494 (patch) (unidiff) | |
tree | d75fbc71ac5d7ae09ad97aacfcd33e43da664f7a /noncore/apps/opie-console/io_bt.cpp | |
parent | e5d66ce2f5939eeae922c4fda9cad084320e647c (diff) | |
download | opie-6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494.zip opie-6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494.tar.gz opie-6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494.tar.bz2 |
either device or mac address
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 | 38 |
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 | |||
@@ -8,44 +8,58 @@ IOBt::IOBt( const Profile &config ) : IOSerial( config ) { | |||
8 | 8 | ||
9 | IOBt::~IOBt() { | 9 | IOBt::~IOBt() { |
10 | if ( m_attach ) { | 10 | if ( m_attach ) { |
11 | delete m_attach; | 11 | delete m_attach; |
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | void IOBt::close() { | 16 | 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 | ||
23 | bool IOBt::open() { | 26 | bool 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 | ||
43 | void IOBt::reload( const Profile &config ) { | 57 | void IOBt::reload( const Profile &config ) { |
44 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); | 58 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); |
45 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); | 59 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); |
46 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); | 60 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); |
47 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); | 61 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); |
48 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); | 62 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); |
49 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); | 63 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); |
50 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); | 64 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); |
51 | } | 65 | } |