diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 2dfac84..b262600 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -195,7 +195,21 @@ void DCCEXParser::parse(const FSH * cmd) { // See documentation on DCC class for info on this section -void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream) +void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) { + // This function can get stings of the form "" or "C OMM AND" + // found is true first after the leading "<" has been passed + bool found = (com[0] != '<'); + for (byte *c=com; c[0] != '\0'; c++) { + if (found) { + parseOne(stream, c, ringStream); + found=false; + } + if (c[0] == '<') + found = true; + } +} + +void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) { #ifndef DISABLE_EEPROM (void)EEPROM; // tell compiler not to warn this is unused diff --git a/DCCEXParser.h b/DCCEXParser.h index d9fe0e1..797eab0 100644 --- a/DCCEXParser.h +++ b/DCCEXParser.h @@ -33,6 +33,7 @@ struct DCCEXParser static void parse(Print * stream, byte * command, RingStream * ringStream); static void parse(const FSH * cmd); + static void parseOne(Print * stream, byte * command, RingStream * ringStream); static void setFilter(FILTER_CALLBACK filter); static void setRMFTFilter(FILTER_CALLBACK filter); static void setAtCommandCallback(AT_COMMAND_CALLBACK filter);