npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kduma-autoid/capacitor-sunmi-uhf

v4.0.0

Published

Capacitor plugin for communication with Sunmi's UHF module SDK

Downloads

11

Readme

@kduma-autoid/capacitor-sunmi-uhf

Capacitor plugin for communication with Sunmi's UHF module SDK

Install

npm install @kduma-autoid/capacitor-sunmi-uhf
npx cap sync

Add following entry to your android/settings.gradle file:

include ':sunmi-scanner-sdk'
project(':sunmi-scanner-sdk').projectDir = new File('../node_modules/@kduma-autoid/capacitor-sunmi-uhf/android/libs/sunmi-scanner-sdk')

API

getScanModel()

getScanModel() => Promise<{ model: "UHF_S7100" | "UHF_R2000" | "INNER" | "NONE" | "UNKNOWN"; available: boolean; }>

Get RFID type

Returns:

  • model - RFID type: UHF_S7100 - UHF S7100, UHF_R2000 - UHF R2000, INNER - Inner RFID, NONE - No RFID module, UNKNOWN - Unknown RFID module.
  • available - Whether the RFID module is available.

Returns: Promise<{ model: 'UHF_S7100' | 'UHF_R2000' | 'INNER' | 'NONE' | 'UNKNOWN'; available: boolean; }>


startScanning(...)

startScanning(options?: { repeat_times?: number | undefined; } | undefined) => Promise<void>

Starts scanning inventory operation

Parameters:

  • options.repeat_times - The number of times the inventory to be repeated. If it is 0xFF, the time used in this inventory round is the shortest time. If there is only one tag in the RF area, the time used in this inventory round is 30-50mS. This parameter value is normally used when quickly polling with several antennas in a four-channel device.

Please note: When the parameter options.repeat_times is set as 255(0xFF), the algorithm specially designed for reading a small amount of tags will be enabled. It is more efficient and sensitive to read a small amount of tags. However, this parameter is not suitable to be used to simultaneously read a large amount of tags.

| Param | Type | | ------------- | --------------------------------------- | | options | { repeat_times?: number; } |


setTagReadCallback(...)

setTagReadCallback(callback: (data: { epc: string; pc: string; frequency: string; rrsi: string; antenna: number; last_updated: number; read_count: number; }) => void) => Promise<CallbackID>

Sets TagReadCallback

| Param | Type | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | callback | (data: { epc: string; pc: string; frequency: string; rrsi: string; antenna: number; last_updated: number; read_count: number; }) => void |

Returns: Promise<string>


clearTagReadCallback()

clearTagReadCallback() => Promise<void>

Removes TagReadCallback


setInventoryScanCompletedCallback(...)

setInventoryScanCompletedCallback(callback: (data: { rate: number; tags_read: number; details: { start_time: number; end_time: number; }; }) => void) => Promise<CallbackID>

Sets InventoryScanCompletedCallback

| Param | Type | | -------------- | ------------------------------------------------------------------------------------------------------------------------ | | callback | (data: { rate: number; tags_read: number; details: { start_time: number; end_time: number; }; }) => void |

Returns: Promise<string>


clearInventoryScanCompletedCallback()

clearInventoryScanCompletedCallback() => Promise<void>

Removes InventoryScanCompletedCallback


stopScanning()

stopScanning() => Promise<void>

Stops scanning


readTag(...)

readTag(options: { bank: "RESERVED" | "EPC" | "TID" | "USER"; address: number; length: number; password?: string; }) => Promise<{ crc: string; pc: string; epc: string; data: string; details: { data_length: number; antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>

Tag operation – read tags

Parameters:

  • options.bank - Tag memory bank: RESERVED - Reserved Memory, EPC - EPC Memory, TID - TID Memory, USER - User Memory.
  • options.address - The first word address of the data read. For the value range, please refer to tag specs.
  • options.length - The data length, word length or WORD (16 bits) length of the data read; For the value range, please refer to tag specs.
  • options.password - Tag access password. 4 bytes. If the tag does not have a password, this parameter is not required.

Please note: setAccessEpcMatch should be done first. Tags with the same EPC but different data read will be deemed as different tags.

| Param | Type | | ------------- | ------------------------------------------------------------------------------------------------------------------ | | options | { bank: 'RESERVED' | 'EPC' | 'TID' | 'USER'; address: number; length: number; password?: string; } |

Returns: Promise<{ crc: string; pc: string; epc: string; data: string; details: { data_length: number; antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>


writeTag(...)

writeTag(options: { bank: "RESERVED" | "EPC" | "TID" | "USER"; address: number; data: string; password?: string; }) => Promise<{ crc: string; pc: string; epc: string; details: { antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>

Tag operation – write tags

Parameters:

  • options.bank - Tag memory bank: RESERVED - Reserved Memory, EPC - EPC Memory, TID - TID Memory, USER - User Memory.
  • options.address - The first word address of the data written. For the value range, please refer to tag specs; it usually starts from 02 if it was written into EPC memory bank, and PC + CRC are stored in the first four bytes of this area.
  • options.data - The data written in Hex String Format.
  • options.password - Tag access password. 4 bytes. If the tag does not have a password, this parameter is not required.

Please note: setAccessEpcMatch should be done first. Tags with the same EPC but different data read will be deemed as different tags.

| Param | Type | | ------------- | ---------------------------------------------------------------------------------------------------------------- | | options | { bank: 'RESERVED' | 'EPC' | 'TID' | 'USER'; address: number; data: string; password?: string; } |

Returns: Promise<{ crc: string; pc: string; epc: string; details: { antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>


lockTag(...)

lockTag(options: { bank: "USER" | "TID" | "EPC" | "ACCESS_PASSWORD" | "KILL_PASSWORD"; type: "OPEN" | "LOCK" | "PERM_OPEM" | "PERM_LOCK"; password: string; }) => Promise<{ crc: string; pc: string; epc: string; details: { antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>

Tag operation – lock tags

Parameters:

  • options.bank - Tag memory bank: USER - User Memory, TID - TID Memory, EPC - EPC Memory, ACCESS_PASSWORD - Access Password, KILL_PASSWORD - Kill Password.
  • options.type - The types of lock operation: OPEN - open, LOCK - lock, PERM_OPEM - permanently open, PERM_LOCK - permanently locked.
  • options.password - Tag access password. 4 bytes.

Please note: setAccessEpcMatch should be done first. Tags with the same EPC but different data read will be deemed as different tags.

| Param | Type | | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | options | { bank: 'EPC' | 'TID' | 'USER' | 'ACCESS_PASSWORD' | 'KILL_PASSWORD'; type: 'OPEN' | 'LOCK' | 'PERM_OPEM' | 'PERM_LOCK'; password: string; } |

Returns: Promise<{ crc: string; pc: string; epc: string; details: { antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>


killTag(...)

killTag(options: { password: string; }) => Promise<{ crc: string; pc: string; epc: string; details: { antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>

Tag operation – kill tags

Parameters:

  • options.password - Tag access password. 4 bytes.

Please note: setAccessEpcMatch should be done first. Tags with the same EPC but different data read will be deemed as different tags.

| Param | Type | | ------------- | ---------------------------------- | | options | { password: string; } |

Returns: Promise<{ crc: string; pc: string; epc: string; details: { antenna: number; tag_read_count: number; start_time: number; end_time: number; }; }>


setAccessEpcMatch(...)

setAccessEpcMatch(options: { epc: string; }) => Promise<{ details: { start_time: number; end_time: number; }; }>

Tag operation – set the matched EPC to be accessed (EPC match is valid until the next refresh)

Parameters:

  • options.epc - EPC number in Hex String Format.

Please note: Tags with the same EPC but different data read will be deemed as different tags.

| Param | Type | | ------------- | ----------------------------- | | options | { epc: string; } |

Returns: Promise<{ details: { start_time: number; end_time: number; }; }>


cancelAccessEpcMatch()

cancelAccessEpcMatch() => Promise<{ details: { start_time: number; end_time: number; }; }>

Tag operation – clear the matched EPC to be accessed

Returns: Promise<{ details: { start_time: number; end_time: number; }; }>


getAccessEpcMatch()

getAccessEpcMatch() => Promise<{ epc_match: string; details: { start_time: number; end_time: number; }; }>

Tag operation – get EPC match

Returns: Promise<{ epc_match: string; details: { start_time: number; end_time: number; }; }>


setImpinjFastTid(...)

setImpinjFastTid(options: { enable: boolean; save?: boolean; }) => Promise<{ details: { start_time: number; end_time: number; }; }>

Tag operation – set FastTID (only valid to some models of Impinj Monza tags)

Parameters:

  • options.enable - FastTID on or off status.
  • options.save - Save the configuration into the internal Flash, which will prevent it from being lost due to an outage. Default is false.

Please note: This function is only effective to some models of Impinj Monza tags.

Please note: This function recognizes EPC and TID at the same time, thus drastically enhancing the efficiency of reading TID.

Please note: After turning on this function, tags of specific model will package TID into EPC during inventory. Therefore, the PC of a tag will be changed, and the original PC + EPC will become: the modified PC + EPC + (CRC of EPC) + TID.

Please note: If there is something goes wrong when recognizing a TID, the original PC + EPC will be uploaded. ★Please turn off this function if you do not need it to avoid unnecessary time used.

| Param | Type | | ------------- | ------------------------------------------------- | | options | { enable: boolean; save?: boolean; } |

Returns: Promise<{ details: { start_time: number; end_time: number; }; }>


getImpinjFastTid()

getImpinjFastTid() => Promise<{ status: number; details: { start_time: number; end_time: number; }; }>

Tag operation – inquire FastTID

Returns: Promise<{ status: number; details: { start_time: number; end_time: number; }; }>


getBatteryChargeState()

getBatteryChargeState() => Promise<void>

Refreshes the battery charging state. The resulting battery state will be returned in onBatteryChargeState events.


getBatteryRemainingPercent()

getBatteryRemainingPercent() => Promise<void>

Refreshes the battery remaining percent. The resulting battery remaining percent will be returned in onBatteryRemainingPercent events.


getBatteryChargeNumTimes()

getBatteryChargeNumTimes() => Promise<void>

Refreshes the battery cycles. The resulting battery cycles will be returned in onBatteryChargeNumTimes events.


getBatteryVoltage()

getBatteryVoltage() => Promise<void>

Refreshes the battery voltage. The resulting battery voltage will be returned in onBatteryVoltage events.


getFirmwareVersion()

getFirmwareVersion() => Promise<void>

Refreshes the UHF firmware version. The resulting UHF firmware version will be returned in onFirmwareVersion events.


getReaderSN()

getReaderSN() => Promise<void>

Refreshes the reader serial number version. The resulting reader serial number version will be returned in onReaderSN events.


addListener('onReaderConnected', ...)

addListener(eventName: 'onReaderConnected', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for reader connected events.

| Param | Type | | ------------------ | -------------------------------- | | eventName | 'onReaderConnected' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


addListener('onReaderBoot', ...)

addListener(eventName: 'onReaderBoot', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for reader booted events.

| Param | Type | | ------------------ | --------------------------- | | eventName | 'onReaderBoot' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


addListener('onReaderBootOrConnected', ...)

addListener(eventName: 'onReaderBootOrConnected', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for reader connected or booted events.

| Param | Type | | ------------------ | -------------------------------------- | | eventName | 'onReaderBootOrConnected' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


addListener('onReaderDisconnected', ...)

addListener(eventName: 'onReaderDisconnected', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for reader disconnected events.

| Param | Type | | ------------------ | ----------------------------------- | | eventName | 'onReaderDisconnected' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


addListener('onReaderLostConnection', ...)

addListener(eventName: 'onReaderLostConnection', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for reader lost connection events.

| Param | Type | | ------------------ | ------------------------------------- | | eventName | 'onReaderLostConnection' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


addListener('onReaderDisconnectedOrLostConnection', ...)

addListener(eventName: 'onReaderDisconnectedOrLostConnection', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for reader disconnected or lost connection events.

| Param | Type | | ------------------ | --------------------------------------------------- | | eventName | 'onReaderDisconnectedOrLostConnection' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


addListener('onBatteryRemainingPercent', ...)

addListener(eventName: 'onBatteryRemainingPercent', listenerFunc: (event: { charge_level: number; }) => void) => Promise<PluginListenerHandle>

Listens for battery remaining percent events.

| Param | Type | | ------------------ | ---------------------------------------------------------- | | eventName | 'onBatteryRemainingPercent' | | listenerFunc | (event: { charge_level: number; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onBatteryLowElectricity', ...)

addListener(eventName: 'onBatteryLowElectricity', listenerFunc: (event: { charge_level: number; }) => void) => Promise<PluginListenerHandle>

Listens for battery low electricity events.

| Param | Type | | ------------------ | ---------------------------------------------------------- | | eventName | 'onBatteryLowElectricity' | | listenerFunc | (event: { charge_level: number; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onBatteryRemainingPercentOrLowElectricity', ...)

addListener(eventName: 'onBatteryRemainingPercentOrLowElectricity', listenerFunc: (event: { charge_level: number; }) => void) => Promise<PluginListenerHandle>

Listens for battery remaining percent or low electricity events.

| Param | Type | | ------------------ | ---------------------------------------------------------- | | eventName | 'onBatteryRemainingPercentOrLowElectricity' | | listenerFunc | (event: { charge_level: number; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onBatteryChargeState', ...)

addListener(eventName: 'onBatteryChargeState', listenerFunc: (event: { state: "Unknown" | "NotCharging" | "PreCharging" | "QuickCharging" | "Charged"; }) => void) => Promise<PluginListenerHandle>

Listens for battery charge state events.

| Param | Type | | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | | eventName | 'onBatteryChargeState' | | listenerFunc | (event: { state: 'Unknown' | 'NotCharging' | 'PreCharging' | 'QuickCharging' | 'Charged'; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onBatteryChargeNumTimes', ...)

addListener(eventName: 'onBatteryChargeNumTimes', listenerFunc: (event: { battery_cycles: number; }) => void) => Promise<PluginListenerHandle>

Listens for battery charge num times events.

| Param | Type | | ------------------ | ------------------------------------------------------------ | | eventName | 'onBatteryChargeNumTimes' | | listenerFunc | (event: { battery_cycles: number; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onBatteryVoltage', ...)

addListener(eventName: 'onBatteryVoltage', listenerFunc: (event: { voltage: number; }) => void) => Promise<PluginListenerHandle>

Listens for battery voltage events.

| Param | Type | | ------------------ | ----------------------------------------------------- | | eventName | 'onBatteryVoltage' | | listenerFunc | (event: { voltage: number; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onFirmwareVersion', ...)

addListener(eventName: 'onFirmwareVersion', listenerFunc: (event: { version: string; major: number; minor: number; }) => void) => Promise<PluginListenerHandle>

Listens for UHF firmware version events.

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | 'onFirmwareVersion' | | listenerFunc | (event: { version: string; major: number; minor: number; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('onReaderSN', ...)

addListener(eventName: 'onReaderSN', listenerFunc: (event: { sn: string; region: "America" | "Europe" | "China" | "Unknown"; band_low: number; band_high: number; }) => void) => Promise<PluginListenerHandle>

Listens for reader serial number events.

| Param | Type | | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | eventName | 'onReaderSN' | | listenerFunc | (event: { sn: string; region: 'Unknown' | 'America' | 'Europe' | 'China'; band_low: number; band_high: number; }) => void |

Returns: Promise<PluginListenerHandle>


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all listeners


Interfaces

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Type Aliases

CallbackID

string