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
Developer
Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None
Accepted Solution

netstatus example

Again, I am playing around with the netstatus example.  I am continuing with trying to access the interface details using:

 

typedef struct netstatus_interface_details_t netstatus_interface_details_t;

 

and this

 

int netstatus_get_interface_details(const char *interface, netstatus_interface_details_t **details);

 

When I try to allocate the structure on the stack I get the following error:

 

netstatus_interface_details_t details[10];  // error: array type has incomplete element type

 

What am I missing?

 

Something like this 

 

struct TestStruct
{
char a[20];
int b;
};

typedef struct TestStruct TestStruct;

TestStruct Array[10];

 

compiles fine with gcc


 

Aside: I just chose 10 because it is bigger than the number of interfaces found previously.

Highlighted
Retired
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: netstatus example

netstatus_interface_details_t is an opaque struct.  Its contents are not declared in the header file so the compiler doesn't know its size.  You use it like:

 

    netstatus_interface_details_t* details;
    int rc = netstatus_get_interface_details(interface, &details);
    if (rc != BPS_SUCCESS) {

        /* handle error */
    } else {

        /* use getter functions on the details struct e.g. */

        const char * name = netstatus_interface_get_name(details);

        /* free it when done */

        netstatus_free_interface_details(&details);

    }

 

Its defined this way so that adding additional members to the interface details doesn't break backwards compatibility.  netstatus_interface_list_t behaves differently because we don't see it changing in the future.

 


Developer
Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None

Re: netstatus example

Thank you very much.