Esempio n. 1
0
        /// <summary>
        /// 获取识别对象 车身对象 事件发生时间 车道号等信息
        /// </summary>
        /// <param name="dwAlarmType"></param>
        /// <param name="pAlarmInfo"></param>
        /// <returns></returns>
        public bool GetStuObject(UInt32 dwAlarmType, IntPtr pAlarmInfo, out DH_MSG_OBJECT stuObj, out DH_MSG_OBJECT vehicleObj, out NET_TIME_EX outUTC, out int outlane, out string strMsg)
        {
            DH_MSG_OBJECT msg      = new DH_MSG_OBJECT();
            DH_MSG_OBJECT veahcile = new DH_MSG_OBJECT();
            NET_TIME_EX   utc      = new NET_TIME_EX();
            int           lane     = 0;

            DH_EVENT_FILE_INFO fileinfo = new DH_EVENT_FILE_INFO();

            string EventMsg = "未定义事件";


            if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFICGATE)
            {
                DEV_EVENT_TRAFFICGATE_INFO Info = new DEV_EVENT_TRAFFICGATE_INFO();
                Info       = (DEV_EVENT_TRAFFICGATE_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFICGATE_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;
                EventMsg   = "交通卡口事件";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFICJUNCTION)
            {
                DEV_EVENT_TRAFFICJUNCTION_INFO Info = new DEV_EVENT_TRAFFICJUNCTION_INFO();
                Info       = (DEV_EVENT_TRAFFICJUNCTION_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFICJUNCTION_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通路口事件";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_RUNREDLIGHT)
            {
                DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO Info = new DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO();
                Info       = (DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通违章-闯红灯事件";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_TURNLEFT)
            {
                DEV_EVENT_TRAFFIC_TURNLEFT_INFO Info = new DEV_EVENT_TRAFFIC_TURNLEFT_INFO();
                Info       = (DEV_EVENT_TRAFFIC_TURNLEFT_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_TURNLEFT_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通违章-违章左转";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_TURNRIGHT)
            {
                DEV_EVENT_TRAFFIC_TURNRIGHT_INFO Info = new DEV_EVENT_TRAFFIC_TURNRIGHT_INFO();
                Info       = (DEV_EVENT_TRAFFIC_TURNRIGHT_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_TURNRIGHT_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通违章-违章右转";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_OVERSPEED)
            {
                DEV_EVENT_TRAFFIC_OVERSPEED_INFO Info = new DEV_EVENT_TRAFFIC_OVERSPEED_INFO();
                Info       = (DEV_EVENT_TRAFFIC_OVERSPEED_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_OVERSPEED_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通违章-超速";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_UNDERSPEED)
            {
                DEV_EVENT_TRAFFIC_UNDERSPEED_INFO Info = new DEV_EVENT_TRAFFIC_UNDERSPEED_INFO();
                Info       = (DEV_EVENT_TRAFFIC_UNDERSPEED_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_UNDERSPEED_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通违章-低速";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_MANUALSNAP)
            {
                DEV_EVENT_TRAFFIC_MANUALSNAP_INFO Info = new DEV_EVENT_TRAFFIC_MANUALSNAP_INFO();
                Info       = (DEV_EVENT_TRAFFIC_MANUALSNAP_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_MANUALSNAP_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通手动抓拍事件";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_PARKING)
            {
                DEV_EVENT_TRAFFIC_PARKING_INFO Info = new DEV_EVENT_TRAFFIC_PARKING_INFO();
                Info       = (DEV_EVENT_TRAFFIC_PARKING_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_PARKING_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "交通违章停车";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_PARKINGSPACENOPARKING)
            {
                DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO Info = new DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO();
                Info       = (DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "车位无车事件";
            }
            else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_PARKINGSPACEPARKING)
            {
                DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO Info = new DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO();
                Info       = (DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO));
                stuObj     = Info.stuObject;
                vehicleObj = Info.stuVehicle;
                outUTC     = Info.UTC;
                outlane    = Info.nLane;
                fileinfo   = Info.stuFileInfo;

                EventMsg = "车位有车事件";
            }
            else
            {
                stuObj     = msg;
                vehicleObj = veahcile;
                outUTC     = utc;
                outlane    = 0;

                EventMsg = "未处理事件dwAlarmType = " + dwAlarmType.ToString();
            }

            if (!EventMsg.Contains("未处理事件"))
            {
                EventMsg = EventMsg + ";组编号GroupID = " + fileinfo.nGroupId + ";图片组总数bount = " + fileinfo.bCount + ";当前图片序号bIndex=" + fileinfo.bIndex;
                try
                {
                    //车牌
                    string   platenumber = Encoding.GetEncoding("gb2312").GetString(stuObj.szText);
                    string[] plate       = platenumber.Split('\0');
                    if (plate.Length > 0)
                    {
                        EventMsg += ";车牌号 = " + plate[0];
                    }

                    //车标
                    string   strType    = Encoding.GetEncoding("gb2312").GetString(vehicleObj.szText);
                    string[] vechitypes = strType.Split('\0');
                    if (vechitypes.Length > 0)
                    {
                        // "Unknown"未知
                        // "Audi" 奥迪
                        // "Honda" 本田
                        // "Buick" 别克
                        // "Volkswagen" 大众
                        // "Toyota" 丰田
                        // "BMW" 宝马
                        // "Peugeot" 标致
                        // "Ford" 福特
                        // "Mazda" 马自达
                        // "Nissan" 尼桑
                        // "Hyundai" 现代
                        // "Suzuki" 铃木
                        // "Citroen" 雪铁龙
                        // "Benz" 奔驰
                        // "BYD" 比亚迪
                        // "Geely" 吉利
                        // "Lexus" 雷克萨斯
                        // "Chevrolet" 雪佛兰
                        // "Chery" 奇瑞
                        // "Kia" 起亚
                        // "Charade" 夏利
                        // "DF" 东风
                        // "Naveco" 依维柯
                        // "SGMW" 五菱
                        // "Jinbei" 金杯

                        if (!vechitypes[0].Equals(""))
                        {
                            EventMsg += ";车标 = " + vechitypes[0];
                        }
                    }
                }
                catch
                {
                    ;
                }
                finally
                {
                    ;
                }
            }
            strMsg = EventMsg;
            return(true);
        }
Esempio n. 2
0
            public byte[] jpgbuffer; //jpg图片

            /// <summary>
            /// 事件名称等信息
            /// </summary>
            /// <returns></returns>
            public string GetMsgString()
            {
                string str = "未知事件";

                if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_RUNREDLIGHT)
                {
                    DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO Info = new DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO();
                    Info = (DEV_EVENT_TRAFFIC_RUNREDLIGHT_INFO)MsgObj;
                    str  = "交通违章-闯红灯事件";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFICJUNCTION)
                {
                    DEV_EVENT_TRAFFICJUNCTION_INFO Info = new DEV_EVENT_TRAFFICJUNCTION_INFO();
                    Info = (DEV_EVENT_TRAFFICJUNCTION_INFO)MsgObj;

                    str = "交通路口事件";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_TURNLEFT)
                {
                    DEV_EVENT_TRAFFIC_TURNLEFT_INFO Info = new DEV_EVENT_TRAFFIC_TURNLEFT_INFO();
                    Info = (DEV_EVENT_TRAFFIC_TURNLEFT_INFO)MsgObj;

                    str = "交通违章-违章左转";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_TURNRIGHT)
                {
                    DEV_EVENT_TRAFFIC_TURNRIGHT_INFO Info = new DEV_EVENT_TRAFFIC_TURNRIGHT_INFO();
                    Info = (DEV_EVENT_TRAFFIC_TURNRIGHT_INFO)MsgObj;
                    str  = "交通违章-违章右转";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_OVERSPEED)
                {
                    DEV_EVENT_TRAFFIC_OVERSPEED_INFO Info = new DEV_EVENT_TRAFFIC_OVERSPEED_INFO();
                    Info = (DEV_EVENT_TRAFFIC_OVERSPEED_INFO)MsgObj;
                    str  = "交通违章-超速";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_UNDERSPEED)
                {
                    DEV_EVENT_TRAFFIC_UNDERSPEED_INFO Info = new DEV_EVENT_TRAFFIC_UNDERSPEED_INFO();
                    Info = (DEV_EVENT_TRAFFIC_UNDERSPEED_INFO)MsgObj;
                    str  = "交通违章-低速";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFICGATE)
                {
                    DEV_EVENT_TRAFFICGATE_INFO Info = new DEV_EVENT_TRAFFICGATE_INFO();
                    Info = (DEV_EVENT_TRAFFICGATE_INFO)MsgObj;
                    str  = "交通卡口事件";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_MANUALSNAP)
                {
                    DEV_EVENT_TRAFFIC_MANUALSNAP_INFO Info = new DEV_EVENT_TRAFFIC_MANUALSNAP_INFO();
                    Info = (DEV_EVENT_TRAFFIC_MANUALSNAP_INFO)MsgObj;
                    str  = "交通手动抓拍事件";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_PARKINGSPACEPARKING)
                {
                    DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO Info = new DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO();
                    Info = (DEV_EVENT_TRAFFIC_PARKINGSPACEPARKING_INFO)MsgObj;
                    str  = "车位有车事件 车位号" + Info.nLane.ToString() + "有车";
                }
                else if (dwAlarmType == EventIvs.EVENT_IVS_TRAFFIC_PARKINGSPACENOPARKING)
                {
                    DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO Info = new DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO();
                    Info = (DEV_EVENT_TRAFFIC_PARKINGSPACENOPARKING_INFO)MsgObj;
                    str  = "车位无车事件 车位号" + Info.nLane.ToString() + "无车";
                }
                else
                {
                    str = str + "未知事件 dwAlarmType = " + dwAlarmType.ToString();
                }

                return(str);
            }