public bool UpdateCrowd(RealtimeCameraInfo cam, List <System.Drawing.Point> region, float area, uint time) { bool ret = false; //List<CrowdCameraInfo> list = CameraManagementService.GetCamerasByGroupID(0); //CrowdCameraInfo cam = list.Find(item => item.CameraCode == cameraCode); if (cam != null) { RealAnalyseInfo info = GetAllCrowd().Find(item => item.realAnalyseParam.eAlgthmType == E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROWD && item.realAnalyseParam.realCameraInfo.szCameraID == cam.CameraID); if (info != null) { SaveEvent(cam.CameraID); DelCrowd(cam.CameraID); uint id = AddCrowd(cam, region, area, time); RecoverEvent(id); } else { ret = false; } } else { ret = false; } return(ret); }
public uint AddCrowd(RealtimeCameraInfo cam, List <System.Drawing.Point> region, float area, uint time) { if (GetRealAnalyseCapableLeft() > 0) { AdpsServerUnitInfo unit = GetOneProcessAdps(); string pChannelId = cam.CameraID; RealAnalyseParam param = new RealAnalyseParam() { eAlgthmType = E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROWD, realCameraInfo = new RealCameraInfo() { dwDevicePort = (ushort)cam.PlatPort, dwDeviceType = (uint)cam.ProtocolType, szCameraID = cam.CameraID, szChannelID = cam.CameraChannelID, szDeviceIP = cam.PlatIP, szLoginPwd = cam.Password, szLoginUser = cam.UserName, }, dwAnalysisPlanID = Convert.ToUInt32(DateTime.Now.Subtract(new DateTime(DateTime.Today.Year, 1, 1, 0, 0, 0)).TotalMilliseconds / 100), szAnalysisParam = BuildAnalyseParamByCollect(region, area, time), szArsIp = unit.szServerIp, wArsPort = unit.wServerPort, }; return(AddRealAnalyse(param)); } else { return(0); } }
public bool UpdatePlate(RealtimeCameraInfo cam, List <System.Drawing.Point> region, List <DriveWayRegion> driveWayRegion, List <System.Drawing.Rectangle> carPlateRegion, bool noplat, AccidentAlarmSubType accidentType, uint carFast, uint carStop, uint carLow, uint fluxTime) { bool ret = false; if (cam != null) { RealAnalyseInfo info = GetAllPlate().Find(item => item.realAnalyseParam.eAlgthmType == E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROSSROAD && item.realAnalyseParam.realCameraInfo.szCameraID == cam.CameraID); if (info != null) { SaveEvent(cam.CameraID); DelPlate(cam.CameraID); uint id = AddPlate(cam, region, driveWayRegion, carPlateRegion, noplat, accidentType, carFast, carStop, carLow, fluxTime); RecoverEvent(id); } else { ret = false; } } else { ret = false; } return(ret); }
public uint AddPlate(RealtimeCameraInfo cam, List <System.Drawing.Point> region, List <DriveWayRegion> driveWayRegion, List <System.Drawing.Rectangle> carPlateRegion, bool noplat, AccidentAlarmSubType accidentType, uint carFast, uint carStop, uint carLow, uint fluxTime) { if (GetRealAnalyseCapableLeft() > 0) { AdpsServerUnitInfo unit = GetOneProcessAdps(); string pChannelId = cam.CameraID; RealAnalyseParam param = new RealAnalyseParam() { eAlgthmType = E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROSSROAD, realCameraInfo = new RealCameraInfo() { dwDevicePort = (ushort)cam.PlatPort, dwDeviceType = (uint)cam.ProtocolType, szCameraID = cam.CameraID, szChannelID = cam.CameraChannelID, szDeviceIP = cam.PlatIP, szLoginPwd = cam.Password, szLoginUser = cam.UserName, }, dwAnalysisPlanID = Convert.ToUInt32(DateTime.Now.Subtract(new DateTime(DateTime.Today.Year, 1, 1, 0, 0, 0)).TotalMilliseconds / 10), szAnalysisParam = BuildAnalyseParamByAccidentAlarm(region, driveWayRegion, carPlateRegion, noplat, accidentType, carFast, carStop, carLow, fluxTime), szArsIp = unit.szServerIp, wArsPort = unit.wServerPort, }; return(AddRealAnalyse(param)); } else { return(0); } }
public List <RealtimeCameraInfo> GetCamerasByGroupID(uint groupId) { using (MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(string.Format(m_connString, m_serverIP, "vdm_server_db"))) { try { List <RealtimeCameraInfo> list = new List <RealtimeCameraInfo>(); //string sql = "SELECT * FROM `camera_info` where GROUP_ID="+groupId; string sql = "SELECT" + " cam.ID AS CameraID," + " cam.`NAME` AS CameraName," + " cam.GROUP_ID AS GroupID," + " cam.`CODE` AS CameraCode," + " cam.COORD_X AS PosCoordX," + " cam.COORD_Y AS PosCoordY," + " cam.NET_STORE_DEV_ID AS PlatId," + " cam.NET_DEV_CHANNEL AS CameraChannelID," + " dev.ACCESS_PROTOCOL_TYPE AS ProtocolType," + " dev.DEVICE_IP AS PlatIP," + " dev.DEVICE_PORT AS PlatPort," + " dev.LOGIN_USER AS UserName," + " dev.LOGIN_PWD AS `Password`" + " FROM" + " camera_info AS cam" + " INNER JOIN net_store_dev_info AS dev ON cam.NET_STORE_DEV_ID = dev.ID"; if (groupId > 0) { sql += " where cam.GROUP_ID=" + groupId; } conn.Open(); MyLog4Net.Container.Instance.Log.Debug("GetCamerasByGroupID sql:" + sql); MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sql, conn); MySql.Data.MySqlClient.MySqlDataReader reader = cmd.ExecuteReader(); DataTable table = new DataTable(); table.Load(reader); foreach (DataRow item in table.Rows) { RealtimeCameraInfo cameraInfo = new RealtimeCameraInfo(); cameraInfo.CameraID = Convert.ToUInt32(item["CameraID"].ToString()); cameraInfo.GroupID = Convert.ToUInt32(item["GroupID"].ToString()); cameraInfo.CameraName = item["CameraName"].ToString(); cameraInfo.CameraCode = item["CameraCode"].ToString(); cameraInfo.PlatId = Convert.ToUInt32(item["PlatId"].ToString()); cameraInfo.CameraChannelID = item["CameraChannelID"].ToString(); cameraInfo.PosCoordX = Convert.ToSingle(item["PosCoordX"].ToString()); cameraInfo.PosCoordY = Convert.ToSingle(item["PosCoordY"].ToString()); cameraInfo.Password = item["Password"].ToString(); cameraInfo.UserName = item["UserName"].ToString(); cameraInfo.PlatIP = item["PlatIP"].ToString(); cameraInfo.PlatPort = Convert.ToUInt32(item["PlatPort"].ToString()); cameraInfo.ProtocolType = (E_VDA_NET_STORE_DEV_PROTOCOL_TYPE)Convert.ToUInt32(item["ProtocolType"].ToString()); if (string.IsNullOrEmpty(cameraInfo.CameraCode)) { //192.168.137.177_13300_1_34010000001320000001 cameraInfo.CameraCode = cameraInfo.PlatIP + "_" + cameraInfo.PlatPort + "_" + (int)cameraInfo.ProtocolType + "_" + cameraInfo.CameraChannelID; } list.Add(cameraInfo); } conn.Close(); list.Sort((it1, it2) => it1.CameraName.CompareTo(it2.CameraName)); return(list); } catch (Exception ex) { MyLog4Net.Container.Instance.Log.DebugWithDebugView("GetCamerasByGroupID sql error:" + ex.ToString()); //Framework.Container.Instance.InteractionService.ShowMessageBox("数据库失败", Framework.Environment.PROGRAM_NAME); return(new List <RealtimeCameraInfo>()); } } }