Example #1
0
 /// <summary>
 /// Fire the rule to see if things will change.
 /// </summary>
 /// <param name="connection">the concerning connection</param>
 /// <param name="newState">the new state</param>
 public IEnumerable<StateChangeDirective> Fire(Connection connection, State newState)
 {
     Debug.WriteLine("Rule with logic: " + LogicText + " fireing!");
     var scd = Logic.GetNewState(newState, connection, Connections.ToList(), LastTriggered, TimeOfLastChange);
     LastTriggered = DateTime.Now.Ticks;
     if (scd.Any()) TimeOfLastChange = DateTime.Now.Ticks;
     return scd;
 }
Example #2
0
 public IEnumerable<NCDControlMessage> GetMessages(State state, IEnumerable<NCDHardwareIdentifier> ids )
 {
     var ncdHardwareIdentifiers = ids as NCDHardwareIdentifier[] ?? ids.ToArray();
     yield return new NCDControlMessage(state == "On", ncdHardwareIdentifiers[0].Bank, ncdHardwareIdentifiers[0].Unit);
 }