2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.bluetooth;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.notification.BluetoothConnectionStatusNotification;
17 import org.openhab.binding.bluetooth.notification.BluetoothScanNotification;
20 * The {@link BluetoothDeviceListener} class defines the a callback interface where devices are notified of updates to a
23 * @author Chris Jackson - Initial contribution
24 * @author Kai Kreuzer - Added descriptor updates
27 public interface BluetoothDeviceListener {
30 * Called when a scan record is received for the device
32 * @param scanNotification the {@link BluetoothScanNotification} providing the scan packet information
34 void onScanRecordReceived(BluetoothScanNotification scanNotification);
37 * Called when the connection status changes
39 * @param connectionNotification the {@link BluetoothConnectionStatusNotification} providing the updated connection
42 void onConnectionStateChange(BluetoothConnectionStatusNotification connectionNotification);
45 * Called when a devices services and characteristics have been completely read
47 void onServicesDiscovered();
50 * Called when a characteristic value is received. Implementations should call this whenever a value
51 * is received from the BLE device even if there is no change to the value.
53 * @param characteristic the updated {@link BluetoothCharacteristic}
54 * @param value the update value
56 void onCharacteristicUpdate(BluetoothCharacteristic characteristic, byte[] value);
59 * Called when a descriptor value is received. Implementations should call this whenever a value
60 * is received from the BLE device even if there is no change to the value.
62 * @param bluetoothDescriptor the updated {@link BluetoothDescriptor}
63 * @param value the update value
65 void onDescriptorUpdate(BluetoothDescriptor bluetoothDescriptor, byte[] value);
68 * Called when the BluetoothAdapter for this BluetoothDevice changes.
69 * Implementations should call this whenever they change the adapter used by this device.
70 * Note: In general this is only called by a RoamingBluetoothDevice
72 * @param adapter the new {@link BluetoothAdapter} used by this device
74 void onAdapterChanged(BluetoothAdapter adapter);