BtLibrary
0.97
Bluetooth Classic Library for Unity
|
Represents the local device Bluetooth adapter. More...
Static Public Member Functions | |
static void | showDevices () |
Display the default Android Bluetooth devices list. More... | |
static bool | isBluetoothEnabled () |
the Bluetooth adapter state. More... | |
static bool | enableBluetooth () |
Force Enabling the bluetooth, without asking the user. More... | |
static bool | disableBluetooth () |
Disables the bluetooth. More... | |
static void | askEnableBluetooth () |
Asks the user to enable bluetooth. More... | |
static void | startServer (string UUID) |
Starts the server. More... | |
static void | startServer (string UUID, int time) |
Starts the server. More... | |
static void | startServer (string UUID, int time, bool connectOneDevice) |
Starts the server. More... | |
static void | listenToBluetoothState () |
Listens the state of the Bluetooth adapter of this device. More... | |
static void | stopListenToBluetoothState () |
Stop listening to the state of the Bluetooth adapter of this device. More... | |
static BluetoothDevice[] | getPairedDevices () |
Gets the paired devices. More... | |
static bool | startDiscovery () |
Start Discovery for nearby devices, get those discovered devices by listening to the event OnDeviceDiscovered More... | |
static void | makeDiscoverable (int time) |
Simply it makes the Android device discoverable. If you want other devices to connect to your device, use startServer (string UUID). More... | |
Events | |
static Action< BluetoothDevice > | OnConnected |
Occurs when a BluetoothDevice instance get connected, and pass its reference. More... | |
static Action< BluetoothDevice > | OnDisconnected |
Occurs when a BluetoothDevice instance get disconnected, and pass its reference. More... | |
static Action< BluetoothDevice > | OnDeviceNotFound |
Occurs when a BluetoothDevice instance can't be found as a near by Device, and pass its reference. More... | |
static Action< BluetoothDevice > | OnDeviceOFF |
Occurs when a BluetoothDevice instance has been found but failed to connect to it, and pass its reference. More... | |
static Action< BluetoothDevice > | OnSendingError |
Occurs when on sending error. Passes the BluetoothDevice reference that has the error. More... | |
static Action< BluetoothDevice > | OnReadingError |
Occurs when on reading error. Passes the BluetoothDevice reference that has the error. More... | |
static Action< BluetoothDevice > | OnDevicePicked |
Occurs when on a device picked by user from the default Android Bluetooth devices list. More... | |
static Action< BluetoothDevice > | OnClientRequest |
Occurs when a client remote device request to connect to your server. More... | |
static Action< BluetoothDevice > | OnReadingStarted |
Occurs when on reading starts for a BluetoothDevice insance and Passes its reference. More... | |
static Action< BluetoothDevice > | OnReadingStoped |
Occurs when on reading stops for a BluetoothDevice insance and Passes its reference. More... | |
static Action | OnBluetoothON |
Occurs when this Android device changes its Bluetoth Adapter state to ON . More... | |
static Action | OnBluetoothOFF |
Occurs when this Android device changes its Bluetoth Adapter state to OFF . More... | |
static Action< BluetoothDevice, short > | OnDeviceDiscovered |
Occurs when a nearby device has been discovered after calling startDiscovery() . More... | |
Represents the local device Bluetooth adapter.
This class has all the general actions that aren't just specific to the remote device you are connecting to, like enabling or checking the status of the Bluetooth Adapter or showing the nearby devices. Also it has all the events that can be raised by this library.
|
static |
Asks the user to enable bluetooth.
A yes/no dialog box will appear to the user asking him to turn Bluetooth ON
|
static |
Disables the bluetooth.
true
, if Bluetooth disabling process was started, false
otherwise.
|
static |
Force Enabling the bluetooth, without asking the user.
true
, if Bluetooth enabling process started, false
otherwise.
|
static |
Gets the paired devices.
BluetoothDevice
array of the paired devices on your Android.
|
static |
the Bluetooth adapter state.
true
, if Bluetooth was enabled, false
otherwise.
|
static |
Listens the state of the Bluetooth adapter of this device.
After calling this method register for OnBluetoothOFF or OnBluetoothON, they won't be broadcasted unless you called this methods
|
static |
Simply it makes the Android device discoverable. If you want other devices to connect to your device, use startServer (string UUID).
|
static |
Display the default Android Bluetooth devices list.
Subscribe to OnDevicePicked Event in order to get a reference of the picked device.
|
static |
Start Discovery for nearby devices, get those discovered devices by listening to the event OnDeviceDiscovered
true
, if Discovery has started, false
otherwise.
|
static |
Starts the server.
Listen to the Event OnClientRequest in order to get a refrence of the remote device is trying to connect
This server will run for 100 seconds, and will close after the first client requests a connection which means after the first OnClientRequest event Broadcasted
UUID | a Unique identifier that other devices will use to connect and identefy your server |
|
static |
Starts the server.
Listen to the Event OnClientRequest in order to get a refrence of the remote device that is trying to connect
This server will close after the first client requests a connection which means after the first OnClientRequest event Broadcasted
UUID | a Unique identifier that other devices will use to connect and identefy your server |
time | how long the server will be running in seconds |
|
static |
Starts the server.
Listen to the Event OnClientRequest in order to get a refrence of the remote devices which are trying to connect
UUID | a Unique identifier that other devices will use to connect and identefy your server |
time | how long the server will be running in seconds |
connectOneDevice | If set to true it will close after the first client requests a connection which means OnClientRequest will be broadcasted once.If set to false it will stay running and accepting connection attempts for the whole time period of a time number of seconds |
|
static |
Stop listening to the state of the Bluetooth adapter of this device.
After calling this method unregister for OnBluetoothOFF and OnBluetoothON events, because they won't be broadcasted after calling this method
|
static |
Occurs when this Android device changes its Bluetoth Adapter state to OFF
.
You need to call listenToBluetoothState() inorder to rescieve this event. Call stopListenToBluetoothState() to stop rescieving this event.
|
static |
Occurs when this Android device changes its Bluetoth Adapter state to ON
.
You need to call listenToBluetoothState() inorder to rescieve this event. Call stopListenToBluetoothState() to stop rescieving this event.
|
static |
Occurs when a client remote device request to connect to your server.
After calling one of the startServer(string) methods, you can listen to client requesting to connect using this event.
The Event Passes a BluetoothDevice reference of the remote client device that is trying to connect
|
static |
Occurs when a BluetoothDevice instance get connected, and pass its reference.
|
static |
Occurs when a nearby device has been discovered after calling startDiscovery() .
It passes a BluetoothDevice reference and its RSSI value
|
static |
Occurs when a BluetoothDevice instance can't be found as a near by Device, and pass its reference.
|
static |
Occurs when a BluetoothDevice instance has been found but failed to connect to it, and pass its reference.
|
static |
Occurs when on a device picked by user from the default Android Bluetooth devices list.
Passes the BluetoothDevice instance which the user picked
You can show the list using showDevices()
|
static |
Occurs when a BluetoothDevice instance get disconnected, and pass its reference.
|
static |
Occurs when on reading error. Passes the BluetoothDevice reference that has the error.
|
static |
Occurs when on reading starts for a BluetoothDevice insance and Passes its reference.
|
static |
Occurs when on reading stops for a BluetoothDevice insance and Passes its reference.
|
static |
Occurs when on sending error. Passes the BluetoothDevice reference that has the error.