Developer World
Spresense SDK Library v3.2.0-ebc0364
LTE Library API

LTE library for using LTE network. More...

Collaboration diagram for LTE Library API:

Modules

 LTE LwM2M API definitions
 LTE LwM2M API Definitions.
 

Files

file  lte_api.h
 

Macros

#define EXTERN   extern "C"
 

Functions

int lte_initialize (void)
 
int lte_finalize (void)
 
int lte_set_report_restart (restart_report_cb_t restart_callback)
 
int lte_power_on (void)
 
int lte_power_off (void)
 
int lte_radio_on_sync (void)
 
int lte_radio_off_sync (void)
 
int lte_get_netinfo_sync (uint8_t pdn_num, FAR lte_netinfo_t *info)
 
int lte_activate_pdn_sync (FAR lte_apn_setting_t *apn, FAR lte_pdn_t *pdn)
 
int lte_activate_pdn (FAR lte_apn_setting_t *apn, activate_pdn_cb_t callback)
 
int lte_activate_pdn_cancel (void)
 
int lte_deactivate_pdn_sync (uint8_t session_id)
 
int lte_data_allow_sync (uint8_t session_id, uint8_t allow, uint8_t roaming_allow)
 
int lte_get_imscap_sync (FAR bool *imscap)
 
int lte_get_version_sync (FAR lte_version_t *version)
 
int lte_get_phoneno_sync (FAR char *phoneno, size_t len)
 
int lte_get_imsi_sync (FAR char *imsi, size_t len)
 
int lte_get_imei_sync (FAR char *imei, size_t len)
 
int lte_get_pinset_sync (FAR lte_getpin_t *pinset)
 
int lte_set_pinenable_sync (bool enable, FAR char *pincode, FAR uint8_t *attemptsleft)
 
int lte_change_pin_sync (int8_t target_pin, FAR char *pincode, FAR char *new_pincode, FAR uint8_t *attemptsleft)
 
int lte_enter_pin_sync (FAR char *pincode, FAR char *new_pincode, FAR uint8_t *simstat, FAR uint8_t *attemptsleft)
 
int lte_get_localtime_sync (FAR lte_localtime_t *localtime)
 
int lte_get_operator_sync (FAR char *oper, size_t len)
 
int lte_get_edrx_sync (FAR lte_edrx_setting_t *settings)
 
int lte_set_edrx_sync (FAR lte_edrx_setting_t *settings)
 
int lte_get_psm_sync (FAR lte_psm_setting_t *settings)
 
int lte_set_psm_sync (FAR lte_psm_setting_t *settings)
 
int lte_get_ce_sync (FAR lte_ce_setting_t *settings)
 
int lte_set_ce_sync (FAR lte_ce_setting_t *settings)
 
int lte_set_report_simstat (simstat_report_cb_t simstat_callback)
 
int lte_set_report_localtime (localtime_report_cb_t localtime_callback)
 
int lte_set_report_quality (quality_report_cb_t quality_callback, uint32_t period)
 
int lte_set_report_cellinfo (cellinfo_report_cb_t cellinfo_callback, uint32_t period)
 
int lte_set_report_netinfo (netinfo_report_cb_t netinfo_callback)
 
int lte_get_errinfo (FAR lte_errinfo_t *info)
 
int lte_get_siminfo_sync (uint32_t option, FAR lte_siminfo_t *siminfo)
 
int lte_get_current_edrx_sync (FAR lte_edrx_setting_t *settings)
 
int lte_get_current_psm_sync (FAR lte_psm_setting_t *settings)
 
int lte_get_quality_sync (FAR lte_quality_t *quality)
 
int lte_get_cellinfo_sync (FAR lte_cellinfo_t *cellinfo)
 
int lte_get_rat_sync (void)
 Get RAT type. More...
 
int lte_set_rat_sync (uint8_t rat, bool persistent)
 Set RAT setting. More...
 
int lte_get_ratinfo_sync (FAR lte_ratinfo_t *info)
 Get RAT information. More...
 
int lte_acquire_wakelock (void)
 
int lte_release_wakelock (void)
 
int lte_get_wakelock_count (void)
 
int lte_send_atcmd_sync (FAR const char *cmd, int cmdlen, FAR char *respbuff, int respbufflen, FAR int *resplen)
 Send AT command to the modem. More...
 
int lte_factory_reset_sync (void)
 
int lte_set_context_save_cb (context_save_cb_t callback)
 
int lte_hibernation_resume (FAR const uint8_t *res_ctx, int len)
 

Detailed Description

LTE library for using LTE network.

Synchronous API Asynchronous API
lte_initialize
lte_finalize
lte_set_report_restart
lte_power_on
lte_power_off
lte_set_report_netinfo
lte_set_report_simstat
lte_set_report_localtime
lte_set_report_quality
lte_set_report_cellinfo
lte_get_errinfo
lte_activate_pdn_cancel
lte_radio_on_sync lte_radio_on (deprecated)
lte_radio_off_sync lte_radio_off (deprecated)
lte_activate_pdn_sync lte_activate_pdn
lte_deactivate_pdn_sync lte_deactivate_pdn (deprecated)
lte_data_allow_sync lte_data_allow (deprecated)
lte_get_netinfo_sync lte_get_netinfo (deprecated)
lte_get_imscap_sync lte_get_imscap (deprecated)
lte_get_version_sync lte_get_version (deprecated)
lte_get_phoneno_sync lte_get_phoneno (deprecated)
lte_get_imsi_sync lte_get_imsi (deprecated)
lte_get_imei_sync lte_get_imei (deprecated)
lte_get_pinset_sync lte_get_pinset (deprecated)
lte_set_pinenable_sync lte_set_pinenable (deprecated)
lte_change_pin_sync lte_change_pin (deprecated)
lte_enter_pin_sync lte_enter_pin (deprecated)
lte_get_localtime_sync lte_get_localtime (deprecated)
lte_get_operator_sync lte_get_operator (deprecated)
lte_get_edrx_sync lte_get_edrx (deprecated)
lte_set_edrx_sync lte_set_edrx (deprecated)
lte_get_psm_sync lte_get_psm (deprecated)
lte_set_psm_sync lte_set_psm (deprecated)
lte_get_ce_sync lte_get_ce (deprecated)
lte_set_ce_sync lte_set_ce (deprecated)
lte_get_siminfo_sync lte_get_siminfo (deprecated)
lte_get_current_edrx_sync lte_get_current_edrx (deprecated)
lte_get_current_psm_sync lte_get_current_psm (deprecated)
lte_get_quality_sync lte_get_quality (deprecated)
lte_get_cellinfo_sync
lte_get_rat_sync
lte_set_rat_sync
lte_get_ratinfo_sync
lte_acquire_wakelock
lte_release_wakelock
lte_send_atcmd_sync
lte_factory_reset_sync
lte_set_context_save_cb
lte_hibernation_resume

Function Documentation

◆ lte_initialize()

int lte_initialize ( void  )

Initialize resources used in LTE API.

Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_finalize()

int lte_finalize ( void  )

Release resources used in LTE API.

Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_report_restart()

int lte_set_report_restart ( restart_report_cb_t  restart_callback)

Register the callback to notify that the modem has started up.

The callback will be invoked if the modem starts successfully after calling lte_power_on. Some APIs have to wait until this callback is invoked. If no wait, those API return with an error. (-ENETDOWN)

The callback is also invoked when the modem is restarted. The cause of the restart can be obtained from the callback argument.

This function must be called after lte_initialize.

Attention
Attention to the following when LTE_RESTART_MODEM_INITIATED is set.
  • Asynchronous API callbacks for which results have not been notified are canceled and becomes available.
  • The processing result of the synchronous API being called results in an error. (Return value is -ENETDOWN) The errno is ENETDOWN for the socket API.
  • It should close the socket by user application.
Parameters
[in]restart_callbackCallback function to notify that modem restarted.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_power_on()

int lte_power_on ( void  )

Power on the modem.

The callback which registered by lte_set_report_restart will be invoked if the modem starts successfully.

This function must be called after lte_set_report_restart.

Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_power_off()

int lte_power_off ( void  )

Power off the modem

Attention
Attention to the following when this API calling.
  • For asynchronous API
    • callback is canceled.
  • For synchronous API
    • API returns with an error.
      • The return value is -ENETDOWN for the LTE API.
      • The errno is ENETDOWN for the socket API.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_radio_on_sync()

int lte_radio_on_sync ( void  )

With the radio on, to start the LTE network search.

Attention
Attention to the following when this API calling.
  • If SIM is PIN locked, the result will be an error.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_radio_off_sync()

int lte_radio_off_sync ( void  )

Exit LTE network searches with the radio off.

If this function is called when a PDN has already been constructed, the PDN is discarded.

Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_netinfo_sync()

int lte_get_netinfo_sync ( uint8_t  pdn_num,
FAR lte_netinfo_t info 
)

Get LTE network information.

Attention
The maximum number of PDNs status areas must be allocated before calls this API.
Parameters
[in]pdn_numNumber of pdn_stat allocated by the user. The range is from LTE_PDN_SESSIONID_MIN to LTE_PDN_SESSIONID_MAX.
[out]infoThe LTE network information. See lte_netinfo_t
Attention
Immediately after successful PDN construction using lte_activate_pdn_sync() or lte_activate_pdn(), session information such as IP address may not be acquired correctly. If you want to use this API after successfully construction the PDN, wait at least 1 second before executing it.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_activate_pdn_sync()

int lte_activate_pdn_sync ( FAR lte_apn_setting_t apn,
FAR lte_pdn_t pdn 
)

Constructs a PDN with the specified APN settings.

When constructs the initial PDN, LTE_APN_TYPE_IA must be set to the APN type.

When PDN construction is successful, an IP address is given from the LTE network.

Attention
Attention to the following when this API calling.
  • The initial PDN construction may take a few minutes depending on radio conditions.
  • If API is not returned, please check if the APN settings are correct.
Parameters
[in]apnThe pointer of the apn setting. See lte_apn_setting_t for valid parameters.
[out]pdnThe construction PDN information. See lte_pdn_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>. If canceling, -ECANCELED is returned.

◆ lte_activate_pdn()

int lte_activate_pdn ( FAR lte_apn_setting_t apn,
activate_pdn_cb_t  callback 
)

Constructs a PDN with the specified APN settings.

When constructs the initial PDN, LTE_APN_TYPE_IA must be set to the APN type.

When PDN construction is successful, an IP address is given from the LTE network.

Attention
Attention to the following when this API calling.
  • The initial PDN construction may take a few minutes depending on radio conditions.
  • If the callback is not notified, please check if the APN settings are correct.
Parameters
[in]apnThe pointer of the apn setting. See lte_apn_setting_t for valid parameters.
[in]callbackCallback function to notify that PDN activation completed.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_activate_pdn_cancel()

int lte_activate_pdn_cancel ( void  )

Cancel PDN construction.

Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_deactivate_pdn_sync()

int lte_deactivate_pdn_sync ( uint8_t  session_id)

Discard the constructed PDN.

Discards the PDN corresponding to the session ID obtained by lte_activate_pdn.

When the discard process is successful, the IP address assigned to the modem is released to the LTE network.

Parameters
[in]session_idThe numeric value of the session ID. Use the value obtained by the lte_activate_pdn.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_data_allow_sync()

int lte_data_allow_sync ( uint8_t  session_id,
uint8_t  allow,
uint8_t  roaming_allow 
)

Allow or disallow to data communication for specified PDN.

Attention
This function is not supported.
Parameters
[in]session_idThe numeric value of the session ID. Use the value obtained by the lte_activate_pdn.
[in]allowAllow or disallow to data communication for all network. Definition is as below.
[in]roaming_allowAllow or disallow to data communication for roaming network. Definition is as below.
Returns
-EOPNOTSUPP is returned.

◆ lte_get_imscap_sync()

int lte_get_imscap_sync ( FAR bool *  imscap)

Get whether the modem supports IMS or not.

Parameters
[out]imscapThe IMS capability. As below value stored.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_version_sync()

int lte_get_version_sync ( FAR lte_version_t version)

Acquires the FW version information of the modem.

Parameters
[out]versionThe version information of the modem. See lte_version_t
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_phoneno_sync()

int lte_get_phoneno_sync ( FAR char *  phoneno,
size_t  len 
)

Get phone number from SIM.

Parameters
[out]phonenoA character string indicating phone number. It is terminated with '\0'. The maximum number of phone number areas must be allocated. See LTE_PHONENO_LEN.
[in]lenLength of the buffer for storing phone number.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_imsi_sync()

int lte_get_imsi_sync ( FAR char *  imsi,
size_t  len 
)

Get International Mobile Subscriber Identity from SIM.

Parameters
[out]imsiA character string indicating IMSI. It is terminated with '\0'. The maximum number of IMSI areas must be allocated. See LTE_IMSI_LEN.
[in]lenLength of the buffer for storing IMSI.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_imei_sync()

int lte_get_imei_sync ( FAR char *  imei,
size_t  len 
)

Get International Mobile Equipment Identifier from the modem.

Parameters
[out]imeiA character string indicating IMEI. It is terminated with '\0'. The maximum number of IMEI areas must be allocated. See LTE_IMEI_LEN.
[in]lenLength of the buffer for storing IMEI.

On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_pinset_sync()

int lte_get_pinset_sync ( FAR lte_getpin_t pinset)

Get Personal Identification Number settings.

Parameters
[out]pinsetPIN settings information. See lte_getpin_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_pinenable_sync()

int lte_set_pinenable_sync ( bool  enable,
FAR char *  pincode,
FAR uint8_t *  attemptsleft 
)

Set Personal Identification Number enable.

Parameters
[in]enable"Enable" or "Disable". Definition is as below.
[in]pincodeCurrent PIN code. Minimum number of digits is 4. Maximum number of digits is 8, end with '\0'. (i.e. Max 9 byte)
[out]attemptsleftNumber of attempts left. Set only if failed.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_change_pin_sync()

int lte_change_pin_sync ( int8_t  target_pin,
FAR char *  pincode,
FAR char *  new_pincode,
FAR uint8_t *  attemptsleft 
)

Change Personal Identification Number.

It can be changed only when PIN is enable.

Parameters
[in]target_pinTarget of change PIN. Definition is as below.
[in]pincodeCurrent PIN code. Minimum number of digits is 4. Maximum number of digits is 8, end with '\0'. (i.e. Max 9 byte)
[in]new_pincodeNew PIN code. Minimum number of digits is 4. Maximum number of digits is 8, end with '\0'. (i.e. Max 9 byte)
[out]attemptsleftNumber of attempts left. Set only if failed.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_enter_pin_sync()

int lte_enter_pin_sync ( FAR char *  pincode,
FAR char *  new_pincode,
FAR uint8_t *  simstat,
FAR uint8_t *  attemptsleft 
)

Enter Personal Identification Number.

Parameters
[in]pincodeCurrent PIN code. Minimum number of digits is 4. Maximum number of digits is 8, end with '\0'. (i.e. Max 9 byte)
[in]new_pincodeAlways set NULL. This parameter is not currently used. If this parameter has a value in it, this API will error.
[out]simstatState after PIN enter. As below value stored.
[out]attemptsleftNumber of attempts left. Set only if failed. If simstat is other than PIN, PUK, PIN2, PUK2, set the number of PIN.
Note
Running this API when the SIM state is other than LTE_PINSTAT_SIM_PIN will return an error.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.
Deprecated:
This API will be removed in a future version

◆ lte_get_localtime_sync()

int lte_get_localtime_sync ( FAR lte_localtime_t localtime)

Get local time.

Parameters
[out]localtimeLocal time. See lte_localtime_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_operator_sync()

int lte_get_operator_sync ( FAR char *  oper,
size_t  len 
)

Get connected network operator information.

Parameters
[out]operA character string indicating network operator. It is terminated with '\0' If it is not connected, the first character is '\0'. The maximum number of network operator areas must be allocated. See LTE_OPERATOR_LEN.
[in]lenLength of the buffer for storing network operator.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_edrx_sync()

int lte_get_edrx_sync ( FAR lte_edrx_setting_t settings)

Get eDRX settings.

Parameters
[out]settingseDRX settings. See lte_edrx_setting_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_edrx_sync()

int lte_set_edrx_sync ( FAR lte_edrx_setting_t settings)

Set eDRX settings.

Parameters
[in]settingseDRX settings.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_psm_sync()

int lte_get_psm_sync ( FAR lte_psm_setting_t settings)

Get PSM settings.

Parameters
[out]settingsPSM settings. See lte_psm_setting_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_psm_sync()

int lte_set_psm_sync ( FAR lte_psm_setting_t settings)

Set PSM settings.

Parameters
[in]settingsPSM settings.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_ce_sync()

int lte_get_ce_sync ( FAR lte_ce_setting_t settings)

Get CE settings.

Parameters
[out]settingsCE settings. See lte_ce_setting_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_ce_sync()

int lte_set_ce_sync ( FAR lte_ce_setting_t settings)

Set CE settings.

Parameters
[in]settingsCE settings
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_report_simstat()

int lte_set_report_simstat ( simstat_report_cb_t  simstat_callback)

Notifies the SIM status to the application.

The default report setting is disable.

Parameters
[in]simstat_callbackCallback function to notify that SIM state. If NULL is set, the report setting is disabled.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_report_localtime()

int lte_set_report_localtime ( localtime_report_cb_t  localtime_callback)

Notifies the Local time to the application.

The default report setting is disable.

Parameters
[in]localtime_callbackCallback function to notify that local time. If NULL is set, the report setting is disabled.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_report_quality()

int lte_set_report_quality ( quality_report_cb_t  quality_callback,
uint32_t  period 
)

Notifies the communication quality information to the application.

Invoke the callback at the specified report interval.

The default report setting is disable.

Attention
When changing the notification cycle, stop and start again.
Parameters
[in]quality_callbackCallback function to notify that quality information. If NULL is set, the report setting is disabled.
[in]periodReporting cycle in sec (1-4233600)
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_report_cellinfo()

int lte_set_report_cellinfo ( cellinfo_report_cb_t  cellinfo_callback,
uint32_t  period 
)

Notifies the LTE network cell information to the application.

Invoke the callback at the specified report interval.

The default report setting is disable.

Attention
When changing the notification cycle, stop and start again.
Parameters
[in]cellinfo_callbackCallback function to notify that cell information. If NULL is set, the report setting is disabled.
[in]periodReporting cycle in sec (1-4233600)
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_report_netinfo()

int lte_set_report_netinfo ( netinfo_report_cb_t  netinfo_callback)

Notifies the LTE network status to the application.

The default report setting is disable.

Parameters
[in]netinfo_callbackCallback function to notify that cell information. If NULL is set, the report setting is disabled.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_errinfo()

int lte_get_errinfo ( FAR lte_errinfo_t info)

Get LTE API last error information.

Call this function when LTE_RESULT_ERROR is returned by callback function. The detailed error information can be obtained.

Parameters
[in]infoPointer of error information.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_siminfo_sync()

int lte_get_siminfo_sync ( uint32_t  option,
FAR lte_siminfo_t siminfo 
)

Get SIM information such as Mobile Country Code/Mobile Network Code.

Parameters
[in]optionIndicates which parameter to get. Bit setting definition is as below.
[out]siminfoSIM information. See lte_siminfo_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_current_edrx_sync()

int lte_get_current_edrx_sync ( FAR lte_edrx_setting_t settings)

Get current eDRX settings.

This API can be issued after connect to the LTE network with lte_activate_pdn().

Get the settings negotiated between the modem and the network.

Parameters
[out]settingsCurrent eDRX settings. See lte_edrx_setting_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_current_psm_sync()

int lte_get_current_psm_sync ( FAR lte_psm_setting_t settings)

Get current PSM settings.

This API can be issued after connect to the LTE network with lte_activate_pdn().

Get the settings negotiated between the modem and the network.

Parameters
[OUT]settings: Current PSM settings. See lte_psm_setting_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_quality_sync()

int lte_get_quality_sync ( FAR lte_quality_t quality)

Get communication quality information.

Parameters
[out]qualityQuality information. See lte_quality_t
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_cellinfo_sync()

int lte_get_cellinfo_sync ( FAR lte_cellinfo_t cellinfo)

Get LTE network cell information.

Attention
This function is not supported yet.
Parameters
[out]cellinfoLTE network cell information. See lte_cellinfo_t
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_rat_sync()

int lte_get_rat_sync ( void  )

Get RAT type.

Returns
On success, RAT type shown below is returned.

◆ lte_set_rat_sync()

int lte_set_rat_sync ( uint8_t  rat,
bool  persistent 
)

Set RAT setting.

Parameters
[in]ratRAT type. Definition is as below.
[in]persistentFlag to keep RAT settings after power off the modem. Definition is as below.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_get_ratinfo_sync()

int lte_get_ratinfo_sync ( FAR lte_ratinfo_t info)

Get RAT information.

Parameters
[out]infoPointer to the structure that stores RAT information See lte_ratinfo_t.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_acquire_wakelock()

int lte_acquire_wakelock ( void  )

Acquire the modem wakelock. If any wakelock is acquired, modem can't enter to the sleep state. Please call this API after calling lte_initialize(). Otherwise this API will result in an error. Before calling lte_finalize(), must release all wakelocks acquired by this API.

Returns
On success, return the count of the current modem wakelock. On failure, negative value is returned according to <errno.h>.

◆ lte_release_wakelock()

int lte_release_wakelock ( void  )

Release the modem wakelock. If all of the wakelock are released, modem can enter to the sleep state. Please call this API after calling lte_initialize(). Otherwise this API will result in an error.

Returns
On success, return the count of the current modem wakelock. On failure, negative value is returned according to <errno.h>.

◆ lte_get_wakelock_count()

int lte_get_wakelock_count ( void  )

Get the number of wakelock counts acquired. Please call this API after calling lte_initialize(). Otherwise this API will result in an error.

On success, return the count of the current modem wakelock. On failure, negative value is returned according to <errno.h>.

◆ lte_send_atcmd_sync()

int lte_send_atcmd_sync ( FAR const char *  cmd,
int  cmdlen,
FAR char *  respbuff,
int  respbufflen,
FAR int *  resplen 
)

Send AT command to the modem.

Parameters
[in]cmdThe AT command data. Maximum length is LTE_AT_COMMAND_MAX_LEN. AT command is shall begin with "AT" and end with '\r'.
[in]cmdlenLength of the AT command data.
[in]respbuffThe area to store the AT command response.
[in]respbufflenLength of the AT command response buffer.
[in]resplenThe pointer to the area store the length of AT command response.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_factory_reset_sync()

int lte_factory_reset_sync ( void  )

Run factory reset on the modem.

Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_set_context_save_cb()

int lte_set_context_save_cb ( context_save_cb_t  callback)

Set callback function for context save.

Parameters
[in]callbackCallback function to notify a context data when modem entering hibernation mode.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.

◆ lte_hibernation_resume()

int lte_hibernation_resume ( FAR const uint8_t *  res_ctx,
int  len 
)

Resume LTE status from hibernation mode.

Parameters
[in]res_ctxContext data for resume daemon.
[in]len: Context data size.
Returns
On success, 0 is returned. On failure, negative value is returned according to <errno.h>.