Exemple #1
0
        /// <summary>
        /// 处理报警信息
        /// </summary>
        /// <param name="obj"></param>
        private void Handle0x2000(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            // 报警
            _0x2000 x2000 = new _0x2000();

            x2000.Content = obj.MsgContent;
            x2000.Unpackage();
            if (null != equipment)
            {
                EquipmentInstance.Update(f => f.id == equipment.id, act =>
                {
                    if (x2000.AlarmBIN[0] == '1')
                    {
                        // Main Power Disconnect
                        act.Voltage = "G0000";
                        // 主电断报警之后进入睡眠状态
                        act.OnlineStyle = (byte)LinkType.SLEEP;
                    }
                    if (x2000.GPSInfo.Available)
                    {
                        act.Latitude   = x2000.GPSInfo.Latitude;
                        act.Longitude  = x2000.GPSInfo.Longitude;
                        act.GpsUpdated = false;
                    }
                });
            }
            if (x2000.GPSInfo.Available)
            {
                SaveGpsInfo(x2000.GPSInfo, equipment, obj.TerminalID, "0x2000");
            }
        }
Exemple #2
0
        /// <summary>
        /// 处理报警信息
        /// </summary>
        /// <param name="obj"></param>
        private void Handle0x2000(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            // 报警
            _0x2000 x2000 = new _0x2000();

            x2000.Content = obj.MsgContent;
            x2000.Unpackage();
            if (null != equipment)
            {
                using (var bll = new EquipmentBLL())
                {
                    bll.Update(f => f.id == equipment.id, act =>
                    {
                        if (x2000.AlarmBIN[0] == '1')
                        {
                            // Main Power Disconnect
                            act.Voltage = "G0000";
                            // 主电断报警之后进入睡眠状态
                            act.OnlineStyle = (byte)LinkType.SLEEP;
                        }
                        // 同时更新设备的报警状态  2015/09/10 14:02
                        act.Alarm = x2000.AlarmBIN;
                        if (x2000.GPSInfo.Available)
                        {
                            act.Latitude   = x2000.GPSInfo.Latitude;
                            act.Longitude  = x2000.GPSInfo.Longitude;
                            act.GpsUpdated = false;
                        }
                    });
                }
            }
            long gps = -1;

            if (x2000.GPSInfo.Available)
            {
                gps = SaveGpsInfo(x2000.GPSInfo, equipment, obj.TerminalID, "Alarm report" + GetPackageType(obj.ProtocolType));
            }
            // 保存报警信息
            SaveAlarm(equipment, obj.TerminalID, gps, x2000.AlarmBIN);
        }