com.sirvar.bluetoothkit / BluetoothKit

BluetoothKit

class BluetoothKit : Any

BluetoothKit controller to interface with Android BluetoothAdapter and BluetoothSocket

Author
Rikin Katyal

Constructors

<init> BluetoothKit()

BluetoothKit controller to interface with Android BluetoothAdapter and BluetoothSocket

Functions

connect fun connect(device: <ERROR CLASS>): Unit

Connect to BluetoothDevice with random UUID

fun connect(device: <ERROR CLASS>, uuid: String): Unit

Connect to BluetoothDevice with UUID as string

fun connect(device: <ERROR CLASS>, uuid: <ERROR CLASS>): Unit

Connect to BluetoothDevice with specific UUID

disable fun disable(): Boolean

Disable bluetooth on device

disconnect fun disconnect(): Unit

Closes all IO streams and terminates the socket. NOTE: does not turn off bluetooth

enable fun enable(): Boolean

Enables bluetooth on device

getBluetoothAdapter fun getBluetoothAdapter(): <ERROR CLASS>

Get the BluetoothAdapter

getBluetoothSocket fun getBluetoothSocket(): BluetoothKitSocketInterface

Get the bluetooth socket implementing BluetoothKitSocketInterface

getDeviceByAddress fun getDeviceByAddress(address: String): <ERROR CLASS>?

Get paired BluetoothDevice by MAC address

getDeviceByName fun getDeviceByName(name: String): <ERROR CLASS>?

Get paired BluetoothDevice by name

getPairedDevices fun getPairedDevices(): Set<<ERROR CLASS>>

Gets Set of paired BluetoothDevice

isEnabled fun isEnabled(): Boolean

Checks if bluetooth is enabled