3.5 Synchronous and Asynchronous APIs

Several API calls operate synchronously due to their minimal execution time requirements, including:
  • Reading from internal stack structures
  • Writing to internal stack structures

For instance, the NWK_GetShortAddr() API synchronously returns the short address that the network layer maintains.

On the other hand, tasks that involve sending requests to other nodes in the network always proceed asynchronously to avoid blocking the system’s execution flow on a single-threaded MCU. These asynchronous tasks feature:
  • Longer response times
  • Callbacks to prevent execution blockages

For example, when the application layer needs to initiate the commissioning process, it invokes the BDB_InvokeCommissioningReq(mode) API. The system then calls the corresponding callback after completing the commissioning process. Meanwhile, the application layer is free to perform other tasks, maintaining system responsiveness and efficiency during complex network operations.