[ English | 简体中文 ]
Telephony Cell Broadcast API
Cell Broadcast Service (CBS) provides cell broadcast capabilities over cellular networks, commonly used for receiving government emergency alerts (earthquakes, tsunamis) and carrier announcements.
Header: #include <tapi_cbs.h>
openvela Implementation Notes
- Power control: Enable/disable cell broadcast reception via
set_cell_broadcast_power_on - Topic subscription: Configure broadcast topic ranges (by channel ID) via
set_cell_broadcast_topics - Event callback: Register event callbacks via
tapi_cbs_registerto receive broadcast messages - SIM identification: All interfaces include a
slot_idparameter for multi-SIM devices - Related protocol: Corresponds to the Cell Broadcast procedure defined in 3GPP TS 23.041
Power Control
tapi_sms_set_cell_broadcast_power_on
int tapi_sms_set_cell_broadcast_power_on(tapi_context context, int slot_id, bool enabled);
Enable or disable cell broadcast reception.
Parameters:
contextTelephony context handle.slot_idSIM card slot ID.enabledtrueto enable,falseto disable.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_sms_get_cell_broadcast_power_on
int tapi_sms_get_cell_broadcast_power_on(tapi_context context, int slot_id, bool* enabled);
Query the cell broadcast reception power state.
Parameters:
contextTelephony context handle.slot_idSIM card slot ID.enabledOutput parameter, returns the current power state.
Returns:
Returns 0 on success, or a negative error code on failure.
Topic Subscription
tapi_sms_set_cell_broadcast_topics
int tapi_sms_set_cell_broadcast_topics(tapi_context context, int slot_id, char* topics);
Configure the cell broadcast topic range (channel ID list).
Parameters:
contextTelephony context handle.slot_idSIM card slot ID.topicsTopic string, typically comma-separated channel IDs or ranges (e.g.,"4352-4356,919").
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_sms_get_cell_broadcast_topics
int tapi_sms_get_cell_broadcast_topics(tapi_context context, int slot_id, char** topics);
Query the currently configured cell broadcast topics.
Parameters:
contextTelephony context handle.slot_idSIM card slot ID.topicsOutput parameter, returns the topic string (caller is responsible for freeing).
Returns:
Returns 0 on success, or a negative error code on failure.
Event Subscription
tapi_cbs_register
int tapi_cbs_register(tapi_context context, int slot_id, tapi_indication_msg msg,
void* user_obj, tapi_async_function p_handle);
Register a cell broadcast event callback.
Parameters:
contextTelephony context handle.slot_idSIM card slot ID.msgEvent type to listen for.user_objUser data, passed back to the callback function.p_handleAsynchronous callback function.
Returns:
Returns the event subscription watch ID on success, or a negative error code on failure.