Restores the previous state @webref
()
| 131 | * @webref |
| 132 | */ |
| 133 | public void close() { |
| 134 | if (NativeInterface.isSimulated()) { |
| 135 | return; |
| 136 | } |
| 137 | |
| 138 | // restore previous settings |
| 139 | String fn = "/sys/class/leds/" + dev + "/brightness"; |
| 140 | int ret = NativeInterface.writeFile(fn, Integer.toString(prevBrightness)); |
| 141 | if (ret < 0) { |
| 142 | throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); |
| 143 | } |
| 144 | |
| 145 | fn = "/sys/class/leds/" + dev + "/trigger"; |
| 146 | ret = NativeInterface.writeFile(fn, prevTrigger); |
| 147 | if (ret < 0) { |
| 148 | throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | |
| 153 | /** |