Example #1
0
        public override string GetAlarmInfo()
        {
            try
            {
                MemoryStream ms = new MemoryStream();
                AlarmImage.Save(ms, ImageFormat.Jpeg);

                StringBuilder sb = new StringBuilder(SystemContext.Name + "<SystemContext>");
                sb.Append(Monitor.Name + "<Monitor><MonitorAlarm>");
                sb.Append(ID + "<ID>");
                sb.Append(Sender + "<Sender>");
                sb.Append(Desc + "<Desc>");
                sb.Append((int)EventType + "<EventType>");
                sb.Append((int)GuardLevel + "<GuardLevel>");
                sb.Append(AreaIndex + "<AreaIndex>");
                sb.Append((int)AreaType + "<AreaType>");
                sb.Append((ushort)AlertOpt + "<AlertOpt>");
                sb.Append(AlarmTime.ToLongDateString() + " " + AlarmTime.ToLongTimeString() + "<AlarmTime>");
                sb.Append(Convert.ToBase64String(ms.GetBuffer()) + "<AlarmImage></MonitorAlarm>");

                return(sb.ToString());
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Example #2
0
        public virtual string GetAlarmInfo()
        {
            try
            {
                StringBuilder sb = new StringBuilder(SystemContext.Name + "<SystemContext>");
                sb.Append(Monitor.Name + "<Monitor><MonitorAlarm>");
                sb.Append(ID + "<ID>");
                sb.Append(Sender + "<Sender>");
                sb.Append(Desc + "<Desc>");
                sb.Append(AlarmTime.ToLongDateString() + " " + AlarmTime.ToLongTimeString() + "<AlarmTime>");
                if (AlarmImage != null)
                {
                    MemoryStream ms = new MemoryStream();
                    AlarmImage.Save(ms, ImageFormat.Jpeg);
                    sb.Append(Convert.ToBase64String(ms.ToArray()));
                }
                sb.Append("<AlarmImage></MonitorAlarm>");

                return(sb.ToString());
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }