public void PTZCtl(int cameraId, CMS_GUID guid, PTZOperation opt) { Logger.Instance.WriteLog("请求PTZCtl"); bool ret = client.SetPTZControl(cameraId, guid, opt, 1, 1, 1, 0, PTZCtlCallback); if (ret) { Logger.Instance.WriteLog("请求PTZCtl成功"); } else { Logger.Instance.WriteLog("请求PTZCtl失败。CameraId:" + cameraId); } }
public bool SetPTZControl(int cameraId, CMS_GUID guid, PTZOperation nCtrlType, UInt16 nSpeedX, UInt16 nSpeedY, UInt16 nSpeedZ, int nPreset, ReturnCallback CallbackFunction) { NetworkMsgAnalysis.GetInstance().SetPTZCtrlCallback = CallbackFunction; CTOS_PTZ_INFO PTZinfo = new CTOS_PTZ_INFO(); PTZinfo.cameraId = cameraId; PTZinfo.camareGuid = guid; PTZinfo.type = (UInt16)nCtrlType; PTZinfo.speedX = nSpeedX; PTZinfo.speedY = nSpeedY; PTZinfo.speedZ = nSpeedZ; PTZinfo.nPreset = nPreset; ALLST_GENERIC stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_SETPTZCTRL_MSG, Marshal.SizeOf(typeof(CTOS_PTZ_INFO))); byte[] msg = new byte[m_iHeaderLen + stHeader.iMessageLen]; byte[] b_header = StructToBytes(stHeader); byte[] b_PTZinfo = StructToBytes(PTZinfo); Buffer.BlockCopy(b_header, 0, msg, 0, m_iHeaderLen); Buffer.BlockCopy(b_PTZinfo, 0, msg, m_iHeaderLen, b_PTZinfo.Length); return(Send(msg)); }