Welcome!

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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
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.

Hi,

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; } } }

 

 

 

Retired
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.