Unity SDK
v1.2.0
|
BluetoothManager — is a main class for BLE interactions. More...
Classes | |
class | DeviceStatusInfo |
Public Member Functions | |
delegate void | dDeviceStatus< DeviceStatusInfo > (DeviceStatusInfo deviceStatusInfo) |
Event when Device status is changing. | |
BluetoothManager (Action< BleDevice > deviceConnectionHandler, Action< BleDevice > deviceReadyHandler, Action< BleDevice > deviceDisconnectionHandler, Action< int, string > errorReceivedHandler) | |
Constructor of the class, calls the request of required permissions from device and init the core variable for further work. | |
string | GetPluginVersion () |
Gets the current version of BLE Android plugin. | |
void | StartScanning (Action< BleDevice > deviceFoundHandler, Action< BleDevice > deviceRemovedHandler) |
Starts the scan for bluetooth devices. | |
void | StopScanning () |
Stops the scan for bluetooth devices. | |
List< BleDevice > | GetAvailableBleDevices () |
Gets the list with currently available devices. | |
void | ConnectToDevice (string deviceMacAddress, Action< BleDevice, sbyte[]> dataReceiveHandler) |
Connects to device using its MAC address and callback to handle data from device. | |
void | ConnectToDevice (BleDevice device, Action< BleDevice, sbyte[]> dataReceiveHandler) |
Connects to device using its MAC address and callback to handle data from device. | |
void | DisconnectDevice (string deviceMacAddress) |
Disconnects device by its MAC address. | |
void | DisconnectDevice (BleDevice device) |
Disconnects device. | |
void | SendData (string deviceMacAddress, byte[] sendingData) |
Sends data to connected device by its MAC Address. | |
void | SendData (BleDevice device, byte[] sendingData) |
Sends data to connected device. | |
bool | ContainsConnectedDevice (BleDevice device) |
Checks if such BleDevice is connected to this BluetoothManager. | |
bool | ContainsConnectedDevice (string deviceMacAddress) |
Checks if such MAC Address is connected to this BluetoothManager. | |
string | GetConnectedDeviceName (string deviceMacAddress) |
Returns connected device name by its MAC Address or empty string if it is not connected. | |
string | GetDeviceNameFromScanner (string deviceMacAddress) |
Returns name by its MAC Address or empty string if it is not scanned by BLE plugin. | |
BleDevice | GetDeviceFromScannedDevices (string deviceMacAddress) |
Gets device from ScannedDeviceList by its MAC Address. If this device is absent in the list — creates and returns the new one. | |
DeviceStatus | GetDeviceStatus (string deviceMacAddress) |
Returns known DeviceStatus by its MAC Address. | |
DeviceStatus | GetDeviceStatus (BleDevice bleDevice) |
Returns known BLE Device Status. | |
bool | CheckDeviceConnectionInPlugin (BleDevice bleDevice) |
Checks if the device is connected with plugin. Useful to handle the delayed OnDisconnected events. | |
string | ExtractMacAddressFromMessage (string input) |
Extracts the MAC Addresses from provided string and returns the first match or returns null if there is no MAC Address. | |
Properties | |
bool | IsScanning [get] |
List< BleDevice > | ListOfScannedDevices = new List<BleDevice>() [get] |
List of devices that were scanned by BluetoothManager within current Application session. | |
List< BleDevice > | ConnectedDevices = new List<BleDevice>() [get] |
List of connected BleDevices. | |
Events | |
dDeviceStatus< DeviceStatusInfo > | DeviceStatusInfoReady |
BluetoothManager — is a main class for BLE interactions.
|
inline |
Constructor of the class, calls the request of required permissions from device and init the core variable for further work.
deviceConnectionHandler | Method to call when connection to device is finished. |
deviceReadyHandler | Method to call when device is ready for transhipment. |
deviceDisconnectionHandler | Method to call when the disconnection from devices is finished(optional). |
///
errorReceivedHandler | Method to call when error is occurred. |
|
inline |
Checks if the device is connected with plugin. Useful to handle the delayed OnDisconnected events.
bleDevice |
|
inline |
Connects to device using its MAC address and callback to handle data from device.
device | Ble device to connect. |
dataReceiveHandler | Method to call when data received from device. |
|
inline |
Connects to device using its MAC address and callback to handle data from device.
deviceMacAddress | MAC Address of device. |
dataReceiveHandler | Method to call when data received from device. |
|
inline |
Checks if such BleDevice is connected to this BluetoothManager.
device | BLE Device to be checked |
|
inline |
Checks if such MAC Address is connected to this BluetoothManager.
deviceMacAddress | MAC Address to be checked. |
delegate void WeArt.Bluetooth.BluetoothManager.dDeviceStatus< DeviceStatusInfo > | ( | DeviceStatusInfo | deviceStatusInfo | ) |
Event when Device status is changing.
|
inline |
Disconnects device.
device | BLE device to disconnect. |
|
inline |
Disconnects device by its MAC address.
deviceMacAddress | MAC address of device to disconnect. |
|
inline |
Extracts the MAC Addresses from provided string and returns the first match or returns null if there is no MAC Address.
input |
|
inline |
Gets the list with currently available devices.
|
inline |
Returns connected device name by its MAC Address or empty string if it is not connected.
deviceMacAddress |
|
inline |
Gets device from ScannedDeviceList by its MAC Address. If this device is absent in the list — creates and returns the new one.
deviceMacAddress |
|
inline |
Returns name by its MAC Address or empty string if it is not scanned by BLE plugin.
deviceMacAddress |
|
inline |
Returns known BLE Device Status.
bleDevice |
|
inline |
Returns known DeviceStatus by its MAC Address.
deviceMacAddress |
|
inline |
Gets the current version of BLE Android plugin.
|
inline |
Sends data to connected device.
device | Connected device. |
sendingData | Data to be sent to device. |
|
inline |
Sends data to connected device by its MAC Address.
deviceMacAddress | MAC address of the connected device. |
sendingData | Data to be sent to device. |
|
inline |
Starts the scan for bluetooth devices.
deviceFoundHandler | Method to call when new device is found. |
///
deviceRemovedHandler | Method to call when discovered device stops being available for connection. |
|
inline |
Stops the scan for bluetooth devices.
List of connected BleDevices.
|
get |
List of devices that were scanned by BluetoothManager within current Application session.
dDeviceStatus<DeviceStatusInfo> WeArt.Bluetooth.BluetoothManager.DeviceStatusInfoReady |