queryUppercase fix

This commit is contained in:
richonguzman 2024-07-05 11:58:18 -04:00
parent dcca18eeac
commit beca09293a
1 changed files with 19 additions and 15 deletions

View File

@ -14,17 +14,19 @@ namespace QUERY_Utils {
String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty) { String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty) {
String answer; String answer;
if (query=="?APRS?" || query=="?aprs?" || query=="?Aprs?" || query=="H" || query=="h" || query=="HELP" || query=="Help" || query=="help" || query=="?") { String queryQuestion = query;
queryQuestion.toUpperCase();
if (queryQuestion == "?APRS?" || queryQuestion == "H" || queryQuestion == "HELP" || queryQuestion=="?") {
answer.concat("?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign"); answer.concat("?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign");
} else if (query=="?APRSV" || query=="?aprsv" || query=="?Aprsv") { } else if (queryQuestion == "?APRSV") {
answer = "CA2RXU_LoRa_iGate 1.4 v"; answer.concat("CA2RXU_LoRa_iGate 1.4 v");
answer.concat(versionDate); answer.concat(versionDate);
} else if (query=="?APRSP" || query=="?aprsp" || query=="?Aprsp") { } else if (queryQuestion == "?APRSP") {
answer = "iGate QTH: "; answer.concat("iGate QTH: ");
answer.concat(String(Config.beacon.latitude,2)); answer.concat(String(Config.beacon.latitude,3));
answer.concat(" "); answer.concat(" ");
answer.concat(String(Config.beacon.longitude,2)); answer.concat(String(Config.beacon.longitude,3));
} else if (query=="?APRSL" || query=="?aprsl" || query=="?Aprsl") { } else if (queryQuestion == "?APRSL") {
if (lastHeardStation.size() == 0) { if (lastHeardStation.size() == 0) {
char answerArray[50]; char answerArray[50];
snprintf(answerArray, sizeof(answerArray), "No Station Listened in the last %d min.", Config.rememberStationTime); snprintf(answerArray, sizeof(answerArray), "No Station Listened in the last %d min.", Config.rememberStationTime);
@ -35,23 +37,20 @@ namespace QUERY_Utils {
} }
answer.trim(); answer.trim();
} }
} else if (query=="?APRSSR" || query=="?aprssr" || query=="?Aprssr") { } else if (queryQuestion == "?APRSSR") {
char signalData[35]; char signalData[35];
snprintf(signalData, sizeof(signalData), " %ddBm / %.2fdB / %dHz", rssi, snr, freqError); snprintf(signalData, sizeof(signalData), " %ddBm / %.2fdB / %dHz", rssi, snr, freqError);
answer.concat(signalData); answer.concat(signalData);
} else if (query.indexOf("?APRSH") == 0 || query.indexOf("?aprsh") == 0 || query.indexOf("?Aprsh") == 0) { } else if (queryQuestion.indexOf("?APRSH") == 0) {
// sacar callsign despues de ?APRSH // sacar callsign despues de ?APRSH
Serial.println("escuchaste a X estacion? en las ultimas 24 o 8 horas?"); Serial.println("escuchaste a X estacion? en las ultimas 24 o 8 horas?");
answer.concat("?APRSH on development 73!"); answer.concat("?APRSH on development 73!");
} else if (query.indexOf("?WHERE") == 0) { } else if (queryQuestion.indexOf("?WHERE") == 0) {
// agregar callsign para completar donde esta X callsign --> posicion // agregar callsign para completar donde esta X callsign --> posicion
Serial.println("estaciones escuchadas directo (ultimos 30 min)"); Serial.println("estaciones escuchadas directo (ultimos 30 min)");
answer.concat("?WHERE on development 73!"); answer.concat("?WHERE on development 73!");
} }
String processedStation = station;
for (int i = station.length(); i < 9; i++) {
processedStation += ' ';
}
String queryAnswer = Config.callsign; String queryAnswer = Config.callsign;
queryAnswer += ">APLRG1"; queryAnswer += ">APLRG1";
if (queryFromAPRSIS) { if (queryFromAPRSIS) {
@ -64,6 +63,11 @@ namespace QUERY_Utils {
} }
} }
queryAnswer += "::"; queryAnswer += "::";
String processedStation = station;
for (int i = station.length(); i < 9; i++) {
processedStation += ' ';
}
queryAnswer += processedStation; queryAnswer += processedStation;
queryAnswer += ":"; queryAnswer += ":";
queryAnswer += answer; queryAnswer += answer;