Customizing the interface
A customization of the interface is possible through a API (application programming interface). The API is based on the scripting language lua.org. If LUA is already installed on the system the system parameters are extended within SXMLIF by the following:
- The default of package cpath is extended by
- The default package path is extended by
The name of the script has to exactly match the name of the XMLinterface process in SIHOT; e.g. if the name of process is “SXMLIF2”, the name of the Lua script has to be “sxmlif2.lua”.
The extension file must be located under:
Concerning the purpose of the extension the Lua script has to implement whether the public function send or receive. The function send is called by the interface every time prior sending information to an external system. The function receive is called every time information was send to the interface. Both functions are called with the XML string as parameter and have to implement two return values. The first value is the XML string that should be used for further operations in the interface; the second value is a boolean value that tells the interface if the XML string still need to be processed by the interface. The complete stucture of the lua extension is shown below.
-- This function is invoked, when the interface is shutdown function shutdown() return "", true end -- This function is invoked prior processing with the data received function receive(data) -- return true if the data is still to be processed -- return false if the data should not be processed return daten, true end -- This function is periodically before the OC:LA is being sent function alive(data) return data, true end -- This function is invoked prior sending with the data to be sent function send(data) -- return true if the data is still to be sent -- return false if the data should not be sent return data, true end
Structure of the lua extension
The simplest implementation of the send-function is shown below. The script file just receives the data, transfers nothing back and tells the following code to not send anything.
function send( data ) return "", false end