Pixels Plugin for Unity
Enable communications with Pixels dice using Bluetooth Low Energy.
Loading...
Searching...
No Matches
Systemic.Unity.BluetoothLE Namespace Reference

Classes

class  BleUuid
 Helper class for Bluetooth UUIDs. More...
 
struct  ManufacturerData
 Represents the manufacturer data of an advertisement packet. More...
 
class  NativeInterface
 A static class that abstracts each platform specific BLE support and offers a unified interface to the Unity programmer. More...
 
struct  NativePeripheralHandle
 Opaque and read only class storing the native peripheral handle as used by the platform specific INativeInterfaceImpl implementation. More...
 
class  RequestEnumerator
 Enumerator handling a request to a BLE peripheral. Instances are meant to be run as coroutines. More...
 
class  ScannedPeripheral
 The advertisement data of a peripheral received during a BLE scan. More...
 
struct  ServiceData
 Represents the service data of an advertisement packet. More...
 
class  ValueRequestEnumerator
 Enumerator handling a request for reading a value from a BLE peripheral. Instances are meant to be run as coroutines. More...
 

Enumerations

enum  BluetoothStatus {
  Unknown , Unsupported , Unavailable , Disabled ,
  Unauthorized , Ready
}
 Bluetooth radio status. More...
 
enum  RequestStatus {
  Success , Error , InProgress , Canceled ,
  Disconnected , InvalidPeripheral , InvalidCall , InvalidParameters ,
  NotSupported , ProtocolError , AccessDenied , AdapterOff ,
  Timeout
}
 Peripheral requests statuses. More...
 
enum  ConnectionEvent {
  Connecting , Connected , FailedToConnect , Ready ,
  Disconnecting , Disconnected
}
 Peripheral connection events. More...
 
enum  ConnectionEventReason {
  Unknown = -1 , Success = 0 , Canceled , NotSupported ,
  Timeout , LinkLoss , AdapterOff , Peripheral
}
 Peripheral connection event reasons. More...
 
enum  CharacteristicProperties : ulong {
  None = 0 , Broadcast = 0x001 , Read = 0x002 , WriteWithoutResponse = 0x004 ,
  Write = 0x008 , Notify = 0x010 , Indicate = 0x020 , SignedWrite = 0x040 ,
  ExtendedProperties = 0x080 , NotifyEncryptionRequired = 0x100 , IndicateEncryptionRequired = 0x200
}
 Standard BLE values for characteristic properties. More...
 
enum  RequestOperation {
  ConnectPeripheral , DisconnectPeripheral , ReadPeripheralRssi , RequestPeripheralMtu ,
  ReadCharacteristic , WriteCharacteristic , SubscribeCharacteristic , UnsubscribeCharacteristic
}
 List of asynchronous BLE operations handled though requests. More...
 

Functions

delegate void NativeBluetoothCallback (BluetoothStatus status)
 Delegate for Bluetooth radio status event.
 
delegate void NativeConnectionEventCallback (ConnectionEvent connectionEvent, ConnectionEventReason reason)
 Delegate for BLE peripheral connection event, with the reason.
 
delegate void NativeRequestResultCallback (RequestStatus result)
 Delegate for BLE peripheral requests result.
 
delegate void NativeValueRequestResultCallback< T > (T value, RequestStatus status)
 Delegate for returning a value and a status.
 

Enumeration Type Documentation

◆ BluetoothStatus

Bluetooth radio status.

Enumerator
Unknown 

Central has not been initialized yet, is initializing or has shutdown.

Unsupported 

The system doesn't have a compatible Bluetooth adapter.

Unavailable 

The Bluetooth radio is resetting or in a uncontrollable state.

Disabled 

The Bluetooth radio is disabled.

Unauthorized 

The access to Bluetooth hasn't been authorized by user.

Ready 

The Bluetooth radio is enabled and ready for use.

◆ CharacteristicProperties

Standard BLE values for characteristic properties.

Enumerator
Broadcast 

Characteristic is broadcastable.

Read 

Characteristic is readable.

WriteWithoutResponse 

Characteristic can be written without response.

Write 

Characteristic can be written.

Notify 

Characteristic supports notification.

Indicate 

Characteristic supports indication.

SignedWrite 

Characteristic supports write with signature.

ExtendedProperties 

Characteristic has extended properties.

NotifyEncryptionRequired 

Characteristic notification uses encryption.

IndicateEncryptionRequired 

Characteristic indication uses encryption.

◆ ConnectionEvent

Peripheral connection events.

Matches C++ enum Systemic::BluetoothLE::ConnectionEvent and Objective-C SGBleConnectionEvent.

Enumerator
Connecting 

Raised at the beginning of the connect sequence and is followed either by Connected or FailedToConnect.

Connected 

Raised once the peripheral is connected, just before services are being discovered.

FailedToConnect 

Raised when the peripheral fails to connect, the reason for the failure is also given.

Ready 

Raised after a Connected event, once the required services have been discovered.

Disconnecting 

Raised at the beginning of a user initiated disconnect.

Disconnected 

Raised when the peripheral is disconnected, the reason for the disconnection is also given.

◆ ConnectionEventReason

Peripheral connection event reasons.

Matches C++ enum Systemic::BluetoothLE::ConnectionEventReason and Objective-C SGBleConnectionEventReason.

Enumerator
Unknown 

The disconnect happened for an unknown reason.

Success 

The disconnect was initiated by user.

Canceled 

Connection attempt canceled by user.

NotSupported 

Peripheral doesn't have all required services.

Timeout 

Peripheral didn't responded in time.

LinkLoss 

Peripheral was disconnected while in "auto connect" mode.

AdapterOff 

The local device Bluetooth adapter is off.

Peripheral 

Disconnection was initiated by peripheral.

◆ RequestOperation

List of asynchronous BLE operations handled though requests.

Enumerator
ConnectPeripheral 

Connect to peripheral.

DisconnectPeripheral 

Disconnect from peripheral.

ReadPeripheralRssi 

Read peripheral RSSI value.

RequestPeripheralMtu 

Request peripheral to change its MTU to a given value.

ReadCharacteristic 

Read a peripheral's characteristic value.

WriteCharacteristic 

Write to a peripheral's characteristic.

SubscribeCharacteristic 

Subscribe to a peripheral's characteristic.

UnsubscribeCharacteristic 

Unsubscribe from a peripheral's characteristic.

◆ RequestStatus

Peripheral requests statuses.

Matches C++ enum Systemic::BluetoothLE::BleRequestStatus.

Enumerator
Success 

The request completed successfully.

Error 

The request completed with a non-specific error.

InProgress 

The request is still in progress.

Canceled 

The request was canceled.

Disconnected 

The request was aborted because the peripheral got disconnected.

InvalidPeripheral 

The request did not run because the given peripheral is not valid.

InvalidCall 

The request did not run because the operation is not valid or permitted.

InvalidParameters 

The request did not run because some of its parameters are invalid.

NotSupported 

The request failed because of the operation is not supported by the peripheral.

ProtocolError 

The request failed because of BLE protocol error.

AccessDenied 

The request failed because it was denied access.

AdapterOff 

The request failed because the Bluetooth radio is off.

Timeout 

The request did not succeed after the timeout period.

Function Documentation

◆ NativeBluetoothCallback()

delegate void Systemic.Unity.BluetoothLE.NativeBluetoothCallback ( BluetoothStatus  status)

Delegate for Bluetooth radio status event.

Parameters
statusThe new status.

◆ NativeConnectionEventCallback()

delegate void Systemic.Unity.BluetoothLE.NativeConnectionEventCallback ( ConnectionEvent  connectionEvent,
ConnectionEventReason  reason 
)

Delegate for BLE peripheral connection event, with the reason.

Parameters
connectionEventThe peripheral event.
reasonThe reason of the event.

◆ NativeRequestResultCallback()

delegate void Systemic.Unity.BluetoothLE.NativeRequestResultCallback ( RequestStatus  result)

Delegate for BLE peripheral requests result.

Parameters
resultThe request status.

◆ NativeValueRequestResultCallback< T >()

delegate void Systemic.Unity.BluetoothLE.NativeValueRequestResultCallback< T > ( value,
RequestStatus  status 
)

Delegate for returning a value and a status.

Template Parameters
TThe type of the returned value.
Parameters
valueThe returned value.
resultThe request status.