Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There should be a way to check attachment status #128

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// Define the repository information in these attributes
:repository-owner: arduino-libraries
:repository-name: MKRNB
:repository-owner: marcus-peterson
:repository-name: MKRNB_v2

= {repository-name} Library for Arduino =
= MKRNB_v2 Library for Arduino =

image:https://github.com/{repository-owner}/{repository-name}/workflows/Compile%20Examples/badge.svg["Compile Examples Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Compile+Examples"]
image:https://github.com/{repository-owner}/{repository-name}/workflows/Spell%20Check/badge.svg["Spell Check Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Spell+Check"]
image:https://github.com/marcus-peterson/MKRNB_v2/workflows/Compile%20Examples/badge.svg["Compile Examples Status", link="https://github.com/marcus-peterson/MKRNB_v2/actions?workflow=Compile+Examples"]
image:https://github.com/marcus-peterson/MKRNB_v2/workflows/Spell%20Check/badge.svg["Spell Check Status", link="https://github.com/marcus-peterson/MKRNB_v2/actions?workflow=Spell+Check"]

This library enables an Arduino MKR NB 1500 board to connect to the internet over a NarrowBand IoT or LTE Cat M1 network.
This library enables an Arduino MKR NB 1500 board to connect to the internet over a NarrowBand IoT or LTE Cat M1 network. It is an extension of the original MKRNB library, designed to provide enhanced control and capabilities for commercial applications.

For more information about this library please visit us at
https://www.arduino.cc/en/Reference/{repository-name}
For more information about the source of this library please visit the official Arduino MKRNB documentation
https://www.arduino.cc/en/Reference/MKRNB
Comment on lines -1 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the changes made here would be good to make in your own "hard fork" of the library, they would be harmful to Arduino's repository if introduced by the merge of this pull request. Please revert these changes.

Note that the best workflow for pull requests from a fork is to create a dedicated branch in the fork repository in which to stage the changes made in the pull request. You submitted this pull request from the master branch of your fork and any commit you push to the master branch becomes part of the changeset of this pull request.


== License ==

Expand Down
31 changes: 31 additions & 0 deletions src/GPRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,37 @@ int GPRS::ready()
return ready;
}

//Check to see if the sim card that is inside the MKRNB is attached or detached to a LTE-M provideer
NB_NetworkStatus_t GPRS::checkAttachmentStatus()
{
MODEM.setResponseDataStorage(&_response);
MODEM.send("AT+CGATT?");
_state = GPRS_STATE_WAIT_CHECK_ATTACHED_RESPONSE;

int ready = 0;

while (ready == 0) {
ready = MODEM.ready();

if (ready > 1) {
_state = GPRS_STATE_IDLE;
_status = NB_ERROR;
break;
}

delay(500);
}

if (_response.indexOf("1,1") >= 0) {
_state = GPRS_STATE_IDLE;
return GPRS_READY;
} else {
_state = GPRS_STATE_IDLE;
return IDLE;
}
}


IPAddress GPRS::getIPAddress()
{
String response;
Expand Down
2 changes: 2 additions & 0 deletions src/GPRS.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class GPRS {
*/
NB_NetworkStatus_t detachGPRS(bool synchronous = true);

NB_NetworkStatus_t checkAttachmentStatus();

/** Get actual assigned IP address in IPAddress format
@return IP address in IPAddress format
*/
Expand Down