public interface MetaWearController
Modifier and Type | Interface and Description |
---|---|
static class |
MetaWearController.DeviceCallbacks
Callbacks for general Bluetooth Le events
|
static interface |
MetaWearController.ModuleCallbacks
Callback functions for MetaWear specific events.
|
static interface |
MetaWearController.ModuleController
Generic type for classes that communicate with a MetaWear module
|
Modifier and Type | Method and Description |
---|---|
MetaWearController |
addDeviceCallback(MetaWearController.DeviceCallbacks callback)
Add a device callback for the broadcast receiver
|
MetaWearController |
addModuleCallback(MetaWearController.ModuleCallbacks callback)
Add a module callback for the broadcast receiver
|
void |
clearCallbacks()
Remove all callbacks associated with this controller
|
void |
close(boolean notify)
Immediately close the connection to the board this controller is attached to
|
void |
close(boolean notify,
boolean wait)
Deprecated.
As of v1.4, use the
waitToClose(boolean) method instead |
void |
connect()
Connect to the board this controller is attached to
|
MetaWearController.ModuleController |
getModuleController(Module module)
Get the controller for the desired module.
|
boolean |
isConnected()
Gets the connection statue to a board
|
void |
readBatteryLevel()
Reads the battery level characteristic.
|
void |
readDeviceInformation()
Reads general device information from the MetaWear board.
|
void |
readRemoteRSSI()
Reads the remote RSSI value of the connected device.
|
void |
reconnect(boolean notify)
Reset the connection to the board this controller is attached to
|
void |
removeDeviceCallback(MetaWearController.DeviceCallbacks callback)
Remove specific device callback
|
void |
removeModuleCallback(MetaWearController.ModuleCallbacks callback)
Remove specific module callback
|
void |
setRetainState(boolean retain)
Sets how to handle the device state when the board disconnects.
|
void |
waitToClose(boolean notify)
Wait for queued BLE commands to finish communicating with the board before closing
the connection
|
MetaWearController.ModuleController getModuleController(Module module)
module
- Module to controlvoid readDeviceInformation()
void readBatteryLevel()
MetaWearController.DeviceCallbacks.receivedGATTCharacteristic(com.mbientlab.metawear.api.GATT.GATTCharacteristic, byte[])
callback
function will be called with the BATTERY_LEVEL GATT characteristicBattery
void readRemoteRSSI()
MetaWearController.DeviceCallbacks.receivedRemoteRSSI(int)
callback function will be
called with the RSSI value.MetaWearController addModuleCallback(MetaWearController.ModuleCallbacks callback)
callback
- Module callback to addMetaWearController addDeviceCallback(MetaWearController.DeviceCallbacks callback)
callback
- Device callback to addvoid clearCallbacks()
void removeModuleCallback(MetaWearController.ModuleCallbacks callback)
callback
- void removeDeviceCallback(MetaWearController.DeviceCallbacks callback)
callback
- void setRetainState(boolean retain)
MetaWearBleService#getMetaWearController(android.bluetooth.BluetoothDevice)
and reconnected to the board via the connect()
functionretain
- False if internal state should be discarded when the device disconnectsvoid connect()
void close(boolean notify)
notify
- True to make a call to the MetaWearController.DeviceCallbacks.disconnected()
callback function@Deprecated void close(boolean notify, boolean wait)
waitToClose(boolean)
method insteadnotify
- True to make a call to the MetaWearController.DeviceCallbacks.disconnected()
callback functionwait
- True if any pending commands should be broadcasted before closing.
Any commands queued after this function call are ignoredvoid waitToClose(boolean notify)
notify
- True to make a call to the MetaWearController.DeviceCallbacks.disconnected()
call back functionvoid reconnect(boolean notify)
notify
- True to make a call to the MetaWearController.DeviceCallbacks.disconnected()
callback functionboolean isConnected()