@Test public void onDescriptorRead() { final BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.randomUUID(), 1, 1); final BluetoothGattDescriptor descriptor = mock(BluetoothGattDescriptor.class); when(descriptor.getCharacteristic()).thenReturn(characteristic); cut.onDescriptorRead(gatt, descriptor, 1); verifyLogger().onDescriptorRead(gatt, descriptor, 1); verifyWrappedClient().onDescriptorRead(gatt, descriptor, 1); }
@Override public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { logger.onDescriptorRead(gatt, descriptor, status); callback.onDescriptorRead(gatt, descriptor, status); }
DebugBluetoothGattCallback extends BluetoothGattCallback implements LogControl { @Override public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { logger.onDescriptorRead(gatt, descriptor, status); callback.onDescriptorRead(gatt, descriptor, status); } }
DebugBluetoothGattCallback extends BluetoothGattCallback implements LogControl { @Override public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { logger.onDescriptorRead(gatt, descriptor, status); callback.onDescriptorRead(gatt, descriptor, status); } @SuppressWarnings("unused")  DebugBluetoothGattCallback(); @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(@NonNull ByteFormat byteFormat,
                                      @NonNull BluetoothGattCallback callback); @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(@NonNull String logTag,
                                      @NonNull ByteFormat byteFormat,
                                      @NonNull BluetoothGattCallback callback); @VisibleForTesting @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(
            @NonNull final String logTag,
            @NonNull final GattCallbackLogger logger,
            @NonNull final BluetoothGattCallback callback); }
DebugBluetoothGattCallback extends BluetoothGattCallback implements LogControl { @Override public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { logger.onDescriptorRead(gatt, descriptor, status); callback.onDescriptorRead(gatt, descriptor, status); } @SuppressWarnings("unused")  DebugBluetoothGattCallback(); @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(@NonNull ByteFormat byteFormat,
                                      @NonNull BluetoothGattCallback callback); @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(@NonNull String logTag,
                                      @NonNull ByteFormat byteFormat,
                                      @NonNull BluetoothGattCallback callback); @VisibleForTesting @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(
            @NonNull final String logTag,
            @NonNull final GattCallbackLogger logger,
            @NonNull final BluetoothGattCallback callback); @RequiresApi(api = Build.VERSION_CODES.O) @Override void onPhyUpdate(BluetoothGatt gatt,
                            int txPhy,
                            int rxPhy,
                            int status); @RequiresApi(api = Build.VERSION_CODES.O) @Override void onPhyRead(BluetoothGatt gatt,
                          int txPhy,
                          int rxPhy,
                          int status); @Override void onConnectionStateChange(BluetoothGatt gatt,
                                        int status,
                                        int newState); @Override void onServicesDiscovered(BluetoothGatt gatt,
                                     int status); @Override void onCharacteristicRead(BluetoothGatt gatt,
                                     BluetoothGattCharacteristic characteristic,
                                     int status); @Override void onCharacteristicWrite(BluetoothGatt gatt,
                                      BluetoothGattCharacteristic characteristic,
                                      int status); @Override void onCharacteristicChanged(BluetoothGatt gatt,
                                        BluetoothGattCharacteristic characteristic); @Override void onDescriptorRead(BluetoothGatt gatt,
                                 BluetoothGattDescriptor descriptor,
                                 int status); @Override void onDescriptorWrite(BluetoothGatt gatt,
                                  BluetoothGattDescriptor descriptor,
                                  int status); @Override void onReliableWriteCompleted(BluetoothGatt gatt,
                                         int status); @Override void onReadRemoteRssi(BluetoothGatt gatt,
                                 int rssi,
                                 int status); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override void onMtuChanged(BluetoothGatt gatt,
                             int mtu,
                             int status); @Override boolean isLoggingEnabled(); @Override void setLoggingEnabled(final boolean enabled); }
DebugBluetoothGattCallback extends BluetoothGattCallback implements LogControl { @Override public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { logger.onDescriptorRead(gatt, descriptor, status); callback.onDescriptorRead(gatt, descriptor, status); } @SuppressWarnings("unused")  DebugBluetoothGattCallback(); @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(@NonNull ByteFormat byteFormat,
                                      @NonNull BluetoothGattCallback callback); @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(@NonNull String logTag,
                                      @NonNull ByteFormat byteFormat,
                                      @NonNull BluetoothGattCallback callback); @VisibleForTesting @SuppressWarnings({"unused", "WeakerAccess"})  DebugBluetoothGattCallback(
            @NonNull final String logTag,
            @NonNull final GattCallbackLogger logger,
            @NonNull final BluetoothGattCallback callback); @RequiresApi(api = Build.VERSION_CODES.O) @Override void onPhyUpdate(BluetoothGatt gatt,
                            int txPhy,
                            int rxPhy,
                            int status); @RequiresApi(api = Build.VERSION_CODES.O) @Override void onPhyRead(BluetoothGatt gatt,
                          int txPhy,
                          int rxPhy,
                          int status); @Override void onConnectionStateChange(BluetoothGatt gatt,
                                        int status,
                                        int newState); @Override void onServicesDiscovered(BluetoothGatt gatt,
                                     int status); @Override void onCharacteristicRead(BluetoothGatt gatt,
                                     BluetoothGattCharacteristic characteristic,
                                     int status); @Override void onCharacteristicWrite(BluetoothGatt gatt,
                                      BluetoothGattCharacteristic characteristic,
                                      int status); @Override void onCharacteristicChanged(BluetoothGatt gatt,
                                        BluetoothGattCharacteristic characteristic); @Override void onDescriptorRead(BluetoothGatt gatt,
                                 BluetoothGattDescriptor descriptor,
                                 int status); @Override void onDescriptorWrite(BluetoothGatt gatt,
                                  BluetoothGattDescriptor descriptor,
                                  int status); @Override void onReliableWriteCompleted(BluetoothGatt gatt,
                                         int status); @Override void onReadRemoteRssi(BluetoothGatt gatt,
                                 int rssi,
                                 int status); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override void onMtuChanged(BluetoothGatt gatt,
                             int mtu,
                             int status); @Override boolean isLoggingEnabled(); @Override void setLoggingEnabled(final boolean enabled);  }