author | korovkin <korovkin> | 2006-04-14 19:22:37 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-14 19:22:37 (UTC) |
commit | a1bcbe41d45924713c4ead9b25ac5518473c9ca9 (patch) (unidiff) | |
tree | 3683eb401dd2d7cde4a7af15e72ecf7463b7208e /noncore/net/opietooth/manager | |
parent | bca53498f37ade8101611fecde82202e9ee1a55c (diff) | |
download | opie-a1bcbe41d45924713c4ead9b25ac5518473c9ca9.zip opie-a1bcbe41d45924713c4ead9b25ac5518473c9ca9.tar.gz opie-a1bcbe41d45924713c4ead9b25ac5518473c9ca9.tar.bz2 |
Added RFCOMM <-> serial line forwarding functionality.
Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 61 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 182 |
3 files changed, 234 insertions, 13 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 0649514..9ec5bf8 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,158 +1,180 @@ | |||
1 | /* | 1 | /* |
2 | * bluebase.cpp * | 2 | * bluebase.cpp * |
3 | * --------------------- | 3 | * --------------------- |
4 | * | 4 | * |
5 | * copyright : (c) 2002 by Maximilian Reiß | 5 | * copyright : (c) 2002 by Maximilian Reiß |
6 | * email : max.reiss@gmx.de | 6 | * email : max.reiss@gmx.de |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "bluebase.h" | 18 | #include "bluebase.h" |
19 | #include "scandialog.h" | 19 | #include "scandialog.h" |
20 | #include "hciconfwrapper.h" | 20 | #include "hciconfwrapper.h" |
21 | #include "devicehandler.h" | 21 | #include "devicehandler.h" |
22 | #include "btconnectionitem.h" | 22 | #include "btconnectionitem.h" |
23 | #include "rfcommassigndialogimpl.h" | 23 | #include "rfcommassigndialogimpl.h" |
24 | #include "forwarder.h" | ||
25 | #include <termios.h> | ||
26 | #include <string.h> | ||
27 | #include <errno.h> | ||
24 | 28 | ||
25 | /* OPIE */ | 29 | /* OPIE */ |
26 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
28 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
29 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
30 | using namespace Opie::Core; | 34 | using namespace Opie::Core; |
31 | 35 | ||
32 | /* QT */ | 36 | /* QT */ |
33 | #include <qframe.h> | 37 | #include <qframe.h> |
34 | #include <qlabel.h> | 38 | #include <qlabel.h> |
35 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
36 | #include <qlayout.h> | 40 | #include <qlayout.h> |
37 | #include <qvariant.h> | 41 | #include <qvariant.h> |
38 | #include <qimage.h> | 42 | #include <qimage.h> |
39 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
40 | #include <qtabwidget.h> | 44 | #include <qtabwidget.h> |
41 | #include <qscrollview.h> | 45 | #include <qscrollview.h> |
42 | #include <qvbox.h> | 46 | #include <qvbox.h> |
43 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
48 | #include <qcombobox.h> | ||
44 | #include <qcheckbox.h> | 49 | #include <qcheckbox.h> |
45 | #include <qlineedit.h> | 50 | #include <qlineedit.h> |
46 | #include <qlistview.h> | 51 | #include <qlistview.h> |
47 | #include <qdir.h> | 52 | #include <qdir.h> |
48 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
49 | #include <qtimer.h> | 54 | #include <qtimer.h> |
50 | #include <qlist.h> | 55 | #include <qlist.h> |
51 | 56 | ||
52 | /* STD */ | 57 | /* STD */ |
53 | #include <remotedevice.h> | 58 | #include <remotedevice.h> |
54 | #include <services.h> | 59 | #include <services.h> |
55 | #include <stdlib.h> | 60 | #include <stdlib.h> |
56 | 61 | ||
57 | using namespace OpieTooth; | 62 | using namespace OpieTooth; |
63 | //Array of possible speeds of the serial port | ||
64 | struct SerSpeed { | ||
65 | const char* str; //string value | ||
66 | int val; //value itself | ||
67 | } speeds[] = { | ||
68 | { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 }, | ||
69 | { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 }, | ||
70 | { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 }, | ||
71 | { "115200", B115200} | ||
72 | }; | ||
58 | 73 | ||
59 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 74 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
60 | : BluetoothBase( parent, name, fl ) | 75 | : BluetoothBase( parent, name, fl ) |
61 | { | 76 | { |
62 | m_localDevice = new Manager( "hci0" ); | 77 | m_localDevice = new Manager( "hci0" ); |
63 | 78 | ||
64 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 79 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
65 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 80 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
66 | 81 | ||
67 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); | 82 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); |
68 | 83 | ||
69 | connect( devicesView, SIGNAL( clicked(QListViewItem*)), | 84 | connect( devicesView, SIGNAL( clicked(QListViewItem*)), |
70 | this, SLOT( startServiceActionClicked(QListViewItem*) ) ); | 85 | this, SLOT( startServiceActionClicked(QListViewItem*) ) ); |
71 | connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 86 | connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
72 | this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); | 87 | this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); |
73 | connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), | 88 | connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), |
74 | this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); | 89 | this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); |
75 | connect( m_localDevice, SIGNAL( available(const QString&,bool) ), | 90 | connect( m_localDevice, SIGNAL( available(const QString&,bool) ), |
76 | this, SLOT( deviceActive(const QString&,bool) ) ); | 91 | this, SLOT( deviceActive(const QString&,bool) ) ); |
77 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), | 92 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), |
78 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); | 93 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); |
79 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), | 94 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), |
80 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); | 95 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); |
96 | connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); | ||
81 | 97 | ||
82 | // let hold be rightButtonClicked() | 98 | // let hold be rightButtonClicked() |
83 | QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); | 99 | QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); |
84 | QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); | 100 | QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); |
85 | 101 | ||
86 | //Load all icons needed | 102 | //Load all icons needed |
87 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); | 103 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); |
88 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); | 104 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); |
89 | m_findPix = Resource::loadPixmap( "opietooth/find" ); | 105 | m_findPix = Resource::loadPixmap( "opietooth/find" ); |
90 | 106 | ||
91 | QPalette pal = this->palette(); | 107 | QPalette pal = this->palette(); |
92 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 108 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
93 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 109 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
94 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 110 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
95 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 111 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
96 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 112 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
97 | this->setPalette( pal ); | 113 | this->setPalette( pal ); |
98 | 114 | ||
99 | setCaption( tr( "Bluetooth Manager" ) ); | 115 | setCaption( tr( "Bluetooth Manager" ) ); |
100 | 116 | ||
101 | readConfig(); | 117 | readConfig(); |
102 | initGui(); | 118 | initGui(); |
103 | 119 | ||
104 | devicesView->setRootIsDecorated(true); | 120 | devicesView->setRootIsDecorated(true); |
105 | m_iconLoader = new BTIconLoader(); | 121 | m_iconLoader = new BTIconLoader(); |
106 | writeToHciConfig(); | 122 | writeToHciConfig(); |
107 | addConnectedDevices(); | 123 | addConnectedDevices(); |
108 | readSavedDevices(); | 124 | readSavedDevices(); |
109 | addServicesToDevices(); | 125 | addServicesToDevices(); |
110 | QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); | 126 | QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); |
127 | forwarder = NULL; | ||
128 | serDevName->setText(tr("/dev/ircomm0")); | ||
129 | for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { | ||
130 | serSpeed->insertItem(speeds[i].str); | ||
131 | } | ||
132 | serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); | ||
111 | } | 133 | } |
112 | 134 | ||
113 | /** | 135 | /** |
114 | * Reads all options from the config file | 136 | * Reads all options from the config file |
115 | */ | 137 | */ |
116 | void BlueBase::readConfig() | 138 | void BlueBase::readConfig() |
117 | { | 139 | { |
118 | 140 | ||
119 | Config cfg( "bluetoothmanager" ); | 141 | Config cfg( "bluetoothmanager" ); |
120 | cfg.setGroup( "bluezsettings" ); | 142 | cfg.setGroup( "bluezsettings" ); |
121 | 143 | ||
122 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with | 144 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
123 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak | 145 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
124 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); | 146 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); |
125 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); | 147 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); |
126 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); | 148 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); |
127 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); | 149 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); |
128 | } | 150 | } |
129 | 151 | ||
130 | /** | 152 | /** |
131 | * Writes all options to the config file | 153 | * Writes all options to the config file |
132 | */ | 154 | */ |
133 | void BlueBase::writeConfig() | 155 | void BlueBase::writeConfig() |
134 | { | 156 | { |
135 | 157 | ||
136 | Config cfg( "bluetoothmanager" ); | 158 | Config cfg( "bluetoothmanager" ); |
137 | cfg.setGroup( "bluezsettings" ); | 159 | cfg.setGroup( "bluezsettings" ); |
138 | 160 | ||
139 | cfg.writeEntry( "name" , m_deviceName ); | 161 | cfg.writeEntry( "name" , m_deviceName ); |
140 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); | 162 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); |
141 | cfg.writeEntry( "useEncryption" , m_useEncryption ); | 163 | cfg.writeEntry( "useEncryption" , m_useEncryption ); |
142 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | 164 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); |
143 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | 165 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); |
144 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 166 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); |
145 | 167 | ||
146 | writeToHciConfig(); | 168 | writeToHciConfig(); |
147 | } | 169 | } |
148 | 170 | ||
149 | /** | 171 | /** |
150 | * Modify the hcid.conf file to our needs | 172 | * Modify the hcid.conf file to our needs |
151 | */ | 173 | */ |
152 | void BlueBase::writeToHciConfig() | 174 | void BlueBase::writeToHciConfig() |
153 | { | 175 | { |
154 | owarn << "writeToHciConfig" << oendl; | 176 | owarn << "writeToHciConfig" << oendl; |
155 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 177 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
156 | hciconf.load(); | 178 | hciconf.load(); |
157 | hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); | 179 | hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); |
158 | hciconf.setName( m_deviceName ); | 180 | hciconf.setName( m_deviceName ); |
@@ -635,48 +657,87 @@ void BlueBase::startScan() | |||
635 | this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); | 657 | this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); |
636 | 658 | ||
637 | QPEApplication::showDialog( scan ); | 659 | QPEApplication::showDialog( scan ); |
638 | } | 660 | } |
639 | 661 | ||
640 | 662 | ||
641 | /** | 663 | /** |
642 | * Set the informations about the local device in information Tab | 664 | * Set the informations about the local device in information Tab |
643 | */ | 665 | */ |
644 | void BlueBase::setInfo() | 666 | void BlueBase::setInfo() |
645 | { | 667 | { |
646 | StatusLabel->setText( status() ); | 668 | StatusLabel->setText( status() ); |
647 | } | 669 | } |
648 | 670 | ||
649 | 671 | ||
650 | /** | 672 | /** |
651 | * Decontructor | 673 | * Decontructor |
652 | */ | 674 | */ |
653 | BlueBase::~BlueBase() | 675 | BlueBase::~BlueBase() |
654 | { | 676 | { |
655 | writeSavedDevices(); | 677 | writeSavedDevices(); |
656 | delete m_iconLoader; | 678 | delete m_iconLoader; |
657 | } | 679 | } |
658 | 680 | ||
659 | 681 | ||
660 | /** | 682 | /** |
661 | * find searches the ListView for a BTDeviceItem containig | 683 | * find searches the ListView for a BTDeviceItem containig |
662 | * the same Device if found return true else false | 684 | * the same Device if found return true else false |
663 | * @param dev RemoteDevice to find | 685 | * @param dev RemoteDevice to find |
664 | * @return returns true if found | 686 | * @return returns true if found |
665 | */ | 687 | */ |
666 | bool BlueBase::find( const RemoteDevice& rem ) | 688 | bool BlueBase::find( const RemoteDevice& rem ) |
667 | { | 689 | { |
668 | QListViewItemIterator it( devicesView ); | 690 | QListViewItemIterator it( devicesView ); |
669 | BTListItem* item; | 691 | BTListItem* item; |
670 | BTDeviceItem* device; | 692 | BTDeviceItem* device; |
671 | for (; it.current(); ++it ) | 693 | for (; it.current(); ++it ) |
672 | { | 694 | { |
673 | item = (BTListItem*) it.current(); | 695 | item = (BTListItem*) it.current(); |
674 | if ( item->typeId() != BTListItem::Device ) | 696 | if ( item->typeId() != BTListItem::Device ) |
675 | continue; | 697 | continue; |
676 | 698 | ||
677 | device = (BTDeviceItem*)item; | 699 | device = (BTDeviceItem*)item; |
678 | if ( rem.equals( device->remoteDevice() ) ) | 700 | if ( rem.equals( device->remoteDevice() ) ) |
679 | return true; | 701 | return true; |
680 | } | 702 | } |
681 | return false; // not found | 703 | return false; // not found |
682 | } | 704 | } |
705 | |||
706 | /** | ||
707 | * Start process of the cell phone forwarding | ||
708 | */ | ||
709 | void BlueBase::doForward() | ||
710 | { | ||
711 | if (forwarder && forwarder->isRunning()) { | ||
712 | runButton->setText("start gateway"); | ||
713 | forwarder->stop(); | ||
714 | delete forwarder; | ||
715 | forwarder = NULL; | ||
716 | return; | ||
717 | } | ||
718 | QString str = serDevName->text(); | ||
719 | forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val); | ||
720 | connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)), | ||
721 | this, SLOT(forwardExited(Opie::Core::OProcess*))); | ||
722 | if (forwarder->start(OProcess::NotifyOnExit) < 0) { | ||
723 | QMessageBox::critical(this, tr("Forwarder Error"), | ||
724 | tr("Forwarder start error:") + tr(strerror(errno))); | ||
725 | return; | ||
726 | } | ||
727 | runButton->setText("stop gateway"); | ||
728 | } | ||
729 | |||
730 | /** | ||
731 | * React on the process end | ||
732 | */ | ||
733 | void BlueBase::forwardExit(Opie::Core::OProcess* proc) | ||
734 | { | ||
735 | if (proc->exitStatus() != 0) | ||
736 | QMessageBox::critical(this, tr("Forwarder Error"), | ||
737 | tr("Forwarder start error")); | ||
738 | delete proc; | ||
739 | forwarder = NULL; | ||
740 | runButton->setText("start gateway"); | ||
741 | } | ||
742 | |||
743 | //eof | ||
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 48883d2..0128a88 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -1,102 +1,106 @@ | |||
1 | 1 | ||
2 | #ifndef BLUEBASE_H | 2 | #ifndef BLUEBASE_H |
3 | #define BLUEBASE_H | 3 | #define BLUEBASE_H |
4 | 4 | ||
5 | #include <qvariant.h> | 5 | #include <qvariant.h> |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | #include <qscrollview.h> | 7 | #include <qscrollview.h> |
8 | #include <qsplitter.h> | 8 | #include <qsplitter.h> |
9 | #include <qlist.h> | 9 | #include <qlist.h> |
10 | #include <qpixmap.h> | 10 | #include <qpixmap.h> |
11 | 11 | ||
12 | #include "bluetoothbase.h" | 12 | #include "bluetoothbase.h" |
13 | 13 | ||
14 | #include "btserviceitem.h" | 14 | #include "btserviceitem.h" |
15 | #include "btdeviceitem.h" | 15 | #include "btdeviceitem.h" |
16 | 16 | ||
17 | #include "popuphelper.h" | 17 | #include "popuphelper.h" |
18 | 18 | ||
19 | #include "bticonloader.h" | 19 | #include "bticonloader.h" |
20 | #include "forwarder.h" | ||
20 | 21 | ||
21 | #include <remotedevice.h> | 22 | #include <remotedevice.h> |
22 | #include <manager.h> | 23 | #include <manager.h> |
23 | 24 | ||
24 | class QVBox; | 25 | class QVBox; |
25 | class QHBoxLayout; | 26 | class QHBoxLayout; |
26 | class QGridLayout; | 27 | class QGridLayout; |
27 | class QFrame; | 28 | class QFrame; |
28 | class QLabel; | 29 | class QLabel; |
29 | class QPushButton; | 30 | class QPushButton; |
30 | class QTabWidget; | 31 | class QTabWidget; |
31 | class QCheckBox; | 32 | class QCheckBox; |
32 | class BTConnectionItem; | 33 | class BTConnectionItem; |
33 | 34 | ||
34 | 35 | ||
35 | namespace OpieTooth { | 36 | namespace OpieTooth { |
36 | 37 | ||
37 | class BlueBase : public BluetoothBase { | 38 | class BlueBase : public BluetoothBase { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | 40 | ||
40 | public: | 41 | public: |
41 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 42 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
42 | ~BlueBase(); | 43 | ~BlueBase(); |
43 | 44 | ||
44 | static QString appName() { return QString::fromLatin1("bluetooth-manager"); } | 45 | static QString appName() { return QString::fromLatin1("bluetooth-manager"); } |
45 | 46 | ||
46 | protected: | 47 | protected: |
47 | 48 | ||
48 | 49 | ||
49 | private slots: | 50 | private slots: |
50 | void startScan(); | 51 | void startScan(); |
51 | 52 | ||
52 | 53 | ||
53 | private: | 54 | private: |
54 | bool find( const RemoteDevice& device ); | 55 | bool find( const RemoteDevice& device ); |
55 | void readConfig(); | 56 | void readConfig(); |
56 | void writeConfig(); | 57 | void writeConfig(); |
57 | void readSavedDevices(); | 58 | void readSavedDevices(); |
58 | void writeSavedDevices(); | 59 | void writeSavedDevices(); |
59 | void writeToHciConfig(); | 60 | void writeToHciConfig(); |
60 | QString status()const; | 61 | QString status()const; |
61 | void initGui(); | 62 | void initGui(); |
62 | void setInfo(); | 63 | void setInfo(); |
63 | 64 | ||
64 | PopupHelper m_popHelper; | 65 | PopupHelper m_popHelper; |
65 | Manager *m_localDevice; | 66 | Manager *m_localDevice; |
66 | QMap<QString,BTDeviceItem*> m_deviceList; | 67 | QMap<QString,BTDeviceItem*> m_deviceList; |
67 | 68 | ||
68 | void deviceActive( const RemoteDevice &device ); | 69 | void deviceActive( const RemoteDevice &device ); |
69 | 70 | ||
70 | QString m_deviceName; | 71 | QString m_deviceName; |
71 | QString m_defaultPasskey; | 72 | QString m_defaultPasskey; |
72 | bool m_useEncryption; | 73 | bool m_useEncryption; |
73 | bool m_enableAuthentification; | 74 | bool m_enableAuthentification; |
74 | bool m_enablePagescan; | 75 | bool m_enablePagescan; |
75 | bool m_enableInquiryscan; | 76 | bool m_enableInquiryscan; |
76 | 77 | ||
77 | QPixmap m_offPix; | 78 | QPixmap m_offPix; |
78 | QPixmap m_onPix; | 79 | QPixmap m_onPix; |
79 | QPixmap m_findPix; | 80 | QPixmap m_findPix; |
80 | 81 | ||
81 | BTIconLoader *m_iconLoader; | 82 | BTIconLoader *m_iconLoader; |
83 | SerialForwarder* forwarder; | ||
82 | 84 | ||
83 | private slots: | 85 | private slots: |
84 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); | 86 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); |
85 | void addServicesToDevices(); | 87 | void addServicesToDevices(); |
86 | void addServicesToDevice( BTDeviceItem *item ); | 88 | void addServicesToDevice( BTDeviceItem *item ); |
87 | void addServicesToDevice( const QString& device, Services::ValueList ); | 89 | void addServicesToDevice( const QString& device, Services::ValueList ); |
88 | void addConnectedDevices(); | 90 | void addConnectedDevices(); |
89 | void addConnectedDevices( ConnectionState::ValueList ); | 91 | void addConnectedDevices( ConnectionState::ValueList ); |
90 | void startServiceActionClicked( QListViewItem *item ); | 92 | void startServiceActionClicked( QListViewItem *item ); |
91 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); | 93 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
92 | void deviceActive( const QString& mac, bool connected ); | 94 | void deviceActive( const QString& mac, bool connected ); |
93 | void applyConfigChanges(); | 95 | void applyConfigChanges(); |
96 | void doForward(); | ||
97 | void forwardExit(Opie::Core::OProcess* proc); | ||
94 | void addSignalStrength(); | 98 | void addSignalStrength(); |
95 | void addSignalStrength( const QString& mac, const QString& strengh ); | 99 | void addSignalStrength( const QString& mac, const QString& strengh ); |
96 | void rfcommDialog(); | 100 | void rfcommDialog(); |
97 | 101 | ||
98 | }; | 102 | }; |
99 | 103 | ||
100 | } | 104 | } |
101 | 105 | ||
102 | #endif | 106 | #endif |
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index cbde3c6..a5e2c6f 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui | |||
@@ -1,85 +1,79 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>BluetoothBase</class> | 2 | <class>BluetoothBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>BluetoothBase</cstring> | 7 | <cstring>BluetoothBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>293</width> | 14 | <width>268</width> |
15 | <height>382</height> | 15 | <height>368</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <vbox> |
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <grid> | ||
29 | <property stdset="1"> | 23 | <property stdset="1"> |
30 | <name>margin</name> | 24 | <name>margin</name> |
31 | <number>4</number> | 25 | <number>0</number> |
32 | </property> | 26 | </property> |
33 | <property stdset="1"> | 27 | <property stdset="1"> |
34 | <name>spacing</name> | 28 | <name>spacing</name> |
35 | <number>2</number> | 29 | <number>0</number> |
36 | </property> | 30 | </property> |
37 | <widget row="0" column="0" > | 31 | <widget> |
38 | <class>QTabWidget</class> | 32 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 33 | <property stdset="1"> |
40 | <name>name</name> | 34 | <name>name</name> |
41 | <cstring>Status</cstring> | 35 | <cstring>Status</cstring> |
42 | </property> | 36 | </property> |
43 | <property> | 37 | <property> |
44 | <name>layoutMargin</name> | 38 | <name>layoutMargin</name> |
45 | </property> | 39 | </property> |
46 | <property> | 40 | <property> |
47 | <name>layoutSpacing</name> | 41 | <name>layoutSpacing</name> |
48 | </property> | 42 | </property> |
49 | <widget> | 43 | <widget> |
50 | <class>QWidget</class> | 44 | <class>QWidget</class> |
51 | <property stdset="1"> | 45 | <property stdset="1"> |
52 | <name>name</name> | 46 | <name>name</name> |
53 | <cstring>tab</cstring> | 47 | <cstring>tab</cstring> |
54 | </property> | 48 | </property> |
55 | <attribute> | 49 | <attribute> |
56 | <name>title</name> | 50 | <name>title</name> |
57 | <string>Devices</string> | 51 | <string>Devices</string> |
58 | </attribute> | 52 | </attribute> |
59 | <vbox> | 53 | <vbox> |
60 | <property stdset="1"> | 54 | <property stdset="1"> |
61 | <name>margin</name> | 55 | <name>margin</name> |
62 | <number>4</number> | 56 | <number>4</number> |
63 | </property> | 57 | </property> |
64 | <property stdset="1"> | 58 | <property stdset="1"> |
65 | <name>spacing</name> | 59 | <name>spacing</name> |
66 | <number>2</number> | 60 | <number>2</number> |
67 | </property> | 61 | </property> |
68 | <widget> | 62 | <widget> |
69 | <class>QListView</class> | 63 | <class>QListView</class> |
70 | <column> | 64 | <column> |
71 | <property> | 65 | <property> |
72 | <name>text</name> | 66 | <name>text</name> |
73 | <string>Device Name</string> | 67 | <string>Device Name</string> |
74 | </property> | 68 | </property> |
75 | <property> | 69 | <property> |
76 | <name>clickable</name> | 70 | <name>clickable</name> |
77 | <bool>true</bool> | 71 | <bool>true</bool> |
78 | </property> | 72 | </property> |
79 | <property> | 73 | <property> |
80 | <name>resizeable</name> | 74 | <name>resizeable</name> |
81 | <bool>true</bool> | 75 | <bool>true</bool> |
82 | </property> | 76 | </property> |
83 | </column> | 77 | </column> |
84 | <column> | 78 | <column> |
85 | <property> | 79 | <property> |
@@ -331,52 +325,214 @@ | |||
331 | </widget> | 325 | </widget> |
332 | <widget row="1" column="1" > | 326 | <widget row="1" column="1" > |
333 | <class>QLineEdit</class> | 327 | <class>QLineEdit</class> |
334 | <property stdset="1"> | 328 | <property stdset="1"> |
335 | <name>name</name> | 329 | <name>name</name> |
336 | <cstring>passkeyLine</cstring> | 330 | <cstring>passkeyLine</cstring> |
337 | </property> | 331 | </property> |
338 | <property stdset="1"> | 332 | <property stdset="1"> |
339 | <name>echoMode</name> | 333 | <name>echoMode</name> |
340 | <enum>Password</enum> | 334 | <enum>Password</enum> |
341 | </property> | 335 | </property> |
342 | </widget> | 336 | </widget> |
343 | </grid> | 337 | </grid> |
344 | </widget> | 338 | </widget> |
345 | </grid> | 339 | </grid> |
346 | </widget> | 340 | </widget> |
347 | <widget> | 341 | <widget> |
348 | <class>QWidget</class> | 342 | <class>QWidget</class> |
349 | <property stdset="1"> | 343 | <property stdset="1"> |
350 | <name>name</name> | 344 | <name>name</name> |
351 | <cstring>tab</cstring> | 345 | <cstring>tab</cstring> |
352 | </property> | 346 | </property> |
353 | <attribute> | 347 | <attribute> |
354 | <name>title</name> | 348 | <name>title</name> |
355 | <string>Status</string> | 349 | <string>Status</string> |
356 | </attribute> | 350 | </attribute> |
357 | <vbox> | 351 | <vbox> |
358 | <property stdset="1"> | 352 | <property stdset="1"> |
359 | <name>margin</name> | 353 | <name>margin</name> |
360 | <number>4</number> | 354 | <number>4</number> |
361 | </property> | 355 | </property> |
362 | <property stdset="1"> | 356 | <property stdset="1"> |
363 | <name>spacing</name> | 357 | <name>spacing</name> |
364 | <number>2</number> | 358 | <number>2</number> |
365 | </property> | 359 | </property> |
366 | <widget> | 360 | <widget> |
367 | <class>QLabel</class> | 361 | <class>QLabel</class> |
368 | <property stdset="1"> | 362 | <property stdset="1"> |
369 | <name>name</name> | 363 | <name>name</name> |
370 | <cstring>StatusLabel</cstring> | 364 | <cstring>StatusLabel</cstring> |
371 | </property> | 365 | </property> |
372 | <property stdset="1"> | 366 | <property stdset="1"> |
373 | <name>text</name> | 367 | <name>text</name> |
374 | <string>Status Label</string> | 368 | <string>Status Label</string> |
375 | </property> | 369 | </property> |
376 | </widget> | 370 | </widget> |
377 | </vbox> | 371 | </vbox> |
378 | </widget> | 372 | </widget> |
373 | <widget> | ||
374 | <class>QWidget</class> | ||
375 | <property stdset="1"> | ||
376 | <name>name</name> | ||
377 | <cstring>tab</cstring> | ||
378 | </property> | ||
379 | <attribute> | ||
380 | <name>title</name> | ||
381 | <string>Phone</string> | ||
382 | </attribute> | ||
383 | <vbox> | ||
384 | <property stdset="1"> | ||
385 | <name>margin</name> | ||
386 | <number>0</number> | ||
387 | </property> | ||
388 | <property stdset="1"> | ||
389 | <name>spacing</name> | ||
390 | <number>0</number> | ||
391 | </property> | ||
392 | <widget> | ||
393 | <class>QGroupBox</class> | ||
394 | <property stdset="1"> | ||
395 | <name>name</name> | ||
396 | <cstring>cellForwarder</cstring> | ||
397 | </property> | ||
398 | <property stdset="1"> | ||
399 | <name>title</name> | ||
400 | <string>Cell Forwarder</string> | ||
401 | </property> | ||
402 | <vbox> | ||
403 | <property stdset="1"> | ||
404 | <name>margin</name> | ||
405 | <number>11</number> | ||
406 | </property> | ||
407 | <property stdset="1"> | ||
408 | <name>spacing</name> | ||
409 | <number>6</number> | ||
410 | </property> | ||
411 | <widget> | ||
412 | <class>QLayoutWidget</class> | ||
413 | <property stdset="1"> | ||
414 | <name>name</name> | ||
415 | <cstring>Layout9</cstring> | ||
416 | </property> | ||
417 | <vbox> | ||
418 | <property stdset="1"> | ||
419 | <name>margin</name> | ||
420 | <number>0</number> | ||
421 | </property> | ||
422 | <property stdset="1"> | ||
423 | <name>spacing</name> | ||
424 | <number>6</number> | ||
425 | </property> | ||
426 | <widget> | ||
427 | <class>QLayoutWidget</class> | ||
428 | <property stdset="1"> | ||
429 | <name>name</name> | ||
430 | <cstring>Layout5</cstring> | ||
431 | </property> | ||
432 | <hbox> | ||
433 | <property stdset="1"> | ||
434 | <name>margin</name> | ||
435 | <number>0</number> | ||
436 | </property> | ||
437 | <property stdset="1"> | ||
438 | <name>spacing</name> | ||
439 | <number>6</number> | ||
440 | </property> | ||
441 | <widget> | ||
442 | <class>QLabel</class> | ||
443 | <property stdset="1"> | ||
444 | <name>name</name> | ||
445 | <cstring>serDevLabel</cstring> | ||
446 | </property> | ||
447 | <property stdset="1"> | ||
448 | <name>text</name> | ||
449 | <string>Serial device:</string> | ||
450 | </property> | ||
451 | </widget> | ||
452 | <widget> | ||
453 | <class>QLineEdit</class> | ||
454 | <property stdset="1"> | ||
455 | <name>name</name> | ||
456 | <cstring>serDevName</cstring> | ||
457 | </property> | ||
458 | </widget> | ||
459 | </hbox> | ||
460 | </widget> | ||
461 | <widget> | ||
462 | <class>QLayoutWidget</class> | ||
463 | <property stdset="1"> | ||
464 | <name>name</name> | ||
465 | <cstring>Layout6</cstring> | ||
466 | </property> | ||
467 | <hbox> | ||
468 | <property stdset="1"> | ||
469 | <name>margin</name> | ||
470 | <number>0</number> | ||
471 | </property> | ||
472 | <property stdset="1"> | ||
473 | <name>spacing</name> | ||
474 | <number>6</number> | ||
475 | </property> | ||
476 | <widget> | ||
477 | <class>QLabel</class> | ||
478 | <property stdset="1"> | ||
479 | <name>name</name> | ||
480 | <cstring>serSpeedLabel</cstring> | ||
481 | </property> | ||
482 | <property stdset="1"> | ||
483 | <name>text</name> | ||
484 | <string>Speed:</string> | ||
485 | </property> | ||
486 | </widget> | ||
487 | <widget> | ||
488 | <class>QComboBox</class> | ||
489 | <property stdset="1"> | ||
490 | <name>name</name> | ||
491 | <cstring>serSpeed</cstring> | ||
492 | </property> | ||
493 | </widget> | ||
494 | </hbox> | ||
495 | </widget> | ||
496 | <widget> | ||
497 | <class>QPushButton</class> | ||
498 | <property stdset="1"> | ||
499 | <name>name</name> | ||
500 | <cstring>runButton</cstring> | ||
501 | </property> | ||
502 | <property stdset="1"> | ||
503 | <name>text</name> | ||
504 | <string>start gateway</string> | ||
505 | </property> | ||
506 | </widget> | ||
507 | </vbox> | ||
508 | </widget> | ||
509 | </vbox> | ||
510 | </widget> | ||
511 | </vbox> | ||
512 | </widget> | ||
379 | </widget> | 513 | </widget> |
380 | </grid> | 514 | </vbox> |
381 | </widget> | 515 | </widget> |
516 | <customwidgets> | ||
517 | <customwidget> | ||
518 | <class>QWidget</class> | ||
519 | <header location="local">qwidget.h</header> | ||
520 | <sizehint> | ||
521 | <width>100</width> | ||
522 | <height>100</height> | ||
523 | </sizehint> | ||
524 | <container>0</container> | ||
525 | <sizepolicy> | ||
526 | <hordata>7</hordata> | ||
527 | <verdata>7</verdata> | ||
528 | </sizepolicy> | ||
529 | <pixmap>image0</pixmap> | ||
530 | </customwidget> | ||
531 | </customwidgets> | ||
532 | <images> | ||
533 | <image> | ||
534 | <name>image0</name> | ||
535 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | ||
536 | </image> | ||
537 | </images> | ||
382 | </UI> | 538 | </UI> |