The HmsScan object is returned by Scan Kit, which contains the barcode position in the input image, original data of the barcode, barcode format, structured data, and zoom ratio.
Call Mode | Return Object | Contained Content |
---|---|---|
Default View Mode | Original value of a barcode (obtained by getOriginalValue()). Barcode format (obtained by getScanType()). Structured data (obtained by getScanTypeForm()). Barcode position in an image (obtained by getBorderRect()). | |
Customized View Mode | Original value of a barcode (obtained by getOriginalValue()). Barcode format (obtained by getScanType()). Structured data (obtained by getScanTypeForm()). Barcode position in an image (obtained by getBorderRect()). | |
Bitmap Mode | Original value of a barcode (obtained by getOriginalValue()). Barcode format (obtained by getScanType()). Structured data (obtained by getScanTypeForm()). Barcode position in an image (obtained by getBorderRect()). Zoom ratio (obtained by setZoomValue(), which is contained only when photoMode is set to false). | |
Status code (obtained by getState()) Barcode scanning result (obtained by getHmsScans()) | ||
Multiprocessor Mode | Original value of a barcode (obtained by getOriginalValue()). Barcode format (obtained by getScanType()). Structured data (obtained by getScanTypeForm()). Barcode position in an image (obtained by getBorderRect()). |
The following table shows QR code images.
QR Code | Data Type Returned by Scan Kit | Method for Obtaining the Data | Data Obtained by the App |
---|---|---|---|
Original value of a barcode | smsto:18300000000:Hello World! | ||
Mobile number of an SMS message | 18300000000 | ||
SMS message content | Hello World! | ||
Original value of a barcode | WIFI:S:WIFI_123;T:WPA;P:12345678;; | ||
Wi-Fi SSID | WIFI_123 | ||
Wi-Fi password | 12345678 | ||
Wi-Fi encryption type | WPA |
public void parseResult(HmsScan result) { if (result.getScanTypeForm() == HmsScan.SMS_FORM) { // Parse the data into structured SMS data. HmsScan.SmsContent smsContent = result.getSmsContent(); String content = smsContent.getMsgContent(); String phoneNumber = smsContent.getDestPhoneNumber(); } else if (result.getScanTypeForm() == HmsScan.WIFI_CONNECT_INFO_FORM){ // Parse the data into structured Wi-Fi data. HmsScan.WiFiConnectionInfo wifiConnectionInfo = result.getWiFiConnectionInfo(); String password = wifiConnectionInfo.getPassword(); String ssidNumber = wifiConnectionInfo.getSsidNumber(); int cipherMode = wifiConnectionInfo.getCipherMode(); } }
public fun parseResult(result:HmsScan) { if (result.getScanTypeForm() == HmsScan.SMS_FORM) { // Parse the data into structured SMS data. val smsContent = result.getSmsContent() val content = smsContent.getMsgContent() val phoneNumber = smsContent.getDestPhoneNumber() } else if (result.getScanTypeForm() == HmsScan.WIFI_CONNECT_INFO_FORM){ // Parse the data into structured Wi-Fi data. val wifiConnectionInfo = result.getWiFiConnectionInfo() val password = wifiConnectionInfo.getPassword() val ssidNumber = wifiConnectionInfo.getSsidNumber() val cipherMode = wifiConnectionInfo.getCipherMode() } }