Determining whether Notecard WiFi is connected to WiFi through Notecard API

How could I determine whether a Notecard WiFi is connected to WiFi through the Notecard API?

I was thinking about using a card.wireless request and looking at the status field, but I’m not sure which status codes would indicate this, and whether or not it’s even reliable.

I was also thinking about using a card.wireless request and looking at whether the net field contains a positive value for bars. Would this work?

Hi @yunzheng,

You’re on the right track! You could use the card.wireless API and then check the status field for the code {network-up}. I believe this would be the simplest method to check that it is connected to a network.

Alex

3 Likes

Thank you. Would it also be possible for the status to have the code network-up? I’m wondering if I should also check for that.

Do you mean the response from {“req”:“card.status”}? I don’t believe so; you can check if the Notecard is connected to Notehub but not specifically if it is connected to a WiFi network, only if the WiFi radio is powered on. I can see how this might be confusing!

Let me discuss internally and see how we can potentially clear up the ambiguity with the status responses from card.wireless vs card.status.

Alex

1 Like