Skip to content

Commit

Permalink
Merge pull request #11 from telit/feature/sockets-binary
Browse files Browse the repository at this point in the history
add SMS and socket binary data
  • Loading branch information
fabiopi-tlt authored Sep 27, 2021
2 parents 9bb8557 + a7d8152 commit 466b796
Show file tree
Hide file tree
Showing 24 changed files with 2,042 additions and 1,369 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ME310 0.0.0 - ????.??.??

ME310 2.4.0 - 2021.09.27
* Add SMS management in AT commands
* Add binary mode improvements for sockets data

ME310 2.3.0 - 2021.08.11
* Added Calling Line Identification Presentation management (CLIP)

ME310 2.2.0 - 2021.07.29

* URC wait method added
* Added URC management improvements in LwM2M code

ME310 2.1.0 - 2021.07.26

* Added MQTT and LWM2M AT commands coverage with example sketches

ME310 2.0.0 - 2021.05.06

* Added support to more AT commands and the command/online modes

ME310 1.0.1 - 2021.03.24

* Improved namespace naming convention and some AT commands management

ME310 1.0.0 - 2021.02.04

* Initial release
53 changes: 24 additions & 29 deletions examples/AGNSS_example/AGNSS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
Sample test of the use of AT commands via ME310 library
@details
In this example sketch, the use of methods offered by the ME310 library for using AT commands is shown.
In this example sketch, it is shown how to use AGNSS management, using ME310 library.\n
AGNSS is enable, GNSS configuration, GNSS controller power management, GNSS nmea configuration functions are shown.\n
GPS positions are acquired and response is printed.
@version
1.0.0
Expand All @@ -31,31 +34,23 @@
/*When NMEA_DEBUG is 0 Unsolicited NMEA is disable*/
#define NMEA_DEBUG 0

using namespace me310;
#ifndef ARDUINO_TELIT_SAMD_CHARLIE
#define ON_OFF 6 /*Select the GPIO to control ON_OFF*/
#endif

using namespace me310;
/*
* If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n
* Please refer to your board configuration in variant.h file.
* Example:
* Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS);
* ME310 myME310 (Serial1);
*/
ME310 myME310;

ME310::return_t rc;
int count = 0;

void turnOnModule (){
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(500);

while(myME310.attention() == ME310::RETURN_TOUT)
{
digitalWrite(ON_OFF, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
delay(6000);
digitalWrite(ON_OFF, LOW);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
}


void setup() {
pinMode(ON_OFF, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
Expand All @@ -64,7 +59,7 @@ void setup() {
Serial.begin(115200);
myME310.begin(115200);
delay(1000);
turnOnModule();
myME310.powerOn(ON_OFF);
delay(5000);
Serial.println("Telit Test AT GNSS command");
Serial.println("ME310 ON");
Expand Down Expand Up @@ -98,7 +93,7 @@ void setup() {

if (rc == ME310::RETURN_VALID)
{
myME310.module_reboot(); //issue command AT#REBOOT
myME310.module_reboot(); //issue command AT#REBOOT
Serial.println(myME310.buffer_cstr(1));
}

Expand All @@ -117,7 +112,7 @@ void setup() {
Serial.println(ME310::return_string(rc));
if (rc == ME310::RETURN_VALID)
{
myME310.module_reboot(); //issue command AT#REBOOT
myME310.module_reboot(); //issue command AT#REBOOT
Serial.println(myME310.buffer_cstr(1));
}
delay(5000);
Expand All @@ -132,12 +127,12 @@ void setup() {
Serial.println(ME310::return_string(rc));
if (rc == ME310::RETURN_VALID)
{
myME310.module_reboot(); //issue command AT#REBOOT
myME310.module_reboot(); //issue command AT#REBOOT
Serial.println(myME310.buffer_cstr(1));
}
delay(5000);


/////////////////////////////////////
// Set on/off GNSS controller
// AT$GPSP=<status>
Expand Down Expand Up @@ -176,7 +171,7 @@ void setup() {
// Set the real-time clock of the module.
// AT+CCLK="05/07/21,12:40:00+00"
/////////////////////////////////////
Serial.println("Set the real-time clock of the module.");
Serial.println("Set the real-time clock of the module.");
rc = myME310.clock_management("05/07/21,12:40:00+00");
Serial.println(ME310::return_string(rc));

Expand All @@ -196,7 +191,7 @@ void setup() {
// Read command returns the requested and the active status for each agnss provider.
// $AGNSS: <provider>,<active>,<requested>
// Request value is 0 to disable or 1 to enable
/////////////////////////////////////
/////////////////////////////////////
myME310.read_gnss_set_agnss_enable();
Serial.println(myME310.buffer_cstr(1));
}
Expand Down Expand Up @@ -226,7 +221,7 @@ void loop() {
int len = tmp_pos.copy(valid_pos, ((len_pos2-1)-len_pos), len_pos+1);
if(len > 2)
{
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
delay(6000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
Expand Down
3 changes: 1 addition & 2 deletions examples/Bosch_sensor_example/Bosch_sensor_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
#include <BMA400.h>

float x = 0, y = 0, z = 0;
float xACC = 0, yACC = 0, zACC = 0;
float xACC = 0, yACC = 0, zACC = 0;
int16_t temperature = 0;
uint8_t idDev = 0;

void setup() {

Wire.begin();
Serial.begin(115200);
delay(1000);
Expand Down
131 changes: 131 additions & 0 deletions examples/CLIP_example/CLIP_example.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */

/**
@file
ME310.cpp
string.h
stdio.h
@brief
Sample test of the use of AT+CLIP command via ME310 library
@details
In this example sketch, the use of methods offered by the ME310 library for using AT commands is shown.\n
The Calling line identify is enable and wait_for_unsolicited is call in loop part. The response is printed with buffer_cstr_raw.\n
To use this example is necessary a voice variant firmware and a SIM card that supports voice.
@version
1.0.0
@note
@author
Cristina Desogus
@date
11/08/2021
*/

#include <ME310.h>
#include <string.h>

#define APN "APN"

#ifndef ARDUINO_TELIT_SAMD_CHARLIE
#define ON_OFF 6 /*Select the GPIO to control ON_OFF*/
#endif

using namespace me310;
/*
* If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n
* Please refer to your board configuration in variant.h file.
* Example:
* Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS);
* ME310 myME310 (Serial1);
*/
ME310 myME310;
ME310::return_t rc; //Enum of return value methods

int cID = 1; //PDP Context Identifier
char ipProt[] = "IP"; //Packet Data Protocol type
bool flag;


void setup() {

pinMode(ON_OFF, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(ON_OFF, LOW);

Serial.begin(115200);
myME310.begin(115200);

delay(2000);
Serial.println("Telit Test AT CLIP command");
myME310.powerOn(ON_OFF);
Serial.println("ME310 ON");
delay(2000);
Serial.println("AT Command");
myME310.report_mobile_equipment_error(2); //issue command AT+CMEE=2 and wait for answer or timeout
rc = myME310.read_enter_pin(); //issue command AT+cpin? in read mode, check that the SIM is inserted and the module is not waiting for the PIN
if(strcmp(myME310.buffer_cstr(2), "OK") == 0) // read response in 2 array position
{
delay(2000);
Serial.println("Define PDP Context");
rc = myME310.define_pdp_context(cID, ipProt, APN); //issue command AT+CGDCONT=cid,PDP_type,APN
if(rc == ME310::RETURN_VALID)
{
myME310.read_define_pdp_context(); //issue command AT+CGDCONT=? (read mode)
Serial.print("pdp context read :");
Serial.println(myME310.buffer_cstr(1)); //print second line of modem answer

Serial.print("gprs network registration status :");
rc = myME310.read_gprs_network_registration_status(); //issue command AT+CGREG? (read mode)
Serial.println(myME310.buffer_cstr(1));
if(rc == ME310::RETURN_VALID)
{
while ((strcmp(myME310.buffer_cstr(1), "+CGREG: 0,1") != 0) && (strcmp(myME310.buffer_cstr(1), "+CGREG: 0,5") != 0))
{
delay(3000);
myME310.read_gprs_network_registration_status();
Serial.println(myME310.buffer_cstr(1));
}
}
Serial.println("Activate context");
myME310.context_activation(cID, 1); //issue command AT#SGACT=cid,state and wait for answer or timeout

rc = myME310.calling_line_identification_presentation(1); //issue command AT+CLIP=enable and wait for answer or timeout
Serial.println(rc);
if(rc == ME310::RETURN_VALID)
{
Serial.println("Calling Line Identity is enable");
flag = true;
}
else
{
Serial.println((String)"Error: " + rc + " Error string: " + myME310.buffer_cstr(2));
flag = false;
}
}
}
else
{
Serial.println((String)"Error: " + rc + " Error string: " + myME310.buffer_cstr(2));
}
}

void loop() {

if(flag)
{
myME310.wait_for_unsolicited(ME310::TOUT_5SEC);
Serial.println(myME310.buffer_cstr_raw());
delay(1000);
}
else
{
Serial.println("Calling Line Identity is not enable");
exit(0);
}
}
67 changes: 40 additions & 27 deletions examples/CheckModule/CheckModule.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */

/**
@file
ME310.cpp
string.h
stdio.h
@brief
Sample test of the use of AT commands via ME310 library
@details
In this example sketch, it is shown how to use a basic AT commands via ME310 library.\n
@version
1.0.0
@note
@author
@date
20/10/2020
*/

#include <ME310.h>

/*
Expand All @@ -7,36 +34,23 @@
#define PAD_MODULE_TX UART_TX_PAD_0
#define PAD_MODULE_RX SERCOM_RX_PAD_1
#define PIN_MODULE_RTS 30
#define PIN_MODULE_CTS 31
#define PIN_MODULE_CTS 31
*/

#define ON_OFF 27
Uart SerialModule(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS);
#ifndef ARDUINO_TELIT_SAMD_CHARLIE
#define ON_OFF 6 /*Select the right GPIO to control ON_OFF*/
#endif

ME310 myME310 (SerialModule);
*/
using namespace me310;

/*
* If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n
* Please refer to your board configuration in variant.h file.
* Example:
* Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS);
* ME310 myME310 (Serial1);
*/
ME310 myME310;

void turnOnModule (){
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(500);

while(myME310.attention() == ME310::RETURN_TOUT)
{
digitalWrite(ON_OFF, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
delay(6000);
digitalWrite(ON_OFF, LOW);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
}

void setup() {
pinMode(ON_OFF, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
Expand All @@ -45,8 +59,7 @@ void setup() {
myME310.begin(115200);

delay(1000);

turnOnModule;
myME310.powerOn(ON_OFF);
}

void loop() {
Expand Down
Loading

0 comments on commit 466b796

Please sign in to comment.