blob: e31141360a9cbb72279a511a84a6a080979fea59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package org.manzerbredes.open_klm.device;
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);
}
}
|