コード例 #1
0
 public override UAVSingleParameter SilentUpdate(string key, object value, bool isremote)
 {
     if (key == Name)
     {
         return(base.SilentUpdate(key, value, isremote));
     }
     else
     {
         return(values.SilentUpdate(key, value, isremote));
     }
 }
コード例 #2
0
ファイル: UAVBase.cs プロジェクト: wangbo121/UAV-NET
        /// <summary>
        /// We have recieved Data from an CommunicationEndpoint, now we process it
        /// </summary>
        /// <param name="timestamp"></param>
        /// <param name="data"></param>
        private void mycomm_DataRecieved(DateTime timestamp, List <UAVParameter> data)
        {
            if (initialised)
            {
                lock (SynclockRecieve)
                {
                    foreach (UAVParameter param in data)
                    {
                        string name = "";
                        // Console.WriteLine(param.Name + ": " + param.Value);
                        RecieveEventCounter++;
                        if (recievedParameters.ContainsKey(timestamp.Ticks.ToString() + param.Name))
                        {
                            continue;
                        }
                        UAVSingleParameter result = uavData.SilentUpdate(param.Name, param.Value, true);
                        if (DataArrived != null)
                        {
                            DataArrived(null, result);
                        }
                        recievedParameters.Add(timestamp.Ticks.ToString() + param.Name, timestamp);
                    }

                    List <string> deletelist = new List <string>();
                    foreach (KeyValuePair <string, DateTime> pair in recievedParameters)
                    {
                        if (pair.Value < DateTime.UtcNow.AddSeconds(-10))
                        {
                            deletelist.Add(pair.Key);
                        }
                    }

                    foreach (string key in deletelist)
                    {
                        recievedParameters.Remove(key);
                    }
                    deletelist.Clear();
                }
            }
        }