You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.6 KiB
124 lines
3.6 KiB
using EC.Helper.CameraSDK;
|
|
|
|
namespace EC.Helper.Test;
|
|
|
|
public class CameraSDKTest
|
|
{
|
|
public static void Test()
|
|
{
|
|
//HiKTest();
|
|
//DaHuaTest();
|
|
//YuShiTest();
|
|
}
|
|
|
|
public static void HiKTest()
|
|
{
|
|
Console.WriteLine("====HiK==========================");
|
|
|
|
try
|
|
{
|
|
string ip = "192.168.1.65";
|
|
string username = "admin";
|
|
string password = "hk123456";
|
|
int type = (int)CameraType.HiK;
|
|
CameraInfo cameraInfo = CameraInfo.New(type, ip, username, password);
|
|
ICameraSDK sdk = new HiKSDK(cameraInfo);
|
|
ICameraSDK sdk2 = new HiKSDK(cameraInfo);
|
|
sdk.Init();
|
|
sdk2.Init();
|
|
|
|
PtzInfo ptzInfo = sdk.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
|
|
sdk.Destory();
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
ptzInfo = sdk.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
|
|
ptzInfo = sdk2.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine(e.ToString());
|
|
throw;
|
|
}
|
|
Console.WriteLine("=================================");
|
|
}
|
|
|
|
public static void DaHuaTest()
|
|
{
|
|
Console.WriteLine("====DaHua========================");
|
|
|
|
try
|
|
{
|
|
string ip = "192.168.1.71";
|
|
string username = "admin";
|
|
string password = "hk123456";
|
|
int type = (int)CameraType.DaHua;
|
|
CameraInfo cameraInfo = CameraInfo.New(type, ip, username, password);
|
|
ICameraSDK sdk = new DaHuaSDK(cameraInfo);
|
|
ICameraSDK sdk2 = new DaHuaSDK(cameraInfo);
|
|
sdk.Init();
|
|
sdk2.Init();
|
|
PtzInfo ptzInfo = sdk.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
|
|
sdk.Destory();
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
ptzInfo = sdk.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
|
|
ptzInfo = sdk2.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine(e.ToString());
|
|
throw;
|
|
}
|
|
|
|
Console.WriteLine("=================================");
|
|
}
|
|
|
|
public static void YuShiTest()
|
|
{
|
|
Console.WriteLine("====YuShi========================");
|
|
|
|
try
|
|
{
|
|
string ip = "192.168.1.109";
|
|
string username = "admin";
|
|
string password = "hk123456";
|
|
int type = (int)CameraType.YuShi;
|
|
CameraInfo cameraInfo = CameraInfo.New(type, ip, username, password);
|
|
ICameraSDK sdk = new YuShiSDK(cameraInfo);
|
|
ICameraSDK sdk2 = new YuShiSDK(cameraInfo);
|
|
sdk.Init();
|
|
sdk2.Init();
|
|
PtzInfo ptzInfo = sdk.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
|
|
sdk.Destory();
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
ptzInfo = sdk.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
|
|
ptzInfo = sdk2.GetPtzInfo();
|
|
Console.WriteLine($"{ptzInfo.Pan}, {ptzInfo.Tilt}, {ptzInfo.Zoom}");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine(e.ToString());
|
|
throw;
|
|
}
|
|
|
|
Console.WriteLine("=================================");
|
|
}
|
|
}
|