async Task <bool> tryInitializeFTDIInterfaceIfRequiredAsync(DeviceOperationScope scope, CancellationToken cancellation) { if (_pipe.InterfaceDevice == InterfaceDevice.RUS_TECHNOLOGICAL_MODULE_FTDI_BOX) { if (_ftdiInterface == null) { _ftdiInterface = await FTDIBoxFeatures.CreateAsync(_pipe, scope, cancellation); } if (_ftdiInterface == null) { Logger.LogErrorEverywhere("Не удалось инициализировать"); } return(_ftdiInterface != null); } else { return(true); } }
protected override async Task deactivateDeviceAsync(DeviceOperationScope scope, AsyncOperationInfo cancellation) { await base.deactivateDeviceAsync(scope, cancellation); _ftdiInterface = null; }