void StatusXMLDocumentHandler::startTag(QString tagName, QHash<QString, QString> attributes) { setStatus(false); bool tmp = true; if(tagName == "DisplayStatus") { } if(checkData(attributeList.value(tagName), attributes)) { if(tagName == "StatusText") { int p; float f; if(validateAttribute(attributes.value("name_text_id"), _int, &p, &tmp)) statusData.setNameTextId(p); if(attributes.contains("value")) { if(validateAttribute(attributes.value("value"), _float, &f, &tmp)) statusData.setValue(f); if(validateAttribute(attributes.value("unit_text_id"), _int, &p, &tmp)) statusData.setUnitTextId(p); if(validateAttribute(attributes.value("precision"), _int, &p, &tmp)) statusData.setPrecision(p); } } else if(tagName == "Led") { int p; QString s; Led led; if(validateAttribute(attributes.value("id"), _int, &p, &tmp)) { if(!leds.contains(p)) { led.setId(p); // leds.insert(p,led); // status.addLed(led); } else { // led = leds.value(p); } } if(validateAttribute(attributes.value("color"), _string, &s, &tmp)) { // if(ledData) led.setColor(s); } if(validateAttribute(attributes.value("blink"), _int, &p, &tmp)) { // if(ledData) led.setBlink(p); } } } else { error("Not all mandatory attributes are validated"); } setStatus(tmp); }
void setup() { led.setColor(standby1); Particle.function("status", handleStatus); }