public class ZBeacon
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private class |
ZBeacon.BroadcastClient
The broadcast client periodically sends beacons via UDP to the network.
|
private class |
ZBeacon.BroadcastServer
The broadcast server receives beacons.
|
static interface |
ZBeacon.Listener
All beacons with matching prefix are passed to a listener.
|
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
beacon |
private ZBeacon.BroadcastClient |
broadcastClient |
private java.net.InetAddress |
broadcastInetAddress |
private long |
broadcastInterval |
private ZBeacon.BroadcastServer |
broadcastServer |
static java.lang.String |
DEFAULT_BROADCAST_HOST |
static long |
DEFAULT_BROADCAST_INTERVAL |
private ZBeacon.Listener |
listener |
private int |
port |
private byte[] |
prefix |
| Constructor and Description |
|---|
ZBeacon(int port,
byte[] beacon) |
ZBeacon(java.lang.String host,
int port,
byte[] beacon) |
ZBeacon(java.lang.String host,
int port,
byte[] beacon,
boolean ignoreLocalAddress) |
| Modifier and Type | Method and Description |
|---|---|
long |
getBroadcastInterval() |
ZBeacon.Listener |
getListener() |
byte[] |
getPrefix() |
void |
setBroadcastInterval(long broadcastInterval) |
void |
setListener(ZBeacon.Listener listener) |
void |
setPrefix(byte[] prefix) |
void |
setUncaughtExceptionHandlers(java.lang.Thread.UncaughtExceptionHandler clientHandler,
java.lang.Thread.UncaughtExceptionHandler serverHandler) |
void |
start() |
void |
stop() |
public static final long DEFAULT_BROADCAST_INTERVAL
public static final java.lang.String DEFAULT_BROADCAST_HOST
private final int port
private java.net.InetAddress broadcastInetAddress
private final ZBeacon.BroadcastClient broadcastClient
private final ZBeacon.BroadcastServer broadcastServer
private final byte[] beacon
private byte[] prefix
private long broadcastInterval
private ZBeacon.Listener listener
public ZBeacon(int port,
byte[] beacon)
public ZBeacon(java.lang.String host,
int port,
byte[] beacon)
public ZBeacon(java.lang.String host,
int port,
byte[] beacon,
boolean ignoreLocalAddress)
public void setUncaughtExceptionHandlers(java.lang.Thread.UncaughtExceptionHandler clientHandler,
java.lang.Thread.UncaughtExceptionHandler serverHandler)
public void start()
public void stop()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void setPrefix(byte[] prefix)
public byte[] getPrefix()
public void setListener(ZBeacon.Listener listener)
public ZBeacon.Listener getListener()
public long getBroadcastInterval()
public void setBroadcastInterval(long broadcastInterval)