diff options
Diffstat (limited to 'src/device/Keyboard.java')
| -rw-r--r-- | src/device/Keyboard.java | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/src/device/Keyboard.java b/src/device/Keyboard.java index 4a594f1..e311413 100644 --- a/src/device/Keyboard.java +++ b/src/device/Keyboard.java @@ -1,10 +1,60 @@ package org.manzerbredes.open_klm.device; -public class Keyboard{ - +import java.util.HashMap; +import org.manzerbredes.open_klm.device.Driver.*; +public class Keyboard{ + + /** + * Device driver + */ + private Driver device; + + /** + * Define Keyboard color state + */ + private HashMap<Region, Color> KeyboardColor=new HashMap<>(); + + /** + * Define Keyboard mode state + */ + private Mode mode=Mode.NORMAL; + /** + * Build a keyboard access + */ + public Keyboard(){ + try { + this.device=new Driver(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + /** + * + * Change global keyboard color + * + * @param color Color to apply + * @param intensity Intensity wanted + */ + public void setColor(Color color, Intensity intensity){ + // Save state + this.KeyboardColor.put(Region.LEFT, color); + this.KeyboardColor.put(Region.MIDDLE, color); + this.KeyboardColor.put(Region.RIGHT, color); + + // Set color + this.device.setColor(Region.LEFT, color, intensity); + this.device.setColor(Region.MIDDLE, color, intensity); + this.device.setColor(Region.RIGHT, color, intensity); + + // Apply color + this.device.commit(this.mode); + + } + }
\ No newline at end of file |
