更新记录

1.1.0(2026-05-28)

最低系统要求

  • Android 5.0+ (API Level 21)
  • HBuilderX 3.6.8+
  • uni-app 4.0+


平台兼容性

uni-app(4.0)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - - 5.0 - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - - -

# lg0815-padyssm

Multi-brand PDA scanner callback plugin for uni-app / uni-app x UTS.

Android currently supports:

  • Honeywell PDA scanners through Honeywell AIDC (DataCollection.jar) and AidcManager / BarcodeReader.
  • UROVO PDA scanners through android.device.ScanManager dynamic intent broadcasts.

Unsupported platforms and unsupported Android brands return explicit errors. iOS and Harmony stubs are exported so imports remain stable.

APIs

import {
  initScanner,
  startScan,
  stopScan,
  releaseScanner,
  getScannerDevice,
  isHoneywellDevice,
  type ScanResult
} from '@/uni_modules/lg0815-padyssm'

getScannerDevice(options)

Returns the detected brand/manufacturer/model plus normalized scanner support information:

  • supported: whether the current Android device maps to a supported scanner backend.
  • scannerBrand: honeywell, urovo, or unsupported.
  • source: honeywell-aidc, urovo-scanmanager, or unsupported.

isHoneywellDevice(options)

Compatibility API for existing callers. It keeps Honeywell-only semantics and returns supported === true only on Honeywell devices. New code should prefer getScannerDevice.

initScanner(options)

Detects the current Android PDA brand, initializes the matching scanner backend, and stores options.onScan.

Honeywell initialization creates and configures a Honeywell BarcodeReader, registers barcode and trigger listeners, and claims the scanner.

UROVO initialization creates ScanManager, opens the scanner, reads the configured broadcast action/data key with PropertyID.WEDGE_INTENT_ACTION_NAME and PropertyID.WEDGE_INTENT_DATA_STRING_TAG, switches output to Intent mode, disables keyboard wedge output, registers a dynamic BroadcastReceiver, and reports ready.

ScanResult fields:

  • data: decoded barcode text.
  • codeId: Honeywell code ID; empty for UROVO.
  • aimId: Honeywell AIM ID; empty for UROVO.
  • timestamp: scanner timestamp for Honeywell, current timestamp string for UROVO.
  • charset: Honeywell charset name; empty for UROVO.
  • source: honeywell-aidc or urovo-scanmanager.
  • brand: honeywell or urovo.

startScan(options) / stopScan(options)

  • Honeywell uses BarcodeReader.softwareTrigger(true/false). Hardware trigger events also call aim, light, and decode with the trigger state.
  • UROVO uses ScanManager.startDecode() / ScanManager.stopDecode(). Physical trigger scans are received through the registered broadcast receiver.

releaseScanner(options)

Stops scanning, unregisters UROVO broadcast receivers, releases/cleans Honeywell listeners, closes scanner managers/readers, and clears callbacks. The Android implementation also registers an activity-destroy cleanup hook to avoid stale native receivers retaining old uni-app JS callbacks.

Usage Example

import { initScanner, startScan, stopScan, releaseScanner, getScannerDevice, type ScanResult } from '@/uni_modules/lg0815-padyssm'

getScannerDevice({
  success: (device) => {
    console.log('scanner supported:', device.supported, device.scannerBrand, device.brand, device.model)
  }
})

initScanner({
  onScan: (result: ScanResult) => {
    if (result.data.length > 0) {
      console.log('scan data:', result.data)
      console.log('source:', result.source, result.brand)
      console.log('Honeywell metadata:', result.codeId, result.aimId, result.charset, result.timestamp)
    } else {
      console.log('scan failed or no-read')
    }
  },
  success: (status) => {
    console.log('scanner ready:', status.source, status.brand)
  },
  fail: (err) => {
    console.error(err.errCode, err.errMsg)
  }
})

// Optional software trigger.
startScan({
  fail: (err) => console.error(err.errMsg)
})

stopScan({})

// Call when leaving the page/module.
releaseScanner({})

Android Integration

Files changed in this plugin:

  • utssdk/interface.uts: typed multi-brand scanner API surface.
  • utssdk/unierror.uts: plugin-specific lg0815-padyssm errors.
  • utssdk/app-android/index.uts: Honeywell AIDC and UROVO ScanManager implementation.
  • utssdk/app-android/config.json: Android min SDK.
  • utssdk/app-android/libs/DataCollection.jar: Honeywell AIDC SDK.
  • utssdk/app-android/libs/platform_sdk_v4.0.0802.jar: vendor platform SDK copied from cds_uni_plat_apk for android.device.* APIs.
  • utssdk/app-android/libs/BarcodeAPI_V1_1_33.jar: barcode/vendor SDK copied from cds_uni_plat_apk.
  • utssdk/app-ios/index.uts: explicit unsupported implementation.
  • utssdk/app-harmony/index.uts: explicit unsupported implementation.
  • readme.md: this usage and verification guide.

Android config requests:

  • minSdkVersion: 21

The host application's Android manifest should include:

<uses-permission android:name="com.honeywell.decode.permission.DECODE" />
<uses-permission android:name="android.permission.VIBRATE" />

UROVO callback support uses a dynamic runtime receiver, so no static <receiver> manifest entry is required when using the implemented ScanManager path.

Do not rely on this plugin's config.json to merge permissions automatically across all HBuilderX versions.

Self-Test Flow

  1. Open the uni-app project in HBuilderX.
  2. Build/run to a real Honeywell Android PDA and a real UROVO Android PDA. Emulator, iOS, Harmony, and unsupported Android devices are expected to report unsupported or no hardware scanner.
  3. Confirm the APK includes DataCollection.jar, platform_sdk_v4.0.0802.jar, and BarcodeAPI_V1_1_33.jar from the plugin libs.
  4. On app startup or page entry, call getScannerDevice and verify supported === true with scannerBrand === 'honeywell' or scannerBrand === 'urovo' on matching hardware.
  5. Call initScanner and verify the success callback reports { ready: true, source: 'honeywell-aidc', brand: 'honeywell' } on Honeywell or { ready: true, source: 'urovo-scanmanager', brand: 'urovo' } on UROVO.
  6. Press the physical scan trigger and scan a Code 128 or QR code. Verify onScan receives non-empty data and the expected source / brand.
  7. Call startScan and stopScan from a button to verify software trigger operation: Honeywell should use softwareTrigger, UROVO should use startDecode / stopDecode.
  8. Leave the page or close the module and call releaseScanner; re-enter and call initScanner again to verify resources can be claimed after cleanup and UROVO does not duplicate callbacks.
  9. Test a bad/no-read scan and confirm the callback/error path does not crash.

Real-Device Verification Requirements

Honeywell AIDC classes are supplied by DataCollection.jar, but scanner availability depends on Honeywell device firmware and scanner service. UROVO classes are supplied by vendor SDK jars, but scanner behavior depends on UROVO firmware and scan service settings. Final verification must be performed on real Honeywell and UROVO PDA hardware.

HBuilderX Compile Caveat

The Android implementation is written in UTS using Java imports, Android BroadcastReceiver, and native listener classes following DCloud UTS Android documentation. If HBuilderX reports missing android.device.* classes, verify the copied UROVO/vendor jars are packaged into the Android custom base.

隐私、权限声明

1. 本插件需要申请的系统权限列表:

android.permission.VIBRATE com.honeywell.decode.permission.DECODE

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。