Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTGateway.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTGateway.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp index 6531cf6..e8137dd 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp | |||
@@ -145,25 +145,25 @@ bool OTGateway::needsEnabling() { | |||
145 | 145 | ||
146 | bool OTGateway::isEnabled() { | 146 | bool OTGateway::isEnabled() { |
147 | if( getOTDevice()->deviceNr() >= 0 && | 147 | if( getOTDevice()->deviceNr() >= 0 && |
148 | driver( getOTDevice()->deviceNr() )->isUp() ) | 148 | driver( getOTDevice()->deviceNr() )->isUp() ) |
149 | return TRUE; | 149 | return TRUE; |
150 | 150 | ||
151 | // else check system | 151 | // else check system |
152 | return getOTDevice()->isAttached(); | 152 | return getOTDevice()->isAttached(); |
153 | } | 153 | } |
154 | 154 | ||
155 | void OTGateway::SLOT_ShowError( const QString & S ) { | 155 | void OTGateway::SLOT_ShowError( const QString & S ) { |
156 | 156 | ||
157 | owarn << S << oendl; | 157 | odebug << S << oendl; |
158 | 158 | ||
159 | if( ErrorConnectCount > 0 ) { | 159 | if( ErrorConnectCount > 0 ) { |
160 | // pass error | 160 | // pass error |
161 | emit error( QString( "<p>" ) + S + "</p>" ); | 161 | emit error( QString( "<p>" ) + S + "</p>" ); |
162 | return; | 162 | return; |
163 | } | 163 | } |
164 | 164 | ||
165 | QMessageBox::warning( 0, | 165 | QMessageBox::warning( 0, |
166 | tr("OTGateway error"), | 166 | tr("OTGateway error"), |
167 | S ); | 167 | S ); |
168 | } | 168 | } |
169 | 169 | ||
@@ -201,42 +201,42 @@ void OTGateway::timerEvent( QTimerEvent * ) { | |||
201 | } | 201 | } |
202 | } else { | 202 | } else { |
203 | // if one driver is unable to provide info | 203 | // if one driver is unable to provide info |
204 | // we refresh all devices | 204 | // we refresh all devices |
205 | updateDrivers(); | 205 | updateDrivers(); |
206 | return; | 206 | return; |
207 | } | 207 | } |
208 | } | 208 | } |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | void OTGateway::SLOT_Enabled( int id, bool Up ) { | 212 | void OTGateway::SLOT_Enabled( int id, bool Up ) { |
213 | owarn << "device " << id << " state " << Up << oendl; | 213 | odebug << "device " << id << " state " << Up << oendl; |
214 | if( Up ) { | 214 | if( Up ) { |
215 | // device is up -> detect it | 215 | // device is up -> detect it |
216 | updateDrivers(); | 216 | updateDrivers(); |
217 | if( (unsigned)id >= AllDrivers.count() ) { | 217 | if( (unsigned)id >= AllDrivers.count() ) { |
218 | // to make sure that the driver really IS detected | 218 | // to make sure that the driver really IS detected |
219 | AllDrivers[id]->bringUp(); | 219 | AllDrivers[id]->bringUp(); |
220 | } | 220 | } |
221 | } // if DOWN device already down | 221 | } // if DOWN device already down |
222 | emit deviceEnabled( Up ); | 222 | emit deviceEnabled( Up ); |
223 | } | 223 | } |
224 | 224 | ||
225 | void OTGateway::updateDrivers( void ) { | 225 | void OTGateway::updateDrivers( void ) { |
226 | OTDriver * D; | 226 | OTDriver * D; |
227 | 227 | ||
228 | AllDrivers.update(); | 228 | AllDrivers.update(); |
229 | 229 | ||
230 | owarn << "updated drivers. now " << AllDrivers.count() << oendl; | 230 | odebug << "updated drivers. now " << AllDrivers.count() << oendl; |
231 | 231 | ||
232 | // connect signals for each driver | 232 | // connect signals for each driver |
233 | for( unsigned int i = 0; | 233 | for( unsigned int i = 0; |
234 | i < AllDrivers.count(); | 234 | i < AllDrivers.count(); |
235 | i ++ ) { | 235 | i ++ ) { |
236 | D = AllDrivers[i]; | 236 | D = AllDrivers[i]; |
237 | 237 | ||
238 | connect( D, | 238 | connect( D, |
239 | SIGNAL( error( const QString & ) ), | 239 | SIGNAL( error( const QString & ) ), |
240 | this, | 240 | this, |
241 | SLOT( SLOT_ShowError( const QString & ) ) | 241 | SLOT( SLOT_ShowError( const QString & ) ) |
242 | ); | 242 | ); |
@@ -256,25 +256,25 @@ void OTGateway::updateDrivers( void ) { | |||
256 | 256 | ||
257 | // verify main device too | 257 | // verify main device too |
258 | if( TheOTDevice ) | 258 | if( TheOTDevice ) |
259 | TheOTDevice->checkAttach(); | 259 | TheOTDevice->checkAttach(); |
260 | 260 | ||
261 | // set to default scanning hardware | 261 | // set to default scanning hardware |
262 | setScanWith( 0 ); | 262 | setScanWith( 0 ); |
263 | 263 | ||
264 | emit driverListChanged(); | 264 | emit driverListChanged(); |
265 | } | 265 | } |
266 | 266 | ||
267 | void OTGateway::SLOT_DriverDisappeared( OTDriver * D ) { | 267 | void OTGateway::SLOT_DriverDisappeared( OTDriver * D ) { |
268 | owarn << "Driver " << D->devname() << " when offline" << oendl; | 268 | odebug << "Driver " << D->devname() << " when offline" << oendl; |
269 | updateDrivers(); | 269 | updateDrivers(); |
270 | } | 270 | } |
271 | 271 | ||
272 | void OTGateway::scanNeighbourhood( OTDriver * D ) { | 272 | void OTGateway::scanNeighbourhood( OTDriver * D ) { |
273 | 273 | ||
274 | if( Scanning ) { | 274 | if( Scanning ) { |
275 | stopScanOfNeighbourhood(); | 275 | stopScanOfNeighbourhood(); |
276 | } | 276 | } |
277 | 277 | ||
278 | if( D ) { | 278 | if( D ) { |
279 | setScanWith( D ); | 279 | setScanWith( D ); |
280 | } | 280 | } |
@@ -309,25 +309,25 @@ OTDriver* OTGateway::findDriver( const OTDeviceAddress & Addr ) { | |||
309 | for( unsigned int i = 0 ; i < AllDrivers.count(); i ++ ) { | 309 | for( unsigned int i = 0 ; i < AllDrivers.count(); i ++ ) { |
310 | if( AllDrivers[i]->address() == Addr ) { | 310 | if( AllDrivers[i]->address() == Addr ) { |
311 | return AllDrivers[i]; | 311 | return AllDrivers[i]; |
312 | } | 312 | } |
313 | } | 313 | } |
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | void OTGateway::SLOT_PeerDetected( OTPeer * P, bool IsNew ) { | 317 | void OTGateway::SLOT_PeerDetected( OTPeer * P, bool IsNew ) { |
318 | 318 | ||
319 | if( IsNew ) { | 319 | if( IsNew ) { |
320 | // new peer | 320 | // new peer |
321 | owarn << "New peer " << P->name() << oendl; | 321 | odebug << "New peer " << P->name() << oendl; |
322 | addPeer( P ); | 322 | addPeer( P ); |
323 | } | 323 | } |
324 | 324 | ||
325 | emit detectedPeer( P, IsNew ); | 325 | emit detectedPeer( P, IsNew ); |
326 | } | 326 | } |
327 | 327 | ||
328 | void OTGateway::addPeer( OTPeer * P ) { | 328 | void OTGateway::addPeer( OTPeer * P ) { |
329 | AllPeers.resize( AllPeers.size()+1); | 329 | AllPeers.resize( AllPeers.size()+1); |
330 | AllPeers.insert( AllPeers.size()-1, P ); | 330 | AllPeers.insert( AllPeers.size()-1, P ); |
331 | AllPeersModified = 1; | 331 | AllPeersModified = 1; |
332 | } | 332 | } |
333 | 333 | ||
@@ -375,32 +375,32 @@ const char * OTGateway::deviceTypeToName( int cls ) { | |||
375 | } | 375 | } |
376 | 376 | ||
377 | PANConnectionVector OTGateway::getPANConnections( void ) { | 377 | PANConnectionVector OTGateway::getPANConnections( void ) { |
378 | PANConnectionVector V; | 378 | PANConnectionVector V; |
379 | 379 | ||
380 | struct bnep_connlist_req req; | 380 | struct bnep_connlist_req req; |
381 | struct bnep_conninfo ci[48]; | 381 | struct bnep_conninfo ci[48]; |
382 | 382 | ||
383 | V.setAutoDelete(TRUE); | 383 | V.setAutoDelete(TRUE); |
384 | 384 | ||
385 | int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); | 385 | int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); |
386 | if (ctl < 0) { | 386 | if (ctl < 0) { |
387 | owarn << "Failed to open control socket" << oendl; | 387 | odebug << "Failed to open control socket" << oendl; |
388 | return V; | 388 | return V; |
389 | } | 389 | } |
390 | 390 | ||
391 | req.cnum = 48; | 391 | req.cnum = 48; |
392 | req.ci = ci; | 392 | req.ci = ci; |
393 | if (ioctl(ctl, BNEPGETCONNLIST, &req)) { | 393 | if (ioctl(ctl, BNEPGETCONNLIST, &req)) { |
394 | owarn << "Failed to get connection list" << oendl; | 394 | odebug << "Failed to get connection list" << oendl; |
395 | ::close( ctl ); | 395 | ::close( ctl ); |
396 | return V; | 396 | return V; |
397 | } | 397 | } |
398 | 398 | ||
399 | for ( unsigned i=0; i < req.cnum; i++) { | 399 | for ( unsigned i=0; i < req.cnum; i++) { |
400 | V.resize( V.size() + 1 ); | 400 | V.resize( V.size() + 1 ); |
401 | if( ci[i].role == BNEP_SVC_PANU ) { | 401 | if( ci[i].role == BNEP_SVC_PANU ) { |
402 | // we are the client | 402 | // we are the client |
403 | V.insert( V.size()-1, new OTPANConnection( | 403 | V.insert( V.size()-1, new OTPANConnection( |
404 | ci[i].device, | 404 | ci[i].device, |
405 | batostr((bdaddr_t *) ci[i].dst) | 405 | batostr((bdaddr_t *) ci[i].dst) |
406 | ) ); | 406 | ) ); |