DATA.TEXT Parsing Best Practise Question
hodeyp
Posts: 104
Hi,
I have an AV processor that sends feedback by rs232. The messages are terminated with 0x0D. However, the messages can be several hundred characters in length and it is possible that the 0x0D is actually embedded in the message for a different reason than termination of the whole message.
So, I need to be able to look for the termination character and also asses do I have the complete message.
Any guides as to best way to handle this?
Apologies if this is a bit vague!
I have an AV processor that sends feedback by rs232. The messages are terminated with 0x0D. However, the messages can be several hundred characters in length and it is possible that the 0x0D is actually embedded in the message for a different reason than termination of the whole message.
So, I need to be able to look for the termination character and also asses do I have the complete message.
Any guides as to best way to handle this?
Apologies if this is a bit vague!
0
Comments
You can use data.text or create_buffer. There's really no significant advantage between them on the grand scale. However, the subtle differences can be better for some situations. Data.text is limited to 2K in size. You can go in and tweak that but I typically don't.
You could try many methods to trap the. $0D. One simple way would be to put the messages in a que. That will slow things down a bit and allow the gear to finish it's message.
another thing to do is append all messages to another buffer and keep parsing it until it's empty. That way you kinda move the 'finding the $0D out of the data_even.
--John
In a lot of cases, the expected string actually is received in one part from serial devices. But if receiving string by IP, in most cases it is not.
If you expect a string from a native NetLinx device (keypad input from a panel, a string response from a moduile's virtual device, etc.) you alway can work directly with DATA.TEXT, because they always come in one part.