/* ******************************************************************************* * INCLUDE ******************************************************************************* */ #include "Temperature.h" #include "Device.h" #include "Application.h" namespace Util { /* ******************************************************************************* * CLASS DEFINE ******************************************************************************* */ float Temperature::read() { Device device("/sys/devices/virtual/mstar/msys/TEMP_R"); try { device.open(); char str[64]; device.read((uint8_t*)str, sizeof(str)); int temp; sscanf(str, "Temperature %d", &temp); device.close(); return temp; } catch (const std::exception& e) { } return 0.0f; } }