Dahua.Api 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dahua.Api --version 1.0.0                
NuGet\Install-Package Dahua.Api -Version 1.0.0                
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="Dahua.Api" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dahua.Api --version 1.0.0                
#r "nuget: Dahua.Api, 1.0.0"                
#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 Dahua.Api as a Cake Addin
#addin nuget:?package=Dahua.Api&version=1.0.0

// Install Dahua.Api as a Cake Tool
#tool nuget:?package=Dahua.Api&version=1.0.0                

Dahua.Api

  • Available as nuget

  • dotnet add package Dahua.Api --version 1.0.0

  • NuGet Downloads

  • Wrapper over Dahua SDK. It allows login, fetch videos list, download videos, get config list and more.

  • Or just run console app sample

Initialization

DahuaApi.Init();

Login. Returns DahuaApi

var session = DahuaApi.Login("192.168.1.64", 8000, "admin", "pass");

Logout

session.Logout();
DahuaApi.Cleanup();

Print list of IP channels for NVR (IP Camera use session.Device.DefaultIpChannel)

Console.WriteLine("Channel:" + string.Join(",", session.AllChannels.Select(t => $"Channel{t.Id}_{t.Name}")));

Get machine name.

session.ConfigService.GetMachineName();

Get device serial number.

session.ConfigService.GetDeviceSerialNumber();

Get device type.

session.ConfigService.GetDeviceType();

Get device current time

session.ConfigService.GetTime();

Set device time

var currentTime = DateTime.Now;
session.ConfigService.SetTime(currentTime);

Video service

Get videos list from IP Camera (default IP channel). Returns IReadOnlyCollection<RemoteFile>

var videos = session.VideoService.FindFiles(DateTime.Today, DateTime.Now);

Get videos list from IP Camera (specific IP channel)

int channel = 2;
var videos = session.VideoService.FindFiles(DateTime.Today, DateTime.Now, channel);

Download video

foreach (var video in videos)
{
    Console.WriteLine(video.Name);
    var name = $"{video.Date.ToString(DateFormat)}_{video.Duration}.mp4";
    var destinationPath = Path.Combine(@$"C:\Users\{Environment.UserName}\Desktop", name);
    var downloadId = session.VideoService.StartDownloadFile(video, destinationPath);
    if (downloadId > 0)
    {
        Console.WriteLine($"Downloading {destinationPath}");
        do
        {
            await Task.Delay(5000);
            var downloadProgress = session.VideoService.GetDownloadPosition(downloadId);
            Console.WriteLine($"Downloading {downloadProgress} %");
            if (downloadProgress.downloadSize == downloadProgress.totalSize)
            {
                session.VideoService.StopDownloadFile(downloadId);
                break;
            }
            else if (!downloadProgress.success)
            {
                throw new InvalidOperationException($"UpdateDownloadProgress failed, progress value = {downloadProgress}");
            }
        }
        while (true);
        Console.WriteLine($"Downloaded {destinationPath}");
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.1 565 2/17/2024
1.0.0 320 1/11/2024

Initial release. Added base functionality