setPowerMode method

  1. @override
Future<void> setPowerMode(
  1. PowerMode powerMode,
  2. int seconds,
  3. int nanos, {
  4. Map<String, dynamic>? extra,
})
override

Set the board to the indicated power mode.

// Set the power mode of the board to offline deep for 60 seconds
// Requires importing 'package:viam_sdk/protos/component/board.dart'
const powerMode = PowerMode.POWER_MODE_OFFLINE_DEEP;
await myBoard.setPowerMode(powerMode, 60, 0);

For more information, see Board component.

Implementation

@override
Future<void> setPowerMode(PowerMode powerMode, int seconds, int nanos, {Map<String, dynamic>? extra}) async {
  final duration = grpc_duration.Duration()
    ..seconds = Int64(seconds)
    ..nanos = nanos;
  final request = SetPowerModeRequest()
    ..name = name
    ..powerMode = powerMode
    ..duration = duration
    ..extra = extra?.toStruct() ?? Struct();
  await client.setPowerMode(request);
}