getEpoch method

Future<SetEpochResponse> getEpoch(
  1. String address, {
  2. int timeout = kScenarioCmdTimeout,
})

Will request for the Epoch time stored on the device at address

Implementation

Future<SetEpochResponse> getEpoch(String address, {int timeout = kScenarioCmdTimeout}) async {
  _checkValidAddress(address, shouldCheckGroupFormat: false);
  final r = Random();
  final correlation = int.parse(address, radix: 16) + r.nextInt(1 << 15);
  return SetEpochResponse.fromJson(await _sendRequest(
    'set_epoch',
    params: <String, dynamic>{
      'node_address': address,
      'request': {
        'command': 'get time',
        'correlation': correlation,
      },
      'timeout': timeout,
    },
  ));
}