73 changed files with 5603 additions and 3495 deletions
File diff suppressed because it is too large
@ -0,0 +1,190 @@ |
|||
using System.Runtime.InteropServices; |
|||
|
|||
namespace EC.Util.CameraSDK; |
|||
|
|||
public class DaHuaSDK : ICameraSDK |
|||
{ |
|||
#region Attr
|
|||
|
|||
private IntPtr LoginId { get; set; } = IntPtr.Zero; |
|||
|
|||
private IntPtr RealplayHandle { get; set; } = IntPtr.Zero; |
|||
|
|||
#endregion Attr
|
|||
|
|||
public DaHuaSDK(CameraInfo cameraInfo) : base(cameraInfo) |
|||
{ |
|||
} |
|||
|
|||
#region Base Method
|
|||
|
|||
public override bool Init() |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (ret) return true; |
|||
|
|||
DaHuaOriSDK.NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY stuInParam = new(); |
|||
stuInParam.dwSize = (uint)Marshal.SizeOf(stuInParam); |
|||
stuInParam.szIP = CameraInfo.Ip; |
|||
stuInParam.nPort = CameraInfo.Port; |
|||
stuInParam.szUserName = CameraInfo.UserName; |
|||
stuInParam.szPassword = CameraInfo.Password; |
|||
stuInParam.emSpecCap = DaHuaOriSDK.EM_LOGIN_SPAC_CAP_TYPE.TCP; |
|||
stuInParam.pCapParam = IntPtr.Zero; |
|||
DaHuaOriSDK.NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY stuOutParam = new(); |
|||
stuOutParam.dwSize = (uint)Marshal.SizeOf(stuOutParam); |
|||
LoginId = DaHuaOriSDK.CLIENT_LoginWithHighLevelSecurity(ref stuInParam, ref stuOutParam); |
|||
ret = ConnectSuccess(); |
|||
if (ret) DaHuaOriSDK.CLIENT_SetAutoReconnect(delegate (IntPtr lLoginID, IntPtr pchDVRIP, int nDVRPort, IntPtr dwUser) |
|||
{ |
|||
LoginId = lLoginID; |
|||
}, IntPtr.Zero); |
|||
|
|||
return ret; |
|||
} |
|||
|
|||
public override bool Destory() |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (!ret) return true; |
|||
|
|||
ret = DaHuaOriSDK.CLIENT_Logout(LoginId); |
|||
if (ret) LoginId = IntPtr.Zero; |
|||
|
|||
return ret; |
|||
} |
|||
|
|||
public override bool ConnectSuccess() |
|||
{ |
|||
return LoginId != IntPtr.Zero; |
|||
} |
|||
|
|||
public override void BuildException() |
|||
{ |
|||
uint errCode = (uint)DaHuaOriSDK.CLIENT_GetLastError(); |
|||
if (errCode == 0) return; |
|||
errCode -= 0x80000000; |
|||
throw CameraException.New(CameraInfo, (int)errCode); |
|||
} |
|||
|
|||
#endregion Base Method
|
|||
|
|||
#region Ptz Method
|
|||
|
|||
private static class GPIParams |
|||
{ |
|||
public static int Size { get; private set; } |
|||
public static Type Type { get; private set; } |
|||
|
|||
static GPIParams() |
|||
{ |
|||
DaHuaOriSDK.DH_PTZ_LOCATION_INFO info = new(); |
|||
Size = Marshal.SizeOf(info); |
|||
Type = info.GetType(); |
|||
} |
|||
} |
|||
|
|||
public override PtzInfo GetPtzInfo() |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (!ret) return PtzInfo.Default; |
|||
|
|||
DaHuaOriSDK.DH_PTZ_LOCATION_INFO entity = new(); |
|||
int nBufLen = GPIParams.Size; |
|||
int pRetLen = 0; |
|||
IntPtr ptrBuf = Marshal.AllocHGlobal(GPIParams.Size); |
|||
Marshal.StructureToPtr(entity, ptrBuf, true); |
|||
try |
|||
{ |
|||
ret = DaHuaOriSDK.CLIENT_QueryDevState(LoginId, (int)DaHuaOriSDK.EM_DEVICE_STATE.PTZ_LOCATION, ptrBuf, nBufLen, ref pRetLen, 3000); |
|||
if (!ret) { BuildException(); return PtzInfo.Default; } |
|||
object? objBuf = Marshal.PtrToStructure(ptrBuf, GPIParams.Type); |
|||
if (objBuf == null) return PtzInfo.Default; |
|||
entity = (DaHuaOriSDK.DH_PTZ_LOCATION_INFO)objBuf; |
|||
return PtzInfo.New(entity.nPTZPan, entity.nPTZTilt, entity.nPTZZoom); |
|||
} |
|||
finally |
|||
{ |
|||
Marshal.FreeHGlobal(ptrBuf); |
|||
} |
|||
} |
|||
|
|||
public override bool TryGetPtzInfo(out PtzInfo ptzInfo) |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (!ret) { ptzInfo = PtzInfo.Default; return false; } |
|||
|
|||
DaHuaOriSDK.DH_PTZ_LOCATION_INFO entity = new(); |
|||
int nBufLen = GPIParams.Size; |
|||
int pRetLen = 0; |
|||
IntPtr ptrBuf = Marshal.AllocHGlobal(GPIParams.Size); |
|||
Marshal.StructureToPtr(entity, ptrBuf, true); |
|||
try |
|||
{ |
|||
ret = DaHuaOriSDK.CLIENT_QueryDevState(LoginId, (int)DaHuaOriSDK.EM_DEVICE_STATE.PTZ_LOCATION, ptrBuf, nBufLen, ref pRetLen, 3000); |
|||
if (!ret) { BuildException(); ptzInfo = PtzInfo.Default; return false; } |
|||
object? objBuf = Marshal.PtrToStructure(ptrBuf, GPIParams.Type); |
|||
if (objBuf == null) { ptzInfo = PtzInfo.Default; return false; } |
|||
entity = (DaHuaOriSDK.DH_PTZ_LOCATION_INFO)objBuf; |
|||
ptzInfo = PtzInfo.New(entity.nPTZPan, entity.nPTZTilt, entity.nPTZZoom); |
|||
return true; |
|||
} |
|||
finally |
|||
{ |
|||
Marshal.FreeHGlobal(ptrBuf); |
|||
} |
|||
} |
|||
|
|||
public override bool PtzMove(int cmd, int stop, int speed) |
|||
{ |
|||
//if (!ConnectSuccess()) return false;
|
|||
//if (stop == 1) cmd = YuShiOriSDK.ALLSTOP;
|
|||
//int channel = 1;
|
|||
//int flag = YuShiOriSDK.NETDEV_PTZControl_Other(LoginId, channel, cmd, speed);
|
|||
//return flag == YuShiOriSDK.TRUE;
|
|||
|
|||
if (!ConnectSuccess()) return false; |
|||
|
|||
//DaHuaOriSDK.CLIENT_DHPTZControlEx2();
|
|||
|
|||
|
|||
return true; |
|||
} |
|||
|
|||
public override bool PtzPreset(int cmd, int presetId) |
|||
{ |
|||
//if (!ConnectSuccess()) return false;
|
|||
//int channel = 1;
|
|||
//int flag = YuShiOriSDK.NETDEV_PTZPreset_Other(LoginId, channel, cmd, Array.Empty<byte>(), presetId);
|
|||
//return flag == YuShiOriSDK.TRUE;
|
|||
if (!ConnectSuccess()) return false; |
|||
return true; |
|||
} |
|||
|
|||
#endregion Ptz Method
|
|||
|
|||
#region Video Method
|
|||
|
|||
public override void StartPlay(IntPtr hwnd) |
|||
{ |
|||
if (!ConnectSuccess() || IsPlaying()) return; |
|||
int channel = 1; |
|||
RealplayHandle = DaHuaOriSDK.CLIENT_RealPlayEx(LoginId, channel, hwnd, DaHuaOriSDK.EM_RealPlayType.Realplay); |
|||
if (RealplayHandle == IntPtr.Zero) BuildException(); |
|||
} |
|||
|
|||
public override void StopPlay() |
|||
{ |
|||
if (!IsPlaying()) return; |
|||
bool flag = DaHuaOriSDK.CLIENT_StopRealPlayEx(RealplayHandle); |
|||
RealplayHandle = IntPtr.Zero; |
|||
if (flag) BuildException(); |
|||
} |
|||
|
|||
public override bool IsPlaying() |
|||
{ |
|||
return RealplayHandle != IntPtr.Zero; |
|||
} |
|||
|
|||
#endregion Video Method
|
|||
} |
@ -0,0 +1,221 @@ |
|||
using System.Runtime.InteropServices; |
|||
|
|||
namespace EC.Util.CameraSDK; |
|||
|
|||
public static class YuShiOriSDK |
|||
{ |
|||
#region Lib Attr
|
|||
|
|||
public const string LibYsNetSDK = @"./libs/ys-win64/NetDEVSDK.dll"; |
|||
|
|||
#endregion Lib Attr
|
|||
|
|||
static YuShiOriSDK() |
|||
{ |
|||
GlobalInit(); |
|||
} |
|||
|
|||
#region Global
|
|||
|
|||
public static bool InitSuccess { get; private set; } |
|||
|
|||
public static bool GlobalInit() |
|||
{ |
|||
if (InitSuccess) return true; |
|||
bool ret = NETDEV_Init(); |
|||
InitSuccess = ret; |
|||
if (!ret) throw new Exception("YuShiOriSDK global init failure."); |
|||
return ret; |
|||
} |
|||
|
|||
public static bool GlobalDestory() |
|||
{ |
|||
if (!InitSuccess) return true; |
|||
bool ret = NETDEV_Cleanup(); |
|||
if (ret) InitSuccess = false; |
|||
return ret; |
|||
} |
|||
|
|||
#endregion Global
|
|||
|
|||
#region SDK Const
|
|||
|
|||
public const int TRUE = 1; |
|||
public const int FALSE = 0; |
|||
|
|||
public const int PtzSpeedMin = 1; |
|||
public const int PtzSpeedMax = 9; |
|||
|
|||
/* Common length */ |
|||
public const int NETDEV_LEN_64 = 64; |
|||
public const int NETDEV_LEN_128 = 128; |
|||
public const int NETDEV_LEN_132 = 132; |
|||
public const int NETDEV_LEN_260 = 260; |
|||
|
|||
/* NETDEV_PTZ_E */ |
|||
public const int ZOOMTELE_STOP = 0x0301; /* Zoom in stop */ |
|||
public const int ZOOMTELE = 0x0302; /* Zoom in */ |
|||
public const int ZOOMWIDE_STOP = 0x0303; /* Zoom out stop */ |
|||
public const int ZOOMWIDE = 0x0304; /* Zoom out */ |
|||
public const int TILTUP = 0x0402; /* Tilt up */ |
|||
public const int TILTDOWN = 0x0404; /* Tilt down */ |
|||
public const int PANRIGHT = 0x0502; /* Pan right */ |
|||
public const int PANLEFT = 0x0504; /* Pan left */ |
|||
public const int LEFTUP = 0x0702; /* Move up left */ |
|||
public const int LEFTDOWN = 0x0704; /* Move down left */ |
|||
public const int RIGHTUP = 0x0802; /* Move up right */ |
|||
public const int RIGHTDOWN = 0x0804; /* Move down right */ |
|||
public const int ALLSTOP = 0x0901; /* All-stop command word */ |
|||
public const int FOCUS_AND_IRIS_STOP = 0x0907; /* Focus & Iris-stop command word */ |
|||
public const int MOVE_STOP = 0x0908; /* move stop command word */ |
|||
public const int ZOOM_STOP = 0x0909; /* zoom stop command word */ |
|||
/* NETDEV_PTZ_PRESETCMD_E */ |
|||
public const int PRESET_SET = 0; /* Set preset */ |
|||
public const int PRESET_CLE = 1; /* Clear preset */ |
|||
public const int PRESET_GOTO = 2; /* Go to preset */ |
|||
|
|||
public enum NETDEV_LIVE_STREAM_INDEX_E : int |
|||
{ |
|||
NETDEV_LIVE_STREAM_INDEX_MAIN = 0, /* Main stream */ |
|||
NETDEV_LIVE_STREAM_INDEX_SUB = 1, /* Sub stream */ |
|||
NETDEV_LIVE_STREAM_INDEX_THIRD = 2, /* Third stream */ |
|||
|
|||
NETDEV_LIVE_STREAM_INDEX_INVALID |
|||
} |
|||
|
|||
public enum NETDEV_PROTOCAL_E : int |
|||
{ |
|||
NETDEV_TRANSPROTOCAL_RTPUDP = 0, /* UDP */ |
|||
NETDEV_TRANSPROTOCAL_RTPTCP = 1 /* TCP */ |
|||
} |
|||
|
|||
public enum NETDEV_PICTURE_FLUENCY_E |
|||
{ |
|||
NETDEV_PICTURE_REAL = 0, /* Real-time first */ |
|||
NETDEV_PICTURE_FLUENCY = 1, /* Fluency first */ |
|||
NETDEV_PICTURE_BALANCE_NEW = 3, /* Balance */ |
|||
NETDEV_PICTURE_RTMP_FLUENCY = 4, /* RTMP fluency first */ |
|||
|
|||
NETDEV_PICTURE_FLUENCY_INVALID = 0xff /* Invalid value */ |
|||
} |
|||
|
|||
#endregion SDK Const
|
|||
|
|||
#region SDK Struct
|
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct NETDEV_DEVICE_LOGIN_INFO_S |
|||
{ |
|||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NETDEV_LEN_260)] |
|||
public string szIPAddr; /* IP地址/域名 */ |
|||
|
|||
public int dwPort; /* 端口号 */ |
|||
|
|||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NETDEV_LEN_132)] |
|||
public string szUserName; /* 用户名 */ |
|||
|
|||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NETDEV_LEN_128)] |
|||
public string szPassword; /* 密码 */ |
|||
|
|||
public int dwLoginProto; /* 登录协议, 参见NETDEV_LOGIN_PROTO_E */ |
|||
public int dwDeviceType; /* 设备类型, 参见NETDEV_DEVICE_TYPE_E */ |
|||
|
|||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] |
|||
public byte[] byRes; /* Reserved */ |
|||
}; |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct NETDEV_SELOG_INFO_S |
|||
{ |
|||
public int dwSELogCount; |
|||
public int dwSELogTime; |
|||
|
|||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] |
|||
public byte[] byRes; |
|||
}; |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct NETDEV_VIDEO_CHL_DETAIL_INFO_S |
|||
{ |
|||
public int dwChannelID; |
|||
public int bPtzSupported; /* Whether ptz is supported */ |
|||
public int enStatus; /* Channel status */ |
|||
public int dwStreamNum; /* Number of streams */ |
|||
|
|||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NETDEV_LEN_64)] |
|||
public string szChnName; /* Device serial number */ |
|||
|
|||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] |
|||
public byte[] szReserve; |
|||
} |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct NETDEV_PTZ_STATUS_S |
|||
{ |
|||
public float fPanTiltX; /* 绝对水平坐标 Absolute horizontal coordinates*/ |
|||
public float fPanTiltY; /* 绝对竖直坐标 Absolute vertical coordinates*/ |
|||
public float fZoomX; /* 绝对聚焦倍数 Absolute multiples*/ |
|||
public int enPanTiltStatus;/* 云台状态 PTZ Status*/ |
|||
public int enZoomStatus; /* 聚焦状态 Focus Status*/ |
|||
}; |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct NETDEV_PREVIEWINFO_S |
|||
{ |
|||
public int dwChannelID; /* ID Channel ID */ |
|||
public int dwStreamType; /* #NETDEV_LIVE_STREAM_INDEX_E Stream type, see enumeration #NETDEV_LIVE_STREAM_INDEX_E */ |
|||
public int dwLinkMode; /* #NETDEV_PROTOCAL_E Transport protocol, see enumeration #NETDEV_PROTOCAL_E */ |
|||
public IntPtr hPlayWnd; /* Play window handle */ |
|||
public int dwFluency; /* #NETDEV_PICTURE_FLUENCY_E image play fluency*/ |
|||
public int dwStreamMode; /* #NETDEV_STREAM_MODE_E start stream mode see #NETDEV_STREAM_MODE_E*/ |
|||
public int dwLiveMode; /* #NETDEV_PULL_STREAM_MODE_E Rev. Flow pattern */ |
|||
public int dwDisTributeCloud; /* #NETDEV_DISTRIBUTE_CLOUD_SRV_E distribution */ |
|||
public int dwallowDistribution; /* allow or no distribution*/ |
|||
public int dwTransType; /* 传输类型,参见枚举# NETDEV_TRANS_TYPE_E */ |
|||
public int dwStreamProtocol; /* 起流协议,参见枚举# NETDEV_START_STREAM_PROT_E */ |
|||
|
|||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 236)] |
|||
public byte[] szReserve; /* Reserved */ |
|||
} |
|||
|
|||
#endregion SDK Struct
|
|||
|
|||
#region Common Method
|
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern bool NETDEV_Init(); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern bool NETDEV_Cleanup(); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern int NETDEV_GetLastError(); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern IntPtr NETDEV_Login_V30(ref NETDEV_DEVICE_LOGIN_INFO_S pstDevLoginInfo, ref NETDEV_SELOG_INFO_S pstSELogInfo); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern bool NETDEV_Logout(IntPtr lpUserID); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern int NETDEV_QueryVideoChlDetailList(IntPtr lpUserID, ref int pdwChlCount, IntPtr pstVideoChlList); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern bool NETDEV_PTZGetStatus(IntPtr lpUserID, int dwChannelID, ref NETDEV_PTZ_STATUS_S pstPTZStaus); |
|||
|
|||
//public boolean NETDEV_GetDevConfig(Pointer lpUserID, int dwChannelID, int dwCommand, Pointer lpOutBuffer, int dwOutBufferSize, IntByReference pdwBytesReturned);
|
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern int NETDEV_PTZControl_Other(IntPtr lpUserID, int dwChannelID, int dwPTZCommand, int dwSpeed); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern int NETDEV_PTZPreset_Other(IntPtr lpUserID, int dwChannelID, int dwPTZPresetCmd, byte[] szPresetName, int dwPresetID); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern IntPtr NETDEV_RealPlay(IntPtr lpUserID, ref NETDEV_PREVIEWINFO_S pstPreviewInfo, IntPtr cbPlayDataCallBack, IntPtr lpUserData); |
|||
|
|||
[DllImport(LibYsNetSDK, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
|||
public static extern int NETDEV_StopRealPlay(IntPtr lpRealHandle); |
|||
|
|||
#endregion Common Method
|
|||
} |
@ -0,0 +1,138 @@ |
|||
namespace EC.Util.CameraSDK; |
|||
|
|||
public class YuShiSDK : ICameraSDK |
|||
{ |
|||
#region Attr
|
|||
|
|||
private IntPtr LoginId { get; set; } = IntPtr.Zero; |
|||
|
|||
private IntPtr RealplayHandle { get; set; } = IntPtr.Zero; |
|||
|
|||
#endregion Attr
|
|||
|
|||
public YuShiSDK(CameraInfo cameraInfo) : base(cameraInfo) |
|||
{ |
|||
} |
|||
|
|||
#region Base Method
|
|||
|
|||
public override bool Init() |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (ret) return true; |
|||
|
|||
YuShiOriSDK.NETDEV_DEVICE_LOGIN_INFO_S loginInfo = new(); |
|||
loginInfo.szIPAddr = CameraInfo.Ip; |
|||
loginInfo.dwPort = CameraInfo.Port; |
|||
loginInfo.szUserName = CameraInfo.UserName; |
|||
loginInfo.szPassword = CameraInfo.Password; |
|||
YuShiOriSDK.NETDEV_SELOG_INFO_S logInfo = new(); |
|||
LoginId = YuShiOriSDK.NETDEV_Login_V30(ref loginInfo, ref logInfo); |
|||
ret = ConnectSuccess(); |
|||
|
|||
return ret; |
|||
} |
|||
|
|||
public override bool Destory() |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (!ret) return true; |
|||
|
|||
ret = YuShiOriSDK.NETDEV_Logout(LoginId); |
|||
if (ret) LoginId = IntPtr.Zero; |
|||
|
|||
return ret; |
|||
} |
|||
|
|||
public override bool ConnectSuccess() |
|||
{ |
|||
return LoginId != IntPtr.Zero; |
|||
} |
|||
|
|||
public override void BuildException() |
|||
{ |
|||
int errCode = YuShiOriSDK.NETDEV_GetLastError(); |
|||
if (errCode == 0) return; |
|||
throw CameraException.New(CameraInfo, errCode); |
|||
} |
|||
|
|||
#endregion Base Method
|
|||
|
|||
#region Ptz Method
|
|||
|
|||
public override PtzInfo GetPtzInfo() |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (!ret) return PtzInfo.Default; |
|||
|
|||
YuShiOriSDK.NETDEV_PTZ_STATUS_S entity = new(); |
|||
ret = YuShiOriSDK.NETDEV_PTZGetStatus(LoginId, 1, ref entity); |
|||
if (!ret) { BuildException(); return PtzInfo.Default; } |
|||
|
|||
return PtzInfo.New(entity.fPanTiltX, entity.fPanTiltY, entity.fZoomX); |
|||
} |
|||
|
|||
public override bool TryGetPtzInfo(out PtzInfo ptzInfo) |
|||
{ |
|||
bool ret = ConnectSuccess(); |
|||
if (!ret) { ptzInfo = PtzInfo.Default; return false; } |
|||
|
|||
YuShiOriSDK.NETDEV_PTZ_STATUS_S entity = new(); |
|||
ret = YuShiOriSDK.NETDEV_PTZGetStatus(LoginId, 1, ref entity); |
|||
if (!ret) { BuildException(); ptzInfo = PtzInfo.Default; return false; } |
|||
|
|||
ptzInfo = PtzInfo.New(entity.fPanTiltX, entity.fPanTiltY, entity.fZoomX); |
|||
return true; |
|||
} |
|||
|
|||
public override bool PtzMove(int cmd, int stop, int speed) |
|||
{ |
|||
if (!ConnectSuccess()) return false; |
|||
if (stop == 1) cmd = YuShiOriSDK.ALLSTOP; |
|||
int channel = 1; |
|||
int flag = YuShiOriSDK.NETDEV_PTZControl_Other(LoginId, channel, cmd, speed); |
|||
return flag == YuShiOriSDK.TRUE; |
|||
} |
|||
|
|||
public override bool PtzPreset(int cmd, int presetId) |
|||
{ |
|||
if (!ConnectSuccess()) return false; |
|||
int channel = 1; |
|||
int flag = YuShiOriSDK.NETDEV_PTZPreset_Other(LoginId, channel, cmd, Array.Empty<byte>(), presetId); |
|||
return flag == YuShiOriSDK.TRUE; |
|||
} |
|||
|
|||
#endregion Ptz Method
|
|||
|
|||
#region Video Method
|
|||
|
|||
public override void StartPlay(IntPtr hwnd) |
|||
{ |
|||
if (!ConnectSuccess() || IsPlaying()) return; |
|||
YuShiOriSDK.NETDEV_PREVIEWINFO_S stPreviewInfo = new() |
|||
{ |
|||
hPlayWnd = hwnd, |
|||
dwChannelID = 1, |
|||
dwStreamType = 0, // YuShiOriSDK.NETDEV_LIVE_STREAM_INDEX_E
|
|||
dwLinkMode = 1, // YuShiOriSDK.NETDEV_PROTOCAL_E
|
|||
dwFluency = 0, // YuShiOriSDK.NETDEV_PICTURE_FLUENCY_E
|
|||
}; |
|||
RealplayHandle = YuShiOriSDK.NETDEV_RealPlay(LoginId, ref stPreviewInfo, IntPtr.Zero, IntPtr.Zero); |
|||
if (RealplayHandle == IntPtr.Zero) BuildException(); |
|||
} |
|||
|
|||
public override void StopPlay() |
|||
{ |
|||
if (!IsPlaying()) return; |
|||
int flag = YuShiOriSDK.NETDEV_StopRealPlay(RealplayHandle); |
|||
RealplayHandle = IntPtr.Zero; |
|||
if (flag == YuShiOriSDK.FALSE) BuildException(); |
|||
} |
|||
|
|||
public override bool IsPlaying() |
|||
{ |
|||
return RealplayHandle != IntPtr.Zero; |
|||
} |
|||
|
|||
#endregion Video Method
|
|||
} |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,31 @@ |
|||
using System.Net; |
|||
|
|||
namespace JiLinApp.Docking.FenceAlarm; |
|||
|
|||
/// <summary>
|
|||
/// 接收到数据报文事件参数
|
|||
/// </summary>
|
|||
/// <typeparam name="T">报文类型</typeparam>
|
|||
public class UdpDatagramReceivedEventArgs<T> : EventArgs |
|||
{ |
|||
/// <summary>
|
|||
/// 客户端
|
|||
/// </summary>
|
|||
public IPEndPoint Ipep { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// 报文
|
|||
/// </summary>
|
|||
public T Datagram { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// 接收到数据报文事件参数
|
|||
/// </summary>
|
|||
/// <param name="tcpClient">客户端</param>
|
|||
/// <param name="datagram">报文</param>
|
|||
public UdpDatagramReceivedEventArgs(IPEndPoint ipep, T datagram) |
|||
{ |
|||
Ipep = ipep ?? throw new ArgumentNullException(nameof(ipep)); |
|||
Datagram = datagram; |
|||
} |
|||
} |
@ -1,17 +0,0 @@ |
|||
namespace JiLinApp.Docking.VibrateAlarm; |
|||
|
|||
public class TcpSectionTable |
|||
{ |
|||
public int id { get; set; } |
|||
public int deviceID { get; set; } |
|||
|
|||
public string name { get; set; } |
|||
public string lat { get; set; } |
|||
|
|||
public string lng { get; set; } |
|||
|
|||
public string channel { get; set; } |
|||
|
|||
public string mode { get; set; } |
|||
public string sensitivity { get; set; } |
|||
} |
@ -0,0 +1,20 @@ |
|||
namespace JiLinApp.Docking.VibrateAlarm; |
|||
|
|||
public class TcpSensorTable |
|||
{ |
|||
public int Id { get; set; } |
|||
|
|||
public int DeviceId { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string Lat { get; set; } |
|||
|
|||
public string Lng { get; set; } |
|||
|
|||
public string Channel { get; set; } |
|||
|
|||
public string Mode { get; set; } |
|||
|
|||
public string Sensitivity { get; set; } |
|||
} |
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,10 @@ |
|||
<Window x:Class="JiLinApp.Components.CameraRealPlay" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" |
|||
Title="RealPlay" Height="430" Width="640" ShowInTaskbar=" False"> |
|||
<Image Name="player"> |
|||
</Image> |
|||
</Window> |
@ -1,10 +0,0 @@ |
|||
<Window x:Class="JiLinApp.Components.HikRealPlay" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" |
|||
Title="HikRealPlay" Height="430" Width="640" ShowInTaskbar="False"> |
|||
<Image Name="player"> |
|||
</Image> |
|||
</Window> |
Loading…
Reference in new issue