### Multi-Spindle Configuration Example Table Source: https://haller-erne.github.io/ogs/tools/openprotocol/sys350-ke350 This table illustrates how to configure multiple fastening operations (FO start) in OGS, each with unique group names (e.g., GRP1_A, GRP1_B, GRP1_C) and sequence numbers for dual-spindle applications. ```text Application start | OGS Task | appl_start | Group | Sequence ---|---|---|---|--- FO start #1 | S1 | GRP1_A1 | GRP1_A | 1 S2 | GRP1_A2 | | 2 FO start #2 | S3 | GRP1_B1 | GRP1_B | 1 S4 | GRP1_B2 | | 2 FO start #3 | S5 | GRP1_C1 | GRP1_C | 1 S6 | GRP1_C2 | | 2 ``` -------------------------------- ### Example Web Request Handler (LUA) Source: https://haller-erne.github.io/ogs/v3/lua/webserver Provides an example of a LUA handler function for the OGS web server. This function processes incoming requests and can return nil if it doesn't handle the request, or a response object. ```LUA local function handlerfn(reqpath, reqparams, verb, body) -- process the request, return the response object (or nil -- if this request is not handled) return nil end -- Register a LUA function to be called whenever a web request to /api/lua -- is made Browser.RegMsgHandler('/api/lua', handlerfn) ``` -------------------------------- ### Load Tool Tracking Support in OGS Setup Source: https://haller-erne.github.io/ogs/tools/positioning/positioning-art-dtrack This code snippet indicates the initial setup step for integrating ART-DTrack positioning into an OGS project. It involves loading the tool tracking support module within the 'config.lua' file. ```lua Load the tool tracking support in `config.lua` ``` -------------------------------- ### AIOI Pick2Light Color Configuration Examples Source: https://haller-erne.github.io/ogs/tools/misc/aioi-pick2light Provides examples of how to configure the 'farbe' (color) property for the AIOI Pick2Light tool, demonstrating the use of predefined color names and custom flag combinations for LED colors and blinking patterns. ```INI ; Red = 2 (on), Green = 1 (off), Blue = 1 (off): LED set to steady red color. ; 211: Red = 2 (on), Green = 1 (off), Blue = 1 (off): LED set to steady red color. ; 311: Red = 3 (blink), Green = 1 (off), Blue = 1 (off): LED set to red blinking ; 441: Red = 4 (fast blink), Green = 4 (fast blink), Blue = 1 (off): LED set for fast yellow (red+green) blinking ``` -------------------------------- ### OpenProtocol Tool Configuration Example Source: https://haller-erne.github.io/ogs/tools/openprotocol Provides a sample configuration for an OpenProtocol tool (channel 01) in the station.ini file. It demonstrates how to set shared parameters like PORT and channel-specific parameters such as IP address, tool type, and various settings. ```INI [OPENPROTO] # Shared/default parameters PORT=4545 # Channel/Tool 1 parameters CHANNEL_01=10.10.2.163 CHANNEL_01_TYPE=NEXO CHANNEL_01_CHECK_TIME_ENABLED=1 CHANNEL_01_CURVE_REQUEST=1 ``` -------------------------------- ### Configure OGS Webserver for Teach-in UI Source: https://haller-erne.github.io/ogs/tools/positioning/positioning-art-dtrack This outlines the final step in the initial OGS system setup for ART-DTrack integration. It involves configuring the OGS webserver and adding the necessary HTML pages to support the teach-in user interface. ```text Configure the OGS webserver and add the html pages to support the sidepanel teach-in ui to the project ``` -------------------------------- ### Configure Tracking Parameters in OGS Station Setup Source: https://haller-erne.github.io/ogs/tools/positioning/positioning-art-dtrack This describes a configuration step for OGS projects using ART-DTrack positioning. It involves setting up tracking parameters, tool mapping, and body mapping within the 'station.ini' file. ```ini Configure the tracking parameters and tool, body, etc. mapping in `station.ini` ``` -------------------------------- ### Execute Report with locate.exe Source: https://haller-erne.github.io/ogs/dataoutput/printout Demonstrates the command-line syntax for executing reports using `locate.exe`. It includes examples of specifying database files, serial numbers, report forms, display options, and output files or printers. ```Batch @rem Generate a pdf report and show it. Use INT_VAR1=12345 and STR_VAR2=YES locate.exe [db=station.fds][sn=123456][form=label.fr3][show=YES][INT_VAR1=12345][STR_VAR2=YES][output=C:\\tmp\\mumu.pdf] ``` ```Batch @rem Print the same report on printer KYOCERA FS1900. Use INT_VAR1=12345 and STR_VAR2=YES locate.exe [db=station.fds][sn=123456][form=label.fr3][show=YES][INT_VAR1=12345][STR_VAR2=YES][output=KYOCERA FS1900] ``` -------------------------------- ### Configure Tool for Loosening without CCW_ACK Source: https://haller-erne.github.io/ogs/tools/openprotocol If CCW_ACK is not used (set to 0), tools with internal loosen programs should be configured to prevent starting when the direction switch is CCW and the start switch is pressed. An on-tool NOK acknowledge should be configured as an alternative. ```Configuration CHANNEL__CCW_ACK = 0 Configure tool to prevent start if direction switch is CCW and start switch is pressed. Configure on-tool NOK acknowledge. ``` -------------------------------- ### LUA BLE Scan Start and Stop Source: https://haller-erne.github.io/ogs/v3/lua/bluetooth-le This LUA code demonstrates how to interact with the OGS runtime's BLE interface. It includes functions to start scanning for BLE advertisement frames with optional filtering and a callback, and to stop an ongoing scan. The callback receives decoded BTHome data or raw advertisement information. ```lua --[[@class BleBtHomeData ---@field flags integer BTHome flags 0x40 = cyclic bthome, 0x44 = trigger bthome ---@field seq integer Sequence number (to detect multiple frames, e. g. increments once per button press) ---@field battery integer Battery level (0-100) ---@field action integer Action code (0 = none, 1 = click, 2 = doubleclick, ...) ---@field button string decoded action ('press', 'double_press', ...) --]] --[[@class BleAdvertismentData ---@field id string Unique MAC address of the BLE device ---@field service integer 16-Bit service id (32/128-bit IDs are only provided in the response data) ---@field name string Local device name (if provided, else empty string) ---@field rssi integer The RSSI level ---@field response table The actual advertisment data as key/value (binary string) data ---@field bthome BleBtHomeData|nil If the device is a bthome device, then decoded data here --]] -- This is what is typically received ---@type BleAdvertismentData local sample = { id = '7CC6B6653AA9', service = 0xFCD2, name = '', rssi = -55, response = { [22] = '', [1] = '' }, bthome = { flags = 0x44, battery = 100, seq = 3, action = 1, button = 'press' } } ``` ```lua local cbFn = nil local myDeviceId = '' -- Callback function, when a BLE advertisment is received local function onScan() end onScan = function(tbl) if tbl == nil then -- scan finished, restart scanning ble.scan_start(cbFn, 0xFCD2) else XTRACE(16, "scan device found: id="..(tbl.id or '')) if tbl.id == myDeviceId then -- this is our key! local bthome = tbl.bthome if cbFn then cbFn(tbl) end ble.scan_stop() end end end -- Call this function to start scanning, until an advertisment -- for the given device-id and the service 0xFCD2 is received, -- If a matching response is received, the callback function -- provided in the parameter will be called and the scan will stop. function Scan(deviceId, callback) -- store the callback function locally cbFn = callback -- keep the device id myDeviceId = deviceId -- start (asynchronously) scanning for btHome devices (service UUID = 0xFCD2) ble.scan_start(cbFn, 0xFCD2) end ``` -------------------------------- ### Enumerate HID Devices in Lua Source: https://haller-erne.github.io/ogs/libs/lua-hid This example demonstrates how to load the LuaHID module, initialize the library, enumerate connected HID devices, print their properties (path, VID, PID, serial number), and then shut down the library. ```Lua local hidapi = require('luahid') print(string.format("Lib VERSION %s build on %s", hid._VERSION, hid._TIMESTAMP)) -- Initialize the library if hidapi.init() then print("hid library: init") else print("hid library: init error") return end -- Enumerate the currently connected devices and print some information local enum = hidapi.enumerate() if not enum then print("Enumeration: no device found or enumeration failed!") return else while true do local dev = enum:next() if not dev then break end print("Device found:") print(string.format("path = '%s'", dev.path)) print(string.format("vid = 0x%04X", dev.vid)) print(string.format("pid = 0x%04X", dev.pid)) print(string.format("serial_number = '%s'", dev.serial_number)) end end end -- Do a clean shutdown if hidapi.exit() then print("hid library: exit") else print("hid library: exit error") return end ``` -------------------------------- ### Configure Event Logging in station.ini Source: https://haller-erne.github.io/ogs/dataoutput/eventlog This configuration example for `station.ini` demonstrates how to set the local and target directories for storing event log files using the `[EVENT_LOG]` section. ```INI [EVENT_LOG] ; Set local directory for (temporarily) storing log files DIRECTORY=C:\\OGS_Log ;; Set target directory for storing the logfiles TARGET_DIR=\\myserver\share$\\OGS\LOG-Files\station-01 ``` -------------------------------- ### Implement Custom Lua Tool Driver Source: https://haller-erne.github.io/ogs/v3/lua/customtools Provides a complete example of a custom Lua tool driver, including initialization, execution logic, and registration with the OGS system. It demonstrates how to access configuration, process tool data, and respond to OGS events. ```Lua -- My custom LUA tool driver local _M = { type = 'MyCustomTool', -- type id (must match the DRIVER= in INI file) } local helpers = require('lua_tool_helpers') ------------------------------------------------------------- -- Tool event: Initialize tool - called once during OGS init -- return 'OK' or some error text if the initialization failes. function _M.init(channel) -- Decode/get my configuration (from station.ini) local cfg = { ComPort = channel.ini_params.COM_PORT, -- COM port } -- Do whatever is needed to initialize your driver -- ... channel.cfg = cfg -- store the channels config data return 'OK' -- init successfully done end ---------------------------------------------------------------------------- -- Tool event: Cyclically called while the tool is enabled -- return the tool task state function _M.execute(channel) -- Check for tool finished local ResultData = _M.GetResultData() -- must be implemented! if ResultData == nil then -- no data available from the tool return channel.task_state -- wait more. end if ResultData.Error then -- some error occurred return lua_task_fault -- return an error code end if ResultData.Data then -- received data -- Build a result data table and notify the OGS core local values = { ResultData.torque, -- M1 actual value ResultData.angle, -- M2 actual value ResultData.t_min, -- M1 min ResultData.t_max, -- M1 max 0.0, -- M2 min 0.0 -- M2 max } local error_code = helpers.get_code_from_limits(ResultData.torque, ResultData.t_min, ResultData.t_max) lua_tool_result_response(channel.tool, error_code, 0, '2A', values) return lua_task_completed end return channel.task_state -- wait more. end ------------------------------------------------------------- -- Tool event: Called whenever the tool is to be enabled -- @ output: true|false - tool enabled/not enabled -- (will be called again until enabled!) function _M.enable(channel) local cfg = channel.cfg -- access the channel config data -- Do whatever is needed return true -- tool is enabled end ------------------------------------------------------------- -- register this tool with OGS (heLuaTool.dll) helpers.register_tool(_M) -- return the module return _M ``` -------------------------------- ### DIGITAL Driver LUA Glue Code Example Source: https://haller-erne.github.io/ogs/tools/positioning Demonstrates the LUA glue code needed for the DIGITAL driver to generate the 'Inpos' signal, typically by reading I/O values from a field bus, and then calling the driver's UpdatePos_InPos() function. ```LUA -- Example LUA glue code for DIGITAL driver -- Replace with actual I/O reading and 'Inpos' signal generation local io_value = read_io_from_fieldbus() local inpos_signal = generate_inpos_signal(io_value) -- Assuming UpdatePos_InPos(inpos_signal) UpdatePos_InPos(inpos_signal) ``` -------------------------------- ### JavaScript Callbacks and Communication - JavaScript Source: https://haller-erne.github.io/ogs/v3/lua/webbrowser Demonstrates how to set up the `OGS` object in JavaScript to receive messages from Lua and send messages back. Includes an `onInit` callback for initial setup and a `myFunction` that is called from Lua, processes parameters, and sends a response back to Lua using `OGS.SendCmd`. ```JavaScript ``` -------------------------------- ### VSCode Debugging Configuration for OGS Source: https://haller-erne.github.io/ogs/appnotes/debugging This JSON configuration file is used by VSCode to launch the OGS debugger. It specifies the program to run, arguments, script roots, and debugging options. Ensure `` is replaced with your OGS installation path. ```json { "version": "0.2.0", "configurations": [ { "name": "OGS (local lua debugger)", "type": "lua-local", "request": "launch", "program": { "command": "/monitor.exe", "communication": "stdio" }, "args": [ ], "scriptRoots": [ "", "/lualibs", ], "stopOnEntry": true, "pullBreakpointsSupport": true, "cwd": "", "verbose": false, "integratedTerminal": true } ] } ``` -------------------------------- ### Configure Traceability Data Output for GWK Tools in station.ini Source: https://haller-erne.github.io/ogs/tools/openprotocol/gwk This configuration example demonstrates how to set up the `[FTP_CLIENT]` section in `station.ini` for sending traceability data from GWK tools. It includes enabling the client and defining channel-specific information like ChannelName and location name. ```INI [FTP_CLIENT] Enabled=1 ;... ; (more settings) ;... ; Parameters for each channel: CHANNEL_06_INFO={ "ChannelName": "WS010|AC_PF6000", "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } ``` -------------------------------- ### IO Driver LUA Glue Code Example Source: https://haller-erne.github.io/ogs/tools/positioning Illustrates the LUA glue code required for the IO driver to read sensor values and forward them to the driver using UpdatePos_RotIncLenInc() or UpdatePos_RotIncLenAbs(). The IO driver handles internal coordinate transforms and calculations. ```LUA -- Example LUA glue code for IO driver -- Replace with actual sensor reading and forwarding logic local sensor_value_rot = read_rotation_sensor() local sensor_value_dist = read_distance_sensor() -- Assuming UpdatePos_RotIncLenInc(rotation, distance) UpdatePos_RotIncLenInc(sensor_value_rot, sensor_value_dist) -- Or assuming UpdatePos_RotIncLenAbs(rotation, distance) -- UpdatePos_RotIncLenAbs(sensor_value_rot, sensor_value_dist) ``` -------------------------------- ### Configure CCW_ACK for Spindle Tools Source: https://haller-erne.github.io/ogs/tools/openprotocol/sys350-ke350 This snippet explains how to configure the CHANNEL__CCW_ACK setting in station.ini for spindle tools. The setting depends on whether separate CW/CCW start signals are used or only CW start and CCW start signals. ```INI ; If you use a spindle tool with seperately wired CW/CCW and start signals, ; then set CHANNEL__CCW_ACK=1 and connect the direction switch output to the CCWSel-Signal CHANNEL__CCW_ACK=1 ; If you use a spindle tool with only CW start and CCW start signals, then set CHANNEL__CCW_ACK=0, ; but make sure to configure the FO 1 CCWLock signal CHANNEL__CCW_ACK=0 ``` -------------------------------- ### Execute Blocking GET Request Source: https://haller-erne.github.io/ogs/libs/lua-net Executes a blocking GET request to a specified URL. It handles authentication via username/password or OAuth2 token. Returns response data, status, and status text. A status code of 200 is considered valid. ```string get(url: string, user: string = nil, pass: string = nil) ``` -------------------------------- ### Configure OGS Traceability with FTP Client Source: https://haller-erne.github.io/ogs/dataoutput/traceability This configuration snippet shows how to enable and set up the Traceability feature using an FTP client in the `station.ini` file. It includes parameters for enabling the feature, reporting skipped operations, FTP server details, authentication, target folder, local directory, and channel-specific information for data reporting. ```INI [FTP_CLIENT] ; Set ENABLED=1 to enable traceability data output ENABLED=1 ; Set ReportSkippedOperations=1, if you want to see operators skip actions ; in the traceability data output, else set to =0 ReportSkippedOperations=1 ; Define the targets FTP (Sys3xxGateway) server IP-Address and port HostIP=10.80.59.252 HostPort=21 ; In case of Sys3xxGateway(Qtrans) as FTP server use "Username=sys3xx" and ; "Password=sys3xx". TargetFolderOnHost is not needed (ignored) then. Username=sys3xx Password=sys3xx ; In case of standard FTP Server the "TargetFolderOnHost" parameter must ; be set TargetFolderOnHost= ; Temporary folder for storing result data files on local machine DIRECTORY=C:\\Bosch Rexroth AG\\tempData ; Channel info in JSON format CHANNEL_99_INFO={ "IP": "", "ChannelName": "WS010|CHANNEL_INFO", "tool serial": 123456, "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } CHANNEL_01_INFO={ "IP": "10.80.59.231", "ChannelName": "WS010|AC_PF6000", "tool serial": "B5780438", "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } CHANNEL_15_INFO={ "IP": "10.80.59.141", "ChannelName": "WS010|SIM", "tool serial": 0, "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } CHANNEL_27_INFO={ "IP": "10.80.59.161", "ChannelName": "WS010|P2L", "tool serial": 0, "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } CHANNEL_31_INFO={ "IP": "10.80.59.141", "ChannelName": "WS010|ACK", "tool serial": 0, "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } ``` -------------------------------- ### Configure OGS for EPC01 Integrated Start Button Source: https://haller-erne.github.io/ogs/tools/misc/oetiker This configuration enables OGS to send an enable command to the EPC01 tool. The clamping process is initiated by the operator pressing the safety lever and start button on the tool itself. This mode requires specific settings within the OGS application. ```OGS Configuration Set the `Start` parameter to `Start button and external control`. ``` -------------------------------- ### Configure OGS Web Server in station.ini Source: https://haller-erne.github.io/ogs/tools/positioning/positioning-art-dtrack This snippet shows how to enable the OGS integrated web server by setting the URL and document root folder in the station.ini file. It also includes instructions for registering the listening URL with appropriate permissions using the 'netsh http add urlacl' command. ```INI [WebServer] ; The integrated web server is enabled, if a non-empty URL is given. Please note, that ; this uses the Microsoft http.sys Windows builtin web server, so you will have to ; register the listening URL with apropriate permissions using the `netsh http add urlacl` ; commmand (running elevated) from the windows command line, e.g.: ; netsh http add urlacl url=http://127.0.0.1:60000/ sddl=D:(A;;GA;;;WD) ; URL=http://127.0.0.1:60000/ ;SDDL=D:(A;;GX;;;S-1-0-0)(A;;GA;;;S-1-5-11) ; Set the document root folder (if not given, defaults to the project base folder), ; this might be either a relative path (to the project folder) or an absolute one. RootFolder=../shared/webroot ``` -------------------------------- ### Configure OGS for EPC01 External Start Mode Source: https://haller-erne.github.io/ogs/tools/misc/oetiker This configuration allows OGS to both enable and start the EPC01 tool's clamping process via an external signal. The tool will operate even if the safety lever is not pushed, emphasizing the need for external safety measures. This mode may require a specific license, such as 'safety lever override'. ```OGS Configuration Set the `Start` parameter to `External control`. ``` -------------------------------- ### Read SmartTrack Camera Info Source: https://haller-erne.github.io/ogs/tools/positioning/positioning-art-dtrack This snippet describes how to retrieve the current settings of a SmartTrack camera by inserting a USB drive and waiting for a double-beep. The camera then creates two files on the drive: 'ART_Controller__info.txt' for current settings and 'ART_Controller__setup.txt' for configuration changes. ```text ART_Controller__info.txt: This file has the current settings ART_Controller__setup.txt: This file can be used to change the settings. It provides a template for modifying all parameters - to change, read the comments in the file and set the values according to your needs. ``` -------------------------------- ### Get LuaHID Module Version Source: https://haller-erne.github.io/ogs/libs/lua-hid Retrieves the version information for the LuaHID module. It returns both a string representation and a table containing the version details. ```Lua local version_str, version_table = require("luhid").version_mod() print("LuaHID Version String: " .. version_str) print("LuaHID Version Table: ", table.concat(version_table, ".")) ``` -------------------------------- ### Show and Navigate Browser Instance using Lua Source: https://haller-erne.github.io/ogs/v3/lua/webbrowser This Lua code snippet demonstrates the `Browser.Show` function, which navigates a browser instance to a given URL and ensures the browser view is visible. It returns the previous URL, allowing for navigation back. ```Lua -- Make the SidePanel visible and navigate the -- web browser to https://www.my-url.com/mypage local oldUrl = Browser.Show('SidePanel', 'https://www.my-url.com/mypage') ``` -------------------------------- ### Configure HTTP Client Output Source: https://haller-erne.github.io/ogs/dataoutput/traceability Enables and configures HTTP client output by specifying the server URL and optional authentication credentials. The configuration section must be named `[HTTP_CLIENT]`. ```INI [HTTP_CLIENT] ; Set ENABLED=1 to enable traceability data output ENABLED=1 ; Set ReportSkippedOperations=1, if you want to see operators skip actions ; in the traceability data output, else set to =0 ReportSkippedOperations=1 ; Define the targets http (Sys3xxGateway) server URL endpoint ; Note, that this also supports https! HostURL=http://myserver:8888/sys3xxgateway ; Optionally set username/password for http basic authentication ;Username=sys3xx ;Password=sys3xx ``` -------------------------------- ### Get Last HID Device Error Source: https://haller-erne.github.io/ogs/libs/lua-hid Retrieves the last error message associated with a HID device. Returns the error description as an ASCII string or nil if no error occurred. ```Lua local device = require("luhid").open(0x1234, 0x5678) if device then -- Simulate an error scenario or check after a failed operation local error_msg = require("luhid").error(device) if error_msg then print("Last error: " .. error_msg) else print("No error reported.") end require("luhid").close(device) end ``` -------------------------------- ### Configure ART Positioning for OpenProtocol Channel Source: https://haller-erne.github.io/ogs/tools/positioning This INI configuration sets up an OpenProtocol channel to use the ART positioning system. It defines the channel type, port, and links it to a specific positioning configuration section (`POSITIONING_ART_CH1`). This section then specifies the driver ('ART') and its parameters like timeout, target ID, and mount ID. ```INI [OPENPROTO] CHANNEL_01=192.168.1.42 CHANNEL_01_TYPE=GWK CHANNEL_01_PORT=4002 ; --> this channel shall use ART positioning CHANNEL_01_POSITIONING=POSITIONING_ART_CH1 ; --> Connection between the CHANNEL_01 and the ART positioning system [POSITIONING_ART_CH1] ; Define to use the AR.Tracking positioning system with this channel DRIVER=ART ; Positioning timeout in milliseconds. Defines the grace time before enable ; is removed for the tool, when leaving a position. If not set, defaults to 0. TIMEOUT=1000 ; Define the target tracker and tool adapter for this tool ; Target-ID: this is the model of the target mounted to the tool. By default, ; T1-T8 are provided, other targets can be defined in "targets.atti"-file TARGET_ID=T5 ; Target-Mount-ID: specify the adapter geometry, so the ART driver can calulate ; the tool center point depending on where the target is mounted on the tool. ; By default, "Rexroth ESA030G" and "GWK Operator Plus" are provided, custom ; mounts may be added in "targetmounts.atti" TARGET_MOUNT_ID=Rexroth ESA030G ; Default-length of the adapter mounted to the tool (tool center point) OFFSET_MM=0 ; --> common parameter required by the ART driver [POSITIONING_ART] ; Define the IP-Address of the SmartTrack camera system IP=10.10.2.108 ; If you want to use custom targets or custom target_mounts, then you can ; specify these in "targets.atti" and "targetmounts.atti" in the following ; folder. If the folder is not specified, it defaults to the current projects ; folder. ;DB_FOLDER= ; If you want to set the reference tracker, then add the name of the tracker here. ; NOTE: the reference tracker must be configured through DTrack and *must* have ; then name "reference" or "referenz" (case insensitive) as part of the ; body name, else it will not be accepted. REFERENCE_TRACKER=Claw Target 21 Reference ``` -------------------------------- ### Get HID Device String Property Source: https://haller-erne.github.io/ogs/libs/lua-hid Retrieves string properties from a HID device, such as manufacturer, product name, or serial number. Returns the property value string or nil on failure. ```Lua local device = require("luhid").open(0x1234, 0x5678) if device then local manufacturer = require("luhid").getstring(device, "manufacturer") local product = require("luhid").getstring(device, "product") local serial = require("luhid").getstring(device, "serial") if manufacturer then print("Manufacturer: " .. manufacturer) end if product then print("Product: " .. product) end if serial then print("Serial: " .. serial) end require("luhid").close(device) end ``` -------------------------------- ### Enable Custom IO Access via OpenProtocol Source: https://haller-erne.github.io/ogs/tools/openprotocol Enables custom Input/Output (IO) access through LUA scripts over the OpenProtocol interface. For CS351 and KE350, set to 2 to enable this. ```INI ; Shared parameter EXTERNAL_IO_OFFSET = 0 ; Optional, defaults to 0 ``` -------------------------------- ### JSON Output for Logon Event Source: https://haller-erne.github.io/ogs/v3/lua/eventlog An example of the JSON message generated for a logon event, showing the structure with fields like type, timestamp, name, status, user1, user2, and login. ```JSON { "type":3, "timestamp":"2023-03-31 09:56:00", "name":"USER_LOGON", "status":0, "user1":"U40003ACC4D", "user2":"", "login":"login" } ``` -------------------------------- ### OGS station.ini Configuration for GUI Input Tool Source: https://haller-erne.github.io/ogs/tools/misc/gui-input This configuration snippet shows how to register the GUI Input tool in OGS by adding the necessary DLL and channel information to the `station.ini` file. It also defines the parameters (Param1 to Param6) with their names, types, default values, and min/max ranges. ```INI [TOOL_DLL] heLuaTool.dll=1 [CHANNELS] 2=LuaTool_GUI_Input [LuaTool_GUI_Input] DRIVER=heLuaTool TYPE=gui_input Param1 = { "name": "Param 1 m2:", "type": 'float', "default": '250', "min": 'heightmin', "max": 'heightmax'} Param2 = { "name": "Param 2 m2:", "type": 'float', "default": '0', "min": 'widthmin', "max": 'widthmax'} Param3 = { "name": "Param 3 m2:", "type": 'int', "default": '0', "min": 'vmin', "max": 'vmax'} Param4 = { "name": "Param 4 m2:", "type": 'int', "default": '0', "min": 'v1min', "max": 'v1max'} Param5 = { "name": "Param 5 m2:", "type": 'float', "default": '300', "min": 'v2min', "max": 'v2max'} Param6 = { "name": "Param 6 m2:", "type": 'float', "default": '0', "min": 'v2min', "max": 'v2max'} ``` -------------------------------- ### JavaScript OGS Helper Object Usage Source: https://haller-erne.github.io/ogs/v3/lua/webbrowser Demonstrates how to use the injected OGS JavaScript object to send commands to the OGS core. It shows implementing the 'onInit' callback to send a message reliably after initialization and also includes 'onShow' and 'onHide' event handlers. ```JavaScript ``` -------------------------------- ### Lua Override Filename with Timestamp Source: https://haller-erne.github.io/ogs/dataoutput/xmlfile Demonstrates how to override the default filename generated by OGS using a Lua function. This example creates a new filename format including the idcode and a timestamp. ```Lua -- Store the original function in a local variable local old_GetXMLFile = GetXMLFile -- Define the new function (override the original one) function GetXMLFile(idcode, model) -- Call the "original" function to get the XML data local old_filename, old_filecontent = old_GetXMLFile(idcode, model) -- Create a new filename as "-
T.xml" local t = os.date('*t') local t_as_str = string.format('%04d%02d%02dT%02d%02d%02d', t.year,t.month, t.day, t.hour,t.min,t.sec) local new_filename = string.format('%s-%s.xml', idcode, t_as_str) -- Return the "new" filename and the "old" file content return new_filename, old_filecontent end ``` -------------------------------- ### Start Asynchronous PUT Request Source: https://haller-erne.github.io/ogs/libs/lua-net Initiates an asynchronous PUT request, similar to the blocking 'put' function. Returns a handle for managing the request, which can be used for polling or aborting. Proper management of the handle is crucial to prevent resource leaks. ```string put_async(url: string, body: string = nil, auth_bearer_token: string = nil, user: string = nil, pass: string = nil) ``` -------------------------------- ### Configure OGS for AIOI Pick2Light Source: https://haller-erne.github.io/ogs/tools/misc/aioi-pick2light This snippet shows the necessary configuration in `station.ini` to integrate the AIOI Pick2Light tool with OGS using the Lua custom tools. It specifies the DLL to load, the channel mapping, and the parameters for the Pick2Light driver. ```INI [TOOL_DLL] heLuaTool.dll=1 [CHANNELS] 20=LuaTool_Pick2Light [LuaTool_Pick2Light] DRIVER=heLuaTool TYPE=LUA_FLOWLIGHT IPADDR=controller_IPADDR IPPORT=controller_IPPORT ``` -------------------------------- ### Configure FTP Client Output Source: https://haller-erne.github.io/ogs/dataoutput/traceability Enables and configures FTP client output, including server IP address, port, authentication, and target folder. The configuration section must be named `[FTP_CLIENT]`. ```INI [FTP_CLIENT] ; Set ENABLED=1 to enable traceability data output ENABLED=1 ; Set ReportSkippedOperations=1, if you want to see operators skip actions ; in the traceability data output, else set to =0 ReportSkippedOperations=1 ; Define the targets FTP (Sys3xxGateway) server IP-Address and port HostIP=10.80.59.252 HostPort=21 ; In case of Sys3xxGateway(Qtrans) as FTP server use "Username=sys3xx" and ; "Password=sys3xx". TargetFolderOnHost is not needed (ignored) then. Username=sys3xx Password=sys3xx ; In case of standard FTP Server the "TargetFolderOnHost" parameter must ; be set and is used as a base folder to store data. TargetFolderOnHost= ``` -------------------------------- ### Start Asynchronous POST Request Source: https://haller-erne.github.io/ogs/libs/lua-net Initiates an asynchronous POST request, similar to the blocking 'post' function. Returns a handle for managing the request, which can be used for polling or aborting. Proper management of the handle is crucial to prevent resource leaks. ```string post_async(url: string, body: string = nil, auth_bearer_token: string = nil, user: string = nil, pass: string = nil) ``` -------------------------------- ### Get Channel from Tool Number (Lua) Source: https://haller-erne.github.io/ogs/v3/lua/customtools Retrieves the channel table associated with a specific tool number. This is a utility function for accessing channel data when only the tool number is available, often used in low-level API interactions. ```lua -- Get the channel table from a given tool number _M.get_channel_from_tool = function(tool) local channel = _M.channels[tool] return channel end ``` -------------------------------- ### Configure Multi-Spindle with appl_start Source: https://haller-erne.github.io/ogs/tools/openprotocol/sys350-ke350 This snippet shows the format for the 'appl_start' task parameter used in OGS to group and sequence spindles for multi-spindle operations. It requires a group name and a sequence number to map bolts to spindles. ```text appl_start = ``` -------------------------------- ### SQL Server Schema and Seed Data Source: https://haller-erne.github.io/ogs/appnotes/databanking This section refers to the 'databanking.sql' file which contains the necessary database schema and lookup data for the default databanking implementation. It also mentions that more information can be found in the README file within the OGS GitHub repository's databanking sample folder. ```SQL -- databanking.sql -- Contains database schema and lookup data for databanking implementation. ``` -------------------------------- ### Initialize LuaHID Library Source: https://haller-erne.github.io/ogs/libs/lua-hid Initializes the LuaHID library. This function must be called before any other LuaHID functions. It returns a boolean indicating success or failure. ```Lua local success = require("luhid").init() if success then print("LuaHID initialized successfully.") else print("Failed to initialize LuaHID.") end ``` -------------------------------- ### Default OGS XML File Naming Convention Source: https://haller-erne.github.io/ogs/dataoutput/xmlfile This example illustrates the default file naming convention used by OGS for generated XML result files. The filename is constructed using the part's ID code and a timestamp. ```Text -.xml where * is the concatenation of the model code and serial number * is the current date/time in format `YYMMDD-HHmmss` ``` -------------------------------- ### Configure Traceability for Doga Tools in OGS Source: https://haller-erne.github.io/ogs/tools/doga-wifi This INI configuration demonstrates how to enable and set up Traceability for Doga tools in OGS by configuring the `[FTP_CLIENT]` section. It includes parameters like `ChannelName` and `location name` required for data output. ```INI [FTP_CLIENT] Enabled=1 ;... ; (more settings) ;... ; Parameters for each channel: CHANNEL_06_INFO={ "ChannelName": "WS010|AC_PF6000", "location name": ["Tool", "Line 2", "WS010", "default", "", "", ""] } ``` -------------------------------- ### Lua Tool Driver Formatting with Helpers Module (Lua) Source: https://haller-erne.github.io/ogs/v3/lua/customtools Demonstrates how to use the `lua_tool_helpers` module to format tool results for the OGS user interface. It covers initialization, reading configuration, and implementing functions to display units, result strings, footer text, and program names. ```lua local helpers = require('lua_tool_helpers') local _M = { type = 'MyLuaTool', -- type identifier (as in INI file) } ------------------------------------------------------------- -- Initialize the driver and read the parameter section function _M.init(channel) -- local (tool instance specific) parameters local cfg = { -- Initialize the parameters for formatting fmt = helpers.read_fmt_config(channel) } channel.cfg = cfg return 'OK' end ------------------------------------------------------------- -- Get the tool specific measurement units -- @param tool: channel number as configured in station.ini -- @return: applicable only for the first two values (from 6) _M.get_tool_units = function(tool) local channel = _M.channels[tool] return helpers.get_tool_units(channel, channel.cfg.fmt) end -- Get the tool specific result string _M.get_tool_result_string = function(tool) local channel = _M.channels[tool] return helpers.get_tool_result_string(channel, channel.cfg.fmt) end -- Get the tool specific footer string _M.get_footer_string = function(tool) local channel = _M.channels[tool] return helpers.get_footer_string(channel, channel.cfg.fmt) end -- Get the tool specific program name _M.get_prg_string = function(tool) local channel = _M.channels[tool] return helpers.get_prg_string(channel, channel.cfg.fmt) end ``` -------------------------------- ### Execute heLabelPrinter.exe with Parameters Source: https://haller-erne.github.io/ogs/dataoutput/printout Demonstrates how to execute the `heLabelPrinter.exe` utility from the command line, passing parameters for report template, display options, output file or printer, and custom variables. ```Batch @rem Generate a pdf report and show it. Use INT_VAR1=12345 and STR_VAR2=YES heLabelPrinter.exe [form=label.fr3][show=YES][INT_VAR1=12345][STR_VAR2=YES][output=C:\\tmp\\mumu.pdf] @rem Print the same report on printer KYOCERA FS1900. Use INT_VAR1=12345 and STR_VAR2=YES heLabelPrinter.exe [form=label.fr3][show=YES][INT_VAR1=12345][STR_VAR2=YES][output=KYOCERA FS1900] ```