Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/CAPABILITIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Provides firmware slot or image-table state for FOTA backends that expose it.
final slotInfo = wearable.getCapability<FotaSlotInfoCapability>();
if (slotInfo != null) {
final slots = await slotInfo.readFirmwareSlots();
await slotInfo.eraseFirmwareSlot();
}
```

Expand Down
21 changes: 20 additions & 1 deletion doc/FOTA.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,25 @@ Each `FirmwareSlotInfo` contains:
This is useful when you want to show the current primary and secondary images
before or after an update.

## Erase An Inactive Firmware Slot

Slot-aware wearables can erase an inactive firmware image slot through
`FotaSlotInfoCapability`:

```dart
final slotInfo = wearable.getCapability<FotaSlotInfoCapability>();
if (slotInfo != null) {
await slotInfo.eraseFirmwareSlot();
await slotInfo.eraseFirmwareSlot(channel: 1);
}
```

When `channel` is omitted, the firmware backend erases its default secondary
image slot. When `channel` is provided, the erase request targets that raw
mcumgr image slot channel. Devices reject erase requests for slots that contain
a confirmed image, an image pending test on the next reboot, or an active
split-image slot.

## What Happens Internally

You do not need to call the lower-level handler classes directly, but it helps to know what `UpdateBloc` is doing:
Expand Down Expand Up @@ -367,7 +386,7 @@ Recommended UX:
- `UnifiedFirmwareRepository` caches results for 15 minutes unless you request a refresh
- The current upload path uses `mcumgr_flutter` under the hood
- `FotaSlotInfoCapability` is optional and only available on wearables whose firmware backend exposes slot-style state
- `mcumgr_flutter 0.6.1` does not expose an API to erase an individual image slot, so this library does not currently offer slot erase either
- The current local `mcumgr_flutter` integration exposes slot erase through `FotaSlotInfoCapability.eraseFirmwareSlot`

## Related Source Files

Expand Down
1 change: 1 addition & 0 deletions example/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
jni
)

set(PLUGIN_BUNDLED_LIBRARIES)
Expand Down
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import Foundation

import file_picker
import flutter_archive
import mcumgr_flutter
import universal_ble

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FlutterArchivePlugin.register(with: registry.registrar(forPlugin: "FlutterArchivePlugin"))
McumgrFlutterPlugin.register(with: registry.registrar(forPlugin: "McumgrFlutterPlugin"))
UniversalBlePlugin.register(with: registry.registrar(forPlugin: "UniversalBlePlugin"))
}
Loading
Loading