|
Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
|
#include <zephyr/types.h>#include <zephyr/device.h>#include <errno.h>#include <stddef.h>#include <zephyr/modem/chat.h>#include <zephyr/drivers/cellular.h>Go to the source code of this file.
Data Structures | |
| struct | hl78xx_agnss_status |
| A-GNSS assistance data status structure. More... | |
| struct | hl78xx_network |
| Cellular network structure. More... | |
| struct | hl78xx_evt |
| HL78xx event structure. More... | |
| struct | nmea_match_gsa_data |
| Parsed GSA sentence data (GNSS DOP and Active Satellites). More... | |
| struct | nmea_match_gst_data |
| Parsed GST sentence data (GNSS Pseudorange Error Statistics). More... | |
| struct | nmea_match_epu_data |
| Parsed EPU sentence data (HL78xx proprietary position error). More... | |
| struct | hl78xx_gnss_nmea_aux_data |
| Container for all GNSS auxiliary NMEA data. More... | |
| struct | hl78xx_gnss_aux_data_callback |
| GNSS auxiliary data callback structure. More... | |
| struct | hl78xx_evt_monitor_entry |
| Event monitor entry structure. More... | |
Macros | |
| #define | CSQ_RSSI_UNKNOWN (99) |
| Unknown RSSI value returned by AT+CSQ command. | |
| #define | CESQ_RSRP_UNKNOWN (255) |
| Unknown RSRP value returned by AT+CESQ command. | |
| #define | CESQ_RSRQ_UNKNOWN (255) |
| Unknown RSRQ value returned by AT+CESQ command. | |
| #define | CSQ_RSSI_TO_DB(v) |
| Convert CSQ RSSI value to dBm. | |
| #define | CESQ_RSRP_TO_DB(v) |
| Convert CESQ RSRP value to dBm. | |
| #define | CESQ_RSRQ_TO_DB(v) |
| Convert CESQ RSRQ value to dB. | |
| #define | PAUSED 1 |
| Monitor is paused. | |
| #define | ACTIVE 0 |
| Monitor is active, default. | |
| #define | MDM_MANUFACTURER_LENGTH 20 |
| Maximum length of modem manufacturer string. | |
| #define | MDM_MODEL_LENGTH 32 |
| Maximum length of modem model string. | |
| #define | MDM_REVISION_LENGTH 64 |
| Maximum length of modem revision string. | |
| #define | MDM_IMEI_LENGTH 16 |
| Maximum length of modem IMEI string. | |
| #define | MDM_IMSI_LENGTH 23 |
| Maximum length of modem IMSI string. | |
| #define | MDM_ICCID_LENGTH 22 |
| Maximum length of modem ICCID string. | |
| #define | MDM_APN_MAX_LENGTH 64 |
| Maximum length of APN string. | |
| #define | MDM_MAX_CERT_LENGTH 4096 |
| Maximum length of certificate. | |
| #define | MDM_MAX_HOSTNAME_LEN 128 |
| Maximum length of hostname. | |
| #define | MDM_SERIAL_NUMBER_LENGTH 32 |
| Maximum length of serial number string. | |
| #define | HL78XX_EVT_MONITOR(name, _handler, ...) |
| Define an Event monitor to receive notifications in the system workqueue thread. | |
| #define | GNSS_AUX_DATA_CALLBACK_DEFINE(_dev, _callback) |
| Register a callback structure for GNSS auxiliary data published. | |
| #define | GNSS_DT_AUX_DATA_CALLBACK_DEFINE(_node_id, _callback) |
| Register a callback structure for GNSS auxiliary data published. | |
Typedefs | |
| typedef void(* | hl78xx_gnss_aux_data_callback_t) (const struct device *dev, const struct hl78xx_gnss_nmea_aux_data *aux_data, uint16_t size) |
| GNSS auxiliary data callback function type. | |
| typedef int(* | hl78xx_api_configure_networks) (const struct device *dev, const struct hl78xx_network *networks, uint8_t size) |
| API function pointer for configuring networks. | |
| typedef int(* | hl78xx_api_get_supported_networks) (const struct device *dev, const struct hl78xx_network **networks, uint8_t *size) |
| API function pointer for getting supported networks. | |
| typedef int(* | hl78xx_api_get_signal) (const struct device *dev, const enum cellular_signal_type type, int16_t *value) |
| API for getting network signal strength. | |
| typedef int(* | hl78xx_api_get_modem_info) (const struct device *dev, const enum cellular_modem_info_type type, char *info, size_t size) |
| API function pointer for getting modem information. | |
| typedef int(* | hl78xx_api_get_registration_status) (const struct device *dev, enum cellular_access_technology tech, enum cellular_registration_status *status) |
| API for getting registration status. | |
| typedef int(* | hl78xx_api_set_phone_functionality) (const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset) |
| API function pointer for setting phone functionality. | |
| typedef int(* | hl78xx_api_get_phone_functionality) (const struct device *dev, enum hl78xx_phone_functionality *functionality) |
| API for get phone functionality. | |
| typedef int(* | hl78xx_api_send_at_cmd) (const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size) |
| API for get phone functionality. | |
| typedef void(* | hl78xx_evt_monitor_dispatcher_t) (struct hl78xx_evt *notif) |
| Event monitor dispatcher function type. | |
| typedef void(* | hl78xx_evt_monitor_handler_t) (struct hl78xx_evt *notif, struct hl78xx_evt_monitor_entry *mon) |
| Event monitor handler function type. | |
Functions | |
| int | hl78xx_api_func_set_phone_functionality (const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset) |
| Set phone functionality mode (internal implementation). | |
| int | hl78xx_api_func_get_phone_functionality (const struct device *dev, enum hl78xx_phone_functionality *functionality) |
| Get phone functionality mode (internal implementation). | |
| int | hl78xx_api_func_get_signal (const struct device *dev, const enum cellular_signal_type type, int16_t *value) |
| Get network signal strength (internal implementation). | |
| int | hl78xx_api_func_get_modem_info_vendor (const struct device *dev, enum hl78xx_modem_info_type type, void *info, size_t size) |
| Get vendor-specific modem information (internal implementation). | |
| int | hl78xx_api_func_modem_dynamic_cmd_send (const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size) |
| Send dynamic AT command (internal implementation). | |
| static int | hl78xx_get_modem_info (const struct device *dev, const enum hl78xx_modem_info_type type, void *info, size_t size) |
| Get modem info for the device. | |
| static int | hl78xx_set_phone_functionality (const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset) |
| Set the modem phone functionality mode. | |
| static int | hl78xx_get_phone_functionality (const struct device *dev, enum hl78xx_phone_functionality *functionality) |
| Get the current phone functionality mode of the modem. | |
| static int | hl78xx_modem_cmd_send (const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size) |
| Send an AT command to the modem and wait for a matched response. | |
| static int | hl78xx_parse_rssi (uint8_t rssi, int16_t *value) |
| Convert raw RSSI value from the modem to dBm. | |
| static int | hl78xx_parse_rsrp (uint8_t rsrp, int16_t *value) |
| Convert raw RSRP value from the modem to dBm. | |
| static int | hl78xx_parse_rsrq (uint8_t rsrq, int16_t *value) |
| Convert raw RSRQ value from the modem to dB. | |
| static void | hl78xx_evt_monitor_pause (struct hl78xx_evt_monitor_entry *mon) |
| Pause monitor. | |
| static void | hl78xx_evt_monitor_resume (struct hl78xx_evt_monitor_entry *mon) |
| Resume monitor. | |
| int | hl78xx_evt_notif_handler_set (hl78xx_evt_monitor_dispatcher_t handler) |
| Set the event notification handler for HL78xx modem events. | |
| int | hl78xx_evt_monitor_register (struct hl78xx_evt_monitor_entry *mon) |
| Register an event monitor to receive HL78xx modem event notifications. | |
| int | hl78xx_evt_monitor_unregister (struct hl78xx_evt_monitor_entry *mon) |
| Unregister an event monitor from receiving HL78xx modem event notifications. | |
| enum cellular_access_technology | hl78xx_rat_to_access_tech (enum hl78xx_cell_rat_mode rat_mode) |
| Convert HL78xx RAT mode to standard cellular API. | |
| #define GNSS_AUX_DATA_CALLBACK_DEFINE | ( | _dev, | |
| _callback ) |
Register a callback structure for GNSS auxiliary data published.
| _dev | Device pointer |
| _callback | The callback function |
| #define GNSS_DT_AUX_DATA_CALLBACK_DEFINE | ( | _node_id, | |
| _callback ) |
Register a callback structure for GNSS auxiliary data published.
| _node_id | Device tree node identifier |
| _callback | The callback function |
| #define HL78XX_EVT_MONITOR | ( | name, | |
| _handler, | |||
| ... ) |
Define an Event monitor to receive notifications in the system workqueue thread.
| name | The monitor name. |
| _handler | The monitor callback. |
| ... | Optional monitor initial state (PAUSED or ACTIVE). The default initial state of a monitor is active. |
| typedef int(* hl78xx_api_configure_networks) (const struct device *dev, const struct hl78xx_network *networks, uint8_t size) |
API function pointer for configuring networks.
| dev | Cellular network device instance |
| networks | Array of network configurations |
| size | Number of networks in array |
| typedef int(* hl78xx_api_get_modem_info) (const struct device *dev, const enum cellular_modem_info_type type, char *info, size_t size) |
API function pointer for getting modem information.
| dev | Cellular network device instance |
| type | Type of modem information |
| info | Buffer to store information string |
| size | Size of info buffer |
| typedef int(* hl78xx_api_get_phone_functionality) (const struct device *dev, enum hl78xx_phone_functionality *functionality) |
API for get phone functionality.
| typedef int(* hl78xx_api_get_registration_status) (const struct device *dev, enum cellular_access_technology tech, enum cellular_registration_status *status) |
API for getting registration status.
| typedef int(* hl78xx_api_get_signal) (const struct device *dev, const enum cellular_signal_type type, int16_t *value) |
API for getting network signal strength.
| typedef int(* hl78xx_api_get_supported_networks) (const struct device *dev, const struct hl78xx_network **networks, uint8_t *size) |
API function pointer for getting supported networks.
| dev | Cellular network device instance |
| networks | Pointer to receive network array |
| size | Pointer to receive array size |
| typedef int(* hl78xx_api_send_at_cmd) (const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size) |
API for get phone functionality.
| typedef int(* hl78xx_api_set_phone_functionality) (const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset) |
API function pointer for setting phone functionality.
| dev | Cellular network device instance |
| functionality | Phone functionality mode |
| reset | Whether to reset modem |
| typedef void(* hl78xx_evt_monitor_dispatcher_t) (struct hl78xx_evt *notif) |
Event monitor dispatcher function type.
Called to dispatch events to registered monitors
| notif | Pointer to the event notification |
| typedef void(* hl78xx_evt_monitor_handler_t) (struct hl78xx_evt *notif, struct hl78xx_evt_monitor_entry *mon) |
Event monitor handler function type.
User callback for receiving event notifications
| notif | Pointer to the event notification |
| mon | Pointer to the monitor entry that received the event |
| typedef void(* hl78xx_gnss_aux_data_callback_t) (const struct device *dev, const struct hl78xx_gnss_nmea_aux_data *aux_data, uint16_t size) |
GNSS auxiliary data callback function type.
| dev | Pointer to the GNSS device |
| aux_data | Pointer to auxiliary NMEA data structure |
| size | Size of the auxiliary data |
| enum hl78xx_agnss_days |
Number of days of predicted assistance data to download (write command) or number of days before it expires (read command).
Only these values are accepted by the AT+GNSSAD=1,<days> command
| enum hl78xx_agnss_mode |
| enum hl78xx_cell_rat_mode |
| enum hl78xx_evt_type |
HL78xx event types.
Asynchronous event notifications from the HL78xx modem
Cellular modem info type.
Types of modem information that can be queried
| enum hl78xx_module_status |
Module status codes.
Status codes returned by AT+CPIN? indicating SIM and module state
| enum nmea_output_port |
NMEA output port options.
Port selection for GNSS NMEA sentence output from the modem
| int hl78xx_api_func_get_modem_info_vendor | ( | const struct device * | dev, |
| enum hl78xx_modem_info_type | type, | ||
| void * | info, | ||
| size_t | size ) |
Get vendor-specific modem information (internal implementation).
Internal function to retrieve HL78xx-specific modem information. Users should call hl78xx_get_modem_info() instead.
| dev | Cellular network device instance |
| type | Type of the modem info to retrieve |
| info | Pointer to store the modem info |
| size | Size of the info buffer |
| int hl78xx_api_func_get_phone_functionality | ( | const struct device * | dev, |
| enum hl78xx_phone_functionality * | functionality ) |
Get phone functionality mode (internal implementation).
Internal function to query the modem's phone functionality mode. Users should call hl78xx_get_phone_functionality() instead.
| dev | Cellular network device instance |
| functionality | Pointer to store the current phone functionality mode |
| int hl78xx_api_func_get_signal | ( | const struct device * | dev, |
| const enum cellular_signal_type | type, | ||
| int16_t * | value ) |
Get network signal strength (internal implementation).
Internal function to retrieve cellular signal strength metrics. Users should use the standard cellular API instead.
| dev | Cellular network device instance |
| type | Type of the signal to retrieve (RSSI, RSRP, RSRQ, etc.) |
| value | Pointer to store the signal value |
| int hl78xx_api_func_modem_dynamic_cmd_send | ( | const struct device * | dev, |
| const char * | cmd, | ||
| uint16_t | cmd_size, | ||
| const struct modem_chat_match * | response_matches, | ||
| uint16_t | matches_size ) |
Send dynamic AT command (internal implementation).
Internal function to send arbitrary AT commands to the modem. Users should call hl78xx_modem_cmd_send() instead.
| dev | Cellular network device instance |
| cmd | AT command to send |
| cmd_size | Size of the AT command |
| response_matches | Expected response patterns |
| matches_size | Number of response patterns |
| int hl78xx_api_func_set_phone_functionality | ( | const struct device * | dev, |
| enum hl78xx_phone_functionality | functionality, | ||
| bool | reset ) |
Set phone functionality mode (internal implementation).
Internal function to set the modem's phone functionality mode. Users should call hl78xx_set_phone_functionality() instead.
| dev | Cellular network device instance |
| functionality | Phone functionality mode to set |
| reset | If true, the modem will be reset as part of applying the functionality change. |
|
inlinestatic |
Pause monitor.
Pause monitor mon from receiving notifications.
| mon | The monitor to pause. |
| int hl78xx_evt_monitor_register | ( | struct hl78xx_evt_monitor_entry * | mon | ) |
Register an event monitor to receive HL78xx modem event notifications.
Adds a monitor to the list of registered event monitors. Once registered, the monitor will receive all modem events unless paused.
| mon | Pointer to the monitor entry to register |
|
inlinestatic |
Resume monitor.
Resume forwarding notifications to monitor mon.
| mon | The monitor to resume. |
| int hl78xx_evt_monitor_unregister | ( | struct hl78xx_evt_monitor_entry * | mon | ) |
Unregister an event monitor from receiving HL78xx modem event notifications.
Removes a monitor from the list of registered event monitors.
| mon | Pointer to the monitor entry to unregister |
| int hl78xx_evt_notif_handler_set | ( | hl78xx_evt_monitor_dispatcher_t | handler | ) |
Set the event notification handler for HL78xx modem events.
Registers a callback handler to receive asynchronous event notifications from the HL78xx modem, such as network registration changes, GNSS updates, or other modem-generated events.
| handler | Function pointer to the event monitor callback. Pass NULL to clear the existing handler. |
| 0 | on success. |
| -EINVAL | if the handler parameter is invalid. |
|
inlinestatic |
Get modem info for the device.
| dev | Cellular network device instance |
| type | Type of the modem info requested |
| info | Info string destination |
| size | Info string size |
| 0 | if successful. |
| -ENOTSUP | if API is not supported by cellular network device. |
| -ENODATA | if modem does not provide info requested |
| Negative | errno-code from chat module otherwise. |
|
inlinestatic |
Get the current phone functionality mode of the modem.
Queries the modem to retrieve its current operational mode, such as full functionality, airplane mode, or minimum functionality.
| dev | Pointer to the modem device instance. |
| functionality | Pointer to store the retrieved functionality mode. (see enum hl78xx_phone_functionality) |
| 0 | on success. |
| -EINVAL | if the input parameters are invalid. |
| -EIO | if the modem fails to respond or returns an error. |
|
inlinestatic |
Send an AT command to the modem and wait for a matched response.
Transmits the specified AT command to the modem and waits for a response that matches one of the expected patterns defined in the response match table.
| dev | Pointer to the modem device instance. |
| cmd | Pointer to the AT command string to be sent. |
| cmd_size | Length of the AT command string in bytes. |
| response_matches | Pointer to an array of expected response patterns. (see struct modem_chat_match) |
| matches_size | Number of response patterns in the array. |
| 0 | on successful command transmission and response match. |
| -EINVAL | if any parameter is invalid. |
| -ETIMEDOUT | if the modem did not respond in the expected time. |
| -EIO | on communication failure or if response did not match. |
Convert raw RSRP value from the modem to dBm.
Parses the Reference Signal Received Power (RSRP) value reported by the modem and converts it into a corresponding signal strength in dBm, typically based on 3GPP TS 36.133 specifications.
| rsrp | Raw RSRP value (commonly in the range 0–97, or 255 if unknown). |
| value | Pointer to store the converted RSRP in dBm. |
| 0 | on successful conversion. |
| -EINVAL | if the RSRP value is out of range or represents an unknown value. |
Convert raw RSRQ value from the modem to dB.
Parses the Reference Signal Received Quality (RSRQ) value provided by the modem and converts it into a signal quality measurement in decibels (dB), as specified by 3GPP TS 36.133.
| rsrq | Raw RSRQ value (typically 0–34, or 255 if unknown). |
| value | Pointer to store the converted RSRQ in dB. |
| 0 | on successful conversion. |
| -EINVAL | if the RSRQ value is out of valid range or indicates unknown. |
Convert raw RSSI value from the modem to dBm.
Parses the RSSI value reported by the modem (typically from an AT command response) and converts it to a corresponding signal strength in dBm, as defined by 3GPP TS 27.007.
| rssi | Raw RSSI value (0–31 or 99 for not known or not detectable). |
| value | Pointer to store the converted RSSI in dBm. |
| 0 | on successful conversion. |
| -EINVAL | if the RSSI value is out of valid range or unsupported. |
| enum cellular_access_technology hl78xx_rat_to_access_tech | ( | enum hl78xx_cell_rat_mode | rat_mode | ) |
Convert HL78xx RAT mode to standard cellular API.
Maps HL78xx-specific radio access technology enum to the standard Zephyr cellular API access technology enum.
| rat_mode | HL78xx RAT mode |
|
inlinestatic |
Set the modem phone functionality mode.
Configures the operational state of the modem (e.g., full, airplane, or minimum functionality). Optionally, the modem can be reset during this transition.
| dev | Pointer to the modem device instance. |
| functionality | Desired phone functionality mode to be set. (e.g., full, airplane, minimum – see enum hl78xx_phone_functionality) |
| reset | If true, the modem will be reset as part of applying the functionality change. |
| 0 | on success. |
| -EINVAL | if an invalid parameter is passed. |
| -EIO | on communication or command failure with the modem. |