diff --git a/Display.cpp b/Display.cpp index 180eb1e..0ac9553 100644 --- a/Display.cpp +++ b/Display.cpp @@ -119,11 +119,11 @@ void CDisplay::writeDMR(unsigned int slotNo, const std::string& src, bool group, m_mode2 = MODE_IDLE; } writeDMRInt(slotNo, src, group, dst, type); - + LogMessage ("Voice TG:%s",dst.c_str()); LogMessage ("Voice Callsign:%s",src.c_str()); - -//TTS Voice + +//TTS char voice[80]; strcpy (voice,"echo \""); if (strcmp ("",src.c_str()) !=0){ @@ -199,7 +199,7 @@ for (char & c : s) strcat(voice," Victor "); } else if (c == 'W'){ - strcat(voice," Güisky "); + strcat(voice," Güisski "); } else if (c == 'X'){ strcat(voice," Exray "); @@ -258,19 +258,36 @@ for (char & c : s) system ("/ram/mm_voice.sh &"); } -if ((strcmp ("99990",dst.c_str()) ==0)) -{ - printf ("Wifi Off\n"); - system("sudo rfkill block 0"); - } - -else if ((strcmp ("99991",dst.c_str()) ==0)) -{ - printf ("Wifi On\n"); - system("sudo rfkill unblock 0"); - } - +//REMOTE Commands + if ((strcmp ("99999",dst.c_str()) ==0)){ + LogMessage ("Remote Command Reboot"); + system("sudo shutdown -r now"); + } + else if ((strcmp ("99998",dst.c_str()) ==0)){ + LogMessage ("Remote Command Shutdown"); + system("sudo shutdown -h now"); + } + else if ((strcmp ("99997",dst.c_str()) ==0)){ + LogMessage ("Remote Command DmrPlus"); + system("mm_plus"); + } + else if ((strcmp ("99996",dst.c_str()) ==0)){ + LogMessage ("Remote Command DMRGateway"); + system("mm_gate"); + } + else if ((strcmp ("99995",dst.c_str()) ==0)){ + LogMessage ("Remote Command BrandMeister"); + system("mm_BM"); + } + else if ((strcmp ("99991",dst.c_str()) ==0)){ + LogMessage ("Remote Command Wifi On"); + system("sudo rfkill unblock 0"); + } + else if ((strcmp ("99990",dst.c_str()) ==0)){ + LogMessage ("Remote Command Wifi Off"); + system("sudo rfkill block 0"); + } } void CDisplay::writeDMRRSSI(unsigned int slotNo, unsigned char rssi) diff --git a/Nextion_HS.cpp b/Nextion_HS.cpp index b768381..57b692c 100644 --- a/Nextion_HS.cpp +++ b/Nextion_HS.cpp @@ -366,7 +366,8 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro if (strcmp(type,"R") == 0) { sendCommand("t2.pco=2016"); - sendCommand("t36.pco=2016"); + sendCommand("j0.pco=1024"); + sendCommand("t36.pco=2016"); sendCommand("t36.txt=\"Busy\""); sendCommand(text); @@ -405,28 +406,6 @@ FILE *cfgfileTG; fclose(cfgfileTG); - - - -// READ INI SYSOP & CONTROL - - FILE *cfgfileCT; - int maxlineCT = 256; - int iCT=0; - char ctrl[7][256]; - std::string tct ("ctrl.ini"); - std::string pathct (""); - pathct = m_filesConfig + tct; - const char* filect = pathct.c_str(); - cfgfileCT = fopen (filect, "r"); - if (cfgfileCT==NULL) printf("can't open file\n"); - while (fgets(ctrl[iCT], maxlineCT, cfgfileCT)) { - ctrl[iCT][strlen(ctrl[iCT])-1] = '\0'; - iCT++; - } - fclose(cfgfileCT); - - /* READ INI PREFIXES * * A prefixes @@ -534,39 +513,6 @@ else { sendCommand("t2.font=11"); sendCommand(text); -// Compare ShutDown Routines - -if ((strcmp (ctrl[3],dst.c_str()) ==0) && (strncmp (src.c_str(),ctrl[0],6) == 0) && (strcmp ("1",ctrl[1]) == 0)) -{ - printf ("Reboot NOW\n"); - system("sudo shutdown -r now"); -} - -else if ((strcmp (ctrl[2],dst.c_str()) ==0) && (strncmp (src.c_str(),ctrl[0],6) == 0) && (strcmp ("1",ctrl[1]) == 0)) -{ -printf ("Shutdown NOW\n"); -system("sudo shutdown -h now"); -close(); -} - -else if ((strcmp (ctrl[4],dst.c_str()) ==0) && (strncmp (src.c_str(),ctrl[0],6) == 0) && (strcmp ("1",ctrl[1]) == 0)) -{ -printf ("DmrPlusmode\n"); -system("mm_plus"); -} - -else if ((strcmp (ctrl[5],dst.c_str()) ==0) && (strncmp (src.c_str(),ctrl[0],6) == 0) && (strcmp ("1",ctrl[1]) == 0)) -{ -printf ("DMRGateway mode\n"); -system("mm_gate"); -} - -else if ((strcmp (ctrl[6],dst.c_str()) ==0) && (strncmp (src.c_str(),ctrl[0],6) == 0) && (strcmp ("1",ctrl[1]) == 0)) -{ -printf ("BrandMeister mode\n"); -system("mm_BM"); -} - ::sprintf(text, "t3.txt=\"%s%s\"", group ? "TG: " : "", dst.c_str()); @@ -603,11 +549,6 @@ else if (strcmp ("4000",dst.c_str()) ==0) { ::sprintf(text, "p5.pic=11"); sendCommand(text); } -else if (strcmp (ctrl[0],dst.c_str()) ==0) { - char text[130U]; - ::sprintf(text, "p5.pic=9"); - sendCommand(text); -} else if (strcmp ("9990",dst.c_str()) ==0) { char text[130U]; ::sprintf(text, "p5.pic=7"); @@ -618,6 +559,23 @@ else if (strcmp ("6",dst.c_str()) ==0) { ::sprintf(text, "p5.pic=13"); sendCommand(text); } +else if ((strcmp ("99991",dst.c_str()) ==0)){ + char text[130U]; + ::sprintf(text, "p5.pic=14"); + sendCommand(text); + } + else if ((strcmp ("99990",dst.c_str()) ==0)){ + char text[130U]; + ::sprintf(text, "p5.pic=15"); + sendCommand(text); + } +/* +else if (strcmp (callsign,dst.c_str()) ==0) { + char text[130U]; + ::sprintf(text, "p5.pic=9"); + sendCommand(text); +} +*/ else { @@ -627,12 +585,10 @@ else sendCommand(text); }} - sendCommand ("t5.txt=\"RSSI: -10udBm\""); sendCommand ("t7.txt=\"Ber: 0.0%\""); sendCommand(text); - } m_clockDisplayTimer.stop(); diff --git a/OLED.cpp b/OLED.cpp index 084983a..458bec0 100644 --- a/OLED.cpp +++ b/OLED.cpp @@ -619,100 +619,75 @@ if (strcmp ("9",dst.c_str()) ==0) { display.printf("%s%s", group ? "TG:" : "", dst.c_str()); -// ShutDown & Reboot compares +// ShutDown & Reboot compares & print screen -if ((strcmp ("99999",dst.c_str()) ==0)) -{ +if ((strcmp ("99999",dst.c_str()) ==0)){ display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("Reboot"); display.display(); - printf ("Reboot\n"); - system("sudo shutdown -r now"); delay (1000); - } -else if ((strcmp ("99998",dst.c_str()) ==0)) -{ +else if ((strcmp ("99998",dst.c_str()) ==0)) { display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("STOP"); display.display(); - printf ("Shutdown\n"); - system("sudo shutdown -h now"); delay (1000); - } -else if ((strcmp ("99997",dst.c_str()) ==0)) -{ +else if ((strcmp ("99997",dst.c_str()) ==0)){ display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("Load +"); display.display(); - printf ("DmrPlus\n"); - system("mm_plus"); delay (100); - } -else if ((strcmp ("99996",dst.c_str()) ==0)) -{ +else if ((strcmp ("99996",dst.c_str()) ==0)){ display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("Load Gate"); display.display(); - printf ("DMRGateway\n"); - system("mm_gate"); delay (100); - } -else if ((strcmp ("99995",dst.c_str()) ==0)) -{ +else if ((strcmp ("99995",dst.c_str()) ==0)){ display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("Load BM"); display.display(); - printf ("BrandMeister\n"); - system("mm_BM"); delay (100); } -else if ((strcmp ("99990",dst.c_str()) ==0)) -{ +else if ((strcmp ("99990",dst.c_str()) ==0)){ display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("Wifi Off"); display.display(); - printf ("Wifi Off\n"); - system("sudo rfkill block 0"); } -else if ((strcmp ("99991",dst.c_str()) ==0)) -{ +else if ((strcmp ("99991",dst.c_str()) ==0)){ display.clearDisplay(); OLED_statusbar(); display.setCursor(20,OLED_LINE3); display.setTextSize(2); display.printf("Wifi On"); display.display(); - printf ("Wifi On\n"); - system("sudo rfkill unblock 0"); }