1 package io.flic.fliclib.javaclient;
3 import java.io.IOException;
4 import java.util.concurrent.atomic.AtomicInteger;
7 * Button scanner class.
9 * Inherit this class and override the {@link #onAdvertisementPacket(Bdaddr, String, int, boolean, boolean)} method.
10 * Then add this button scanner to a {@link FlicClient} using {@link FlicClient#addScanner(ButtonScanner)} to start it.
12 public abstract class ButtonScanner {
13 private static AtomicInteger nextId = new AtomicInteger();
14 int scanId = nextId.getAndIncrement();
17 * This will be called for every received advertisement packet from a Flic button.
19 * @param bdaddr Bluetooth address
20 * @param name Advertising name
21 * @param rssi RSSI value in dBm
22 * @param isPrivate The button is private and won't accept new connections from non-bonded clients
23 * @param alreadyVerified The server has already verified this button, which means you can connect to it even if it's private
24 * @param alreadyConnectedToThisDevice The button is already connected to this device
25 * @param alreadyConnectedToOtherDevice The button is already connected to another device
27 public abstract void onAdvertisementPacket(Bdaddr bdaddr, String name, int rssi, boolean isPrivate, boolean alreadyVerified, boolean alreadyConnectedToThisDevice, boolean alreadyConnectedToOtherDevice) throws IOException;