News:

  • August 31, 2026, 06:54:34 PM

Login with username, password and session length

Author Topic: StreamIn data format  (Read 31656 times)

sgsims

  • Hero Member
  • *****
  • Posts: 127
Re: StreamIn data format
« Reply #15 on: April 17, 2024, 11:39:07 PM »
Is there a way to see the message payload into the Queue if my StreamIn instruction is throwing an error bit? 

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: StreamIn data format
« Reply #16 on: April 26, 2024, 03:08:10 PM »
Is there a way to see the message payload into the Queue if my StreamIn instruction is throwing an error bit?
Currently, no. However, just about the only thing I can think of that can cause the STREAMIN error, is a timeout. This would mean that you have the parameter, "Network Timeout" checked in the instruction, and that time is reached before the "Complete when..." requirements are met. In other words, you enable the STREAMIN instruction and the timeout starts. You, let's say, have the instruction configured to complete when 10 bytes are received, but you only receive 8. Then the timeout will happen and an error will occur. Or you have the instruction configured to complete when it gets its delimiters of CR, LF, and you never get those characters. Then the timeout will happen and an error will occur.

This is why I recommended never executing the STREAMIN until there is data in the .InQueue structure member (i.e. > 0).

Someone can correct me if I'm wrong, but that's about the only thing I've seen as far as the STREAMIN throwing an error... it's a timeout.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

sgsims

  • Hero Member
  • *****
  • Posts: 127
Re: StreamIn data format
« Reply #17 on: April 26, 2024, 03:51:15 PM »
Thanks Greg...I think that is what is happening in my case I have a timeout specified and the instruction to complete when either of 2 delimiters are received.  I do have logic in place that enables the Streamin instruction upon seeing data in the queue....so pretty sure something is getting intop the queue.  My suspision is that the bit pattern they are sending to represent the delimiter is not correct so the instruction is hanging until the tiemout limit is reached.

Another question....when / how is the queue cleared?  if data goes into the queue does it stay until the streamin instruction completes with either a succes or failure?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: StreamIn data format
« Reply #18 on: April 26, 2024, 03:58:52 PM »
Another question....when / how is the queue cleared?
Make sure you have FLUSH INPUT DEVICE checkbox CHECKED in the STREAMOUT instruction

Quote
  if data goes into the queue does it stay until the streamin instruction completes with either a succes or failure?

Yes.  This is why you should FLUSH it just in case there are any "old" characters in there from the last time.

sgsims

  • Hero Member
  • *****
  • Posts: 127
Re: StreamIn data format
« Reply #19 on: April 26, 2024, 04:09:47 PM »
Guess I need to readup on the queue particulars ..sounds like the same queue is used for out going and incoming data

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: StreamIn data format
« Reply #20 on: April 26, 2024, 04:30:31 PM »
Is there a way to see the message payload into the Queue if my StreamIn instruction is throwing an error bit?

I was playing with this a little, and what I did was send 10 bytes to my BRX built-in port, including a carriage return & linefeed. Then for my STREAMIN, I configured it to just retrieve 1 byte with no delimiters. That allowed me, through multiple execution of the same STREAMIN instruction, to get 1 byte at a time out of the input queue. In this manner I could see exactly what was transmitted.

You could do the same and you could see exactly what your program is sending to your SERIO port.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: StreamIn data format
« Reply #21 on: April 26, 2024, 04:34:42 PM »
Here is what I mean...

Pay no attention to the name, "TCP_ex"... you would use the name of your Device instead, of course.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

sgsims

  • Hero Member
  • *****
  • Posts: 127
Re: StreamIn data format
« Reply #22 on: April 26, 2024, 04:43:26 PM »
Got it..so I just connect a serial cable from one port on the BRX to a 2nd port on the same BRX and send messages back and forth?  Genius