0 ceterm script events – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual
Page 82

4.0 CETerm Script Events
This section describes the script events within the CETerm script engine. These
events provide ways to trigger event handlers when various conditions occur in
CETerm. The event handlers are arbitrary scripts.
The event model in CETerm uses specific event handler names to bind events to
handlers. If the event handler function (e.g., “OnBarcodeRead”) is defined in the
script engine, it will be executed when the event occurs. There is no special
command required to register or bind the function to the event. Event handlers
can be re-defined at any time. If the handler is no longer needed, the function
can be re-defined as empty.
Events play a very important role for scripting in CETerm. Just as in the standard
web browser, a script cannot run continuously, or it will prevent user interaction
and other program actions. The script engine acts like a
“virtual user”. When a
script is executing, CETerm will seem unresponsive. Typically, a script will do a
little bit of work and then exit. This way, CETerm is always ready to respond to
the user or host actions. Events and timers are used to start or re-start a script to
do the next bit of work.
The “expect” script described in Section 2.6 is a good example of using a timer to
automate multiple steps. The events described in this section are the second
major technique for running a script to satisfy a condition.
Event
Fired when…
OnBarcodeRead
Barcode read.
OnDocumentDone
New web page loads.
OnIBMCommand
Receives special command in IBM data stream.
OnKeyboardStateChange Keyboard state changes in TE session.
OnNavigateError
Web navigation fails.
OnNavigateRequest
Web navigation begins.
OnNetCheckFailed
Fails to complete network check to host.
OnProgramExit
CETerm exits.
OnProgramStart
CETerm first starts.
OnSerialPortEvent
Serial port status changes.
OnSessionConnect
Session connects to host.
OnSessionDisconnect
User disconnects session from host.
OnSessionDisconnected
Session disconnected by host.
OnSessionReceive
TE session receives data from host.
OnSessionSwitch
Active session changes.
OnStylusDown
Stylus tap on screen.
OnTriggerEvent
Hardware trigger status changes.
OnVTCommand
Receives special command in VT data stream.
OnWakeup
Device resumes after a suspend.