Skip to content

Commit

Permalink
Merge pull request #1 from telit/fix/commands
Browse files Browse the repository at this point in the history
fix some AT commands wrappers
  • Loading branch information
fabiopi-tlt authored Mar 24, 2021
2 parents 0d8c43f + 9b671da commit dce2b88
Show file tree
Hide file tree
Showing 6 changed files with 432 additions and 411 deletions.
5 changes: 3 additions & 2 deletions examples/CheckModule/CheckModule.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
ME310 myME310 (SerialModule);
*/

using namespace me310;

ME310 myME310;

void turnOnModule (){
Expand All @@ -25,7 +26,7 @@ void turnOnModule (){
digitalWrite(LED_BUILTIN, LOW);
delay(500);

while(myME310.attention() == ME310::RETURN_TOUT)
while(myME310.attention() == RETURN_TOUT)
{
digitalWrite(ON_OFF, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
Expand Down
50 changes: 25 additions & 25 deletions examples/ME310_AT_Test/ME310_AT_Test.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */

/**
Expand All @@ -15,12 +15,11 @@
It makes it easy to build Arduino applications that use the full power of ME310 module
@version
1.0.0
1.0.1
@note
@author
BlackIoT Sagl
@date
28/10/2020
Expand All @@ -44,7 +43,8 @@
ME310 myME310 (SerialModule);
*/

using namespace me310;

ME310 myME310;

void print_buffer(ME310 &aME310, const char *term = "OK");
Expand All @@ -55,7 +55,7 @@ void turnOnModule (){
digitalWrite(LED_BUILTIN, LOW);
delay(500);

while(myME310.attention() == ME310::RETURN_TOUT)
while(myME310.attention() == RETURN_TOUT)
{
digitalWrite(ON_OFF, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
Expand Down Expand Up @@ -83,25 +83,25 @@ void setup() {

Serial.println();
Serial.println("AT Command");
ME310::return_t rc = myME310.attention(); // issue command and wait for answer or timeout
return_t rc = myME310.attention(); // issue command and wait for answer or timeout
Serial.println(myME310.buffer_cstr()); // print first line of modem answer
Serial.print(ME310::return_string(rc)); // print return value
Serial.println(" answer from ME310 MODULE");
if(rc != ME310::RETURN_VALID) // exit on error
Serial.println(" answer from ME310G1 MODULE");
if(rc != RETURN_VALID) // exit on error
return;


Serial.println();
Serial.print("Soft Reset Command : ");
rc = myME310.soft_reset (); // issue command and wait for answer or timeout
Serial.println(ME310::return_string(rc)); // print return value
if(rc != ME310::RETURN_VALID) // exit on error
if(rc != RETURN_VALID) // exit on error
return;

Serial.println();
Serial.println("Display Config Profile : ");
rc = myME310.display_config_profile(); // issue command and wait for answer or timeout
if(rc == ME310::RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
if(rc == RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
print_buffer(myME310);
else return; // exit on error

Expand All @@ -113,15 +113,15 @@ void setup() {
Serial.println();
Serial.println("Read Query SIM Status : ");
rc = myME310.read_query_sim_status();
if(rc == ME310::RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
if(rc == RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
{
Serial.println(myME310.buffer_cstr(1));
if(strstr(myME310.buffer_cstr(1),"#QSS: 0,1"))
{
Serial.println("SIM is inserted");

rc = myME310.read_enter_pin();
if(rc == ME310::RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
if(rc == RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
{
if(strstr(myME310.buffer_cstr(1),"READY"))
Serial.println("PIN not required");
Expand All @@ -133,7 +133,7 @@ void setup() {
Serial.println();
Serial.print("Print ICCID : ");
rc = myME310.read_iccid();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
{
const char *pLabel = strstr(myME310.buffer_cstr(1),"+CCID: ");
if(pLabel)
Expand All @@ -147,14 +147,14 @@ void setup() {

Serial.print("Print IMSI : ");
rc = myME310.imsi(); // no command echo
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.println();
Serial.println("List Capabilities : ");
rc = myME310.capabilities_list();
if(rc == ME310::RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
if(rc == RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
Serial.println(myME310.buffer_cstr(1));
else return;

Expand All @@ -168,62 +168,62 @@ void setup() {
Serial.println();
Serial.print("Manufacturer Identification : ");
rc = myME310.manufacturer_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Model Identification : ");
rc = myME310.model_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Revision Identification : ");
rc = myME310.revision_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Serial Number : ");
rc = myME310.serial_number();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Request Manufacturer Ident. : ");
rc = myME310.request_manufacturer_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Request Model Ident. : ");
rc = myME310.request_model_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Request Revision Ident. : ");
rc = myME310.request_revision_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Product Serial Number : ");
rc = myME310.request_psn_identification();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Product Code : ");
rc = myME310.request_product_code();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.println();
Serial.println("Software Package Version : ");
rc = myME310.request_software_package_version();
if(rc == ME310::RETURN_VALID)
if(rc == RETURN_VALID)
print_buffer(myME310);
else return;

Expand Down
10 changes: 6 additions & 4 deletions examples/TransparentBridge/TransparentBridge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
ME310 myME310 (SerialModule);
*/


using namespace me310;

ME310 myME310;

void turnOnModule (){
Expand All @@ -25,7 +27,7 @@ void turnOnModule (){
digitalWrite(LED_BUILTIN, LOW);
delay(500);

while(myME310.attention() == ME310::RETURN_TOUT)
while(myME310.attention() == RETURN_TOUT)
{
digitalWrite(ON_OFF, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
Expand All @@ -45,9 +47,9 @@ void setup() {
myME310.begin(115200);
delay(1000);

Serial.println("TURN ON ME310");
Serial.println("TURN ON ME310G1");
turnOnModule();
Serial.println("ME310 TURNED ON");
Serial.println("ME310G1 TURNED ON");
Serial.println("Bridge Communication Enabled");

}
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ME310G1
version=1.0.0
version=1.0.1
author=Telit
maintainer=Telit <[email protected]>
sentence=Allows communication with ME310G1 Telit module.
Expand Down
Loading

0 comments on commit dce2b88

Please sign in to comment.