Huddly.YaUVC 1.0.7

dotnet add package Huddly.YaUVC --version 1.0.7
NuGet\Install-Package Huddly.YaUVC -Version 1.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Huddly.YaUVC" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Huddly.YaUVC --version 1.0.7
#r "nuget: Huddly.YaUVC, 1.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Huddly.YaUVC as a Cake Addin
#addin nuget:?package=Huddly.YaUVC&version=1.0.7

// Install Huddly.YaUVC as a Cake Tool
#tool nuget:?package=Huddly.YaUVC&version=1.0.7

Overview

yauvc (Yet Another UVC) is a cross-platform library for USB video devices. It enables fine-grained control over USB video devices exporting the standard USB Video Class (UVC) interface, enabling developers to access UVC devices in a generic fashion. It was primarily developed for use by Huddly SDK for .NET.
C# wrapper are generated by SWIG (as part of the cmake build process).

Feature highlights

  • Cross-platform: Windows, macOS, Linux
  • Controls zoom, pan, tilt, gain, brightness etc.
  • Supports extension unit controls (XU controls)
  • Monitor device connection and disconnection
  • C# wrapper for .NET developers

Getting started

Here is a simple example of how to use yauvc to control a UVC device:

using Huddly.UVC.PInvoke;

namespace dotnet_sample;

class Program
{
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
    static async Task Main(string[] args)
    {
        // Vendor ID of the device is 0x2bd9
        var uvcDevice = new HuddlyUVCDevice(0x2bd9);
        uvcDevice.DeviceConnected += (sender, device) =>
        {
            var uvc = (HuddlyUVCDevice)sender;
            ShowDeviceInformation(uvc, device);
        };
        uvcDevice.DeviceDisconnected += (sender, device) =>
        {
            Console.WriteLine($"Device disconnected: {device.serialNumber}");
            Console.WriteLine();
        };

        try
        {
            // Start monitoring for device connection/disconnection using HuddlyUVCDevice
            // await uvcDevice.StartMonitoring();
            // await Task.Delay(200);

            // Find device by Pid and Serial number
            var device = uvcDevice.findDevice(0x21, "B44K00521");
            if (device is not null)
            {
                ShowDeviceInformation(uvcDevice, device);

                // Attention! Call this when the Device disconnected or disposed
                // it will remove the device from the internal cache
                uvcDevice.onDeviceDisconnected(device.pathName);
            }

            Console.WriteLine("Press any key to exit...");
            Console.WriteLine();
            Console.ReadKey();

            // Stop monitoring for device connection/disconnection (optional)
            // and cleanup the resources
            uvcDevice.StopMonitoring();
            uvcDevice.Dispose();
        }
        catch (Exception e)
        {
            Console.WriteLine($"Error: {e}");
        }

        Console.WriteLine("Exiting...");
    }

    static void ShowDeviceInformation(HuddlyUVCDevice uvc, DeviceParams device)
    {
        if (uvc.IsDisposed)
            return;
        
        Console.WriteLine(
            $"Device connected: {device.deviceName} VID=0x{device.vendorId:x4}, PID=0x{device.productId:x4}, Serial={device.serialNumber}"
        );
        Console.WriteLine($"Device Id: {device.pathName}");
        if (uvc.getPanTilt(device.pathName, out int pan, out int tilt))
            Console.WriteLine($"Pan: {pan}, Tilt: {tilt}");

        var settings = uvc.getSupportedSettings(device.pathName);
        Console.Write($"Supported setting:");
        foreach (var setting in settings)
        {
            Console.Write($" {setting}");
        }
        Console.WriteLine();

        var panRes = uvc.getSetting(device.pathName, "pan");
        if (panRes is not null)
            Console.WriteLine($"  pan: {panRes.cur} [{panRes.min}, {panRes.max}]");
        var tiltRes = uvc.getSetting(device.pathName, "tilt");
        if (tiltRes is not null)
            Console.WriteLine($"  tilt: {tiltRes.cur} [{tiltRes.min}, {tiltRes.max}]");
        var zoomRes = uvc.getSetting(device.pathName, "zoom");
        if (zoomRes is not null)
            Console.WriteLine($"  zoom: {zoomRes.cur} [{zoomRes.min}, {zoomRes.max}]");
        var brRes = uvc.getSetting(device.pathName, "brightness");
        if (brRes is not null)
            Console.WriteLine($"  brightness: {brRes.cur} [{brRes.min}, {brRes.max}]");
        Console.WriteLine();
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.7 103 2/16/2024
1.0.6 129 1/26/2024
1.0.5 90 1/25/2024
1.0.4 89 1/22/2024
1.0.3 78 1/22/2024
1.0.2 71 1/22/2024