o
expectFramed – Tells the communication listener which data to pass on to the onExpectedData and
onUnexpectedData methods. It is possible to change the match parameter at runtime. The following three
arguments are required:
n header of type string, can be empty (””)
n terminator of type string, can be empty (””)
n max length of type integer, specifies the maximum length of an input message to check for a match
[required]
o
setEncoder – Units of the distance argument are millimetres. The encoder is configured in Setup Tool under
System Settings -> Pulse Encoder. If encoder ticks should be used instead of distance set the value of the
parameter “Resolution (mm)” to 1.
n distance (double) – The encoder distance in which the onEncoder method will be called.
The methods must be implemented in the public section of the object.
Examples
API usage of custom communication protocol object
This example below demonstrates the API usage of the custom communication protocol object. The example implements
custom commands read from the connection. The commands are framed by a ”#” header and terminated by ”;\r” (for
example, a serial PuTTY connection). A timer periodically sends timer messages. Use the custom stop command to stop
them. You can change the timer handler once by the switch command.
55
DataMan Application Development