author | zecke <zecke> | 2002-06-15 23:07:12 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-15 23:07:12 (UTC) |
commit | 0675d8e8ea5f599af9f433e1e86b63953b26639d (patch) (unidiff) | |
tree | fb3aaa512aa8f4600de119574999749758d38139 | |
parent | 3f49c8a3006c4c51cf7d4a2f84a3926efd3e1820 (diff) | |
download | opie-0675d8e8ea5f599af9f433e1e86b63953b26639d.zip opie-0675d8e8ea5f599af9f433e1e86b63953b26639d.tar.gz opie-0675d8e8ea5f599af9f433e1e86b63953b26639d.tar.bz2 |
fix it
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 11 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/lib.pro | 2 |
3 files changed, 11 insertions, 4 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index a380ac7..6e5ee82 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -1,205 +1,205 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> | 3 | .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <, > . <= redistribute it and/or modify it under | 6 | .> <, > . <= redistribute it and/or modify it under |
7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%+i> _;_. | 11 | .%+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. . .: details. | 18 | ++= -. . .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-= this library; see the file COPYING.LIB. | 22 | -- :-= this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #include "bluezapplet.h" | 30 | #include "bluezapplet.h" |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | #include <qpoint.h> | 38 | #include <qpoint.h> |
39 | #include <qpainter.h> | 39 | #include <qpainter.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qframe.h> | 41 | #include <qframe.h> |
42 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
43 | #include <qstring.h> | 43 | #include <qstring.h> |
44 | #include <qtimer.h> | 44 | #include <qtimer.h> |
45 | #include <qpopupmenu.h> | 45 | #include <qpopupmenu.h> |
46 | 46 | ||
47 | #include <device.h> | 47 | #include <device.h> |
48 | 48 | ||
49 | namespace OpieTooth { | 49 | namespace OpieTooth { |
50 | 50 | ||
51 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { | 51 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { |
52 | setFixedHeight( 18 ); | 52 | setFixedHeight( 18 ); |
53 | setFixedWidth( 14 ); | 53 | setFixedWidth( 14 ); |
54 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); | 54 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); |
55 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); | 55 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); |
56 | // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); | 56 | // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); |
57 | startTimer(5000); | 57 | startTimer(5000); |
58 | timerEvent(NULL); | 58 | timerEvent(NULL); |
59 | } | 59 | } |
60 | 60 | ||
61 | BluezApplet::~BluezApplet() { | 61 | BluezApplet::~BluezApplet() { |
62 | } | 62 | } |
63 | 63 | ||
64 | int BluezApplet::checkBluezStatus() { | 64 | int BluezApplet::checkBluezStatus() { |
65 | if (btDevice) { | 65 | if (btDevice) { |
66 | if (btDevice->isLoaded() ) { | 66 | if (btDevice->isLoaded() ) { |
67 | return 1; | 67 | return 1; |
68 | } else { | 68 | } else { |
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | } else { | 71 | } else { |
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | int BluezApplet::setBluezStatus(int c) { | 76 | int BluezApplet::setBluezStatus(int c) { |
77 | 77 | ||
78 | if (c == 1) { | 78 | if (c == 1) { |
79 | btDevice = new Device("/dev/ttySB0", "scr" ); | 79 | btDevice = new Device("/dev/ttySB0", "csr" ); |
80 | // system("hciattach /dev/ttySB0 csr"); | 80 | // system("hciattach /dev/ttySB0 csr"); |
81 | //system("hcid"); | 81 | //system("hcid"); |
82 | } else { | 82 | } else { |
83 | if (btDevice) { | 83 | if (btDevice) { |
84 | delete btDevice; | 84 | delete btDevice; |
85 | } | 85 | } |
86 | //system("killall hciattach"); | 86 | //system("killall hciattach"); |
87 | //system("killall hcid"); | 87 | //system("killall hcid"); |
88 | } | 88 | } |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | int BluezApplet::checkBluezDiscoveryStatus() { | 92 | int BluezApplet::checkBluezDiscoveryStatus() { |
93 | } | 93 | } |
94 | 94 | ||
95 | int BluezApplet::setBluezDiscoveryStatus(int d) { | 95 | int BluezApplet::setBluezDiscoveryStatus(int d) { |
96 | } | 96 | } |
97 | 97 | ||
98 | void BluezApplet::mousePressEvent( QMouseEvent *) { | 98 | void BluezApplet::mousePressEvent( QMouseEvent *) { |
99 | 99 | ||
100 | QPopupMenu *menu = new QPopupMenu(); | 100 | QPopupMenu *menu = new QPopupMenu(); |
101 | QPopupMenu *signal = new QPopupMenu(); | 101 | QPopupMenu *signal = new QPopupMenu(); |
102 | int ret=0; | 102 | int ret=0; |
103 | 103 | ||
104 | /* Refresh active state */ | 104 | /* Refresh active state */ |
105 | timerEvent(NULL); | 105 | timerEvent(NULL); |
106 | 106 | ||
107 | 107 | ||
108 | if (bluezactive) { | 108 | if (bluezactive) { |
109 | menu->insertItem( tr("Disable Bluetooth"), 0 ); | 109 | menu->insertItem( tr("Disable Bluetooth"), 0 ); |
110 | } else { | 110 | } else { |
111 | menu->insertItem( tr("Enable Bluetooth"), 1 ); | 111 | menu->insertItem( tr("Enable Bluetooth"), 1 ); |
112 | } | 112 | } |
113 | 113 | ||
114 | menu->insertItem( tr("Launch manager"), 2 ); | 114 | menu->insertItem( tr("Launch manager"), 2 ); |
115 | 115 | ||
116 | menu->insertSeparator(6); | 116 | menu->insertSeparator(6); |
117 | menu->insertItem( tr("Signal strength"), signal, 5); | 117 | menu->insertItem( tr("Signal strength"), signal, 5); |
118 | menu->insertSeparator(8); | 118 | menu->insertSeparator(8); |
119 | 119 | ||
120 | if (bluezDiscoveryActive) { | 120 | if (bluezDiscoveryActive) { |
121 | menu->insertItem( tr("Disable discovery"), 3 ); | 121 | menu->insertItem( tr("Disable discovery"), 3 ); |
122 | } else { | 122 | } else { |
123 | menu->insertItem( tr("Enable discovery"), 4 ); | 123 | menu->insertItem( tr("Enable discovery"), 4 ); |
124 | } | 124 | } |
125 | //menu->insertItem( tr("More..."), 7 ) | 125 | //menu->insertItem( tr("More..."), 7 ) |
126 | 126 | ||
127 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); | 127 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); |
128 | ret = menu->exec(p, 0); | 128 | ret = menu->exec(p, 0); |
129 | 129 | ||
130 | // qDebug("ret was %d\n", ret); | 130 | // qDebug("ret was %d\n", ret); |
131 | 131 | ||
132 | switch(ret) { | 132 | switch(ret) { |
133 | case 0: | 133 | case 0: |
134 | setBluezStatus(0); | 134 | setBluezStatus(0); |
135 | timerEvent(NULL); | 135 | timerEvent(NULL); |
136 | break; | 136 | break; |
137 | case 1: | 137 | case 1: |
138 | setBluezStatus(1); | 138 | setBluezStatus(1); |
139 | timerEvent(NULL); | 139 | timerEvent(NULL); |
140 | break; | 140 | break; |
141 | case 2: | 141 | case 2: |
142 | // start bluetoothmanager | 142 | // start bluetoothmanager |
143 | launchManager(); | 143 | launchManager(); |
144 | timerEvent(NULL); | 144 | timerEvent(NULL); |
145 | break; | 145 | break; |
146 | case 3: | 146 | case 3: |
147 | setBluezDiscoveryStatus(0); | 147 | setBluezDiscoveryStatus(0); |
148 | timerEvent(NULL); | 148 | timerEvent(NULL); |
149 | break; | 149 | break; |
150 | case 4: | 150 | case 4: |
151 | setBluezDiscoveryStatus(1); | 151 | setBluezDiscoveryStatus(1); |
152 | timerEvent(NULL); | 152 | timerEvent(NULL); |
153 | break; | 153 | break; |
154 | //case 7: | 154 | //case 7: |
155 | // With table of currently-detected devices. | 155 | // With table of currently-detected devices. |
156 | } | 156 | } |
157 | delete menu; | 157 | delete menu; |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Launches the bluetooth manager | 162 | * Launches the bluetooth manager |
163 | */ | 163 | */ |
164 | void BluezApplet::launchManager() { | 164 | void BluezApplet::launchManager() { |
165 | QCopEnvelope e("QPE/System", "execute(QString)"); | 165 | QCopEnvelope e("QPE/System", "execute(QString)"); |
166 | e << QString("bluetooth-manager"); | 166 | e << QString("bluetooth-manager"); |
167 | } | 167 | } |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Refresh timer | 170 | * Refresh timer |
171 | * @param the timer event | 171 | * @param the timer event |
172 | */ | 172 | */ |
173 | void BluezApplet::timerEvent( QTimerEvent * ) { | 173 | void BluezApplet::timerEvent( QTimerEvent * ) { |
174 | int oldactive = bluezactive; | 174 | int oldactive = bluezactive; |
175 | int olddiscovery = bluezDiscoveryActive; | 175 | int olddiscovery = bluezDiscoveryActive; |
176 | 176 | ||
177 | bluezactive = checkBluezStatus(); | 177 | bluezactive = checkBluezStatus(); |
178 | bluezDiscoveryActive = checkBluezDiscoveryStatus(); | 178 | bluezDiscoveryActive = checkBluezDiscoveryStatus(); |
179 | 179 | ||
180 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { | 180 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { |
181 | paintEvent(NULL); | 181 | paintEvent(NULL); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Implementation of the paint event | 186 | * Implementation of the paint event |
187 | * @param the QPaintEvent | 187 | * @param the QPaintEvent |
188 | */ | 188 | */ |
189 | void BluezApplet::paintEvent( QPaintEvent* ) { | 189 | void BluezApplet::paintEvent( QPaintEvent* ) { |
190 | QPainter p(this); | 190 | QPainter p(this); |
191 | qDebug("paint bluetooth pixmap"); | 191 | qDebug("paint bluetooth pixmap"); |
192 | 192 | ||
193 | p.eraseRect ( 0, 0, this->width(), this->height() ); | 193 | p.eraseRect ( 0, 0, this->width(), this->height() ); |
194 | 194 | ||
195 | if (bluezactive > 0) { | 195 | if (bluezactive > 0) { |
196 | p.drawPixmap( 0, 1, bluezOnPixmap ); | 196 | p.drawPixmap( 0, 1, bluezOnPixmap ); |
197 | } else { | 197 | } else { |
198 | p.drawPixmap( 0, 1, bluezOffPixmap ); | 198 | p.drawPixmap( 0, 1, bluezOffPixmap ); |
199 | } | 199 | } |
200 | 200 | ||
201 | if (bluezDiscoveryActive > 0) { | 201 | if (bluezDiscoveryActive > 0) { |
202 | p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); | 202 | p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | }; | 205 | }; |
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index 5234996..5edfc03 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc | |||
@@ -1,142 +1,149 @@ | |||
1 | 1 | ||
2 | #include <signal.h> | 2 | #include <signal.h> |
3 | 3 | ||
4 | #include <opie/oprocess.h> | 4 | #include <opie/oprocess.h> |
5 | 5 | ||
6 | #include "device.h" | 6 | #include "device.h" |
7 | 7 | ||
8 | using namespace OpieTooth; | 8 | using namespace OpieTooth; |
9 | 9 | ||
10 | namespace { | 10 | namespace { |
11 | int parsePid( const QCString& par ){ | 11 | int parsePid( const QCString& par ){ |
12 | int id=0; | 12 | int id=0; |
13 | QString string( par ); | 13 | QString string( par ); |
14 | QStringList list = QStringList::split( '\n', string ); | 14 | QStringList list = QStringList::split( '\n', string ); |
15 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ | 15 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ |
16 | qWarning("parsePID: %s", (*it).latin1() ); | ||
16 | if( !(*it).startsWith("CSR") ){ | 17 | if( !(*it).startsWith("CSR") ){ |
17 | id = (*it).toInt(); | 18 | id = (*it).toInt(); |
18 | break; | 19 | break; |
19 | } | 20 | } |
20 | } | 21 | } |
21 | return id; | 22 | return id; |
22 | } | 23 | } |
23 | } | 24 | } |
24 | 25 | ||
25 | Device::Device(const QString &device, const QString &mode ) | 26 | Device::Device(const QString &device, const QString &mode ) |
26 | : QObject(0, "device" ) { | 27 | : QObject(0, "device" ) { |
27 | qWarning("OpieTooth::Device create" ); | 28 | qWarning("OpieTooth::Device create" ); |
28 | m_hci = 0; | 29 | m_hci = 0; |
29 | m_process = 0; | 30 | m_process = 0; |
30 | m_attached = false; | 31 | m_attached = false; |
31 | m_device = device; | 32 | m_device = device; |
32 | m_mode = mode; | 33 | m_mode = mode; |
33 | attach(); | 34 | attach(); |
34 | } | 35 | } |
35 | Device::~Device(){ | 36 | Device::~Device(){ |
36 | detach(); | 37 | detach(); |
37 | } | 38 | } |
38 | void Device::attach(){ | 39 | void Device::attach(){ |
39 | qWarning("attaching %s %s", m_device.latin1(), m_mode.latin1() ); | 40 | qWarning("attaching %s %s", m_device.latin1(), m_mode.latin1() ); |
40 | if(m_process == 0 ){ | 41 | if(m_process == 0 ){ |
41 | m_output.resize(0); | 42 | m_output.resize(0); |
42 | qWarning("new process to create" ); | 43 | qWarning("new process to create" ); |
43 | m_process = new OProcess(); | 44 | m_process = new OProcess(); |
44 | *m_process << "hciattach"; | 45 | *m_process << "hciattach"; |
45 | *m_process << "-p"; | 46 | *m_process << "-p"; |
46 | *m_process << m_device << m_mode; | 47 | *m_process << m_device << m_mode; |
47 | connect(m_process, SIGNAL( processExited(OProcess*) ), | 48 | connect(m_process, SIGNAL( processExited(OProcess*) ), |
48 | this, SLOT( slotExited(OProcess* ) ) ); | 49 | this, SLOT( slotExited(OProcess* ) ) ); |
49 | connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ), | 50 | connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ), |
50 | this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); | 51 | this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); |
51 | connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ), | 52 | connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ), |
52 | this, SLOT(slotStdErr(OProcess*,char*,int) ) ); | 53 | this, SLOT(slotStdErr(OProcess*,char*,int) ) ); |
53 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ | 54 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ |
54 | qWarning("Could not start" ); | 55 | qWarning("Could not start" ); |
55 | delete m_process; | 56 | delete m_process; |
56 | m_process = 0; | 57 | m_process = 0; |
57 | } | 58 | } |
58 | }; | 59 | }; |
59 | } | 60 | } |
60 | void Device::detach(){ | 61 | void Device::detach(){ |
61 | delete m_hci; | 62 | delete m_hci; |
62 | delete m_process; | 63 | delete m_process; |
63 | // kill the pid we got | 64 | // kill the pid we got |
64 | if(m_attached ){ | 65 | if(m_attached ){ |
65 | //kill the pid | 66 | //kill the pid |
66 | qWarning( "killing" ); | 67 | qWarning( "killing" ); |
67 | kill(pid, 9); | 68 | kill(pid, 9); |
68 | } | 69 | } |
69 | qWarning("detached" ); | 70 | qWarning("detached" ); |
70 | } | 71 | } |
71 | bool Device::isLoaded()const{ | 72 | bool Device::isLoaded()const{ |
72 | return m_attached; | 73 | return m_attached; |
73 | } | 74 | } |
74 | QString Device::devName()const { | 75 | QString Device::devName()const { |
75 | return QString::fromLatin1("hci0"); | 76 | return QString::fromLatin1("hci0"); |
76 | }; | 77 | }; |
77 | void Device::slotExited( OProcess* proc) | 78 | void Device::slotExited( OProcess* proc) |
78 | { | 79 | { |
79 | qWarning("prcess exited" ); | 80 | qWarning("prcess exited" ); |
80 | if(proc== m_process ){ | 81 | if(proc== m_process ){ |
82 | qWarning("proc == m_process" ); | ||
81 | if( m_process->normalExit() ){ // normal exit | 83 | if( m_process->normalExit() ){ // normal exit |
84 | qWarning("normalExit" ); | ||
82 | int ret = m_process->exitStatus(); | 85 | int ret = m_process->exitStatus(); |
83 | if( ret == 0 ){ // attached | 86 | if( ret == 0 ){ // attached |
84 | qWarning("attached" ); | 87 | qWarning("attached" ); |
85 | qWarning("Output: %s", m_output.data() ); | 88 | qWarning("Output: %s", m_output.data() ); |
86 | pid = parsePid( m_output ); | 89 | pid = parsePid( m_output ); |
87 | qWarning("Pid = %d", pid ); | 90 | qWarning("Pid = %d", pid ); |
88 | // now hciconfig hci0 up ( determine hciX FIXME) | 91 | // now hciconfig hci0 up ( determine hciX FIXME) |
89 | // and call hciconfig hci0 up | 92 | // and call hciconfig hci0 up |
90 | // FIXME hardcoded to hci0 now :( | 93 | // FIXME hardcoded to hci0 now :( |
91 | m_hci = new OProcess( ); | 94 | m_hci = new OProcess( ); |
92 | *m_hci << "hciconfig"; | 95 | *m_hci << "hciconfig"; |
93 | *m_hci << "hci0 up"; | 96 | *m_hci << "hci0 up"; |
94 | connect(m_hci, SIGNAL( processExited(OProcess*) ), | 97 | connect(m_hci, SIGNAL( processExited(OProcess*) ), |
95 | this, SLOT( slotExited(OProcess* ) ) ); | 98 | this, SLOT( slotExited(OProcess* ) ) ); |
96 | if(!m_hci->start() ){ | 99 | if(!m_hci->start() ){ |
97 | qWarning("could not start" ); | 100 | qWarning("could not start" ); |
98 | m_attached = false; | 101 | m_attached = false; |
99 | emit device("hci0", false ); | 102 | emit device("hci0", false ); |
100 | } | 103 | } |
101 | }else{ | 104 | }else{ |
105 | qWarning("crass" ); | ||
102 | m_attached = false; | 106 | m_attached = false; |
103 | emit device("hci0", false ); | 107 | emit device("hci0", false ); |
104 | 108 | ||
105 | } | 109 | } |
106 | } | 110 | } |
107 | delete m_process; | 111 | delete m_process; |
108 | m_process = 0; | 112 | m_process = 0; |
109 | }else if(proc== m_hci ){ | 113 | }else if(proc== m_hci ){ |
110 | qWarning("M HCI exited" ); | 114 | qWarning("M HCI exited" ); |
111 | if( m_hci->normalExit() ){ | 115 | if( m_hci->normalExit() ){ |
112 | qWarning("normal exit" ); | 116 | qWarning("normal exit" ); |
113 | int ret = m_hci->exitStatus(); | 117 | int ret = m_hci->exitStatus(); |
114 | if( ret == 0 ){ | 118 | if( ret == 0 ){ |
115 | qWarning("attached really really attached" ); | 119 | qWarning("attached really really attached" ); |
116 | m_attached = true; | 120 | m_attached = true; |
117 | emit device("hci0", true ); | 121 | emit device("hci0", true ); |
118 | }else{ | 122 | }else{ |
119 | qWarning( "failed" ); | 123 | qWarning( "failed" ); |
120 | emit device("hci0", false ); | 124 | emit device("hci0", false ); |
121 | m_attached = false; | 125 | m_attached = false; |
122 | } | 126 | } |
123 | }// normal exit | 127 | }// normal exit |
124 | delete m_hci; | 128 | delete m_hci; |
125 | m_hci = 0; | 129 | m_hci = 0; |
126 | } | 130 | } |
127 | } | 131 | } |
128 | void Device::slotStdOut(OProcess* proc, char* chars, int len) | 132 | void Device::slotStdOut(OProcess* proc, char* chars, int len) |
129 | { | 133 | { |
130 | qWarning("std out" ); | 134 | qWarning("std out" ); |
131 | if( len <1 ) | 135 | if( len <1 ){ |
136 | qWarning( "len < 1 " ); | ||
132 | return; | 137 | return; |
138 | } | ||
133 | if(proc == m_process ){ | 139 | if(proc == m_process ){ |
134 | QCString string( chars, len+1 ); // \0 == +1 | 140 | QCString string( chars, len+1 ); // \0 == +1 |
135 | qWarning("output: %s", string.data() ); | 141 | qWarning("output: %s", string.data() ); |
136 | m_output.append( string.data() ); | 142 | m_output.append( string.data() ); |
137 | } | 143 | } |
138 | } | 144 | } |
139 | void Device::slotStdErr(OProcess*, char*, int ) | 145 | void Device::slotStdErr(OProcess* proc, char* chars, int len) |
140 | { | 146 | { |
141 | qWarning("std err" ); | 147 | qWarning("std err" ); |
148 | slotStdOut( proc, chars, len ); | ||
142 | } | 149 | } |
diff --git a/noncore/net/opietooth/lib/lib.pro b/noncore/net/opietooth/lib/lib.pro index f2cde06..ce36d66 100644 --- a/noncore/net/opietooth/lib/lib.pro +++ b/noncore/net/opietooth/lib/lib.pro | |||
@@ -1,9 +1,9 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = device.h manager.h remotedevice.h services.h | 3 | HEADERS = device.h manager.h remotedevice.h services.h |
4 | SOURCES = device.cc manager.cc remotedevice.cc services.cc | 4 | SOURCES = device.cc manager.cc remotedevice.cc services.cc |
5 | TARGET = opietooth | 5 | TARGET = opietooth |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
8 | LIBS = -lopie | 8 | LIBS += -lopie |
9 | #VERSION = 0.0.0 | 9 | #VERSION = 0.0.0 |