Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
simcom-sim7080.h
Go to the documentation of this file.
1
8
9#ifndef ZEPHYR_INCLUDE_DRIVERS_MODEM_SIMCOM_SIM7080_H
10#define ZEPHYR_INCLUDE_DRIVERS_MODEM_SIMCOM_SIM7080_H
11
12#include <zephyr/types.h>
13
14#include <stdbool.h>
15#include <stdint.h>
16#include <time.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
23#define SIM7080_GNSS_DATA_UTC_LEN 20
25#define SIM7080_SMS_MAX_LEN 160
27#define SIM7080_UE_SYS_INFO_BAND_SIZE 32
29#define SIM7080_DNS_MAX_RECOUNT 10
31#define SIM7080_DNS_MAX_TIMEOUT_MS 60000
32
34#define SIM7080_LTE_CHANNEL_MASK_NB1 0x7BEFFU
36#define SIM7080_LTE_CHANNEL_MASK_M1 0x5FFFFU
38#define SIM7080_NUM_LTE_CHANNELS 19U
39
48
56
79
119
128
135
163
173
181
190
214
248
264
271
278
285
292
301
308
317
336
343
351int mdm_sim7080_download_xtra(uint8_t server_id, const char *f_name);
352
360int mdm_sim7080_query_xtra_validity(int16_t *diff_h, int16_t *duration_h, struct tm *inject);
361
369
374
378const char *mdm_sim7080_get_model(void);
379
383const char *mdm_sim7080_get_revision(void);
384
388const char *mdm_sim7080_get_imei(void);
389
393const char *mdm_sim7080_get_iccid(void);
394
408
416
426int mdm_sim7080_set_gpio(int gpio, int level);
427
438int mdm_sim7080_ftp_get_start(const char *server, const char *user, const char *passwd,
439 const char *file, const char *path);
440
449int mdm_sim7080_ftp_get_read(char *dst, size_t *size);
450
460
468
477
488
496
497#if defined(CONFIG_MODEM_SIMCOM_SIM7080_SOCKETS_SOCKOPT_TLS)
506typedef int (*sim7080_tls_cert_read_func)(uint8_t *buf, size_t max_len, size_t offset);
507
521int mdm_sim7080_import_root_ca(const char *cert_name, sim7080_tls_cert_read_func read_func,
522 size_t cert_len);
523
541int mdm_sim7080_import_client_cert(const char *cert_name, sim7080_tls_cert_read_func cert_read_func,
542 size_t cert_len, const char *key_name,
543 sim7080_tls_cert_read_func key_read_func, size_t key_len,
544 const char *passwd);
545
563int mdm_sim7080_import_dtls_psk(const char *psk_name, sim7080_tls_cert_read_func read_func,
564 size_t psk_len);
565
576int mdm_sim7080_configure_tls_certs(int fd, const char *root_ca, const char *client_cert);
577
587int mdm_sim7080_configure_dtls_psktable(int fd, const char *psktable);
588#endif
589
596
610
618
635
636#ifdef __cplusplus
637}
638#endif
639
640#endif /* ZEPHYR_INCLUDE_DRIVERS_MODEM_SIMCOM_SIM7080_H */
#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)
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:50
@ SIM7080_RAT_LTE_M1
LTE CAT M1 only.
Definition simcom-sim7080.h:52
@ SIM7080_RAT_LTE_AUTO
Modem automatically selects M1 or NB1.
Definition simcom-sim7080.h:53
@ SIM7080_RAT_LTE_NB1
NB-IoT only.
Definition simcom-sim7080.h:51
@ SIM7080_RAT_GSM
GSM.
Definition simcom-sim7080.h:54
sim7080_sms_stat
Possible sms states in memory.
Definition simcom-sim7080.h:121
@ SIM7080_SMS_STAT_REC_READ
Message read.
Definition simcom-sim7080.h:123
@ SIM7080_SMS_STAT_REC_UNREAD
Message unread.
Definition simcom-sim7080.h:122
@ SIM7080_SMS_STAT_STO_UNSENT
Message stored unsent.
Definition simcom-sim7080.h:124
@ SIM7080_SMS_STAT_ALL
Status count.
Definition simcom-sim7080.h:126
@ SIM7080_SMS_STAT_STO_SENT
Message stored sent.
Definition simcom-sim7080.h:125
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:175
@ SIM7080_UE_SYS_MODE_LTE_NB_IOT
LTE NB IOT.
Definition simcom-sim7080.h:179
@ SIM7080_UE_SYS_MODE_NO_SERVICE
No service.
Definition simcom-sim7080.h:176
@ SIM7080_UE_SYS_MODE_GSM
GSM.
Definition simcom-sim7080.h:177
@ SIM7080_UE_SYS_MODE_LTE_CAT_M1
LTE CAT M1.
Definition simcom-sim7080.h:178
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:27
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:130
@ SIM7080_FTP_RC_FINISHED
Session finished.
Definition simcom-sim7080.h:132
@ SIM7080_FTP_RC_OK
Operation finished correctly.
Definition simcom-sim7080.h:131
@ SIM7080_FTP_RC_ERROR
An error occurred.
Definition simcom-sim7080.h:133
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:41
@ SIM7080_STATE_NETWORKING
Network active.
Definition simcom-sim7080.h:44
@ SIM7080_STATE_OFF
Modem off.
Definition simcom-sim7080.h:46
@ SIM7080_STATE_IDLE
Modem idle.
Definition simcom-sim7080.h:43
@ SIM7080_STATE_INIT
Initial modem state.
Definition simcom-sim7080.h:42
@ SIM7080_STATE_GNSS
GNSS active.
Definition simcom-sim7080.h:45
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:25
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:23
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:183
@ SIM7080_UE_OP_MODE_OFFLINE
Offline.
Definition simcom-sim7080.h:185
@ SIM7080_UE_OP_MODE_RESET
Reset.
Definition simcom-sim7080.h:187
@ SIM7080_UE_OP_MODE_FACTORY_TEST_MODE
Factory test mode.
Definition simcom-sim7080.h:186
@ SIM7080_UE_OP_MODE_ONLINE
Online.
Definition simcom-sim7080.h:184
@ SIM7080_UE_OP_MODE_LOW_POWER_MODE
Low power mode.
Definition simcom-sim7080.h:188
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:58
@ SIM7080_LTE_CHAN_B20
LTE Band 20.
Definition simcom-sim7080.h:70
@ SIM7080_LTE_CHAN_B27
LTE Band 27.
Definition simcom-sim7080.h:73
@ SIM7080_LTE_CHAN_B13
LTE Band 13.
Definition simcom-sim7080.h:66
@ SIM7080_LTE_CHAN_B19
LTE Band 19.
Definition simcom-sim7080.h:69
@ SIM7080_LTE_CHAN_B26
LTE Band 26.
Definition simcom-sim7080.h:72
@ SIM7080_LTE_CHAN_B18
LTE Band 18.
Definition simcom-sim7080.h:68
@ SIM7080_LTE_CHAN_B4
LTE Band 4.
Definition simcom-sim7080.h:62
@ SIM7080_LTE_CHAN_B8
LTE Band 8.
Definition simcom-sim7080.h:64
@ SIM7080_LTE_CHAN_B25
LTE Band 25.
Definition simcom-sim7080.h:71
@ SIM7080_LTE_CHAN_B14
LTE Band 14.
Definition simcom-sim7080.h:67
@ SIM7080_LTE_CHAN_B85
LTE Band 85.
Definition simcom-sim7080.h:77
@ SIM7080_LTE_CHAN_B5
LTE Band 5.
Definition simcom-sim7080.h:63
@ SIM7080_LTE_CHAN_B2
LTE Band 2.
Definition simcom-sim7080.h:60
@ SIM7080_LTE_CHAN_B3
LTE Band 3.
Definition simcom-sim7080.h:61
@ SIM7080_LTE_CHAN_B28
LTE Band 28.
Definition simcom-sim7080.h:74
@ SIM7080_LTE_CHAN_B71
LTE Band 71.
Definition simcom-sim7080.h:76
@ SIM7080_LTE_CHAN_B1
LTE Band 1.
Definition simcom-sim7080.h:59
@ SIM7080_LTE_CHAN_B12
LTE Band 12.
Definition simcom-sim7080.h:65
@ SIM7080_LTE_CHAN_B66
LTE Band 66.
Definition simcom-sim7080.h:75
__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
Definition pwd.h:15
Sim7080 gnss data structure.
Definition simcom-sim7080.h:81
int32_t lon
Longitude in 10^-7 degree.
Definition simcom-sim7080.h:101
int32_t lat
Latitude in 10^-7 degree.
Definition simcom-sim7080.h:97
uint16_t kmh
Speed in 10^-1 km/h.
Definition simcom-sim7080.h:117
uint16_t cog
Course over ground un 10^-2 degree.
Definition simcom-sim7080.h:113
bool fix_status
Whether fix is acquired or not.
Definition simcom-sim7080.h:89
char utc[20]
UTC in format yyyyMMddhhmmss.sss.
Definition simcom-sim7080.h:93
int32_t alt
Altitude in mm.
Definition simcom-sim7080.h:105
bool run_status
Whether gnss is powered or not.
Definition simcom-sim7080.h:85
uint16_t hdop
Horizontal dilution of precision in 10^-2.
Definition simcom-sim7080.h:109
Buffer structure for sms reads.
Definition simcom-sim7080.h:167
uint8_t nsms
Number of sms structures.
Definition simcom-sim7080.h:171
struct sim7080_sms * sms
sms structures to read to.
Definition simcom-sim7080.h:169
Buffer structure for sms.
Definition simcom-sim7080.h:139
uint8_t day
Day of the month.
Definition simcom-sim7080.h:152
uint8_t second
Second.
Definition simcom-sim7080.h:155
uint8_t month
Month of the year.
Definition simcom-sim7080.h:151
uint8_t minute
Minute.
Definition simcom-sim7080.h:154
char data[160+1]
Buffered sms.
Definition simcom-sim7080.h:159
uint8_t first_octet
First octet of the sms.
Definition simcom-sim7080.h:141
enum sim7080_sms_stat stat
Status of the sms in memory.
Definition simcom-sim7080.h:145
uint8_t tp_pid
Message protocol identifier.
Definition simcom-sim7080.h:143
uint16_t index
Index of the sms in memory.
Definition simcom-sim7080.h:147
uint8_t timezone
Current timezone.
Definition simcom-sim7080.h:156
uint8_t hour
Hour of the day.
Definition simcom-sim7080.h:153
uint8_t data_len
Length of the sms in buffer.
Definition simcom-sim7080.h:161
uint8_t year
Current Year.
Definition simcom-sim7080.h:150
Sim7080 ue system information structure for gsm.
Definition simcom-sim7080.h:194
uint16_t mcn
Mobile network code.
Definition simcom-sim7080.h:198
uint16_t c2
C2 coefficient.
Definition simcom-sim7080.h:212
uint16_t lac
Location area code.
Definition simcom-sim7080.h:200
uint16_t cid
Cell ID.
Definition simcom-sim7080.h:202
uint16_t c1
C1 coefficient.
Definition simcom-sim7080.h:210
uint8_t arfcn[32+1]
Absolute radio frequency channel number.
Definition simcom-sim7080.h:204
int16_t track_lo_adjust
Track LO adjust.
Definition simcom-sim7080.h:208
int16_t rx_lvl
RX level in dBm.
Definition simcom-sim7080.h:206
uint16_t mcc
Mobile country code.
Definition simcom-sim7080.h:196
Sim7080 ue system information structure for LTE.
Definition simcom-sim7080.h:218
uint16_t dlbw
Downlink bandwidth in MHz.
Definition simcom-sim7080.h:234
uint16_t mcc
Mobile country code.
Definition simcom-sim7080.h:220
int16_t rssi
Received signal strength indicator in dBm.
Definition simcom-sim7080.h:242
uint16_t mcn
Mobile network code.
Definition simcom-sim7080.h:222
int16_t sinr
Signal to interference plus noise ratio in dB.
Definition simcom-sim7080.h:246
int16_t rssnr
Reference signal signal to noise ratio in dB.
Definition simcom-sim7080.h:244
uint32_t sci
Serving Cell ID.
Definition simcom-sim7080.h:226
uint16_t ulbw
Uplink bandwidth in MHz.
Definition simcom-sim7080.h:236
uint8_t band[32+1]
Frequency band.
Definition simcom-sim7080.h:230
uint16_t earfcn
E-UTRA absolute radio frequency channel number.
Definition simcom-sim7080.h:232
int16_t rsrp
Reference signal received power in dBm.
Definition simcom-sim7080.h:240
uint16_t tac
Tracing area code.
Definition simcom-sim7080.h:224
uint16_t pci
Physical Cell ID.
Definition simcom-sim7080.h:228
int16_t rsrq
Reference signal received quality in dB.
Definition simcom-sim7080.h:238
Sim7080 ue system information structure.
Definition simcom-sim7080.h:252
enum sim7080_ue_sys_mode sys_mode
Refer to sim7080_ue_sys_mode.
Definition simcom-sim7080.h:254
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:256
struct sim7080_ue_sys_info_lte lte
Only set if sys mode is LTE CAT-M1/NB-IOT.
Definition simcom-sim7080.h:261
struct sim7080_ue_sys_info_gsm gsm
Only set if sys_mode is GSM.
Definition simcom-sim7080.h:259
Definition time.h:24