Beispiel #1
0
 public void OnAckReferenceSourceChangeReceived(object sender, AckReceivedEventArgs e)
 {
     if (e.ID == _msgID)
     {
         TimerOutWatch.Stop();
         _organizer.MWMsgCtrl.AckCommandReceived -= OnAckReferenceSourceChangeReceived;
         ElementStatusUpdateEventArgs eStatus = new ElementStatusUpdateEventArgs();
         eStatus.Status = string.Format("Acknowledge received for {0} at {1}", this.Node.Text, DateTime.Now.ToString("HH:mm:ss.fff"));
         ElementStatusUpdateEvent(this, eStatus);
         IsDone = true;
     }
 }
Beispiel #2
0
 public void OnPacketReceived(Serial_parser sender,PacketEventArgs e){
     Serial_parser.msg_type_tx received_msg_type = (Serial_parser.msg_type_tx)e.packet[e.packet_config.padding_len + 1];
     if (received_msg_type != Serial_parser.msg_type_tx.probe)//Probe fills output windows
     {
         Debug.WriteLine(string.Format("MSG CTRL OnPacketReceived {0} at {1}", received_msg_type.ToString(), DateTime.Now.ToLongTimeString()));
     }
     switch (received_msg_type)
     {
         case Serial_parser.msg_type_tx.heart_beat:
             if (HeartBeatReceived != null)
             {
                 HeartBeatReceived(this, new EventArgs());
             }
             break;
         case Serial_parser.msg_type_tx.settings_tx:
             //serial_driver.main_form.settings.push_setting_data(packet); //TODO
             throw new NotImplementedException();
             break;
         case Serial_parser.msg_type_tx.probe:
             ProbeReceivedEventArgs eProbe=new ProbeReceivedEventArgs();
             eProbe.payload=e.payload;
             if (ProbeReceived != null)
             {
                 ProbeReceived(eProbe);
             }
             else
             {
                 Debug.WriteLine(string.Format("Unhandeled {0} at {1}", received_msg_type.ToString(), DateTime.Now.ToLongTimeString()));
             }
             break;
         case Serial_parser.msg_type_tx.msg_tx:
             throw new NotImplementedException();
             //TODO
             break;
         case Serial_parser.msg_type_tx.acknowledgement:
             switch ((ACK_type)e.payload[0])
             {
                 case ACK_type.AckCommand:
                     if (AckCommandReceived != null)
                     {
                         AckReceivedEventArgs eAck = new AckReceivedEventArgs();
                         eAck.ID = e.payload[1];
                         AckCommandReceived(this,eAck);
                     }
                     else
                     {
                         Debug.WriteLine(string.Format("Unhandeled {0} at {1}", received_msg_type.ToString(), DateTime.Now.ToLongTimeString()));
                     }
                     break;
                 case ACK_type.AckSettingUpdate:
                     if (AckSettingUpdateReceived!=null)
                     {
                         AckReceivedEventArgs eAck = new AckReceivedEventArgs();
                         eAck.ID = e.payload[1];
                         AckSettingUpdateReceived(this,eAck);
                     }
                     else
                     {
                         Debug.WriteLine(string.Format("Unhandeled {0} at {1}", received_msg_type.ToString(), DateTime.Now.ToLongTimeString()));
                     }
                     break;
                 default:
                     throw new NotImplementedException();
                     break;
             }
             break;
         case Serial_parser.msg_type_tx.dbg_txt:
             DebugTextReceivedEventArgs eDebugText = new DebugTextReceivedEventArgs();
             eDebugText.DebugText=System.Text.Encoding.Default.GetString(e.payload.ToArray());
             if (DebugTextReceived != null)
             {
                 DebugTextReceived(eDebugText);
             }
             else
             {
                 Debug.WriteLine(string.Format("Unhandeled {0} at {1}", received_msg_type.ToString(), DateTime.Now.ToLongTimeString()));
             }
             break;
         case Serial_parser.msg_type_tx.chnl_bias:
             BiasReceivedEventArgs eBias = new BiasReceivedEventArgs();
             eBias.Bias = BitConverter.ToSingle(e.payload.ToArray(), 0);
             eBias.CtrlChnl = (commander.ctrl_channel)BitConverter.ToSingle(e.payload.ToArray(), 4);
             BiasReceived(this,eBias);
             break;
         case Serial_parser.msg_type_tx.mrft_bag:
             MRFTBagReceivedEventArgs eMRFTBag = new MRFTBagReceivedEventArgs();
             eMRFTBag.Amplitude = BitConverter.ToSingle(e.payload.ToArray(), 0);
             eMRFTBag.Duration = BitConverter.ToUInt32(e.payload.ToArray(), 4);
             if (MRFTBagReceived != null)
             {
                 MRFTBagReceived(eMRFTBag);
             }
             else
             {
                 Debug.WriteLine(string.Format("Unhandeled {0} at {1}", received_msg_type.ToString(), DateTime.Now.ToLongTimeString()));
             }
             break;
         default:
             throw new NotImplementedException();
             break;
     }
 }
Beispiel #3
0
 private void OnHeart_beat_received(object sender,AckReceivedEventArgs e)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new MethodInvoker(delegate
         {
             btn_hrtbeat.Text = "Heart Beat Received";
             btn_start.Enabled = true;
             lblStrip_mw_status.Text = "Heart Beat Received";
         }));
     }
     msg_ctrl_main.AckCommandReceived -= OnHeart_beat_received;
 }
Beispiel #4
0
        public void OnArmAckReceived(object sender, AckReceivedEventArgs e)
        {
            msg_ctrl_main.AckCommandReceived -= OnArmAckReceived;
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate
                {
                    if (hardware_driver != null)
                    {
                        btn_stop.Enabled = true;
                    }
                    if (RC_driver != null)
                    {
                        btn_stop.Enabled = true;
                    }
                }));
            }

        }
Beispiel #5
0
 public void OnAckSettingUpdateReceived(object sender, AckReceivedEventArgs e)
 {
     if (_msgID == e.ID)
     {
         _organizer.MWMsgCtrl.AckSettingUpdateReceived -= OnAckSettingUpdateReceived;
         mrft_points[_perform_counter].MRFTbagsCompleted += OnMRFTBagsCompeleted;
         _organizer.MWMsgCtrl.MRFTBagReceived += OnMRFTBagReceived;
         Debug.WriteLine(string.Format("MRFT settings update ack {0}", DateTime.Now.ToLongTimeString()));
     }
 }
Beispiel #6
0
 public void OnAckIntialSettingUpdateReceived(object sender, AckReceivedEventArgs e)
 {
     //Second step
     if (_msgID == e.ID)
     {
         TimeOutWatch.Stop();
         _organizer.MWMsgCtrl.AckSettingUpdateReceived -= OnAckIntialSettingUpdateReceived;
         _organizer.MWMsgCtrl.AckCommandReceived += OnAckCtrlSelectRecieved;
         _msgID = _organizer.MWCommander.AckID;
         LastMessage = _organizer.MWCommander.issue_cmd(commander.cmd_type.mrft_select, 1, _ctrl_chnl);//1: true
         _organizer.MWSerialDriver.serial_send(LastMessage);
         Debug.WriteLine(string.Format("MRFT settings update ack {0}", DateTime.Now.ToLongTimeString()));
         TimeOutWatch.Interval = session_organizer.timeOutInterval;
         TimeOutWatch.Start();
     }
 }
Beispiel #7
0
 private void OnAckCtrlSelectRecieved(object sender, AckReceivedEventArgs e)
 {
     if (_msgID == e.ID)
     {
         Debug.WriteLine(string.Format("MRFT ctrl select ack {0}", DateTime.Now.ToLongTimeString()));
         TimeOutWatch.Stop();
         _organizer.MWMsgCtrl.AckCommandReceived -= OnAckCtrlSelectRecieved;
         _organizer.MWMsgCtrl.MRFTBagReceived += OnMRFTBagReceived;
         mrft_points[_perform_counter].MRFTbagsCompleted += OnMRFTBagsCompeleted;
     }
 }
Beispiel #8
0
 private void OnAckSettingUpdate(object sender, AckReceivedEventArgs e)
 {
     if (_msgID == e.ID)
     {
         TimeOutWatch.Stop();
         _organizer.MWMsgCtrl.AckSettingUpdateReceived -= OnAckSettingUpdate;
         _organizer.MWMsgCtrl.AckCommandReceived += OnAckCtrlSelectRecieved;
         _msgID = _organizer.MWCommander.AckID;
         LastMessage = _organizer.MWCommander.issue_cmd(commander.cmd_type.mrft_select, 0, _ctrl_chnl);//0: false
         _organizer.MWSerialDriver.serial_send(LastMessage);
         TimeOutWatch.Interval = session_organizer.timeOutInterval;
         TimeOutWatch.Start();
     }
 }
Beispiel #9
0
 private void OnAckCtrlSelectRecieved(object sender, AckReceivedEventArgs e)
 {
     if (_msgID == e.ID)
     {
         TimeOutWatch.Stop();
         _organizer.MWMsgCtrl.AckCommandReceived -= OnAckCtrlSelectRecieved;
         if (IsGetBias)
         {
             _organizer.MWMsgCtrl.AckCommandReceived += OnAckGetBiasSet;
             _organizer.MWMsgCtrl.BiasReceived += OnBiasReceived;
             _msgID = _organizer.MWCommander.AckID;
             LastMessage = _organizer.MWCommander.issue_cmd(commander.cmd_type.get_bias, 0, _ctrl_chnl);
             _organizer.MWSerialDriver.serial_send(LastMessage);
             TimeOutWatch.Interval = session_organizer.timeOutInterval;
             TimeOutWatch.Start();
         }
         else
         {
             IsDone = true;
         }
     }
 }
Beispiel #10
0
 private void OnAckGetBiasSet(object sender, AckReceivedEventArgs e)
 {
     if (_msgID == e.ID)
     {
         TimeOutWatch.Stop();
         _organizer.MWMsgCtrl.AckCommandReceived -= OnAckGetBiasSet;
     }
 }