private void hostController_SECsSecondaryIn(object sender, SECsSecondaryInEventArgs e) { switch (e.EventId) { case SecondaryEventType.EstablishCommunicationReply: // S1F14. Replies from S1F13 message // Check if equipment accept our S1F13 request if (e.Outputs.DataItem["Ln"]["COMMACK"].Value.ToString() == "0") // 0 means OK { Logger("Establish Communication accepted"); Logger("Now wait for event: MaterialArrived (CEID:2001) to be sent by Equipment!!!"); } else { Logger("Establish Communication not accepted. Initialization terminated!"); } break; case SecondaryEventType.HostCommandReply: // S2F42. Replies from our HostCommand (S2F41) message. if (e.Outputs.DataItem["Ln"]["HACK"].Value.ToString() == "0") { Logger("Host command: " + e.Inputs.DataItem["Ln"]["RCMD"].Value.ToString() + " is accepted by equipment"); Logger("Now we will wait for other event/alarm from equipment..."); } else { Logger("Host command: " + e.Inputs.DataItem["Ln"]["RCMD"].Value.ToString() + " is not accepted by equipment. HACK: " + e.Outputs.DataItem["Ln"]["HACK"].Value.ToString()); } break; case SecondaryEventType.EquipmentStatusVariablesReply: // S1F4. Replies from our EquipmentStatusVariables() method for (int i = 0; i < e.Outputs.DataItem["Ln"].Count; i++) { Logger("SV: " + e.Outputs.DataItem["Ln"][i].Name + ", Value: " + e.Outputs.DataItem["Ln"][i].Value.ToString()); } break; } }
private void OnSecondaryIn(object sender, SECsSecondaryInEventArgs e) { switch (e.EventId) { case SecondaryEventType.EstablishCommunicationReply: // S1F14. Replies from S1F13 message // Check if equipment accept our S1F13 request if (e.Outputs.DataItem["Ln"]["COMMACK"].Value.ToString() == "0") // 0 means OK { Logger("Establish Communication accepted"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 4: Synchronous Host current date & time with Equipment"); hostController.DateTimeSetRequest(); } } else { Logger("Establish Communication not accepted. Initialization terminated!"); } break; case SecondaryEventType.DateTimeSetReply: // S2F32. Acknowledgement from our DateTimeSetRequest() if (e.Outputs.DataItem["TIACK"].Value.ToString() == "0") // 0 Means OK { Logger("DateTimeSet acknowledged OK"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 5: Disable all the alarm activation status at Equipment"); hostController.EnableAlarm(false); } } break; case SecondaryEventType.DisableAlarmReportReply: // S5F4. Acknowledgement from our EnableAlarm(false) - Disable all alarm if (e.Outputs.DataItem["ACKC5"].Value.ToString() == "0") { Logger("Disable all Alarms accepted by equipment"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 6: Enable all the alarm as defined in our ToolModel1.xml"); hostController.EnableAlarm(true); } } else { Logger("Disable all Alarms not accepted by equipment. Initialization terminated!"); } break; case SecondaryEventType.EnableAlarmReportReply: // S5F4. Enable Alarm acknowledgement if (e.Outputs.DataItem["ACKC5"].Value.ToString() == "0") { Logger("Enable all Alarms accepted by equipment"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 7: Delete equipment existing report definition"); hostController.DefineReports(DefineReportType.DeleteReports); } } else { Logger("Enable Alarms not accepted by equipment. Initialization terminated!"); } break; case SecondaryEventType.DeleteAllReportsReply: // S2F34. Delete all reports acknowledgement if (e.Outputs.DataItem["DRACK"].Value.ToString() == "0") { Logger("Delete all report accepted"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 8: Define all reports and its associated variables as defined in out ToolModel1.xml"); hostController.DefineReports(DefineReportType.DefineReports); } } else { Logger("Delete all report not accepted. Initialization terminated!"); } break; case SecondaryEventType.DefineReportsReply: // S2F34. Define reports acknowledgement if (e.Outputs.DataItem["DRACK"].Value.ToString() == "0") { Logger("Define all report accepted"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 9: Unlink equipment event report definition"); hostController.LinkEventReport(LinkEventReportType.UnlinkEventReports); } } else { Logger("Define all report not accepted. Initialization terminated!"); } break; case SecondaryEventType.UnlinkEventReportsReply: // S2F36 Unlink event report acknowledgement if (e.Outputs.DataItem["LRACK"].Value.ToString() == "0") { Logger("Unlink event report is accepted"); // Check if it is a Initialization Chain Context if (e.Tag.Equals(InitializationChainContext)) { // Continue our initialization // Keep setting the Daisy Chain context hostController.Tag = InitializationChainContext; Logger("Step 10: Link event report definition to equipment as defined in our ToolModel1.xml"); hostController.LinkEventReport(LinkEventReportType.LinkEventReports); } } else { Logger("Unlink event report is not accepted. Initialization terminated!"); } break; case SecondaryEventType.LinkEventReportsReply: // S2F36 Link event report acknowledgement if (e.Outputs.DataItem["LRACK"].Value.ToString() == "0") { Logger("Unlink event report is accepted"); Logger("Daisy Chain Demo completed."); // This will disconnect our connection to equipment hostController.Disconnect(); Logger("Communication disconnected"); } else { Logger("Unlink event report is not accepted. Initialization terminated!"); } break; } }