How does this compile without error?
I just noticed this and I am wondering if this was causing me some problems?
The part I just saw is that in the WAIT_UNTIL, I am using the variable passed into the function. As far as I know, you cannot use stack_vars in waits. I think this may be causing me some issues, and I obviously meant to store the value in a global variable (nDevBeingRegistered), but I missed it. I am just surprised that the compiler didn't flip out.
Jeff
define_function fnDoDevRegister(integer nDevIndex){
if(nDevIndex and (nDevIndex <= MAX_NUM_DEVS)){
if(fnConnect()){
if(!nProcID){
fnDoProcRegister();
}
wait_until(nProcID){
nWaitingForResponse = 2;
nDevBeingRegistered = nDevIndex;
wait_until(bConnected){
bConnected = 0;
SEND_STRING dvDevice, "'GET /webpage?X=',itoa(nProcID),
'&D=',itoa(uDevData[nDevIndex].nDevNum),
'&P=',itoa(uDevData[nDevIndex].nPortNum),
'&S=',itoa(uDevData[nDevIndex].nSysNum),
'&N=New',
'&PC=',fnGetPC(),' HTTP/1.1',$0d,$0a"
SEND_STRING dvDevice, "'Host: ',sServerAddress,$0d,$0a"
SEND_STRING dvDevice, "'Authorization: Basic',$0d,$0a"
SEND_STRING dvDevice, "$0d,$0a"
}
}
}
}else{
send_string 0,"'Invalid Device ID provided to Register Device'";
}
}
The part I just saw is that in the WAIT_UNTIL, I am using the variable passed into the function. As far as I know, you cannot use stack_vars in waits. I think this may be causing me some issues, and I obviously meant to store the value in a global variable (nDevBeingRegistered), but I missed it. I am just surprised that the compiler didn't flip out.
Jeff