victor-bluetooth-plugin
Advanced tools
Comparing version 0.0.30 to 0.0.31
@@ -9,20 +9,24 @@ { | ||
{ | ||
"name": "connect", | ||
"signature": "(options: { address: string; }) => Promise<{ connected: boolean; }>", | ||
"parameters": [ | ||
{ | ||
"name": "options", | ||
"docs": "", | ||
"type": "{ address: string; }" | ||
} | ||
], | ||
"returns": "Promise<{ connected: boolean; }>", | ||
"name": "checkPermissions", | ||
"signature": "() => Promise<void>", | ||
"parameters": [], | ||
"returns": "Promise<void>", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"slug": "connect" | ||
"slug": "checkpermissions" | ||
}, | ||
{ | ||
"name": "read", | ||
"signature": "(options: { address: string; }) => Promise<{ data: string; }>", | ||
"name": "listDevices", | ||
"signature": "() => Promise<{ devices: { name: string; address: string; }[]; }>", | ||
"parameters": [], | ||
"returns": "Promise<{ devices: { name: string; address: string; }[]; }>", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"slug": "listdevices" | ||
}, | ||
{ | ||
"name": "connect", | ||
"signature": "(options: { address: string; }) => Promise<void>", | ||
"parameters": [ | ||
@@ -35,17 +39,17 @@ { | ||
], | ||
"returns": "Promise<{ data: string; }>", | ||
"returns": "Promise<void>", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"slug": "read" | ||
"slug": "connect" | ||
}, | ||
{ | ||
"name": "scan", | ||
"signature": "() => Promise<{ devices: { name: string; address: string; }[]; }>", | ||
"name": "readData", | ||
"signature": "() => Promise<{ data: string; }>", | ||
"parameters": [], | ||
"returns": "Promise<{ devices: { name: string; address: string; }[]; }>", | ||
"returns": "Promise<{ data: string; }>", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"slug": "scan" | ||
"slug": "readdata" | ||
} | ||
@@ -52,0 +56,0 @@ ], |
@@ -0,13 +1,6 @@ | ||
declare module "@capacitor/core" { | ||
} | ||
export interface BluetoothPluginPlugin { | ||
connect(options: { | ||
address: string; | ||
}): Promise<{ | ||
connected: boolean; | ||
}>; | ||
read(options: { | ||
address: string; | ||
}): Promise<{ | ||
data: string; | ||
}>; | ||
scan(): Promise<{ | ||
checkPermissions(): Promise<void>; | ||
listDevices(): Promise<{ | ||
devices: { | ||
@@ -18,2 +11,8 @@ name: string; | ||
}>; | ||
connect(options: { | ||
address: string; | ||
}): Promise<void>; | ||
readData(): Promise<{ | ||
data: string; | ||
}>; | ||
} |
@@ -5,20 +5,10 @@ import { WebPlugin } from '@capacitor/core'; | ||
constructor(); | ||
connect(options: { | ||
address: string; | ||
}): Promise<{ | ||
connected: boolean; | ||
}>; | ||
read(options: { | ||
address: string; | ||
}): Promise<{ | ||
checkPermissions(): Promise<void>; | ||
listDevices(): Promise<any>; | ||
connect(options: any): Promise<any>; | ||
readData(): Promise<{ | ||
data: string; | ||
}>; | ||
scan(): Promise<{ | ||
devices: { | ||
name: string; | ||
address: string; | ||
}[]; | ||
}>; | ||
} | ||
declare const BluetoothPlugin: BluetoothPluginWeb; | ||
export { BluetoothPlugin }; |
@@ -9,14 +9,18 @@ import { WebPlugin } from '@capacitor/core'; | ||
} | ||
checkPermissions() { | ||
console.log('Checking permissions'); | ||
return Promise.resolve(); // Web implementation can be a mock or throw an error | ||
} | ||
async listDevices() { | ||
console.log('Listing devices'); | ||
return true; // Web implementation can be a mock or throw an error | ||
} | ||
async connect(options) { | ||
console.log('Connecting to:', options.address); | ||
return { connected: false }; // Web implementation can be a mock or throw an error | ||
console.log('Connecting to device', options); | ||
return true; // Web implementation can be a mock or throw an error | ||
} | ||
async read(options) { | ||
console.log('Reading from:', options.address); | ||
async readData() { | ||
console.log('Reading data'); | ||
return { data: '' }; // Web implementation can be a mock or throw an error | ||
} | ||
async scan() { | ||
console.log('Scanning for devices'); | ||
return { devices: [] }; // Web implementation can be a mock or throw an error | ||
} | ||
} | ||
@@ -23,0 +27,0 @@ const BluetoothPlugin = new BluetoothPluginWeb(); |
@@ -18,14 +18,18 @@ 'use strict'; | ||
} | ||
checkPermissions() { | ||
console.log('Checking permissions'); | ||
return Promise.resolve(); // Web implementation can be a mock or throw an error | ||
} | ||
async listDevices() { | ||
console.log('Listing devices'); | ||
return true; // Web implementation can be a mock or throw an error | ||
} | ||
async connect(options) { | ||
console.log('Connecting to:', options.address); | ||
return { connected: false }; // Web implementation can be a mock or throw an error | ||
console.log('Connecting to device', options); | ||
return true; // Web implementation can be a mock or throw an error | ||
} | ||
async read(options) { | ||
console.log('Reading from:', options.address); | ||
async readData() { | ||
console.log('Reading data'); | ||
return { data: '' }; // Web implementation can be a mock or throw an error | ||
} | ||
async scan() { | ||
console.log('Scanning for devices'); | ||
return { devices: [] }; // Web implementation can be a mock or throw an error | ||
} | ||
} | ||
@@ -32,0 +36,0 @@ const BluetoothPlugin = new BluetoothPluginWeb(); |
@@ -15,14 +15,18 @@ var capacitorBluetoothPlugin = (function (exports, core) { | ||
} | ||
checkPermissions() { | ||
console.log('Checking permissions'); | ||
return Promise.resolve(); // Web implementation can be a mock or throw an error | ||
} | ||
async listDevices() { | ||
console.log('Listing devices'); | ||
return true; // Web implementation can be a mock or throw an error | ||
} | ||
async connect(options) { | ||
console.log('Connecting to:', options.address); | ||
return { connected: false }; // Web implementation can be a mock or throw an error | ||
console.log('Connecting to device', options); | ||
return true; // Web implementation can be a mock or throw an error | ||
} | ||
async read(options) { | ||
console.log('Reading from:', options.address); | ||
async readData() { | ||
console.log('Reading data'); | ||
return { data: '' }; // Web implementation can be a mock or throw an error | ||
} | ||
async scan() { | ||
console.log('Scanning for devices'); | ||
return { devices: [] }; // Web implementation can be a mock or throw an error | ||
} | ||
} | ||
@@ -29,0 +33,0 @@ const BluetoothPlugin = new BluetoothPluginWeb(); |
{ | ||
"name": "victor-bluetooth-plugin", | ||
"version": "0.0.30", | ||
"version": "0.0.31", | ||
"description": "A plugin for connecting to classic BT devices on android", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
@@ -16,5 +16,6 @@ # victor-bluetooth-plugin | ||
* [`checkPermissions()`](#checkpermissions) | ||
* [`listDevices()`](#listdevices) | ||
* [`connect(...)`](#connect) | ||
* [`read(...)`](#read) | ||
* [`scan()`](#scan) | ||
* [`readData()`](#readdata) | ||
@@ -26,21 +27,26 @@ </docgen-index> | ||
### connect(...) | ||
### checkPermissions() | ||
```typescript | ||
connect(options: { address: string; }) => Promise<{ connected: boolean; }> | ||
checkPermissions() => Promise<void> | ||
``` | ||
| Param | Type | | ||
| ------------- | --------------------------------- | | ||
| **`options`** | <code>{ address: string; }</code> | | ||
-------------------- | ||
**Returns:** <code>Promise<{ connected: boolean; }></code> | ||
### listDevices() | ||
```typescript | ||
listDevices() => Promise<{ devices: { name: string; address: string; }[]; }> | ||
``` | ||
**Returns:** <code>Promise<{ devices: { name: string; address: string; }[]; }></code> | ||
-------------------- | ||
### read(...) | ||
### connect(...) | ||
```typescript | ||
read(options: { address: string; }) => Promise<{ data: string; }> | ||
connect(options: { address: string; }) => Promise<void> | ||
``` | ||
@@ -52,14 +58,12 @@ | ||
**Returns:** <code>Promise<{ data: string; }></code> | ||
-------------------- | ||
### scan() | ||
### readData() | ||
```typescript | ||
scan() => Promise<{ devices: { name: string; address: string; }[]; }> | ||
readData() => Promise<{ data: string; }> | ||
``` | ||
**Returns:** <code>Promise<{ devices: { name: string; address: string; }[]; }></code> | ||
**Returns:** <code>Promise<{ data: string; }></code> | ||
@@ -66,0 +70,0 @@ -------------------- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30049
70
307