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 java.util.UUID |
METABOOT_SERVICE
UUID identifying MetaBoot boards.
|
static java.util.UUID |
METAWEAR_GATT_SERVICE
UUID identifying the MetaWear GATT service and the advertising UUID.
|
static java.util.UUID |
METAWEAR_NOTIFY_CHAR
Deprecated.
Not needed by developers
|
Modifier and Type | Method and Description |
---|---|
bolts.Task<java.lang.Boolean> |
checkForFirmwareUpdateAsync()
Checks if there is a newer version of the firmware available for your board.
|
bolts.Task<java.lang.Void> |
connectAsync()
Establishes a Bluetooth Low Energy connection to the MetaWear board
|
bolts.Task<java.lang.Void> |
connectAsync(long delay)
Establishes a Bluetooth Low Energy connection to the MetaWear board
|
bolts.Task<java.lang.Void> |
connectWithRetryAsync(int retries)
Establishes a Bluetooth Low Energy connection to the MetaWear board
|
bolts.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(java.io.InputStream ins)
Restore serialized state from the provided input stream
|
bolts.Task<java.lang.Void> |
disconnectAsync()
Disconnects from the board and cancels pending
connectAsync() tasks |
bolts.Task<java.io.File> |
downloadFirmwareAsync(java.lang.String version)
Deprecated.
Since v3.5.0, use
downloadFirmwareUpdateFilesAsync(String) instead |
bolts.Task<java.util.List<java.io.File>> |
downloadFirmwareUpdateFilesAsync()
Retrieves the files needed to update the board to the latest available firmware.
|
bolts.Task<java.util.List<java.io.File>> |
downloadFirmwareUpdateFilesAsync(java.lang.String version)
Retrieves the files needed to update the board to the specific firmware version.
|
bolts.Task<java.util.List<java.io.File>> |
downloadFirmwareUpdateFilesAsyncV2()
Retrieves the files needed to update the board to the latest available firmware.
|
bolts.Task<java.util.List<java.io.File>> |
downloadFirmwareUpdateFilesAsyncV2(java.lang.String version)
Variant of
downloadFirmwareUpdateFilesAsyncV2() that lets the caller specify which firmware version to download |
bolts.Task<java.io.File> |
downloadLatestFirmwareAsync()
Deprecated.
Since v3.5.0, use
downloadFirmwareUpdateFilesAsync() instead |
bolts.Task<org.json.JSONObject> |
dumpModuleInfo(org.json.JSONObject partial)
Queries all info registers.
|
bolts.Task<java.lang.String> |
findLatestAvailableFirmwareAsync()
Checks if a newer firmware version is available for the current board.
|
java.lang.String |
getMacAddress()
Retrieves the MAC address of the board
|
Model |
getModel()
Determines the board model of the currently connected device
|
java.lang.String |
getModelString()
Same behavior as
getModel() except the returned value is a friendly name rather than an enum |
<T extends MetaWearBoard.Module> |
getModule(java.lang.Class<T> moduleClass)
Retrieves a reference to the requested module if supported.
|
<T extends MetaWearBoard.Module> |
getModuleOrThrow(java.lang.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
|
bolts.Task<java.lang.Byte> |
readBatteryLevelAsync()
Reads the battery level characteristic
|
bolts.Task<DeviceInformation> |
readDeviceInformationAsync()
Reads supported characteristics from the Device Information service
|
bolts.Task<java.lang.Integer> |
readRssiAsync()
Reads the current RSSI value
|
void |
serialize()
Serialize object state and write the state to the local disk
|
void |
serialize(java.io.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 java.util.UUID METAWEAR_GATT_SERVICE
@Deprecated static final java.util.UUID METAWEAR_NOTIFY_CHAR
static final java.util.UUID METABOOT_SERVICE
Model getModel()
java.lang.String getModelString()
getModel()
except the returned value is a friendly name rather than an enumjava.lang.String getMacAddress()
bolts.Task<java.lang.Integer> readRssiAsync()
bolts.Task<java.lang.Byte> readBatteryLevelAsync()
bolts.Task<DeviceInformation> readDeviceInformationAsync()
bolts.Task<java.util.List<java.io.File>> downloadFirmwareUpdateFilesAsync(java.lang.String version)
version
- Firmware revision to download, null to retrieve the latest versionbolts.Task<java.util.List<java.io.File>> downloadFirmwareUpdateFilesAsync()
bolts.Task<java.util.List<java.io.File>> downloadFirmwareUpdateFilesAsyncV2()
inMetaBootMode()
.bolts.Task<java.util.List<java.io.File>> downloadFirmwareUpdateFilesAsyncV2(java.lang.String version)
downloadFirmwareUpdateFilesAsyncV2()
that lets the caller specify which firmware version to downloadversion
- Firmware revision to download, null to retrieve the latest versionbolts.Task<java.lang.String> findLatestAvailableFirmwareAsync()
@Deprecated bolts.Task<java.io.File> downloadFirmwareAsync(java.lang.String version)
downloadFirmwareUpdateFilesAsync(String)
insteadversion
- Firmware revision to download, null to retrieve the latest version@Deprecated bolts.Task<java.io.File> downloadLatestFirmwareAsync()
downloadFirmwareUpdateFilesAsync()
insteadbolts.Task<java.lang.Boolean> checkForFirmwareUpdateAsync()
bolts.Task<java.lang.Void> connectAsync()
bolts.Task<java.lang.Void> connectWithRetryAsync(int retries)
retries
- Number of retry attempts before completing the task with an errorbolts.Task<java.lang.Void> connectAsync(long delay)
delay
- How long to wait (in milliseconds) before attempting to connectbolts.Task<java.lang.Void> disconnectAsync()
connectAsync()
tasksvoid onUnexpectedDisconnect(MetaWearBoard.UnexpectedDisconnectHandler handler)
handler
- Handler for unexpected disconnectsboolean isConnected()
boolean inMetaBootMode()
<T extends MetaWearBoard.Module> T getModule(java.lang.Class<T> moduleClass)
T
- Runtime type the return value is casted asmoduleClass
- Module class to lookup<T extends MetaWearBoard.Module> T getModuleOrThrow(java.lang.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 modebolts.Task<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 java.io.IOException
java.io.IOException
- If the internal OutputStream throws an exceptionvoid serialize(java.io.OutputStream outs) throws java.io.IOException
outs
- Output stream to write tojava.io.IOException
- If the provided OutputStream throws an exceptionvoid deserialize() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
- If the internal InputStream throws an exceptionjava.lang.ClassNotFoundException
- Class of a serialized object cannot be foundvoid deserialize(java.io.InputStream ins) throws java.io.IOException, java.lang.ClassNotFoundException
ins
- Input stream to read fromjava.io.IOException
- If the provided InputStream throws an exceptionjava.lang.ClassNotFoundException
- Class of a serialized object cannot be foundbolts.Task<org.json.JSONObject> dumpModuleInfo(org.json.JSONObject partial)
partial
- Map of previously queries module info results, set to null to query all modules