npm install @codext/capacitor-blufi
npx cap syncstartScan(...)stopScan()connectToDevice(...)setWifi(...)scanWifi()getDeviceInfo()addListener('onBlufiEvent', ...)removeAllListeners(...)- Interfaces
- Type Aliases
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() => Promise<void>Stop scanning for BLE devices
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(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() => Promise<void>Request device to scan for available WiFi networks
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(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(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 |
| Prop | Type |
|---|---|
remove |
() => Promise<void> |
| Prop | Type |
|---|---|
key |
string |
value |
string | BleScanResult | WifiInfo |
address |
string |
| Prop | Type |
|---|---|
address |
string |
name |
string |
rssi |
number |
| Prop | Type |
|---|---|
ssid |
string |
rssi |
number |
address |
string |
(event: BlufiEvent): void