Exemple #1
0
        public CoreInstance OnPing(string Name, string IP, string Mac)
        {
            CoreInstance newDevice = new CoreInstance();

            newDevice.BoardName  = Name;
            newDevice.IpAddress  = IP;
            newDevice.MacAddress = Mac;
            newDevice.LastPing   = DateTime.Now;
            newDevice.Online     = true;
            if (this.Contains(newDevice))
            {
                int i = this.IndexOf(newDevice);

                this[i].LastPing  = DateTime.Now;
                this[i].IpAddress = IP;
                this[i].BoardName = Name;
                this[i].Online    = true;

                BoardTrcData bdTrcData = BoardTrcMonitor.GetBoardTrcData(IP);
                if (bdTrcData != null)
                {
                    this[i].OsVersion   = bdTrcData.PlatInfo_OsBuildLabEx;
                    this[i].BiosVersion = bdTrcData.PlatInfo_SystemBiosVersion;
                    this[i].PlatType    = bdTrcData.PlatInfo_PlatType;
                }
            }
            else
            {
                Add(newDevice);
            }
            return(newDevice);
        }
Exemple #2
0
        public static BoardTrcData GetBoardTrcData(string hostNameOrIp)
        {
            if (String.IsNullOrEmpty(hostNameOrIp)) return null;

            // init resources
            lock (monLock)
            {
                if (_bdList == null) _bdList = new List<BoardTrcData>();
                if (_monThread == null)
                {
                    _monThread = new Thread(new ThreadStart(MonitorThread));
                    if (_monThread != null) _monThread.Start();
                }
            }

            // see if name being monitored already
            foreach (BoardTrcData bd in _bdList)
            {
                if (bd.host.CompareTo(hostNameOrIp) == 0) return bd;
            }

            // if not there, add new one to list for scheduled updates
            BoardTrcData newbd = new BoardTrcData();
            newbd.ClearPlatInfo();
            newbd.host = hostNameOrIp;
            lock (monLock)
            {
                _bdList.Add(newbd);
            }

            return null;
        }
        public static BoardTrcData GetBoardTrcData(string hostNameOrIp)
        {
            if (String.IsNullOrEmpty(hostNameOrIp))
            {
                return(null);
            }

            // init resources
            lock (monLock)
            {
                if (_bdList == null)
                {
                    _bdList = new List <BoardTrcData>();
                }
                if (_monThread == null)
                {
                    _monThread = new Thread(new ThreadStart(MonitorThread));
                    if (_monThread != null)
                    {
                        _monThread.Start();
                    }
                }
            }

            // see if name being monitored already
            foreach (BoardTrcData bd in _bdList)
            {
                if (bd.host.CompareTo(hostNameOrIp) == 0)
                {
                    return(bd);
                }
            }

            // if not there, add new one to list for scheduled updates
            BoardTrcData newbd = new BoardTrcData();

            newbd.ClearPlatInfo();
            newbd.host = hostNameOrIp;
            lock (monLock)
            {
                _bdList.Add(newbd);
            }

            return(null);
        }