@@ -0,0 +1,780 @@
+package io.silverspoon.bulldog.devices.sensors;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.nio.file.Files;%0A%0A/**%0A * Dallas DS18B20 temperature sensor implementation.%0A * %0A * @author sbunciak%0A *%0A */%0Apublic class DS18B20TemperatureSensor %7B%0A%0A%09private File deviceFile = null;%0A%0A%09public DS18B20TemperatureSensor(File deviceFile) %7B%0A%09%09this.deviceFile = deviceFile;%0A%09%7D%0A%0A%09// TODO: implement using UART?%0A%09public float readTemperature() throws IOException %7B%0A%0A%09%09byte%5B%5D encoded = Files.readAllBytes(new File(deviceFile, %22w1_slave%22).toPath());%0A%0A%09%09String tmp = new String(encoded);%0A%09%09int tmpIndex = tmp.indexOf(%22t=%22);%0A%0A%09%09if (tmpIndex %3C 0) %7B%0A%09%09%09throw new IOException(%22Could not read temperature!%22);%0A%09%09%7D%0A%0A%09%09return Integer.parseInt(tmp.substring(tmpIndex + 2).trim()) / 1000f;%0A%09%7D%0A%7D%0A

Add support for DS18B20 Temperature Sensor