public class RuntimeConnection
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RuntimeConnection.RC_CMD
Defines the compatible commands of the Tact-Tiles API
RuntimeConnection clients. |
static class |
RuntimeConnection.RS_CMD
Defines the compatible commands of the Tact-Tiles Runtime Service app.
|
Constructor and Description |
---|
RuntimeConnection()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
connect(Context appContext)
Connects this adapter to the Tact-Tiles runtime service,
which handles the bluetooth communication and device access, starting it if necessary.
|
void |
disconnect()
Properly unregister this client.
|
protected void |
onIPCMessage(int type,
Bundle data)
Called when this client receives a response from the service runtime.
|
protected void |
onServiceConnected()
Called when this adapter successfully connects to the service.
|
protected void |
onServiceDisconnected()
Called when this adapter is disconnected from the service.
|
void |
requestBTDiscovery()
Request a rescan of the available devices.
|
void |
requestFocus(Device device)
Request that all bluetooth messages received from a Tact-Tiles device to be redirected to this adapter.
|
static void |
sendAnonymousIPCMessage(Context appContext,
int type,
Bundle data,
Handler handler)
Sends a request to the runtime service without the need to setup a new
RuntimeConnection . |
void |
sendBTMessage(byte[] msg)
Sends a request to send a bluetooth message to the device.
|
protected void |
sendIPCMessage(int type,
Bundle data)
Sends a request to the runtime service.
|
void |
vibratePhone(long[] pattern)
Vibrates the phone.
|
public static void sendAnonymousIPCMessage(Context appContext, int type, Bundle data, Handler handler)
RuntimeConnection
.appContext
- The current context of this application.type
- Type of the request, defined by RuntimeConnection.RS_CMD
.data
- Bundle with the command arguments.handler
- The handler for the response message, if any.public void vibratePhone(long[] pattern)
pattern
- Pattern as defined by alternating off-on values in milliseconds.protected void onIPCMessage(int type, Bundle data)
type
- Type of the request, defined by RuntimeConnection.RC_CMD
.data
- Bundle with the command arguments.protected void sendIPCMessage(int type, Bundle data)
type
- Type of the request, defined by RuntimeConnection.RS_CMD
.data
- Bundle with the command arguments.public void sendBTMessage(byte[] msg)
msg
- The message to be sent.public boolean connect(Context appContext)
appContext
- The current context of this application.public void disconnect()
public void requestFocus(Device device)
device
- The device to be registered.public void requestBTDiscovery()
protected void onServiceConnected()
protected void onServiceDisconnected()