smWrite() with timeout fails

mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

smWrite() with timeout fails

Post by mbowdich » Fri Jul 15, 2011 8:36 am

When trying to use smWrite() with timeout, I keep getting a compiler error for no matching signatures. ("1" and "2" are both valid parameters in the following.)

Code: Select all

void $EventName ()
{
	double var1;
	smRead(smGetHandle("1"), var1);
	smWrite(smGetHandle("2"), var1, 10000);
}
Without the timeout, there are no compiler errors:

Code: Select all

double var1;
	smRead(smGetHandle("1"), var1);
	smWrite(smGetHandle("2"), var1);
}
jtabb
Enovation Controls Development
Enovation Controls Development
Posts: 37
Joined: Mon Apr 04, 2011 8:59 am

Re: smWrite() with timeout fails

Post by jtabb » Fri Jul 15, 2011 10:00 am

mbowdich,

This is looks like a deficiency in our documentation.

It appears if you are going to use the time out parameter you must also use the Boolean par mater.

The signature will look like

Code: Select all

smWrite(uint, double, uint, bool)
The Boolean is used to force the value invalid.

In your example you should be able to get this to work:

Code: Select all

void $EventName ()
{
   double var1;
   smRead(smGetHandle("1"), var1);
   smWrite(smGetHandle("2"), var1, 10000, true);
}
jtabb
FW Murphy Development Team
mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

Re: smWrite() with timeout fails

Post by mbowdich » Sat Jul 16, 2011 11:04 am

So, what happens if I put false in the boolean position? Does it not go invalid?
jtabb
Enovation Controls Development
Enovation Controls Development
Posts: 37
Joined: Mon Apr 04, 2011 8:59 am

Re: smWrite() with timeout fails

Post by jtabb » Mon Jul 18, 2011 1:56 pm

Setting it to false would make it invalid every time. I think the intent was too be able to flag a condition that the line will not execute.
jtabb
FW Murphy Development Team