summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/opietooth2/OTDriver.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTDriver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDriver.cpp16
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
@@ -129,49 +129,49 @@ static ClassMap_t MapPeripheralClass[] = {
typedef struct {
int Major;
ClassMap_t * Map;
} MainClassMap_t;
static MainClassMap_t MainClasses[] = {
{ 0, MapMiscClass },
{ 1, MapComputerClass },
{ 2, MapPhoneClass },
{ 3, 0 }, // special case
{ 4, MapAVClass },
{ 5, MapPeripheralClass },
{ 6, 0 }, // special case
{ 63, MapUnclassifiedClass },
{ -1, 0 }
};
OTDriver::OTDriver( OTGateway * _OT, struct hci_dev_info* di) : QObject( _OT ), Address() {
OT = _OT;
IsUp = 0;
Socket = 0;
init(di);
- owarn << "Driver " << devname() << oendl;
+ odebug << "Driver " << devname() << oendl;
AutoClose = new QTimer( this );
connect( AutoClose,
SIGNAL( timeout() ),
this,
SLOT( SLOT_CloseFd() )
);
}
OTDriver::~OTDriver() {
closeSocket();
SLOT_CloseFd();
}
void OTDriver::SLOT_CloseFd( void ){
if ( isOpen() ) {
AutoClose->stop();
::close( fd() );
setfd( -1 );
}
}
void OTDriver::init(struct hci_dev_info* di) {
@@ -364,72 +364,72 @@ int OTDriver::reset() {
if( ioctl(fd(), HCIDEVRESET, devId()) < 0 ) {
if( errno != EALREADY ) {
emit error( tr( "Reset failed for %1. %2 : %3" ).
arg( devname() ).
arg( errno ).
arg( strerror(errno) ) );
if (errno == EACCES) {
return EACCES;
}
}
}
return 0;
}
void OTDriver::setUp( bool M ) {
if( M && ! isUp() ) {
bringUp();
} else if( ! M && isUp() ) {
bringDown();
}
}
void OTDriver::bringUp() {
- owarn << "bringUp : " << Dev << oendl;
+ odebug << "bringUp : " << Dev << oendl;
if( ! open() ) {
return;
}
if (! isUp()) {
if( ioctl(fd(), HCIDEVUP, devId()) < 0 ) {
if( errno != EALREADY ) {
emit error( tr( "Cannot bring interface %1 up. %2 : %3" ).
arg( devname() ).
arg( errno ).
arg( strerror(errno) ) );
}
return;
}
// have to wait a bit for the 'up' to become active
QTimer::singleShot( 3000, this, SLOT( reinit() ) );
}
}
void OTDriver::bringDown() {
- owarn << "bringDown : " << Dev << oendl;
+ odebug << "bringDown : " << Dev << oendl;
if( ! open() ) {
return;
}
if ( isUp() ) {
if( ioctl(fd(), HCIDEVDOWN, devId()) < 0 ) {
if( errno != EALREADY ) {
emit error( tr( "Cannot bring interface %1 down. %2 : %3" ).
arg( devname() ).
arg( errno ).
arg( strerror(errno) ) );
}
return;
}
reinit();
}
}
void OTDriver::setScanMode(bool iscan, bool pscan) {
struct hci_dev_req dr;
if( ! open() ) {
@@ -640,105 +640,105 @@ void OTDriver::getClass( QString & service,
break;
}
MCM ++;
}
if( MCM->Major == -1 ) {
device = "Unknown (reserved) minor device class";
}
}
QString OTDriver::strType() {
return QString( hci_dtypetostr(Type) );
}
void OTDriver::setFeatures( unsigned char * _f) {
Features = lmp_featurestostr(_f, NULL, 255);
}
void OTDriver::setManufacturer(int compid) {
Manufacturer = bt_compidtostr(compid);
}
OTHCISocket * OTDriver::openSocket( void ) {
if( ! Socket ) {
- owarn << "Open HCI socket to " << devname() << oendl;
+ odebug << "Open HCI socket to " << devname() << oendl;
Socket = new OTHCISocket( this );
}
return Socket;
}
void OTDriver::closeSocket( void ) {
if( Socket ) {
- owarn << "Close HCI socket to " << devname() << oendl;
+ odebug << "Close HCI socket to " << devname() << oendl;
delete Socket;
Socket = 0;
}
}
QString OTDriver::getPeerName( const OTDeviceAddress & PAddr ) {
QString S;
char name[100 ];
if( ! open() ) {
return QString("N/A");
}
if( hci_read_remote_name( fd(),
&(PAddr.getBDAddr()),
sizeof(name),
name,
100000 ) < 0 ) {
return QString( "N/A" );
}
return QString( name );
}
long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) {
struct hci_conn_info_req *cr;
struct hci_request rq;
read_rssi_rp rp;
uint16_t handle;
if( ! open() ) {
return 0;
}
cr = (struct hci_conn_info_req *)malloc(
sizeof(*cr) + sizeof(struct hci_conn_info));
if (!cr)
return 0;
bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) );
cr->type = ACL_LINK;
if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) {
- owarn << "Get connection info failed" << oendl;
+ odebug << "Get connection info failed" << oendl;
free(cr);
return 0;
}
handle = htobs(cr->conn_info->handle);
free(cr);
memset(&rq, 0, sizeof(rq));
rq.ogf = OGF_STATUS_PARAM;
rq.ocf = OCF_READ_RSSI;
rq.cparam = &handle;
rq.clen = 2;
rq.rparam = &rp;
rq.rlen = GET_LINK_QUALITY_RP_SIZE;
if (hci_send_req( fd(), &rq, 100) < 0) {
- owarn << "Get connection info failed" << oendl;
+ odebug << "Get connection info failed" << oendl;
return 0;
}
if( rp.status ) {
- owarn << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl;
+ odebug << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl;
return 0;
}
return rp.rssi+50;
}