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
- 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
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(); |
Check Hardware Class
This function triggers a callback which 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. |
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 |
|
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 |
|
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 |
|
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