initializeOnvif method

Future<void> initializeOnvif()

Implementation

Future<void> initializeOnvif() async {
  final authFile = File(globalResults!['config-file']);

  if (!authFile.existsSync()) {
    throw UsageException('Authentication file not found', usage);
  }

  final auth = json.decode(authFile.readAsStringSync());

  // configure device connection
  _onvif = await Onvif.connect(
    host: auth['host'],
    username: auth['username'],
    password: auth['password'],
    logOptions: OnvifUtil.convertToLogOptions(globalResults!['log-level']),
  );
}