br_serial
v0.0.8
Published
carry
Readme
serial
carry
Install
npm run buildnpm publishnpm install br_serial
npx cap syncAPI
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
