Class AmxBeaconListener
java.lang.Object
org.harctoolbox.harchardware.beacon.AmxBeaconListener
This class listens for an AMX beacon and reports its findings.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This is called when a new node appears, or a node is removed.static class
This class contains one node discovered by its AMX beacon. -
Constructor Summary
ConstructorDescriptionAmxBeaconListener
(AmxBeaconListener.Callback callback) AmxBeaconListener
(AmxBeaconListener.Callback callback, String key, String value) -
Method Summary
Modifier and TypeMethodDescriptionlong
getAge()
Returns the number of microseconds elapsed since the object was created.getNodes()
Returns the found nodes.static Collection<AmxBeaconListener.Node>
listen
(int time) Listen for the amount of time given in the argument, then return then nodes found.static AmxBeaconListener.Node
Searches for a node with the prescribed value of the key.static void
mainly for testing.void
reset()
Discard present nodes.void
start()
void
stop()
-
Constructor Details
-
AmxBeaconListener
-
AmxBeaconListener
public AmxBeaconListener() -
AmxBeaconListener
-
-
Method Details
-
listenFor
Searches for a node with the prescribed value of the key.- Parameters:
key
- Key to search for, e.g. "-Make".value
- Value of the key to search for.timeout
- Timeout in microseconds.- Returns:
-
listen
Listen for the amount of time given in the argument, then return then nodes found.- Parameters:
time
- Time to listen, in microseconds.- Returns:
-
main
mainly for testing.- Parameters:
args
-
-
start
public void start() -
stop
public void stop() -
getNodes
Returns the found nodes.- Returns:
- Collection of nodes.
-
reset
public void reset()Discard present nodes. -
getAge
public long getAge()Returns the number of microseconds elapsed since the object was created.- Returns:
- microseconds
-