/// <summary>
        /// Factory to create an ICCAction instance depending on Scenario ID.
        /// </summary>
        /// <param name="scenarioId">ICCP Scenario ID.</param>
        /// <param name="address">Module address.</param>
        /// <param name="log">Log Manager.</param>
        /// <returns>An instance of the right ICCAction type.</returns>
        public static IICCAction GetAction(byte scenarioId, byte address, ILogger log = null)
        {
            IICCAction a = null;

            if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_ARCWELDING)
            {
                a = new ICCActionLightingScenarioStartArcWelding();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_BLKLED)
            {
                a = new ICCActionLightingScenarioStartBlinker();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_BLKOLD)
            {
                a = new ICCActionLightingScenarioStartBlinker();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_CAMERAFLASH)
            {
                a = new ICCActionLightingScenarioStartCameraFlash();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_CHASER)
            {
                a = new ICCActionLightingScenarioStartChaser();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_FIRE)
            {
                a = new ICCActionLightingScenarioStartFire();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_PROGCHANGE)
            {
                a = new ICCActionLightingScenarioStartProgChange();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_TRFCDEU)
            {
                a = new ICCActionLightingScenarioStartTrafficLights();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_TRFCFRA)
            {
                a = new ICCActionLightingScenarioStartTrafficLights();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_TUNGOFF)
            {
                a = new ICCActionLightingScenarioStartTungsten();
            }
            else if (scenarioId == ICCConstants.BICCP_SCN_LIGHT_TUNGON)
            {
                a = new ICCActionLightingScenarioStartTungsten();
            }
            else
            {
                throw new NotImplementedException(string.Format("ICCActionLightingScenarioStart doesn't recognize scenario {0:X2}.", scenarioId));
            }

            a.Address = address;
            a.Log     = log;

            return(a);
        }
示例#2
0
 /// <summary>
 /// Raises an action.
 /// </summary>
 /// <param name="a">Action.</param>
 protected virtual void RaiseAction(IICCAction a)
 {
     if (_actionRaised != null)
     {
         _actionRaised(this, new ActionEventArgs()
         {
             Action = a
         });
     }
 }
示例#3
0
 /// <summary>
 /// Add an action to the list.
 /// </summary>
 /// <param name="action">Action to be added.</param>
 public virtual void AddMessage(IICCAction action)
 {
     Actions.Add(action);
 }