Skip to content

Commit

Permalink
Merge pull request #4 from telit/feature/GNSS
Browse files Browse the repository at this point in the history
Add TLT GNSS example
  • Loading branch information
fabiopi-tlt authored Oct 14, 2021
2 parents 775266b + c7d51d8 commit b853348
Show file tree
Hide file tree
Showing 22 changed files with 839 additions and 157 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
TLT 0.0.0 - ????.??.??

TLT 1.2.0 - 2021.10.14
* GNSS formatting utilities and example
* file utils improvements and example
* better ME310 device management in sketches

TLT 1.1.0 - 2021.10.08

* Add GNSS class utility
Expand Down
85 changes: 70 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,70 @@
# TLT Library for Arduino

This library allows to use a Telit Charlie board to connect to the Internet over a NBIoT, LTE Cat M1 or 2G network(if fallback is available).

It is a loose porting effort of https://github.com/arduino-libraries/MKRNB Arduino library, providing the same interfaces when possible.

This library requires the ME310 Arduino Library **greater or equal than 2.4.0** version to work.


## Download and install the ME310 Library

Download the ME310 Arduino library from https://github.com/telit/arduino-me310-library, and place the folder in your Arduino libraries folder, or install the new library from the ZIP file.

This Library will simplify the interactions with the ME310G1 Module.

# TLT Library for Arduino

This library allows to use a Telit Charlie board to connect to the Internet over a NBIoT, LTE Cat M1 or 2G network(if fallback is available).

It is a loose porting effort of https://github.com/arduino-libraries/MKRNB Arduino library, providing the same interfaces when possible.

This library requires the ME310 Arduino Library **greater or equal than 2.4.0** version to work.


## Download and install the ME310 Library

Download the ME310 Arduino library from https://github.com/telit/arduino-me310-library, and place the folder in your Arduino libraries folder, or install the new library from the ZIP file.


## Contents

This Library will simplify the interactions with the ME310G1 Module.

### Classes

The library provides the following classes:

- **TLT**: _modem related operations (turn off, check status, enable connectivity, etc. )_
- **TLTSMS**: _helper for SMS operations_
- **GPRS**: _GPRS attach utilities_
- **TLTClient**: _Client to exchange data over TCP/IP_
- **TLTScanner**: _Utilities to analyze the cellular network such as carrier info, signal strength, etc._
- **TLTPIN**: _Utilities for the SIM PIN management_
- **TLTSSLClient**: _TLS/SSL client to exchange data in secure mode_
- **TLTUDP**: _UDP client utilities_
- **TLTFileUtils**: _Modem filesystem management_
- **TLTGNSS**: _GNSS configuration and data management/conversion_


### Examples

The following examples are available:

- **[ChooseRadioAccessTechnology_example](examples/ChooseRadioAccessTechnology_example/ChooseRadioAccessTechnology_example.ino)** : _Select a network operator and register the module via the ME310 library. with the preferred technology_
- **[GPRS_example](examples/GPRS_example/GPRS_example.ino)** : _sest the device connectivity trying to communicate with a HTTP server_
- **[PinManagement_example](examples/PinManagement_example/PinManagement_example.ino)** : _Insert or disable the SIM PIN_
- **[ReceiveSMS_example](examples/ReceiveSMS_example/ReceiveSMS_example.ino)** : _SMS management, loop to receive an SMS message_
- **[SendSMS_example](examples/SendSMS_example/SendSMS_example.ino)** : _SMS management, how to send SMS messages_
- **[ScanNetworks_example](examples/ScanNetworks_example/ScanNetworks_example.ino)** : _Scan nearby network cells and provide info_
- **[SSLWebClient_example](examples/SSLWebClient_example/SSLWebClient_example.ino)** : _Connect to a website using SSL_
- **[TLTGNSS_example](examples/TLTGNSS_example/TLTGNSS_example.ino)** : _Configure the module in GNSS priority and then waits a fix, printing the retrieved coordinates (in decimal and DMS formats)_
- **[UDPNtpClient_example](examples/UDPNtpClient_example/UDPNtpClient_example.ino)** : _UDP client used to retrieve NTP time_
- **[WebClient_example](examples/WebClient_example/WebClient_example.ino)** : _Connects to an echo server and exchanges data_
- **[FileUtils_example](examples/FileUtils_example/FileUtils_example.ino)** : _Shows how to perform file related operations_


## Support

If you need support, please open a ticket to our technical support by sending an email to:

- ts-americas@telit.com if you are in the Americas region
- ts-emea@telit.com if you are in EMEA region
- ts-apac@telit.com if you are in APAC

providing the following information:

- module type
- answer to the commands (you can use the ME310 library TrasparentBridge example to communicate with the modem)
- AT#SWPKGV
- AT+CPIN?
- AT+CCID
- AT+CGSN
- AT+CGDCONT?

and add [Charlie][AppZone] in the e-mail object, and in the e-mail body refer to the opened issue on github.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ ME310 myME310;
void setup() {
Serial.begin(115200);
myME310.begin(115200);

delay(2000);
delay(1000);
myME310.powerOn(ON_OFF);
delay(5000);
for (int i = 0; i < 80; i++) Serial.print("*");
Serial.println();
Serial.println("This sketch allows you to select your preferred");
Expand Down
145 changes: 145 additions & 0 deletions examples/FileRead_example/FileRead_example.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/
/* See LICENSE file in the project root for full license information. */

/**
@file
TLTMDM.h
string.h
stdio.h
@brief
Sample test of the use of FileUtils class in TLT library.
@details
In this example sketch, it is shown to use file system management, using FileUtils library.\n
Add file in directory, get list of directory, delete files and directory functions are shown.\n
@version
1.0.0
@note
@author
Cristina Desogus
@date
10/08/2021
*/
// libraries
#include <TLTMDM.h>
using namespace me310;

// initialize the library instance
ME310* myME310 = new ME310();
TLTFileUtils fileUtils(myME310, true);

char filename[] = "testFile.txt";
char fileBin[] = "testBin.bin";


void setup() {
Serial.begin(115200);
myME310->begin(115200);

delay(5000);
Serial.println("Starting Arduino file demo.");

myME310->powerOn(ON_OFF);

fileUtils.begin();
Serial.print("Free space: ");
Serial.print(fileUtils.freeSpace());
Serial.println(" Bytes.");

Serial.print("Count File: ");
Serial.println(fileUtils.fileCount());

Serial.println("Files list before new file creation.");
fileUtils.printFiles();

String buf = "Hello World";
Serial.println("Create File");
fileUtils.createFile(filename, buf.c_str(), buf.length());

Serial.println("Files List after create file.");
fileUtils.printFiles();


Serial.println("Check file.");
Serial.print(filename);
Serial.print(": ");
if (fileUtils.existFile(filename))
{
Serial.println("File present!");

uint32_t size = fileUtils.listFile(filename);
Serial.print("Size file: ");
Serial.println(size);

String contentFile;
Serial.println("Read File: <");
fileUtils.readFile(filename, contentFile);
Serial.println(contentFile.c_str());
Serial.println(">");

uint8_t contentFileUint[size+1] = {0};
Serial.println("Read File Uint8: <");
fileUtils.readFile(filename, contentFileUint);
Serial.println((char*)contentFileUint);
Serial.println(">");

Serial.println("Delete File.");
fileUtils.deleteFile(filename);

Serial.println("Files List after delete file.");
fileUtils.printFiles();
}
else
{
Serial.println("File does not present!");
}

Serial.println("Create a binary file");
uint8_t bufferBin[] = {0,1,2,3,4,5,6,7,8,9};

fileUtils.createFile(fileBin, (char*)bufferBin, 10);
Serial.println("Files List after create binary file.");
fileUtils.printFiles();

Serial.println("Check file.");
Serial.print(fileBin);
Serial.print(": ");
if (fileUtils.existFile(fileBin))
{
Serial.println("File present!");

uint32_t size = fileUtils.listFile(fileBin);
Serial.print("Size file: ");
Serial.println(size);

uint8_t contentFileUint[size+1] = {0};
uint8_t tmp_contFileUint[(size*2)+1] = {0};
Serial.println("Read File Uint8: <");
fileUtils.readFile(fileBin, contentFileUint);
myME310->ConvertBufferToIRA(contentFileUint, tmp_contFileUint, size);
Serial.println((char*)tmp_contFileUint);
Serial.println(">");

Serial.println("Delete File.");
fileUtils.deleteFile(fileBin);

Serial.println("Files List after delete file.");
fileUtils.printFiles();
}
else
{
Serial.println("File does not present!");
}


Serial.println("end");
}

void loop() {
}
2 changes: 2 additions & 0 deletions examples/GPRS_example/GPRS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ void setup()
Serial.begin(115200);
myME310->begin(115200);
delay(2000);
myME310->powerOn(ON_OFF);
delay(5000);
}

void loop() {
Expand Down
7 changes: 4 additions & 3 deletions examples/PinManagement_example/PinManagement_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- TLTMDM.h
@brief
This example enables you to change or remove the PIN number of a SIM card inserted into a board.n
This example enables you to change or remove the PIN of a SIM card inserted into a board.
@details
Expand Down Expand Up @@ -43,8 +43,9 @@ void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(115200);
myME310->begin(115200);

delay(2000);
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);

Serial.println("Change PIN example\n");
PINManager.begin();
Expand Down
5 changes: 3 additions & 2 deletions examples/ReceiveSMS_example/ReceiveSMS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ void setup() {

pinMode(ON_OFF, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(ON_OFF, LOW);
// initialize serial communications and wait for port to open:
Serial.begin(115200);
myME310->begin(115200);
delay(2000);
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);
Serial.println(F("SMS Messages Receiver"));
// connection state
bool connected = false;
Expand Down
2 changes: 2 additions & 0 deletions examples/SSLWebClient_example/SSLWebClient_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(115200);
myME310->begin(115200);
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);
Serial.println("Starting Arduino web client.");
// connection state
Expand Down
23 changes: 9 additions & 14 deletions examples/ScanNetworks_example/ScanNetworks_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@

ME310* myME310 = new ME310();

TLT TLTAccess(myME310); // include a 'true' parameter to enable debugging
TLT TLTAccess(myME310, true); // include a 'true' parameter to enable debugging
TLTScanner scannerNetworks(myME310);

// Save data variables
String IMEI = "";

// serial monitor result messages
String errortext = "ERROR";

char APN[]= "APN";
char APN[]= "apn";

void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(115200);
myME310->begin(115200);
delay(2000);
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);
Serial.println("NB IoT/LTE Cat M1 networks scanner");
scannerNetworks.begin();

Expand All @@ -55,7 +54,7 @@ void setup() {
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (!connected)
{
if (TLTAccess.begin(0, APN, true) == READY)
if (TLTAccess.begin(NULL, APN, true) == READY)
{
connected = true;
}
Expand All @@ -69,12 +68,8 @@ void setup() {
// get modem parameters
// IMEI, modem unique identifier
Serial.print("Modem IMEI: ");
IMEI = myME310->request_imei_software_version();
IMEI.replace("\n", "");
if (IMEI != NULL)
{
Serial.println(IMEI);
}
IMEI = TLTAccess.getIMEI();
Serial.println(IMEI.c_str());
}

void loop() {
Expand All @@ -90,7 +85,7 @@ void loop() {
Serial.println(" [0-31]");

// scan for existing networks, displays a list of networks
Serial.println("Scanning available networks. May take some seconds.");
Serial.println("Scanning available networks. This may take some seconds.");
Serial.println(scannerNetworks.readNetworks());
// wait ten seconds before scanning again
delay(10000);
Expand Down
5 changes: 3 additions & 2 deletions examples/SendSMS_example/SendSMS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ void setup() {

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

Serial.begin(115200);
myME310->begin(115200);
delay(2000);
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);
Serial.println(F("SMS Messages Sender"));

// connection state
Expand Down
Loading

0 comments on commit b853348

Please sign in to comment.