0.0.11 • Published 2 years ago
capacitor-plugin-usb-printer v0.0.11
usb-serial-plugin
This plugin can be used for reading data from other device over the usb channel
Install
npm install usb-serial-plugin
npx cap syncAPI
usbAttachedDetached(...)connectedDevices()openSerial(...)closeSerial()readSerial()writeSerial(...)registerReadCall(...)- Interfaces
usbAttachedDetached(...)
usbAttachedDetached(callback: MyPluginCallback) => any| Param | Type |
|---|---|
callback | (data: UsbSerialResponse) => void |
Returns: any
connectedDevices()
connectedDevices() => anyReturns: any
openSerial(...)
openSerial(options: UsbSerialOptions) => any| Param | Type |
|---|---|
options | UsbSerialOptions |
Returns: any
closeSerial()
closeSerial() => anyReturns: any
readSerial()
readSerial() => anyReturns: any
writeSerial(...)
writeSerial(data: UsbSerialWriteOptions) => any| Param | Type |
|---|---|
data | UsbSerialWriteOptions |
Returns: any
registerReadCall(...)
registerReadCall(callback: MyPluginCallback) => any| Param | Type |
|---|---|
callback | (data: UsbSerialResponse) => void |
Returns: any
Interfaces
UsbSerialResponse
| Prop | Type |
|---|---|
success | boolean |
error | UsbSerialError |
data | any |
UsbSerialError
| Prop | Type |
|---|---|
message | string |
cause | string |
UsbSerialOptions
| Prop | Type |
|---|---|
deviceId | number |
portNum | number |
baudRate | number |
dataBits | number |
stopBits | number |
parity | number |
dtr | boolean |
rts | boolean |
sleepOnPause | boolean |
UsbSerialWriteOptions
| Prop | Type |
|---|---|
data | string |