API: Scan Using Aila Scanners

Return data from a scan through a connected Aila scanner, as well as return information about the status and configuration of the scanner.

Supported barcode types for this integration include UPC-EAN, QR, Code 128, Code 39, PDF417, and Interleaved 2 of 5.  Aila's scanners use a mirrored system to access the rear camera on the iPad for barcode capture and recognition and the audio jack or USB-C port for communication with the app.

It is possible to configure the scanning mode, motion detection mode, whether the scanner should beep when a scan is recognized, and which types of codes should be returned in the app's settings.

Requirements

Kiosk Pro Enterprise

  • Integration of our JavaScript API into your webpage
    • Sample code to run within the app and download for integration into your own project is available here.
    • Best practices for working with the JavaScript API are available here.
  • App Settings
    • Content > JavaScript API > Access JavaScript API = By Import
  • iOS/iPadOS Permissions
    • Camera - more on enabling specific iOS/iPadOS permissions here
    • Microphone - required if using an Aila scanner that connects through the audio jack
  • Physical Hardware
    • Aila scanner hardware. For more information about Aila's scanners, click here.


Triggers via API Functions

Check Hardware Class

This function triggers a callback that returns which type of Alia scanner is currently connected.

Format
kp_padlockScan_getHardwareClass();
		
Triggers Kiosk Pro will immediately call kp_padlockScan_hardwareClassDidChange with the current status.


Start Scanning

This function starts a new scanning session.

Format
kp_padlockScan_start();
		
Triggers Kiosk Pro will immediately trigger kp_padlockScan_scanningStateDidChange with the current scanning status.


Stop Scanning

This function ends any scanning session currently in progress.

Format
kp_padlockScan_stop();
		
Triggers Kiosk Pro will immediately trigger kp_padlockScan_scanningStateDidChange with the current scanning status.


Check Scanning Status

This function triggers a callback to return the scanning status of the Alia scanner currently connected.

Format
kp_padlockScan_getScanningState();
		
Triggers Kiosk Pro will immediately trigger kp_padlockScan_scanningStateDidChange with the current scanning status.


Beep

This function triggers an audible alert beep from the scanner unit. It is also possible to trigger a beep automatically following a successful scan using the Automatically Beep on Scan setting.

Format
kp_padlockScan_beep();
		


Disconnect Camera from Aila Scanner

This function prevents camera output from being processed by the connected Aila scanner. It can be triggered to allow the use of camera output for other purposes, including file inputs or our JavaScript API calls to capture photos and video.

Note: Due to physical obstruction of the scanner hood, rear camera output when connected to the Aila scanner may include masking around the edges of the image at default zoom levels. If using a newer Aila scanner that connects through the USB-C port, API calls that do not have a zoomFactor of at least 2.0 defined for the rear camera may fail to return camera output when the device is connected to the Aila scanner. 

If the scanner is currently scanning, it must be stopped prior to triggering this call.

Format
kp_padlockScan_enableCamera(callback);
		
Parameters callback - [string] the name of the callback to be triggered, which can be defined in the page to trigger additional actions then after the camera is available
Callback format
callback();
		


Disconnect Audio Output from Aila Scanner

For use with newer Aila scanners that connect through the iPad's USB-C port only - not supported for Aila scanners that connect via audio jack. This function prevents the audio output from being sent to the connected Aila scanner and instead sends audio output to the iPad's external speakers. It can be used to allow the playback of multimedia assets, including audio and video, while the Aila scanner is not active.

If the scanner is currently scanning, it must be stopped prior to triggering this call.

Format
kp_padlockScan_enableSpeaker(callback);
		
Parameters callback - [string] the name of the callback to be triggered, which can be defined in the page to trigger additional actions after audio is transferred to the iPad's speakers
Callback format
callback();
		


Check Current State of Audio Output

For use with newer Aila scanners that connect through the iPad's USB-C port only - not supported for Aila scanners that connect via audio jack. This function triggers a callback with the current state of audio output.

Format
kp_padlockScan_getSpeakerState(callback);
		
Parameters callback - [string] the name of the callback to be triggered with the result
Callback format
callback(stateCode);
		
Callback return values
  • stateCode - [integer] representing the Possible values are:
    • 0 - undefined, the API is unable to return information about the current state of speaker output
    • 1 - routed through the Aila scanner and cannot be used for other purposes, neither kp_padlockScan_EnableSpeaker() nor kp_padlockScan_start() have been triggered
    • 2 - disconnected from the Aila scanner and is being routed through the iPad's speakers, kp_padlockScan_enableSpeaker() has been triggered
    • 3 - routed through the Aila scanner and cannot be used for other purposes, kp_padlockScan_start() has been triggered


Check Firmware Version

This function triggers a callback with the current firmware version of the connected Aila scanner.

Format
kp_padlockScan_getFirmwareVersion(callback);
		
Parameters callback - [string] the name of the callback to be triggered with the result
Callback format
callback(versionString);
		
Callback return values versionString - [string] the firmware version associated with the Aila scanner currently connected


Check SDK Version

This function triggers a callback with the current SDK version of the connected Aila scanner.

Format
kp_padlockScan_getSDKVersion(callback);
		
Parameters callback - [string] the name of the callback to be triggered with the result
Callback format
callback(versionString);
		
Callback return values versionString - [string] the SDK version associated with the Aila scanner currently connected


Notifications via API Callbacks

When a Scan is Returned

This callback is triggered whenever the scanner complete a successful scan.

If source image contains a valid code, but the code does not match a supported type of code (as defined in Kiosk Pro settings) or if the source image does not contain a valid code, then this callback will not be triggered and the scan will be ignored.

Format
kp_padlockScan_scanningDidFinish(scanType, scanData);
		
Return values
  • scanType - [integer] representing the type of bar code scanned. Possible values are:
    • 1 - UPC-EAN
    • 2 - QR Code
    • 4 - Code 128
    • 8 - Code 39
    • 16 - Interleaved 2 of 5
  • scanData - [string] the data contained in the barcode scanned


When Scanning Status Changes

This callback is triggered when the connected scanner is powered on or off through calls in the API or any time ' kp_padlockScan_getScanningState' is called.

Format
kp_padlockScan_scanningStateDidChange(scanning);
		
Return values
  • scanning - [integer] representing the current scanning status of the connected scanner. Possible values are:
    • 1 - a scanning session is ongoing
    • 0 - not scanning


When Hardware Class Changes

This callback is triggered when an Aila scanner is connected or any time ' kp_padlockScan_getHardwareClass' is called.

Format
kp_padlockScan_hardwareClassDidChange(hardwareClass);
		
Return values
  • hardwareClass - [integer] the type of Aila hardware connected. Possible values are:
    • 0 - no scanner connected
    • 1 - kiosk scanner connected
    • 2 - hand-held, mobile scanner connected


Sample Code

  • This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
  • To run sample code, set the app's homepage to kioskgroup.com/aila-scanning-api
  • To download a .zip of sample code, click here.

Change Log

  • Added in version 8.0. Ability to return the firmware version of the scanner added in 9.5.7. Ability to disconnect the speaker or camera from the Aila scanner added in 11.0.4

Still stuck? How can we help? How can we help?