UNPKG

@yesprasoon/capacitor-bluetooth-communication

Version:

A Capacitor plugin for client-to-server communication over Bluetooth Classic on Android.

58 lines (51 loc) 2.37 kB
var capacitorBluetoothCommunication = (function (exports, core) { 'use strict'; const BluetoothCommunication$1 = core.registerPlugin('BluetoothCommunication', { web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.BluetoothCommunicationWeb()), }); class BluetoothCommunicationWeb extends core.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(); var web = /*#__PURE__*/Object.freeze({ __proto__: null, BluetoothCommunication: BluetoothCommunication, BluetoothCommunicationWeb: BluetoothCommunicationWeb }); exports.BluetoothCommunication = BluetoothCommunication$1; return exports; })({}, capacitorExports); //# sourceMappingURL=plugin.js.map