Exemple #1
0
        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);
            }
        }
Exemple #2
0
        protected override async Task deactivateDeviceAsync(DeviceOperationScope scope, AsyncOperationInfo cancellation)
        {
            await base.deactivateDeviceAsync(scope, cancellation);

            _ftdiInterface = null;
        }