@yesprasoon/capacitor-bluetooth-communication
Version:
A Capacitor plugin for client-to-server communication over Bluetooth Classic on Android.
40 lines • 1.7 kB
JavaScript
import { WebPlugin } from '@capacitor/core';
export class BluetoothCommunicationWeb extends WebPlugin {
async initialize() {
console.log('[Web] Bluetooth initialized (stub).');
}
async enableBluetooth() {
console.log('[Web] Enable Bluetooth is not supported on the web.');
throw this.unavailable('Bluetooth is not supported on the web.');
}
async scanDevices() {
console.log('[Web] Scanning devices (stub).');
return { devices: [] }; // Return an empty list
}
async startServer() {
console.log('[Web] Start Server is not supported on the web.');
throw this.unavailable('Bluetooth is not supported on the web.');
}
async stopServer() {
console.log('[Web] Stop Server is not supported on the web.');
throw this.unavailable('Bluetooth is not supported on the web.');
}
async connect(options) {
console.log(`[Web] Connecting to device with address: ${options.address} (stub).`);
throw this.unavailable('Bluetooth connection is not supported on the web.');
}
async disconnect() {
console.log('[Web] Disconnecting (stub).');
}
async sendData(options) {
console.log(`[Web] Sending data: ${options.data} (stub).`);
throw this.unavailable('Bluetooth data transfer is not supported on the web.');
}
addListener(eventName, listenerFunc) {
console.log(`BluetoothCommunicationWeb: addListener called for event ${eventName}`);
return super.addListener(eventName, listenerFunc);
}
}
const BluetoothCommunication = new BluetoothCommunicationWeb();
export { BluetoothCommunication };
//# sourceMappingURL=web.js.map