Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.35k stars 287 forks source link

Event listener with multiple different delimiters #483

Closed ctadlock closed 1 year ago

ctadlock commented 1 year ago

From what I can tell there is no way to create an event listener that supports multiple different delimiters. Is that true?

My use case is I have a device that returns XML data, the outer element of that XML is different based on the command that is sent. Its a crap design that I cant control. For example:

I dont see a way to create an event listener for this data as there is not a common delimeter, the length is not fixed, and multiple listeners is not supported (https://github.com/Fazecast/jSerialComm/issues/456).

hedgecrw commented 1 year ago

Unfortunately, that's correct. If you don't have a uniform, pre-defined set of delimiters, there's no way to register a delimited event listener. You will either have to write your own custom listener/parser in application code, or you could register a delimited event listener on "</" and then just parse the response tag by starting from whichever index the first "<" character is located at. Hope that helps!

hedgecrw commented 1 year ago

Closing as "will not fix".