Implementation
Onvif(
{required host,
required this.username,
required this.password,
required LogOptions logOptions,
required LoggyPrinter printer}) {
Loggy.initLoggy(logPrinter: printer, logOptions: logOptions);
final dio = 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
}));
Soap.dio = dio;
// Logger.root.onRecord.listen((LogRecord record) => logOutput!.write(sprintf(
// '%26s %7s - %5s - %s\n',
// [record.time, record.level, record.loggerName, record.message])));
deviceManagement =
DeviceManagement(onvif: this, uri: 'http://$host/onvif/device_service');
}