-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
49 lines (36 loc) · 1.07 KB
/
index.js
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
"use strict";
const ddcci = require("bindings")("ddcci");
const vcp = require("./vcp");
module.exports = {
vcp
, _getVCP: ddcci.getVCP
, _setVCP: ddcci.setVCP
, _refresh: ddcci.refresh
, getMonitorList: ddcci.getMonitorList
, getVCP: ddcci.getVCP
, setVCP: ddcci.setVCP
, getBrightness (monitorId) {
return ddcci.getVCP(monitorId, vcp.LUMINANCE)[0];
}
, getMaxBrightness (monitorId) {
return ddcci.getVCP(monitorId, vcp.LUMINANCE)[1];
}
, getContrast (monitorId) {
return ddcci.getVCP(monitorId, vcp.CONTRAST)[0];
}
, getMaxContrast (monitorId) {
return ddcci.getVCP(monitorId, vcp.CONTRAST)[1];
}
, setBrightness (monitorId, level) {
if (level < 0) {
throw RangeError("Brightness level not within valid range");
}
ddcci.setVCP(monitorId, vcp.LUMINANCE, level);
}
, setContrast (monitorId, level) {
if (level < 0) {
throw RangeError("Contrast level not within valid range");
}
ddcci.setVCP(monitorId, vcp.CONTRAST, level);
}
};