registerForDeviceData Method

The registerForDeviceData method registers a listener for a keyboard emulation device.


    deviceName String that specifies the name of the keyboard emulation device.
    callbackFunc Callback function that will be called after receiving input from device.
Return Value
    The callback function has two parameters containing the data recieved from a device and the name of that device.
    The keyboard emulation device must be configured in the configuration of SiteKiosk, including the device name that is used to register the listener.
    The following example registers a listener for a keyboard emulation device and displays the recieved data.

    <!DOCTYPE html>
    <html lang="en">
    	<meta charset="UTF-8">
    	<title>Keyboard Emulation Device Test</title>
    		var callbackFunc = function (data, devicename) {
    			document.getElementById("text").innerHTML = 
    			"Data received from device with the name: " 
    			+ devicename + ". Data: " + data;
    		function registerDevice() {
    			var deviceName = document.
    			if(deviceName == "")
    				return document.
    				innerHTML = "The device name is empty!";
    			registerForDeviceData(deviceName, callbackFunc);
    			return document.getElementById("foundDevice").
    			innerHTML = "Registered device: " + deviceName;
    		<h1>Test page for reading the input of keyboard 
    		emulation devices configured in the configuration 
    		of SiteKiosk</h1>
    			Listen to input from this device that has been 
    			configured in SiteKiosk: 
    			<input id="devicename" tpye="text" /> 
    			(state the device name) 
    			<button onclick="registerDevice()">
    			Register the listener</button>
    		<span id="foundDevice"></span>
    			Data that has been received: 
    			<span id="text">Waiting for data...</span>

Applies to
    SiteKiosk v9.0 (and later versions).

Back to top