コード例 #1
0
    private void hostController_SECsPrimaryIn(object sender, SECsPrimaryInEventArgs e)
    {
        switch (e.EventId)
        {
        case PrimaryEventType.Connected:
            Logger("Equipment Connected");

            Logger("Step 3: Initiate Establish Communication via S1F13 to equipment");
            // Trigger the S1F13 message to equipment. Now note that our establish communication carry a InitializationChain Context
            hostController.EstablishCommunication();

            // Wait for the reply from Equipment in Secondary Event
            break;

        case PrimaryEventType.EventReport:
            HandleEventReport(e.Inputs);
            break;

        case PrimaryEventType.AlarmSet:
            HandleAlarmReport(e.Inputs);
            break;

        case PrimaryEventType.AlarmCleared:
            // In this demo, assuming we are not interested in the specific alarm clear event, so we just broadcast the alarm event.
            Logger("Alarm: " + e.Inputs.DataItem["Ln"]["ALID"].Value + " is cleared");
            break;
        }
    }
コード例 #2
0
    /// <summary>
    /// Equipment primary event handler
    /// </summary>
    /// <param name="sender">event sender</param>
    /// <param name="e">event parameters</param>
    private void OnPrimaryIn(object sender, SECsPrimaryInEventArgs e)
    {
        switch (e.EventId)
        {
        case PrimaryEventType.Connected:                        // this signal that we have successfully connected to the equipment
            Logger("Equipment Connected");
            // Use Tag to set the context for our Daisy Chain method
            hostController.Tag = InitializationChainContext;

            Logger("Step 3: Initiate Establish Communication via S1F13 to equipment");
            // Trigger the S1F13 message to equipment. Now note that our establish communication carry a InitializationChain Context
            hostController.EstablishCommunication();

            // Wait for the reply from Equipment in Secondary Event
            break;

        case PrimaryEventType.EventReport:
            Logger("Received event: " + e.Inputs.DataItem["Ln"]["CEID"].Value);
            break;
        }
    }