This plugin can be used for reading data from other device over the usb channel
npm install usb-serial-plugin
npx cap sync
usbAttachedDetached(...)
connectedDevices()
openSerial(...)
closeSerial()
readSerial()
writeSerial(...)
writeSerialHex(...)
registerReadCall(...)
- Interfaces
- Type Aliases
usbAttachedDetached(callback: MyPluginCallback) => Promise<CallbackID>
Param | Type |
---|---|
callback |
MyPluginCallback |
Returns: Promise<string>
connectedDevices() => Promise<UsbSerialResponse>
Returns: Promise<UsbSerialResponse>
openSerial(options: UsbSerialOptions) => Promise<UsbSerialResponse>
Param | Type |
---|---|
options |
UsbSerialOptions |
Returns: Promise<UsbSerialResponse>
closeSerial() => Promise<UsbSerialResponse>
Returns: Promise<UsbSerialResponse>
readSerial() => Promise<UsbSerialResponse>
Returns: Promise<UsbSerialResponse>
writeSerial(data: UsbSerialWriteOptions) => Promise<UsbSerialResponse>
Param | Type |
---|---|
data |
UsbSerialWriteOptions |
Returns: Promise<UsbSerialResponse>
writeSerialHex(data: UsbSerialWriteOptions) => Promise<UsbSerialResponse>
Param | Type |
---|---|
data |
UsbSerialWriteOptions |
Returns: Promise<UsbSerialResponse>
registerReadCall(callback: MyPluginCallback) => Promise<CallbackID>
Param | Type |
---|---|
callback |
MyPluginCallback |
Returns: Promise<string>
Prop | Type |
---|---|
success |
boolean |
error |
UsbSerialError |
data |
any |
Prop | Type |
---|---|
message |
string |
cause |
string |
Prop | Type |
---|---|
deviceId |
number |
portNum |
number |
baudRate |
number |
dataBits |
number |
stopBits |
number |
parity |
number |
dtr |
boolean |
rts |
boolean |
sleepOnPause |
boolean |
Prop | Type |
---|---|
data |
string |
(data: UsbSerialResponse): void
string