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.notification;
18 * The {@link BluetoothScanNotification} provides a notification of a received scan packet
20 * @author Chris Jackson - Initial contribution
21 * @author Peter Rosenberg - Add support for ServiceData
23 public class BluetoothScanNotification extends BluetoothNotification {
25 * The receive signal strength for this beacon packet
27 private int rssi = Integer.MIN_VALUE;
32 private byte[] data = null;
35 * The manufacturer specific data
37 private byte[] manufacturerData = null;
41 * Key: UUID of the service
42 * Value: Data of the characteristic
44 private Map<String, byte[]> serviceData = null;
49 private BluetoothBeaconType beaconType = BluetoothBeaconType.BEACON_UNKNOWN;
54 private String name = new String();
57 * An enumeration of basic beacon types
59 public enum BluetoothBeaconType {
66 * Sets the receive signal strength RSSI value for the scan
68 * param rssi the RSSI value for the scan packet in dBm
70 public void setRssi(int rssi) {
75 * Gets the receive signal strength RSSI value for the scan
77 * @return the RSSI value for the scan packet in dBm or Integer.MIN_VALUE if no RSSI is available.
79 public int getRssi() {
84 * Sets the scan packet data
86 * @param data a byte array containing the raw packet data;
88 public void setData(byte[] data) {
93 * Gets the scan packet data
95 * @return a byte array containing the data or null if none is set
97 public byte[] getData() {
102 * Sets the scan packet manufacturer specific data
104 * @param manufacturerData a byte array containing the manufacturer specific data
106 public void setManufacturerData(byte[] manufacturerData) {
107 this.manufacturerData = manufacturerData;
111 * Gets the scan packet manufacturer specific data
113 * @return a byte array containing the manufacturer specific data or null if none is set
115 public byte[] getManufacturerData() {
116 return manufacturerData;
119 public void setServiceData(Map<String, byte[]> serviceData) {
120 this.serviceData = serviceData;
123 public Map<String, byte[]> getServiceData() {
128 * Sets the beacon type for this packet
130 * @beaconType the {@link BluetoothBeaconType} for this packet
132 public void setBeaconType(BluetoothBeaconType beaconType) {
133 this.beaconType = beaconType;
137 * Gets the beacon type for this packet
139 * @return the {@link BluetoothBeaconType} for this packet
141 public BluetoothBeaconType getBeaconType() {
146 * Sets the device name
148 * @param name {@link String} containing the device name
150 public void setDeviceName(String name) {
155 * Gets the device name
157 * @return {@link String} containing the device name
159 public String getDeviceName() {