PM.BLL/PMCommunicator.cs
/// <summary>
/// Checks if the device is valid and can be communicated with
/// </summary>
/// <param name="device">The device</param>
/// <returns>True if valid, false otherwise</returns>
Checks if the device is valid and can be communicated with
Checks if the device is valid and can be communicated with
private bool IsValidDevice(IUsbDevice device)
        {
            if (device == null)
            {
                _logger.LogWarning("Device was found, but discovered to be null");
                return false;
            }
            if (!device.Configs.Any())
            {
                _logger.LogWarning("Device was found, but had no configuration.");
                return false;
            }
            if (!device.Configs[0].Interfaces.Any())
            {
                _logger.LogWarning("Device was found, but had no interfaces.");
                return false;
            }
            if (device.Configs[0].Interfaces[0].Endpoints.Count != 2)
            {
                _logger.LogWarning("Device was found, but did not have 2 endpoints.");
                return false;
            }
            return true;
        }
private bool IsValidDevice ( IUsbDevice device ) { if ( device == null ) { _logger . LogWarning ( " " ) ; return false ; } if ( ! device . Configs . Any ( ) ) { _logger . LogWarning ( " " ) ; return false ; } if ( ! device . Configs [ 0 ] . Interfaces . Any ( ) ) { _logger . LogWarning ( " " ) ; return false ; } if ( device . Configs [ 0 ] . Interfaces [ 0 ] . Endpoints . Count != 2 ) { _logger . LogWarning ( " " ) ; return false ; } return true ; }
Checks if the device is valid and can be communicated with
Checks if the device is valid and can be communicated with
True if valid, false otherwise
True if valid false otherwise
device
IUsbDevice
None