author | wimpie <wimpie> | 2005-01-09 00:32:10 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-09 00:32:10 (UTC) |
commit | e54346d28b19d3ac671802a25e8c03f346693291 (patch) (unidiff) | |
tree | 0f8d6561e24a7ba36fd8a6ab1869aa470e1fdb36 /noncore/settings/networksettings2/opietooth2/OTDriver.cpp | |
parent | 60a617583d0ccc793d9ea4465998d90ec208db58 (diff) | |
download | opie-e54346d28b19d3ac671802a25e8c03f346693291.zip opie-e54346d28b19d3ac671802a25e8c03f346693291.tar.gz opie-e54346d28b19d3ac671802a25e8c03f346693291.tar.bz2 |
Updated dependencies
NS2->app requires OT2Lib and NS2Lib
OT2Lib requires NS2Lib
Most plugins only require NS2Lib
Except
BTPlugin which requires als OT2Lib
Also renamed owarn -> odebug
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTDriver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTDriver.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.cpp b/noncore/settings/networksettings2/opietooth2/OTDriver.cpp index 8bd7919..a7ee662 100644 --- a/noncore/settings/networksettings2/opietooth2/OTDriver.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTDriver.cpp | |||
@@ -141,25 +141,25 @@ static MainClassMap_t MainClasses[] = { | |||
141 | { 5, MapPeripheralClass }, | 141 | { 5, MapPeripheralClass }, |
142 | { 6, 0 }, // special case | 142 | { 6, 0 }, // special case |
143 | { 63, MapUnclassifiedClass }, | 143 | { 63, MapUnclassifiedClass }, |
144 | { -1, 0 } | 144 | { -1, 0 } |
145 | }; | 145 | }; |
146 | 146 | ||
147 | OTDriver::OTDriver( OTGateway * _OT, struct hci_dev_info* di) : QObject( _OT ), Address() { | 147 | OTDriver::OTDriver( OTGateway * _OT, struct hci_dev_info* di) : QObject( _OT ), Address() { |
148 | OT = _OT; | 148 | OT = _OT; |
149 | IsUp = 0; | 149 | IsUp = 0; |
150 | Socket = 0; | 150 | Socket = 0; |
151 | 151 | ||
152 | init(di); | 152 | init(di); |
153 | owarn << "Driver " << devname() << oendl; | 153 | odebug << "Driver " << devname() << oendl; |
154 | 154 | ||
155 | AutoClose = new QTimer( this ); | 155 | AutoClose = new QTimer( this ); |
156 | connect( AutoClose, | 156 | connect( AutoClose, |
157 | SIGNAL( timeout() ), | 157 | SIGNAL( timeout() ), |
158 | this, | 158 | this, |
159 | SLOT( SLOT_CloseFd() ) | 159 | SLOT( SLOT_CloseFd() ) |
160 | ); | 160 | ); |
161 | } | 161 | } |
162 | 162 | ||
163 | OTDriver::~OTDriver() { | 163 | OTDriver::~OTDriver() { |
164 | closeSocket(); | 164 | closeSocket(); |
165 | SLOT_CloseFd(); | 165 | SLOT_CloseFd(); |
@@ -376,48 +376,48 @@ int OTDriver::reset() { | |||
376 | } | 376 | } |
377 | 377 | ||
378 | void OTDriver::setUp( bool M ) { | 378 | void OTDriver::setUp( bool M ) { |
379 | if( M && ! isUp() ) { | 379 | if( M && ! isUp() ) { |
380 | bringUp(); | 380 | bringUp(); |
381 | } else if( ! M && isUp() ) { | 381 | } else if( ! M && isUp() ) { |
382 | bringDown(); | 382 | bringDown(); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | void OTDriver::bringUp() { | 386 | void OTDriver::bringUp() { |
387 | 387 | ||
388 | owarn << "bringUp : " << Dev << oendl; | 388 | odebug << "bringUp : " << Dev << oendl; |
389 | 389 | ||
390 | if( ! open() ) { | 390 | if( ! open() ) { |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (! isUp()) { | 394 | if (! isUp()) { |
395 | if( ioctl(fd(), HCIDEVUP, devId()) < 0 ) { | 395 | if( ioctl(fd(), HCIDEVUP, devId()) < 0 ) { |
396 | if( errno != EALREADY ) { | 396 | if( errno != EALREADY ) { |
397 | emit error( tr( "Cannot bring interface %1 up. %2 : %3" ). | 397 | emit error( tr( "Cannot bring interface %1 up. %2 : %3" ). |
398 | arg( devname() ). | 398 | arg( devname() ). |
399 | arg( errno ). | 399 | arg( errno ). |
400 | arg( strerror(errno) ) ); | 400 | arg( strerror(errno) ) ); |
401 | } | 401 | } |
402 | return; | 402 | return; |
403 | } | 403 | } |
404 | // have to wait a bit for the 'up' to become active | 404 | // have to wait a bit for the 'up' to become active |
405 | QTimer::singleShot( 3000, this, SLOT( reinit() ) ); | 405 | QTimer::singleShot( 3000, this, SLOT( reinit() ) ); |
406 | } | 406 | } |
407 | } | 407 | } |
408 | 408 | ||
409 | void OTDriver::bringDown() { | 409 | void OTDriver::bringDown() { |
410 | 410 | ||
411 | owarn << "bringDown : " << Dev << oendl; | 411 | odebug << "bringDown : " << Dev << oendl; |
412 | 412 | ||
413 | if( ! open() ) { | 413 | if( ! open() ) { |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | 416 | ||
417 | if ( isUp() ) { | 417 | if ( isUp() ) { |
418 | if( ioctl(fd(), HCIDEVDOWN, devId()) < 0 ) { | 418 | if( ioctl(fd(), HCIDEVDOWN, devId()) < 0 ) { |
419 | if( errno != EALREADY ) { | 419 | if( errno != EALREADY ) { |
420 | emit error( tr( "Cannot bring interface %1 down. %2 : %3" ). | 420 | emit error( tr( "Cannot bring interface %1 down. %2 : %3" ). |
421 | arg( devname() ). | 421 | arg( devname() ). |
422 | arg( errno ). | 422 | arg( errno ). |
423 | arg( strerror(errno) ) ); | 423 | arg( strerror(errno) ) ); |
@@ -652,33 +652,33 @@ QString OTDriver::strType() { | |||
652 | } | 652 | } |
653 | 653 | ||
654 | void OTDriver::setFeatures( unsigned char * _f) { | 654 | void OTDriver::setFeatures( unsigned char * _f) { |
655 | Features = lmp_featurestostr(_f, NULL, 255); | 655 | Features = lmp_featurestostr(_f, NULL, 255); |
656 | } | 656 | } |
657 | 657 | ||
658 | void OTDriver::setManufacturer(int compid) { | 658 | void OTDriver::setManufacturer(int compid) { |
659 | Manufacturer = bt_compidtostr(compid); | 659 | Manufacturer = bt_compidtostr(compid); |
660 | } | 660 | } |
661 | 661 | ||
662 | OTHCISocket * OTDriver::openSocket( void ) { | 662 | OTHCISocket * OTDriver::openSocket( void ) { |
663 | if( ! Socket ) { | 663 | if( ! Socket ) { |
664 | owarn << "Open HCI socket to " << devname() << oendl; | 664 | odebug << "Open HCI socket to " << devname() << oendl; |
665 | Socket = new OTHCISocket( this ); | 665 | Socket = new OTHCISocket( this ); |
666 | } | 666 | } |
667 | return Socket; | 667 | return Socket; |
668 | } | 668 | } |
669 | 669 | ||
670 | void OTDriver::closeSocket( void ) { | 670 | void OTDriver::closeSocket( void ) { |
671 | if( Socket ) { | 671 | if( Socket ) { |
672 | owarn << "Close HCI socket to " << devname() << oendl; | 672 | odebug << "Close HCI socket to " << devname() << oendl; |
673 | delete Socket; | 673 | delete Socket; |
674 | Socket = 0; | 674 | Socket = 0; |
675 | } | 675 | } |
676 | } | 676 | } |
677 | 677 | ||
678 | QString OTDriver::getPeerName( const OTDeviceAddress & PAddr ) { | 678 | QString OTDriver::getPeerName( const OTDeviceAddress & PAddr ) { |
679 | QString S; | 679 | QString S; |
680 | char name[100 ]; | 680 | char name[100 ]; |
681 | 681 | ||
682 | if( ! open() ) { | 682 | if( ! open() ) { |
683 | return QString("N/A"); | 683 | return QString("N/A"); |
684 | } | 684 | } |
@@ -704,41 +704,41 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) { | |||
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | cr = (struct hci_conn_info_req *)malloc( | 707 | cr = (struct hci_conn_info_req *)malloc( |
708 | sizeof(*cr) + sizeof(struct hci_conn_info)); | 708 | sizeof(*cr) + sizeof(struct hci_conn_info)); |
709 | if (!cr) | 709 | if (!cr) |
710 | return 0; | 710 | return 0; |
711 | 711 | ||
712 | bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) ); | 712 | bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) ); |
713 | cr->type = ACL_LINK; | 713 | cr->type = ACL_LINK; |
714 | 714 | ||
715 | if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) { | 715 | if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) { |
716 | owarn << "Get connection info failed" << oendl; | 716 | odebug << "Get connection info failed" << oendl; |
717 | free(cr); | 717 | free(cr); |
718 | return 0; | 718 | return 0; |
719 | } | 719 | } |
720 | 720 | ||
721 | handle = htobs(cr->conn_info->handle); | 721 | handle = htobs(cr->conn_info->handle); |
722 | 722 | ||
723 | free(cr); | 723 | free(cr); |
724 | 724 | ||
725 | memset(&rq, 0, sizeof(rq)); | 725 | memset(&rq, 0, sizeof(rq)); |
726 | rq.ogf = OGF_STATUS_PARAM; | 726 | rq.ogf = OGF_STATUS_PARAM; |
727 | rq.ocf = OCF_READ_RSSI; | 727 | rq.ocf = OCF_READ_RSSI; |
728 | rq.cparam = &handle; | 728 | rq.cparam = &handle; |
729 | rq.clen = 2; | 729 | rq.clen = 2; |
730 | rq.rparam = &rp; | 730 | rq.rparam = &rp; |
731 | rq.rlen = GET_LINK_QUALITY_RP_SIZE; | 731 | rq.rlen = GET_LINK_QUALITY_RP_SIZE; |
732 | 732 | ||
733 | if (hci_send_req( fd(), &rq, 100) < 0) { | 733 | if (hci_send_req( fd(), &rq, 100) < 0) { |
734 | owarn << "Get connection info failed" << oendl; | 734 | odebug << "Get connection info failed" << oendl; |
735 | return 0; | 735 | return 0; |
736 | } | 736 | } |
737 | 737 | ||
738 | if( rp.status ) { | 738 | if( rp.status ) { |
739 | owarn << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; | 739 | odebug << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; |
740 | return 0; | 740 | return 0; |
741 | } | 741 | } |
742 | 742 | ||
743 | return rp.rssi+50; | 743 | return rp.rssi+50; |
744 | } | 744 | } |