Dahua.Api
1.0.1
dotnet add package Dahua.Api --version 1.0.1
NuGet\Install-Package Dahua.Api -Version 1.0.1
<PackageReference Include="Dahua.Api" Version="1.0.1" />
paket add Dahua.Api --version 1.0.1
#r "nuget: Dahua.Api, 1.0.1"
// Install Dahua.Api as a Cake Addin #addin nuget:?package=Dahua.Api&version=1.0.1 // Install Dahua.Api as a Cake Tool #tool nuget:?package=Dahua.Api&version=1.0.1
Dahua.Api
Available as nuget
dotnet add package Dahua.Api --version 1.0.1
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.63", 37777, "admin", "pass");
Logout
session.Logout();
DahuaApi.Cleanup();
Print list of IP channels for NVR (IP Camera use hikapi.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 | Versions 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. |
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.
Initial release. Added base functionality