Sets the brightness @param bright 0.0 (off) to 1.0 (maximum) @webref
(float bright)
| 109 | * @webref |
| 110 | */ |
| 111 | public void brightness(float bright) { |
| 112 | if (bright < 0.0 || 1.0 < bright) { |
| 113 | System.err.println("Brightness must be between 0.0 and 1.0."); |
| 114 | throw new IllegalArgumentException("Illegal argument"); |
| 115 | } |
| 116 | |
| 117 | if (NativeInterface.isSimulated()) { |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | String fn = "/sys/class/leds/" + dev + "/brightness"; |
| 122 | int ret = NativeInterface.writeFile(fn, Integer.toString((int)(bright * maxBrightness))); |
| 123 | if (ret < 0) { |
| 124 | throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | |
| 129 | /** |
nothing calls this directly
no test coverage detected