Class ConcreteBLEReceiver

  • All Implemented Interfaces:
    BLEReceiver, Sensor

    public class ConcreteBLEReceiver
    extends android.bluetooth.BluetoothGattCallback
    implements BLEReceiver
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(SensorDelegate delegate)  
      boolean immediateSend​(Data data, TargetIdentifier targetIdentifier)  
      boolean immediateSendAll​(Data data)  
      void onCharacteristicRead​(android.bluetooth.BluetoothGatt gatt, android.bluetooth.BluetoothGattCharacteristic characteristic, int status)  
      void onCharacteristicWrite​(android.bluetooth.BluetoothGatt gatt, android.bluetooth.BluetoothGattCharacteristic characteristic, int status)  
      void onConnectionStateChange​(android.bluetooth.BluetoothGatt gatt, int status, int newState)  
      void onMtuChanged​(android.bluetooth.BluetoothGatt gatt, int mtu, int status)  
      void onServicesDiscovered​(android.bluetooth.BluetoothGatt gatt, int status)  
      void start()  
      void stop()  
      • Methods inherited from class android.bluetooth.BluetoothGattCallback

        onCharacteristicChanged, onDescriptorRead, onDescriptorWrite, onPhyRead, onPhyUpdate, onReadRemoteRssi, onReliableWriteCompleted
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConcreteBLEReceiver

        public ConcreteBLEReceiver​(@NonNull
                                   android.content.Context context,
                                   @NonNull
                                   BluetoothStateManager bluetoothStateManager,
                                   @NonNull
                                   BLETimer timer,
                                   @NonNull
                                   BLEDatabase database,
                                   @NonNull
                                   BLETransmitter transmitter,
                                   @NonNull
                                   PayloadDataSupplier payloadDataSupplier)
        Receiver starts automatically when Bluetooth is enabled.
        Parameters:
        context - The Herald execution environment Context
        bluetoothStateManager - To determine whether Bluetooth is enabled
        timer - Used to register a need for periodic events to occur
        database - BLE Device database to locate nearby device information
        transmitter - The associated BLETransmitter instance
        payloadDataSupplier - Source of the payload to transmit
    • Method Detail

      • start

        public void start()
        Specified by:
        start in interface Sensor
      • stop

        public void stop()
        Specified by:
        stop in interface Sensor
      • onConnectionStateChange

        public void onConnectionStateChange​(@NonNull
                                            android.bluetooth.BluetoothGatt gatt,
                                            int status,
                                            int newState)
        Overrides:
        onConnectionStateChange in class android.bluetooth.BluetoothGattCallback
      • onServicesDiscovered

        public void onServicesDiscovered​(@NonNull
                                         android.bluetooth.BluetoothGatt gatt,
                                         int status)
        Overrides:
        onServicesDiscovered in class android.bluetooth.BluetoothGattCallback
      • onMtuChanged

        public void onMtuChanged​(@NonNull
                                 android.bluetooth.BluetoothGatt gatt,
                                 int mtu,
                                 int status)
        Overrides:
        onMtuChanged in class android.bluetooth.BluetoothGattCallback
      • onCharacteristicRead

        public void onCharacteristicRead​(@NonNull
                                         android.bluetooth.BluetoothGatt gatt,
                                         @NonNull
                                         android.bluetooth.BluetoothGattCharacteristic characteristic,
                                         int status)
        Overrides:
        onCharacteristicRead in class android.bluetooth.BluetoothGattCallback
      • onCharacteristicWrite

        public void onCharacteristicWrite​(@NonNull
                                          android.bluetooth.BluetoothGatt gatt,
                                          @NonNull
                                          android.bluetooth.BluetoothGattCharacteristic characteristic,
                                          int status)
        Overrides:
        onCharacteristicWrite in class android.bluetooth.BluetoothGattCallback