void EmsMessage::parseRCHKMonitorMessage(EmsValue::SubType subtype) { parseNumeric(2, 1, 2, EmsValue::SollTemp, EmsValue::Raum); parseNumeric(3, 2, 10, EmsValue::IstTemp, EmsValue::Raum); if (canAccess(7, 3)) { EmsValue value(EmsValue::HKKennlinie, subtype, m_data[7 - m_offset], m_data[8 - m_offset], m_data[9 - m_offset]); m_valueHandler(value); } parseNumeric(14, 1, 1, EmsValue::SollTemp, subtype); parseInteger(5, 1, EmsValue::EinschaltoptimierungsZeit, subtype); parseInteger(6, 1, EmsValue::AusschaltoptimierungsZeit, subtype); if (canAccess(15, 1) && (m_data[15 - m_offset] & 1) == 0) { parseNumeric(10, 2, 100, EmsValue::TemperaturAenderung, EmsValue::Raum); } parseBool(0, 2, EmsValue::Automatikbetrieb, subtype); parseBool(0, 0, EmsValue::Ausschaltoptimierung, subtype); parseBool(0, 1, EmsValue::Einschaltoptimierung, subtype); parseBool(0, 3, EmsValue::WWVorrang, subtype); parseBool(0, 4, EmsValue::Estrichtrocknung, subtype); parseBool(0, 6, EmsValue::Frostschutzbetrieb, subtype); parseBool(1, 0, EmsValue::Sommerbetrieb, subtype); parseBool(1, 1, EmsValue::Tagbetrieb, subtype); parseBool(13, 2, EmsValue::Party, subtype); parseBool(13, 3, EmsValue::Pause, subtype); parseBool(13, 6, EmsValue::Urlaub, subtype); parseBool(13, 7, EmsValue::Ferien, subtype); parseBool(13, 4, EmsValue::SchaltuhrEin, subtype); }
void EmsMessage::parseUBAParameterWWMessage() { parseBool(1, 0, EmsValue::KesselSchalter, EmsValue::WW); parseNumeric(2, 1, 1, EmsValue::SetTemp, EmsValue::WW); parseNumeric(8, 1, 1, EmsValue::DesinfektionsTemp, EmsValue::WW); parseEnum(7,EmsValue::Schaltpunkte, EmsValue::Zirkulation); }
void EmsMessage::parseMMTempMessage() { parseNumeric(0, 1, 1, EmsValue::SollTemp, EmsValue::HK2); parseNumeric(1, 2, 10, EmsValue::IstTemp, EmsValue::HK2); parseNumeric(3, 1, 1, EmsValue::Mischersteuerung, EmsValue::None); /* Byte 3 = 0 -> Pumpe aus, 100 = 0x64 -> Pumpe an */ parseBool(3, 2, EmsValue::PumpeAktiv, EmsValue::HK2); }
void EmsMessage::parseUBAMonitorSlowMessage() { parseNumeric(0, 2, 10, EmsValue::IstTemp, EmsValue::Aussen); parseNumeric(2, 2, 10, EmsValue::IstTemp, EmsValue::Waermetauscher); parseNumeric(4, 2, 10, EmsValue::IstTemp, EmsValue::Abgas); parseNumeric(9, 1, 1, EmsValue::IstModulation, EmsValue::KesselPumpe); parseInteger(10, 3, EmsValue::Brennerstarts, EmsValue::Kessel); parseInteger(13, 3, EmsValue::BetriebsZeit, EmsValue::Kessel); parseInteger(19, 3, EmsValue::HeizZeit, EmsValue::Kessel); }
void EmsMessage::parseUBAMonitorFastMessage() { parseNumeric(0, 1, 1, EmsValue::SollTemp, EmsValue::Kessel); parseNumeric(1, 2, 10, EmsValue::IstTemp, EmsValue::Kessel); parseNumeric(11, 2, 10, EmsValue::IstTemp, EmsValue::WW); parseNumeric(13, 2, 10, EmsValue::IstTemp, EmsValue::Ruecklauf); parseNumeric(3, 1, 1, EmsValue::SollModulation, EmsValue::Brenner); parseNumeric(4, 1, 1, EmsValue::IstModulation, EmsValue::Brenner); parseNumeric(15, 2, 10, EmsValue::Flammenstrom, EmsValue::None); parseNumeric(17, 1, 10, EmsValue::Systemdruck, EmsValue::None); if (canAccess(18, 2)) { std::ostringstream ss; ss << m_data[18] << m_data[19]; m_valueHandler(EmsValue(EmsValue::ServiceCode, EmsValue::None, ss.str())); } if (canAccess(20, 2)) { std::ostringstream ss; ss << std::dec << (m_data[20] << 8 | m_data[21]); m_valueHandler(EmsValue(EmsValue::FehlerCode, EmsValue::None, ss.str())); } parseBool(7, 0, EmsValue::FlammeAktiv, EmsValue::None); parseBool(7, 2, EmsValue::BrennerAktiv, EmsValue::None); parseBool(7, 3, EmsValue::ZuendungAktiv, EmsValue::None); parseBool(7, 5, EmsValue::PumpeAktiv, EmsValue::Kessel); parseBool(7, 6, EmsValue::DreiWegeVentilAufWW, EmsValue::None); parseBool(7, 7, EmsValue::ZirkulationAktiv, EmsValue::None); }
Token Lexer::parseNext() { //skip whitespace of the current character skipWhitespace(); //return eof if we are at the end if (curChar() == '\0') { return Token::Eof; } Token ret; //first check if it is a keyword and return it ret = parseKeyword(); if (ret != Token::None) return ret; ret = parseSymbol(); if (ret != Token::None) return ret; ret = parseIdentifier(); if (ret != Token::None) return ret; ret = parseNumeric(); if (ret != Token::None) return ret; //if nothing was able to parse it, it must be a character and we return it value.character = eatChar(); return Token::Character; }
void EmsMessage::parseRCSystemParameterMessage() { parseNumeric(5, 1, 1, EmsValue::MinTemp, EmsValue::Aussen); parseEnum(6, EmsValue::GebaeudeArt, EmsValue::None); parseBool(21, 1, EmsValue::ATDaempfung, EmsValue::None); }
void EmsMessage::parseWMTemp1Message() { parseNumeric(0, 2, 10, EmsValue::IstTemp, EmsValue::HK1); /* Byte 2 = 0 -> Pumpe aus, 100 = 0x64 -> Pumpe an */ parseBool(2, 2, EmsValue::PumpeAktiv, EmsValue::HK1); }
void EmsMessage::parseUBAMonitorWWMessage() { parseNumeric(0, 1, 1, EmsValue::SollTemp, EmsValue::WW); parseNumeric(1, 2, 10, EmsValue::IstTemp, EmsValue::WW); parseInteger(10, 3, EmsValue::WarmwasserbereitungsZeit, EmsValue::None); parseInteger(13, 3, EmsValue::WarmwasserBereitungen, EmsValue::None); parseBool(5, 0, EmsValue::Tagbetrieb, EmsValue::WW); parseBool(5, 1, EmsValue::EinmalLadungAktiv, EmsValue::WW); parseBool(5, 2, EmsValue::DesinfektionAktiv, EmsValue::WW); parseBool(5, 3, EmsValue::WarmwasserBereitung, EmsValue::None); parseBool(5, 4, EmsValue::NachladungAktiv, EmsValue::WW); parseBool(5, 5, EmsValue::WarmwasserTempOK, EmsValue::None); parseBool(7, 0, EmsValue::Tagbetrieb, EmsValue::Zirkulation); parseBool(7, 2, EmsValue::ZirkulationAktiv, EmsValue::None); parseEnum(8, EmsValue::WWSystemType, EmsValue::None); }
/*! ********************************************************************** * Function: waitForNumericInput * * \brief Waits for input and parses number * * Include: * * Description: Waits in a loop for a user command ended with a new line character. * Once a command is received, it is converted into the appropriate * numeric value that the user has given. * * Arguments: None * * Returns: The integer result of the string input * ERR_NOT_NUMERIC for any non-numeric input * ERR_NUM_OUT_OF_RANGE for 0 digits or 5+ digits * ESC_PRESSED if escape was pressed *************************************************************************/ static int getSerialNumericInput() { char userget[80] = {0}; if (receiveEsc()) { popEsc(); return ESC_PRESSED; } readString(userget); //!Get the input string and store it in @userget return parseNumeric(userget); }
void AttributeParser::parseNumericData(MFnDependencyNode & node, MObject & attr) { MStatus status; MFnNumericData fnNumericData(attr, &status); if (!status) return; MPlug plug = node.findPlug(attr, &status); if (!status) return; MFnNumericData::Type type = fnNumericData.numericType(&status); parseNumeric(plug, type); }
MStatus AttributeParser::parseNumericAttribute(MFnDependencyNode & node, MObject & attr) { MStatus status; MFnNumericAttribute fnNumAttr(attr, &status); if (!status) return status; MFnNumericData::Type type = fnNumAttr.unitType(&status); if (!status) return status; MPlug plug = node.findPlug(attr, &status); if (!status) return status; return parseNumeric(plug, type); }
void EmsMessage::parseRCWWOpmodeMessage() { parseBool(0, 1, EmsValue::EigenesProgrammAktiv, EmsValue::WW); parseBool(1, 1, EmsValue::EigenesProgrammAktiv, EmsValue::Zirkulation); parseEnum(2, EmsValue::Betriebsart, EmsValue::WW); parseEnum(3, EmsValue::Betriebsart, EmsValue::Zirkulation); parseBool(4, 1, EmsValue::Desinfektion, EmsValue::WW); parseEnum(5, EmsValue::DesinfektionTag, EmsValue::WW); parseInteger(6, 1, EmsValue::DesinfektionStunde, EmsValue::WW); parseNumeric(8, 1, 1, EmsValue::MaxTemp, EmsValue::WW); parseBool(9 ,1, EmsValue::EinmalLadungsLED, EmsValue::WW); }
void EmsMessage::parseUBAParametersMessage() { parseBool(0, 1, EmsValue::KesselSchalter, EmsValue::Kessel); parseNumeric(1, 1, 1, EmsValue::SetTemp, EmsValue::Kessel); parseNumeric(2, 1, 1, EmsValue::MaxModulation, EmsValue::Brenner); parseNumeric(3, 1, 1, EmsValue::MinModulation, EmsValue::Brenner); parseNumeric(4, 1, 1, EmsValue::AusschaltHysterese, EmsValue::Kessel); parseNumeric(5, 1, 1, EmsValue::EinschaltHysterese, EmsValue::Kessel); parseInteger(6, 1, EmsValue::AntipendelZeit, EmsValue::None); parseInteger(8, 1, EmsValue::NachlaufZeit, EmsValue::KesselPumpe); parseNumeric(9, 1, 1, EmsValue::MaxModulation, EmsValue::KesselPumpe); parseNumeric(10, 1, 1, EmsValue::MinModulation, EmsValue::KesselPumpe); }
static void readToken (tokenInfo *const token) { int c; token->type = TOKEN_UNDEFINED; token->keyword = KEYWORD_NONE; vStringClear (token->string); getNextChar: do c = getcFromInputFile (); while (c == '\t' || c == ' ' || c == '\n'); switch (c) { case EOF: token->type = TOKEN_EOF; break; case ';': token->type = TOKEN_SEMICOLON; break; case '!': token->type = TOKEN_BANG; break; case '}': token->type = TOKEN_CLOSE_BRACE; break; case ']': token->type = TOKEN_CLOSE_BRACKET; break; case ')': token->type = TOKEN_CLOSE_PAREN; break; case ',': token->type = TOKEN_COMMA; break; case '$': token->type = TOKEN_DOLLAR; break; case '.': token->type = TOKEN_DOT; break; case '{': token->type = TOKEN_OPEN_BRACE; break; case '[': token->type = TOKEN_OPEN_BRACKET; break; case '(': token->type = TOKEN_OPEN_PAREN; break; case '~': token->type = TOKEN_TILDE; break; case '+': case '*': case '^': case '=': token->type = TOKEN_OPERATOR; break; case '-': c = getcFromInputFile (); if (c == '>') token->type = TOKEN_CONSTRAINT; else if (c == '-') /* is this the start of a comment? */ { skipToCharacter ('\n'); goto getNextChar; } else { if (!isspace (c)) ungetcToInputFile (c); token->type = TOKEN_OPERATOR; } break; case '?': case ':': { int c2 = getcFromInputFile (); if (c2 == '=') token->type = TOKEN_OPERATOR; else { if (!isspace (c2)) ungetcToInputFile (c2); if (c == ':') token->type = TOKEN_COLON; else token->type = TOKEN_QUESTION; } break; } case '<': c = getcFromInputFile (); if (c != '=' && c != '>' && !isspace (c)) ungetcToInputFile (c); token->type = TOKEN_OPERATOR; break; case '>': c = getcFromInputFile (); if (c != '=' && c != '>' && !isspace (c)) ungetcToInputFile (c); token->type = TOKEN_OPERATOR; break; case '/': c = getcFromInputFile (); if (c != '/' && c != '=' && !isspace (c)) ungetcToInputFile (c); token->type = TOKEN_OPERATOR; break; case '\\': c = getcFromInputFile (); if (c != '\\' && !isspace (c)) ungetcToInputFile (c); token->type = TOKEN_OPERATOR; break; case '"': token->type = TOKEN_STRING; parseString (token->string); break; case '\'': token->type = TOKEN_CHARACTER; parseCharacter (); break; default: if (isalpha (c)) { parseIdentifier (token->string, c); token->keyword = analyzeToken (token->string, Lang_eiffel); if (isKeyword (token, KEYWORD_NONE)) token->type = TOKEN_IDENTIFIER; else token->type = TOKEN_KEYWORD; } else if (isdigit (c)) { vString* numeric = parseNumeric (c); vStringCat (token->string, numeric); vStringDelete (numeric); token->type = TOKEN_NUMERIC; } else if (isFreeOperatorChar (c)) { parseFreeOperator (token->string, c); token->type = TOKEN_OPERATOR; } else token->type = TOKEN_UNDEFINED; break; } }
static void readToken (tokenInfo *const token) { int c; token->type = TOKEN_UNDEFINED; token->keyword = KEYWORD_NONE; vStringClear (token->string); getNextChar: do c = fileGetc (); while (c == '\t' || c == ' ' || c == '\n'); switch (c) { case EOF: longjmp (Exception, (int)ExceptionEOF); break; case '!': token->type = TOKEN_BANG; break; case '$': token->type = TOKEN_DOLLAR; break; case '(': token->type = TOKEN_OPEN_PAREN; break; case ')': token->type = TOKEN_CLOSE_PAREN; break; case ',': token->type = TOKEN_COMMA; break; case '.': token->type = TOKEN_DOT; break; case ';': goto getNextChar; case '[': token->type = TOKEN_OPEN_BRACKET; break; case ']': token->type = TOKEN_CLOSE_BRACKET; break; case '{': token->type = TOKEN_OPEN_BRACE; break; case '}': token->type = TOKEN_CLOSE_BRACE; break; case '~': token->type = TOKEN_TILDE; break; case '+': case '*': case '^': case '=': token->type = TOKEN_OPERATOR; break; case '-': c = fileGetc (); if (c == '>') token->type = TOKEN_CONSTRAINT; else if (c == '-') /* is this the start of a comment? */ { skipToCharacter ('\n'); goto getNextChar; } else { if (!isspace (c)) fileUngetc (c); token->type = TOKEN_OPERATOR; } break; case '?': case ':': c = fileGetc (); if (c == '=') token->type = TOKEN_OPERATOR; else { token->type = TOKEN_COLON; if (!isspace (c)) fileUngetc (c); } break; case '<': c = fileGetc (); if (c != '=' && c != '>' && !isspace (c)) fileUngetc (c); token->type = TOKEN_OPERATOR; break; case '>': c = fileGetc (); if (c != '=' && c != '>' && !isspace (c)) fileUngetc (c); token->type = TOKEN_OPERATOR; break; case '/': c = fileGetc (); if (c != '/' && c != '=' && !isspace (c)) fileUngetc (c); token->type = TOKEN_OPERATOR; break; case '\\': c = fileGetc (); if (c != '\\' && !isspace (c)) fileUngetc (c); token->type = TOKEN_OPERATOR; break; case '"': token->type = TOKEN_STRING; parseString (token->string); break; case '\'': token->type = TOKEN_CHARACTER; parseCharacter (); break; default: if (isalpha (c)) { parseIdentifier (token->string, c); token->keyword = analyzeToken (token->string); if (isKeyword (token, KEYWORD_NONE)) token->type = TOKEN_IDENTIFIER; else token->type = TOKEN_KEYWORD; } else if (isdigit (c)) { vStringCat (token->string, parseNumeric (c)); token->type = TOKEN_NUMERIC; } else if (isFreeOperatorChar (c)) { parseFreeOperator (token->string, c); token->type = TOKEN_OPERATOR; } else { token->type = TOKEN_UNDEFINED; Assert (! isType (token, TOKEN_UNDEFINED)); } break; } }
void AttributeParser::parseAttribute(MFnDependencyNode & node, MObject & attr, std::set<String>& parsedAttributes) { AutoOnAfterAttribute onAfterAttribute(*this, node, attr); if (!onBeforeAttribute(node, attr)) { // Skip attribute return; } MStatus status; MFnAttribute fnAttr(attr, &status); if (!status) return; MString attrName = fnAttr.name(&status); if (!status) return; // First handle numeric compound types MFnNumericData::Type type; if (IsNumericCompoundAttribute(attr, type)) { MPlug plug = node.findPlug(attr, &status); if (!status) return; parseNumeric(plug, type); // Mark children as parsed MFnCompoundAttribute fnCompoundAttribute(attr, &status); if (!status) return; unsigned int numChildren = fnCompoundAttribute.numChildren(&status); if (!status) return; for (unsigned int i = 0; i < fnCompoundAttribute.numChildren(); ++i) { MObject child = fnCompoundAttribute.child(i, &status); if (!status) return; MFnAttribute childFnAttr(child); parsedAttributes.insert(childFnAttr.name().asChar()); } } // Other cases else if (attr.hasFn(MFn::kCompoundAttribute)) { parseCompoundAttribute(node, attr, parsedAttributes); } else if (attr.hasFn(MFn::kEnumAttribute)) { parseEnumAttribute(node, attr); } else if (attr.hasFn(MFn::kGenericAttribute)) { // TODO } else if (attr.hasFn(MFn::kLightDataAttribute)) { // TODO } else if (attr.hasFn(MFn::kMatrixAttribute)) { parseMatrixAttribute(node, attr); } else if (attr.hasFn(MFn::kMessageAttribute)) { parseMessageAttribute(node, attr); } else if (attr.hasFn(MFn::kNumericAttribute)) { parseNumericAttribute(node, attr); } else if (attr.hasFn(MFn::kTypedAttribute)) { parseTypedAttribute(node, attr); } else if (attr.hasFn(MFn::kUnitAttribute)) { parseUnitAttribute(node, attr); } }
void EmsMessage::parseInteger(size_t offset, size_t size, EmsValue::Type type, EmsValue::SubType subtype) { parseNumeric(offset, size, 0, type, subtype); }
void EmsMessage::parseWMTemp2Message() { parseNumeric(0, 2, 10, EmsValue::IstTemp, EmsValue::HK1); }
void EmsMessage::parseRCOutdoorTempMessage() { parseNumeric(0, 1, 1, EmsValue::GedaempfteTemp, EmsValue::Aussen); }
void EmsMessage::parseRCHKOpmodeMessage(EmsValue::SubType subtype) { parseEnum(0, EmsValue::HeizArt, subtype); parseNumeric(1, 1, 2, EmsValue::NachtTemp, subtype); parseNumeric(2, 1, 2, EmsValue::TagTemp, subtype); parseNumeric(3, 1, 2, EmsValue::UrlaubTemp, subtype); parseNumeric(4, 1, 2, EmsValue::RaumEinfluss, subtype); parseNumeric(6, 1, 2, EmsValue::RaumOffset, subtype); parseEnum(7, EmsValue::Betriebsart, subtype); parseNumeric(16, 1, 1, EmsValue::MinTemp, subtype); parseNumeric(35, 1, 1, EmsValue::MaxTemp, subtype); parseBool(19, 1, EmsValue::SchaltzeitOptimierung, subtype); parseNumeric(22, 1, 1, EmsValue::SchwelleSommerWinter, subtype); parseNumeric(23, 1, 1, EmsValue::FrostSchutzTemp, subtype); parseEnum(25, EmsValue::RegelungsArt, subtype); parseEnum(28, EmsValue::Frostschutz, subtype); parseEnum(32, EmsValue::HeizSystem, subtype); parseEnum(33, EmsValue::FuehrungsGroesse, subtype); parseNumeric(36, 1, 1, EmsValue::AuslegungsTemp, subtype); parseNumeric(37, 1, 2, EmsValue::RaumUebersteuerTemp, subtype); parseNumeric(38, 1, 1, EmsValue::AbsenkungsAbbruchTemp, subtype); parseNumeric(39, 1, 1, EmsValue::AbsenkungsSchwellenTemp, subtype); parseNumeric(40, 1, 1, EmsValue::UrlaubAbsenkungsSchwellenTemp, subtype); parseEnum(41, EmsValue::UrlaubAbsenkungsArt, subtype); }