Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing multi outputs with a waitlist 1

Status
Not open for further replies.

majpooper

Technical User
Feb 5, 2005
17
US
REF: thread448-659646

waitlist for multi waitfors works great as far it goes but it is based on the concept that you are trying to capture only one of several possibal outputs.

However the challange I have is that I need to capture one or MORE of six or seven possibal outputs.

It was no problem increasing the waitlist to seven. The WaitListStat though gets set to the first expected output it finds. Any other expected outputs are then not captured.

What I have done is run the the waitlist three times looking
for the outputs in sets (without going into detail some of the outputs will not come in together or if you get one then you don't need to look for another)so this is awkward and clunky but works - kind of.

What I would like to do (and speed things up a lot) is run the command once. Do a waitlist that indicate all of the seven outputs found rather than simply the first one found.
 
I think this could be doable with a little tinkering. First, you would need to remove all of the when target clear commands from the different procedures that could be called by the main WaitList procedure, except for the string that you just found. In other words, you would need to remove when target 0 clear from the WaitListS1 procedure and so on.

Second, remove the if WaitListStat structure from the main procedure so the procedure doesn't return after one string you are looking for has been received.

The final thing you would need to do would be to create a way to determine which of the multiple possible strings were received. One way to do this if you are familiar with binary flags is to assign each possible string a power of 2, such that if the first string is found you add 1 to the current value of WaitListState, second string adds two, third strings adds four, and so on. You could then demultiplex that at the calling end to determine which of the various strings would have been received. Since no string should be counted twice, this should work but will be a bit messy. Another alternative is to have a global variable for each possible string and set that value to 1 when the appropriate string is received, then check the values of each global variable when the WaitList procedure has timed out.

 
Knob - you are a genius !!!!! that worked

THX much !!!
 
Sorry for the late answer - multiple global variables - mainly because that is what I could understand vs binary which I do not understand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top