capacitor-rfid-plugin-ox
v0.5.0
Published
rfid read-write
Downloads
441
Readme
capacitor-rfid-plugin-ox
rfid read-write
Install
npm install capacitor-rfid-plugin-ox
npx cap syncAPI
getCapabilities()getConnectionState()listReaderPorts()selectReaderPort(...)isConnected()startScan()stopScan()clearData()getScanData()getOutputPower()setOutputPower(...)getRange()setRange(...)getQueryMode()setQueryMode(...)getReaderType()getFirmwareVersion()writeEpc(...)writeEpcString(...)startSearch(...)stopSearch()addListener('onConnectionState', ...)addListener(string, ...)- Interfaces
- Type Aliases
getCapabilities()
getCapabilities() => Promise<ReaderCapabilities>Capabilities of the connected Reader.
Implementations that predate this method reject. That is a signal, not a failure: the caller treats a rejection as a handheld Mobile Reader.
Returns: Promise<ReaderCapabilities>
getConnectionState()
getConnectionState() => Promise<ReaderConnectionState>Connection state for the first render. The stream of later changes comes
from the onConnectionState listener — "not responding" is only found out
after a timeout, so it cannot be a return value.
A reader is an exclusive resource, so its state is only knowable while it
is held: an implementation that is not connected may start an attempt here
and answer connecting, with the outcome arriving on the listener.
Implementations that predate this method reject. The caller then hides the indicator instead of guessing.
Returns: Promise<ReaderConnectionState>
listReaderPorts()
listReaderPorts() => Promise<{ ports: ReaderPort[]; }>The readers plugged in right now, newest listing every call — a port that was there a minute ago may be gone.
Only readers, not every serial port: what the caller does with this list is offer it as a choice, and a Bluetooth port is not a choice.
Implementations that predate this method reject. The caller then keeps whatever the driver picks on its own.
Returns: Promise<{ ports: ReaderPort[]; }>
selectReaderPort(...)
selectReaderPort(options: { path: string; }) => Promise<void>Use this reader from now on. Reconnects when another port is open.
The choice itself is not stored here: the driver is restarted with the app, and where a choice belongs is the caller's question. The caller remembers the path and says it again on the next start.
Rejects when the path is not in the current listReaderPorts() — a
remembered reader that was unplugged has to be chosen again, not opened
blindly.
| Param | Type |
| ------------- | ------------------------------ |
| options | { path: string; } |
isConnected()
isConnected() => Promise<{ connected: boolean; }>Returns: Promise<{ connected: boolean; }>
startScan()
startScan() => Promise<void>stopScan()
stopScan() => Promise<void>clearData()
clearData() => Promise<void>getScanData()
getScanData() => Promise<any>Returns: Promise<any>
getOutputPower()
getOutputPower() => Promise<{ value: number; }>Returns: Promise<{ value: number; }>
setOutputPower(...)
setOutputPower(options: { power: number; }) => Promise<{ value: number; }>| Param | Type |
| ------------- | ------------------------------- |
| options | { power: number; } |
Returns: Promise<{ value: number; }>
getRange()
getRange() => Promise<{ value: number; }>Returns: Promise<{ value: number; }>
setRange(...)
setRange(options: { range: number; }) => Promise<{ value: number; }>| Param | Type |
| ------------- | ------------------------------- |
| options | { range: number; } |
Returns: Promise<{ value: number; }>
getQueryMode()
getQueryMode() => Promise<{ value: 0 | 1 | 2 | 3; }>Returns: Promise<{ value: 0 | 1 | 2 | 3; }>
setQueryMode(...)
setQueryMode(options: { queryMode: 0 | 1 | 2 | 3; }) => Promise<{ value: number; }>| Param | Type |
| ------------- | --------------------------------------------- |
| options | { queryMode: 0 | 1 | 2 | 3; } |
Returns: Promise<{ value: number; }>
getReaderType()
getReaderType() => Promise<{ value: number; }>Returns: Promise<{ value: number; }>
getFirmwareVersion()
getFirmwareVersion() => Promise<{ value: string; }>Returns: Promise<{ value: string; }>
writeEpc(...)
writeEpc(options: { epc: string; password?: string; }) => Promise<{ value: number; }>| Param | Type |
| ------------- | ------------------------------------------------ |
| options | { epc: string; password?: string; } |
Returns: Promise<{ value: number; }>
writeEpcString(...)
writeEpcString(options: { epc: string; password?: string; }) => Promise<{ value: number; }>| Param | Type |
| ------------- | ------------------------------------------------ |
| options | { epc: string; password?: string; } |
Returns: Promise<{ value: number; }>
startSearch(...)
startSearch(options: { searchableTags: string[]; playSound: boolean; }) => Promise<void>| Param | Type |
| ------------- | -------------------------------------------------------------- |
| options | { searchableTags: string[]; playSound: boolean; } |
stopSearch()
stopSearch() => Promise<void>addListener('onConnectionState', ...)
addListener(eventName: 'onConnectionState', listener: (state: ReaderConnectionState) => void) => Promise<PluginListenerHandle>Every connection state change. Fires only on a change, not on a poll.
| Param | Type |
| --------------- | ------------------------------------------------------------------------------------------- |
| eventName | 'onConnectionState' |
| listener | (state: ReaderConnectionState) => void |
Returns: Promise<PluginListenerHandle>
addListener(string, ...)
addListener(eventName: string, listenerFunc: (...args: any[]) => any) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | --------------------------------------- |
| eventName | string |
| listenerFunc | (...args: any[]) => any |
Returns: Promise<PluginListenerHandle>
Interfaces
ReaderCapabilities
What the connected Reader can do. Mode gating comes from here, not from the reader type — a desktop reader that can write must not be gated like one that cannot.
| Prop | Type | Description |
| ---------------- | ----------------------------------------------------------- | --------------------------------------------------------------------- |
| canWrite | boolean | Reader can write an EPC to a tag (Generate & Set mode depends on it). |
| hasRssi | boolean | Reader reports RSSI (Find mode depends on it). |
| isHandheld | boolean | Reader is a handheld terminal rather than a desk device. |
| power | { min: number; max: number; default: number; } | Output power range in dBm. The power slider renders this range. |
ReaderConnectionState
| Prop | Type | Description |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status | ReaderConnectionStatus | |
| reason | ReaderConnectionReason | |
| detail | string | Driver text: the port list, the command code, the OS error. This is the one field allowed to talk about the wiring, because nothing branches on it — it is shown as-is for support, not translated. |
ReaderPort
One reader the driver could talk to.
path is the identity — COM3 on Windows, /dev/cu.usbserial-110
elsewhere. Two identical CH340 adapters carry no serial number of their own,
so the path is all that separates them.
The caller treats it as opaque: it compares, stores and hands it back, and never reads meaning out of it. A driver for a device that is not a serial port puts its own identity here.
| Prop | Type | Description |
| --------------- | ------------------- | ------------------------------------------------------------------------ |
| path | string | |
| label | string | What the OS calls the device. For the operator to read, not to match on. |
| vendorId | string | |
| productId | string | |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
Type Aliases
ReaderConnectionStatus
The four states an operator can act on.
isConnected() is too coarse for this: a reader that is plugged in but
silent answers false the same way a missing one does, and the operator
needs a different move in each case. isConnected() stays as it is.
'connecting' | 'connected' | 'not-found' | 'not-responding'
ReaderConnectionReason
Why the reader is unusable. The status alone does not say what to do next: a busy reader needs another program closed, a missing one needs the connection checked. The UI picks its message from the reason when there is one.
These name what happened to the reader, never how it is wired. A driver
for a device with no serial port has to be able to answer in this
vocabulary too, and the operator has to be told the truth either way —
so nothing here says "COM port" or "USB". The device-specific sentence
belongs in detail.
'busy' | 'not-detected' | 'disconnected' | 'no-answer' | 'not-chosen'
