@yesprasoon/capacitor-bluetooth-communication
Version:
A Capacitor plugin for client-to-server communication over Bluetooth Classic on Android.
187 lines • 5.33 kB
JSON
{
"api": {
"name": "BluetoothCommunicationPlugin",
"slug": "bluetoothcommunicationplugin",
"docs": "Interface for the BluetoothCommunicationPlugin, providing methods for bluetooth communications.",
"tags": [],
"methods": [
{
"name": "initialize",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Initializes the Bluetooth adapter.\nResolves if Bluetooth is supported, rejects otherwise.",
"complexTypes": [],
"slug": "initialize"
},
{
"name": "enableBluetooth",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Enables Bluetooth on the device.\nIf Bluetooth is already enabled, resolves without any action.",
"complexTypes": [],
"slug": "enablebluetooth"
},
{
"name": "scanDevices",
"signature": "() => Promise<{ devices: BluetoothDevice[]; }>",
"parameters": [],
"returns": "Promise<{ devices: BluetoothDevice[]; }>",
"tags": [
{
"name": "returns",
"text": "A list of paired devices."
}
],
"docs": "Scans for paired Bluetooth devices.",
"complexTypes": [
"BluetoothDevice"
],
"slug": "scandevices"
},
{
"name": "startServer",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Starts the Bluetooth server and listens for incoming connections.",
"complexTypes": [],
"slug": "startserver"
},
{
"name": "stopServer",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Stops the Bluetooth server and disconnects any active connections.",
"complexTypes": [],
"slug": "stopserver"
},
{
"name": "connect",
"signature": "(options: { address: string; }) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "The connection options, including the device address.",
"type": "{ address: string; }"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "options The connection options, including the device address."
}
],
"docs": "Connects to a Bluetooth device using its MAC address.",
"complexTypes": [],
"slug": "connect"
},
{
"name": "disconnect",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [],
"docs": "Disconnects the current Bluetooth connection.",
"complexTypes": [],
"slug": "disconnect"
},
{
"name": "sendData",
"signature": "(options: { data: string; }) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "The data to be sent as a string.",
"type": "{ data: string; }"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "param",
"text": "options The data to be sent as a string."
}
],
"docs": "Sends data to the connected Bluetooth device.",
"complexTypes": [],
"slug": "senddata"
},
{
"name": "addListener",
"signature": "(eventName: 'dataReceived', listenerFunc: (data: { data: string; }) => void) => PluginListenerHandle",
"parameters": [
{
"name": "eventName",
"docs": "",
"type": "'dataReceived'"
},
{
"name": "listenerFunc",
"docs": "",
"type": "(data: { data: string; }) => void"
}
],
"returns": "PluginListenerHandle",
"tags": [],
"docs": "Listens for incoming data from the connected Bluetooth device.\nThe plugin emits a `dataReceived` event when new data is received.",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistenerdatareceived-"
}
],
"properties": []
},
"interfaces": [
{
"name": "BluetoothDevice",
"slug": "bluetoothdevice",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "name",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "string | null"
},
{
"name": "address",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "string"
}
]
},
{
"name": "PluginListenerHandle",
"slug": "pluginlistenerhandle",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "remove",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "() => Promise<void>"
}
]
}
],
"enums": [],
"typeAliases": [],
"pluginConfigs": []
}