Device.Net icon indicating copy to clipboard operation
Device.Net copied to clipboard

Windows and LibUsb factory extensions don't match

Open BryanCrotaz opened this issue 3 years ago • 2 comments

Signatures of Windows and LibUsb extensions don't match:

Windows version will accept List<FilterDeviceDefinition> but LibUsb will only accept ReadOnlyList<FilterDeviceDefinition>

Suggest changing LibUsb to accept IEnumerable<FilterDeviceDefinition> filterDeviceDefinitions which is backwards compatible.

public static IDeviceFactory CreateWindowsUsbDeviceFactory(
        this IEnumerable<FilterDeviceDefinition> filterDeviceDefinitions,
        ILoggerFactory loggerFactory = null,
        GetConnectedDeviceDefinitionsAsync getConnectedDeviceDefinitionsAsync = null,
        GetUsbInterfaceManager getUsbInterfaceManager = null,
        Guid? classGuid = null,
        ushort? readBufferSize = null,
        ushort? writeBufferSize = null
    )

public static IDeviceFactory CreateLibUsbDeviceFactory(
            this IReadOnlyList<FilterDeviceDefinition> filterDeviceDefinitions,
            ILoggerFactory loggerFactory = null,
            int? timeout = null,
            ushort? writeBufferSize = null,
            ushort? readBufferSize = null,
            Func<ConnectedDeviceDefinition, CancellationToken, Task<bool>> supportsDevice = null
            )

BryanCrotaz avatar Jun 28 '21 22:06 BryanCrotaz

They are different beasts really. It's more that the lib USB one needs a refactor and I couldn't really do that until lib USB dotnet is stable.

MelbourneDeveloper avatar Jul 07 '21 22:07 MelbourneDeveloper

You shouldn't need to worry about the optional parameters too much.

MelbourneDeveloper avatar Jul 07 '21 22:07 MelbourneDeveloper