Capacitor Plugin for Serial over OTG
  • Java 69.9%
  • JavaScript 11.5%
  • TypeScript 7.7%
  • Swift 3.7%
  • HTML 2.9%
  • Other 4.3%
Find a file
2022-12-08 21:40:14 +01:00
android First commit 2022-12-08 21:40:14 +01:00
example First commit 2022-12-08 21:40:14 +01:00
ios Initial commit 2022-12-07 17:19:02 +01:00
src First commit 2022-12-08 21:40:14 +01:00
.eslintignore Initial commit 2022-12-07 17:19:02 +01:00
.gitignore Initial commit 2022-12-07 17:19:02 +01:00
.prettierignore Initial commit 2022-12-07 17:19:02 +01:00
CapacitorSerial.podspec Initial commit 2022-12-07 17:19:02 +01:00
CONTRIBUTING.md Initial commit 2022-12-07 17:19:02 +01:00
package.json Initial commit 2022-12-07 17:19:02 +01:00
README.md First commit 2022-12-08 21:40:14 +01:00
rollup.config.js Initial commit 2022-12-07 17:19:02 +01:00
tsconfig.json Initial commit 2022-12-07 17:19:02 +01:00

capacitor-serial

Serial over OTG

Install

npm install capacitor-serial
npx cap sync

API

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