Hi Dojo,
When doing simple math for a parameter, is it a good practice just to use the below syntax?
<Interprete>
<RawType>numeric text</RawType>
<Type>double</Type>
<LengthType>next param</LengthType>
<Sequence noset="true">factor:[id:150];div:1000</Sequence>
</Interprete>
Or QAction is a better way to go?
Regards,
Hi,
If the raw parameter value is directly coming in through polling (snmp, serial) and the value can be adapted with a Sequence then it is best practice to use that.
The benefits compared to using a QAction in this case are:
- Only 1 parameter is needed, vs 2 (one that would be containing the raw polled value and one that would be containing the calculated value).
- Faster processing, everything stays in SLProtocol. Else a QAction needs to be started in SLScripting, it needs to perform an inter-processes call between SLScripting and SLProtocol to get the value and another call to set the value. At first startup the QAction dll also needs to be compiled.
- Less developer work: not needing to create the 2nd parameter, not needing to write the QAction.
The benefits of using a QAction is that more complex calculations can be done and it is easier to debug if needed, but if the calculation is simple and can be done with a Sequence then I would go for the Sequence possibility.
Hi Laurens,
Thank you for the insights.
Regards,