mirror of
https://github.com/meshtastic/firmware.git
synced 2026-11-08 07:15:22 -05:00
Set ClientNotification.type on every firmware notification (#12280)
* Set ClientNotification.type on every firmware notification Every ClientNotification the firmware sends now carries the NotificationType for its message, so clients can localize or act on it without matching the text. `message` is unchanged. The shared senders take the type as a required argument so a new call site cannot omit it: PhoneAPI::sendNotification, AdminModule::sendWarning / sendWarningAndLog / queueChannelWarning, and RadioInterface's sendErrorNotification. The channel-warning queue keeps the type of a lone warning and uses CHANNEL_*_ISSUES for a coalesced one. checkConfigRegion() gains an optional errType out-parameter so validateConfigRegion() can send the reason's type. NodeDB::notifyRefusedIdentity() (added in #12191) has no type yet and stays UNSET until the protobufs add one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZVEy3QxYqj916trqLEsrb * Fix AdminModule.h formatting Move pendingWarningType below the aligned member block so clang-format leaves the existing trailing-comment alignment alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZVEy3QxYqj916trqLEsrb * Honor level in PhoneAPI::sendNotification; test catch-all types sendNotification ignored its level argument and always sent WARNING. Every caller passes WARNING today, so behavior is unchanged. Add test_admin_radio cases for the CHANNEL_PSK_ISSUES and CHANNEL_NAME_AND_PSK_ISSUES catch-all types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZVEy3QxYqj916trqLEsrb --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
24c6e139dc
commit
51ac6ea7b7
18 files changed
+260
-61
No files matched your search
@@ -3995,6 +3995,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
|
||||
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
|
||||
if (cn) {
|
||||
cn->level = meshtastic_LogRecord_Level_WARNING;
|
||||
cn->type = meshtastic_ClientNotification_NotificationType_DUPLICATED_PUBLIC_KEY;
|
||||
cn->time = getValidTime(RTCQualityFromNet);
|
||||
snprintf(cn->message, sizeof(cn->message), warning, safeName);
|
||||
service->sendClientNotification(cn);
|
||||
@@ -4925,6 +4926,7 @@ bool NodeDB::notifyPendingLicensedIdentityMigration()
|
||||
if (!notification)
|
||||
return false;
|
||||
notification->level = meshtastic_LogRecord_Level_WARNING;
|
||||
notification->type = meshtastic_ClientNotification_NotificationType_LICENSED_IDENTITY_CHANGED;
|
||||
notification->time = getValidTime(RTCQualityFromNet);
|
||||
snprintf(notification->message, sizeof(notification->message), "%s", LICENSED_IDENTITY_MIGRATION_WARNING);
|
||||
service->sendClientNotification(notification);
|
||||
|
||||
Reference in new issue
Block a user