public interface MetaWearBoard
Modifier and Type | Interface and Description |
---|---|
static interface |
MetaWearBoard.Module
Sensor, peripheral, or firmware feature
|
static interface |
MetaWearBoard.UnexpectedDisconnectHandler
Handler for when the API is not expecting a disconnect event
|
Modifier and Type | Field and Description |
---|---|
static UUID |
METABOOT_SERVICE
UUID identifying MetaBoot boards.
|
static UUID |
METAWEAR_GATT_SERVICE
UUID identifying the MetaWear GATT service and the advertising UUID.
|
static UUID |
METAWEAR_NOTIFY_CHAR
Deprecated.
Not needed by developers
|
Modifier and Type | Method and Description |
---|---|
Task<Boolean> |
checkForFirmwareUpdateAsync()
Checks if there is a newer version of the firmware available for your board.
|
Task<Void> |
connectAsync()
Establishes a Bluetooth Low Energy connection to the MetaWear board
|
Task<Void> |
connectAsync(long delay)
Establishes a Bluetooth Low Energy connection to the MetaWear board
|
Task<AnonymousRoute[]> |
createAnonymousRoutesAsync()
Reads the current state of the board and creates anonymous routes based on what data is being logged
|
void |
deserialize()
Restore serialized state from the local disk if available
|
void |
deserialize(InputStream ins)
Restore serialized state from the provided input stream
|
Task<Void> |
disconnectAsync()
Disconnects from the board and cancels pending
connectAsync() tasks |
Task<File> |
downloadFirmwareAsync(String version)
Deprecated.
Since v3.5.0, use
downloadFirmwareUpdateFilesAsync(String) instead |
Task<List<File>> |
downloadFirmwareUpdateFilesAsync()
Retrieves the files needed to update the board to the latest available firmware.
|
Task<List<File>> |
downloadFirmwareUpdateFilesAsync(String version)
Retrieves the files needed to update the board to the specific firmware version.
|
Task<File> |
downloadLatestFirmwareAsync()
Deprecated.
Since v3.5.0, use
downloadFirmwareUpdateFilesAsync() instead |
Task<org.json.JSONObject> |
dumpModuleInfo(org.json.JSONObject partial)
Queries all info registers.
|
Task<String> |
findLatestAvailableFirmwareAsync()
Checks if a newer firmware version is available for the current board.
|
String |
getMacAddress()
Retrieves the MAC address of the board
|
Model |
getModel()
Determines the board model of the currently connected device
|
String |
getModelString()
Same behavior as
getModel() except the returned value is a friendly name rather than an enum |
<T extends MetaWearBoard.Module> |
getModule(Class<T> moduleClass)
Retrieves a reference to the requested module if supported.
|
<T extends MetaWearBoard.Module> |
getModuleOrThrow(Class<T> moduleClass)
Retrieves a reference to the requested module if supported, throws a checked exception if the function fails.
|
boolean |
inMetaBootMode()
Checks if the board is in the MetaBoot (bootloader) mode.
|
boolean |
isConnected()
Gets the connection state
|
Observer |
lookupObserver(int id)
Retrieves an observer
|
Route |
lookupRoute(int id)
Retrieves a route
|
void |
onUnexpectedDisconnect(MetaWearBoard.UnexpectedDisconnectHandler handler)
Set a handler for unexpected disconnects
|
Task<Byte> |
readBatteryLevelAsync()
Reads the battery level characteristic
|
Task<DeviceInformation> |
readDeviceInformationAsync()
Reads supported characteristics from the Device Information service
|
Task<Integer> |
readRssiAsync()
Reads the current RSSI value
|
void |
serialize()
Serialize object state and write the state to the local disk
|
void |
serialize(OutputStream outs)
Serialize object state and write the state to the provided output stream
|
void |
tearDown()
Removes all routes and resources allocated on the board (observers, data processors, timers, and loggers)
|
static final UUID METAWEAR_GATT_SERVICE
@Deprecated static final UUID METAWEAR_NOTIFY_CHAR
static final UUID METABOOT_SERVICE
Model getModel()
String getModelString()
getModel()
except the returned value is a friendly name rather than an enumString getMacAddress()
Task<Integer> readRssiAsync()
Task<Byte> readBatteryLevelAsync()
Task<DeviceInformation> readDeviceInformationAsync()
Task<List<File>> downloadFirmwareUpdateFilesAsync(String version)
version
- Firmware revision to download, null to retrieve the latest versionTask<List<File>> downloadFirmwareUpdateFilesAsync()
Task<String> findLatestAvailableFirmwareAsync()
@Deprecated Task<File> downloadFirmwareAsync(String version)
downloadFirmwareUpdateFilesAsync(String)
insteadversion
- Firmware revision to download, null to retrieve the latest version@Deprecated Task<File> downloadLatestFirmwareAsync()
downloadFirmwareUpdateFilesAsync()
insteadTask<Boolean> checkForFirmwareUpdateAsync()
Task<Void> connectAsync()
Task<Void> connectAsync(long delay)
delay
- How long to wait (in milliseconds) before attempting to connectTask<Void> disconnectAsync()
connectAsync()
tasksvoid onUnexpectedDisconnect(MetaWearBoard.UnexpectedDisconnectHandler handler)
handler
- Handler for unexpected disconnectsboolean isConnected()
boolean inMetaBootMode()
<T extends MetaWearBoard.Module> T getModule(Class<T> moduleClass)
T
- Runtime type the return value is casted asmoduleClass
- Module class to lookup<T extends MetaWearBoard.Module> T getModuleOrThrow(Class<T> moduleClass) throws UnsupportedModuleException
T
- Runtime type the return value is casted asmoduleClass
- ModuleId class to lookupUnsupportedModuleException
- If the requested module is not supported or the board is in MetaBoot modeTask<AnonymousRoute[]> createAnonymousRoutesAsync()
Route lookupRoute(int id)
id
- Numerical ID to look upObserver lookupObserver(int id)
id
- Numerical ID to look upvoid tearDown()
void serialize() throws IOException
IOException
- If the internal OutputStream throws an exceptionvoid serialize(OutputStream outs) throws IOException
outs
- Output stream to write toIOException
- If the provided OutputStream throws an exceptionvoid deserialize() throws IOException, ClassNotFoundException
IOException
- If the internal InputStream throws an exceptionClassNotFoundException
- Class of a serialized object cannot be foundvoid deserialize(InputStream ins) throws IOException, ClassNotFoundException
ins
- Input stream to read fromIOException
- If the provided InputStream throws an exceptionClassNotFoundException
- Class of a serialized object cannot be foundTask<org.json.JSONObject> dumpModuleInfo(org.json.JSONObject partial)
partial
- Map of previously queries module info results, set to null to query all modules