C/C++ API Reference
Loading...
Searching...
No Matches
pw_chre

Oveview

Android Context Hub Runtime Environment backend. Main docs: https://pigweed.dev/pw_chre.

Classes

struct  pw::chre::NanoappMessage
 
struct  pw::chre::MessageToAp
 

Typedefs

using pw::chre::MessageToApContext = const void *
 

Functions

void pw::chre::Init ()
 
void pw::chre::Deinit ()
 
void pw::chre::RunEventLoop ()
 
void pw::chre::StopEventLoop ()
 
void pw::chre::SendMessageToNanoapp (NanoappMessage message)
 
void pw::chre::FreeMessageToAp (MessageToApContext context)
 
void pw::chre::SetEstimatedHostTimeOffset (int64_t offset)
 
bool pw::chre::SendMessageToAp (MessageToAp message)
 

Variables

uint64_t pw::chre::NanoappMessage::nano_app_id
 The id of the nanoapp this message is sent to.
 
uint32_t pw::chre::NanoappMessage::message_type
 The type of message this is.
 
uint16_t pw::chre::NanoappMessage::host_endpoint
 The id of the host on the AP that sent this request.
 
const uint8_t * pw::chre::NanoappMessage::data
 The actual message data.
 
size_t pw::chre::NanoappMessage::length
 The size in bytes of the message data.
 
uint64_t pw::chre::MessageToAp::nanoapp_id
 The id of the nanoapp sending the message.
 
uint32_t pw::chre::MessageToAp::message_type
 The type of the message.
 
uint32_t pw::chre::MessageToAp::app_permissions
 
uint32_t pw::chre::MessageToAp::message_permissions
 
uint16_t pw::chre::MessageToAp::host_endpoint
 The id of the client that this message should be delivered to on the host.
 
bool pw::chre::MessageToAp::woke_host
 
const uint8_t * pw::chre::MessageToAp::data
 
size_t pw::chre::MessageToAp::length
 The length of data in bytes.
 
MessageToApContext pw::chre::MessageToAp::chre_context
 

Typedef Documentation

◆ MessageToApContext

using pw::chre::MessageToApContext = typedef const void*

This is a token representing a message that CHRE allocated. It must be passed to FreeMessageToAp when the message is finished.

Function Documentation

◆ Deinit()

void pw::chre::Deinit ( )

Teardown the CHRE environment. This must be called after Init and after the event loop has been stopped.

◆ FreeMessageToAp()

void pw::chre::FreeMessageToAp ( MessageToApContext  context)

Free a message that CHRE created to send to the AP (via SendMessageToAp). This function must be called after the message is finishd being used. After this function is called, the message data must not be accessed. This can be called from any thread.

Parameters
[in]contextThe message being freed.

◆ Init()

void pw::chre::Init ( )

Initialize the CHRE environment and load any static nanoapps that exist. This must be called before the event loop has been started.

◆ RunEventLoop()

void pw::chre::RunEventLoop ( )

Run the CHRE event loop. This function will not return until StopEventLoop is called.

◆ SendMessageToAp()

bool pw::chre::SendMessageToAp ( MessageToAp  message)

CHRE calls this method to send a message to the Application Processor (AP). The client must implement this method, and the client is responsible for calling FreeMessageToAp once they are finished with the message.

Parameters
[in]messageThe message to be sent.
[out]boolWhether this method was successful.

◆ SendMessageToNanoapp()

void pw::chre::SendMessageToNanoapp ( NanoappMessage  message)

Send a message to a nano app. This can be called from any thread.

Parameters
[in]messageThe message being send to the nano app.

◆ SetEstimatedHostTimeOffset()

void pw::chre::SetEstimatedHostTimeOffset ( int64_t  offset)

Set the estimated offset between the AP time and CHRE's time.

Parameters
[in]offsetThe offset time in nanoseconds.

◆ StopEventLoop()

void pw::chre::StopEventLoop ( )

Stop the CHRE event loop. This can be called from any thread.

Variable Documentation

◆ chre_context

MessageToApContext pw::chre::MessageToAp::chre_context

The context of the message, used to free the message when the client is finished sending it.

◆ data

const uint8_t* pw::chre::MessageToAp::data

The underlying data of the message. This is owned by chre_context and should not be accessed after the message has been freed.

◆ woke_host

bool pw::chre::MessageToAp::woke_host

Whether CHRE is responsible for waking the AP. If this is true, then the client must wake the AP in SendMessageToAp before sending this message.