setPendingImage method

Future<ImageState> setPendingImage(
  1. List<int> hash,
  2. bool confirm,
  3. Duration timeout
)

Marks the image with the specified hash as pending.

If confirm is false, the device will boot the image only once.

Implementation

Future<ImageState> setPendingImage(
    List<int> hash, bool confirm, Duration timeout) {
  return execute(
    Message(
      op: Operation.write,
      group: _imgGroup,
      id: _imgCmdState,
      flags: 0,
      data: CborMap({
        CborString("hash"): CborBytes(hash),
        CborString("confirm"): CborBool(confirm),
      }),
    ),
    timeout,
  ).unwrap().then((value) => ImageState(value.data));
}