@cabletv102/chainwayc66
v0.0.9
Published
Utilizes the Chainway Software Development Kit for Chainway C66
Readme
chainwayc66
Utilizes the Chainway Software Development Kit for Chainway C66
Install
npm install chainwayc66
npx cap syncAPI
open()close()startScan()stopScan()setTimeout(...)setParameter(...)playSuccessSound()playFailSound()addListener('scan', ...)- Interfaces
open()
open() => Promise<{ opened: boolean; }>Open the scanner hardware connection. Must be called before startScan().
Returns: Promise<{ opened: boolean; }>
close()
close() => Promise<void>Close the scanner hardware connection.
startScan()
startScan() => Promise<void>Trigger a scan operation. Scanner must be open.
stopScan()
stopScan() => Promise<void>Stop any ongoing scan operation.
setTimeout(...)
setTimeout(options: { ms: number; }) => Promise<void>Set scan timeout in milliseconds.
| Param | Type |
| ------------- | ---------------------------- |
| options | { ms: number; } |
setParameter(...)
setParameter(options: { num: number; value: number; }) => Promise<void>Set a scanner parameter. Parameter numbers & values depend on Chainway SDK docs.
| Param | Type |
| ------------- | -------------------------------------------- |
| options | { num: number; value: number; } |
playSuccessSound()
playSuccessSound() => Promise<void>Play the scanner's success sound immediately.
playFailSound()
playFailSound() => Promise<void>Play the scanner's failure/error sound immediately.
addListener('scan', ...)
addListener(eventName: 'scan', listenerFunc: (event: ScanEvent) => void) => Promise<PluginListenerHandle>Listen for scan events from the hardware.
| Param | Type |
| ------------------ | ------------------------------------------------------------------- |
| eventName | 'scan' |
| listenerFunc | (event: ScanEvent) => void |
Returns: Promise<PluginListenerHandle>
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
ScanEvent
| Prop | Type |
| ---------- | ------------------- |
| data | string |
