Package: android.hardware.contexthub@1.0
IContexthub
interface IContexthub
The Context Hub HAL provides an interface to a separate low-power processing domain that has direct access to contextual information, such as sensors.Native applications that run within a context hub are known as nanoapps, and they execute within the Context Hub Runtime Environment(CHRE), which is standardized via the CHRE API, defined elsewhere.
Methods
getHubs
getHubs ()
generates (vec<ContextHub> hubs)
Enumerate all available context hubs on the system.
Details |
Generates |
hubs
|
list of hubs on this system.
|
|
registerCallback
registerCallback (uint32_t hubId, IContexthubCallback cb)
generates (Result result)
Register a callback for the HAL implementation to send asynchronous messages to the service from a context hub.There can be a maximum of one callback registered with the HAL.A call to this function when a callback has already been registered must override the previous registration.
Details |
Parameters |
hubId
|
identifier for the hub callback an implementation of the IContextHubCallbacks
|
cb
|
|
|
Generates |
result
|
OK on success BAD_VALUE if parameters are not sane
|
|
sendMessageToHub
sendMessageToHub (uint32_t hubId, ContextHubMsg msg)
generates (Result result)
Details |
Parameters |
hubId
|
identifier for hub to send message to msg message to be sent
|
msg
|
|
|
Generates |
result
|
OK if successful, error code otherwise BAD_VALUE if parameters are not sane TRANSACTION_FAILED if message send failed
|
|
loadNanoApp
loadNanoApp (uint32_t hubId, NanoAppBinary appBinary, uint32_t transactionId)
generates (Result result)
Loads a nanoApp.After loading, the nanoApp's init method must be called.After the init method for nanoApp returns success, this must be indicated to the service by an asynchronous call to handleTxnResult.
Loading a nanoapp must not take more than 30 seconds.
Depending on the implementation, nanoApps loaded via this API may or may not persist across reboots of the hub.If they do persist, the implementation must initially place nanoApps in the disabled state upon a reboot, and not start them until a call is made to enableNanoApp().In this case, the app must also be unloaded upon a factory reset of the device.
Details |
Parameters |
hubId
|
identifer of the contextHub appBinary contains the binary representation of the nanoApp, plus metadata transactionId transactionId for this call
|
appBinary
|
|
transactionId
|
|
|
Generates |
result
|
OK if transation started BAD_VALUE if parameters are not sane TRANSACTION_PENDING if hub is busy with another load/unload transaction TRANSACTION_FAILED if load failed synchronously
|
|
unloadNanoApp
unloadNanoApp (uint32_t hubId, uint64_t appId, uint32_t transactionId)
generates (Result result)
Unloads a nanoApp.Before the unload, the apps deinit method is called.After this, success must be indicated to the service through an asynchronous call to handleTxnResult.
Unloading a nanoapp must not take more than 5 seconds.
Details |
Parameters |
hubId
|
identifer of the contextHub appId appIdentifier returned by the HAL msg message to be sent
|
appId
|
|
transactionId
|
|
|
Generates |
result
|
OK if transation started BAD_VALUE if parameters are not sane TRANSACTION_PENDING if hub is busy with another load/unload transaction TRANSACTION_FAILED if unload failed synchronously
|
|
enableNanoApp
enableNanoApp (uint32_t hubId, uint64_t appId, uint32_t transactionId)
generates (Result result)
Enables a nanoApp.The app's init method is called.After this, success must be indicated to the service through an asynchronous message.
Enabling a nanoapp must not take more than 5 seconds.
Details |
Parameters |
hubId
|
identifer of the contextHub appId appIdentifier returned by the HAL msg message to be sent
|
appId
|
|
transactionId
|
|
|
Generates |
result
|
OK if transation started BAD_VALUE if parameters are not sane TRANSACTION_PENDING if hub is busy with another load/unload transaction FAILED_TRANSACTION if load fails immediately
|
|
disableNanoApp
disableNanoApp (uint32_t hubId, uint64_t appId, uint32_t transactionId)
generates (Result result)
Disables a nanoApp.The app's deinit method is called.After this, success must be indicated to the service through an asynchronous message.
Disabling a nanoapp must not take more than 5 seconds.
Details |
Parameters |
hubId
|
identifer of the contextHub appId appIdentifier returned by the HAL msg message to be sent
|
appId
|
|
transactionId
|
|
|
Generates |
result
|
OK if transation started BAD_VALUE if parameters are not sane TRANSACTION_PENDING if hub is busy with another load/unload transaction FAILED_TRANSACTION if load fails immediately
|
|
queryApps
queryApps (uint32_t hubId)
generates (Result result)
Queries for Loaded apps on the hub
Details |
Parameters |
hubId
|
identifer of the contextHub
|
|
Generates |
|