Package com.microej.facer.sync.bluetooth
Class BluetoothMessageHandler
- java.lang.Object
-
- com.microej.layout.sync.MessageHandler
-
- com.microej.facer.sync.bluetooth.BluetoothMessageHandler
-
public class BluetoothMessageHandler extends com.microej.layout.sync.MessageHandlerImplements the server-side logic of the Facer watchface sync, using a bluetooth connection.When a Facer client (i.e., the Facer mobile application) will connect to the watch using bluetooth, this class will handle incoming messages and answer accordingly.
-
-
Constructor Summary
Constructors Constructor Description BluetoothMessageHandler(com.microej.layout.sync.FileWriter fileWriter, com.microej.layout.sync.SyncListener listener, ej.bluetooth.BluetoothService service)Creates a server for handling the messages sent by a remote Facer client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidsendMessage(byte[] data)voidstartListening()Starts the server.voidstopListening()Stops the server.
-
-
-
Constructor Detail
-
BluetoothMessageHandler
public BluetoothMessageHandler(com.microej.layout.sync.FileWriter fileWriter, com.microej.layout.sync.SyncListener listener, ej.bluetooth.BluetoothService service) throws ej.bluetooth.util.AttributeNotFoundExceptionCreates a server for handling the messages sent by a remote Facer client.The specified
BluetoothServicemust provide the characteristics defined in the Facer GATT Service specification.- Parameters:
fileWriter- the instance to use for writing the watchface files to the device memorylistener- the instance to notify on watchface sync eventsservice- the bluetooth service- Throws:
ej.bluetooth.util.AttributeNotFoundException- if the specified bluetooth service does not provide the mandatory Facer characteristics.
-
-
Method Detail
-
startListening
public void startListening()
Starts the server.After calling this method, the server will start listening for write requests from the remote client.
-
stopListening
public void stopListening()
Stops the server.After calling this method, the server will stop listening for write requests from the remote client.
-
sendMessage
protected void sendMessage(byte[] data) throws java.io.IOException- Specified by:
sendMessagein classcom.microej.layout.sync.MessageHandler- Throws:
java.io.IOException
-
-