[ English | 简体中文 ]
Network Service API
Cellular network registration, signal strength, operator information, etc.
Header: #include <tapi_network.h>
openvela Implementation Notes
- Network selection mode: Supports automatic selection (
select_auto) and manual selection (select_manual) - Scanning:
tapi_network_scanscans for available network operators - Cell information:
get_serving_cellinfosretrieves the current serving cell,get_neighbouring_cellinfosretrieves neighboring cells - SIM identification: Most interfaces include a
slot_idparameter to distinguish network state across different SIM slots - Event subscription:
tapi_network_register/tapi_network_unregistermonitor registration state and signal strength changes
Network Selection and Scanning
tapi_network_select_auto
int tapi_network_select_auto(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Automatically select a network.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_select_manual
int tapi_network_select_manual(tapi_context context, int slot_id, int event_id, tapi_operator_info* network, tapi_async_function p_handle);
Manually select a network.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.networkNetwork information.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_scan
int tapi_network_scan(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Scan for available network operators.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Cell Information
tapi_network_get_serving_cellinfos
int tapi_network_get_serving_cellinfos(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Get serving cell information.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_get_neighbouring_cellinfos
int tapi_network_get_neighbouring_cellinfos(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Get neighboring cell information.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Voice Network State
tapi_network_is_voice_registered
int tapi_network_is_voice_registered(tapi_context context, int slot_id, bool* out);
Query whether voice service is registered.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_is_voice_emergency_only
int tapi_network_is_voice_emergency_only(tapi_context context, int slot_id, bool* out);
Query whether only emergency calls are available.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_get_voice_network_type
int tapi_network_get_voice_network_type(tapi_context context, int slot_id, tapi_network_type* out);
Get the voice network type.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_is_voice_roaming
int tapi_network_is_voice_roaming(tapi_context context, int slot_id, bool* out);
Query whether voice is roaming.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
Operator Information
tapi_network_get_display_name
int tapi_network_get_display_name(tapi_context context, int slot_id, char** out);
Get the operator display name.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
Signal Strength
tapi_network_get_signalstrength
int tapi_network_get_signalstrength(tapi_context context, int slot_id, tapi_signal_strength* out);
Get the signal strength.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
Registration Information
tapi_network_get_registration_info
int tapi_network_get_registration_info(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Get network registration information.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Reporting Rate and Events
tapi_network_set_cell_info_list_rate
int tapi_network_set_cell_info_list_rate(tapi_context context, int slot_id, int event_id, u_int32_t period, tapi_async_function p_handle);
Set the cell information list reporting rate.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID for callback matching.periodPeriod in milliseconds.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_register
int tapi_network_register(tapi_context context, int slot_id, tapi_indication_msg msg, void* user_obj, tapi_async_function p_handle);
Register for network event notifications.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).msgMessage type.user_objUser object pointer.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_unregister
int tapi_network_unregister(tapi_context context, int watch_id);
Unregister from network event notifications.
Parameters:
contextTelephony context handle.watch_idWatch ID (used to cancel the subscription).
Returns:
Returns 0 on success, or a negative error code on failure.
MCC / MNC
tapi_network_get_mcc
int tapi_network_get_mcc(tapi_context context, int slot_id, char** mcc);
Get the Mobile Country Code.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).mccMobile Country Code.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_get_mnc
int tapi_network_get_mnc(tapi_context context, int slot_id, char** mnc);
Get the Mobile Network Code.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).mncMobile Network Code.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_get_operator_status
int tapi_network_get_operator_status(tapi_context context, int slot_id, int* out);
Get the operator status.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_get_operator_name
int tapi_network_get_operator_name(tapi_context context, int slot_id, char** out);
Get the operator name.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_network_get_reg_state
int tapi_network_get_reg_state(tapi_context context, int slot_id, tapi_registration_state* out);
Get the network registration state.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.