Onvif constructor

Onvif(
  1. {required AuthInfo authInfo,
  2. required LogOptions logOptions,
  3. required LoggyPrinter printer}
)

Implementation

Onvif(
    {required this.authInfo,
    required LogOptions logOptions,
    required LoggyPrinter printer})
    : _hostUri = (authInfo.host.startsWith('http')
              ? authInfo.host
              : 'http://${authInfo.host}')
          .parseUri {
  Loggy.initLoggy(logPrinter: printer, logOptions: logOptions);

  final dio = Dio()
    ..interceptors.add(InterceptorsWrapper(onRequest: (options, handler) {
      loggy.debug('URI: ${options.uri}');

      loggy.debug('REQUEST:\n${options.data}');

      return handler.next(options); //continue
    }, onResponse: (response, handler) {
      loggy.debug('RESPONSE:\n${response.data}');

      return handler.next(response); // continue
    }, onError: (DioError e, handler) {
      loggy.error('ERROR:\n$e');

      return handler.next(e); //continue
    }));

  _transport = soap.Transport(dio: dio, authInfo: authInfo);

  _deviceManagement = DeviceManagement(
      transport: transport,
      uri: '${_hostUri.origin}/onvif/device_service'.parseUri);
}