Skip to content

Commit

Permalink
Merge pull request #18 from telit/fix/samples
Browse files Browse the repository at this point in the history
mqtt and ftp examples update
  • Loading branch information
fabiopi-tlt authored Nov 24, 2022
2 parents 91756a9 + afa21bf commit c94de00
Show file tree
Hide file tree
Showing 11 changed files with 284 additions and 64 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
ME310 0.0.0 - ????.??.??

ME310 2.12.0 - 2022.11.23
* Fixes in MQTT and FTP examples


ME310 2.11.0 - 2022.11.22
* Added hello world example
* Added sleep example
* Added debug flag in ME310 class

ME310 2.10.0 - 2022.01.31
* Added several lwm2m utility functions
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ The following examples are available:
- **[CLIP_example](examples/CLIP_example/CLIP_example.ino)** : _Shows how to use Calling Line Identifier protocol_
- **[FTP_example](examples/FTP_example/FTP_example.ino)** : _Connects to an FTP server and performs basic operations_
- **[GNSS_example](examples/GNSS_example/GNSS_example.ino)** : _Simple GNSS example, it enables the GNSS receiver and provides raw location data_
- **[Hello_World_example](examples/Hello_World_example/Hello_World_example.ino)** : _Basic Hello World example_
- **[LWM2M_example](examples/LWM2M_example/)** : _uses LwM2M protocol and the accelerometer to send data to the OneEdge portal_
- **[LWM2M_example_2G](examples/LWM2M_example/LWM2M_example_2G/LWM2M_example_2G.ino)** : _example with 2G network_
- **[LWM2M_example_4G](examples/LWM2M_example/LWM2M_example_4G/LWM2M_example_4G.ino)** : _example with 4G network_
- **[LWM2M_first_example](examples/LWM2M_first_example/)** : _uses LwM2M to create a simple connection to OneEdge portal and pushes accelerometer data showing basic resources operations_
- **[LWM2M_Get_Object_example](examples/LWM2M_Get_Object_example/)** : _uses LwM2M GET OBJ functionality to access a whole object with single calls_
- **[M2M_example](examples/M2M_example/M2M_example.ino)** : _Communicates with the modem using the M2M commands to manage the filesystem_
- **[ME310_AT_Test](examples/ME310_AT_Test/ME310_AT_Test.ino)** : _Communicates with the modem and provides info about it (ICCID, IMEI etc.)_
- **[MQTT_example](examples/MQTT_example/MQTT_example.ino)** : _Communicate with a MQTT broker_
- **[Ping_example](examples/Ping_example/Ping_example.ino)** : _Simple example that enables the connectivity and pings a server_
- **[Socket_example](examples/Socket_example/Socket_example.ino)** : _Enables connectivity and uses a TCP socket example communicating with a demo server_
- **[Sleep_mode_example](examples/Sleep_mode_example/Sleep_mode_example.ino)** : _Shows how to configure sleep modes on the board_
- **[TransparentBridge](examples/TransparentBridge/TransparentBridge.ino)** : _Enable the modem and creates a bridge between Arduino serial and modem AT interface, allowing user to send AT commands manually_
- **[GenericCommand_example](examples/GenericCommand_example/GenericCommand_example.ino)** : _Shows how to send AT commands to the modem manually and manage the response (useful for complex AT commands or chains of commands)_

Expand Down
6 changes: 1 addition & 5 deletions examples/FTP_example/FTP_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@version
1.0.0
1.0.1
@note
Expand Down Expand Up @@ -141,10 +141,6 @@ void loop() {
Serial.println(myME310.return_string(rc));
if(rc == ME310::RETURN_VALID)
{
Serial.println("Ftp list in current directory: ");
myME310.ftp_list(ME310::TOUT_10SEC);
Serial.println(myME310.buffer_cstr_raw());

Serial.print("Ftp Change Working Directory: ");
rc = myME310.ftp_change_working_directory("/CristinaDe", ME310::TOUT_10SEC); //issue command AT#FTPCWD=path directory and wait for answer or timeout
Serial.println(myME310.return_string(rc)); //returns a string with return_t codes
Expand Down
37 changes: 37 additions & 0 deletions examples/Hello_World_example/Hello_World_example.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */

/**
@file
@brief
Sample test of the use the Arduino.
@details
In this example sketch, it is shown how to print Hello World.\n
@version
1.0.0
@note
@author
Cristina Desogus
@date
04/20/2022
*/

void setup()
{
Serial.begin(115200);
delay(5000);

Serial.println("Hello World");

}

void loop()
{
exit(0);
}
3 changes: 2 additions & 1 deletion examples/LWM2M_first_example/LWM2M_first_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ This function checks whether or not a particular agent exists.
bool checkExistAgent(String LWM2MEXISTCommand)
{
bool ret = false;
myRc = myME310.send_command(LWM2MEXISTCommand.c_str(), OK_ANSWER); //issue command AT#LWM2MEXIST=agentInstance, objectNumber, objecttInstanceNumber.
const char *answer = OK_ANSWER;
myRc = myME310.send_command(LWM2MEXISTCommand.c_str(), answer); //issue command AT#LWM2MEXIST=agentInstance, objectNumber, objecttInstanceNumber.
String resp = myME310.buffer_cstr(1);
if(resp.endsWith("OK"))
{
Expand Down
44 changes: 22 additions & 22 deletions examples/ME310_AT_Test/ME310_AT_Test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
The library contains a single class that implements a C++ interface to all ME310 AT Commands.
It makes it easy to build Arduino applications that use the full power of ME310 module
@version
@version
1.0.0
@note
@author
Expand All @@ -25,20 +25,20 @@
@date
28/10/2020
*/
#include <ME310.h>

#include <ME310.h>

#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
* 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 (Serial1);
*/
ME310 myME310;
ME310::return_t rc; //Enum of return value methods
Expand All @@ -55,17 +55,17 @@ void setup() {
delay(1000);

Serial.println("SERCOMM Telit Test AT");

myME310.powerOn();

Serial.println("ME310 ON");

Serial.println();
Serial.println("AT Command");
ME310::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");
Serial.println(" answer from ME310 MODULE");
if(rc != ME310::RETURN_VALID) // exit on error
return;

Expand All @@ -75,21 +75,21 @@ void setup() {
Serial.println(ME310::return_string(rc)); // print return value
if(rc != ME310::RETURN_VALID) // exit on error
return;

Serial.println();
Serial.println("Display Config Profile : ");
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)
print_buffer(myME310);
else return; // exit on error

Serial.println();
Serial.print("Query SIM Status : ");
Serial.print("Query SIM Status : ");
myME310.query_sim_status();
Serial.println(myME310.buffer_cstr(1));

Serial.println();
Serial.println("Read Query SIM Status : ");
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)
{
Expand All @@ -100,7 +100,7 @@ void setup() {
if(strstr(resp,"#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)
{
Expand All @@ -113,18 +113,18 @@ void setup() {
Serial.println("PIN required");
}
}
else return;
else return;

Serial.println();
Serial.print("Print ICCID : ");
Serial.print("Print ICCID : ");
rc = myME310.read_iccid();
if(rc == ME310::RETURN_VALID)
{
resp = (char*) myME310.buffer_cstr(1);
if(resp != NULL)
{
const char *pLabel = strstr(resp,"+CCID: ");
if(pLabel)
if(pLabel)
{
Serial.print("[");
Serial.write(pLabel+7,19);
Expand All @@ -145,7 +145,7 @@ void setup() {
rc = myME310.capabilities_list();
if(rc == ME310::RETURN_VALID) // print all rows returned from ME310 except command echo (index = 0)
Serial.println(myME310.buffer_cstr(1));
else return;
else return;

}
else
Expand All @@ -161,7 +161,7 @@ void setup() {
if(rc == ME310::RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;

Serial.print("Model Identification : ");
rc = myME310.model_identification();
if(rc == ME310::RETURN_VALID)
Expand All @@ -178,7 +178,7 @@ void setup() {
rc = myME310.serial_number();
if(rc == ME310::RETURN_VALID)
Serial.println(myME310.buffer_cstr(1));
else return;
else return;

Serial.print("Request Manufacturer Ident. : ");
rc = myME310.request_manufacturer_identification();
Expand Down Expand Up @@ -237,7 +237,7 @@ void print_buffer(ME310 &aME310, const char *term)
for(int index = 1;;index++)
{
const char * tmp = aME310.buffer_cstr(index);
if(tmp)
if(tmp)
{
if(term)
{
Expand Down
Loading

0 comments on commit c94de00

Please sign in to comment.