"COM1" or "COM USB".
onConnect – Initialize state upon connection (a network connection established or protocol stack starts on serial
o
connection). If the method is not implemented an error occurs. The method has one argument and a return value:
peerName – The peer name of the connection. The peer name for a network connection is "<PEER_
l
IP>:<PORT>". An example peer name for a Telnet connection is "10.82.80.71:19772", for a "Network
Client" connection it is "10.82.80.71:1000", where the host port is configured to 1000. The peer name for
the serial connection is "COM1" or "COM USB".
return – The boolean return value defines if the handler for this connection should be activated:
l
true: Enables customization of the communication protocol. Therefore, if you want to use your own
n
protocol for communicating with the Dataman device, return true.
false: If you do not need the customized protocol for this peer, return false.
n
onDisconnect – Cleanup method called when closing the connection channel
o
onExpectedData – Method called if data matching the set properties has arrived. The method has one argument:
o
inputString – The received frame matched data excluding header and termination
l
return – Determines if the data should be removed from input buffer
l
true: clear the buffer.
n
false: keep the value in buffer.
n
onTimer – The timer value expired
o
onUnexpectedData – The recieved data is not matching the requirements. The boolean return value determines
o
if the data should be removed from input. The method has one argument:
inputString – The received data
l
return – Determines if the data should be removed from input buffer
l
true: clear the buffer.
n
false: keep the value in buffer.
n
onError – An error occurred in the firmware and can be reported. The implementation of the method is
o
mandatory. The method has one argument and no return value:
errorMsg – The error message for trigger overruns ("Trigger Overrun"), buffer overruns ("Buffer Overflow")
l
and general errors reported by the firmware.
onEncoder – Executed if a configured encoder distance is reached. The distance can be configured by the
o
setEncoder method. The method has no arguments or return value.
send – Send data to channel, returns the number of send characters. The method must be called with one
o
argument:
Data argument is a string
l
close – Actively terminates connection for the communication object (for example, close TCP/IP socket). On
o
UART, this causes onConnect to be called right afterwards.
setTimer – Set the one-shot timer value when the onTimer will be executed. The timer can be re-initialized and
o
aborted.
Timeout in seconds of type double, internal resolution is us (1e-6 sec). A zero value aborts a running
l
timer. Active timer will be overwritten.
DataMan Application Development
54
Need help?
Do you have a question about the DataMan and is the answer not in the manual?