Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Regular Contributor
Posts: 63
Registered: ‎08-05-2013
My Device: Blackberry-10 webworks
My Carrier: zcon

Sim card is not present still QNetworkInterface returns true.


I am using QNetworkInterface to get the list of interface. As sim card is not present and wifi is also off still QNetworkInterface returns "bptp0". When I check whether interface is running or IsUp it will return true.

Why QNetworkInterface returns "bptp0" ?

Here is my code:


QList<QString> possibleMatches;
QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
	if ( !ifaces.isEmpty())
	  for(int i=0; i < ifaces.size(); i++)
	    unsigned int flags = ifaces[i].flags();
	    bool isLoopback = (bool)(flags & QNetworkInterface::IsLoopBack);
	    bool isP2P = (bool)(flags & QNetworkInterface::IsPointToPoint);
	    bool isRunning = (bool)(flags & QNetworkInterface::IsRunning);
          // If this interface isn't running, we don't care about it
	    if ( !isRunning ) continue;
      // We only want valid interfaces that aren't loopback/virtual and not point to point
           if ( !ifaces[i].isValid() || isLoopback || isP2P ) continue;
          QList<QHostAddress> addresses = ifaces[i].allAddresses();
	  for(int a=0; a < addresses.size(); a++)
	      // Ignore local host
	     if ( addresses[a] == QHostAddress::LocalHost ) continue;

	      // Ignore non-ipv4 addresses
	      if ( !addresses[a].toIPv4Address() ) continue;

	      QString ip = addresses[a].toString();
	      if ( ip.isEmpty() ) continue;
	      bool foundMatch = false;
for (int j=0; j < possibleMatches.size(); j++) { if ( ip == possibleMatches[j] ) { foundMatch = true; break; } } if ( !foundMatch ) { possibleMatches.push_back( ip );
QString interfaceName=ifaces[i].humanReadableName(); bool isup = (bool)(flags & ifaces[i].IsUp); bool isrun = (bool)(flags & ifaces[i].IsRunning); qDebug()<<"interface "<<interfaceName <<"isup"<< isup<<"isRun"<<isrun; } } }




Posts: 85
Registered: ‎05-25-2012
My Device: Limited Edition Z10
My Carrier: Bell

Re: Sim card is not present still QNetworkInterface returns true.

bptp0 is a virtual peer-2-peer network interface that's used for things like Remote File Access.