12#ifndef ZEPHYR_INCLUDE_DRIVERS_MODEM_HL7800_H_
13#define ZEPHYR_INCLUDE_DRIVERS_MODEM_HL7800_H_
32#define MDM_HL7800_REVISION_MAX_SIZE 29
34#define MDM_HL7800_REVISION_MAX_STRLEN (MDM_HL7800_REVISION_MAX_SIZE - 1)
37#define MDM_HL7800_IMEI_SIZE 16
39#define MDM_HL7800_IMEI_STRLEN (MDM_HL7800_IMEI_SIZE - 1)
42#define MDM_HL7800_ICCID_MAX_SIZE 21
44#define MDM_HL7800_ICCID_MAX_STRLEN (MDM_HL7800_ICCID_MAX_SIZE - 1)
47#define MDM_HL7800_SERIAL_NUMBER_SIZE 15
49#define MDM_HL7800_SERIAL_NUMBER_STRLEN (MDM_HL7800_SERIAL_NUMBER_SIZE - 1)
52#define MDM_HL7800_APN_MAX_SIZE 64
54#define MDM_HL7800_APN_USERNAME_MAX_SIZE 65
56#define MDM_HL7800_APN_PASSWORD_MAX_SIZE 65
59#define MDM_HL7800_APN_MAX_STRLEN (MDM_HL7800_APN_MAX_SIZE - 1)
61#define MDM_HL7800_APN_USERNAME_MAX_STRLEN \
62 (MDM_HL7800_APN_USERNAME_MAX_SIZE - 1)
64#define MDM_HL7800_APN_PASSWORD_MAX_STRLEN \
65 (MDM_HL7800_APN_PASSWORD_MAX_SIZE - 1)
68#define MDM_HL7800_APN_CMD_MAX_SIZE \
69 (32 + MDM_HL7800_APN_USERNAME_MAX_STRLEN + \
70 MDM_HL7800_APN_PASSWORD_MAX_STRLEN)
72#define MDM_HL7800_APN_CMD_MAX_STRLEN (MDM_HL7800_APN_CMD_MAX_SIZE - 1)
83#define MDM_HL7800_LTE_BAND_STR_SIZE 21
85#define MDM_HL7800_LTE_BAND_STRLEN (MDM_HL7800_LTE_BAND_STR_SIZE - 1)
88#define MDM_HL7800_OPERATOR_INDEX_SIZE 3
89#define MDM_HL7800_OPERATOR_INDEX_STRLEN (MDM_HL7800_OPERATOR_INDEX_SIZE - 1)
93#define MDM_HL7800_IMSI_MIN_STR_SIZE 15
95#define MDM_HL7800_IMSI_MAX_STR_SIZE 16
97#define MDM_HL7800_IMSI_MAX_STRLEN (MDM_HL7800_IMSI_MAX_STR_SIZE - 1)
100#define MDM_HL7800_MODEM_FUNCTIONALITY_SIZE 2
101#define MDM_HL7800_MODEM_FUNCTIONALITY_STRLEN \
102 (MDM_HL7800_MODEM_FUNCTIONALITY_SIZE - 1)
106#define MDM_HL7800_MAX_GPS_STR_SIZE 33
109#define MDM_HL7800_MAX_POLTE_USER_ID_SIZE 16
111#define MDM_HL7800_MAX_POLTE_PASSWORD_SIZE 16
113#define MDM_HL7800_MAX_POLTE_LOCATION_STR_SIZE 33
123#define MDM_HL7800_POLTE_SERVER_ERROR 10
126#define MDM_HL7800_SET_POLTE_USER_AND_PASSWORD_FMT_STR "AT%%POLTECMD=\"SERVERAUTH\",\"%s\",\"%s\""
585#if defined(CONFIG_MODEM_HL7800_FW_UPDATE) || defined(__DOXYGEN__)
#define MDM_HL7800_MAX_POLTE_LOCATION_STR_SIZE
Size of a PoLTE location string, including the terminating NUL.
Definition hl7800.h:113
bool mdm_hl7800_valid_rat(uint8_t value)
Check if a Radio Access Technology value is valid.
void mdm_hl7800_register_gpio6_callback(void(*func)(int state))
Allows mapping of P1.12_GPIO6 signal to a user accessible test point on the development board.
void mdm_hl7800_register_wake_test_point_callback(void(*func)(int state))
Allows mapping of WAKE_UP signal to a user accessible test point on the development board.
int32_t mdm_hl7800_polte_locate(void)
Locate device using PoLTE.
int32_t mdm_hl7800_set_functionality(enum mdm_hl7800_functionality mode)
Set airplane, normal, or reduced functionality mode.
char * mdm_hl7800_get_sn(void)
Get the HL7800 serial number.
int32_t mdm_hl7800_polte_enable(char *user, char *password)
Enable PoLTE.
int mdm_hl7800_set_desired_sleep_level(enum mdm_hl7800_sleep level)
Set desired sleep level.
int32_t mdm_hl7800_set_gps_rate(uint32_t rate)
When rate is non-zero: Put modem into Airplane mode.
int32_t mdm_hl7800_get_operator_index(void)
Read the operator index from the modem.
mdm_hl7800_radio_mode
Radio Access Technology.
Definition hl7800.h:138
int32_t mdm_hl7800_get_functionality(void)
Get modem functionality.
mdm_hl7800_sleep
Sleep state.
Definition hl7800.h:315
int32_t mdm_hl7800_update_apn(char *access_point_name)
Update the Access Point Name in the modem.
mdm_hl7800_event
Event type reported to a mdm_hl7800_event_callback_t.
Definition hl7800.h:149
int32_t mdm_hl7800_send_at_cmd(const uint8_t *data, uint8_t resp_timeout, char *resp, uint16_t *resp_len)
Send an AT command to the HL7800.
char * mdm_hl7800_get_imei(void)
Get the HL7800 IMEI.
void mdm_hl7800_wakeup(bool awake)
Control the wake signals to the HL7800.
mdm_hl7800_gps_string_types
Type of GPS string reported by HL7800_EVENT_GPS.
Definition hl7800.h:381
int32_t mdm_hl7800_update_fw(char *file_path)
Update the HL7800 via XMODEM protocol.
mdm_hl7800_state
Driver state.
Definition hl7800.h:280
mdm_hl7800_gnss_status
Status of a GNSS event.
Definition hl7800.h:364
char * mdm_hl7800_get_imsi(void)
Get the IMSI.
mdm_hl7800_gnss_event
GNSS event reported by the modem.
Definition hl7800.h:355
#define MDM_HL7800_APN_MAX_SIZE
Size of an Access Point Name, including the terminating NUL.
Definition hl7800.h:52
mdm_hl7800_network_state
Network registration state.
Definition hl7800.h:302
uint32_t mdm_hl7800_log_filter_set(uint32_t level)
Set the log level for the modem.
int32_t mdm_hl7800_polte_register(void)
Register modem/SIM with polte.io.
mdm_hl7800_fota_state
Firmware update state.
Definition hl7800.h:324
int32_t mdm_hl7800_set_bands(const char *bands)
Set the bands available for the LTE connection.
int32_t mdm_hl7800_reset(void)
Reset the HL7800 (and allow it to reconfigure).
int32_t mdm_hl7800_perform_site_survey(void)
Perform a site survey.
int32_t mdm_hl7800_update_rat(enum mdm_hl7800_radio_mode value)
Update the Radio Access Technology (mode).
void mdm_hl7800_generate_status_events(void)
Force modem module to generate status events.
#define MDM_HL7800_APN_PASSWORD_MAX_SIZE
Size of an APN password, including the terminating NUL.
Definition hl7800.h:56
char * mdm_hl7800_get_fw_version(void)
Get the HL7800 firmware version.
#define MDM_HL7800_APN_USERNAME_MAX_SIZE
Size of an APN username, including the terminating NUL.
Definition hl7800.h:54
void mdm_hl7800_get_signal_quality(int *rsrp, int *sinr)
Get the signal quality of the HL7800.
int mdm_hl7800_unregister_event_callback(struct mdm_hl7800_callback_agent *agent)
Unregister a callback event function.
int32_t mdm_hl7800_power_off(void)
Power off the HL7800.
void mdm_hl7800_register_cts_callback(void(*func)(int state))
Allows mapping of UART1_CTS signal to a user accessible test point on the development board.
mdm_hl7800_gnss_position_event
Position fix status reported by HL7800_EVENT_GPS_POSITION_STATUS.
Definition hl7800.h:371
mdm_hl7800_startup_state
Modem startup state.
Definition hl7800.h:286
char * mdm_hl7800_get_iccid(void)
Get the SIM card ICCID.
mdm_hl7800_functionality
Modem functionality level, follows the +CFUN values.
Definition hl7800.h:337
void(* mdm_hl7800_event_callback_t)(enum mdm_hl7800_event event, void *event_data)
Event callback.
Definition hl7800.h:425
int32_t mdm_hl7800_get_local_time(struct tm *tm, int32_t *offset)
Get the local time from the modem's real time clock.
int mdm_hl7800_register_event_callback(struct mdm_hl7800_callback_agent *agent)
Register a function that is called when a modem event occurs.
@ MDM_RAT_CAT_NB1
NB-IoT (LTE Cat NB1).
Definition hl7800.h:140
@ MDM_RAT_CAT_M1
LTE-M (LTE Cat M1).
Definition hl7800.h:139
@ HL7800_SLEEP_SLEEP
Sleep (UART can wake the modem).
Definition hl7800.h:320
@ HL7800_SLEEP_LITE_HIBERNATE
Lite hibernate (IO state retained).
Definition hl7800.h:319
@ HL7800_SLEEP_AWAKE
Awake.
Definition hl7800.h:318
@ HL7800_SLEEP_HIBERNATE
Hibernate (lowest power consumption).
Definition hl7800.h:317
@ HL7800_SLEEP_UNINITIALIZED
Sleep state not known yet.
Definition hl7800.h:316
@ HL7800_EVENT_NETWORK_STATE_CHANGE
Network registration change.
Definition hl7800.h:158
@ HL7800_EVENT_GPS_POSITION_STATUS
Position fix status change.
Definition hl7800.h:242
@ HL7800_EVENT_STARTUP_STATE_CHANGE
Modem startup state change.
Definition hl7800.h:183
@ HL7800_EVENT_POLTE
PoLTE location response.
Definition hl7800.h:262
@ HL7800_EVENT_BANDS
Configured LTE bands changed.
Definition hl7800.h:202
@ HL7800_EVENT_SITE_SURVEY
Site survey response.
Definition hl7800.h:269
@ HL7800_EVENT_FOTA_COUNT
Firmware update progress.
Definition hl7800.h:222
@ HL7800_EVENT_APN_UPDATE
Access Point Name change.
Definition hl7800.h:164
@ HL7800_EVENT_RESERVED
Reserved, not generated.
Definition hl7800.h:151
@ HL7800_EVENT_SLEEP_STATE_CHANGE
Sleep state change.
Definition hl7800.h:190
@ HL7800_EVENT_POLTE_LOCATE_STATUS
Result of issuing the PoLTE locate command.
Definition hl7800.h:256
@ HL7800_EVENT_REVISION
Firmware revision change.
Definition hl7800.h:228
@ HL7800_EVENT_STATE
Driver state change.
Definition hl7800.h:276
@ HL7800_EVENT_ACTIVE_BANDS
Active LTE bands changed.
Definition hl7800.h:208
@ HL7800_EVENT_RSSI
Reference Signal Received Power change.
Definition hl7800.h:170
@ HL7800_EVENT_RAT
Radio Access Technology change.
Definition hl7800.h:196
@ HL7800_EVENT_SINR
Signal to Interference plus Noise Ratio change.
Definition hl7800.h:176
@ HL7800_EVENT_POLTE_REGISTRATION
PoLTE registration result.
Definition hl7800.h:249
@ HL7800_EVENT_FOTA_STATE
Firmware update state change.
Definition hl7800.h:215
@ HL7800_EVENT_GPS
GPS data received.
Definition hl7800.h:235
@ HL7800_GPS_STR_GPS_TIME
Time of the position fix.
Definition hl7800.h:384
@ HL7800_GPS_STR_ALTITUDE
Altitude.
Definition hl7800.h:387
@ HL7800_GPS_STR_ALT_UNC
Altitude uncertainty.
Definition hl7800.h:388
@ HL7800_GPS_STR_VER_SPEED
Vertical speed.
Definition hl7800.h:391
@ HL7800_GPS_STR_LONGITUDE
Longitude.
Definition hl7800.h:383
@ HL7800_GPS_STR_LATITUDE
Latitude.
Definition hl7800.h:382
@ HL7800_GPS_STR_FIX_TYPE
Type of position fix.
Definition hl7800.h:385
@ HL7800_GPS_STR_HOR_SPEED
Horizontal speed.
Definition hl7800.h:390
@ HL7800_GPS_STR_HEPE
Horizontal Estimated Position Error.
Definition hl7800.h:386
@ HL7800_GPS_STR_DIRECTION
Direction of movement.
Definition hl7800.h:389
@ HL7800_STATE_INITIALIZED
Driver has configured the modem.
Definition hl7800.h:282
@ HL7800_STATE_NOT_READY
Driver is not ready.
Definition hl7800.h:281
@ HL7800_GNSS_STATUS_FAILURE
Operation failed.
Definition hl7800.h:366
@ HL7800_GNSS_STATUS_INVALID
Status could not be parsed.
Definition hl7800.h:365
@ HL7800_GNSS_STATUS_SUCCESS
Operation succeeded.
Definition hl7800.h:367
@ HL7800_GNSS_EVENT_POSITION
Position fix status change.
Definition hl7800.h:360
@ HL7800_GNSS_EVENT_INVALID
Event could not be parsed.
Definition hl7800.h:356
@ HL7800_GNSS_EVENT_INIT
GNSS initialized.
Definition hl7800.h:357
@ HL7800_GNSS_EVENT_START
Position fix started.
Definition hl7800.h:358
@ HL7800_GNSS_EVENT_STOP
Position fix stopped.
Definition hl7800.h:359
@ HL7800_EMERGENCY
Emergency services only.
Definition hl7800.h:309
@ HL7800_SEARCHING
Not registered, searching for an operator.
Definition hl7800.h:305
@ HL7800_UNABLE_TO_CONFIGURE
Modem could not be configured.
Definition hl7800.h:311
@ HL7800_REGISTRATION_DENIED
Registration denied.
Definition hl7800.h:306
@ HL7800_HOME_NETWORK
Registered, home network.
Definition hl7800.h:304
@ HL7800_NOT_REGISTERED
Not registered, not searching.
Definition hl7800.h:303
@ HL7800_ROAMING
Registered, roaming.
Definition hl7800.h:308
@ HL7800_OUT_OF_COVERAGE
Out of coverage.
Definition hl7800.h:307
@ HL7800_FOTA_PAD
Padding of the last XMODEM block.
Definition hl7800.h:328
@ HL7800_FOTA_REBOOT_AND_RECONFIGURE
Modem is rebooting to complete the update.
Definition hl7800.h:332
@ HL7800_FOTA_INSTALL
Modem is installing the update.
Definition hl7800.h:331
@ HL7800_FOTA_WIP
File transfer in progress.
Definition hl7800.h:327
@ HL7800_FOTA_SEND_EOT
End of transmission being sent.
Definition hl7800.h:329
@ HL7800_FOTA_FILE_ERROR
Update file could not be read.
Definition hl7800.h:330
@ HL7800_FOTA_IDLE
No update in progress.
Definition hl7800.h:325
@ HL7800_FOTA_COMPLETE
Update complete.
Definition hl7800.h:333
@ HL7800_FOTA_START
Update file transfer is starting.
Definition hl7800.h:326
@ HL7800_GNSS_POSITION_EVENT_2D_AVAILABLE
2D position fix available
Definition hl7800.h:375
@ HL7800_GNSS_POSITION_EVENT_3D_AVAILABLE
3D position fix available
Definition hl7800.h:376
@ HL7800_GNSS_POSITION_EVENT_FIXED_TO_INVALID
Position fix was lost.
Definition hl7800.h:377
@ HL7800_GNSS_POSITION_EVENT_INVALID
Event could not be parsed.
Definition hl7800.h:372
@ HL7800_GNSS_POSITION_EVENT_LOST_OR_NOT_AVAILABLE_YET
No position fix.
Definition hl7800.h:373
@ HL7800_GNSS_POSITION_EVENT_PREDICTION_AVAILABLE
Predicted position available.
Definition hl7800.h:374
@ HL7800_STARTUP_STATE_SIMLOCK
SIM locked to another operator.
Definition hl7800.h:290
@ HL7800_STARTUP_STATE_UNRECOVERABLE_ERROR
Unrecoverable error.
Definition hl7800.h:291
@ HL7800_STARTUP_STATE_WAITING_FOR_ACCESS_CODE
SIM waiting for PIN or PUK.
Definition hl7800.h:288
@ HL7800_STARTUP_STATE_SIM_NOT_PRESENT
No SIM card present.
Definition hl7800.h:289
@ HL7800_STARTUP_STATE_INACTIVE_SIM
SIM card is inactive.
Definition hl7800.h:293
@ HL7800_STARTUP_STATE_UNKNOWN
Unknown state.
Definition hl7800.h:292
@ HL7800_STARTUP_STATE_READY
Ready.
Definition hl7800.h:287
@ HL7800_FUNCTIONALITY_AIRPLANE
Airplane mode (radio disabled).
Definition hl7800.h:340
@ HL7800_FUNCTIONALITY_FULL
Full functionality.
Definition hl7800.h:339
@ HL7800_FUNCTIONALITY_MINIMUM
Minimum (reduced) functionality.
Definition hl7800.h:338
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:44
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Access Point Name configuration.
Definition hl7800.h:76
char value[64]
APN.
Definition hl7800.h:77
char password[65]
APN password.
Definition hl7800.h:79
char username[65]
APN username.
Definition hl7800.h:78
Event callback registration.
Definition hl7800.h:429
sys_snode_t node
Reserved for the driver, do not modify.
Definition hl7800.h:431
mdm_hl7800_event_callback_t event_callback
Callback invoked when a modem event occurs.
Definition hl7800.h:433
Event data made of a code and a string.
Definition hl7800.h:349
char * string
NUL terminated string reported with the value.
Definition hl7800.h:351
uint8_t code
Value of the enumeration matching the event type.
Definition hl7800.h:350
PoLTE location response.
Definition hl7800.h:402
int status
Negative errno, 0 on success, positive error code from the server.
Definition hl7800.h:409
char confidence_in_meters[33]
Location confidence, in meters.
Definition hl7800.h:415
char longitude[33]
Longitude.
Definition hl7800.h:413
uint32_t timestamp
Timestamp of the location response.
Definition hl7800.h:404
char latitude[33]
Latitude.
Definition hl7800.h:411
PoLTE registration result.
Definition hl7800.h:395
int status
Negative errno, 0 on success.
Definition hl7800.h:396
char * password
PoLTE password, not valid if status is non-zero.
Definition hl7800.h:398
char * user
PoLTE user, not valid if status is non-zero.
Definition hl7800.h:397
Site survey result.
Definition hl7800.h:130
int rsrq
Reference Signal Received Quality.
Definition hl7800.h:134
int rsrp
Reference Signal Received Power.
Definition hl7800.h:133
uint32_t cell_id
Cell identity.
Definition hl7800.h:132
uint32_t earfcn
EUTRA Absolute Radio Frequency Channel Number.
Definition hl7800.h:131