Beispiel #1
0
        private void SecsGemService_PrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
        {
            var       message  = e.Message;
            string    sf       = message.GetSFString();
            IScenario scenario = null;

            switch (sf)
            {
            case "S1F1":
            case "S1F13":
            case "S1F17":
            case "S1F15":
            case "S2F17":    // equipment requests host time
            case "S6F11":
                scenario = scenarioControllers[Scenarios.Intialize_Scenario];
                break;

            case "S2F41":
                scenario = scenarioControllers[Scenarios.Remote_Control];
                break;

            case "S5F3":
            case "S5F103":
                scenario = scenarioControllers[Scenarios.Alarm_Management];
                break;

            case "S2F31":
                scenario = scenarioControllers[Scenarios.Clock];
                break;

            case "S10F1":
            case "S10F5":
                scenario = scenarioControllers[Scenarios.Equipment_Terminal_Service];
                break;

            case "S7F19":
            case "S7F25":
                scenario = scenarioControllers[Scenarios.Recipe_Management];
                break;

            case "S6F3":
            case "S2F23":
            case "S6F1":
            case "S1F3":
            case "S1F5":
            case "S2F13":
            case "S2F15":
            case "S2F37":
                scenario = scenarioControllers[Scenarios.Data_Collection];
                break;

            default:
                break;
            }
            message.SystenBytes = e.MessageId;
            scenario?.HandleSecsMessage(message);
        }
Beispiel #2
0
        private async void AutoReply(PrimaryMessageWrapper pmw)
        {
            try
            {
                // Get the Stream
                switch (pmw.Message.S)
                {
                case 1:
                {
                    switch (pmw.Message.F)
                    {
                    case 1:
                        await pmw.ReplyAsync(new SecsMessage(1, 2, "I am here",
                                                             Item.L()));

                        return;

                    case 13:
                        await pmw.ReplyAsync(new SecsMessage(1, 14,
                                                             "Establish Communications Request Acknowledge",
                                                             Item.L()));

                        return;
                    }

                    break;
                }

                case 14:
                {
                    if (pmw.Message.F == 1)
                    {
                        await pmw.ReplyAsync(txtReplySeconary.Text.ToSecsMessage());

                        return;
                    }

                    break;
                }
                }

                await pmw.ReplyAsync(new SecsMessage(pmw.Message.S, (byte)((int)pmw.Message.F + 1),
                                                     "SuperResponse", Item.B(0)));
            }
            catch (Exception ee)
            {
                Invoke((MethodInvoker) delegate {
                    richTextBox1.SelectionColor = Color.Red;
                    richTextBox1.AppendText($"Exception AutoResponse\n{ee}\n");
                });
            }
        }
Beispiel #3
0
        private async void PrimaryMsgHandler(object sender, PrimaryMessageWrapper e)
        {
            try
            {
                await e.ReplyAsync(SecsMessages[e.Message.S, (byte)(e.Message.F + 1)].FirstOrDefault());

                if (_eventHandlers.TryGetValue(e.Message.GetKey(), out var handler))
                {
                    Parallel.ForEach(handler.GetInvocationList().Cast <Action <SecsMessage> >(), h => h(e.Message));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Handle Primary SECS message Error", ex);
            }
        }
Beispiel #4
0
 private void PrimaryMsgHandler(object sender, PrimaryMessageWrapper e)
 {
     try
     {
         e.Reply(SecsMessages[e.Message.S, (byte)(e.Message.F + 1)].FirstOrDefault());
         Action <SecsMessage> handler = null;
         if (_eventHandlers.TryGetValue(e.Message.GetKey(), out handler))
         {
             Parallel.ForEach(handler.GetInvocationList().Cast <Action <SecsMessage> >(), h => h(e.Message));
         }
     }
     catch (Exception ex)
     {
         EapLogger.Error("Handle Primary SECS message Error", ex);
     }
 }
        private void SecsGem_PrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
        {
            SmlLog(e.Message.ToSml());

            string reply = @"Establish Communication Request:'S1F14'
  <L [2] 
    <A [1] '0'>
    <L [2] 
      <A [4] 'MDLN'>
      <A [7] 'SOFTREV'>
    >
  >
.";
            //Thread.Sleep(1000);
            //secsGem.SendAsync(reply.ToSecsMessage(), e.MessageId);
        }
Beispiel #6
0
 private void PrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
 {
     try
     {
         if (CheckBoxAutoResponse.Checked)
         {
             AutoReply(e);
         }
         else
         {
             this.Invoke(new MethodInvoker(() => recvBuffer.Add(e)));
         }
     }
     catch (Exception ee)
     {
         Invoke((MethodInvoker) delegate {
             richTextBox1.SelectionColor = Color.Red;
             richTextBox1.AppendText($"Exception PrimaryMessageReceived\n{ee}\n");
         });
     }
 }
Beispiel #7
0
 private void PrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
 {
     this.Invoke(new MethodInvoker(() => recvBuffer.Add(e)));
 }
Beispiel #8
0
 private void SecsGem_PrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
 {
     SmlLog(e.Message.ToSml());
 }
 private void Host_PrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
 {
     Trace.WriteLine($"{nameof(SecsGem.PrimaryMessageReceived)}: {e.Message}", nameof(this.Host));
 }