internal void SetArchorInfo(UDPArchor archor, string key)
 {
     if (key == "id")
     {
     }
     ScanArchors(UDPCommands.GetAll().ToArray(), new string[] { archor.GetClientIP() });
 }
        private DevAlarm CreateDevAlarm(UDPArchor item)
        {
            DevAlarm alarm = new DevAlarm();

            alarm.Level          = Abutment_DevAlarmLevel.低;
            alarm.Code           = "基站离线";
            alarm.Title          = "基站离线";
            alarm.Src            = Abutment_DevAlarmSrc.人员定位;//其实应该加上“基站扫描”的
            alarm.AlarmTime      = DateTime.Now;
            alarm.AlarmTimeStamp = TimeConvert.ToStamp(alarm.AlarmTime);
            var clientIP = item.GetClientIP();

            alarm.Msg = "基站离线:" + clientIP;

            var anchor = DbArchorList.Find(i => i.Ip == clientIP);

            if (anchor != null)
            {
                var devId = (int)anchor.DevId;
                var dev   = devDict[devId];
                alarm.DevInfo     = dev;
                alarm.DevInfoId   = devId;
                alarm.Device_desc = dev.Name;
                alarm.Title       = string.Format("基站离线[{0},{1}]", anchor.Code.Trim(), anchor.Ip.Trim());
                alarm.Msg         = string.Format("基站离线[{0},{1}]", anchor.Code, anchor.Ip);
                //alarm.AreaId
            }

            alarm.DictKey = alarm.Msg;

            return(alarm);
        }
Example #3
0
 public UDPArchorInfoWindow(ArchorManager archorManager, UDPArchor archor)
 {
     InitializeComponent();
     this.archor        = archor;
     this.archorManager = archorManager;
     this.archorManager.ArchorListChanged += ArchorManager_ArchorListChanged;
     PropertyGrid1.SelectedObject          = archor;
 }
        internal CommandResultGroup Add(UDPArchor item)
        {
            var group = new CommandResultGroup(item);

            Groups.Add(group);
            if (!string.IsNullOrEmpty(item.IsConnected))
            {
                statistics.Add(group.Id);
            }
            return(group);
        }
 internal void GetArchorInfo(UDPArchor archor, string key)
 {
     //key = key.ToLower();
     if (key == "Id")
     {
         ScanArchor(UDPCommands.GetId, archor.GetClientIP());
     }
     else if (key == "Ip")
     {
         ScanArchor(UDPCommands.GetIp, archor.GetClientIP());
     }
     else if (key == "Type")
     {
         ScanArchor(UDPCommands.GetType, archor.GetClientIP());
     }
     else if (key == "ServerIp")
     {
         ScanArchor(UDPCommands.GetServerIp, archor.GetClientIP());
     }
     else if (key == "ServerPort")
     {
         ScanArchor(UDPCommands.GetServerPort, archor.GetClientIP());
     }
     else if (key == "Mask")
     {
         ScanArchor(UDPCommands.GetMask, archor.GetClientIP());
     }
     else if (key == "Gateway")
     {
         ScanArchor(UDPCommands.GetGateway, archor.GetClientIP());
     }
     else if (key == "DHCP")
     {
         ScanArchor(UDPCommands.GetDHCP, archor.GetClientIP());
     }
     else if (key == "SoftVersion")
     {
         ScanArchor(UDPCommands.GetSoftVersion, archor.GetClientIP());
     }
     else if (key == "HardVersion")
     {
         ScanArchor(UDPCommands.GetHardVersion, archor.GetClientIP());
     }
     else if (key == "Power")
     {
         ScanArchor(UDPCommands.GetPower, archor.GetClientIP());
     }
     else if (key == "MAC")
     {
         ScanArchor(UDPCommands.GetMAC, archor.GetClientIP());
     }
 }
        private void SendCmd(string cmd, UDPArchor archor)
        {
            var archorIp = archor.GetClientIP();
            var localIp  = GetLocalIp(archorIp);

            if (localIp == null)
            {
                return;
            }
            var        udp        = GetLightUDP(localIp);
            IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(archorIp), archorPort);

            udp.SendHex(cmd, ipEndPoint);
            AddLog(string.Format("发送 :: [{0}]:{1}", ipEndPoint, cmd));
        }
Example #7
0
        private void MenuLocalArchor_Click(object sender, RoutedEventArgs e)
        {
            List <string> codes = new List <string>();

            foreach (var item in DataGrid3.SelectedItems)
            {
                UDPArchor archor = item as UDPArchor;
                if (archor == null)
                {
                    continue;
                }
                codes.Add(archor.GetClientIP());
            }
            StaticEvents.OnLocateArchorByIp(codes);
        }
Example #8
0
 private void ShowValue(UDPArchor ar)
 {
     if (ar != null)
     {
         this.Dispatcher.Invoke(() =>
         {
             AibId.Value          = ar.Id;
             AibIp.Value          = ar.Ip;
             AibType.Value        = ar.Type;
             AibServerIp.Value    = ar.ServerIp;
             AibServerPort.Value  = ar.ServerPort;
             AibMask.Value        = ar.Mask;
             AibGateway.Value     = ar.Gateway;
             AibDHCP.Value        = ar.DHCP;
             AibSoftVersion.Value = ar.SoftVersion;
             AibHardVersion.Value = ar.HardVersion;
             AibPower.Value       = ar.Power;
             AibMAC.Value         = ar.MAC;
         });
     }
 }
Example #9
0
        private void OnArchorListChanged(UDPArchorList a, UDPArchor item)
        {
            if (item != null && item.Id != null)
            {
                //if(!progressList.Contains(item))
                //    progressList.Add(item);

                if (!progressList.ContainsKey(item.Id))
                {
                    progressList.Add(item.Id, item);
                    //Log.Info(Name, string.Format("maxCount:{0}", progressList.Count));
                }

                count++;

                //Log.Info(Name, "ArchorListChanged:" + count);
            }

            if (ArchorListChanged != null)
            {
                ArchorListChanged(a, item);
            }
        }
Example #10
0
        private void SetArchorList(ArchorManager archorManager, UDPArchorList list, UDPArchor item1 = null, int id = -1)
        {
            this.Dispatcher.Invoke(() => {
                if (archorManager == null)
                {
                    TbConsole.Text        = "";
                    DataGrid3.ItemsSource = null;
                    LbCount.Content       = "";
                    LbStatistics.Content  = "";
                }
                else
                {
                    //IsDirty = true;
                    LbTime.Content = archorManager.GetTimeSpan();
                    TbConsole.Text = archorManager.Log;

                    if (DbArchorListDict != null)
                    {
                        //list.ClearInfo();
                        foreach (var item in list)
                        {
                            item.DbInfo   = "";
                            item.RealArea = "";
                            var clientIP  = item.GetClientIP();
                            //var ar = DbArchorList.Find(i => i.Ip == clientIP);
                            if (DbArchorListDict.ContainsKey(clientIP))
                            {
                                var ar = DbArchorListDict[clientIP];
                                if (ar != null)
                                {
                                    item.RealArea = ar.Parent.Name;
                                    if (item.GetClientIP() != ar.Ip)
                                    {
                                        item.DbInfo = "IP:" + ar.Ip;
                                    }
                                    else
                                    {
                                        string code = ar.Code.Trim();
                                        if (!string.IsNullOrEmpty(code))
                                        {
                                            item.DbInfo = "有:" + code;
                                        }
                                        else
                                        {
                                            item.DbInfo = "有:" + ar.Ip;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (id > 0)
                    {
                        var item2 = list[id];
                        if (item2 != item1)
                        {
                        }

                        int id2 = list.IndexOf(item1);
                    }

                    DataGrid3.ItemsSource = list;

                    if (id > 0)
                    {
                        var item2 = list[id];
                        if (item2 != item1)
                        {
                        }
                        int id2 = list.IndexOf(item1);
                    }

                    LbCount.Content        = list.GetConnectedCount();
                    LbStatistics.Content   = archorManager.GetStatistics();
                    LbServerIpList.Content = list.ServerList.GetText();

                    LbListenCount.Content      = archorManager.valueList.Count;
                    LbListenStatistics.Content = archorManager.valueList.GetStatistics();
                }
            });
        }
Example #11
0
 private void ArchorManager_ArchorListChanged(UDPArchorList arg1, UDPArchor arg2)
 {
     ShowValue(arg2);
 }
 public CommandResultGroup(UDPArchor item)
 {
     Items  = new List <UDPCommandResult>();
     Id     = item.Client;
     Archor = item;
 }
 public CommandResultGroup()
 {
     Items  = new List <UDPCommandResult>();
     Archor = new UDPArchor();
     IsNew  = true;
 }
        private void SetArchorList(ArchorManager archorManager, UDPArchorList list, UDPArchor item1 = null, int id = -1)
        {
            if (DbArchorListDict != null)
            {
                //list.ClearInfo();
                foreach (var item in list)
                {
                    item.DbInfo   = "";
                    item.RealArea = "";
                    var clientIP = item.GetClientIP();
                    //var ar = DbArchorList.Find(i => i.Ip == clientIP);
                    if (DbArchorListDict.ContainsKey(clientIP))
                    {
                        var ar = DbArchorListDict[clientIP];
                        if (ar != null)
                        {
                            item.RealArea = ar.Parent.Name;
                            if (item.GetClientIP() != ar.Ip)
                            {
                                item.DbInfo = "IP:" + ar.Ip;
                            }
                            else
                            {
                                string code = ar.Code.Trim();
                                if (!string.IsNullOrEmpty(code))
                                {
                                    item.DbInfo = "有:" + code;
                                }
                                else
                                {
                                    item.DbInfo = "有:" + ar.Ip;
                                }
                            }
                        }
                    }
                }

                if (id > 0)
                {
                    var item2 = list[id];
                    if (item2 != item1)
                    {
                    }

                    int id2 = list.IndexOf(item1);
                }

                if (UDPArchorList == null)
                {
                    UDPArchorList = list;
                }
                else
                {
                    //if(UDPArchorList!= list)
                    //{

                    //}
                }


                if (id > 0)
                {
                    var item2 = list[id];
                    if (item2 != item1)
                    {
                    }
                    int id2 = list.IndexOf(item1);
                }
            }
        }