Skip to content

Commit

Permalink
Merge pull request #7 from telit/feature/debug-and-cleanup
Browse files Browse the repository at this point in the history
add debug feature for TLT class
  • Loading branch information
fabiopi-tlt authored Jan 11, 2022
2 parents f1fa6b4 + 035faae commit a1b6736
Show file tree
Hide file tree
Showing 29 changed files with 777 additions and 361 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
TLT 0.0.0 - ????.??.??

TLT 1.3.0 - 2022.01.11
* added debug functionality
* code cleanup + general improvements

TLT 1.2.0 - 2021.10.14
* GNSS formatting utilities and example
* file utils improvements and example
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This library allows to use a Telit Charlie board to connect to the Internet over

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.6.0** version to work.
This library requires the ME310 Arduino Library **greater or equal than 2.9.0** version to work.


## Download and install the ME310 Library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Sample test of the use of Radio Access Technology selection for Arduino with TLTMDM.\n
@details
This sketch shows how to select a network operator and register the module via the ME310 library.\n
You can choose among CAT-M1, NB-IoT or a combination of both.\n
LTE technology supported:
Expand All @@ -18,9 +18,9 @@
- CAT-M1 (preferred) and NB-IoT (2)
- CAT-M1 and NB-IoT (preferred) (3)
@version
@version
1.1.0
@note
@author
Expand Down Expand Up @@ -71,7 +71,7 @@ void loop() {

Serial.print("> ");

Serial.setTimeout(-1);
Serial.setTimeout(0);
while (Serial.available() == 0);
String uratInput = Serial.readStringUntil('\n');
uratInput.trim();
Expand Down Expand Up @@ -135,6 +135,6 @@ bool apply()
} while (rc != ME310::RETURN_VALID);

Serial.println("done.");

return true;
}
22 changes: 14 additions & 8 deletions examples/FileRead_example/FileRead_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,20 @@ void setup() {
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(">");

if(size > 0)
{
uint8_t contentFileUint[size+1] = {0};
if(((size*2)+1) < INT8_MAX)
{
int tmp_size = (size*2)+1;
uint8_t tmp_contFileUint[tmp_size] = {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);

Expand Down
11 changes: 5 additions & 6 deletions examples/GPRS_example/GPRS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
Sample test of the use of ability to connect to a GPRS network.
@details
This sketch tests board's ability to connect to a GPRS network. It asks for APN information through
This sketch tests board's ability to connect to a GPRS network. It asks for APN information through
the serial monitor and tries to connect to example.org.
@version
@version
1.0.0
@note
@author
Expand All @@ -37,7 +37,7 @@ TLT tltAccess(myME310);
// messages for serial monitor response
String oktext = "OK";
String errortext = "ERROR";
char APN[]= "web.omnitel.it";
char APN[]= "APN";

// URL and path (for example: example.org)
char url[] = "example.org";
Expand Down Expand Up @@ -69,7 +69,6 @@ void loop() {
if ((tltAccess.begin(0, APN, true) == READY))
{
Serial.println(errortext);
while (true);
}
Serial.println(oktext);

Expand Down Expand Up @@ -127,7 +126,7 @@ void loop() {
if (use_proxy)
{
client.print(urlproxy);
}
}
else
{
client.print(path);
Expand Down
10 changes: 4 additions & 6 deletions examples/PinManagement_example/PinManagement_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
@details
@version
@version
1.0.0
@note
@author
Expand Down Expand Up @@ -46,7 +46,7 @@ void setup() {
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);

Serial.println("Change PIN example\n");
PINManager.begin();

Expand All @@ -65,7 +65,7 @@ void setup() {
auth = true;
PINManager.setPINUsed(true);
Serial.println(oktext);
}
}
else
{
// if PIN code was incorrected
Expand Down Expand Up @@ -96,7 +96,6 @@ void setup() {
{
// the worst case, PIN and PUK are locked
Serial.println("PIN and PUK locked. Use PIN2/PUK2 in a mobile phone.");
while (true);
}
else
{
Expand All @@ -121,7 +120,6 @@ void setup() {
{
// error connection
Serial.println(errortext);
while (true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/ReceiveSMS_example/ReceiveSMS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void setup() {
while (!connected) {
if (TLTAccess.begin() == READY)
{
connected = true;
connected = true;
Serial.println(F(""));
}
else
Expand Down
4 changes: 2 additions & 2 deletions examples/SSLWebClient_example/SSLWebClient_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
SSL Web client
@details
This sketch connects to a website using SSL through the board.\n
This sketch connects to a website using SSL through the board.\n
Specifically, this example downloads the URL "www.telit.com" and prints it to the Serial monitor.
@version
Expand Down Expand Up @@ -76,7 +76,7 @@ void setup() {
{
//Serial.println(F("connected"));
// Make a HTTP request:

client.println("GET / HTTP/1.1\r\nHost: telit.com\r\nConnection: close\r\n");
}
else
Expand Down
4 changes: 2 additions & 2 deletions examples/ScanNetworks_example/ScanNetworks_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@details
This example sketch prints the IMEI number of the modem, then check if it is connected to an operator.\n
It then scans nearby networks and prints their signal strength.
@version
@version
1.0.0
@note
@author
Expand Down
2 changes: 1 addition & 1 deletion examples/SendSMS_example/SendSMS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TLT TLTAccess(myME310);
TLTSMS sms(myME310);

void setup() {

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

Expand Down
10 changes: 5 additions & 5 deletions examples/TLTGNSS_example/TLTGNSS_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
For the sketch to work correctly, GNSS should be tested in open sky conditions to allow a fix. The fix may take a few minutes.
@version
@version
1.0.0
@note
@author
Expand All @@ -43,7 +43,7 @@ void setup()
Serial.begin(115200);
_me310->begin(115200);
delay(3000);

Serial.println("TLT GNSS example, enabling ME310 module");

_me310->powerOn();
Expand All @@ -65,12 +65,12 @@ void loop()

/*Fix 1.2 or 1.3 means valid fix*/
if (gnssInfo.fix.toFloat() > 1.0)
{
{
Serial.println("");
Serial.print("Fix valid, converting...");
if (gnss.convertNMEA2Decimal(gnssInfo.latitude, gnssInfo.longitude, &lat, &lng))
{

Serial.println("Conversion done!");
Serial.println(lat, 6);
Serial.println(lng, 6);
Expand Down
18 changes: 9 additions & 9 deletions examples/UDPNtpClient_example/UDPNtpClient_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
unsigned int localPort = 2500; // local port to listen for UDP packets

const char timeServer[] = "0.it.pool.ntp.org";
unsigned short hostPort = 123;
unsigned short hostPort = 123;

const int timeZone = 2;
const int timeZone = 2;
time_t prevDisplay = 0; // when the digital clock was displayed

const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
Expand All @@ -55,7 +55,7 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
myME310->begin(115200);
myME310->begin(115200);
delay(1000);
myME310->powerOn(ON_OFF);
delay(5000);
Expand All @@ -80,7 +80,7 @@ void setup()
}

Serial.println(F("Starting connection to server..."));
Udp.begin(localPort);
Udp.begin(localPort);
Serial.println(F("Waiting for sync..."));
setSyncProvider(getNtpTime);
}
Expand All @@ -105,12 +105,12 @@ void digitalClockDisplay()
Serial.print("/");
Serial.print(month());
Serial.print("/");
Serial.print(day());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
Serial.println();
}

void printDigits(int digits)
Expand Down Expand Up @@ -151,7 +151,7 @@ time_t getNtpTime()
// send an NTP request to the time server at the given address
unsigned long sendNTPpacket(const char* address)
{

// set all bytes in the buffer to 0
memset(packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
Expand All @@ -172,5 +172,5 @@ unsigned long sendNTPpacket(const char* address)
// you can send a packet requesting a timestamp:
Udp.beginPacket(address, hostPort); //NTP requests are to port 123
Udp.write(packetBuffer, NTP_PACKET_SIZE);
Udp.endPacket();
return Udp.endPacket();
}
2 changes: 1 addition & 1 deletion examples/WebClient_example/WebClient_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Web client
@details
This sketch connects to a server using sockets through the board.\n
This sketch connects to a server using sockets through the board.\n
Specifically, this example connects to echo server "modules.telit.com" and prints the response to the Serial monitor.
@version
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=TLT
version=1.2.1
version=1.3.0
author=Telit
maintainer=Telit <info@telit.com>
sentence=Provides network communication capabilities over ME310G1 Telit module.
Expand Down
Loading

0 comments on commit a1b6736

Please sign in to comment.