0.0.4 • Published 2 years ago

capacitor-bluetooth-classic-basic v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

capacitor-bluetooth-classic-basic

A work in progress capacitor plugin that communicates with legacy bluetooth

Install

npm install capacitor-bluetooth-classic-basic
npx cap sync

API

echo(...)

echo(options: { value: string; }) => Promise<{ value: string; }>
ParamType
options{ value: string; }

Returns: Promise<{ value: string; }>


startDiscovering(...)

startDiscovering(options?: { periodically: boolean; } | undefined) => Promise<{ status: number; message: string; }>

Start the discovering process for finding bluetooth devices.

ParamType
options{ periodically: boolean; }

Returns: Promise<{ status: number; message: string; }>


cancelDiscovering()

cancelDiscovering() => Promise<any>

Cancels the discovering process for finding bluetooth devices.

Returns: Promise<any>


connectToDevice(...)

connectToDevice(options: { address: string; }) => Promise<{ status: string; }>

Connects to the specified device with the address.

ParamType
options{ address: string; }

Returns: Promise<{ status: string; }>


disconnectFromDevice()

disconnectFromDevice() => Promise<{ status: string; }>

Disconnects the current connected device.

Returns: Promise<{ status: string; }>


sendDataToDevice(...)

sendDataToDevice(options: { data: string; }) => Promise<{ status: string; }>

Sends data to the connected device.

ParamType
options{ data: string; }

Returns: Promise<{ status: string; }>


addListener('discoveryStartEvent', ...)

addListener(eventName: 'discoveryStartEvent', callback: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DiscoveryStartEvent

ParamType
eventName'discoveryStartEvent'
callback() => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('discoveryStopEvent', ...)

addListener(eventName: 'discoveryStopEvent', callback: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DiscoveryStopEvent

ParamType
eventName'discoveryStopEvent'
callback() => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('deviceFoundEvent', ...)

addListener(eventName: 'deviceFoundEvent', callback: (device: Device) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DeviceFoundListener

ParamTypeDescription
eventName'deviceFoundEvent'DeviceFoundEvent
callback(device: Device) => voidCallback

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('deviceRecvDataEvent', ...)

addListener(eventName: 'deviceRecvDataEvent', callback: (data: DeviceData) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DeviceRecvDataListener

ParamTypeDescription
eventName'deviceRecvDataEvent'DeviceRecvDataEvent
callback(data: DeviceData) => voidCallback

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>

Device

PropType
namestring
typenumber
addressstring
rssinumber

DeviceData

PropType
datastring
0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago