Skip to content

Commit

Permalink
Ngrok: Add toggle to start/stop service manually
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Apr 11, 2024
1 parent 2cbe1a7 commit 957071f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions selfdrive/ui/qt/network/networking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
});
list->addItem(hiddenNetworkButton);

// Ngrok
QProcess process;
process.start("sudo service ngrok status | grep running");
process.waitForFinished();
QString output = QString(process.readAllStandardOutput());
bool ngrokRunning = !output.isEmpty();
ToggleControl *ngrokToggle = new ToggleControl(tr("Ngrok Service"), "", "", ngrokRunning);
connect(ngrokToggle, &ToggleControl::toggleFlipped, [=](bool state) {
if (state) std::system("sudo ngrok service start");
else std::system("sudo ngrok service stop");
});
list->addItem(ngrokToggle);

// Set initial config
wifi->updateGsmSettings(roamingEnabled, QString::fromStdString(params.get("GsmApn")), metered);

Expand Down

0 comments on commit 957071f

Please sign in to comment.