private void CheckKeys(byte unitId, int column, byte newValues, byte oldValues, byte[] alldata) { var changedBits = newValues ^ oldValues; for (byte bit = 0; bit < 8; bit++) { if ((changedBits & 0x1) > 0) { DeviceEnumerator.KeyNotify(unitId, column * 8 + bit, (newValues & 0x1) > 0, GetAllKeys(alldata)); } changedBits = changedBits >> 1; newValues = (byte)(newValues >> 1); } }
private void SetBacklight(IEngine engine) { try { foreach (var backlight in Backlights.Where(b => b.State != engine.EngineState)) { foreach (var backlightKey in backlight.Keys) { DeviceEnumerator.SetBacklight(UnitId, backlightKey, BacklightColorEnum.None, false); } } foreach (var backlight in Backlights.Where(b => b.State == engine.EngineState)) { foreach (var backlightKey in backlight.Keys) { DeviceEnumerator.SetBacklight(UnitId, backlightKey, backlight.Color, backlight.Blinking); } } } catch (Exception exception) { Logger.Error(exception); } }