|
1 | | -/* |
| 1 | +/** @file |
| 2 | + * @brief Simcom SIM7080 modem public API header file. |
| 3 | + * |
2 | 4 | * Copyright (C) 2021 metraTec GmbH |
3 | 5 | * |
4 | 6 | * SPDX-License-Identifier: Apache-2.0 |
|
16 | 18 | extern "C" { |
17 | 19 | #endif |
18 | 20 |
|
| 21 | +/** Maximum Length of GNSS UTC data */ |
19 | 22 | #define SIM7080_GNSS_DATA_UTC_LEN 20 |
| 23 | +/** Maximum SMS length */ |
20 | 24 | #define SIM7080_SMS_MAX_LEN 160 |
| 25 | +/** Maximum UE system information band size */ |
21 | 26 | #define SIM7080_UE_SYS_INFO_BAND_SIZE 32 |
22 | 27 |
|
| 28 | +/** Sim7080 modem state */ |
23 | 29 | enum sim7080_state { |
24 | | - SIM7080_STATE_INIT = 0, |
25 | | - SIM7080_STATE_IDLE, |
26 | | - SIM7080_STATE_NETWORKING, |
27 | | - SIM7080_STATE_GNSS, |
28 | | - SIM7080_STATE_OFF, |
| 30 | + SIM7080_STATE_INIT = 0, /**< Initial modem state */ |
| 31 | + SIM7080_STATE_IDLE, /**< Modem idle */ |
| 32 | + SIM7080_STATE_NETWORKING, /**< Network active */ |
| 33 | + SIM7080_STATE_GNSS, /**< GNSS active */ |
| 34 | + SIM7080_STATE_OFF, /**< Modem off */ |
29 | 35 | }; |
30 | 36 |
|
| 37 | +/** Sim7080 gnss data structure */ |
31 | 38 | struct sim7080_gnss_data { |
32 | 39 | /** |
33 | 40 | * Whether gnss is powered or not. |
@@ -67,145 +74,149 @@ struct sim7080_gnss_data { |
67 | 74 | uint16_t kmh; |
68 | 75 | }; |
69 | 76 |
|
70 | | -/** |
71 | | - * Possible sms states in memory. |
72 | | - */ |
| 77 | +/** Possible sms states in memory. */ |
73 | 78 | enum sim7080_sms_stat { |
74 | | - SIM7080_SMS_STAT_REC_UNREAD = 0, |
75 | | - SIM7080_SMS_STAT_REC_READ, |
76 | | - SIM7080_SMS_STAT_STO_UNSENT, |
77 | | - SIM7080_SMS_STAT_STO_SENT, |
78 | | - SIM7080_SMS_STAT_ALL, |
| 79 | + SIM7080_SMS_STAT_REC_UNREAD = 0, /**< Message unread */ |
| 80 | + SIM7080_SMS_STAT_REC_READ, /**< Message read*/ |
| 81 | + SIM7080_SMS_STAT_STO_UNSENT, /**< Message stored unsent */ |
| 82 | + SIM7080_SMS_STAT_STO_SENT, /**< Message stored sent */ |
| 83 | + SIM7080_SMS_STAT_ALL, /**< Status count */ |
79 | 84 | }; |
80 | 85 |
|
81 | | -/** |
82 | | - * Possible ftp return codes. |
83 | | - */ |
| 86 | +/** Possible ftp return codes. */ |
84 | 87 | enum sim7080_ftp_rc { |
85 | | - /* Operation finished correctly. */ |
86 | | - SIM7080_FTP_RC_OK = 0, |
87 | | - /* Session finished. */ |
88 | | - SIM7080_FTP_RC_FINISHED, |
89 | | - /* An error occurred. */ |
90 | | - SIM7080_FTP_RC_ERROR, |
| 88 | + SIM7080_FTP_RC_OK = 0, /**< Operation finished correctly. */ |
| 89 | + SIM7080_FTP_RC_FINISHED, /**< Session finished. */ |
| 90 | + SIM7080_FTP_RC_ERROR, /**< An error occurred. */ |
91 | 91 | }; |
92 | 92 |
|
93 | 93 | /** |
94 | 94 | * Buffer structure for sms. |
95 | 95 | */ |
96 | 96 | struct sim7080_sms { |
97 | | - /* First octet of the sms. */ |
| 97 | + /** First octet of the sms. */ |
98 | 98 | uint8_t first_octet; |
99 | | - /* Message protocol identifier. */ |
| 99 | + /** Message protocol identifier. */ |
100 | 100 | uint8_t tp_pid; |
101 | | - /* Status of the sms in memory. */ |
| 101 | + /** Status of the sms in memory. */ |
102 | 102 | enum sim7080_sms_stat stat; |
103 | | - /* Index of the sms in memory. */ |
| 103 | + /** Index of the sms in memory. */ |
104 | 104 | uint16_t index; |
105 | | - /* Time the sms was received. */ |
| 105 | + /** Time the sms was received. */ |
106 | 106 | struct { |
107 | | - uint8_t year; |
108 | | - uint8_t month; |
109 | | - uint8_t day; |
110 | | - uint8_t hour; |
111 | | - uint8_t minute; |
112 | | - uint8_t second; |
113 | | - uint8_t timezone; |
| 107 | + uint8_t year; /**< Current Year */ |
| 108 | + uint8_t month; /**< Month of the year */ |
| 109 | + uint8_t day; /**< Day of the month */ |
| 110 | + uint8_t hour; /**< Hour of the day */ |
| 111 | + uint8_t minute; /**< Minute */ |
| 112 | + uint8_t second; /**< Second */ |
| 113 | + uint8_t timezone; /**< Current timezone */ |
114 | 114 | } time; |
115 | | - /* Buffered sms. */ |
| 115 | + /** Buffered sms. */ |
116 | 116 | char data[SIM7080_SMS_MAX_LEN + 1]; |
117 | | - /* Length of the sms in buffer. */ |
| 117 | + /** Length of the sms in buffer. */ |
118 | 118 | uint8_t data_len; |
119 | 119 | }; |
120 | 120 |
|
121 | 121 | /** |
122 | 122 | * Buffer structure for sms reads. |
123 | 123 | */ |
124 | 124 | struct sim7080_sms_buffer { |
125 | | - /* sms structures to read to. */ |
| 125 | + /** sms structures to read to. */ |
126 | 126 | struct sim7080_sms *sms; |
127 | | - /* Number of sms structures. */ |
| 127 | + /** Number of sms structures. */ |
128 | 128 | uint8_t nsms; |
129 | 129 | }; |
130 | 130 |
|
| 131 | +/** UE system mode */ |
131 | 132 | enum sim7080_ue_sys_mode { |
132 | | - SIM7080_UE_SYS_MODE_NO_SERVICE, |
133 | | - SIM7080_UE_SYS_MODE_GSM, |
134 | | - SIM7080_UE_SYS_MODE_LTE_CAT_M1, |
135 | | - SIM7080_UE_SYS_MODE_LTE_NB_IOT, |
| 133 | + SIM7080_UE_SYS_MODE_NO_SERVICE, /**< No service */ |
| 134 | + SIM7080_UE_SYS_MODE_GSM, /**< GSM */ |
| 135 | + SIM7080_UE_SYS_MODE_LTE_CAT_M1, /**< LTE CAT M1 */ |
| 136 | + SIM7080_UE_SYS_MODE_LTE_NB_IOT, /**< LTE NB IOT */ |
136 | 137 | }; |
137 | 138 |
|
| 139 | +/** UE operating mode */ |
138 | 140 | enum sim7080_ue_op_mode { |
139 | | - SIM7080_UE_OP_MODE_ONLINE, |
140 | | - SIM7080_UE_OP_MODE_OFFLINE, |
141 | | - SIM7080_UE_OP_MODE_FACTORY_TEST_MODE, |
142 | | - SIM7080_UE_OP_MODE_RESET, |
143 | | - SIM7080_UE_OP_MODE_LOW_POWER_MODE, |
| 141 | + SIM7080_UE_OP_MODE_ONLINE, /**< Online */ |
| 142 | + SIM7080_UE_OP_MODE_OFFLINE, /**< Offline */ |
| 143 | + SIM7080_UE_OP_MODE_FACTORY_TEST_MODE, /**< Factory test mode */ |
| 144 | + SIM7080_UE_OP_MODE_RESET, /**< Reset */ |
| 145 | + SIM7080_UE_OP_MODE_LOW_POWER_MODE, /**< Low power mode */ |
144 | 146 | }; |
145 | 147 |
|
| 148 | +/** |
| 149 | + * Sim7080 ue system information structure for gsm. |
| 150 | + */ |
146 | 151 | struct sim7080_ue_sys_info_gsm { |
147 | | - /* Mobile country code */ |
| 152 | + /** Mobile country code */ |
148 | 153 | uint16_t mcc; |
149 | | - /* Mobile network code */ |
| 154 | + /** Mobile network code */ |
150 | 155 | uint16_t mcn; |
151 | | - /* Location area code */ |
| 156 | + /** Location area code */ |
152 | 157 | uint16_t lac; |
153 | | - /* Cell ID */ |
| 158 | + /** Cell ID */ |
154 | 159 | uint16_t cid; |
155 | | - /* Absolute radio frequency channel number */ |
| 160 | + /** Absolute radio frequency channel number */ |
156 | 161 | uint8_t arfcn[SIM7080_UE_SYS_INFO_BAND_SIZE + 1]; |
157 | | - /* RX level in dBm */ |
| 162 | + /** RX level in dBm */ |
158 | 163 | int16_t rx_lvl; |
159 | | - /* Track LO adjust */ |
| 164 | + /** Track LO adjust */ |
160 | 165 | int16_t track_lo_adjust; |
161 | | - /* C1 coefficient */ |
| 166 | + /** C1 coefficient */ |
162 | 167 | uint16_t c1; |
163 | | - /* C2 coefficient */ |
| 168 | + /** C2 coefficient */ |
164 | 169 | uint16_t c2; |
165 | 170 | }; |
166 | 171 |
|
| 172 | +/** |
| 173 | + * Sim7080 ue system information structure for LTE. |
| 174 | + */ |
167 | 175 | struct sim7080_ue_sys_info_lte { |
168 | | - /* Mobile country code */ |
| 176 | + /** Mobile country code */ |
169 | 177 | uint16_t mcc; |
170 | | - /* Mobile network code */ |
| 178 | + /** Mobile network code */ |
171 | 179 | uint16_t mcn; |
172 | | - /* Tracing area code */ |
| 180 | + /** Tracing area code */ |
173 | 181 | uint16_t tac; |
174 | | - /* Serving Cell ID */ |
| 182 | + /** Serving Cell ID */ |
175 | 183 | uint32_t sci; |
176 | | - /* Physical Cell ID */ |
| 184 | + /** Physical Cell ID */ |
177 | 185 | uint16_t pci; |
178 | | - /* Frequency band */ |
| 186 | + /** Frequency band */ |
179 | 187 | uint8_t band[SIM7080_UE_SYS_INFO_BAND_SIZE + 1]; |
180 | | - /* E-UTRA absolute radio frequency channel number */ |
| 188 | + /** E-UTRA absolute radio frequency channel number */ |
181 | 189 | uint16_t earfcn; |
182 | | - /* Downlink bandwidth in MHz */ |
| 190 | + /** Downlink bandwidth in MHz */ |
183 | 191 | uint16_t dlbw; |
184 | | - /* Uplink bandwidth in MHz */ |
| 192 | + /** Uplink bandwidth in MHz */ |
185 | 193 | uint16_t ulbw; |
186 | | - /* Reference signal received quality in dB */ |
| 194 | + /** Reference signal received quality in dB */ |
187 | 195 | int16_t rsrq; |
188 | | - /* Reference signal received power in dBm */ |
| 196 | + /** Reference signal received power in dBm */ |
189 | 197 | int16_t rsrp; |
190 | | - /* Received signal strength indicator in dBm */ |
| 198 | + /** Received signal strength indicator in dBm */ |
191 | 199 | int16_t rssi; |
192 | | - /* Reference signal signal to noise ratio in dB */ |
| 200 | + /** Reference signal signal to noise ratio in dB */ |
193 | 201 | int16_t rssnr; |
194 | | - /* Signal to interference plus noise ratio in dB */ |
| 202 | + /** Signal to interference plus noise ratio in dB */ |
195 | 203 | int16_t sinr; |
196 | 204 | }; |
197 | 205 |
|
| 206 | +/** |
| 207 | + * Sim7080 ue system information structure. |
| 208 | + */ |
198 | 209 | struct sim7080_ue_sys_info { |
199 | | - /* Refer to sim7080_ue_sys_mode */ |
| 210 | + /** Refer to sim7080_ue_sys_mode */ |
200 | 211 | enum sim7080_ue_sys_mode sys_mode; |
201 | | - /* Refer to sim7080_ue_op_mode */ |
| 212 | + /** Refer to sim7080_ue_op_mode */ |
202 | 213 | enum sim7080_ue_op_mode op_mode; |
203 | 214 | union { |
204 | | - /* Only set if sys_mode is GSM */ |
| 215 | + /** Only set if sys_mode is GSM */ |
205 | 216 | struct sim7080_ue_sys_info_gsm gsm; |
206 | | - /* Only set if sys mode is LTE CAT-M1/NB-IOT */ |
| 217 | + /** Only set if sys mode is LTE CAT-M1/NB-IOT */ |
207 | 218 | struct sim7080_ue_sys_info_lte lte; |
208 | | - } cell; |
| 219 | + } cell; /**< Cell information */ |
209 | 220 | }; |
210 | 221 |
|
211 | 222 | /** |
|
0 commit comments