Capacitor Plugin for Serial over OTG
- Java 69.9%
- JavaScript 11.5%
- TypeScript 7.7%
- Swift 3.7%
- HTML 2.9%
- Other 4.3%
| android | ||
| example | ||
| ios | ||
| src | ||
| .eslintignore | ||
| .gitignore | ||
| .prettierignore | ||
| CapacitorSerial.podspec | ||
| CONTRIBUTING.md | ||
| package.json | ||
| README.md | ||
| rollup.config.js | ||
| tsconfig.json | ||
capacitor-serial
Serial over OTG
Install
npm install capacitor-serial
npx cap sync
API
echo(...)registerUsbAttachedDetachedCallback(...)devices()open(...)close()read()write(...)registerReadCallback(...)- Interfaces
- Type Aliases
echo(...)
echo(options: { value: string; }) => Promise<{ value: string; }>
| Param | Type |
|---|---|
options |
{ value: string; } |
Returns: Promise<{ value: string; }>
registerUsbAttachedDetachedCallback(...)
registerUsbAttachedDetachedCallback(callback: UsbAttachedDetachedCallback) => Promise<CallbackID>
| Param | Type |
|---|---|
callback |
UsbAttachedDetachedCallback |
Returns: Promise<string>
devices()
devices() => Promise<SerialResponse<any>>
Returns: Promise<SerialResponse<any>>
open(...)
open(options: SerialOptions) => Promise<SerialResponse<any>>
| Param | Type |
|---|---|
options |
SerialOptions |
Returns: Promise<SerialResponse<any>>
close()
close() => Promise<SerialResponse<any>>
Returns: Promise<SerialResponse<any>>
read()
read() => Promise<SerialResponse<any>>
Returns: Promise<SerialResponse<any>>
write(...)
write(data: SerialWriteOptions) => Promise<SerialResponse<any>>
| Param | Type |
|---|---|
data |
SerialWriteOptions |
Returns: Promise<SerialResponse<any>>
registerReadCallback(...)
registerReadCallback(callback: ReadCallback) => Promise<CallbackID>
| Param | Type |
|---|---|
callback |
ReadCallback |
Returns: Promise<string>
Interfaces
SerialResponse
| Prop | Type |
|---|---|
success |
boolean |
error |
SerialError |
data |
T |
SerialError
| Prop | Type |
|---|---|
message |
string |
cause |
string |
SerialOptions
| Prop | Type |
|---|---|
deviceId |
number |
portNum |
number |
baudRate |
number |
dataBits |
number |
stopBits |
number |
parity |
number |
dtr |
boolean |
rts |
boolean |
sleepOnPause |
boolean |
SerialWriteOptions
| Prop | Type |
|---|---|
data |
string |
Type Aliases
UsbAttachedDetachedCallback
(data: SerialResponse<any>): void
CallbackID
string
ReadCallback
(data: SerialResponse<any>): void