public final class ContextHubManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ContextHubManager.Callback
An interface to receive asynchronous communication from the context hub.
|
static interface |
ContextHubManager.ICallback
Deprecated.
Use
ContextHubManager.Callback instead. |
Constructor and Description |
---|
ContextHubManager(Context context,
Looper mainLooper) |
Modifier and Type | Method and Description |
---|---|
int[] |
findNanoAppOnHub(int hubHandle,
NanoAppFilter filter)
Find a specified nano app on the system
|
int[] |
getContextHubHandles()
Get a handle to all the context hubs in the system
|
ContextHubInfo |
getContextHubInfo(int hubHandle)
Get more information about a specific hub.
|
NanoAppInstanceInfo |
getNanoAppInstanceInfo(int nanoAppHandle)
get information about the nano app instance
NOTE: The returned NanoAppInstanceInfo does _not_ contain correct
information for several fields, specifically:
- getName()
- getPublisher()
- getNeededExecMemBytes()
- getNeededReadMemBytes()
- getNeededWriteMemBytes()
For example, say you call loadNanoApp() with a NanoApp that has
getName() returning "My Name".
|
int |
loadNanoApp(int hubHandle,
NanoApp app)
Load a nano app on a specified context hub.
|
int |
registerCallback(ContextHubManager.Callback callback)
Set a callback to receive messages from the context hub
|
int |
registerCallback(ContextHubManager.Callback callback,
Handler handler)
Set a callback to receive messages from the context hub
|
int |
registerCallback(ContextHubManager.ICallback callback)
Deprecated.
Use
registerCallback(Callback) instead. |
int |
sendMessage(int hubHandle,
int nanoAppHandle,
ContextHubMessage message)
Send a message to a specific nano app instance on a context hub.
|
int |
unloadNanoApp(int nanoAppHandle)
Unload a specified nanoApp
Note that unloading is asynchronous.
|
int |
unregisterCallback(ContextHubManager.Callback callback)
Unregister a callback for receive messages from the context hub.
|
int |
unregisterCallback(ContextHubManager.ICallback callback)
Deprecated.
Use
unregisterCallback(Callback) instead. |
public int[] getContextHubHandles()
public ContextHubInfo getContextHubInfo(int hubHandle)
hubHandle
- Handle (system-wide unique identifier) of a context hub.ContextHubInfo
public int loadNanoApp(int hubHandle, NanoApp app)
hubHandle
- handle of context hub to load the app on.app
- the nanoApp to load on the hubNanoApp
public int unloadNanoApp(int nanoAppHandle)
nanoAppHandle
- handle of the nanoApp to unloadpublic NanoAppInstanceInfo getNanoAppInstanceInfo(int nanoAppHandle)
nanoAppHandle
- handle of the nanoAppInstanceNanoAppInstanceInfo
public int[] findNanoAppOnHub(int hubHandle, NanoAppFilter filter)
hubHandle
- handle of hub to search for nano appfilter
- filter specifying the search criteria for appNanoAppFilter
public int sendMessage(int hubHandle, int nanoAppHandle, ContextHubMessage message)
hubHandle
- handle of the hub to send the message tonanoAppHandle
- handle of the nano app to send tomessage
- Message to be sentContextHubMessage
public int registerCallback(ContextHubManager.Callback callback)
callback
- Callback objectContextHubManager.Callback
@Deprecated public int registerCallback(ContextHubManager.ICallback callback)
registerCallback(Callback)
instead.public int registerCallback(ContextHubManager.Callback callback, Handler handler)
callback
- Callback objecthandler
- Handler objectContextHubManager.Callback
public int unregisterCallback(ContextHubManager.Callback callback)
callback
- method to deregisterContextHubManager.Callback
public int unregisterCallback(ContextHubManager.ICallback callback)
unregisterCallback(Callback)
instead.