public class FlicClient
extends java.lang.Object
handleEvents() method which is a main loop that never exits, unless the socket is closed.
For a more detailed description of all commands, events and enums, check the protocol specification.| Constructor and Description |
|---|
FlicClient(java.lang.String hostName)
Create a FlicClient and connect to the specified hostName using the default TCP port
|
FlicClient(java.lang.String hostName,
int port)
Create a FlicClient and connect to the specified hostName and TCP port
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionChannel(ButtonConnectionChannel channel)
Adds a connection channel to a specific Flic button.
|
void |
addScanner(ButtonScanner buttonScanner)
Add a scanner.
|
void |
addScanWizard(ScanWizard scanWizard)
Add a scan wizard.
|
void |
cancelScanWizard(ScanWizard scanWizard)
Cancel a scan wizard.
|
void |
close()
Close the socket.
|
void |
forceDisconnect(Bdaddr bdaddr)
Force disconnection or cancel pending connection of a specific Flic button.
|
void |
getButtonUUID(Bdaddr bdaddr,
GetButtonUUIDResponseCallback callback)
Get button uuid for a verified button.
|
void |
getInfo(GetInfoResponseCallback callback)
Get info about the current state of the server.
|
void |
handleEvents()
Start the main loop for this client.
|
void |
removeConnectionChannel(ButtonConnectionChannel channel)
Remove a connection channel.
|
void |
removeScanner(ButtonScanner buttonScanner)
Remove a scanner.
|
void |
runOnHandleEventsThread(TimerTask task)
Run a task on the thread that handles the events.
|
void |
setGeneralCallbacks(GeneralCallbacks callbacks)
Set general callbacks to be called upon receiving some specific events.
|
void |
setTimer(int timeoutMillis,
TimerTask timerTask)
Set a timer.
|
public FlicClient(java.lang.String hostName,
int port)
throws java.net.UnknownHostException,
java.io.IOException
hostName - port - java.net.UnknownHostExceptionjava.io.IOExceptionpublic FlicClient(java.lang.String hostName)
throws java.net.UnknownHostException,
java.io.IOException
hostName - java.net.UnknownHostExceptionjava.io.IOExceptionpublic void close()
throws java.io.IOException
handleEvents() will return as soon as the closing is done.java.io.IOExceptionpublic void setGeneralCallbacks(GeneralCallbacks callbacks)
callbacks - public void getInfo(GetInfoResponseCallback callback) throws java.io.IOException
callback - java.io.IOExceptionpublic void getButtonUUID(Bdaddr bdaddr, GetButtonUUIDResponseCallback callback) throws java.io.IOException
bdaddr - The bluetooth address.callback - Callback for the response.java.io.IOExceptionpublic void addScanner(ButtonScanner buttonScanner) throws java.io.IOException
buttonScanner - java.io.IOExceptionpublic void removeScanner(ButtonScanner buttonScanner) throws java.io.IOException
buttonScanner - The same scanner that was used in addScanner(ButtonScanner)java.io.IOExceptionpublic void addScanWizard(ScanWizard scanWizard) throws java.io.IOException
scanWizard - java.io.IOExceptionpublic void cancelScanWizard(ScanWizard scanWizard) throws java.io.IOException
scanWizard - The same scan wizard that was used in addScanWizard(ScanWizard)java.io.IOExceptionpublic void addConnectionChannel(ButtonConnectionChannel channel) throws java.io.IOException
ButtonConnectionChannel.Callbacks.onCreateConnectionChannelResponse(io.flic.fliclib.javaclient.ButtonConnectionChannel, io.flic.fliclib.javaclient.enums.CreateConnectionChannelError, io.flic.fliclib.javaclient.enums.ConnectionStatus)
method will be called after this command has been received by the server.
You may have as many connection channels as you wish for a specific Flic Button.channel - java.io.IOExceptionpublic void removeConnectionChannel(ButtonConnectionChannel channel) throws java.io.IOException
ButtonConnectionChannel.Callbacks.onRemoved(io.flic.fliclib.javaclient.ButtonConnectionChannel, io.flic.fliclib.javaclient.enums.RemovedReason) event arrives.channel - java.io.IOExceptionpublic void forceDisconnect(Bdaddr bdaddr) throws java.io.IOException
bdaddr - java.io.IOExceptionpublic void setTimer(int timeoutMillis,
TimerTask timerTask)
throws java.io.IOException
timeoutMillis - timerTask - java.io.IOExceptionpublic void runOnHandleEventsThread(TimerTask task) throws java.io.IOException
task - java.io.IOExceptionpublic void handleEvents()
throws java.io.IOException
java.io.IOException