0.1.15 • Published 1 year ago
usb-serial-plugin-edited v0.1.15
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(...)writeSerialHex(...)registerReadCall(...)- Interfaces
- Type Aliases
usbAttachedDetached(...)
usbAttachedDetached(callback: MyPluginCallback) => Promise<CallbackID>| Param | Type |
|---|---|
callback | MyPluginCallback |
Returns: Promise<string>
connectedDevices()
connectedDevices() => Promise<UsbSerialResponse>Returns: Promise<UsbSerialResponse>
openSerial(...)
openSerial(options: UsbSerialOptions) => Promise<UsbSerialResponse>| Param | Type |
|---|---|
options | UsbSerialOptions |
Returns: Promise<UsbSerialResponse>
closeSerial()
closeSerial() => Promise<UsbSerialResponse>Returns: Promise<UsbSerialResponse>
readSerial()
readSerial() => Promise<UsbSerialResponse>Returns: Promise<UsbSerialResponse>
writeSerial(...)
writeSerial(data: UsbSerialWriteOptions) => Promise<UsbSerialResponse>| Param | Type |
|---|---|
data | UsbSerialWriteOptions |
Returns: Promise<UsbSerialResponse>
writeSerialHex(...)
writeSerialHex(data: UsbSerialWriteOptions) => Promise<UsbSerialResponse>| Param | Type |
|---|---|
data | UsbSerialWriteOptions |
Returns: Promise<UsbSerialResponse>
registerReadCall(...)
registerReadCall(callback: MyPluginCallback) => Promise<CallbackID>| Param | Type |
|---|---|
callback | MyPluginCallback |
Returns: Promise<string>
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 |
Type Aliases
MyPluginCallback
(data: UsbSerialResponse): void
CallbackID
string