getStatus method

Future<StatusResult?> getStatus({
  1. int timeout = 5,
  2. bool cache = true,
})

获取设备状态 @param cache 是否使用缓存,默认为true 使用缓存

Implementation

Future<StatusResult?> getStatus({int timeout = 5, bool cache = true}) async {
  if (cache) {
    return statusResult;
  }
  var getstatus = 'get_status.cgi?';
  if (isVirtualId) {
    getstatus = 'get_status.cgi?vuid=$id&';
  }

  bool ret = await writeCgi(getstatus, timeout: timeout);
  if (ret) {
    CommandResult result = await waitCommandResult((int cmd, Uint8List data) {
      return cmd == 24577;
    }, timeout);
    if (result.isSuccess) {
      statusResult = StatusResult.form(result);
      return statusResult;
    }
  }
  return statusResult;
}