Commit dfae4067 authored by AlaskaLinuxUser's avatar AlaskaLinuxUser

Select, read, delete, and reply to texts!

parent e16dffae
......@@ -77,6 +77,7 @@ char imei[16] = {0}; // MUST use a 16 character buffer for IMEI!
bool GPSon = 0;
char messageText[120];
char sendText[21];
int smsNum = 1;
//*********************** Screen ******************
#include <PCD8544.h>
......@@ -377,16 +378,24 @@ void loop() {
lcd.print(" YES");
break;
}
case 9:{ // View all messages screen // TODO: make this work.
case 9:{ // View all messages screen
lcd.setCursor(0, 1);
lcd.print("READ WHICH MESSAGE?");
lcd.setCursor(0, 3);
lcd.print(smsNum);
lcd.setCursor(0, 5);
lcd.print("SELECT SCROLLs");
lcd.print("SELECT READS");
break;
}
case 10:{ // Read message screen // TODO: make this work.
lcd.setCursor(0, 3);
lcd.print("-REPLY");
case 10:{ // Read message screen
lcd.setCursor(0, 1);
lcd.print(sendText);
lcd.setCursor(0, 2);
lcd.print(messageText);
lcd.setCursor(0, 4);
lcd.print("-DELETE");
lcd.print("L-REPLY");
lcd.setCursor(0, 5);
lcd.print("R-DELETE");
break;
}
case 11:{ // Delete message screen
......@@ -645,24 +654,36 @@ void loop() {
screenNumber = 6;
break;
}
case 90:{ // Screen 9 - Scroll message screen. // TODO: make this work.
screenNumber = 1;
case 90:{ // Screen 9 - Scroll message screen.
// Up one number
smsNum++;
break;
}
case 99:{
screenNumber = 1;
// Down one number
if (smsNum <= 1) {
smsNum = 1;
} else {
smsNum--;
}
break;
}
}
case 108:{
screenNumber = 1;
// Up ten number
smsNum+=10;
break;
}
case 117:{
screenNumber = 1;
// Down ten number
if (smsNum <= 11) {
smsNum = 1;
} else {
smsNum-=10;
}
break;
}
case 130:{ // Screen 10 - View message screen.
screenNumber = 7; // TODO: Add phone number.
screenNumber = 7;
break;
}
case 140:{
......@@ -674,6 +695,12 @@ void loop() {
break;
}
case 165:{
// delete an SMS
if (fona.deleteSMS(smsNum-1)) {
Serial.println(F("K"));
} else {
Serial.println(F("F"));
}
screenNumber = 6;
break;
}
......@@ -730,6 +757,20 @@ void loop() {
} else if (screenNumber == 7) {
screenNumber = 5;
curPos = 0;
} else if (screenNumber == 9) {
// Retrieve SMS sender address/phone number.
if (! fona.getSMSSender(smsNum-1, sendText, 250)) {
Serial.println("F");
break;
}
// Retrieve SMS value.
uint16_t smslen;
if (! fona.readSMS(smsNum-1, messageText, 250, &smslen)) { // pass in buffer and max len!
Serial.println("F");
break;
}
screenNumber = 10;
curPos = 0;
} else {
screenNumber = screenNumber;
// Essentially, do nothing.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment