Create_Buffer question
jcerecke
Posts: 40
Hey,
So I'm interfacing with a Lifesize Room 220 via RS-232. It likes sending lots and lots of strings to me when calls are happening, and all the strings I'm thinking go into a buffer. But how do most people prefer to handle large volumes of strings? I'm thinking:
Or else you could:
Just curious. Am I being a worrywort about missing some strings? Are the chances that two come in on top of one another really big enough to care about?
So I'm interfacing with a Lifesize Room 220 via RS-232. It likes sending lots and lots of strings to me when calls are happening, and all the strings I'm thinking go into a buffer. But how do most people prefer to handle large volumes of strings? I'm thinking:
Data_Event { String: { //do stuff with the buffer in here } }But then what if two strings come in close to each other? The next string will get tacked onto the end of the buffer but I'll never know about it?
Or else you could:
Define_Program { IF (length_array(sbuffer)>0) { //do stuff with the buffer in here } }
Just curious. Am I being a worrywort about missing some strings? Are the chances that two come in on top of one another really big enough to care about?
0
Comments
It starts a new line with "$0D,$0A"
It ends a string with "'ok,00',$0D,$0A"
Definitely this method.
Each time a string comes in it will be appended to DATA.TEXT which you can then troll through and rip out what you need and throw away the rest.
Cheers
Mush
Or alternatively, if you're wanting all lines and not just what I presume are ACK's:
Definately not. Things can get dodgy real quickly if you start missing data. For the control system it's the equivalent of walking into a conversation half way through - as soon as it starts talking it'll make an *** of itself.
Jeff
That works as well.
You mean this type of arrangement?:
while buffer is longer than ''
{
parse buffer up until the next ACK
}
Next question is this:
Lets say a string comes in, string event fires and during the while loop, a second string comes in. Will a second string event fire?
The while loop from the first string event will parse the second string (and remove it from buffer) and the second string event will try and start a while loop which will immediately break? Not that this will cause any problems.
Thanks for the help thus far!
Here's a couple of exmples:
I may be misremembering, but I think that only applies to Axcess. In NetLinx there is no distinction between WHILEs and LONG_WHILEs. NetLinx is also only single-threaded. When a WHILE is executing, nothing else is happening or being processed. As result, I tend to make sure I only use them when I know it's going to be a very short time period. I had to port an involved math function that used a while to iterate through some very small increments, and it pretty much locked up the master while it was running. I had to sacrifice most of the resolution of the function to make it usable at all, and even then there was a noticeable hiccup in the processor when it ran.