Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTGateway.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTGateway.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp index 1b61a2e..7fc8719 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp @@ -41,51 +41,51 @@ void OTGateway::releaseOTGateway( void ) { } // open bluetooth system OTGateway::OTGateway( void ) : QObject( 0, "OTGateway" ), AllDrivers( this ), AllPeers() { ErrorConnectCount = 0; TheOTDevice = 0; Scanning = 0; AllPeersModified = 0; AllPeers.setAutoDelete( TRUE ); if ( ( HciCtl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0) { SLOT_ShowError( tr( "error opening hci socket" ) ); return; } // load all known devices updateDrivers(); // load all peers we have ever seen loadKnownPeers(); - // iterate over drivers and find active connections + // iterate over drivers and find active NetworkSetups // adding/updating peers - loadActiveConnections(); + loadActiveNetworkSetups(); // check every 4 seconds the state of BT timerEvent(0); RefreshTimer = -1; setRefreshTimer( 4000 ); // load known link keys readLinkKeys(); } // close bluetooth system OTGateway::~OTGateway( void ) { if( AllPeersModified ) { saveKnownPeers(); } if( Scanning ) delete Scanning; if( TheOTDevice ) delete TheOTDevice; if( HciCtl >= 0 ) { @@ -354,75 +354,75 @@ void OTGateway::SLOT_FinishedDetecting() { const char * OTGateway::deviceTypeToName( int cls ) { switch ( (cls & 0x001F00) >> 8) { case 0x00: return "misc"; case 0x01: return "computer"; case 0x02: return "phone"; case 0x03: return "lan"; case 0x04: return "av"; case 0x05: return "peripheral"; case 0x06: return "imaging"; case 0x07: default : break; } return "unknown"; } -PANConnectionVector OTGateway::getPANConnections( void ) { - PANConnectionVector V; +PANNetworkSetupVector OTGateway::getPANNetworkSetups( void ) { + PANNetworkSetupVector V; struct bnep_connlist_req req; struct bnep_conninfo ci[48]; V.setAutoDelete(TRUE); int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); if (ctl < 0) { odebug << "Failed to open control socket" << oendl; return V; } req.cnum = 48; req.ci = ci; if (ioctl(ctl, BNEPGETCONNLIST, &req)) { - odebug << "Failed to get connection list" << oendl; + odebug << "Failed to get NetworkSetup list" << oendl; ::close( ctl ); return V; } for ( unsigned i=0; i < req.cnum; i++) { V.resize( V.size() + 1 ); if( ci[i].role == BNEP_SVC_PANU ) { // we are the client - V.insert( V.size()-1, new OTPANConnection( + V.insert( V.size()-1, new OTPANNetworkSetup( ci[i].device, batostr((bdaddr_t *) ci[i].dst) ) ); } } ::close( ctl ); return V; } struct link_key { bdaddr_t sba; bdaddr_t dba; uint8_t key[16]; uint8_t type; time_t time; }; void OTGateway::readLinkKeys( void ) { struct link_key k; int rv; AllKeys.truncate(0); @@ -489,77 +489,77 @@ bool OTGateway::removeLinkKey( unsigned int Index ) { // rename files QDir D( "/etc/bluetooth" ); D.remove( "link_key" ); D.rename( "newlink_key", "link_key" ); // restart hcid system( "/etc/init.d/hcid stop" ); system( "/etc/init.d/hcid start" ); // remove from table if( Index < (AllKeys.size()-1) ) { // collapse array AllKeys[Index] = AllKeys[AllKeys.size()-1]; } // remove last element AllKeys.resize( AllKeys.size()-1 ); return 1; } #define MAXCONNECTIONS 10 -void OTGateway::loadActiveConnections( void ) { +void OTGateway::loadActiveNetworkSetups( void ) { struct hci_conn_list_req *cl; struct hci_conn_info *ci; OTDeviceAddress Addr; OTPeer * P; if (!(cl = (struct hci_conn_list_req *)malloc( MAXCONNECTIONS * sizeof(*ci) + sizeof(*cl)))) { emit error( tr("Can't allocate memory") ); return; } memset( cl, 0, MAXCONNECTIONS * sizeof(*ci) + sizeof(*cl) ); for( unsigned int i = 0; i < AllDrivers.count(); i ++ ) { if( ! AllDrivers[i]->isUp() ) { continue; } - // driver is up -> check connections + // driver is up -> check NetworkSetups cl->dev_id = AllDrivers[i]->devId(); cl->conn_num = MAXCONNECTIONS; ci = cl->conn_info; if (ioctl( getSocket(), HCIGETCONNLIST, (void *) cl)) { - emit error( tr("Can't get connection list") ); + emit error( tr("Can't get NetworkSetup list") ); break; } for ( int k = 0; k < cl->conn_num; k++, ci++) { if( ci->state != BT_CONNECTED ) { // not yet connected continue; } Addr.setBDAddr( ci->bdaddr ); P = findPeer( Addr ); if( ! P ) { // peer not yet known -> add P = new OTPeer( this ); addPeer( P ); P->setAddress( Addr ); // infoQueue.push_back(info); P->setName( AllDrivers[i]->getPeerName( Addr ) ); } P->setState( OTPeer::Peer_Up ); P->setConnectedTo( AllDrivers[i] ); } } @@ -732,43 +732,43 @@ int OTGateway::releaseRFCommDevice( int devnr ) { emit error( tr("Can't open RFCOMM control socket") ); return 0; } // get all rfcomm devices { struct rfcomm_dev_list_req *dl; struct rfcomm_dev_info *di, *dr; int i; dl = (struct rfcomm_dev_list_req *)alloca( sizeof(*dl) + RFCOMM_MAX_DEV * sizeof(*di)); memset( dl, 0, sizeof(*dl) + RFCOMM_MAX_DEV * sizeof(*di) ); dl->dev_num = RFCOMM_MAX_DEV; di = dl->dev_info; if( ::ioctl(s, RFCOMMGETDEVLIST, (void *) dl) < 0) { emit error( tr("Can't get device list") ); ::close( s ); return 0; } dr = di; for (i = 0; i < dl->dev_num; i++, dr++) { if( dr->id == devnr ) { - // still in connection list + // still in NetworkSetup list struct rfcomm_dev_req req; int err; memset(&req, 0, sizeof(req)); req.dev_id = devnr; if ((err = ioctl(s, RFCOMMRELEASEDEV, &req)) < 0 ) { return err; } return 0; } } } // no device -> nothing to release eiterh return 0; } |