Skip to content

codextde/capacitor-blufi

Repository files navigation

@codext/capacitor-blufi

Install

npm install @codext/capacitor-blufi
npx cap sync

API

startScan(...)

startScan(options?: { filter?: string | undefined; } | undefined) => Promise<{ success: boolean; }>

Start scanning for BLE devices

Param Type Description
options { filter?: string; } Optional filter string to filter devices by name

Returns: Promise<{ success: boolean; }>


stopScan()

stopScan() => Promise<void>

Stop scanning for BLE devices


connectToDevice(...)

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

Connect to a BLE device

Param Type Description
options { address: string; } Device address to connect to

Returns: Promise<{ success: boolean; }>


setWifi(...)

setWifi(options: { ssid: string; password: string; }) => Promise<void>

Configure WiFi credentials on the device

Param Type Description
options { ssid: string; password: string; } SSID and password for WiFi network

scanWifi()

scanWifi() => Promise<void>

Request device to scan for available WiFi networks


getDeviceInfo()

getDeviceInfo() => Promise<void>

Get device information (version and status) Status includes whether device is connected to WiFi Results are sent through the event listener (device_version, device_status, device_wifi_connect)


addListener('onBlufiEvent', ...)

addListener(eventName: 'onBlufiEvent', listenerFunc: BlufiEventCallback) => Promise<PluginListenerHandle>

Add listener for BluFi events

Param Type Description
eventName 'onBlufiEvent' Event name to listen for
listenerFunc BlufiEventCallback Callback function to handle events

Returns: Promise<PluginListenerHandle>


removeAllListeners(...)

removeAllListeners(options?: { eventName: string; } | undefined) => Promise<void>

Remove all listeners for a specific event

Param Type Description
options { eventName: string; } Event name to remove listeners for

Interfaces

PluginListenerHandle

Prop Type
remove () => Promise<void>

BlufiEvent

Prop Type
key string
value string | BleScanResult | WifiInfo
address string

BleScanResult

Prop Type
address string
name string
rssi number

WifiInfo

Prop Type
ssid string
rssi number
address string

Type Aliases

BlufiEventCallback

(event: BlufiEvent): void

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published