IBluetoothStateCallback

interface IBluetoothStateCallback

IBluetoothStateCallback

Description :

This interface represent the API for all event related to Bluetooth connection state. * This interface is used with the STWBluetoothStateManager in order to delegate event linked to classic bluetooth.

This class offers several possible callback defined in the following list :

  • Bluetooth turn on/off
  • Bluetooth Device connexion state Connected/Disconnected

Example of use :

  • Implementation :
    
     IBluetoothStateCallback mBluetoothStateCallback = new IBluetoothStateCallback() {
    public void onBluetoothTurnedOff() {
    //code...
    }
    
    public void onBluetoothTurnedOn() {
    //code...
    }
    
    public void onDeviceConnected(String bluetoothDeviceAddress) {
    //code...
    
    }
    
    public void onDeviceDisconnect(String bluetoothDeviceAddress) {
    //code...
    
    }
    }
    
  • Registration :
    
     STWBluetoothStateManager.getInstance.registerForBluetoothStateCallback(mBluetoothStateCallback)
    
  • UnRegister :
    
     STWBluetoothStateManager.getInstance.unregisterForBluetoothStateCallback(mBluetoothStateCallback)
    

Functions

Link copied to clipboard
abstract fun onBluetoothTurnedOff()
Callback triggered when Bluetooth Turned off event.
Link copied to clipboard
abstract fun onBluetoothTurnedOn()
Callback triggered when Bluetooth Turned on event.
Link copied to clipboard
abstract fun onDeviceConnected(@Nullable bluetoothDeviceAddress: String)
Callback triggered when new device Connected.
Link copied to clipboard
abstract fun onDeviceDisconnect(@Nullable bluetoothDeviceAddress: String)
Callback triggered when Bluetooth device is disconnecting.