Code Monkey home page Code Monkey logo

capacitor-plugin-usb-serial's Introduction

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 sync

API

connectedDevices()

connectedDevices() => Promise<{ devices: []; }>

Returns: Promise<{ devices: []; }>


openSerial(...)

openSerial(options: UsbSerialOptions) => Promise<void>
Param Type
options UsbSerialOptions

closeSerial()

closeSerial() => Promise<void>

readSerial()

readSerial() => Promise<{ data: string; }>

Returns: Promise<{ data: string; }>


writeSerial(...)

writeSerial(options: { data: string; }) => Promise<void>
Param Type
options { data: string; }

addListener('log', ...)

addListener(eventName: 'log', listenerFunc: (data: { text: string; tag: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'log'
listenerFunc (data: { text: string; tag: string; }) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('connected', ...)

addListener(eventName: 'connected', listenerFunc: (data: UsbSerialDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'connected'
listenerFunc (data: UsbSerialDevice) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('attached', ...)

addListener(eventName: 'attached', listenerFunc: (data: UsbSerialDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'attached'
listenerFunc (data: UsbSerialDevice) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('detached', ...)

addListener(eventName: 'detached', listenerFunc: (data: UsbSerialDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'detached'
listenerFunc (data: UsbSerialDevice) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('data', ...)

addListener(eventName: 'data', listenerFunc: (data: { data: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'data'
listenerFunc (data: { data: string; }) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('error', ...)

addListener(eventName: 'error', listenerFunc: (data: { error: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'error'
listenerFunc (data: { error: string; }) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

UsbSerialOptions

Prop Type
deviceId number
portNum number
baudRate number
dataBits number
stopBits number
parity number
dtr boolean
rts boolean

PluginListenerHandle

Prop Type
remove () => Promise<void>

UsbSerialDevice

Prop Type
pid number
vid number
did number

capacitor-plugin-usb-serial's People

Contributors

coooweee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.