Utility Functions#

Utility functions for applications on SoC.

Functions#

sl_status_t
sl_bt_pop_event(sl_bt_msg_t *event)
void
void
sl_bt_handle_command(uint32_t hdr, void *data)
sl_status_t
sl_bt_external_signal(uint32_t signals)

Signal the Bluetooth stack that an external event has happened.

void
sl_bt_send_system_error(uint16_t reason, uint8_t data_len, const uint8_t *data)
uint8_t
sl_bt_is_sensitive_message(uint32_t message_header)
void
sl_bt_send_rsp_user_message_to_target(uint16_t result, uint8_t data_len, uint8_t *data)
void
sl_bt_send_evt_user_message_to_host(uint8_t data_len, uint8_t *data)

Function Documentation#

sl_bt_pop_event#

sl_status_t sl_bt_pop_event (sl_bt_msg_t * event)
Parameters
N/Aevent

the pointer for storing the new event

Get the next event that requires processing by user application. Application is not blocked if no event is waiting.

Returns

  • SL_STATUS_OK if a new event is returned, or SL_STATUS_NOT_FOUND if no event is waiting; other value indicates an error occurred


Definition at line 15486 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_event_pending#

bool sl_bt_event_pending (void )
Parameters
N/A

Check whether events are in queue pending for processing. Call sl_bt_pop_event to process pending events.

Returns

  • true if event is pending; false otherwise


Definition at line 15494 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_event_pending_len#

uint32_t sl_bt_event_pending_len (void )
Parameters
N/A

Check whether events are in queue pending for processing and return the next event length in bytes if events are pending. Call sl_bt_pop_event to process pending events.

Returns

  • the next event length if event is pending; 0 otherwise


Definition at line 15503 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_run#

void sl_bt_run ()

Run the Bluetooth stack to process scheduled tasks. Events for user application may be generated as a result of this operation.


Definition at line 15510 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_handle_command#

void sl_bt_handle_command (uint32_t hdr, void * data)
Parameters
N/Ahdr

the command header

N/Adata

the command payload in a byte array

Handle an API command in binary format.

This is provided to NCP target applications for processing commands received from NCP transport. This function is a synonym for a generic BGAPI function sl_bgapi_handle_command. If the NCP application uses an RTOS, use the sequence documented in sl_bgapi_handle_command to handle the BGAPI command in a thread-safe manner.


Definition at line 15524 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_get_command_response#

static sl_bt_msg_t * sl_bt_get_command_response ()

Get the response to the command currently been handled.

This is provided to NCP target applications for processing commands received from NCP transport. This function is a synonym for a generic BGAPI function sl_bgapi_get_command_response.


Definition at line 15533 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_priority_handle#

void sl_bt_priority_handle (void )
Parameters
N/A

Priority message handler function if user application requires the use of PendSV interrupt.

If scheduler_callback function pointer in configuration struct is something else than NULL, then stack will not install its own PendSV IRQ handler but instead uses callback/handler functions.

When application receives call to the scheduler_callback function it must schedule the call to gecko_priority_handle function to later time to run on high priority thread. This callback may happen inside radio IRQ so processing must not block and has to happen as fast as possible.

Recommended implementation: High priority thread is loop that waits on binary semaphore and calls gecko_priority_handler. The scheduler_callback is simple function that only signals the semaphore.


Definition at line 15556 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_external_signal#

sl_status_t sl_bt_external_signal (uint32_t signals)

Signal the Bluetooth stack that an external event has happened.

Parameters
N/Asignals

is a bitmask defining active signals that are reported back to the application by system_external_signal-event.

Signals can be used to report status changes from interrupt context or from other threads to application. Signals are bits that are automatically cleared after application has been notified.

If the Platform Core Interrupt API has been configured to use the CORE_ATOMIC_METHOD_BASEPRI as the implementation method of atomic sections, this function must not be called from an interrupt handler with a priority higher than CORE_ATOMIC_BASE_PRIORITY_LEVEL.

Returns

  • SL_STATUS_OK if the operation is successful, SL_STATUS_NO_MORE_RESOURCE indicating the request could not be processed due to resource limitation at the moment, or SL_STATUS_INVALID_STATE when the on-demand start feature is used and the stack is currently stopped.


Definition at line 15577 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_send_system_awake#

void sl_bt_send_system_awake ()

Signals stack to send system_awake event when application received wakeup signal.


Definition at line 15583 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_send_system_error#

void sl_bt_send_system_error (uint16_t reason, uint8_t data_len, const uint8_t * data)
Parameters
N/Areason
N/Adata_len
N/Adata

Signals stack to send system_error event when in case of an error.


Definition at line 15588 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_is_sensitive_message#

uint8_t sl_bt_is_sensitive_message (uint32_t message_header)
Parameters
[in]message_header

The header of the SL_BT_API message

Tells if a SL_BT_API message is sensitive.

Returns

  • 1 if the message is sensitive; otherwise 0


Definition at line 15596 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_send_rsp_user_message_to_target#

void sl_bt_send_rsp_user_message_to_target (uint16_t result, uint8_t data_len, uint8_t * data)
Parameters
N/Aresult
N/Adata_len
N/Adata

Sends the NCP host a message whose SL_BT_MSG_ID is gecko_rsp_user_message_to_target_id.

This a utility helping a NCP host and target application to exchange user data. Do not use it in SoC mode.


Definition at line 15605 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_send_evt_user_message_to_host#

void sl_bt_send_evt_user_message_to_host (uint8_t data_len, uint8_t * data)
Parameters
N/Adata_len
N/Adata

Sends the NCP host a message whose SL_BT_MSG_ID is gecko_evt_user_message_to_host_id.

This a utility helping a NCP host and target application to exchange user data. Do not use it in SoC mode.


Definition at line 15614 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_send_rsp_user_manage_event_filter#

void sl_bt_send_rsp_user_manage_event_filter (uint16_t result)
Parameters
N/Aresult

Sends the NCP host a message whose SL_BT_MSG_ID is gecko_rsp_user_manage_event_filter_id.

This a utility helping a NCP host and target application to manage event filter. Do not use it in SoC mode.


Definition at line 15623 of file /mnt/raid/workspaces/ws.XK183xwsq/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h