Add Dual-SIM Dual Standby (DSDS), outgoing SIM selection, and instant charging icon update

This commit is contained in:
Luxferre committed 2026-10-27 11:36:00 +02:00
1 parent 5132deb4d8
commit 46f1255905
28 files changed
+2560 -280

No files matched your search

+63 -12
View File
@@ -56,8 +56,14 @@ struct SimSlotInfo {
std::string upinState = "not-initialized";
int upinRetries = 0;
int upukRetries = 0;
std::string regState;
std::string operatorName;
std::string rat;
std::string phoneNumber;
int rssi = 0;
bool isActiveProvisioned = false;
bool isSecondaryProvisioned = false;
bool isPreferred = false;
bool needsPin() const {
@@ -84,6 +90,8 @@ struct ModemStatusData {
bool qmiAvailable = false;
int preferredSlot = 1;
int primaryGwSlot = 0;
int secondaryGwSlot = 0;
bool dualSimActive = false;
SimSlotInfo slots[2];
bool mmPresent = false;
@@ -261,6 +269,10 @@ ModemStatusData queryModemAndSimStatus() {
if (!uimKv["PRIMARY_GW_SLOT"].empty()) {
d.primaryGwSlot = std::atoi(uimKv["PRIMARY_GW_SLOT"].c_str());
}
if (!uimKv["SECONDARY_GW_SLOT"].empty()) {
d.secondaryGwSlot = std::atoi(uimKv["SECONDARY_GW_SLOT"].c_str());
}
d.dualSimActive = (uimKv["DUAL_SIM_ACTIVE"] == "1");
d.nasRegState = uimKv["NAS_REG_STATE"];
d.nasOperator = uimKv["NAS_OPERATOR"];
d.nasMcc = uimKv["NAS_MCC"];
@@ -291,7 +303,15 @@ ModemStatusData queryModemAndSimStatus() {
if (!uimKv[pfx + "UPUK_RETRIES"].empty()) {
s.upukRetries = std::atoi(uimKv[pfx + "UPUK_RETRIES"].c_str());
}
s.regState = uimKv[pfx + "REG_STATE"];
s.operatorName = uimKv[pfx + "OPERATOR"];
s.rat = uimKv[pfx + "RAT"];
s.phoneNumber = uimKv[pfx + "NUMBER"];
if (!uimKv[pfx + "RSSI"].empty()) {
s.rssi = std::atoi(uimKv[pfx + "RSSI"].c_str());
}
s.isActiveProvisioned = (d.primaryGwSlot == (i + 1));
s.isSecondaryProvisioned = (d.secondaryGwSlot == (i + 1));
s.isPreferred = (d.preferredSlot == (i + 1));
}
@@ -740,8 +760,13 @@ int runModemApp(int argc, char** argv) {
10, cardY + 2, 22, kIconSim);
std::string title = "SIM Slot " + std::to_string(s.slotNum);
if (s.isActiveProvisioned) {
if (status.dualSimActive &&
(s.isActiveProvisioned || s.isSecondaryProvisioned)) {
title += s.isPreferred ? " [ACTIVE / DEFAULT]" : " [ACTIVE / DSDS]";
} else if (s.isActiveProvisioned) {
title += " [ACTIVE]";
} else if (s.isSecondaryProvisioned) {
title += " [DSDS STANDBY]";
} else if (s.isPreferred) {
title += " [PREF]";
}
@@ -759,20 +784,40 @@ int runModemApp(int argc, char** argv) {
line2Col = &colOrange;
} else if (s.isActiveProvisioned) {
std::string reg = status.regStatusLabel();
if (!status.operatorName.empty()) {
reg += " - " + status.operatorName;
std::string op = !s.operatorName.empty() ? s.operatorName : status.operatorName;
std::string rat = !s.rat.empty() ? s.rat : status.accessTech;
if (!op.empty()) {
reg += " - " + op;
}
if (!status.accessTech.empty()) {
reg += " [" + status.accessTech + "]";
if (!rat.empty()) {
reg += " [" + rat + "]";
}
line2 = reg;
if (status.isNetworkRegistered()) {
if (status.isNetworkRegistered() || s.regState == "registered") {
line2Col = &colGreen;
} else if (status.isNetworkSearching()) {
} else if (status.isNetworkSearching() || s.regState == "searching") {
line2Col = &colOrange;
} else {
line2Col = &colRed;
}
} else if (s.isSecondaryProvisioned || s.regState == "registered" ||
s.regState == "searching") {
if (s.regState == "registered") {
line2 = "Registered (DSDS)";
if (!s.operatorName.empty()) {
line2 += " - " + s.operatorName;
}
if (!s.rat.empty()) {
line2 += " [" + s.rat + "]";
}
line2Col = &colGreen;
} else if (s.regState == "searching") {
line2 = "Searching Network (DSDS)...";
line2Col = &colOrange;
} else {
line2 = "Active Standby (" + s.appType + ")";
line2Col = &colBlue;
}
} else if (status.primaryGwSlot == 0) {
line2 = "Present (Unactivated - Press Select)";
line2Col = &colOrange;
@@ -796,8 +841,11 @@ int runModemApp(int argc, char** argv) {
else if (pState == "blocked") pState = "PUK Req";
line3 = pState + " (PIN:" + std::to_string(s.pin1Retries) +
" PUK:" + std::to_string(s.puk1Retries) + ")";
if (s.isActiveProvisioned && !status.ownNumber.empty()) {
line3 += " " + status.ownNumber;
std::string numStr = !s.phoneNumber.empty()
? s.phoneNumber
: (s.isActiveProvisioned ? status.ownNumber : "");
if (!numStr.empty()) {
line3 += " " + numStr;
}
} else {
line3 = "Insert nano-SIM & restart/switch";
@@ -820,7 +868,9 @@ int runModemApp(int argc, char** argv) {
std::string(kIconRefresh) +
(status.primaryGwSlot == 0
? (" Activate SIM " + std::to_string(otherSlot))
: (" Switch Active to SIM " + std::to_string(otherSlot))),
: (status.dualSimActive
? (" Set Default SIM to Slot " + std::to_string(otherSlot))
: (" Switch Active to SIM " + std::to_string(otherSlot)))),
std::string(kIconUnlock) + " Unlock SIM (PIN / PUK)",
std::string(kIconLock) + " Enable / Disable SIM PIN",
std::string(kIconKey) + " Change SIM PIN Code",
@@ -1043,7 +1093,7 @@ int runModemApp(int argc, char** argv) {
drawPango(layoutMain, &colYellow, 20, 48, 24, hdr, kWinWidth - 40);
const char* actLabels[5] = {
"Set as Active SIM Slot",
"Set as Default / Primary SIM",
"Unlock SIM (Enter PIN)",
"Unblock SIM (Enter PUK)",
"Enable / Disable SIM PIN",
@@ -1457,7 +1507,8 @@ int runModemApp(int argc, char** argv) {
const auto& s = status.slots[row];
if (s.needsPin() || s.needsPuk()) {
openPinOrPukModalForSlot(sNum);
} else if (s.state == "present" && !s.isActiveProvisioned) {
} else if (s.state == "present" && !s.isActiveProvisioned &&
!s.isSecondaryProvisioned) {
switchSimSlotNow(sNum);
} else {
targetSlot = sNum;