]> git.basschouten.com Git - openhab-addons.git/blob
41ca1487e8cf93ceff3aeceb9914617be803e3ee
[openhab-addons.git] /
1 package io.flic.fliclib.javaclient;
2
3 import java.io.IOException;
4 import java.util.concurrent.atomic.AtomicInteger;
5
6 /**
7  * Button scanner class.
8  *
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.
11  */
12 public abstract class ButtonScanner {
13     private static AtomicInteger nextId = new AtomicInteger();
14     int scanId = nextId.getAndIncrement();
15
16     /**
17      * This will be called for every received advertisement packet from a Flic button.
18      *
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
26      */
27     public abstract void onAdvertisementPacket(Bdaddr bdaddr, String name, int rssi, boolean isPrivate, boolean alreadyVerified, boolean alreadyConnectedToThisDevice, boolean alreadyConnectedToOtherDevice) throws IOException;
28 }