public void FetchData(int _vid, ref TUpDgram _dgram) { if (!DictRcver.ContainsKey(_vid)) { return; } DGramRcver <TUpDgram> rcver = DictRcver[_vid]; rcver.FetchData(ref _dgram); }
private void timer1_Tick(object sender, EventArgs e) { lock (LockData2) { // FetchData为线程外异步获取数据的接口 rcver.FetchData(ref obj); label7.Text = obj.m_vehicle_state.ToString(); speed.Text = obj.m_speed.ToString(); label10.Text = obj.m_rpm.ToString(); label2.Text = obj.m_steering.ToString(); label3.Text = obj.m_path_heading.ToString(); label4.Text = ((double)obj.m_path_x / 1000000).ToString(); label5.Text = ((double)obj.m_path_y / 1000000).ToString(); // FetchData为线程外异步获取数据的接口 rcver2.FetchData(ref obj2); label36.Text = obj2.m_vehicle_state.ToString(); label38.Text = obj2.m_speed.ToString(); label40.Text = obj2.m_rpm.ToString(); label43.Text = obj2.m_steering.ToString(); label39.Text = obj2.m_path_heading.ToString(); label44.Text = ((double)obj2.m_path_x / 1000000).ToString(); label45.Text = ((double)obj2.m_path_y / 1000000).ToString(); // FetchData为线程外异步获取数据的接口 rcver3.FetchData(ref obj3); label47.Text = obj3.m_vehicle_state.ToString(); label46.Text = obj3.m_speed.ToString(); label48.Text = obj3.m_rpm.ToString(); label51.Text = obj3.m_steering.ToString(); label52.Text = obj3.m_path_heading.ToString(); label53.Text = ((double)obj3.m_path_x / 1000000).ToString(); label54.Text = ((double)obj3.m_path_y / 1000000).ToString(); } }