@yesprasoon/capacitor-bluetooth-communication
Version:
A Capacitor plugin for client-to-server communication over Bluetooth Classic on Android.
33 lines (32 loc) • 1.06 kB
TypeScript
import { WebPlugin } from '@capacitor/core';
import type { BluetoothCommunicationPlugin } from './definitions';
export interface BluetoothDevice {
name: string;
address: string;
}
export interface DataReceivedResult {
data: string;
}
export declare type DataReceivedCallback = (result: DataReceivedResult) => void;
export declare class BluetoothCommunicationWeb extends WebPlugin implements BluetoothCommunicationPlugin {
initialize(): Promise<void>;
enableBluetooth(): Promise<void>;
scanDevices(): Promise<{
devices: Array<{
name: string;
address: string;
}>;
}>;
startServer(): Promise<void>;
stopServer(): Promise<void>;
connect(options: {
address: string;
}): Promise<void>;
disconnect(): Promise<void>;
sendData(options: {
data: string;
}): Promise<void>;
addListener(eventName: 'dataReceived', listenerFunc: (data: any) => void): any;
}
declare const BluetoothCommunication: BluetoothCommunicationWeb;
export { BluetoothCommunication };