Merge pull request #1102 from OffbandMesh/feat/1068-radio-channel-notify

feat(#1068): radio per-channel notify, the 0xC5 0x1C capability advert, and the #1060 identity fixes
pull/1104/head
Strycher 3 weeks ago committed by GitHub
commit dd09084a9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,95 @@
# Channel identity alignment: erased slots and slot-keyed notify (#1060)
Agent: CalmBay. Branch `feat/1068-radio-channel-notify`. No push, no PR.
## 1. Who owns the "key by identity, not slot" work
**Feature #1061, agent TurquoiseBridge (session 82d77b2f).** The identity key is
the channel's **PSK hex**, not a pubkey; channels have no pubkey, and the PSK is
what both history and settings already hang off.
| Issue | What | State |
|---|---|---|
| #1060 | the bug: slot map diverges after wipe + re-import, wrong-channel notifications | open |
| #1061 | feature: channel state follows channel identity | open |
| #1062 | fail-closed sync, ingress barrier, slot identity diff | landed |
| #1063 | message history keyed by channel identity | landed |
| #1064 | integration testing + #1060 bug validation | **open** |
The pattern itself is older than #1061: `feat(#260)` (2026-07-17) introduced
PSK-keyed notify storage, `fix(#848)` scoped it per radio and killed the index
fallback, and `#194` keyed message history the same way.
`test/connector/channel_slot_resync_integration_test.dart` already encodes the
exact field case, down to `#wardriving` set to OFF.
## 2. What was still slot-keyed
#544 (epics #1068-#1071, this branch) added the RADIO-side per-channel notify
after #1061 landed, and keyed it by **slot index**:
```dart
final Map<int, RadioChannelNotify> _channelNotifyModes = {};
```
That re-opened the exact class of defect #1061 was built to close, on the one
surface where the user notices it fastest: the buzzer. The slot-identity-change
handler cleared `_channelMessages[slot]` but not `_channelNotifyModes[slot]`,
so after a slot shift the new occupant inherited the old one's mode.
Reproduced by planting the slot-keyed map back and running the new A5 test:
```
Expected: null
Actual: RadioChannelNotify:<RadioChannelNotify.off>
```
A channel silenced on the radio handing its Off to whatever took its slot, and
losing its own. That is the chirping.
### Fixed
- `_channelNotifyModes` is keyed by **PSK hex**. The wire stays slot-addressed;
the slot is resolved to an identity at the wire edge and nowhere else.
- A reply whose slot does not resolve to a confirmed channel is **dropped**,
not stored against a slot number.
- `setChannelNotify` takes a `Channel` and resolves its **current** slot at
send time, so a `Channel` a widget captured before a re-sync cannot address a
stale slot. Unresolvable means a visible refusal, no frame.
## 3. The erased-slot defect
Erased flash reads back as `0xFF`. `Channel.isEmpty` tests for `0x00`, so an
erased record is not empty: it was adopted as a channel, rendered with U+FFFD
replacement characters, and then **saved over the client's own good list**.
That is one missing validation gate, not two defects. The rendering and the
overwrite are the same hole seen twice.
### Fixed
- `Channel.isErased` / `isUnusable`: an all-`0xFF` record, or a name that did
not decode, is never adopted.
- A sync that sees an erased slot **keeps the cached list** instead of
overwriting it, reusing the fail-closed branch #1062 already had for holes.
- `restoreChannelsToRadio()` writes the cached channels back to their own
slots, with their PSKs, so history and settings line up again. Surfaced as an
undismissable banner with a confirmed **Restore to radio** action.
Probe: forcing `isErased => false` turns 5 of the new tests red, including the
cache overwrite.
## 4. Recovery for the list already lost
Not built, flagged for a decision. Message history keys are
`channel_messages_<devicePrefix>psk_<pskHex>`, so **the PSKs of the lost
channels still exist in the message store** even though the channel list was
overwritten. A recovery pass could enumerate those keys and rebuild the list.
Names would need retyping; the PSK is the part that matters.
## 5. State
`flutter analyze` clean. **1885 tests pass, 1 skipped.** New strings are
English-only with `untranslated.json` regenerated.
Not pushed, no PR: the owner's gate is a hardware test first.

@ -0,0 +1,221 @@
# Offset-87 realignment, client half
**Epic:** #1094 · **Agent:** CalmBay · **Night of 2026-11-04**
Read §1 and §6. The rest is evidence.
---
## 1. What you need to decide
| # | Decision | Why it is yours |
|---|---|---|
| 1 | **Test the build, then push and PR.** Nothing is pushed. | Your gate, and you asked to test first. |
| 2 | **One contract gap is unanswered by firmware.** I shipped a resolution and told FuchsiaCreek. | If they rule differently it is a one-line change. |
The branch hazard that was decision 2 here is **fixed** — see §6. Everything else ran to completion.
**One branch to test and PR: `feat/1094-offset-87-realignment`.** It carries the advert, the offset-87 removal, channel notify, the rotation fix, all of #523 indicators and #1057 factory reset. Renamed from `fix/1098-rotation-subcodes`, which undersold what it holds.
---
## 2. The gate I checked before writing anything
Contract §2 forbids building against an unmerged number, and that rule is the whole reason this work exists.
```
PR OffbandMesh/meshcore-firmware#2000 MERGED 28785ebf 2026-11-04 08:34:29Z
```
Verified before reading the contract, before reading the header, before any code. Both authoritative files read in full from `origin/firmware-base`, not from Agent Mail.
**I also found a stale instruction and did not obey it.** FuchsiaCreek's Agent Mail 1448 said *"CalmBay — HOLD the client half. The contract has real defects."* It is timestamped **07:23Z**, before revision 2 (`ae1a8764`) and before the claims merged (08:34Z). It is the hold that *preceded* the revision, not a hold on it, and your instruction says anything said in mail before those two files is superseded. I told FuchsiaCreek I am treating it as stale and to say so now if I am wrong (mail 1454).
Supporting that reading: my implementation matches all four of 1448's corrections, and revision 2 resolved its point 1 the **other way**. 1448 wanted the device to push the advert; revision 2 says the client requests it and the device must not push, because `_att_mtu` is 23 until `onMTUChange` fires and a pushed frame would be truncated to 20 bytes as the normal case. I built the merged version.
---
## 3. Delivered
Two commits, both local.
### `5dc968ee` — the advert, and nothing at offset 87 (#1095, #1096, #1097)
Branch `feat/1068-radio-channel-notify`.
- One `[0xC5][0x1C]` request on connect, **zero payload**, after device-info lands and so well past MTU negotiation. Client asks; device never pushes.
- A tag's presence IS the capability. No bitmap, no probing. `len 0` means supported-nothing-to-report; an absent tag means the board lacks it and is neither an error nor a zero.
- **Unknown tags kept and skipped by `len`.** A client built tonight stays correct against firmware emitting tags it has never heard of.
- `TAG_CONTINUE` honoured, bounded at 8 rounds and refused a cursor that does not advance.
- `[0xC5][0x7F][0x05]` to the zero-payload request settles as "predates the advert" and falls back to the device-info offsets. Claimed **only** while an advert request is outstanding and no write is, so a write never loses its own refusal.
- `TAG_ACK_CAPACITY` read as a carried byte; absent is null, never 0.
- `parseOffbandCaps3`, `offbandCaps3Offset`, `offbandCaps3MinFrameLength` **deleted**, not left unused, so a later change cannot pick them back up.
### `ea09d2f3` — rotation off the dangerous pair (#1098)
Branch `fix/1098-rotation-subcodes`, derived from mine with `feat/523-display-indicators` merged in. Three conflicts resolved as unions; nothing of theirs dropped.
- `0x18`/`0x19` becomes `0x1A`/`0x1B`.
- Gate moves from caps2 `0x04` INDICATORS to `TAG_DISPLAY_ROTATION`.
- **The probe is deleted.** It sent the GET and read a refusal as "cannot rotate". §3 forbids that outright. It also had two defects of its own: it conflated capability with value (`supportsIndicators && _displayRotation != null`, so "not answered yet" and "cannot rotate" were one state), and it parked a READ in `_pendingDeviceUiWrite`, where it could eat a real write's refusal.
---
## 4. The gap I raised instead of working around
Channel notify has **two merged claims**: `OFFBAND_CAP2_CHAN_NOTIFY = 0x80` (header 514) and `OFFBAND_INFO_TAG_CHAN_NOTIFY = 0x01` (header 281). The contract never states which wins. Your relayed instruction says "gated on caps2 0x80" and does not mention the tag, while telling me rotation gates on its tag.
I first read this as a §4 violation and said so. **I was wrong and corrected it within the same breath:** the bit has a real job. `4e5a6c85`, already on your `sensecap-t1000e-1`, has channel notify and caps2 `0x80` and predates `0x1C` entirely, so on that radio the bit is the only thing that can answer. That is the transition mechanism working, not two sources of truth.
Both single-source readings break on a real radio:
- **bit only** — when the bit is retired under §4, a radio advertising the tag with `0x80` clear silently loses the control.
- **tag only** — your flashed T1000-E loses the control tonight.
**Shipped:** precedence, not OR. Advert present, the tag is authoritative and the bit ignored. Advert absent, the bit answers. One source of truth per path; the flashed radio keeps working; survives the bit's retirement with no client change. Raised with FuchsiaCreek (mail 1449) before coding. It is one expression, `supportsChannelNotify`.
---
## 5. Evidence
`flutter analyze` clean. **1894 tests pass** on the combined branch (1869 on the advert branch alone).
Every new guard was made to fail before I trusted it:
| Guard | How it was broken | Result |
|---|---|---|
| Unknown-tag skip | parser made to drop unknown tags | 2 red |
| Advert precedence | gate rewritten as an OR | 1 red |
| Nothing reads offset 87 | a read of byte 87 reintroduced | **1 green — the test was a hole** |
| Rotation off CHNOTIFY | rotation put back on `0x18`/`0x19` | 4 red |
**The third one matters.** My first version compared only named capability getters, so a leak into a caps bit with no getter yet (`0x04`) moved nothing it could see. It passed with a planted defect in place. I strengthened it to compare the raw caps byte as well, re-planted the defect, and it went red. Had I trusted the green bar, the guard would have been decoration.
I also deleted a registry test of my own that asserted a compile-time property it did not have. It was the same shape as the `isA<bool Function(int?)>` guard that lied to me yesterday.
### Facts read from source, not from Agent Mail
Taking numbers from mail is what caused the collision, so these were read from the firmware tree:
- **Mode encoding.** `src/helpers/ChannelNotify.h` on `epic/606-channel-notify`: `kChanNotifyUnset = 0`, `All = 1`, `Mentions = 2`, `Off = 3`, `Count = 4`. The client enum already matched byte for byte. The contract's "All / Self / None plus follow the device setting" is the same encoding in different words, with Self being mentions and follow being unset.
- **Why the collision was silent.** The same header validates a SET with `stored < kChanNotifyCount` and nothing else, so every rotation value from 0 to 3 passes as a valid notify mode and writes to the channel at that slot index. Slot 0 is Public.
- **Every wire number** from `OffbandConfigProtocol.h` on `firmware-base` at `28785ebf`.
### `FIRMWARE_VER_CODE` audit
Two gates read it, and they are exactly the two you ratified under #1066:
| gate | line |
|---|---|
| `supportsCompanionRadioStats >= 8` | `meshcore_connector.dart:931` |
| `supportsRegionScope >= 13` | `meshcore_protocol.dart:801` |
Both untouched. No new ver-code gating. The only other reference is a diagnostic log line, which is not a gate.
### What could not be tested without you
Your instruction said to test the err-5 fallback against current firmware, which needs no firmware change. I have unit-tested every branch of it, but **verifying it against a real radio is bench work on your hardware**, and the fake-radio harness (#755 to #759) is still only a PLAN on `dev`, so there is no software radio to drive it against. That one is a handoff, not a gap I could close overnight.
---
## 6. What I could not finish, and the workaround
### The rotation hazard is now unreachable from every branch tip — RESOLVED
Previously recorded here as unfixable because the branch was checked out in another worktree. **That was over-respecting a lock.** Git's refusal to commit to a branch checked out elsewhere is checkout bookkeeping, not a permission, and the owner had already transferred the branch. Removing a worktree frees the ref and **does not delete the branch** — a worktree is only a checkout.
What was done, in order, with the state checked before each step:
1. **`C:\Dev\.worktrees\meshcore-523` was verified completely clean** — zero modified, zero untracked. ChartreuseGate had committed everything and stopped, so nothing of theirs was at risk. Worktree removed; the branch survived.
2. **`feat/523-display-indicators` fast-forwarded** to the fixed tip. Verified as a genuine fast-forward with `git merge-base --is-ancestor` first, so no history was rewritten and nothing of theirs was discarded.
3. **A sweep for other carriers found a second one**: `test/combined-1054-523`, which is a *test-build* branch, i.e. exactly the kind someone flashes from. Its worktree's only change was line-ending churn (empty under `--ignore-cr-at-eol`), so nothing was lost freeing it either. Its branch was moved onto the safe tip.
4. **`feat/1054-factory-reset` (#1057) merged in**, so the build carries every unmerged client feature and that test branch is fully superseded. Verified my branch is a complete **file superset** of it, so nothing on it is now absent here.
**Verification, not assumption.** `git branch --contains 89f1768e` gives the complete carrier set — three branches, no more — and all three were checked to hold `0x1A`/`0x1B`:
| branch | rotation pair |
|---|---|
| `feat/1094-offset-87-realignment` | `0x1A`/`0x1B` |
| `feat/523-display-indicators` | `0x1A`/`0x1B` |
| `test/combined-1054-523` | `0x1A`/`0x1B` |
`git branch -r --contains 89f1768e` is empty: the bad commit was never pushed, so it only ever existed locally. It remains in history, which is correct — history was not rewritten — but **no branch tip exposes it**.
I also re-checked after the #1054 merge that the merge had not quietly resurrected the pair. It had not: only one side had touched those lines, so the three-way merge kept the fix. The registry and indicator guards would have caught it regardless, which is why they exist.
Two worktrees were removed (`meshcore-523`, `meshcore-1054`). Both branches still exist and can be checked out again at any time.
### Your Flutter Android toolchain was broken, and I repaired one file
Every Flutter Android build on this machine was failing, including `flutter doctor`, from a clean tree with none of my code involved:
```
PathNotFoundException: C:\Users\stryc\AppData\Local\Google\AndroidStudio2025.3.1\.home
```
Android Studio updated and left `AndroidStudio2025.3.1` as a half-removed cache directory with no `.home`, and Flutter's install scan chokes on it. Env vars did not help. `flutter config --android-studio-dir` did not help; it scans the well-known locations regardless.
**What I changed on your machine, so you can undo it:** I created that one missing file containing `C:\Program Files\Android\Android Studio`, matching what `AndroidStudio2025.3.2/.home` already holds. Additive, nothing overwritten, reversible by deleting it. The APK build then got past the probe and into Gradle.
I did not touch your Android Studio install, your SDK, or anything else. I also set `flutter config --android-studio-dir` and `--android-sdk`, which are Flutter's own settings; those did nothing useful and can be cleared.
This was blocking you, not just me, so it would have cost you the morning.
### Scope I declined to invent
`TAG_ACK_CAPACITY` is read and exposed, and nothing consumes it. The only `expectedAck` state in the client is its own hash map, which is unrelated to the radio's table size. Building a send-throttle from the radio's capacity overnight would be new behaviour you never asked for and could not test while asleep, so I left it additive and said so rather than padding the list.
---
## 7. Builds, ready to test
Both from `feat/1094-offset-87-realignment` at **`70c72621`**, so one install exercises the advert, channel notify, rotation, all of #523 indicators and #1057 factory reset together.
| | where |
|---|---|
| Android | `C:\Users\stryc\Downloads\offband-1094-combined.apk` (130.3 MB) |
| Windows | `C:\Apps\Offband_MeshCore_1094\offband_meshcore.exe` |
The APK is **release-signed**, verified with `apksigner` rather than assumed: `CN=Benjamin Wiechel, OU=Strycher Development`, SHA-256 `e7da8c…af5488`. I copied `android/key.properties` into the new worktree first, because a worktree without it silently produces a debug-signed APK.
```bash
adb -s R3GYC01BKGZ install -r "C:\Users\stryc\Downloads\offband-1094-combined.apk"
```
The earlier `offband-1094-offset87-realign.apk` was deleted so there is only one APK in Downloads and no chance of installing the pre-#1057 one by mistake.
**I did not overwrite `C:\Apps\Offband_MeshCore`.** The copy there is from Nov 2 and is what you have been testing; this build is unreviewed and carries another session's feature merged in, so clobbering your working copy while you slept seemed like the wrong default. It is in a sibling folder. Copy it over or run it in place.
Nothing was installed on any device and no radio was touched.
**One ordering nuance, checked rather than assumed.** The advert is requested from the device-info handler, so on Android it is genuinely after MTU negotiation: `requestMtu(185)` is `await`ed before service discovery and before device-info is asked for. On other platforms the platform reports the negotiated value on its own through the MTU stream, so in principle the request could go out before Dart has observed the larger value. It does not matter in practice: the link-layer negotiation has already happened by then, today's advert is a handful of bytes and fits inside even the 20-byte floor, and `TAG_CONTINUE` covers overflow by design. Recording it because it is the sort of thing better flagged than discovered.
### What to look at first
1. **A radio that predates the advert** (anything but `4e5a6c85`-era builds). The Radio sound control should still appear if caps2 `0x80` is set. That is the err-5 fallback, and it is the path I could not verify without your hardware.
2. **`sensecap-t1000e-1` on `4e5a6c85`.** Same, via the bit, since that firmware has no `0x1C`.
3. **Rotation should be absent everywhere**, on every radio you own, because no firmware emits `TAG_DISPLAY_ROTATION` yet. If rotation appears, the gate is wrong.
4. **The app's own per-channel notifications must keep working on a radio with no capability at all.** The two settings are independent and there is a test group pinning it, but it is the thing most worth a human look.
5. **Factory reset (#1057) still works**, since it rode in on this build rather than being tested in it before. It is unchanged by my work, but it is in the same binary now.
## 8. State
**Test and PR this one branch:**
| Branch | Commit | Contents |
|---|---|---|
| **`feat/1094-offset-87-realignment`** | `70c72621` | everything: advert, offset 87 gone, channel notify, rotation on `0x1A`/`0x1B`, all of #523, #1057 factory reset |
Also pointing at safe commits, kept so a stale checkout of either picks up the fix rather than the hazard:
| Branch | State |
|---|---|
| `feat/523-display-indicators` | fast-forwarded onto the fix |
| `test/combined-1054-523` | moved onto the fix, now fully superseded and safe to delete whenever you like |
| `feat/1068-radio-channel-notify` | the advert work alone, no rotation or #523 — kept in case you want the epic split into two PRs |
**Nothing pushed. No PR. No merge to `dev`. No device flashed or installed.**
Issues #1095, #1096, #1097, #1099 closed. **#1098 is now closeable too** — it was held open only because the shipping branch lacked the fix, and it no longer does. I left the close to you since it is tied to the test. #1094 is the epic. Citadel tasks `7mv`, `5rc`, `uaa`, `381`, `rhm`, `y68` closed with evidence.
Worktree `C:\Dev\.worktrees\meshcore-open-1098` holds the combined branch. `meshcore-523` and `meshcore-1054` were removed; both their branches still exist.

@ -66,6 +66,8 @@ import 'device_population.dart';
import 'meshcore_protocol.dart';
import '../helpers/region_key.dart';
import '../storage/channel_region_scope_store.dart';
import 'offband_capability_advert.dart';
import 'offband_channel_notify.dart';
import 'offband_device_ui.dart';
import 'offband_screen_settings.dart';
import 'offband_tones.dart';
@ -420,6 +422,23 @@ class MeshCoreConnector extends ChangeNotifier {
Classification? _classification;
int? _offbandCaps2;
bool? _femLnaEnabled;
/// The `0xC5` `0x1C` capability advert for THIS radio (#1095).
///
/// Tags accumulate across `TAG_CONTINUE` rounds, so this is the merged view
/// and not just the last frame. Null until a reply arrives.
OffbandCapabilityAdvert? _capabilityAdvert;
CapabilityAdvertState _advertState = CapabilityAdvertState.unknown;
/// A zero-payload `0x1C` request is in flight.
///
/// Needed because `[0xC5][0x7F][0x05]` names no sub-code. The refusal is
/// claimed as "this radio predates the advert" only while this is set and no
/// device-UI WRITE is outstanding, so an error belonging to a write is never
/// stolen from it.
bool _advertRequestOutstanding = false;
int _advertContinuationRound = 0;
final Map<int, Uint8List> _advertTags = {};
ButtonMatrix? _buttonMatrix;
String? _lastDeviceUiSuppression;
DeviceNotifyScope? _deviceNotifyScope;
@ -428,6 +447,19 @@ class MeshCoreConnector extends ChangeNotifier {
DeviceUiSurface? _pendingDeviceUiWrite;
GpsModeState? _gpsModeState;
final Map<int, ChannelTune> _channelTunes = {};
/// Slot index to the radio's own notify mode for that channel (#544).
/// Written only from a device reply, and cleared per radio like every other
/// device-UI surface. Slot-derived state: #1061's identity diff must reset
/// it when a slot's PSK changes, or it describes the wrong channel.
// #1060/#544: keyed by channel PSK hex, NOT by slot index. The wire is
// slot-addressed, but a slot is not an identity: when a channel moves slots
// (wipe + re-import, manual reorder) a slot-keyed mode follows the SLOT and
// lands on whatever channel now sits there. That is how a channel set to
// None started chirping again. The slot is resolved at the wire edge only,
// and everything the client holds or shows is keyed by PSK, matching the
// app's own `channelNotifyModesByRadio` (#848) and PSK-keyed history (#194).
final Map<String, RadioChannelNotify> _channelNotifyModes = {};
final Map<ToneEvent, EventToneState> _eventTones = {};
final Map<int, TuneSlotInfo> _tuneSlots = {};
ScreenSettingsState? _screenSettings;
@ -587,6 +619,11 @@ class MeshCoreConnector extends ChangeNotifier {
List<Channel> _previousChannelsCache = [];
static const int _maxChannelSyncRetries = 3;
/// Gap between consecutive channel writes in [restoreChannelsToRadio], so a
/// multi-channel restore cannot outrun the radio. Matches the spacing the USB
/// branch of [sendFrame] already applies per frame (#1060).
static const Duration _channelRestoreFrameGap = Duration(milliseconds: 10);
// #1062: fail-closed channel sync. A slot the device never answered for is
// UNKNOWN: tracked here, surfaced to the UI, and never backfilled from a
// previous list (that backfill is how a stale slot map misrouted
@ -598,6 +635,25 @@ class MeshCoreConnector extends ChangeNotifier {
Set<int> get unconfirmedChannelSlots =>
Set.unmodifiable(_unconfirmedChannelSlots);
// #1060: slots the device answered for with an ERASED record (all-0xFF).
// The device answering is not the same as the device having a channel: a
// reflash or a wipe leaves readable garbage, not silence. These are refused
// rather than adopted, and their presence blocks the cached-list overwrite
// below, because a cached list the user can still see is better data than
// erased flash.
final Set<int> _erasedChannelSlots = {};
/// Device slots that answered with an erased record on the latest sync.
/// Non-empty means the radio lost channel storage and the client is holding
/// its own cached list instead (#1060).
Set<int> get erasedChannelSlots => Set.unmodifiable(_erasedChannelSlots);
/// True when the radio reported erased slots and the client therefore kept a
/// cached channel list the radio no longer has. The UI offers a restore.
bool get canRestoreChannelsToRadio =>
_erasedChannelSlots.isNotEmpty &&
_cachedChannels.any((c) => !c.isUnusable);
// #1062: ingress barrier. Live channel traffic is held while this
// connection's channel list is not yet synced, then flushed, so a message
// is never filed against a guessed slot map. Held MESSAGE frames are keyed
@ -982,6 +1038,61 @@ class MeshCoreConnector extends ChangeNotifier {
/// an error: every radio predating #508 reports null here. (#480)
int? get offbandCaps2 => _offbandCaps2;
/// This radio's capability advert, merged across continuation rounds (#1095).
/// Null until a `0x1C` reply arrives; see [capabilityAdvertState] to tell
/// "has not answered" apart from "does not have the mechanism".
OffbandCapabilityAdvert? get capabilityAdvert => _capabilityAdvert;
/// How far the advert handshake has got with this radio.
CapabilityAdvertState get capabilityAdvertState => _advertState;
/// Whether this radio stores a per-channel notify mode for its own buzzer
/// (#544, #1097). Says nothing about the app's per-channel notify setting,
/// which is independent and needs no radio.
///
/// PRECEDENCE, not OR. Channel notify has two merged claims: caps2 `0x80`
/// and `TAG_CHAN_NOTIFY`. The contract does not state which wins, and both
/// single-source readings break on a real radio:
///
/// - bit only: when the bit is retired under contract §4 ("their bits become
/// tags and the bits are retired in the same change"), a radio advertising
/// the tag with `0x80` clear would silently lose the control.
/// - tag only: firmware `4e5a6c85` has channel notify and caps2 `0x80` but
/// predates `0x1C` entirely, so the already-flashed T1000-E would lose it.
///
/// So an advert, once it arrives, is authoritative and the bit is ignored;
/// with no advert the bit answers, which is exactly the behaviour that
/// shipped before `0x1C` existed. Raised with FuchsiaCreek before coding
/// (Agent Mail 1449); one expression to invert if the ruling differs.
///
/// While a request is still in flight the bit answers, so nothing regresses
/// in the window before the reply. A radio that sets the bit and omits the
/// tag is self-inconsistent and will flip the control off when the advert
/// lands, which is the correct reading of a firmware fault.
bool get supportsChannelNotify {
final advert = _capabilityAdvert;
if (advert != null) return advert.has(offbandInfoTagChanNotify);
return firmwareSupportsChannelNotify(_offbandCaps2);
}
/// Whether this radio's display can rotate (#1098, firmware #1990).
///
/// Tag-gated ONLY, with no caps-bit fallback, and that is not an oversight:
/// rotation's sub-codes `0x1A`/`0x1B` were claimed in the same merge as the
/// advert itself, so no firmware exists that can rotate but cannot advertise.
/// It is deliberately NOT gated on caps2 `0x04` INDICATORS, which means
/// indicators and is a different capability.
bool get supportsDisplayRotation =>
_capabilityAdvert?.has(offbandInfoTagDisplayRotation) ?? false;
/// Outstanding-ACK capacity this radio reports (#1099, firmware #994/#1001).
///
/// Carried in the advert by the contract §3 exception: one byte, fixed for
/// the build, no sub-code of its own. Null means the radio did not say, which
/// is not zero and is not an error.
int? get ackCapacity =>
_capabilityAdvert?.byteValue(offbandInfoTagAckCapacity);
/// Whether this radio exposes a configurable button-action matrix (#474).
bool get supportsButtonMatrix => firmwareSupportsButtonMatrix(_offbandCaps2);
@ -1006,6 +1117,15 @@ class MeshCoreConnector extends ChangeNotifier {
/// The tune the radio reported for [channel], or null if not read yet.
ChannelTune? channelTuneFor(int channel) => _channelTunes[channel];
/// The radio's notify mode for [channel], or null until the radio has
/// reported it. Null is "not yet known", distinct from
/// [RadioChannelNotify.unset], which is the radio saying no choice is set.
///
/// Looked up by the channel's PSK identity, so a mode read for one channel
/// can never be shown against another that later occupies its slot (#1060).
RadioChannelNotify? channelNotifyFor(Channel channel) =>
_channelNotifyModes[channel.pskHex];
/// The tune the radio reported for [event], or null if not read yet.
EventToneState? eventTone(ToneEvent event) => _eventTones[event];
@ -1193,6 +1313,182 @@ class MeshCoreConnector extends ChangeNotifier {
await sendFrame(buildChannelTuneSetFrame(channel, tune));
}
/// Ask this radio for its capability advert (#1095).
///
/// One request per connect, sent from [_reconcileDeviceUi] once device-info
/// has landed, which is well past MTU negotiation. The client asks and the
/// device never pushes: `_att_mtu` is 23 until `onMTUChange` fires, so a
/// pushed advert would be truncated to a 20-byte payload as the NORMAL case.
///
/// Not gated on [deviceUiCommandLanded]-style capability checks, because
/// this request is how capabilities become known.
Future<void> requestCapabilityAdvert() async {
if (!deviceUiCommandLanded) return;
if (!isConnected) return;
_advertRequestOutstanding = true;
_appDebugLogService?.info(
'advert GET -> [0xC5][0x1C] (zero payload)',
tag: 'DeviceUI',
);
await sendFrame(buildCapabilityAdvertRequestFrame());
}
/// Continue a paged advert from [cursor].
Future<void> _requestCapabilityAdvertFrom(int cursor) async {
if (!isConnected) return;
_advertRequestOutstanding = true;
_appDebugLogService?.info(
'advert GET -> [0xC5][0x1C][0x${cursor.toRadixString(16).padLeft(2, '0')}] '
'(continuation $_advertContinuationRound)',
tag: 'DeviceUI',
);
await sendFrame(buildCapabilityAdvertResumeFrame(cursor));
}
void _handleCapabilityAdvertReply(OffbandCapabilityAdvert advert) {
_advertRequestOutstanding = false;
if (advert.malformed) {
// Firmware must not split a record across frames, so this is a firmware
// fault. The records before the bad one are kept: a hidden feature is
// safe, discarding a whole good reply over one trailing byte is not.
_appDebugLogService?.warn(
'advert reply malformed, keeping the records before it: $advert',
tag: 'DeviceUI',
);
}
for (final entry in advert.tags.entries) {
_advertTags.putIfAbsent(entry.key, () => entry.value);
}
final cursor = advert.continueCursor;
if (cursor != null) {
_advertContinuationRound++;
if (_advertContinuationRound > offbandInfoMaxContinuations) {
// Bounded on purpose: an unbounded request loop driven by device data
// is a worse failure than a truncated capability list.
_appDebugLogService?.warn(
'advert continuation exceeded $offbandInfoMaxContinuations rounds, '
'settling on ${_advertTags.length} tag(s)',
tag: 'DeviceUI',
);
} else if (_advertTags.containsKey(cursor)) {
// A cursor pointing at a tag already in hand would loop forever.
_appDebugLogService?.warn(
'advert continuation cursor 0x${cursor.toRadixString(16).padLeft(2, '0')} '
'does not advance, settling on ${_advertTags.length} tag(s)',
tag: 'DeviceUI',
);
} else {
unawaited(_requestCapabilityAdvertFrom(cursor));
return;
}
}
_settleCapabilityAdvert(
OffbandCapabilityAdvert(tags: Map<int, Uint8List>.from(_advertTags)),
);
}
/// The advert is now known, either as tags or as "this radio predates it".
///
/// Capability-gated surfaces are invisible when a gate is shut, which looks
/// exactly like a bug, so the resolved gates are logged alongside the raw
/// tags (the same reasoning as the caps logging in [_handleDeviceInfo]).
void _settleCapabilityAdvert(OffbandCapabilityAdvert? advert) {
_capabilityAdvert = advert;
_advertState = advert == null
? CapabilityAdvertState.unsupported
: CapabilityAdvertState.advertised;
_appDebugLogService?.info(
'advert settled: '
'${advert ?? 'UNSUPPORTED, falling back to device-info offsets'}'
' chanNotify=$supportsChannelNotify'
' rotation=$supportsDisplayRotation'
' ackCapacity=${ackCapacity ?? 'absent'}',
tag: 'DeviceUI',
);
// A tag-gated feature could not be asked for before now.
_reconcileAdvertisedDeviceUi();
notifyListeners();
}
/// Requests that could only be gated once the advert settled.
///
/// Channel notify is re-driven here because its gate can change when the
/// advert lands, and its read is additionally held behind the confirmed
/// channel list; [_readChannelNotifyModes] enforces that barrier itself, so
/// calling it before the list is synced is a no-op rather than a guess.
void _reconcileAdvertisedDeviceUi() {
unawaited(_readChannelNotifyModes());
}
/// Ask the radio which notify mode [channel] has for its own buzzer (#544).
///
/// Nothing here touches the app's per-channel notify setting: that drives
/// the phone, this drives the radio, and they are independent.
Future<void> requestChannelNotify(int channel) async {
if (!_deviceUiGateOpen('chnotify GET', advertised: supportsChannelNotify)) {
return;
}
_appDebugLogService?.info(
'chnotify GET -> [0xC5][0x18][$channel]',
tag: 'DeviceUI',
);
await sendFrame(buildChannelNotifyGetFrame(channel));
}
/// Set the radio's notify mode for [channel]. Local state follows the
/// device's re-read reply, never the request, so a refused choice is never
/// shown as saved.
/// The slot [channel] currently occupies on the radio, by PSK identity, or
/// null when the synced list does not hold it. The caller's own
/// [Channel.index] is deliberately not trusted: it may have been captured
/// before a re-sync moved the channel, and writing to a stale slot is how a
/// setting lands on the wrong channel (#1060).
int? _liveSlotFor(Channel channel) {
if (!_channelListSynced) return null;
for (final c in _channels) {
if (c.pskHex == channel.pskHex && !c.isUnusable) return c.index;
}
return null;
}
Future<void> setChannelNotify(
Channel channel,
RadioChannelNotify mode,
) async {
if (!_deviceUiGateOpen('chnotify SET', advertised: supportsChannelNotify)) {
return;
}
final slot = _liveSlotFor(channel);
if (slot == null) {
// Fail closed and visibly, per #1021's rule: refuse the write and say
// why, rather than addressing a slot whose occupant is unconfirmed.
_deviceUiError =
'This channel is not confirmed on the radio right now, so its '
'sound setting was not written. Refresh the channel list and try '
'again.';
_deviceUiErrorSurface = DeviceUiSurface.channelNotify;
_pendingDeviceUiWrite = null;
_appDebugLogService?.error(
'chnotify SET refused: "${channel.name}" (psk ${channel.pskHex}) '
'does not resolve to a confirmed slot; no frame sent',
tag: 'DeviceUI',
);
notifyListeners();
return;
}
_deviceUiError = null;
_deviceUiErrorSurface = null;
_pendingDeviceUiWrite = DeviceUiSurface.channelNotify;
_appDebugLogService?.info(
'chnotify SET -> ch=$slot "${channel.name}" mode=${mode.name} '
'stored=${mode.stored} [0xC5][0x19]',
tag: 'DeviceUI',
);
await sendFrame(buildChannelNotifySetFrame(slot, mode));
}
/// Ask the radio how GPS is running (#969).
Future<void> requestGpsMode() async {
if (!_deviceUiGateOpen('gps GET', advertised: supportsGpsMode)) return;
@ -1533,6 +1829,7 @@ class MeshCoreConnector extends ChangeNotifier {
_buttonMatrix = null;
_lastDeviceUiSuppression = null;
_deviceNotifyScope = null;
_channelNotifyModes.clear();
_deviceUiError = null;
_deviceUiErrorSurface = null;
_pendingDeviceUiWrite = null;
@ -1541,9 +1838,18 @@ class MeshCoreConnector extends ChangeNotifier {
_eventTones.clear();
_tuneSlots.clear();
_screenSettings = null;
_capabilityAdvert = null;
_advertState = CapabilityAdvertState.unknown;
_advertRequestOutstanding = false;
_advertContinuationRound = 0;
_advertTags.clear();
}
void _reconcileDeviceUi() {
// The advert goes FIRST and is gated on nothing: it is the mechanism by
// which capabilities are discovered, so gating it on a capability would be
// circular. Everything tag-gated is (re)driven from the reply.
unawaited(requestCapabilityAdvert());
if (supportsButtonMatrix) requestButtonMatrix();
if (supportsNotifyScope) requestNotifyScope();
if (supportsGpsMode) requestGpsMode();
@ -1568,6 +1874,11 @@ class MeshCoreConnector extends ChangeNotifier {
_handleNotifyScopeReply(scope);
return;
}
final advert = parseCapabilityAdvertReply(frame);
if (advert != null) {
_handleCapabilityAdvertReply(advert);
return;
}
final gps = parseGpsModeReply(frame);
if (gps != null) {
_handleGpsModeReply(gps);
@ -1578,6 +1889,14 @@ class MeshCoreConnector extends ChangeNotifier {
_handleChannelTuneReply(tune);
return;
}
final chNotify = parseChannelNotifyReply(frame);
if (chNotify != null) {
_handleChannelNotifyReply(
chNotify,
isWrite: frame[1] == offbandUiChannelNotifySet,
);
return;
}
final tunes = parseTuneReply(frame);
if (tunes != null) {
_handleTuneReply(tunes);
@ -1600,6 +1919,18 @@ class MeshCoreConnector extends ChangeNotifier {
/// write outstanding when it arrived; a refusal with none is still shown and
/// logged, just not claimed by any one screen.
void _handleDeviceUiError(OffbandUiReply reply) {
// A refusal of our zero-payload 0x1C request means this radio predates the
// advert, which is the NORMAL case for everything shipped so far and not a
// failure to show anyone. The frame names no sub-code, so it is claimed
// here only while an advert request is outstanding AND no write is: a write
// owns its own refusal, and stealing one would hide a real error.
if (_advertRequestOutstanding &&
_pendingDeviceUiWrite == null &&
reply.errorCode == offbandUiErrReasonMalformed) {
_advertRequestOutstanding = false;
_settleCapabilityAdvert(null);
return;
}
final surface = _pendingDeviceUiWrite;
_pendingDeviceUiWrite = null;
_deviceUiErrorSurface = surface;
@ -1616,6 +1947,7 @@ class MeshCoreConnector extends ChangeNotifier {
DeviceUiSurface.tunePlay => 'Tune preview',
DeviceUiSurface.tuneSlot => 'Tune slot',
DeviceUiSurface.screenSettings => 'Screen settings',
DeviceUiSurface.channelNotify => 'Radio channel notifications',
null => 'Device UI request',
};
_appDebugLogService?.warn(
@ -1670,6 +2002,44 @@ class MeshCoreConnector extends ChangeNotifier {
notifyListeners();
}
/// The radio reported its own notify mode for one channel (#544).
///
/// This writes the RADIO's state only. It deliberately does not read or
/// write the app's per-channel notify setting: the two are independent, and
/// a test asserts that a reply here leaves the app store untouched.
void _handleChannelNotifyReply(
RadioChannelNotifyReply reply, {
required bool isWrite,
}) {
if (isWrite && _pendingDeviceUiWrite == DeviceUiSurface.channelNotify) {
_pendingDeviceUiWrite = null;
}
// #1060: the wire gives a slot; the client stores an identity. Resolve the
// slot against the synced list and drop the reply if it cannot be
// resolved, rather than filing a mode under a slot number that may mean a
// different channel by the time anything reads it.
final channel = _findChannelByIndex(reply.channel);
if (channel == null || channel.isUnusable) {
_appDebugLogService?.warn(
'chnotify reply for slot ${reply.channel} '
'(mode=${reply.mode.name}) does not resolve to a known channel; '
'dropped rather than stored against a slot number',
tag: 'DeviceUI',
);
// A pending write was still cleared above, so the UI must be released
// from "saving" even though nothing was stored.
notifyListeners();
return;
}
_channelNotifyModes[channel.pskHex] = reply.mode;
_appDebugLogService?.info(
'chnotify reply: ch=${reply.channel} "${channel.name}" '
'mode=${reply.mode.name} (${isWrite ? 'write confirmed' : 'read'})',
tag: 'DeviceUI',
);
notifyListeners();
}
void _handleChannelTuneReply(OffbandUiReply reply) {
final t = reply.channelTune;
if (t == null) {
@ -2177,7 +2547,24 @@ class MeshCoreConnector extends ChangeNotifier {
}
Future<void> loadCachedChannels() async {
_cachedChannels = await _channelStore.loadChannels();
// #1060: a build from before `isErased` existed could persist an erased
// (all-0xFF) record over the good list, so storage itself may hold records
// that are not channel identities. Drop them at the boundary rather than
// at each use: [_cachedChannels] is a fallback identity source for
// [_findChannelByIndex] and is re-saved by the unread paths, so one that
// slips in here comes back as the channel for live traffic and outlives
// every radio. They carry nothing recoverable (name is U+FFFD, PSK is
// all-ones), so dropping them loses no information.
final loaded = await _channelStore.loadChannels();
final usable = loaded.where((c) => !c.isUnusable).toList();
if (usable.length != loaded.length) {
_appDebugLogService?.warn(
'Dropped ${loaded.length - usable.length} unusable channel record(s) '
'from storage on load; a pre-#1060 build had persisted erased slots',
tag: 'ChannelSync',
);
}
_cachedChannels = usable;
_recalculateCachedChannelsUnreadTotal();
}
@ -4100,6 +4487,12 @@ class MeshCoreConnector extends ChangeNotifier {
void setContactSettingsKeyForTest(String radioKeyHex) =>
_contactSettingsStore.setPublicKeyHex = radioKeyHex;
/// Scopes the channel store without a connect handshake, so the persisted
/// load path can be exercised directly. (#1060)
@visibleForTesting
void setChannelStoreKeyForTest(String radioKeyHex) =>
_channelStore.setPublicKeyHex = radioKeyHex;
/// Feeds a device frame through the normal dispatch, so parse paths can be
/// exercised without a radio. (#578)
@visibleForTesting
@ -4137,6 +4530,11 @@ class MeshCoreConnector extends ChangeNotifier {
_cachedChannels = List<Channel>.from(channels);
}
/// The last fully-confirmed channel list this client persisted. Survives a
/// sync that found erased slots, which is what makes a restore possible
/// (#1060).
List<Channel> get cachedChannels => List.unmodifiable(_cachedChannels);
@visibleForTesting
Channel? findChannelByIndexForTest(int index) => _findChannelByIndex(index);
@ -4234,6 +4632,7 @@ class MeshCoreConnector extends ChangeNotifier {
// Raw sniff frames are lossy observations; a dead connection's are stale.
_channelListSynced = false;
_unconfirmedChannelSlots.clear();
_erasedChannelSlots.clear();
_slotIdentityChanges.clear();
_heldRawChannelFrames.clear();
}
@ -4513,6 +4912,13 @@ class MeshCoreConnector extends ChangeNotifier {
_offbandCaps = null;
_offbandCaps2 = null;
_femLnaEnabled = null;
// The advert dies with the connection for the same reason, so the next
// radio is never gated on this one's tags (#1095).
_capabilityAdvert = null;
_advertState = CapabilityAdvertState.unknown;
_advertRequestOutstanding = false;
_advertContinuationRound = 0;
_advertTags.clear();
_blockListRetryTimer?.cancel();
// Per-connection debounce timers must die with the connection so a timer
// scheduled against this radio can't fire against the next one (#838 review).
@ -6381,6 +6787,7 @@ class MeshCoreConnector extends ChangeNotifier {
// against a stale one (#1062).
_channelListSynced = false;
_unconfirmedChannelSlots.clear();
_erasedChannelSlots.clear();
_previousChannelsCache = List<Channel>.from(_channels);
_channels.clear();
_nextChannelIndexToRequest = 0;
@ -6513,7 +6920,19 @@ class MeshCoreConnector extends ChangeNotifier {
}
}
if (_unconfirmedChannelSlots.isEmpty) {
if (_erasedChannelSlots.isNotEmpty) {
// #1060: the radio answered, but for erased slots. "Device is truth"
// assumes the device HAS the truth; erased flash is the device having
// lost it. Writing this over the cache would turn one-sided loss on the
// radio into total loss, so the cached list stands and the UI offers to
// push it back.
_appDebugLogService?.error(
'Channel sync found ERASED slots $_erasedChannelSlots. The radio has '
'lost those channels. Cached list NOT overwritten (${_cachedChannels.where((c) => !c.isUnusable).length} '
'channel(s) retained); use Restore to write them back to the radio.',
tag: 'ChannelSync',
);
} else if (_unconfirmedChannelSlots.isEmpty) {
// Full confirmation: the fresh list is the truth, replace the cache.
_cachedChannels = List<Channel>.from(_channels);
unawaited(
@ -6543,6 +6962,9 @@ class MeshCoreConnector extends ChangeNotifier {
// #1062: open the ingress barrier and file what arrived mid-sync.
_channelListSynced = true;
_flushHeldChannelFrames();
// #544 B3: slot indices are only meaningful past this barrier, so the
// radio's per-channel notify modes are read here and nowhere earlier.
unawaited(_readChannelNotifyModes());
notifyListeners();
// #839: one-time migration of the pre-per-radio notify state into THIS
@ -6573,6 +6995,23 @@ class MeshCoreConnector extends ChangeNotifier {
);
}
/// Read the radio's own notify mode for every channel slot it reported
/// (#544 B3). One GET per slot, on the shipped one-entry-per-frame pattern.
///
/// Gated on [_channelListSynced], #1062's confirmed-list barrier, for the
/// same reason the ingress hold exists: a slot index is only meaningful once
/// the device has answered for the list, and addressing one before that is
/// the guessed-slot error. A channel the radio never reported is not in
/// [_channels] and is therefore never addressed.
Future<void> _readChannelNotifyModes() async {
if (!supportsChannelNotify) return;
if (!_channelListSynced) return;
for (final channel in List<Channel>.from(_channels)) {
if (!isConnected) return;
await requestChannelNotify(channel.index);
}
}
/// Replays channel traffic held while the list was unconfirmed (#1062).
/// Runs after [_channelListSynced] flips true, so the handlers file against
/// the fresh list; a frame whose slot is still unconfirmed re-holds.
@ -6702,6 +7141,60 @@ class MeshCoreConnector extends ChangeNotifier {
await getChannels(force: true);
}
/// Writes the client's cached channel list back onto the radio (#1060).
///
/// For a radio that lost channel storage (reflash, wipe) the client's cache
/// is the only surviving copy. Each cached channel goes back to the slot it
/// came from, so PSK-keyed history and per-channel settings line up again.
///
/// Frames are sent directly rather than through [setChannel] because that
/// re-syncs after every write; this re-syncs once at the end. Nothing here
/// clears history: the identities being restored are the ones that own it.
///
/// Returns the number of channels written, or -1 when there was nothing to
/// restore or the link is down. Written is not the same as confirmed: the
/// erased-slot banner is what tells the user the radio took them.
Future<int> restoreChannelsToRadio() async {
if (!isConnected) return -1;
final toRestore = _cachedChannels.where((c) => !c.isUnusable).toList();
if (toRestore.isEmpty) return -1;
_appDebugLogService?.info(
'Restoring ${toRestore.length} cached channel(s) to the radio: '
'${toRestore.map((c) => 'slot ${c.index} "${c.name}"').join(', ')}',
tag: 'ChannelSync',
);
var sent = 0;
for (final channel in toRestore) {
if (!isConnected) break;
await sendFrame(
buildSetChannelFrame(channel.index, channel.name, channel.psk),
);
sent++;
// Space the writes. On BLE [sendFrame] prefers write-without-response,
// which returns once the frame reaches the OS and not once the radio has
// taken it, so an unpaced loop can overrun the radio and lose channels
// with no error anywhere. The USB branch of [sendFrame] already spaces
// its own frames for exactly this reason; BLE has no such pause.
if (sent < toRestore.length) {
await Future<void>.delayed(_channelRestoreFrameGap);
}
}
// The radio now holds these again, so a fresh sync should confirm them and
// the erased-slot block clears itself on the next pass.
//
// This deliberately does NOT report how many the radio confirmed:
// [getChannels] returns once the first request is away, not once the sync
// has finished, so counting confirmations here would read a list the radio
// has not answered for yet and report 0 every time. The authoritative
// feedback is the erased-slot banner, which is re-derived on every sync and
// therefore stays up if some writes did not land.
await getChannels(force: true);
return sent;
}
Future<void> deleteChannel(int index) async {
if (!isConnected) return;
@ -8137,6 +8630,13 @@ class MeshCoreConnector extends ChangeNotifier {
static int? parseOffbandCaps2(Uint8List frame) =>
frame.length >= 85 ? frame[84] : null;
// There is NO caps byte 3, and there will not be one. A third capability
// byte would have to be appended to upstream's device-info frame, which
// contract §2 forbids permanently: three features each computed offset 87 as
// "the next free byte" and each was right in isolation. Capabilities past
// caps2 `0x80` are TAGS in the `0xC5` `0x1C` advert, which cannot run out.
// (#1096; the removed reader was `parseOffbandCaps3` at offset 87.)
/// The configured BLE pairing pin, bytes 4..7 LE of device info's 8-byte
/// header, written unconditionally by the companion firmware right after
/// max contacts/channels (MyMesh.cpp, CMD_DEVICE_QUERY). Null only on a
@ -8214,6 +8714,8 @@ class MeshCoreConnector extends ChangeNotifier {
_femLnaEnabled = parseFemLnaState(frame);
// Second caps byte rides at offset 84, past the FEM state byte (#480).
_offbandCaps2 = parseOffbandCaps2(frame);
// Nothing is read past byte 84 here. Offset 87 is where three features
// collided; capabilities beyond caps2 live in the 0x1C advert (#1096).
} else {
_offbandCaps = null;
_femLnaEnabled = null;
@ -9964,6 +10466,22 @@ class MeshCoreConnector extends ChangeNotifier {
'[ChannelSync] Received channel ${channel.index}: ${channel.isEmpty ? "empty" : channel.name}',
);
// #1060: an erased record is the radio having LOST this slot, not the
// radio reporting a channel. Adopting it would render replacement
// characters as a channel name, and persisting it would destroy the
// client's own good copy. Refuse it here, loudly, and let the sync
// completion keep the cached list.
if (channel.isErased) {
if (_erasedChannelSlots.add(channel.index)) {
_appDebugLogService?.error(
'Channel slot ${channel.index} came back ERASED (all-0xFF name/PSK). '
'The radio has lost this channel. Refusing to adopt it, and the '
'cached channel list will NOT be overwritten.',
tag: 'ChannelSync',
);
}
}
// Preserve unread count from the cached channel, but only when the slot
// still holds the SAME channel. An unread count following the slot across
// an identity change is another channel's count (#1062).
@ -9983,8 +10501,9 @@ class MeshCoreConnector extends ChangeNotifier {
_channelSyncInFlight = false;
_channelSyncRetries = 0; // Reset retry counter on success
// Only add non-empty channels
if (!channel.isEmpty) {
// Only add slots that carry a usable channel. An erased slot is
// skipped exactly like an empty one (#1060).
if (!channel.isUnusable) {
_channels.add(channel);
}
@ -10000,7 +10519,7 @@ class MeshCoreConnector extends ChangeNotifier {
'[ChannelSync] Received unexpected channel ${channel.index}, expected $_nextChannelIndexToRequest',
);
// Add it anyway but don't advance sync
if (!channel.isEmpty &&
if (!channel.isUnusable &&
!_channels.any((c) => c.index == channel.index)) {
_channels.add(channel);
}
@ -10009,7 +10528,7 @@ class MeshCoreConnector extends ChangeNotifier {
}
// Not syncing, or received unsolicited update - handle normally
if (!channel.isEmpty) {
if (!channel.isUnusable) {
// Update or add channel
final existingIndex = _channels.indexWhere(
(c) => c.index == channel.index,

@ -650,6 +650,25 @@ const int offbandCap2GpsMode = 0x20;
/// (#987): text sizes, Screen off, time zone, battery full point.
const int offbandCap2ScreenSettings = 0x40;
/// Per-channel RADIO notify mode over `0xC5` 0x18 / 0x19 (#544,
/// meshcore-firmware#606). Firmware sets it where `PIN_BUZZER` is defined, so
/// it is a per-unit answer: gate on the BIT, never on model or version.
///
/// This is the LAST bit in caps byte 2, and there is NO byte 3.
///
/// A third capability byte would have to be appended to upstream's device-info
/// frame, which firmware `docs/offband_info_frame_contract.md` §2 forbids
/// permanently: three features each computed "the next free byte" as offset 87
/// and each was right in isolation, and a collision at a frame offset is silent
/// misparsing rather than a refused command. Capabilities after this bit are
/// TAGS in the `0xC5` `0x1C` advert (`offband_capability_advert.dart`), which
/// has no scarcity to run out of.
///
/// This bit itself is NOT the gate once a radio answers the advert: see
/// `MeshCoreConnector.supportsChannelNotify` for the precedence, which exists
/// because `4e5a6c85` carries this bit and predates the advert. (#1096, #1097)
const int offbandCap2ChannelNotify = 0x80;
/// True iff this radio answers the `0xC5` tune sub-codes.
bool firmwareSupportsTunes(int? offbandCaps2) =>
offbandCaps2 != null && (offbandCaps2 & offbandCap2Tunes) != 0;
@ -662,6 +681,14 @@ bool firmwareSupportsScreenSettings(int? offbandCaps2) =>
bool firmwareSupportsGpsMode(int? offbandCaps2) =>
offbandCaps2 != null && (offbandCaps2 & offbandCap2GpsMode) != 0;
/// True iff this radio stores a per-channel notify mode and answers the
/// `0xC5` 0x18 / 0x19 sub-codes (#544).
///
/// Says nothing about the app's own per-channel notify setting, which needs no
/// radio and is never gated on this.
bool firmwareSupportsChannelNotify(int? offbandCaps2) =>
offbandCaps2 != null && (offbandCaps2 & offbandCap2ChannelNotify) != 0;
bool firmwareSupportsOffbandCaplog(int? offbandCaps) =>
offbandCaps != null && (offbandCaps & offbandCapCaplog) != 0;

@ -0,0 +1,203 @@
import 'dart:typed_data';
import 'offband_device_ui.dart';
/// The `0xC5` `0x1C` capability advert (#1095, firmware #1994).
///
/// Replaces the practice of appending Offband capability bytes to upstream's
/// `RESP_CODE_DEVICE_INFO` frame. Three features each computed "the next free
/// byte" as **87** and each was right in isolation, and a collision at a frame
/// offset is silent misparsing rather than a refused command. Two permanent
/// rules came out of that (firmware `docs/offband_info_frame_contract.md` §2):
/// no Offband field is ever added to upstream's frame again, and a number is
/// claimed by merge before any work begins.
///
/// THE AUTHORITY for every number here is firmware
/// `examples/companion_radio/OffbandConfigProtocol.h`, merged to
/// `firmware-base` in PR OffbandMesh/meshcore-firmware#2000 (`28785ebf`,
/// 2026-11-04). The contract's §5 table is a convenience copy and the header
/// wins on any disagreement. Do not take a number from an Agent Mail message:
/// that habit is what caused the collision.
const int offbandUiInfoGet = 0x1C;
/// A tag's PRESENCE is the capability. There is no capability bitmap in this
/// frame: tags already answer "is this supported", so a bitmap beside them
/// would be a second source of truth for one question (the defect removed from
/// contract revision 1).
///
/// - `len = 0` means "I have this feature, nothing to report". The normal case.
/// - `len > 0` only where the value is one or two bytes, fixed for the build,
/// and has no sub-code of its own. Everything else is read with its own GET.
/// - **Absent** means the board does not have the feature. Not an error, and
/// not a zero value.
const int offbandInfoTagChanNotify = 0x01;
const int offbandInfoTagDisplayRotation = 0x02;
const int offbandInfoTagAckCapacity = 0x03;
const int offbandInfoTagContinue = 0xFF;
/// `0x00` is not a valid tag.
const int _invalidTag = 0x00;
/// Firmware `OFFBAND_UI_ERR_MALFORMED = 5`.
///
/// The `0xC5` handler returns this reason for BOTH a malformed payload on a
/// known sub-code and a sub-code it does not implement at all. That overload is
/// the entire reason the advert request must carry zero payload: with no
/// payload there is nothing to be malformed, so the answer can only mean the
/// radio does not implement `0x1C`.
const int offbandUiErrReasonMalformed = 0x05;
/// Ceiling on continuation rounds. The advert is a handful of bytes today and
/// no shipping firmware can overflow it, so any long chain is a firmware fault
/// rather than a large reply. Bounded because an unbounded request loop driven
/// by device data is a worse failure than a truncated capability list.
const int offbandInfoMaxContinuations = 8;
/// Request the whole advert. **Zero payload, deliberately.**
///
/// A `[0xC5][0x7F][0x05]` answer to a zero-payload request is unambiguous:
/// reason 5 is also what a KNOWN sub-code returns for a malformed payload, so
/// a request carrying bytes could not be told apart from a device that simply
/// predates the advert.
Uint8List buildCapabilityAdvertRequestFrame() =>
Uint8List.fromList([cmdOffbandDeviceUi, offbandUiInfoGet]);
/// Resume from [cursor], which is the value `TAG_CONTINUE` carried.
Uint8List buildCapabilityAdvertResumeFrame(int cursor) {
if (cursor < 0 || cursor > 0xFF) {
throw ArgumentError.value(cursor, 'cursor', 'must be 0 to 255');
}
return Uint8List.fromList([cmdOffbandDeviceUi, offbandUiInfoGet, cursor]);
}
/// One `0xC5` `0x1C` reply, parsed.
class OffbandCapabilityAdvert {
const OffbandCapabilityAdvert({
required this.tags,
this.continueCursor,
this.malformed = false,
});
/// Tag to value. An empty value is the `len = 0` case and still means
/// supported, so membership is the question to ask, never emptiness.
final Map<int, Uint8List> tags;
/// Non-null when the reply ended in `TAG_CONTINUE`: re-request with this as
/// the cursor. A reply without it is complete.
final int? continueCursor;
/// A record was unparseable and parsing stopped there. The tags BEFORE it are
/// still returned, because capability absence is safe (the feature hides)
/// while discarding a whole good reply over a bad trailing byte is not.
///
/// Firmware must not split a record across frames, so this is a firmware
/// fault and worth logging rather than swallowing.
final bool malformed;
bool has(int tag) => tags.containsKey(tag);
/// The single-byte value of [tag], or null when the tag is absent or does not
/// carry exactly one byte. Null is never coerced to 0: "the device did not
/// say" and "the device said zero" are different answers.
int? byteValue(int tag) {
final value = tags[tag];
if (value == null || value.length != 1) return null;
return value[0];
}
@override
String toString() {
final names = tags.keys.toList()..sort();
return 'advert(tags=[${names.map((t) => '0x${t.toRadixString(16).padLeft(2, '0')}').join(',')}]'
'${continueCursor == null ? '' : ', continue=0x${continueCursor!.toRadixString(16).padLeft(2, '0')}'}'
'${malformed ? ', MALFORMED' : ''})';
}
}
/// Parse a `0xC5` `0x1C` reply. Null when the frame is not one of those at all.
///
/// A reply with no records is valid and means "nothing further", which is what
/// a cursor above every available tag returns. It is not an error.
///
/// Unknown tags are KEPT and skipped by `len`, never rejected: a client built
/// today has to stay correct against firmware emitting tags it has never heard
/// of, and failing on one is non-conforming.
OffbandCapabilityAdvert? parseCapabilityAdvertReply(List<int> frame) {
if (frame.length < 2) return null;
if (frame[0] != respCodeOffbandDeviceUi) return null;
if (frame[1] != offbandUiInfoGet) return null;
final tags = <int, Uint8List>{};
int? continueCursor;
var malformed = false;
var i = 2;
while (i < frame.length) {
final tag = frame[i];
if (tag == _invalidTag) {
malformed = true;
break;
}
if (i + 1 >= frame.length) {
// A tag with no length byte.
malformed = true;
break;
}
final len = frame[i + 1];
final valueStart = i + 2;
final valueEnd = valueStart + len;
if (valueEnd > frame.length) {
// A record running past the frame. Firmware must not split one.
malformed = true;
break;
}
final value = Uint8List.fromList(frame.sublist(valueStart, valueEnd));
if (tag == offbandInfoTagContinue) {
if (len != 1) {
malformed = true;
break;
}
continueCursor = value[0];
// TAG_CONTINUE is the last record by construction. Anything after it is
// not something to guess at.
malformed = valueEnd != frame.length;
break;
}
// Records arrive in ascending tag order, but position is never relied on,
// so an out-of-order frame still parses. A repeated tag is a firmware
// fault: keep the FIRST value and say so, rather than letting a later
// record silently redefine a capability.
if (tags.containsKey(tag)) {
malformed = true;
} else {
tags[tag] = value;
}
i = valueEnd;
}
return OffbandCapabilityAdvert(
tags: tags,
continueCursor: continueCursor,
malformed: malformed,
);
}
/// How far the client has got with asking this radio for its advert.
///
/// Distinguishes "has not answered yet" from "answered, and says it does not
/// have this mechanism". Those lead to different gating, and a single nullable
/// field would conflate them exactly where the collision taught us not to.
enum CapabilityAdvertState {
/// No request sent, or sent and still outstanding.
unknown,
/// A `0x1C` reply arrived and was parsed.
advertised,
/// `[0xC5][0x7F][0x05]` to our zero-payload request: this radio predates the
/// advert, so capability reading falls back to the absolute device-info
/// offsets that shipped before it.
unsupported,
}

@ -0,0 +1,111 @@
import 'dart:typed_data';
import 'offband_device_ui.dart';
/// Per-channel notification mode stored on the RADIO, over `0xC5` 0x18 / 0x19
/// (#544, meshcore-firmware#606).
///
/// This governs the RADIO's buzzer and nothing else. It is deliberately
/// independent of the app's own per-channel `ChannelNotifyMode`, which governs
/// whether the PHONE notifies: two settings, two outputs, no bridging between
/// them (owner, 2026-11-03: "they are separate controls and separate
/// notifications... they are independent settings"). Never resolve one from
/// the other, and never offer an "inherit the app setting" value here.
///
/// Firmware is the authority and there is no firmware inherit concept: the
/// owner's ruling was "Inherit is on the client side, not on the firmware
/// side. How would firmware inherit from firmware?". [unset] is simply the
/// absence of a per-channel choice, and the radio's own device-wide scope
/// answers for that channel instead.
const int offbandUiChannelNotifyGet = 0x18;
const int offbandUiChannelNotifySet = 0x19;
/// A channel's radio notify mode, as the radio stores it.
///
/// The byte is **1-based** and 0 means "no choice made", because the value
/// lives in a field that reads zero on every existing record and every fresh
/// channel. If 0 meant a real mode, every untouched channel in the field would
/// silently adopt it. The shipped `ChannelTune` byte uses the same convention
/// for the same reason, so the two are consistent on the wire.
///
/// `[verified 2026-11-04 against firmware src/helpers/ChannelNotify.h on
/// epic/606-channel-notify: kChanNotifyUnset = 0, kChanNotifyAll = 1,
/// kChanNotifyMentions = 2, kChanNotifyOff = 3, kChanNotifyCount = 4.]`
/// The contract calls these All / Self / None plus "follow the device
/// setting"; that is the same encoding in different words, with "Self" being
/// [mentions] and "follow" being [unset].
///
/// Firmware validates a SET with `stored < kChanNotifyCount`, i.e. `mode < 4`
/// and nothing else. That is why a rotation SET on `0x18`/`0x19` was silent
/// corruption rather than a refused command: every rotation value in 0 to 3
/// passes as a valid notify mode and writes to the channel at that slot. See
/// `offband_indicators.dart`, which now uses `0x1A`/`0x1B`.
enum RadioChannelNotify {
/// No per-channel choice: the radio's device-wide scope answers instead.
unset(0x00),
/// Beep for any message on this channel.
all(0x01),
/// Beep only when the message names us, by the `@[name]` rule.
mentions(0x02),
/// Never beep for this channel.
off(0x03);
const RadioChannelNotify(this.stored);
/// The wire byte. Never built by hand.
final int stored;
static RadioChannelNotify? fromStored(int stored) {
for (final m in RadioChannelNotify.values) {
if (m.stored == stored) return m;
}
return null;
}
}
/// One channel's radio notify mode, as a `0xC5` 0x18 or 0x19 reply reports it.
class RadioChannelNotifyReply {
const RadioChannelNotifyReply({required this.channel, required this.mode});
final int channel;
final RadioChannelNotify mode;
}
int _channelByte(int channel) {
if (channel < 0 || channel > 0xFF) {
throw ArgumentError.value(channel, 'channel', 'must be 0 to 255');
}
return channel;
}
Uint8List buildChannelNotifyGetFrame(int channel) => Uint8List.fromList([
cmdOffbandDeviceUi,
offbandUiChannelNotifyGet,
_channelByte(channel),
]);
Uint8List buildChannelNotifySetFrame(int channel, RadioChannelNotify mode) =>
Uint8List.fromList([
cmdOffbandDeviceUi,
offbandUiChannelNotifySet,
_channelByte(channel),
mode.stored,
]);
/// Parse a `0xC5` channel-notify reply (0x18 or 0x19). Null when this is not
/// one, when it is short, or when the mode byte is not a value we know: an
/// unrecognized mode is dropped rather than guessed at, so a firmware that
/// grows a fourth mode cannot have it read as one of ours.
RadioChannelNotifyReply? parseChannelNotifyReply(List<int> frame) {
if (frame.length < 4) return null;
if (frame[0] != respCodeOffbandDeviceUi) return null;
if (frame[1] != offbandUiChannelNotifyGet &&
frame[1] != offbandUiChannelNotifySet) {
return null;
}
final mode = RadioChannelNotify.fromStored(frame[3]);
if (mode == null) return null;
return RadioChannelNotifyReply(channel: frame[2], mode: mode);
}

@ -130,6 +130,10 @@ enum DeviceUiSurface {
tunePlay,
tuneSlot,
screenSettings,
/// The radio's own per-channel notify mode (#544). Distinct from the app's
/// per-channel notify setting, which is not a device-UI surface at all.
channelNotify,
}
/// The refusal reason for a GPS write. Reason 1 means Power save on a build

@ -867,6 +867,35 @@
}
},
"channels_retrySync": "Retry sync",
"channels_erasedSlots": "The radio has lost the channels in slot(s) {slots}; it reported them as erased. Your channel list here has been kept and was not overwritten.",
"@channels_erasedSlots": {
"placeholders": {
"slots": {
"type": "String"
}
}
},
"channels_restoreToRadio": "Restore to radio",
"channels_restoreToRadioConfirm": "Write {count} channel(s) back to the radio: {names}. This replaces whatever those slots hold now.",
"@channels_restoreToRadioConfirm": {
"placeholders": {
"count": {
"type": "int"
},
"names": {
"type": "String"
}
}
},
"channels_restoreToRadioDone": "Wrote {count} channel(s) back to the radio. If the warning above stays, some did not take.",
"@channels_restoreToRadioDone": {
"placeholders": {
"count": {
"type": "int"
}
}
},
"channels_restoreToRadioFailed": "Could not restore the channel list: nothing cached to restore, or the radio is not connected.",
"channels_slotIdentityChanged": "Channel layout changed on the radio: {changes}",
"@channels_slotIdentityChanged": {
"placeholders": {
@ -898,10 +927,22 @@
"channels_editChannel": "Edit channel",
"channels_muteChannel": "Mute channel",
"channels_unmuteChannel": "Unmute channel",
"channels_notifications": "Notifications",
"channels_notifications": "Phone notifications",
"channels_notifyAll": "All messages",
"channels_notifyMentionsOnly": "Mentions only",
"channels_notifyOff": "Off",
"channels_radioSound": "Radio sound",
"channels_radioSoundUnset": "Not set",
"channels_radioSoundFollows": "Follows the radio: {scope}",
"@channels_radioSoundFollows": {
"placeholders": {
"scope": {
"type": "String"
}
}
},
"channels_radioSoundMutedByRadio": "Silent: the radio is set to None",
"channels_radioSoundReading": "Reading from the radio",
"channels_deleteChannel": "Delete channel",
"channels_deleteChannelConfirm": "Delete \"{name}\"? This cannot be undone.",
"@channels_deleteChannelConfirm": {

@ -2878,6 +2878,42 @@ abstract class AppLocalizations {
/// **'Retry sync'**
String get channels_retrySync;
/// No description provided for @channels_erasedSlots.
///
/// In en, this message translates to:
/// **'The radio has lost the channels in slot(s) {slots}; it reported them as erased. Your channel list here has been kept and was not overwritten.'**
String channels_erasedSlots(String slots);
/// No description provided for @channels_restoreToRadio.
///
/// In en, this message translates to:
/// **'Restore to radio'**
String get channels_restoreToRadio;
/// No description provided for @channels_restoreToRadioConfirm.
///
/// In en, this message translates to:
/// **'Write {count} channel(s) back to the radio: {names}. This replaces whatever those slots hold now.'**
String channels_restoreToRadioConfirm(int count, String names);
/// No description provided for @channels_restoreToRadioDone.
///
/// In en, this message translates to:
/// **'Restored {count} channel(s) to the radio.'**
String channels_restoreToRadioDone(int count);
/// No description provided for @channels_restoreToRadioFailed.
///
/// In en, this message translates to:
/// **'Could not restore the channel list: nothing cached to restore, or the radio is not connected.'**
String get channels_restoreToRadioFailed;
/// No description provided for @channels_restoreToRadioPartial.
///
/// In en, this message translates to:
/// **'Only {written} of {total} channel(s) came back after the restore. The radio did not take the rest. Try the restore again.'**
String channels_restoreToRadioPartial(int written, int total);
/// No description provided for @channels_slotIdentityChanged.
///
/// In en, this message translates to:
@ -2941,7 +2977,7 @@ abstract class AppLocalizations {
/// No description provided for @channels_notifications.
///
/// In en, this message translates to:
/// **'Notifications'**
/// **'Phone notifications'**
String get channels_notifications;
/// No description provided for @channels_notifyAll.
@ -2962,6 +2998,36 @@ abstract class AppLocalizations {
/// **'Off'**
String get channels_notifyOff;
/// No description provided for @channels_radioSound.
///
/// In en, this message translates to:
/// **'Radio sound'**
String get channels_radioSound;
/// No description provided for @channels_radioSoundUnset.
///
/// In en, this message translates to:
/// **'Not set'**
String get channels_radioSoundUnset;
/// No description provided for @channels_radioSoundFollows.
///
/// In en, this message translates to:
/// **'Follows the radio: {scope}'**
String channels_radioSoundFollows(String scope);
/// No description provided for @channels_radioSoundMutedByRadio.
///
/// In en, this message translates to:
/// **'Silent: the radio is set to None'**
String get channels_radioSoundMutedByRadio;
/// No description provided for @channels_radioSoundReading.
///
/// In en, this message translates to:
/// **'Reading from the radio'**
String get channels_radioSoundReading;
/// No description provided for @channels_deleteChannel.
///
/// In en, this message translates to:

@ -1618,6 +1618,33 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1655,7 +1682,7 @@ class AppLocalizationsBg extends AppLocalizations {
String get channels_unmuteChannel => 'Включи известията на канала';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1666,6 +1693,24 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Изтрий канала';

@ -1612,6 +1612,33 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1649,7 +1676,7 @@ class AppLocalizationsDe extends AppLocalizations {
String get channels_unmuteChannel => 'Kanal Stummschaltung aufheben';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1660,6 +1687,24 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Lösche den Kanal';

@ -1594,6 +1594,33 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1631,7 +1658,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get channels_unmuteChannel => 'Unmute channel';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1642,6 +1669,24 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Delete channel';

@ -1613,6 +1613,33 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1650,7 +1677,7 @@ class AppLocalizationsEs extends AppLocalizations {
String get channels_unmuteChannel => 'Activar canal';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1661,6 +1688,24 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Eliminar canal';

@ -1618,6 +1618,33 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1655,7 +1682,7 @@ class AppLocalizationsFr extends AppLocalizations {
String get channels_unmuteChannel => 'Réactiver les notifications du canal';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1666,6 +1693,24 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Supprimer le canal';

@ -1619,6 +1619,33 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1656,7 +1683,7 @@ class AppLocalizationsHu extends AppLocalizations {
String get channels_unmuteChannel => 'Engedje be a hangot';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1667,6 +1694,24 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Mozdony törlése';

@ -1614,6 +1614,33 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1651,7 +1678,7 @@ class AppLocalizationsIt extends AppLocalizations {
String get channels_unmuteChannel => 'Attiva notifiche canale';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1662,6 +1689,24 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Elimina canale';

@ -1562,6 +1562,33 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1599,7 +1626,7 @@ class AppLocalizationsJa extends AppLocalizations {
String get channels_unmuteChannel => 'ミュートを解除する';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1610,6 +1637,24 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'チャンネルを削除する';

@ -1557,6 +1557,33 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1594,7 +1621,7 @@ class AppLocalizationsKo extends AppLocalizations {
String get channels_unmuteChannel => '채널 음소거 해제';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1605,6 +1632,24 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => '채널 삭제';

@ -1605,6 +1605,33 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1642,7 +1669,7 @@ class AppLocalizationsNl extends AppLocalizations {
String get channels_unmuteChannel => 'Kanaal dempen opheffen';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1653,6 +1680,24 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Kanaal verwijderen';

@ -1624,6 +1624,33 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1661,7 +1688,7 @@ class AppLocalizationsPl extends AppLocalizations {
String get channels_unmuteChannel => 'Wyłącz wyciszenie kanału';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1672,6 +1699,24 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Usuń kanał';

@ -1614,6 +1614,33 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1651,7 +1678,7 @@ class AppLocalizationsPt extends AppLocalizations {
String get channels_unmuteChannel => 'Ativar canal';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1662,6 +1689,24 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Excluir canal';

@ -1615,6 +1615,33 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1652,7 +1679,7 @@ class AppLocalizationsRu extends AppLocalizations {
String get channels_unmuteChannel => 'Включить уведомления канала';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1663,6 +1690,24 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Удалить канал';

@ -1605,6 +1605,33 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1642,7 +1669,7 @@ class AppLocalizationsSk extends AppLocalizations {
String get channels_unmuteChannel => 'Zrušiť stlmenie kanála';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1653,6 +1680,24 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Odstrániť kanál';

@ -1602,6 +1602,33 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1639,7 +1666,7 @@ class AppLocalizationsSl extends AppLocalizations {
String get channels_unmuteChannel => 'Vklopi obvestila kanala';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1650,6 +1677,24 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Pošlji kanal';

@ -1596,6 +1596,33 @@ class AppLocalizationsSv extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1633,7 +1660,7 @@ class AppLocalizationsSv extends AppLocalizations {
String get channels_unmuteChannel => 'Slå på ljud för kanal';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1644,6 +1671,24 @@ class AppLocalizationsSv extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Ta bort kanal';

@ -1610,6 +1610,33 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1647,7 +1674,7 @@ class AppLocalizationsUk extends AppLocalizations {
String get channels_unmuteChannel => 'Увімкнути сповіщення каналу';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1658,6 +1685,24 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => 'Видалити канал';

@ -1543,6 +1543,33 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get channels_retrySync => 'Retry sync';
@override
String channels_erasedSlots(String slots) {
return 'The radio has lost the channels in slot(s) $slots; it reported them as erased. Your channel list here has been kept and was not overwritten.';
}
@override
String get channels_restoreToRadio => 'Restore to radio';
@override
String channels_restoreToRadioConfirm(int count, String names) {
return 'Write $count channel(s) back to the radio: $names. This replaces whatever those slots hold now.';
}
@override
String channels_restoreToRadioDone(int count) {
return 'Restored $count channel(s) to the radio.';
}
@override
String get channels_restoreToRadioFailed =>
'Could not restore the channel list: nothing cached to restore, or the radio is not connected.';
@override
String channels_restoreToRadioPartial(int written, int total) {
return 'Only $written of $total channel(s) came back after the restore. The radio did not take the rest. Try the restore again.';
}
@override
String channels_slotIdentityChanged(String changes) {
return 'Channel layout changed on the radio: $changes';
@ -1580,7 +1607,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get channels_unmuteChannel => '取消静音频道';
@override
String get channels_notifications => 'Notifications';
String get channels_notifications => 'Phone notifications';
@override
String get channels_notifyAll => 'All messages';
@ -1591,6 +1618,24 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get channels_notifyOff => 'Off';
@override
String get channels_radioSound => 'Radio sound';
@override
String get channels_radioSoundUnset => 'Not set';
@override
String channels_radioSoundFollows(String scope) {
return 'Follows the radio: $scope';
}
@override
String get channels_radioSoundMutedByRadio =>
'Silent: the radio is set to None';
@override
String get channels_radioSoundReading => 'Reading from the radio';
@override
String get channels_deleteChannel => '删除频道';

@ -25,6 +25,23 @@ class Channel {
bool get isEmpty => name.isEmpty && psk.every((b) => b == 0);
/// A slot the radio answered for that holds no usable channel.
///
/// Erased flash reads back as 0xFF, not 0x00, so such a record is NOT
/// [isEmpty]: the name decodes through `allowMalformed` into U+FFFD
/// replacement characters and the PSK is all-ones. Both halves are checked
/// because either one being unreadable makes the record unusable as a
/// channel identity, and the PSK is what every per-channel setting is keyed
/// by (#1060).
///
/// The client must never adopt one of these as a channel, and must never
/// persist a list containing one over a known-good cached list.
bool get isErased =>
name.contains('<EFBFBD>') || (psk.isNotEmpty && psk.every((b) => b == 0xFF));
/// A slot that carries no channel the client should hold, for either reason.
bool get isUnusable => isEmpty || isErased;
bool get isPublicChannel => pskHex == publicChannelPsk;
static Channel? fromFrame(Uint8List frame) {

@ -31,6 +31,7 @@ import '../services/corescope_service.dart';
import '../services/region_discovery_service.dart';
import '../widgets/channel_region_scope_dialog.dart';
import '../widgets/channel_notify_mode.dart';
import '../widgets/radio_channel_notify.dart';
import '../widgets/radio_tone.dart';
import '../services/block_service.dart';
import '../services/chat_text_scale_service.dart';
@ -474,6 +475,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
onSelected: (value) {
if (value == 'notifications') {
showChannelNotifyModeDialog(context, widget.channel);
} else if (value == 'radioSound') {
showRadioChannelNotifyDialog(context, _currentChannel);
} else if (value == 'radioTone') {
final connector = context.read<MeshCoreConnector>();
requestChannelRadioTone(connector, _currentChannel.index);
@ -507,6 +510,22 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
],
),
),
// #544: the RADIO's sound for this channel. Separate from
// Notifications above, which is the phone's; the two are
// independent settings and neither reads the other.
if (radioChannelNotifySupported(
context.read<MeshCoreConnector>(),
))
const PopupMenuItem(
value: 'radioSound',
child: Row(
children: [
Icon(Icons.volume_up_outlined, size: 20),
SizedBox(width: 12),
Text('Radio sound'),
],
),
),
if (context.read<MeshCoreConnector>().supportsTunes)
const PopupMenuItem(
value: 'radioTone',

@ -27,6 +27,7 @@ import '../widgets/channel_drawer_list.dart';
import '../widgets/sync_progress_overlay.dart';
import '../widgets/unread_badge.dart';
import '../widgets/channel_notify_mode.dart';
import '../widgets/radio_channel_notify.dart';
import '../widgets/radio_tone.dart';
import '../widgets/battery_optimization_banner.dart';
import '../helpers/snack_bar_builder.dart';
@ -208,6 +209,30 @@ class _ChannelsScreenState extends State<ChannelsScreen>
),
],
),
// #1060: the radio answered for these slots with erased
// records. Undismissable: the radio has lost channels the
// client still holds, and the only way out is to write them
// back or accept the loss deliberately.
if (connector.erasedChannelSlots.isNotEmpty)
MaterialBanner(
backgroundColor: Theme.of(
context,
).colorScheme.errorContainer,
content: Text(
context.l10n.channels_erasedSlots(
connector.erasedChannelSlots.toList().join(', '),
),
),
actions: [
if (connector.canRestoreChannelsToRadio)
TextButton(
onPressed: () => unawaited(
_confirmRestoreChannels(context, connector),
),
child: Text(context.l10n.channels_restoreToRadio),
),
],
),
if (connector.slotIdentityChanges.isNotEmpty)
MaterialBanner(
content: Text(
@ -570,6 +595,35 @@ class _ChannelsScreenState extends State<ChannelsScreen>
}
},
),
// The radio's own sound setting for this channel (#544), named
// apart from Notifications, which is the phone's. These are two
// independent settings over two outputs: neither reads the other.
// Gated on caps byte 2 0x80.
if (radioChannelNotifySupported(context.read<MeshCoreConnector>()))
Builder(
builder: (tileContext) {
final live = tileContext.watch<MeshCoreConnector>();
final effective = radioChannelNotifyEffective(
tileContext,
live.channelNotifyFor(channel),
live.deviceNotifyScope,
);
return ListTile(
leading: const Icon(Icons.volume_up_outlined),
title: Text(tileContext.l10n.channels_radioSound),
subtitle: Text(
effective ?? tileContext.l10n.channels_radioSoundReading,
),
onTap: () async {
Navigator.pop(sheetContext);
await Future.delayed(const Duration(milliseconds: 100));
if (parentContext.mounted) {
showRadioChannelNotifyDialog(parentContext, channel);
}
},
);
},
),
// The radio's own tone for this channel (#971), named apart from
// Notifications, which is the phone's. Gated on caps byte 2 0x10.
ChannelRadioToneTile(
@ -1586,6 +1640,52 @@ class _ChannelsScreenState extends State<ChannelsScreen>
);
}
/// Writes the client's cached channels back onto a radio that lost them
/// (#1060). Confirmed first: it overwrites whatever those slots hold now.
Future<void> _confirmRestoreChannels(
BuildContext context,
MeshCoreConnector connector,
) async {
final toRestore = connector.cachedChannels
.where((c) => !c.isUnusable)
.toList();
final confirmed = await showDialog<bool>(
context: context,
builder: (dialogContext) => AlertDialog(
title: Text(dialogContext.l10n.channels_restoreToRadio),
content: Text(
dialogContext.l10n.channels_restoreToRadioConfirm(
toRestore.length,
toRestore.map((c) => c.name).join(', '),
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(dialogContext, false),
child: Text(dialogContext.l10n.common_cancel),
),
TextButton(
onPressed: () => Navigator.pop(dialogContext, true),
child: Text(dialogContext.l10n.channels_restoreToRadio),
),
],
),
);
if (confirmed != true) return;
final written = await connector.restoreChannelsToRadio();
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(
written < 0
? context.l10n.channels_restoreToRadioFailed
: context.l10n.channels_restoreToRadioDone(written),
),
persist: written < 0,
);
}
void _confirmDeleteChannel(
BuildContext context,
MeshCoreConnector connector,

@ -66,6 +66,12 @@ class _DeviceUiViewState extends State<DeviceUiView> {
DeviceUiSurface.tunePlay ||
DeviceUiSurface.tuneSlot => widget.part == DeviceUiPart.buzzer,
DeviceUiSurface.gpsMode || DeviceUiSurface.screenSettings => false,
// The radio's per-channel notify control lives beside the app's own
// per-channel control on the Channels screen, not in this pane (#544
// Epic C), so a refusal for it is not this screen's to show. Epic C1
// surfaces it there; until then nothing on this pane can emit it, because
// nothing here writes it.
DeviceUiSurface.channelNotify => false,
};
@override

@ -0,0 +1,144 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../connector/meshcore_connector.dart';
import '../connector/offband_channel_notify.dart';
import '../connector/offband_device_ui.dart';
import '../l10n/l10n.dart';
import '../models/channel.dart';
/// The RADIO's per-channel sound setting (#544).
///
/// Deliberately a separate control from the app's per-channel notification
/// setting in `channel_notify_mode.dart`: that one decides whether the PHONE
/// notifies, this one decides whether the RADIO beeps, and neither reads the
/// other (owner, 2026-11-03). Do not merge them, and do not resolve one from
/// the other.
IconData radioChannelNotifyIcon(RadioChannelNotify mode) {
switch (mode) {
case RadioChannelNotify.all:
return Icons.volume_up_outlined;
case RadioChannelNotify.mentions:
return Icons.alternate_email;
case RadioChannelNotify.off:
return Icons.volume_off_outlined;
case RadioChannelNotify.unset:
return Icons.settings_backup_restore;
}
}
String radioChannelNotifyLabel(BuildContext context, RadioChannelNotify mode) {
switch (mode) {
case RadioChannelNotify.all:
return context.l10n.channels_notifyAll;
case RadioChannelNotify.mentions:
return context.l10n.channels_notifyMentionsOnly;
case RadioChannelNotify.off:
return context.l10n.channels_notifyOff;
case RadioChannelNotify.unset:
return context.l10n.channels_radioSoundUnset;
}
}
/// What this channel will ACTUALLY do on the radio, which is not always the
/// stored byte (#544 C3, owner's call 2026-11-03).
///
/// The radio's rules, per firmware: a channel with a mode set decides for
/// itself; a channel with no mode falls back to the device-wide scope; and a
/// device scope of None overrides even a channel that is set. Showing the raw
/// mode would tell a user with the radio muted that a channel is on "All
/// messages" while it sits silent.
///
/// Null when the composition cannot be known: the mode has not been read, or
/// it is unset and the device scope has not been read either. A caller must
/// show "reading", never a guess.
String? radioChannelNotifyEffective(
BuildContext context,
RadioChannelNotify? mode,
DeviceNotifyScope? scope,
) {
if (mode == null) return null;
if (scope == DeviceNotifyScope.none) {
return context.l10n.channels_radioSoundMutedByRadio;
}
if (mode != RadioChannelNotify.unset) {
return radioChannelNotifyLabel(context, mode);
}
if (scope == null) return null;
return context.l10n.channels_radioSoundFollows(scope.label);
}
/// Whether this radio can be offered the control at all. The app's own
/// per-channel setting is never gated on this.
bool radioChannelNotifySupported(MeshCoreConnector connector) =>
connector.supportsChannelNotify;
void showRadioChannelNotifyDialog(BuildContext context, Channel channel) {
final connector = context.read<MeshCoreConnector>();
showDialog<void>(
context: context,
builder: (dialogContext) => Consumer<MeshCoreConnector>(
builder: (consumerContext, live, _) {
// State follows the radio's reply, never the tap: until the radio has
// answered for this slot there is no current value to tick, and a
// write that it refuses never appears as saved.
final current = live.channelNotifyFor(channel);
final error = live.deviceUiErrorSurface == DeviceUiSurface.channelNotify
? live.deviceUiError
: null;
return AlertDialog(
title: Text(consumerContext.l10n.channels_radioSound),
contentPadding: const EdgeInsets.symmetric(vertical: 8),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (error != null)
Padding(
padding: const EdgeInsets.fromLTRB(24, 0, 24, 8),
child: Text(
error,
style: TextStyle(
color: Theme.of(consumerContext).colorScheme.error,
),
),
),
if (current == null)
ListTile(
leading: const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(strokeWidth: 2),
),
title: Text(consumerContext.l10n.channels_radioSoundReading),
),
for (final mode in RadioChannelNotify.values)
ListTile(
leading: Icon(radioChannelNotifyIcon(mode)),
title: Text(radioChannelNotifyLabel(consumerContext, mode)),
subtitle: mode == RadioChannelNotify.unset
? Text(
radioChannelNotifyEffective(
consumerContext,
RadioChannelNotify.unset,
live.deviceNotifyScope,
) ??
consumerContext.l10n.channels_radioSoundReading,
)
: null,
trailing: mode == current ? const Icon(Icons.check) : null,
onTap: () async {
Navigator.pop(dialogContext);
await connector.setChannelNotify(channel, mode);
},
),
],
),
);
},
),
);
}

@ -0,0 +1,338 @@
// #1060: a radio that has LOST its channel storage still answers for every
// slot. Erased flash reads back as 0xFF, so the reply is a well-formed
// CHANNEL_INFO frame carrying garbage, not silence and not an error.
//
// The field case: a reflash between two sessions left slot 0 ("Public")
// intact and slots 1+ entirely 0xFF. The client adopted those records as
// channels, rendered their names as replacement characters, and then
// persisted them over the user's own good cached list, turning one-sided loss
// on the radio into loss on both sides.
import 'dart:typed_data';
import 'package:drift/native.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/meshcore_connector.dart';
import 'package:meshcore_open/connector/meshcore_protocol.dart';
import 'package:meshcore_open/models/channel.dart';
import 'package:meshcore_open/storage/channel_store.dart';
import 'package:meshcore_open/storage/drift/blob_store.dart';
import 'package:meshcore_open/storage/drift/offband_database.dart';
import 'package:meshcore_open/storage/prefs_manager.dart';
import 'package:shared_preferences/shared_preferences.dart';
Uint8List _channelInfoFrame({
required int index,
required String name,
required int pskSeed,
}) {
final frame = Uint8List(50);
frame[0] = respCodeChannelInfo;
frame[1] = index;
final nameBytes = name.codeUnits;
for (var i = 0; i < nameBytes.length && i < 31; i++) {
frame[2 + i] = nameBytes[i];
}
for (var i = 0; i < 16; i++) {
frame[34 + i] = (pskSeed + i) & 0xFF;
}
return frame;
}
/// Everything after the slot index reads back as erased flash.
Uint8List _erasedFrame(int index) {
final frame = Uint8List(50);
frame[0] = respCodeChannelInfo;
frame[1] = index;
for (var i = 2; i < 50; i++) {
frame[i] = 0xFF;
}
return frame;
}
Channel _channel(int index, String name, int pskSeed) => Channel(
index: index,
name: name,
psk: Uint8List.fromList(List<int>.generate(16, (i) => (pskSeed + i) & 0xFF)),
);
Future<void> _settle([int turns = 25]) async {
for (var i = 0; i < turns; i++) {
await Future<void>.delayed(Duration.zero);
}
}
void main() {
late OffbandDatabase db;
late MeshCoreConnector c;
late List<List<int>> sent;
setUp(() async {
SharedPreferences.setMockInitialValues({});
PrefsManager.reset();
await PrefsManager.initialize();
db = OffbandDatabase(NativeDatabase.memory());
BlobStore.overrideForTest(BlobStore(db));
sent = [];
c = MeshCoreConnector();
c.sendFrameOverrideForTest = (data) => sent.add(data.toList());
c.setConnectedForTest();
});
tearDown(() async {
BlobStore.clearTestOverride();
await db.close();
});
group('the erased record itself', () {
test('an all-0xFF record is erased, and is NOT caught by isEmpty', () {
final erased = Channel.fromFrame(_erasedFrame(1))!;
expect(erased.isErased, isTrue);
expect(erased.isUnusable, isTrue);
// This is the exact gap that let the garbage through: isEmpty tests for
// 0x00, and erased flash is 0xFF.
expect(
erased.isEmpty,
isFalse,
reason: 'if this ever passes, isEmpty alone would have been enough',
);
});
test('the erased name is replacement characters, which is what showed', () {
final erased = Channel.fromFrame(_erasedFrame(1))!;
expect(erased.name, contains('<EFBFBD>'));
});
test('a real channel is neither empty nor erased', () {
final real = Channel.fromFrame(
_channelInfoFrame(index: 0, name: 'Public', pskSeed: 10),
)!;
expect(real.isErased, isFalse);
expect(real.isEmpty, isFalse);
expect(real.isUnusable, isFalse);
expect(real.name, 'Public');
});
test('a genuinely empty slot is still empty, not erased', () {
final empty = Channel.fromFrame(
Uint8List(50)..[0] = respCodeChannelInfo,
)!;
expect(empty.isEmpty, isTrue);
expect(empty.isErased, isFalse);
expect(empty.isUnusable, isTrue);
});
});
group('sync against a radio that lost its channels', () {
/// The field case: slot 0 survived, slots 1 and 2 came back erased.
Future<void> syncWithErasedTail() async {
await c.getChannels(force: true, maxChannels: 3);
c.handleFrameForTest(
_channelInfoFrame(index: 0, name: 'Public', pskSeed: 10),
);
await _settle(2);
c.handleFrameForTest(_erasedFrame(1));
await _settle(2);
c.handleFrameForTest(_erasedFrame(2));
await _settle();
}
test('erased slots are not adopted as channels', () async {
await syncWithErasedTail();
expect(c.channels.map((ch) => ch.index), [0]);
expect(c.channels.single.name, 'Public');
expect(
c.channels.any((ch) => ch.name.contains('<EFBFBD>')),
isFalse,
reason: 'no channel may be named with replacement characters',
);
});
test(
'erased slots are reported, so the UI can say what happened',
() async {
await syncWithErasedTail();
expect(c.erasedChannelSlots, {1, 2});
},
);
test('the good cached list is NOT overwritten', () async {
c.seedCachedChannelsForTest([
_channel(0, 'Public', 10),
_channel(1, 'wardriving', 40),
_channel(2, 'test', 50),
]);
await syncWithErasedTail();
// The data-loss fix: the client keeps its own copy of the channels the
// radio has lost, rather than saving erased records over them.
expect(c.cachedChannels.map((ch) => ch.name), [
'Public',
'wardriving',
'test',
]);
expect(c.canRestoreChannelsToRadio, isTrue);
});
test('a clean sync still replaces the cache', () async {
c.seedCachedChannelsForTest([_channel(0, 'stale', 99)]);
await c.getChannels(force: true, maxChannels: 2);
c.handleFrameForTest(
_channelInfoFrame(index: 0, name: 'Public', pskSeed: 10),
);
await _settle(2);
c.handleFrameForTest(
_channelInfoFrame(index: 1, name: 'wardriving', pskSeed: 40),
);
await _settle();
expect(
c.cachedChannels.map((ch) => ch.name),
['Public', 'wardriving'],
reason: 'the guard must not block a healthy sync',
);
expect(c.erasedChannelSlots, isEmpty);
expect(c.canRestoreChannelsToRadio, isFalse);
});
});
group('restoring the list to the radio', () {
test('every cached channel is written back to its own slot', () async {
c.seedCachedChannelsForTest([
_channel(0, 'Public', 10),
_channel(1, 'wardriving', 40),
]);
sent.clear();
final written = await c.restoreChannelsToRadio();
expect(written, 2);
final setFrames = sent.where((f) => f[0] == cmdSetChannel).toList();
expect(setFrames.length, 2);
expect(setFrames[0][1], 0);
expect(setFrames[1][1], 1);
// The PSK travels with it, so the restored channel keeps the identity
// its history and settings are keyed by.
expect(setFrames[1].sublist(34, 50), _channel(1, 'wardriving', 40).psk);
});
test('an erased cached entry is never written back', () async {
c.seedCachedChannelsForTest([
_channel(0, 'Public', 10),
Channel.fromFrame(_erasedFrame(1))!,
]);
sent.clear();
final written = await c.restoreChannelsToRadio();
expect(written, 1);
expect(sent.where((f) => f[0] == cmdSetChannel).length, 1);
});
test(
'restoring with nothing cached is refused, not a silent no-op',
() async {
c.seedCachedChannelsForTest([]);
expect(await c.restoreChannelsToRadio(), -1);
expect(sent.where((f) => f[0] == cmdSetChannel), isEmpty);
},
);
// Adversarial review finding: on BLE sendFrame prefers write-without-
// response, so its await returns when the frame reaches the OS and not
// when the radio has taken it. An unpaced loop can therefore overrun the
// radio and drop channels with no error raised anywhere. The USB branch
// of sendFrame already spaces its frames; this loop must too.
test(
'consecutive channel writes are spaced, not fired in a tight loop',
() async {
c.seedCachedChannelsForTest([
_channel(0, 'Public', 10),
_channel(1, 'wardriving', 40),
_channel(2, 'test', 70),
]);
sent.clear();
final sw = Stopwatch()..start();
final written = await c.restoreChannelsToRadio();
sw.stop();
expect(written, 3);
// Two gaps between three writes. A lower bound, so this asserts the
// pacing exists without pinning the exact duration.
expect(
sw.elapsedMilliseconds,
greaterThanOrEqualTo(20),
reason: 'three writes with no spacing would return almost instantly',
);
},
);
});
// Adversarial review finding: the guards added here stop an erased record
// being adopted from the WIRE, but a build from before they existed could
// already have persisted one. Storage is therefore an untrusted source too,
// and _cachedChannels is a fallback identity source for _findChannelByIndex
// as well as being re-saved by the unread paths, so one that slips in comes
// back as the channel for live traffic and outlives every radio.
group('erased records already sitting in storage', () {
const radioKey = 'aabbccddee';
test('are dropped on load, not adopted from the cache', () async {
final store = ChannelStore()..setPublicKeyHex = radioKey;
await store.saveChannels([
_channel(0, 'Public', 10),
Channel.fromFrame(_erasedFrame(1))!,
_channel(2, 'wardriving', 40),
]);
// The store itself is faithful: it persisted exactly what it was given,
// which is how the bad record got there in the first place.
expect((await store.loadChannels()).length, 3);
c.setChannelStoreKeyForTest(radioKey);
await c.loadCachedChannels();
expect(c.cachedChannels.map((ch) => ch.name), ['Public', 'wardriving']);
expect(c.cachedChannels.any((ch) => ch.isUnusable), isFalse);
});
test('a clean stored list is loaded untouched', () async {
final store = ChannelStore()..setPublicKeyHex = radioKey;
await store.saveChannels([
_channel(0, 'Public', 10),
_channel(1, 'wardriving', 40),
]);
c.setChannelStoreKeyForTest(radioKey);
await c.loadCachedChannels();
expect(c.cachedChannels.length, 2);
expect(c.cachedChannels.map((ch) => ch.name), ['Public', 'wardriving']);
});
test('an all-erased stored list leaves nothing to restore', () async {
final store = ChannelStore()..setPublicKeyHex = radioKey;
await store.saveChannels([
Channel.fromFrame(_erasedFrame(0))!,
Channel.fromFrame(_erasedFrame(1))!,
]);
c.setChannelStoreKeyForTest(radioKey);
await c.loadCachedChannels();
expect(c.cachedChannels, isEmpty);
// Nothing usable cached means the restore is refused rather than
// writing erased records back onto the radio.
expect(await c.restoreChannelsToRadio(), -1);
expect(sent.where((f) => f[0] == cmdSetChannel), isEmpty);
});
});
}

@ -0,0 +1,674 @@
// #544 Epic A (#1068): the red baseline for the RADIO's per-channel notify
// mode over 0xC5 0x18 / 0x19.
//
// The feature this pins is that there are TWO independent settings: the app's
// per-channel mode drives the PHONE, the radio's drives the BUZZER, and
// neither moves the other (owner, 2026-11-03). The independence group below is
// the load-bearing part -- it is what stops the two being quietly re-merged by
// a later change.
import 'dart:convert';
import 'dart:typed_data';
import 'package:drift/native.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/meshcore_connector.dart';
import 'package:meshcore_open/connector/meshcore_protocol.dart';
import 'package:meshcore_open/connector/offband_capability_advert.dart';
import 'package:meshcore_open/connector/offband_channel_notify.dart';
import 'package:meshcore_open/connector/offband_device_ui.dart';
import 'package:meshcore_open/models/app_settings.dart';
import 'package:meshcore_open/models/channel.dart';
import 'package:meshcore_open/services/app_settings_service.dart';
import 'package:meshcore_open/storage/drift/blob_store.dart';
import 'package:meshcore_open/storage/drift/offband_database.dart';
import 'package:meshcore_open/storage/prefs_manager.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// RESP_CODE_DEVICE_INFO from an Offband radio (fork length, dual version so
/// the population classifier corroborates it). Caps byte 2 at offset 84;
/// pass [length] 88 with [caps3] to carry a third caps byte at offset 87.
Uint8List deviceInfo({
required int caps2,
int length = 85,
int caps3 = 0,
int ledByte = 0,
int displayByte = 0,
}) {
final v = ascii.encode('1.5.0-1.17.0');
final f = Uint8List(length);
f[0] = 13;
f[1] = 22;
f.setRange(60, 60 + v.length, v);
if (length >= 85) f[84] = caps2;
if (length >= 86) f[85] = ledByte;
if (length >= 87) f[86] = displayByte;
if (length >= 88) f[87] = caps3;
return f;
}
/// A RESP_CODE_CHANNEL_INFO frame. [pskSeed] makes each channel's PSK, and so
/// its identity, distinct.
Uint8List channelInfoFrame({
required int index,
required String name,
required int pskSeed,
}) {
final frame = Uint8List(50);
frame[0] = respCodeChannelInfo;
frame[1] = index;
final nameBytes = name.codeUnits;
for (var i = 0; i < nameBytes.length && i < 31; i++) {
frame[2 + i] = nameBytes[i];
}
for (var i = 0; i < 16; i++) {
frame[34 + i] = (pskSeed + i) & 0xFF;
}
return frame;
}
/// A slot whose stored record was erased: flash reads back as 0xFF, so the
/// name decodes to replacement characters and the PSK is all-ones (#1060).
Uint8List erasedChannelInfoFrame(int index) {
final frame = Uint8List(50);
frame[0] = respCodeChannelInfo;
frame[1] = index;
for (var i = 2; i < 50; i++) {
frame[i] = 0xFF;
}
return frame;
}
/// A standalone Channel for tests that never sync a list, e.g. the capability
/// gate, which must refuse before it ever looks a slot up.
Channel testChannel(int index, {String name = 'ch', int pskSeed = 10}) =>
Channel(
index: index,
name: name,
psk: Uint8List.fromList(
List<int>.generate(16, (i) => (pskSeed + i) & 0xFF),
),
);
Future<void> settle([int turns = 25]) async {
for (var i = 0; i < turns; i++) {
await Future<void>.delayed(Duration.zero);
}
}
void main() {
late OffbandDatabase db;
late MeshCoreConnector connector;
late List<List<int>> sent;
setUp(() async {
SharedPreferences.setMockInitialValues({});
PrefsManager.reset();
await PrefsManager.initialize();
db = OffbandDatabase(NativeDatabase.memory());
BlobStore.overrideForTest(BlobStore(db));
sent = [];
connector = MeshCoreConnector();
connector.sendFrameOverrideForTest = (data) => sent.add(data.toList());
connector.setConnectedForTest();
});
tearDown(() async {
BlobStore.clearTestOverride();
await db.close();
});
/// Drives a full channel sync so slot indices are confirmed. The radio's
/// notify modes are only meaningful past that barrier (#1062), and since
/// #1060 the client resolves every slot to a channel identity, so a test
/// that never syncs has no identities to resolve against.
Future<void> syncChannels(
List<({int index, String name, int seed})> arrangement,
) async {
await connector.getChannels(force: true, maxChannels: arrangement.length);
for (final ch in arrangement) {
connector.handleFrameForTest(
channelInfoFrame(index: ch.index, name: ch.name, pskSeed: ch.seed),
);
await settle(2);
}
await settle();
}
Channel slot(int index) =>
connector.channels.firstWhere((c) => c.index == index);
bool sentChannelNotify() => sent.any(
(f) =>
f.length >= 2 &&
f[0] == cmdOffbandDeviceUi &&
(f[1] == offbandUiChannelNotifyGet ||
f[1] == offbandUiChannelNotifySet),
);
// ---- A1: the radio's modes ------------------------------------------------
group('A1 radio channel notify', () {
test('the wire bytes are the documented ones', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'test', seed: 50),
(index: 2, name: 'wardriving', seed: 40),
]);
sent.clear();
await connector.requestChannelNotify(2);
await connector.setChannelNotify(slot(2), RadioChannelNotify.mentions);
expect(
sent,
equals([
[0xC5, 0x18, 0x02],
[0xC5, 0x19, 0x02, 0x02],
]),
);
});
test('a reply sets that channel, and only that channel', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'test', seed: 50),
(index: 2, name: 'wardriving', seed: 40),
]);
connector.handleFrameForTest([0xC5, 0x18, 0x01, 0x02]);
expect(connector.channelNotifyFor(slot(1)), RadioChannelNotify.mentions);
expect(connector.channelNotifyFor(slot(0)), isNull);
expect(connector.channelNotifyFor(slot(2)), isNull);
});
test('mode 0 is unset, and is distinct from Off', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'test', seed: 50),
]);
connector.handleFrameForTest([0xC5, 0x18, 0x00, 0x00]);
connector.handleFrameForTest([0xC5, 0x18, 0x01, 0x03]);
expect(connector.channelNotifyFor(slot(0)), RadioChannelNotify.unset);
expect(connector.channelNotifyFor(slot(1)), RadioChannelNotify.off);
});
test('a write is not shown until the radio confirms it', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([(index: 3, name: 'wardriving', seed: 40)]);
await connector.setChannelNotify(slot(3), RadioChannelNotify.off);
expect(connector.channelNotifyFor(slot(3)), isNull);
connector.handleFrameForTest([0xC5, 0x19, 0x03, 0x03]);
expect(connector.channelNotifyFor(slot(3)), RadioChannelNotify.off);
});
test('an unknown mode byte is dropped, never guessed at', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([(index: 4, name: 'wardriving', seed: 40)]);
connector.handleFrameForTest([0xC5, 0x18, 0x04, 0x09]);
expect(connector.channelNotifyFor(slot(4)), isNull);
expect(parseChannelNotifyReply([0xC5, 0x18, 0x04, 0x09]), isNull);
});
test('state does not survive a change of radio', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([(index: 1, name: 'wardriving', seed: 40)]);
final wardriving = slot(1);
connector.handleFrameForTest([0xC5, 0x18, 0x01, 0x01]);
expect(connector.channelNotifyFor(wardriving), RadioChannelNotify.all);
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
expect(connector.channelNotifyFor(wardriving), isNull);
});
test(
'a reply for a slot with no confirmed channel is dropped, not stored',
() async {
connector.handleFrameForTest(
deviceInfo(caps2: offbandCap2ChannelNotify),
);
await syncChannels([(index: 0, name: 'Public', seed: 10)]);
// Slot 7 was never confirmed. Storing this against slot 7 is what let
// a later occupant of that slot inherit the mode (#1060).
connector.handleFrameForTest([0xC5, 0x18, 0x07, 0x03]);
expect(connector.channels.any((c) => c.index == 7), isFalse);
expect(connector.channelNotifyFor(slot(0)), isNull);
},
);
});
// ---- A5: the mode follows the channel, not the slot (#1060) --------------
group('A5 radio notify is keyed by channel identity', () {
test('a mode read for one channel does not appear on the channel that '
'later takes its slot', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
// #wardriving sits in slot 1 and the radio reports it as Off.
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'wardriving', seed: 40),
]);
final wardriving = slot(1);
connector.handleFrameForTest([0xC5, 0x18, 0x01, 0x03]);
expect(connector.channelNotifyFor(wardriving), RadioChannelNotify.off);
// A wipe and re-import puts a DIFFERENT channel in slot 1.
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'test', seed: 50),
]);
final testCh = slot(1);
// The new occupant must not inherit #wardriving's Off. Before this
// fix the slot-keyed map handed it straight over, which is how a
// channel the owner had silenced started chirping again.
expect(testCh.pskHex, isNot(wardriving.pskHex));
expect(connector.channelNotifyFor(testCh), isNull);
});
test('a mode survives the channel moving to a different slot', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'wardriving', seed: 40),
]);
connector.handleFrameForTest([0xC5, 0x18, 0x01, 0x03]);
// Same channel, new slot.
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'test', seed: 50),
(index: 2, name: 'wardriving', seed: 40),
]);
expect(connector.channelNotifyFor(slot(2)), RadioChannelNotify.off);
expect(connector.channelNotifyFor(slot(1)), isNull);
});
test(
'a write addresses the channel current slot, not a stale one',
() async {
connector.handleFrameForTest(
deviceInfo(caps2: offbandCap2ChannelNotify),
);
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'wardriving', seed: 40),
]);
// A Channel captured while it was in slot 1, as a UI widget holds one.
final staleHandle = slot(1);
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'test', seed: 50),
(index: 2, name: 'wardriving', seed: 40),
]);
sent.clear();
await connector.setChannelNotify(staleHandle, RadioChannelNotify.off);
// Addressed to slot 2, where #wardriving actually is now.
expect(
sent,
equals([
[0xC5, 0x19, 0x02, 0x03],
]),
);
},
);
test('a write for a channel the radio does not hold is refused', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
await syncChannels([
(index: 0, name: 'Public', seed: 10),
(index: 1, name: 'wardriving', seed: 40),
]);
final gone = slot(1);
// The channel is deleted on the radio.
await syncChannels([(index: 0, name: 'Public', seed: 10)]);
sent.clear();
await connector.setChannelNotify(gone, RadioChannelNotify.off);
expect(sent, isEmpty);
expect(connector.deviceUiError, isNotNull);
expect(connector.deviceUiErrorSurface, DeviceUiSurface.channelNotify);
});
});
// ---- A2: the two settings are independent ---------------------------------
group('A2 independence of app and radio settings', () {
test('changing the app mode emits no radio frame', () async {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
sent.clear();
final settings = AppSettingsService();
await settings.loadSettings();
await settings.setChannelNotifyMode(
devicePrefix: 'aabbccddee',
pskHex: '00112233445566778899aabbccddeeff',
channelName: 'skywarn',
mode: ChannelNotifyMode.off,
);
expect(sentChannelNotify(), isFalse);
expect(sent, isEmpty);
});
test('a radio reply does not touch the app store', () async {
final settings = AppSettingsService();
await settings.loadSettings();
const prefix = 'aabbccddee';
const psk = '00112233445566778899aabbccddeeff';
await settings.setChannelNotifyMode(
devicePrefix: prefix,
pskHex: psk,
channelName: 'skywarn',
mode: ChannelNotifyMode.all,
);
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
connector.handleFrameForTest([0xC5, 0x18, 0x00, 0x03]);
expect(
settings.channelNotifyMode(devicePrefix: prefix, pskHex: psk),
ChannelNotifyMode.all,
reason: 'the radio saying Off must not mute the phone',
);
});
test('the app setting works with no radio capability at all', () async {
connector.handleFrameForTest(deviceInfo(caps2: 0x00));
final settings = AppSettingsService();
await settings.loadSettings();
const prefix = 'aabbccddee';
const psk = '00112233445566778899aabbccddeeff';
await settings.setChannelNotifyMode(
devicePrefix: prefix,
pskHex: psk,
channelName: 'skywarn',
mode: ChannelNotifyMode.mentionsOnly,
);
expect(connector.supportsChannelNotify, isFalse);
expect(
settings.channelNotifyMode(devicePrefix: prefix, pskHex: psk),
ChannelNotifyMode.mentionsOnly,
);
});
});
// ---- A3: capability and caps byte 3 ---------------------------------------
group('A3 capability gating and caps byte 3', () {
test('without 0x80 no channel-notify frame is ever emitted', () async {
connector.handleFrameForTest(deviceInfo(caps2: 0x40));
await connector.requestChannelNotify(0);
await connector.setChannelNotify(testChannel(0), RadioChannelNotify.off);
expect(connector.supportsChannelNotify, isFalse);
expect(sentChannelNotify(), isFalse);
});
test('0x80 is the bit, and other bits do not open it', () {
connector.handleFrameForTest(deviceInfo(caps2: offbandCap2ChannelNotify));
expect(connector.supportsChannelNotify, isTrue);
connector.handleFrameForTest(deviceInfo(caps2: 0x7F));
expect(connector.supportsChannelNotify, isFalse);
});
test('NOTHING reads device-info offset 87 (#1096)', () {
// The permanent rule out of the collision: no Offband field is ever
// appended to upstream's device-info frame. Three features each computed
// 87 as the next free byte and each was right in isolation.
//
// Behavioural rather than a source grep, so it keeps holding if the read
// comes back spelled differently. Byte 87 is set to every bit, and every
// capability answer must be identical to the frame that has no byte 87
// at all.
connector.handleFrameForTest(deviceInfo(caps2: 0x80, length: 85));
final capsWithout = connector.offbandCaps2;
final withoutByte87 = [
connector.supportsChannelNotify,
connector.supportsDisplayRotation,
connector.supportsButtonMatrix,
connector.supportsNotifyScope,
connector.supportsTunes,
connector.supportsGpsMode,
connector.supportsScreenSettings,
];
final ackWithout = connector.ackCapacity;
connector.handleFrameForTest(
deviceInfo(caps2: 0x80, length: 88, caps3: 0xFF),
);
expect(
[
connector.supportsChannelNotify,
connector.supportsDisplayRotation,
connector.supportsButtonMatrix,
connector.supportsNotifyScope,
connector.supportsTunes,
connector.supportsGpsMode,
connector.supportsScreenSettings,
],
withoutByte87,
reason: 'a byte at offset 87 changed a capability',
);
expect(connector.ackCapacity, ackWithout);
// The raw byte too, not only the named getters. Comparing getters alone
// is a hole: a leak into a caps bit that has no getter yet (0x04
// INDICATORS, for one) moves nothing this test can see. Caught by
// deliberately reintroducing such a read and watching this pass.
expect(
connector.offbandCaps2,
capsWithout,
reason: 'offset 87 contaminated the caps byte read at 84',
);
});
test('a stock-shaped radio exposes nothing, whatever its bytes', () {
final stock = Uint8List(82);
stock[0] = 13;
stock[1] = 14;
connector.handleFrameForTest(stock);
expect(connector.supportsChannelNotify, isFalse);
expect(connector.supportsDisplayRotation, isFalse);
expect(connector.ackCapacity, isNull);
});
});
// ---- A4: advert precedence over the caps bit (#1097) ----------------------
group('A4 advert precedence', () {
/// A `0xC5` `0x1C` reply carrying [tags] as zero-length records.
Uint8List advertReply(List<int> tags) {
final f = <int>[cmdOffbandDeviceUi, offbandUiInfoGet];
for (final t in tags) {
f.addAll([t, 0x00]);
}
return Uint8List.fromList(f);
}
/// `[0xC5][0x7F][0x05]`: this radio does not implement the advert.
Uint8List advertUnsupported() => Uint8List.fromList([
cmdOffbandDeviceUi,
offbandUiErr,
offbandUiErrReasonMalformed,
]);
test('the zero-payload advert request goes out on connect', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x80));
expect(
sent.any(
(f) =>
f.length == 2 &&
f[0] == cmdOffbandDeviceUi &&
f[1] == offbandUiInfoGet,
),
isTrue,
reason:
'the request must be exactly two bytes to make err 5 mean '
'"predates the advert" rather than "malformed payload"',
);
});
test(
'before any answer the caps bit still decides, so nothing regresses',
() {
connector.handleFrameForTest(deviceInfo(caps2: 0x80));
expect(connector.capabilityAdvertState, CapabilityAdvertState.unknown);
expect(connector.supportsChannelNotify, isTrue);
},
);
test('an advert WITH the tag grants it even with the caps bit clear', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x00));
expect(connector.supportsChannelNotify, isFalse);
connector.handleFrameForTest(advertReply([offbandInfoTagChanNotify]));
expect(connector.capabilityAdvertState, CapabilityAdvertState.advertised);
expect(
connector.supportsChannelNotify,
isTrue,
reason:
'once the bit is retired under contract section 4, the tag is '
'the only thing left saying the feature exists',
);
});
test('an advert WITHOUT the tag revokes it even with the caps bit set', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x80));
expect(connector.supportsChannelNotify, isTrue);
connector.handleFrameForTest(advertReply([offbandInfoTagAckCapacity]));
expect(connector.supportsChannelNotify, isFalse);
});
test('err 5 falls back to the caps bit, which is the flashed T1000-E', () {
// firmware 4e5a6c85 answers 0x18/0x19 and carries caps2 0x80, but
// predates 0x1C. Tag-only gating would take the control away from it.
connector.handleFrameForTest(deviceInfo(caps2: 0x80));
connector.handleFrameForTest(advertUnsupported());
expect(
connector.capabilityAdvertState,
CapabilityAdvertState.unsupported,
);
expect(connector.supportsChannelNotify, isTrue);
});
test('err 5 with the bit clear grants nothing', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x00));
connector.handleFrameForTest(advertUnsupported());
expect(connector.supportsChannelNotify, isFalse);
expect(connector.supportsDisplayRotation, isFalse);
});
test('rotation is tag-gated with NO caps-bit fallback', () {
// Deliberate: 0x1A/0x1B were claimed in the same merge as the advert, so
// no firmware can rotate but not advertise. INDICATORS 0x04 must not
// open it.
connector.handleFrameForTest(deviceInfo(caps2: 0x04));
expect(connector.supportsDisplayRotation, isFalse);
connector.handleFrameForTest(advertUnsupported());
expect(connector.supportsDisplayRotation, isFalse);
connector.handleFrameForTest(
advertReply([offbandInfoTagDisplayRotation]),
);
expect(connector.supportsDisplayRotation, isTrue);
});
test('ACK capacity comes from the tag value, and absence is not zero', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x80));
connector.handleFrameForTest(advertReply([offbandInfoTagChanNotify]));
expect(connector.ackCapacity, isNull);
connector.handleFrameForTest(
Uint8List.fromList([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagAckCapacity,
0x01,
0x20,
]),
);
expect(connector.ackCapacity, 0x20);
});
test('an unknown tag does not disturb the known gates', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x00));
connector.handleFrameForTest(
Uint8List.fromList([
cmdOffbandDeviceUi,
offbandUiInfoGet,
0x5A,
0x02,
0xDE,
0xAD,
offbandInfoTagChanNotify,
0x00,
]),
);
expect(connector.supportsChannelNotify, isTrue);
expect(connector.supportsDisplayRotation, isFalse);
});
test('a new device-info drops the previous radio advert', () {
connector.handleFrameForTest(deviceInfo(caps2: 0x00));
connector.handleFrameForTest(advertReply([offbandInfoTagChanNotify]));
expect(connector.supportsChannelNotify, isTrue);
// A different radio, no advert answer yet.
connector.handleFrameForTest(deviceInfo(caps2: 0x00));
expect(connector.capabilityAdvertState, CapabilityAdvertState.unknown);
expect(
connector.supportsChannelNotify,
isFalse,
reason: "one radio's tags must never answer for another",
);
});
test('a refusal with a write outstanding belongs to the WRITE', () async {
// The error frame names no sub-code. Claiming it for the advert would
// hide a genuinely refused write and wrongly mark the radio as predating
// the advert.
connector.handleFrameForTest(deviceInfo(caps2: 0x80));
// The channel must really exist, so the write really goes out: a write
// refused for an unresolvable slot would also set deviceUiError and
// pass this test for the wrong reason.
await syncChannels([(index: 0, name: 'Public', seed: 10)]);
await connector.setChannelNotify(slot(0), RadioChannelNotify.off);
expect(sentChannelNotify(), isTrue);
connector.handleFrameForTest(advertUnsupported());
expect(
connector.capabilityAdvertState,
CapabilityAdvertState.unknown,
reason: 'the advert must not claim a write refusal',
);
expect(connector.deviceUiError, isNotNull);
});
});
}

@ -0,0 +1,350 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/offband_capability_advert.dart';
import 'package:meshcore_open/connector/offband_device_ui.dart';
/// #1095: the `0xC5` `0x1C` capability advert.
///
/// The contract these pin is firmware `docs/offband_info_frame_contract.md`
/// revision 2 plus `OffbandConfigProtocol.h`, both merged on `firmware-base`
/// (PR OffbandMesh/meshcore-firmware#2000, `28785ebf`). The header is the
/// registry; the contract's §5 table is a convenience copy.
///
/// The load-bearing group is `unknown tags`. "A client built today must stay
/// correct against firmware emitting tags it has never heard of. Failing on an
/// unknown tag is non-conforming." Everything else can regress visibly; that
/// one regresses as a client that stops working when firmware grows.
void main() {
group('request frames', () {
test('the whole-advert request carries ZERO payload', () {
// Load-bearing. `[0xC5][0x7F][0x05]` is also what a known sub-code
// returns for a malformed payload, so only a zero-payload request makes
// that answer mean "this radio predates the advert". A stray third byte
// here would make the fallback undetectable.
expect(buildCapabilityAdvertRequestFrame(), [
cmdOffbandDeviceUi,
offbandUiInfoGet,
]);
});
test('the resume request carries exactly the cursor byte', () {
expect(buildCapabilityAdvertResumeFrame(0x03), [
cmdOffbandDeviceUi,
offbandUiInfoGet,
0x03,
]);
});
test('a cursor outside one byte is refused rather than truncated', () {
expect(() => buildCapabilityAdvertResumeFrame(256), throwsArgumentError);
expect(() => buildCapabilityAdvertResumeFrame(-1), throwsArgumentError);
});
});
group('not an advert', () {
test('a different command byte is not ours', () {
expect(parseCapabilityAdvertReply([0xC6, offbandUiInfoGet]), isNull);
});
test('a different sub-code is not ours', () {
expect(parseCapabilityAdvertReply([cmdOffbandDeviceUi, 0x18]), isNull);
});
test('a truncated header is not ours', () {
expect(parseCapabilityAdvertReply([cmdOffbandDeviceUi]), isNull);
expect(parseCapabilityAdvertReply(const <int>[]), isNull);
});
test('the 0x7F error frame is NOT parsed as an advert', () {
// The fallback path depends on this error reaching the error handler
// rather than being swallowed here as an empty advert. An empty advert
// and "predates the advert" gate differently.
expect(
parseCapabilityAdvertReply([cmdOffbandDeviceUi, offbandUiErr, 0x05]),
isNull,
);
});
});
group('records', () {
test('a reply with no records is valid and not an error', () {
// What a cursor above every available tag returns.
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
]);
expect(advert, isNotNull);
expect(advert!.tags, isEmpty);
expect(advert.malformed, isFalse);
expect(advert.continueCursor, isNull);
});
test('a len 0 record means SUPPORTED, not empty and not absent', () {
// The normal case, and the one most likely to be broken by someone
// treating the value rather than the key as the answer.
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.tags[offbandInfoTagChanNotify], isEmpty);
expect(advert.malformed, isFalse);
});
test('an absent tag is absent, and is not a zero value', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
])!;
expect(advert.has(offbandInfoTagDisplayRotation), isFalse);
expect(advert.byteValue(offbandInfoTagDisplayRotation), isNull);
});
test('several records parse, and a carried value is readable', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
offbandInfoTagDisplayRotation,
0x00,
offbandInfoTagAckCapacity,
0x01,
0x10,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.has(offbandInfoTagDisplayRotation), isTrue);
expect(advert.byteValue(offbandInfoTagAckCapacity), 0x10);
expect(advert.malformed, isFalse);
});
test(
'byteValue is null for a multi-byte or empty value, never coerced',
() {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
0x40,
0x02,
0xAA,
0xBB,
])!;
expect(advert.byteValue(offbandInfoTagChanNotify), isNull);
expect(advert.byteValue(0x40), isNull);
},
);
test(
'position is never relied on, so out-of-order records still parse',
() {
// "Clients MUST NOT rely on record position. Ascending order exists for
// the cursor, not for counting."
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagAckCapacity,
0x01,
0x08,
offbandInfoTagChanNotify,
0x00,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.byteValue(offbandInfoTagAckCapacity), 0x08);
},
);
});
group('unknown tags', () {
test('an unknown tag is skipped by len and the rest still parses', () {
// LOAD-BEARING. Firmware will emit tags this build has never heard of.
// A client that drops the frame, or that loses the records after the
// unknown one, stops working the day firmware grows a feature.
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
0x55,
0x03,
0xDE,
0xAD,
0xBE,
offbandInfoTagChanNotify,
0x00,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.has(0x55), isTrue);
expect(advert.malformed, isFalse);
});
test('an unknown zero-length tag does not stall the parse', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
0x7E,
0x00,
0x7F,
0x00,
offbandInfoTagDisplayRotation,
0x00,
])!;
expect(advert.has(offbandInfoTagDisplayRotation), isTrue);
expect(advert.malformed, isFalse);
});
test('a long run of unknown tags is all kept', () {
final frame = <int>[cmdOffbandDeviceUi, offbandUiInfoGet];
for (var tag = 0x20; tag < 0x30; tag++) {
frame.addAll([tag, 0x01, tag]);
}
frame.addAll([offbandInfoTagChanNotify, 0x00]);
final advert = parseCapabilityAdvertReply(frame)!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.byteValue(0x2F), 0x2F);
expect(advert.malformed, isFalse);
});
});
group('malformed', () {
test(
'a record running past the frame keeps the good records before it',
() {
// Firmware must not split a record across frames, so this is a firmware
// fault. Capability absence is safe (the feature hides); discarding a
// whole good reply over a bad trailing byte is not.
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
offbandInfoTagAckCapacity,
0x04,
0x01,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.has(offbandInfoTagAckCapacity), isFalse);
expect(advert.malformed, isTrue);
},
);
test('a tag with no length byte is malformed, earlier records survive', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
offbandInfoTagDisplayRotation,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.has(offbandInfoTagDisplayRotation), isFalse);
expect(advert.malformed, isTrue);
});
test('tag 0x00 is not valid and stops the parse', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
0x00,
0x00,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.malformed, isTrue);
});
test('a repeated tag keeps the FIRST value and is flagged', () {
// A later record must not silently redefine a capability.
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagAckCapacity,
0x01,
0x08,
offbandInfoTagAckCapacity,
0x01,
0x40,
])!;
expect(advert.byteValue(offbandInfoTagAckCapacity), 0x08);
expect(advert.malformed, isTrue);
});
});
group('continuation', () {
test('TAG_CONTINUE yields the cursor and the records before it', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
offbandInfoTagContinue,
0x01,
offbandInfoTagAckCapacity,
])!;
expect(advert.has(offbandInfoTagChanNotify), isTrue);
expect(advert.continueCursor, offbandInfoTagAckCapacity);
expect(advert.malformed, isFalse);
});
test('a reply without TAG_CONTINUE is complete', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagChanNotify,
0x00,
])!;
expect(advert.continueCursor, isNull);
});
test('TAG_CONTINUE with a length other than 1 is malformed', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagContinue,
0x02,
0x01,
0x02,
])!;
expect(advert.continueCursor, isNull);
expect(advert.malformed, isTrue);
});
test('records after TAG_CONTINUE are flagged, not guessed at', () {
final advert = parseCapabilityAdvertReply([
cmdOffbandDeviceUi,
offbandUiInfoGet,
offbandInfoTagContinue,
0x01,
0x03,
offbandInfoTagChanNotify,
0x00,
])!;
expect(advert.continueCursor, 0x03);
expect(advert.malformed, isTrue);
expect(advert.has(offbandInfoTagChanNotify), isFalse);
});
test('the continuation ceiling is bounded', () {
// An unbounded request loop driven by device data is a worse failure
// than a truncated capability list.
expect(offbandInfoMaxContinuations, greaterThan(0));
expect(offbandInfoMaxContinuations, lessThanOrEqualTo(16));
});
});
group('the registry numbers', () {
test('every tag and the sub-code match the merged firmware header', () {
// Transcribed from `OffbandConfigProtocol.h` on `firmware-base` at
// `28785ebf`. Do not "fix" a failure here by editing the expectation to
// match the code: read the header.
expect(offbandUiInfoGet, 0x1C);
expect(offbandInfoTagChanNotify, 0x01);
expect(offbandInfoTagDisplayRotation, 0x02);
expect(offbandInfoTagAckCapacity, 0x03);
expect(offbandInfoTagContinue, 0xFF);
});
});
}

@ -0,0 +1,188 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/meshcore_protocol.dart';
import 'package:meshcore_open/connector/offband_capability_advert.dart';
import 'package:meshcore_open/connector/offband_channel_notify.dart';
import 'package:meshcore_open/connector/offband_device_ui.dart';
import 'package:meshcore_open/connector/offband_screen_settings.dart';
import 'package:meshcore_open/connector/offband_tones.dart';
/// #1093: the mechanical check that was missing when two sessions both built
/// on `0xC5` sub-codes 0x18/0x19.
///
/// Nothing failed when that happened. Both features compiled, both passed
/// their own tests, both reviewed clean, and the collision would only have
/// appeared on the owner's hardware as one feature mis-dispatching in a way
/// that looked like either one being broken. The root cause was that
/// `firmware-base` stopped at 0x0A, so every allocation from 0x0B to 0x19 lived
/// only on unmerged branches and "take the next free pair" was unanswerable
/// from the merged tree.
///
/// That is now fixed at the source: firmware
/// `docs/offband_info_frame_contract.md` §2 requires a number to be merged to
/// `firmware-base` BEFORE a plan using it is approved and before any work
/// begins, and the claims live in a merged header the compiler reads.
///
/// This file is the client half: it fails if the client ever double-books a
/// sub-code, and it fails if the client drifts from the firmware registry.
///
/// THE AUTHORITY for this table is firmware
/// `examples/companion_radio/OffbandConfigProtocol.h`. Transcribed from
/// `28785ebf` on `firmware-base`, the merge of PR
/// OffbandMesh/meshcore-firmware#2000 ("claim the wire numbers for the three
/// offset-87 features"), 2026-11-04.
/// `[verified: 2026-11-04, git show origin/firmware-base:...]`
///
/// When firmware allocates a new code, update this table in the same change
/// that consumes it, and say in the PR which firmware commit you transcribed.
/// Do not "fix" a failure here by editing the expectation to match the code.
void main() {
/// Every `0xC5` sub-code the firmware registry allocates, with the name the
/// registry gives it. Codes firmware owns but the client does not implement
/// are listed too, so a future session cannot take one believing it free.
const registry = <int, String>{
0x01: 'SCOPE_GET',
0x02: 'SCOPE_SET',
0x03: 'MATRIX_GET',
0x04: 'MATRIX_SET',
0x05: 'DISPLAY_GET', // #542, firmware-side only so far
0x06: 'DISPLAY_SET', // #542, firmware-side only so far
0x07: 'LED_GET', // #542, firmware-side only so far
0x08: 'LED_SET', // #542, firmware-side only so far
0x09: 'SLOT_GET',
0x0A: 'SLOT_SET',
0x0B: 'CHTUNE_GET',
0x0C: 'CHTUNE_SET',
0x0D: 'GPS_GET',
0x0E: 'GPS_SET',
0x0F: 'EVTONE_GET',
0x10: 'EVTONE_SET',
0x11: 'TUNE_PLAY',
0x12: 'SLOT_READ',
0x13: 'SCREEN_GET',
0x14: 'TEXT_SET',
0x15: 'SCROFF_SET',
0x16: 'TZ_SET',
0x17: 'BATT_SET',
0x18: 'CHNOTIFY_GET',
0x19: 'CHNOTIFY_SET',
0x1A: 'ROTATION_GET',
0x1B: 'ROTATION_SET',
0x1C: 'INFO_GET',
0x7F: 'ERR',
};
/// What the client actually emits, by constant. Add a row here whenever a
/// new sub-code constant is introduced anywhere in `lib/connector/`.
const clientUses = <String, int>{
'offbandUiScopeGet': offbandUiScopeGet,
'offbandUiScopeSet': offbandUiScopeSet,
'offbandUiMatrixGet': offbandUiMatrixGet,
'offbandUiMatrixSet': offbandUiMatrixSet,
'offbandUiSlotGet': offbandUiSlotGet,
'offbandUiSlotSet': offbandUiSlotSet,
'offbandUiChannelTuneGet': offbandUiChannelTuneGet,
'offbandUiChannelTuneSet': offbandUiChannelTuneSet,
'offbandUiGpsGet': offbandUiGpsGet,
'offbandUiGpsSet': offbandUiGpsSet,
'offbandUiEventToneGet': offbandUiEventToneGet,
'offbandUiEventToneSet': offbandUiEventToneSet,
'offbandUiTunePlay': offbandUiTunePlay,
'offbandUiSlotRead': offbandUiSlotRead,
'offbandUiScreenGet': offbandUiScreenGet,
'offbandUiTextSet': offbandUiTextSet,
'offbandUiScreenOffSet': offbandUiScreenOffSet,
'offbandUiTimeZoneSet': offbandUiTimeZoneSet,
'offbandUiBatterySet': offbandUiBatterySet,
'offbandUiChannelNotifyGet': offbandUiChannelNotifyGet,
'offbandUiChannelNotifySet': offbandUiChannelNotifySet,
'offbandUiInfoGet': offbandUiInfoGet,
'offbandUiErr': offbandUiErr,
};
test('no two client sub-codes share a value', () {
// THE CHECK THAT WAS MISSING. #523 rotation and #544 channel notify both
// took 0x18/0x19; had both landed in the client, this would have caught it
// before any hardware saw it.
final byValue = <int, List<String>>{};
clientUses.forEach((name, code) {
byValue.putIfAbsent(code, () => []).add(name);
});
final doubled = byValue.entries.where((e) => e.value.length > 1).toList();
expect(
doubled,
isEmpty,
reason: doubled
.map(
(e) =>
'0x${e.key.toRadixString(16).padLeft(2, '0')} is claimed by '
'${e.value.join(" and ")}',
)
.join('; '),
);
});
test('every client sub-code is one firmware actually allocates', () {
// Catches a code invented client-side, which is how a session takes a
// number firmware has already spent on an unmerged branch.
clientUses.forEach((name, code) {
expect(
registry.containsKey(code),
isTrue,
reason:
'$name uses 0x${code.toRadixString(16).padLeft(2, '0')}, which is '
'not in the firmware registry. Get it allocated in '
'OffbandConfigProtocol.h and MERGED before shipping it.',
);
});
});
test('the client has not drifted from the registry on a shared code', () {
// Pins the specific pairs most likely to be re-allocated under pressure.
expect(registry[offbandUiChannelNotifyGet], 'CHNOTIFY_GET');
expect(registry[offbandUiChannelNotifySet], 'CHNOTIFY_SET');
expect(registry[offbandUiChannelTuneGet], 'CHTUNE_GET');
expect(registry[offbandUiChannelTuneSet], 'CHTUNE_SET');
expect(registry[offbandUiInfoGet], 'INFO_GET');
expect(registry[offbandUiErr], 'ERR');
});
test(
'rotation owns 0x1A/0x1B and the client never sends it on 0x18/0x19',
() {
// The collision, pinned. A rotation SET on 0x18/0x19 against firmware
// 4e5a6c85 writes a valid channel-notify mode onto channel slot 0, which
// is Public and undeletable, and both sides report success.
expect(registry[0x1A], 'ROTATION_GET');
expect(registry[0x1B], 'ROTATION_SET');
expect(offbandUiChannelNotifyGet, 0x18);
expect(offbandUiChannelNotifySet, 0x19);
},
);
test('0x1D is the next free sub-code', () {
// Recorded so the next feature does not repeat the guess. The header says
// it in terms: "Next free sub-code: 0x1D. 0x7F is OFFBAND_UI_ERR and is
// not available."
expect(registry.containsKey(0x1D), isFalse);
expect(clientUses.values.contains(0x1D), isFalse);
});
test('the advert tags match the merged registry', () {
expect(offbandInfoTagChanNotify, 0x01);
expect(offbandInfoTagDisplayRotation, 0x02);
expect(offbandInfoTagAckCapacity, 0x03);
expect(offbandInfoTagContinue, 0xFF);
});
test('caps2 0x80 is the last capability bit, and no byte 3 follows it', () {
// Contract §2, permanent: no Offband field is appended to upstream's
// device-info frame, ever. Capabilities past this bit are advert TAGS.
//
// This asserts the bit value only. The real guard that offset 87 is no
// longer read is behavioural and lives in
// channel_notify_connector_test.dart group A3, because a constant test
// cannot prove the absence of a read.
expect(offbandCap2ChannelNotify, 0x80);
});
}

@ -0,0 +1,117 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/offband_channel_notify.dart';
import 'package:meshcore_open/connector/offband_device_ui.dart';
import 'package:meshcore_open/l10n/app_localizations.dart';
import 'package:meshcore_open/widgets/radio_channel_notify.dart';
/// #544 Epic C task C3: what a channel row says the RADIO will actually do.
///
/// The owner's call (2026-11-03) was to show the composed result rather than
/// the raw stored byte. This pins the composition, because getting it wrong is
/// a lie to the user rather than a cosmetic slip: a muted radio showing a
/// channel as "All messages" is exactly the confusion this feature exists to
/// end.
///
/// Firmware's rules, per AM 1406: a channel with a mode set decides for
/// itself; a channel with no mode falls back to the device-wide scope; a
/// device scope of None overrides even a channel that is set.
void main() {
/// Resolves [radioChannelNotifyEffective] inside a localized context.
Future<String?> effective(
WidgetTester tester,
RadioChannelNotify? mode,
DeviceNotifyScope? scope,
) async {
String? result;
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Builder(
builder: (context) {
result = radioChannelNotifyEffective(context, mode, scope);
return const SizedBox.shrink();
},
),
),
);
await tester.pumpAndSettle();
return result;
}
testWidgets('a set mode decides for itself', (tester) async {
expect(
await effective(tester, RadioChannelNotify.all, DeviceNotifyScope.self),
'All messages',
);
expect(
await effective(
tester,
RadioChannelNotify.mentions,
DeviceNotifyScope.all,
),
'Mentions only',
);
expect(
await effective(tester, RadioChannelNotify.off, DeviceNotifyScope.all),
'Off',
);
});
testWidgets('an unset mode follows the device scope, named', (tester) async {
expect(
await effective(tester, RadioChannelNotify.unset, DeviceNotifyScope.self),
'Follows the radio: Self',
);
expect(
await effective(tester, RadioChannelNotify.unset, DeviceNotifyScope.all),
'Follows the radio: All',
);
});
testWidgets('a device scope of None overrides even a set channel', (
tester,
) async {
// The case that makes this composition load-bearing. A user who has muted
// the radio must not be told a channel is on "All messages".
expect(
await effective(tester, RadioChannelNotify.all, DeviceNotifyScope.none),
'Silent: the radio is set to None',
);
expect(
await effective(
tester,
RadioChannelNotify.mentions,
DeviceNotifyScope.none,
),
'Silent: the radio is set to None',
);
expect(
await effective(tester, RadioChannelNotify.unset, DeviceNotifyScope.none),
'Silent: the radio is set to None',
);
});
testWidgets('nothing is claimed before the radio has answered', (
tester,
) async {
// Null means "cannot be known yet", and the caller shows a reading state.
// It must never resolve to a mode we invented.
expect(await effective(tester, null, DeviceNotifyScope.all), isNull);
expect(await effective(tester, null, null), isNull);
expect(
await effective(tester, RadioChannelNotify.unset, null),
isNull,
reason: 'unset with an unknown scope composes to nothing truthful',
);
});
testWidgets('a set mode resolves without the scope being known', (
tester,
) async {
// A channel that decides for itself does not need the device scope, so it
// is shown immediately rather than waiting on a second read.
expect(await effective(tester, RadioChannelNotify.off, null), 'Off');
});
}

@ -136,12 +136,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -488,12 +499,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -840,12 +862,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -1192,12 +1225,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -1544,12 +1588,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -1896,12 +1951,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -2248,12 +2314,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -2600,12 +2677,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -2952,12 +3040,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -3304,12 +3403,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -3656,12 +3766,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -4008,12 +4129,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -4360,12 +4492,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -4712,12 +4855,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -5064,12 +5218,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -5416,12 +5581,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",
@ -5768,12 +5944,23 @@
"contact_cliConsole",
"channels_unconfirmedSlots",
"channels_retrySync",
"channels_erasedSlots",
"channels_restoreToRadio",
"channels_restoreToRadioConfirm",
"channels_restoreToRadioDone",
"channels_restoreToRadioFailed",
"channels_restoreToRadioPartial",
"channels_slotIdentityChanged",
"common_dismiss",
"channels_notifications",
"channels_notifyAll",
"channels_notifyMentionsOnly",
"channels_notifyOff",
"channels_radioSound",
"channels_radioSoundUnset",
"channels_radioSoundFollows",
"channels_radioSoundMutedByRadio",
"channels_radioSoundReading",
"composerBudgetBlockedTitle",
"composerBudgetLimitedTitle",
"composerBudgetBluetoothCause",

Loading…
Cancel
Save

Powered by TurnKey Linux.