-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 45 | ||||
-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.cpp | 38 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 1 |
4 files changed, 71 insertions, 19 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index 7673d0b..6246f92 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp | |||
@@ -4,2 +4,4 @@ | |||
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qhbox.h> | ||
6 | #include <qradiobutton.h> | ||
5 | 7 | ||
@@ -27,5 +29,9 @@ BTConfigWidget::BTConfigWidget( const QString& name, | |||
27 | 29 | ||
28 | m_lay = new QVBoxLayout(this ); | 30 | m_lay = new QVBoxLayout( this ); |
29 | m_device = new QLabel(tr("Device"), this ); | 31 | |
30 | m_deviceCmb = new QComboBox(this ); | 32 | m_device = new QLabel( tr( "Device" ), this ); |
33 | QHBox *deviceBox = new QHBox( this ); | ||
34 | m_devRadio = new QRadioButton( deviceBox ); | ||
35 | connect( m_devRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotDevRadio( bool ) ) ); | ||
36 | m_deviceCmb = new QComboBox( deviceBox ); | ||
31 | m_deviceCmb->setEditable( TRUE ); | 37 | m_deviceCmb->setEditable( TRUE ); |
@@ -33,4 +39,7 @@ BTConfigWidget::BTConfigWidget( const QString& name, | |||
33 | QLabel *macLabel = new QLabel( this ); | 39 | QLabel *macLabel = new QLabel( this ); |
34 | macLabel->setText( tr("Enter peer mac address here:") ); | 40 | macLabel->setText( tr( "Or peer mac address" ) ); |
35 | m_mac = new QLineEdit( this ); | 41 | QHBox *macBox = new QHBox( this ); |
42 | m_macRadio = new QRadioButton( macBox ); | ||
43 | connect( m_macRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotMacRadio( bool ) ) ); | ||
44 | m_mac = new QLineEdit( macBox ); | ||
36 | 45 | ||
@@ -39,5 +48,5 @@ BTConfigWidget::BTConfigWidget( const QString& name, | |||
39 | m_lay->addWidget( m_device ); | 48 | m_lay->addWidget( m_device ); |
40 | m_lay->addWidget( m_deviceCmb ); | 49 | m_lay->addWidget( deviceBox ); |
41 | m_lay->addWidget( macLabel ); | 50 | m_lay->addWidget( macLabel ); |
42 | m_lay->addWidget( m_mac ); | 51 | m_lay->addWidget( macBox ); |
43 | m_lay->addWidget( m_base ); | 52 | m_lay->addWidget( m_base ); |
@@ -59,2 +68,4 @@ void BTConfigWidget::load( const Profile& prof ) { | |||
59 | m_mac->setText( mac ); | 68 | m_mac->setText( mac ); |
69 | } else { | ||
70 | m_devRadio->setChecked( true ); | ||
60 | } | 71 | } |
@@ -157 +168,21 @@ void BTConfigWidget::save( Profile& prof ) { | |||
157 | } | 168 | } |
169 | |||
170 | void BTConfigWidget::slotMacRadio( bool on ) { | ||
171 | if ( on ) { | ||
172 | m_devRadio->setChecked( false ); | ||
173 | m_deviceCmb->setEnabled( false ); | ||
174 | m_mac->setEnabled( true ); | ||
175 | } else { | ||
176 | m_devRadio->setChecked( true ); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | void BTConfigWidget::slotDevRadio( bool on ) { | ||
181 | if ( on ) { | ||
182 | m_macRadio->setChecked( false ); | ||
183 | m_deviceCmb->setEnabled( true ); | ||
184 | m_mac->setEnabled( false ); | ||
185 | } else { | ||
186 | m_macRadio->setChecked( true ); | ||
187 | } | ||
188 | } | ||
diff --git a/noncore/apps/opie-console/btconfigwidget.h b/noncore/apps/opie-console/btconfigwidget.h index ceb13ee..d60d8a2 100644 --- a/noncore/apps/opie-console/btconfigwidget.h +++ b/noncore/apps/opie-console/btconfigwidget.h | |||
@@ -9,2 +9,3 @@ class QComboBox; | |||
9 | class QLineEdit; | 9 | class QLineEdit; |
10 | class QRadioButton; | ||
10 | class IOLayerBase; | 11 | class IOLayerBase; |
@@ -26,3 +27,8 @@ private: | |||
26 | QLineEdit* m_mac; | 27 | QLineEdit* m_mac; |
28 | QRadioButton *m_macRadio; | ||
29 | QRadioButton *m_devRadio; | ||
27 | 30 | ||
31 | private slots: | ||
32 | void slotMacRadio( bool on ); | ||
33 | void slotDevRadio( bool on ); | ||
28 | }; | 34 | }; |
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 | |||
@@ -19,3 +19,6 @@ void IOBt::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 | } |
@@ -24,17 +27,28 @@ 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 | } |
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp index cc63c58..e6d1688 100644 --- a/noncore/apps/opie-console/io_serial.cpp +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -1 +1,2 @@ | |||
1 | |||
1 | #include <fcntl.h> | 2 | #include <fcntl.h> |