10#ifndef ZEPHYR_INCLUDE_DRIVERS_MODEM_SIMCOM_SIM7080_H
11#define ZEPHYR_INCLUDE_DRIVERS_MODEM_SIMCOM_SIM7080_H
31#define SIM7080_GNSS_DATA_UTC_LEN 20
33#define SIM7080_SMS_MAX_LEN 160
35#define SIM7080_UE_SYS_INFO_BAND_SIZE 32
37#define SIM7080_DNS_MAX_RECOUNT 10
39#define SIM7080_DNS_MAX_TIMEOUT_MS 60000
42#define SIM7080_LTE_CHANNEL_MASK_NB1 0x7BEFFU
44#define SIM7080_LTE_CHANNEL_MASK_M1 0x5FFFFU
46#define SIM7080_NUM_LTE_CHANNELS 19U
447 const char *file,
const char *path);
505#if defined(CONFIG_MODEM_SIMCOM_SIM7080_SOCKETS_SOCKOPT_TLS)
514typedef int (*sim7080_tls_cert_read_func)(
uint8_t *buf,
size_t max_len,
size_t offset);
529int mdm_sim7080_import_root_ca(
const char *cert_name, sim7080_tls_cert_read_func read_func,
549int mdm_sim7080_import_client_cert(
const char *cert_name, sim7080_tls_cert_read_func cert_read_func,
550 size_t cert_len,
const char *key_name,
551 sim7080_tls_cert_read_func key_read_func,
size_t key_len,
571int mdm_sim7080_import_dtls_psk(
const char *psk_name, sim7080_tls_cert_read_func read_func,
584int mdm_sim7080_configure_tls_certs(
int fd,
const char *root_ca,
const char *client_cert);
595int mdm_sim7080_configure_dtls_psktable(
int fd,
const char *psktable);
int mdm_sim7080_dns_set_lookup_params(uint8_t recount, uint16_t timeout)
Set the dns query lookup parameters.
sim7080_rat
Modem radio access technology.
Definition simcom-sim7080.h:58
sim7080_sms_stat
Possible sms states in memory.
Definition simcom-sim7080.h:129
enum sim7080_state mdm_sim7080_get_state(void)
Get the current state of the modem.
int mdm_sim7080_query_xtra_validity(int16_t *diff_h, int16_t *duration_h, struct tm *inject)
Query the validity of the XTRA file.
sim7080_ue_sys_mode
UE system mode.
Definition simcom-sim7080.h:183
const char * mdm_sim7080_get_imei(void)
Get the sim7080 imei number.
int mdm_sim7080_get_ue_sys_info(struct sim7080_ue_sys_info *info)
Read the ue system information.
int mdm_sim7080_get_battery_charge(uint8_t *bcs, uint8_t *bcl, uint16_t *voltage)
Read voltage, charge status and battery connection level.
int mdm_sim7080_power_off(void)
Power off the Sim7080.
#define SIM7080_UE_SYS_INFO_BAND_SIZE
Maximum UE system information band size.
Definition simcom-sim7080.h:35
void mdm_sim7080_force_reset(void)
Forcefully reset the modem by pulling pwrkey for 15 seconds.
sim7080_ftp_rc
Possible ftp return codes.
Definition simcom-sim7080.h:138
int mdm_sim7080_set_lte_bands(uint32_t nb1, uint32_t m1)
Set the LTE bands to use.
int mdm_sim7080_ftp_get_start(const char *server, const char *user, const char *passwd, const char *file, const char *path)
Start a ftp get session.
const char * mdm_sim7080_get_model(void)
Get the sim7080 model information.
sim7080_state
Sim7080 modem state.
Definition simcom-sim7080.h:49
int mdm_sim7080_start_gnss(void)
Starts the modem in gnss operation mode.
int mdm_sim7080_stop_gnss(void)
Stops the modem gnss operation mode.
int mdm_sim7080_set_gpio(int gpio, int level)
Set the level of one of the module's GPIO pins.
int mdm_sim7080_get_local_time(struct tm *t)
Get the local time of the modem.
int mdm_sim7080_ftp_get_read(char *dst, size_t *size)
Read data from a ftp get session.
const char * mdm_sim7080_get_manufacturer(void)
Get the sim7080 manufacturer.
int mdm_sim7080_start_gnss_xtra(void)
Starts the modem in gnss operation mode with xtra functionality.
void mdm_sim7080_get_lte_bands(uint32_t *nb1, uint32_t *m1)
Get the currently used LTE bands.
void mdm_sim7080_dns_get_lookup_params(uint8_t *recount, uint16_t *timeout)
Get the dns query lookup parameters.
int mdm_sim7080_power_on(void)
Power on the Sim7080.
const char * mdm_sim7080_get_revision(void)
Get the sim7080 revision.
int mdm_sim7080_stop_network(void)
Stops the networking operation mode of the modem.
int mdm_sim7080_set_rat(enum sim7080_rat rat)
Set the radio technology.
int mdm_sim7080_read_sms(struct sim7080_sms_buffer *buffer)
Read sms from sim module.
#define SIM7080_SMS_MAX_LEN
Maximum SMS length.
Definition simcom-sim7080.h:33
int mdm_sim7080_query_gnss(struct sim7080_gnss_data *data)
Query gnss position form the modem.
#define SIM7080_GNSS_DATA_UTC_LEN
Maximum Length of GNSS UTC data.
Definition simcom-sim7080.h:31
const char * mdm_sim7080_get_iccid(void)
Get the sim7080 iccid number.
int mdm_sim7080_download_xtra(uint8_t server_id, const char *f_name)
Download the XTRA file for assisted gnss.
int mdm_sim7080_start_network(void)
Activates the network operation mode of the modem.
int mdm_sim7080_delete_sms(uint16_t index)
Delete a sms at a given index.
sim7080_ue_op_mode
UE operating mode.
Definition simcom-sim7080.h:191
void mdm_sim7080_get_rat(enum sim7080_rat *rat)
Get the currently selected radio technology.
sim7080_lte_chan
Supported LTE channels.
Definition simcom-sim7080.h:66
@ SIM7080_RAT_LTE_M1
LTE CAT M1 only.
Definition simcom-sim7080.h:60
@ SIM7080_RAT_LTE_AUTO
Modem automatically selects M1 or NB1.
Definition simcom-sim7080.h:61
@ SIM7080_RAT_LTE_NB1
NB-IoT only.
Definition simcom-sim7080.h:59
@ SIM7080_RAT_GSM
GSM.
Definition simcom-sim7080.h:62
@ SIM7080_SMS_STAT_REC_READ
Message read.
Definition simcom-sim7080.h:131
@ SIM7080_SMS_STAT_REC_UNREAD
Message unread.
Definition simcom-sim7080.h:130
@ SIM7080_SMS_STAT_STO_UNSENT
Message stored unsent.
Definition simcom-sim7080.h:132
@ SIM7080_SMS_STAT_ALL
Status count.
Definition simcom-sim7080.h:134
@ SIM7080_SMS_STAT_STO_SENT
Message stored sent.
Definition simcom-sim7080.h:133
@ SIM7080_UE_SYS_MODE_LTE_NB_IOT
LTE NB IOT.
Definition simcom-sim7080.h:187
@ SIM7080_UE_SYS_MODE_NO_SERVICE
No service.
Definition simcom-sim7080.h:184
@ SIM7080_UE_SYS_MODE_GSM
GSM.
Definition simcom-sim7080.h:185
@ SIM7080_UE_SYS_MODE_LTE_CAT_M1
LTE CAT M1.
Definition simcom-sim7080.h:186
@ SIM7080_FTP_RC_FINISHED
Session finished.
Definition simcom-sim7080.h:140
@ SIM7080_FTP_RC_OK
Operation finished correctly.
Definition simcom-sim7080.h:139
@ SIM7080_FTP_RC_ERROR
An error occurred.
Definition simcom-sim7080.h:141
@ SIM7080_STATE_NETWORKING
Network active.
Definition simcom-sim7080.h:52
@ SIM7080_STATE_OFF
Modem off.
Definition simcom-sim7080.h:54
@ SIM7080_STATE_IDLE
Modem idle.
Definition simcom-sim7080.h:51
@ SIM7080_STATE_INIT
Initial modem state.
Definition simcom-sim7080.h:50
@ SIM7080_STATE_GNSS
GNSS active.
Definition simcom-sim7080.h:53
@ SIM7080_UE_OP_MODE_OFFLINE
Offline.
Definition simcom-sim7080.h:193
@ SIM7080_UE_OP_MODE_RESET
Reset.
Definition simcom-sim7080.h:195
@ SIM7080_UE_OP_MODE_FACTORY_TEST_MODE
Factory test mode.
Definition simcom-sim7080.h:194
@ SIM7080_UE_OP_MODE_ONLINE
Online.
Definition simcom-sim7080.h:192
@ SIM7080_UE_OP_MODE_LOW_POWER_MODE
Low power mode.
Definition simcom-sim7080.h:196
@ SIM7080_LTE_CHAN_B20
LTE Band 20.
Definition simcom-sim7080.h:78
@ SIM7080_LTE_CHAN_B27
LTE Band 27.
Definition simcom-sim7080.h:81
@ SIM7080_LTE_CHAN_B13
LTE Band 13.
Definition simcom-sim7080.h:74
@ SIM7080_LTE_CHAN_B19
LTE Band 19.
Definition simcom-sim7080.h:77
@ SIM7080_LTE_CHAN_B26
LTE Band 26.
Definition simcom-sim7080.h:80
@ SIM7080_LTE_CHAN_B18
LTE Band 18.
Definition simcom-sim7080.h:76
@ SIM7080_LTE_CHAN_B4
LTE Band 4.
Definition simcom-sim7080.h:70
@ SIM7080_LTE_CHAN_B8
LTE Band 8.
Definition simcom-sim7080.h:72
@ SIM7080_LTE_CHAN_B25
LTE Band 25.
Definition simcom-sim7080.h:79
@ SIM7080_LTE_CHAN_B14
LTE Band 14.
Definition simcom-sim7080.h:75
@ SIM7080_LTE_CHAN_B85
LTE Band 85.
Definition simcom-sim7080.h:85
@ SIM7080_LTE_CHAN_B5
LTE Band 5.
Definition simcom-sim7080.h:71
@ SIM7080_LTE_CHAN_B2
LTE Band 2.
Definition simcom-sim7080.h:68
@ SIM7080_LTE_CHAN_B3
LTE Band 3.
Definition simcom-sim7080.h:69
@ SIM7080_LTE_CHAN_B28
LTE Band 28.
Definition simcom-sim7080.h:82
@ SIM7080_LTE_CHAN_B71
LTE Band 71.
Definition simcom-sim7080.h:84
@ SIM7080_LTE_CHAN_B1
LTE Band 1.
Definition simcom-sim7080.h:67
@ SIM7080_LTE_CHAN_B12
LTE Band 12.
Definition simcom-sim7080.h:73
@ SIM7080_LTE_CHAN_B66
LTE Band 66.
Definition simcom-sim7080.h:83
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
time_t time(time_t *tloc)
__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
__INT16_TYPE__ int16_t
Definition stdint.h:73
Sim7080 gnss data structure.
Definition simcom-sim7080.h:89
int32_t lon
Longitude in 10^-7 degree.
Definition simcom-sim7080.h:109
int32_t lat
Latitude in 10^-7 degree.
Definition simcom-sim7080.h:105
uint16_t kmh
Speed in 10^-1 km/h.
Definition simcom-sim7080.h:125
uint16_t cog
Course over ground un 10^-2 degree.
Definition simcom-sim7080.h:121
bool fix_status
Whether fix is acquired or not.
Definition simcom-sim7080.h:97
char utc[20]
UTC in format yyyyMMddhhmmss.sss.
Definition simcom-sim7080.h:101
int32_t alt
Altitude in mm.
Definition simcom-sim7080.h:113
bool run_status
Whether gnss is powered or not.
Definition simcom-sim7080.h:93
uint16_t hdop
Horizontal dilution of precision in 10^-2.
Definition simcom-sim7080.h:117
Buffer structure for sms reads.
Definition simcom-sim7080.h:175
uint8_t nsms
Number of sms structures.
Definition simcom-sim7080.h:179
struct sim7080_sms * sms
sms structures to read to.
Definition simcom-sim7080.h:177
Buffer structure for sms.
Definition simcom-sim7080.h:147
uint8_t day
Day of the month.
Definition simcom-sim7080.h:160
uint8_t second
Second.
Definition simcom-sim7080.h:163
uint8_t month
Month of the year.
Definition simcom-sim7080.h:159
uint8_t minute
Minute.
Definition simcom-sim7080.h:162
char data[160+1]
Buffered sms.
Definition simcom-sim7080.h:167
uint8_t first_octet
First octet of the sms.
Definition simcom-sim7080.h:149
enum sim7080_sms_stat stat
Status of the sms in memory.
Definition simcom-sim7080.h:153
uint8_t tp_pid
Message protocol identifier.
Definition simcom-sim7080.h:151
uint16_t index
Index of the sms in memory.
Definition simcom-sim7080.h:155
uint8_t timezone
Current timezone.
Definition simcom-sim7080.h:164
uint8_t hour
Hour of the day.
Definition simcom-sim7080.h:161
uint8_t data_len
Length of the sms in buffer.
Definition simcom-sim7080.h:169
uint8_t year
Current Year.
Definition simcom-sim7080.h:158
Sim7080 ue system information structure for gsm.
Definition simcom-sim7080.h:202
uint16_t mcn
Mobile network code.
Definition simcom-sim7080.h:206
uint16_t c2
C2 coefficient.
Definition simcom-sim7080.h:220
uint16_t lac
Location area code.
Definition simcom-sim7080.h:208
uint16_t cid
Cell ID.
Definition simcom-sim7080.h:210
uint16_t c1
C1 coefficient.
Definition simcom-sim7080.h:218
uint8_t arfcn[32+1]
Absolute radio frequency channel number.
Definition simcom-sim7080.h:212
int16_t track_lo_adjust
Track LO adjust.
Definition simcom-sim7080.h:216
int16_t rx_lvl
RX level in dBm.
Definition simcom-sim7080.h:214
uint16_t mcc
Mobile country code.
Definition simcom-sim7080.h:204
Sim7080 ue system information structure for LTE.
Definition simcom-sim7080.h:226
uint16_t dlbw
Downlink bandwidth in MHz.
Definition simcom-sim7080.h:242
uint16_t mcc
Mobile country code.
Definition simcom-sim7080.h:228
int16_t rssi
Received signal strength indicator in dBm.
Definition simcom-sim7080.h:250
uint16_t mcn
Mobile network code.
Definition simcom-sim7080.h:230
int16_t sinr
Signal to interference plus noise ratio in dB.
Definition simcom-sim7080.h:254
int16_t rssnr
Reference signal signal to noise ratio in dB.
Definition simcom-sim7080.h:252
uint32_t sci
Serving Cell ID.
Definition simcom-sim7080.h:234
uint16_t ulbw
Uplink bandwidth in MHz.
Definition simcom-sim7080.h:244
uint8_t band[32+1]
Frequency band.
Definition simcom-sim7080.h:238
uint16_t earfcn
E-UTRA absolute radio frequency channel number.
Definition simcom-sim7080.h:240
int16_t rsrp
Reference signal received power in dBm.
Definition simcom-sim7080.h:248
uint16_t tac
Tracing area code.
Definition simcom-sim7080.h:232
uint16_t pci
Physical Cell ID.
Definition simcom-sim7080.h:236
int16_t rsrq
Reference signal received quality in dB.
Definition simcom-sim7080.h:246
Sim7080 ue system information structure.
Definition simcom-sim7080.h:260
enum sim7080_ue_sys_mode sys_mode
Refer to sim7080_ue_sys_mode.
Definition simcom-sim7080.h:262
union sim7080_ue_sys_info::@041034271235200172273050166165340340337120372264 cell
Cell information.
enum sim7080_ue_op_mode op_mode
Refer to sim7080_ue_op_mode.
Definition simcom-sim7080.h:264
struct sim7080_ue_sys_info_lte lte
Only set if sys mode is LTE CAT-M1/NB-IOT.
Definition simcom-sim7080.h:269
struct sim7080_ue_sys_info_gsm gsm
Only set if sys_mode is GSM.
Definition simcom-sim7080.h:267