I’ll be using an Arduino to control a third party audio DSP via a Telnet session… i.e. DSP is the Telnet Server, Arduino is client.
Got the telnet part working in a basic live Serial.read() & Serial.print() functionality, so I’m not too worried about that part.
Where I am worried is when it comes to parsing the serial responses received from the Telnet server.
I don’t have any control of the format of the messages coming back on the server…here’s what they look like:
valueIs “controlname” -20.0dB 0.80
valueIs - all of the lines I care about will begin with this
“controlname” - the name of the control I’m dealing with, i.e. “volume” or “mute”. It is always inside double quotes, which is where I’m mostly getting hung up I think.
-20.0dB - the current value of the control. I will ultimately need to strip off the trailing dB but I’m not thinking about that right now. Depending on the control type, this could also return as a boolean true / false.
0.80 - the current physical position of the control. I don’t really care about this right now.
So, the messages are always made of four elements separated by spaces, and the control name is always wrapped in " ".
Being a relative Arduino newbie, for the past couple of days I’ve (foolishly?) been wrapping my head around regex, and finally worked out a statement that would give me the two values I want (which really made my day):
only to realize that the Arduino doesn’t support a standard version of regex… Is that true?
Then I played a bit with the library I found here :
but it doesn’t seem to be able to handle the double quotes surrounding the “controlname” that will be in my incoming string.
Ultimately I guess I’d like a string array containing the control name in index 0 and the value in index 1.
I’d also like it to be agnostic to the actual control name, to allow this code to be used easily when / if control names change.
Perhaps I’m totally overlooking a really easy way to handle this?
Pleases set me straight if it’s needed.
Thanks for reading this far.