#include "model/Led.h" #include "QDebug" Led::Led() { _hasLed = false; } /*************************************************************************************************/ Led::Led(char functionCode) { _functionCode = functionCode; _hasLed = true; } /*************************************************************************************************/ void Led::newData(QByteArray data, Logger* _logger) { if(data[FUNCTION_CODE] != _functionCode) { return; } try { if(!(data[LED_COLOR] == static_cast(LED_OFF) || data[LED_COLOR] == static_cast(LED_COLOR_WHITE) || data[LED_COLOR] == static_cast(LED_COLOR_GREEN))) { throw std::runtime_error("Led state color is not correct"); } if(data[FUNCTION_CODE] == _functionCode) { emit ledChanged(data[LED_COLOR]); } } catch(const std::exception& e) { _logger->log(e.what()); } }