liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #ifndef MBTK_INFO_INCLUDE |
| 2 | #define MBTK_INFO_INCLUDE |
| 3 | #include <netinet/in.h> |
| 4 | |
| 5 | #include "mbtk_type.h" |
| 6 | #include "mbtk_list.h" |
| 7 | #include "mbtk_log.h" |
| 8 | #include "mbtk_utils.h" |
| 9 | #include "mbtk_info_api.h" |
| 10 | |
| 11 | #define MBTK_INFO_PACKET_FLAG 0x5F6F7F8F |
| 12 | #define SOCK_INFO_PATH "/tmp/info_sock" |
| 13 | #define SOCK_MSG_LEN_MAX 2048 |
| 14 | |
| 15 | // Tag(4) + Packet_Length(2) |
| 16 | #define SOCK_PACK_EXTRA_LEN 6 |
| 17 | // SOCK_PACK_EXTRA_LEN + Id(2) + Error(2) + Number(2) |
| 18 | #define SOCK_PACK_LEN_MIN (SOCK_PACK_EXTRA_LEN + 6) |
| 19 | |
| 20 | typedef enum |
| 21 | { |
| 22 | MBTK_INFO_TYPE_REQ, |
| 23 | MBTK_INFO_TYPE_RSP, |
| 24 | MBTK_INFO_TYPE_IND, |
| 25 | MBTK_INFO_TYPE_UNKNOWN |
| 26 | } mbtk_info_type_enum; |
| 27 | |
| 28 | typedef enum |
| 29 | { |
| 30 | // Device Information |
| 31 | MBTK_INFO_ID_DEV_BEGIN = 0, |
| 32 | // <string> IMEI |
| 33 | MBTK_INFO_ID_DEV_IMEI_REQ, |
| 34 | MBTK_INFO_ID_DEV_IMEI_RSP, |
| 35 | // <string> SN |
| 36 | MBTK_INFO_ID_DEV_SN_REQ, |
| 37 | MBTK_INFO_ID_DEV_SN_RSP, |
| 38 | // <string> MEID |
| 39 | MBTK_INFO_ID_DEV_MEID_REQ, |
| 40 | MBTK_INFO_ID_DEV_MEID_RSP, |
| 41 | // <string> VERSION |
| 42 | MBTK_INFO_ID_DEV_VERSION_REQ, |
| 43 | MBTK_INFO_ID_DEV_VERSION_RSP, |
| 44 | // <string> MODEL |
| 45 | MBTK_INFO_ID_DEV_MODEL_REQ, |
| 46 | MBTK_INFO_ID_DEV_MODEL_RSP, |
| 47 | // <uint8> 0:Close 1:Open |
| 48 | MBTK_INFO_ID_DEV_VOLTE_REQ, |
| 49 | MBTK_INFO_ID_DEV_VOLTE_RSP, |
| 50 | // <string> Temperature |
| 51 | MBTK_INFO_ID_DEV_TEMP_REQ, // Temperature |
| 52 | MBTK_INFO_ID_DEV_TEMP_RSP, |
| 53 | // <uint8><string> YYYY-MM-DD-HH:MM:SS |
| 54 | MBTK_INFO_ID_DEV_TIME_REQ, // Time |
| 55 | MBTK_INFO_ID_DEV_TIME_RSP, |
| 56 | //<string> "23/03/20,01:58:00+32" |
b.liu | baa41e1 | 2024-07-19 15:07:24 +0800 | [diff] [blame] | 57 | MBTK_INFO_ID_DEV_CELL_TIME_REQ, // Time |
| 58 | MBTK_INFO_ID_DEV_CELL_TIME_RSP, |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 59 | |
| 60 | MBTK_INFO_ID_DEV_MODEM_REQ, |
| 61 | MBTK_INFO_ID_DEV_MODEM_RSP, |
| 62 | |
| 63 | MBTK_INFO_ID_DEV_END, |
| 64 | |
| 65 | // Sim Information |
| 66 | MBTK_INFO_ID_SIM_BEGIN = 1000, |
| 67 | // <uint8> 0:NOT_EXIST 1:READY ... |
| 68 | MBTK_INFO_ID_SIM_STATE_REQ, |
| 69 | MBTK_INFO_ID_SIM_STATE_RSP, |
| 70 | // <uint8> 0: SIM 1: USIM 2: TEST SIM 3: TEST USIM 4: UNKNOWN |
| 71 | MBTK_INFO_ID_SIM_STYPE_REQ, |
| 72 | MBTK_INFO_ID_SIM_STYPE_RSP, |
| 73 | // <string> PIN |
| 74 | MBTK_INFO_ID_SIM_PIN_REQ, |
| 75 | MBTK_INFO_ID_SIM_PIN_RSP, |
| 76 | // <string> PIN |
| 77 | MBTK_INFO_ID_SIM_ENABLE_PIN_REQ, |
| 78 | MBTK_INFO_ID_SIM_ENABLE_PIN_RSP, |
| 79 | // <string> PUK |
| 80 | MBTK_INFO_ID_SIM_PUK_REQ, |
| 81 | MBTK_INFO_ID_SIM_PUK_RSP, |
| 82 | // <string> PLMN |
| 83 | MBTK_INFO_ID_SIM_PLMN_REQ, |
| 84 | MBTK_INFO_ID_SIM_PLMN_RSP, |
| 85 | // <uint8> <uint8> <uint8> <uint8> PIN PUK LAST TIMES |
| 86 | MBTK_INFO_ID_SIM_PINPUK_TIMES_REQ, |
| 87 | MBTK_INFO_ID_SIM_PINPUK_TIMES_RSP, |
| 88 | // <string> IMSI |
| 89 | MBTK_INFO_ID_SIM_IMSI_REQ, |
| 90 | MBTK_INFO_ID_SIM_IMSI_RSP, |
| 91 | // <string> ICCID |
| 92 | MBTK_INFO_ID_SIM_ICCID_REQ, |
| 93 | MBTK_INFO_ID_SIM_ICCID_RSP, |
| 94 | // <string> Phone Number |
| 95 | MBTK_INFO_ID_SIM_PN_REQ, |
| 96 | MBTK_INFO_ID_SIM_PN_RSP, |
| 97 | // <string> <string> old_PIN new_PIN |
| 98 | MBTK_INFO_ID_SIM_CHANGE_PIN_REQ, |
| 99 | MBTK_INFO_ID_SIM_CHANGE_PIN_RSP, |
| 100 | |
| 101 | MBTK_INFO_ID_SIM_END, |
| 102 | |
| 103 | // Network Information |
| 104 | MBTK_INFO_ID_NET_BEGIN = 2000, |
| 105 | // <uint8> 0:OFF 1:ON |
| 106 | MBTK_INFO_ID_NET_RADIO_REQ, |
| 107 | MBTK_INFO_ID_NET_RADIO_RSP, |
| 108 | // sel_mode(uint8)type(uint8)plmn(uint32)...sel_mode(uint8)type(uint8)plmn(uint32) |
| 109 | MBTK_INFO_ID_NET_AVAILABLE_REQ, |
| 110 | MBTK_INFO_ID_NET_AVAILABLE_RSP, |
| 111 | // <uint8> 0: automatic 1: manual |
| 112 | // or |
| 113 | // sel_mode(uint8)type(uint8)plmn(uint32) |
| 114 | MBTK_INFO_ID_NET_SEL_MODE_REQ, |
| 115 | MBTK_INFO_ID_NET_SEL_MODE_RSP, |
| 116 | // mbtk_band_info_t |
| 117 | MBTK_INFO_ID_NET_BAND_REQ, |
| 118 | MBTK_INFO_ID_NET_BAND_RSP, |
| 119 | // mbtk_signal_info_t |
| 120 | MBTK_INFO_ID_NET_SIGNAL_REQ, |
| 121 | MBTK_INFO_ID_NET_SIGNAL_RSP, |
| 122 | // mbtk_net_reg_info_t |
| 123 | MBTK_INFO_ID_NET_REG_REQ, |
| 124 | MBTK_INFO_ID_NET_REG_RSP, |
| 125 | // mbtk_apn_info_t |
| 126 | MBTK_INFO_ID_NET_APN_REQ, |
| 127 | MBTK_INFO_ID_NET_APN_RSP, |
wangyouqiang | 80487e4 | 2024-05-24 15:06:20 +0800 | [diff] [blame] | 128 | // mbtk_qser_apn_info_t |
| 129 | MBTK_INFO_ID_NET_QSER_APN_REQ, |
| 130 | MBTK_INFO_ID_NET_QSER_APN_RSP, |
liuyang | 0e49d9a | 2024-04-23 21:04:54 +0800 | [diff] [blame] | 131 | // mbtk_apn_del |
| 132 | MBTK_INFO_ID_NET_APN_DEL_REQ, |
| 133 | MBTK_INFO_ID_NET_APN_DEL_RSP, |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 134 | // mbtk_cell_info_t[] |
| 135 | MBTK_INFO_ID_NET_CELL_REQ, |
| 136 | MBTK_INFO_ID_NET_CELL_RSP, |
| 137 | // REQ: |
| 138 | // <call_type[1]><cid[1]><timeout[1]> |
| 139 | // call_type : mbtk_data_call_type_enum |
| 140 | // cid : 1 - 15 |
| 141 | // timeout : second |
| 142 | // RSP: |
| 143 | // <type[1]><ipv4><ipv6> |
| 144 | // type : 0-IPV4 1-IPV6 2-IPV4V6 |
| 145 | // ipv4 : mbtk_ipv4_info_t |
| 146 | // ipv6 : mbtk_ipv6_info_t |
| 147 | MBTK_INFO_ID_NET_DATA_CALL_REQ, |
| 148 | MBTK_INFO_ID_NET_DATA_CALL_RSP, |
| 149 | |
r.xiao | 06db9a1 | 2024-04-14 18:51:15 -0700 | [diff] [blame] | 150 | // mbtk_net_ims |
| 151 | MBTK_INFO_ID_NET_IMS_REQ, |
| 152 | MBTK_INFO_ID_NET_IMS_RSP, |
b.liu | 288093c | 2024-05-09 17:02:57 +0800 | [diff] [blame] | 153 | |
b.liu | fdf0317 | 2024-06-07 15:01:29 +0800 | [diff] [blame] | 154 | MBTK_INFO_ID_NET_IMS_REG_STATE_REQ, |
| 155 | MBTK_INFO_ID_NET_IMS_REG_STATE_RSP, |
| 156 | |
r.xiao | 06db9a1 | 2024-04-14 18:51:15 -0700 | [diff] [blame] | 157 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 158 | MBTK_INFO_ID_NET_END, |
| 159 | |
r.xiao | 06db9a1 | 2024-04-14 18:51:15 -0700 | [diff] [blame] | 160 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 161 | // Call Information |
| 162 | MBTK_INFO_ID_CALL_BEGIN = 3000, |
| 163 | MBTK_INFO_ID_CALL_STATE_REQ, |
| 164 | MBTK_INFO_ID_CALL_STATE_RSP, |
| 165 | |
| 166 | // Start call. |
| 167 | MBTK_INFO_ID_CALL_START_REQ, |
| 168 | MBTK_INFO_ID_CALL_START_RSP, |
| 169 | //answer call |
| 170 | MBTK_INFO_ID_CALL_ANSWER_REQ, |
| 171 | MBTK_INFO_ID_CALL_ANSWER_RSP, |
| 172 | //hang up all call |
| 173 | MBTK_INFO_ID_CALL_HANGUP_REQ, |
| 174 | MBTK_INFO_ID_CALL_HANGUP_RSP, |
| 175 | //hang up a call |
| 176 | MBTK_INFO_ID_CALL_HANGUP_A_REQ, |
| 177 | MBTK_INFO_ID_CALL_HANGUP_A_RSP, |
| 178 | //hang up waiting or background call |
| 179 | MBTK_INFO_ID_CALL_HANGUP_B_REQ, |
| 180 | MBTK_INFO_ID_CALL_HANGUP_B_RSP, |
| 181 | //hang up foreground resume background |
| 182 | MBTK_INFO_ID_CALL_HANGUP_C_REQ, |
| 183 | MBTK_INFO_ID_CALL_HANGUP_C_RSP, |
| 184 | //wait in call |
| 185 | MBTK_INFO_ID_CALL_WAITIN_REQ, |
| 186 | MBTK_INFO_ID_CALL_WAITIN_RSP, |
| 187 | //mute call |
| 188 | MBTK_INFO_ID_CALL_MUTE_REQ, |
| 189 | MBTK_INFO_ID_CALL_MUTE_RSP, |
| 190 | //dtmf call |
| 191 | MBTK_INFO_ID_CALL_DTMF_REQ, |
| 192 | MBTK_INFO_ID_CALL_DTMF_RSP, |
| 193 | |
| 194 | MBTK_INFO_ID_CALL_END, |
| 195 | |
| 196 | // SMS Information |
| 197 | MBTK_INFO_ID_SMS_BEGIN = 4000, |
| 198 | MBTK_INFO_ID_SMS_STATE_REQ, |
| 199 | MBTK_INFO_ID_SMS_STATE_RSP, |
| 200 | MBTK_INFO_ID_SMS_CMGF_REQ, |
| 201 | MBTK_INFO_ID_SMS_CMGF_RSP, |
| 202 | MBTK_INFO_ID_SMS_CPMS_REQ, |
| 203 | MBTK_INFO_ID_SMS_CPMS_RSP, |
| 204 | MBTK_INFO_ID_SMS_CMGS_REQ, |
| 205 | MBTK_INFO_ID_SMS_CMGS_RSP, |
| 206 | MBTK_INFO_ID_SMS_CMSS_REQ, |
| 207 | MBTK_INFO_ID_SMS_CMSS_RSP, |
| 208 | MBTK_INFO_ID_SMS_CMGR_REQ, |
| 209 | MBTK_INFO_ID_SMS_CMGR_RSP, |
| 210 | MBTK_INFO_ID_SMS_CMGW_REQ, |
| 211 | MBTK_INFO_ID_SMS_CMGW_RSP, |
| 212 | MBTK_INFO_ID_SMS_CMGD_REQ, |
| 213 | MBTK_INFO_ID_SMS_CMGD_RSP, |
| 214 | MBTK_INFO_ID_SMS_CMGL_REQ, |
| 215 | MBTK_INFO_ID_SMS_CMGL_RSP, |
| 216 | MBTK_INFO_ID_SMS_CSCA_REQ, |
| 217 | MBTK_INFO_ID_SMS_CSCA_RSP, |
| 218 | MBTK_INFO_ID_SMS_CSMP_REQ, |
| 219 | MBTK_INFO_ID_SMS_CSMP_RSP, |
| 220 | MBTK_INFO_ID_SMS_CSCB_REQ, |
| 221 | MBTK_INFO_ID_SMS_CSCB_RSP, |
| 222 | MBTK_INFO_ID_SMS_CNMI_REQ, |
| 223 | MBTK_INFO_ID_SMS_CNMI_RSP, |
| 224 | |
| 225 | MBTK_INFO_ID_SMS_END, |
| 226 | |
| 227 | // PhoneBook Information |
| 228 | MBTK_INFO_ID_PB_BEGIN = 5000, |
| 229 | MBTK_INFO_ID_PB_STATE_REQ, |
| 230 | MBTK_INFO_ID_PB_STATE_RSP, |
| 231 | |
| 232 | MBTK_INFO_ID_PB_END, |
| 233 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 234 | //wakeup |
| 235 | MBTK_INFO_ID_WAKEUP_STA_BEGIN = 6000, |
r.xiao | ec113d1 | 2024-01-12 02:13:28 -0800 | [diff] [blame] | 236 | MBTK_INFO_ID_WAKEUP_STA_REQ, |
| 237 | MBTK_INFO_ID_WAKEUP_STA_RSP, |
| 238 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 239 | MBTK_INFO_ID_WAKEUP_STA_END, |
| 240 | |
r.xiao | ec113d1 | 2024-01-12 02:13:28 -0800 | [diff] [blame] | 241 | //oos(out of service)) |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 242 | MBTK_INFO_ID_OOS_STA_BEGIN = 7000, |
r.xiao | ec113d1 | 2024-01-12 02:13:28 -0800 | [diff] [blame] | 243 | MBTK_INFO_ID_OOS_STA_REQ, |
| 244 | MBTK_INFO_ID_OOS_STA_RSP, |
| 245 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 246 | MBTK_INFO_ID_OOS_STA_END, |
b.liu | 288093c | 2024-05-09 17:02:57 +0800 | [diff] [blame] | 247 | |
wangyouqiang | 38e5336 | 2024-01-23 10:53:48 +0800 | [diff] [blame] | 248 | //led |
| 249 | MBTK_INFO_ID_LED_BEGIN = 8000, |
| 250 | MBTK_INFO_ID_LED_REQ, |
| 251 | MBTK_INFO_ID_LED_RSP, |
| 252 | MBTK_INFO_ID_LED_END, |
r.xiao | ec113d1 | 2024-01-12 02:13:28 -0800 | [diff] [blame] | 253 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 254 | // IND Information |
| 255 | MBTK_INFO_ID_IND_BEGIN = 10000, |
| 256 | // <uint8> State |
| 257 | MBTK_INFO_ID_IND_NET_STATE_CHANGE, |
| 258 | // <uint8> State |
| 259 | MBTK_INFO_ID_IND_CALL_STATE_CHANGE, |
| 260 | // <uint8> State |
| 261 | MBTK_INFO_ID_IND_SMS_STATE_CHANGE, |
| 262 | // <uint8> State |
| 263 | MBTK_INFO_ID_IND_RADIO_STATE_CHANGE, |
| 264 | // <uint8> State |
| 265 | MBTK_INFO_ID_IND_SIM_STATE_CHANGE, |
| 266 | // <uint8> State |
| 267 | MBTK_INFO_ID_IND_PDP_STATE_CHANGE, |
| 268 | // <uint8> State |
| 269 | MBTK_INFO_ID_IND_SERVER_STATE_CHANGE,////mbtk wyq for server_ready_status add |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 270 | // <uint8> State |
| 271 | MBTK_INFO_ID_IND_SIGNAL_STATE_CHANGE, |
| 272 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 273 | |
| 274 | MBTK_INFO_ID_IND_END, |
| 275 | MBTK_INFO_ID_REQ_UNKNOWN // Unknown information. |
| 276 | } mbtk_info_id_enum; |
| 277 | |
| 278 | typedef enum { |
| 279 | MBTK_NET_CS_STATE = 0, |
| 280 | MBTK_NET_PS_STATE |
| 281 | } mbtk_net_state_type_enum; |
| 282 | |
| 283 | typedef enum { |
| 284 | MBTK_INFO_ERR_SUCCESS = 300, |
| 285 | MBTK_INFO_ERR_FORMAT, // Packet format error. |
| 286 | MBTK_INFO_ERR_REQ_UNKNOWN, // Unknown request. |
| 287 | MBTK_INFO_ERR_REQ_PARAMETER, // Request parameter error. |
| 288 | MBTK_INFO_ERR_UNSUPPORTED, // Unsupported operation. |
| 289 | MBTK_INFO_ERR_MEMORY, // Insufficient memory. |
| 290 | MBTK_INFO_ERR_IND_FULL, // Register IND fail(FULL). |
| 291 | MBTK_INFO_ERR_IND_UNKNOWN, // Register IND fail(Unknown IND). |
| 292 | MBTK_INFO_ERR_CID, // CID error. |
| 293 | MBTK_INFO_ERR_TIMEOUT, // Timeout. |
| 294 | MBTK_INFO_ERR_TIME_FORMAT, // Time format error. |
b.liu | 288093c | 2024-05-09 17:02:57 +0800 | [diff] [blame] | 295 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 296 | //mbtk wyq for data_call add start |
| 297 | MBTK_INFO_ERR_CID_EXIST, |
| 298 | MBTK_INFO_ERR_CID_NO_EXIST, |
| 299 | MBTK_INFO_ERR_NET_NO_INIT, |
| 300 | //mbtk wyq for data_call add end |
| 301 | |
| 302 | MBTK_INFO_ERR_UNKNOWN = 400, // Unknown error. |
| 303 | // CME error start index. |
| 304 | MBTK_INFO_ERR_CME = 500, |
| 305 | MBTK_INFO_ERR_CME_NON = 1000 |
| 306 | } mbtk_info_err_enum; |
| 307 | |
| 308 | /* |
| 309 | GSM band�� |
| 310 | 1 �C PGSM 900 (standard or primary) |
| 311 | 2 �C DCS GSM 1800 |
| 312 | 4 �C PCS GSM 1900 |
| 313 | 8 �C EGSM 900 (extended) |
| 314 | 16 �C GSM 450 |
| 315 | 32 �C GSM 480 |
| 316 | 64 �C GSM 850 |
| 317 | 512 - BAND_LOCK_BIT // used for GSM band setting |
| 318 | */ |
| 319 | typedef enum |
| 320 | { |
| 321 | MBTK_GSM_BAND_PGSM_900 = 1, |
| 322 | MBTK_GSM_BAND_DCS_GSM_1800 = 2, |
| 323 | MBTK_GSM_BAND_PCS_GSM_1900 = 4, |
| 324 | MBTK_GSM_BAND_EGSM_900 = 8, |
| 325 | MBTK_GSM_BAND_GSM_450 = 16, |
| 326 | MBTK_GSM_BAND_GSM_480 = 32, |
| 327 | MBTK_GSM_BAND_GSM_850 = 64, |
| 328 | MBTK_GSM_BAND_BAND_LOCK_BIT = 512 |
| 329 | } mbtk_gsm_band_enum; |
| 330 | |
| 331 | /* |
| 332 | UMTS band�� |
| 333 | 1 �C UMTS_BAND_1 |
| 334 | 2 �C UMTS_BAND_2 |
| 335 | 4 �C UMTS_BAND_3 |
| 336 | 8 �C UMTS_BAND_4 |
| 337 | 16 �C UMTS_BAND_5 |
| 338 | 32 �C UMTS_BAND_6 |
| 339 | 64 �C UMTS_BAND_7 |
| 340 | 128 �C UMTS_BAND_8 |
| 341 | 256 �C UMTS_BAND_9 |
| 342 | */ |
| 343 | typedef enum |
| 344 | { |
| 345 | MBTK_UMTS_BAND_1 = 1, |
| 346 | MBTK_UMTS_BAND_2 = 2, |
| 347 | MBTK_UMTS_BAND_3 = 4, |
| 348 | MBTK_UMTS_BAND_4 = 8, |
| 349 | MBTK_UMTS_BAND_5 = 16, |
| 350 | MBTK_UMTS_BAND_6 = 32, |
| 351 | MBTK_UMTS_BAND_7 = 64, |
| 352 | MBTK_UMTS_BAND_8 = 128, |
| 353 | MBTK_UMTS_BAND_9 = 256 |
| 354 | } mbtk_umts_band_enum; |
| 355 | |
| 356 | /* |
| 357 | LTEbandH(TDD-LTE band) |
| 358 | 32 �C TDLTE_BAND_38 |
| 359 | 64 �C TDLTE_BAND_39 |
| 360 | 128 �C TDLTE_BAND_40 |
| 361 | 256 �C TDLTE_BAND_41 |
| 362 | */ |
| 363 | typedef enum |
| 364 | { |
| 365 | MBTK_TDLTE_BAND_38 = 32, |
| 366 | MBTK_TDLTE_BAND_39 = 64, |
| 367 | MBTK_TDLTE_BAND_40 = 128, |
| 368 | MBTK_TDLTE_BAND_41 = 256 |
| 369 | } mbtk_tdlte_band_enum; |
| 370 | |
| 371 | /* |
| 372 | LTEbandL(FDD-LTE band) |
| 373 | 1 �C FDDLTE_BAND_1 |
| 374 | 4 �C FDDLTE _BAND_3 |
| 375 | 8 �C FDDLTE _BAND_4 |
| 376 | 64 �C FDDLTE _BAND_7 |
| 377 | 65536 �C FDDLTE _BAND_17 |
| 378 | 524288 �C FDDLTE _BAND_20 |
| 379 | */ |
| 380 | typedef enum |
| 381 | { |
| 382 | MBTK_FDDLTE_BAND_1 = 1, |
| 383 | MBTK_FDDLTE_BAND_3 = 4, |
| 384 | MBTK_FDDLTE_BAND_4 = 8, |
| 385 | MBTK_FDDLTE_BAND_7 = 64, |
| 386 | MBTK_FDDLTE_BAND_17 = 65536, |
| 387 | MBTK_FDDLTE_BAND_20 = 524288 |
| 388 | } mbtk_fddlte_band_enum; |
| 389 | |
b.liu | 288093c | 2024-05-09 17:02:57 +0800 | [diff] [blame] | 390 | typedef enum |
| 391 | { |
| 392 | MBTK_LTE_EXT_BAND_65 = 1, |
| 393 | MBTK_LTE_EXT_BAND_66 = 2, |
| 394 | MBTK_LTE_EXT_BAND_67 = 4, |
| 395 | MBTK_LTE_EXT_BAND_68 = 8, |
| 396 | MBTK_LTE_EXT_BAND_69 = 16 |
| 397 | } mbtk_lte_ext_band_enum; |
| 398 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 399 | /* |
| 400 | 0: unknown |
| 401 | 1: available |
| 402 | 2: current |
| 403 | 3: forbidden |
| 404 | */ |
| 405 | typedef enum |
| 406 | { |
| 407 | MBTK_NET_AVIL_STATE_UNKNOWN = 0, |
| 408 | MBTK_NET_AVIL_STATE_AVAILABLE, |
| 409 | MBTK_NET_AVIL_STATE_CURRENT, |
| 410 | MBTK_NET_AVIL_STATE_FORBIDDEN |
| 411 | } mbtk_net_avil_state_enum; |
| 412 | |
| 413 | typedef struct |
| 414 | { |
| 415 | uint16 tac; |
| 416 | uint16 earfcn; |
| 417 | } mbtk_local_info_t; |
| 418 | |
| 419 | typedef struct |
| 420 | { |
| 421 | uint16 info_id; |
| 422 | uint16 info_err; |
| 423 | const uint8 *data; |
| 424 | uint16 data_len; |
| 425 | } mbtk_info_pack_t; |
| 426 | |
| 427 | typedef struct |
| 428 | { |
| 429 | uint8 type; // 0: GSM 1: UMTS 2: LTE |
| 430 | bool running; |
| 431 | |
| 432 | int cell_num; |
| 433 | mbtk_cell_info_t cell[CELL_NUM_MAX]; |
| 434 | } mbtK_cell_pack_info_t; |
| 435 | |
| 436 | typedef enum { |
| 437 | MBTK_MOBILE_ORIGINATED_CALL, |
| 438 | MBTK_TERMINATED_CALL, |
| 439 | } mbtk_call_dir_enum; |
| 440 | |
| 441 | typedef enum { |
| 442 | MBTK_VOICE, |
| 443 | MBTK_DATA, |
| 444 | MBTK_FAX, |
| 445 | MBTK_VOICE_FOLLOWED_BY_DATA_VOICE_MODE, |
| 446 | MBTK_ALTERNATING_VOICE_VOICE_MODE, |
| 447 | MBTK_ALTERNATING_FAX_VOICE_MODE, |
| 448 | MBTK_VOICE_FOLLOWED_BY_DATA_DATA_MODE, |
| 449 | MBTK_ALTERNATING_VOICE_DATA_MODE, |
| 450 | MBTK_ALTERNATING_FAX_FAX_MODE, |
| 451 | MBTL_UNKNOW, |
| 452 | } mbtk_call_mode_enum; |
| 453 | |
| 454 | typedef enum { |
| 455 | MBTK_NOT_MULITYPARTY_CALL, |
| 456 | MBTK_MULITYPARTY__CALL, |
| 457 | } mbtk_call_mpty_enum; |
| 458 | |
| 459 | typedef struct |
| 460 | { |
| 461 | int cid; |
| 462 | bool act; |
| 463 | bool waitting; |
| 464 | } info_cgact_wait_t; |
| 465 | |
| 466 | typedef struct |
| 467 | { |
| 468 | uint32 count; |
| 469 | list_node_t *net_list; |
| 470 | } mbtk_net_array_info_t; |
| 471 | |
| 472 | typedef struct |
| 473 | { |
| 474 | bool inited; |
| 475 | mbtk_radio_state_enum radio_state; |
| 476 | mbtk_sim_state_enum sim_state; |
| 477 | mbtk_radio_technology_enum net_type; |
| 478 | mbtk_ip_type_enum ip_type; |
| 479 | struct sockaddr_in addr4; |
| 480 | struct sockaddr_in preferred_dns4; |
| 481 | struct sockaddr_in alternate_dns4; |
| 482 | |
| 483 | struct sockaddr_in6 addr6; |
| 484 | struct sockaddr_in6 preferred_dns6; |
| 485 | struct sockaddr_in6 alternate_dns6; |
| 486 | } net_info_t; |
| 487 | |
| 488 | #ifdef __cplusplus |
| 489 | extern "C" { |
| 490 | #endif |
| 491 | char* type2str(mbtk_info_type_enum type); |
| 492 | |
| 493 | char* apn2str(mbtk_ip_type_enum type); |
| 494 | |
| 495 | char* id2str(int id); |
| 496 | |
| 497 | char* err2str(mbtk_info_err_enum err); |
| 498 | |
| 499 | /* |
| 500 | IPv6 : 254.128.0.0.0.0.0.0.0.1.0.2.144.5.212.239 -> uint128 |
| 501 | */ |
| 502 | int str_2_ipv6(const void *ip_str, void *ipv6); |
| 503 | |
| 504 | /* |
| 505 | IPv6 : uint128 -> fe80::215:1dff:fe81:484c |
| 506 | */ |
| 507 | int ipv6_2_str(const void *ipv6, void *ipv6_str); |
| 508 | |
| 509 | /* |
| 510 | 0 GSM |
| 511 | 1 GSM_COMPACT |
| 512 | 2 UTRAN |
| 513 | 3 GSM_EGPRS |
| 514 | 4 UTRAN_HSDPA |
| 515 | 5 UTRAN_HSUPA |
| 516 | 6 UTRAN_HSDPA_HSUPA |
| 517 | 7 EUTRAN |
| 518 | 8 ECGSM |
| 519 | */ |
| 520 | mbtk_net_type_enum mbtk_net_type_get(mbtk_radio_technology_enum radio_tech); |
| 521 | |
| 522 | mbtk_info_type_enum mbtk_info_type_get(int info_id); |
| 523 | |
| 524 | mbtk_info_pack_t* mbtk_info_pack_creat(int info_id); |
| 525 | |
| 526 | #if 0 |
| 527 | int mbtk_info_pack_data_set(mbtk_info_pack_t *pack, const void *data, int data_len); |
| 528 | void* mbtk_info_pack_data_get(mbtk_info_pack_t *pack, int *data_len); |
| 529 | #endif |
| 530 | |
| 531 | int mbtk_info_pack_send(int fd, mbtk_info_pack_t *pack); |
| 532 | |
| 533 | mbtk_info_pack_t** mbtk_info_pack_recv(int fd, bool is_server, mbtk_info_err_enum *err); |
| 534 | |
| 535 | int mbtk_info_pack_free(mbtk_info_pack_t **pack); |
| 536 | #ifdef __cplusplus |
| 537 | } |
| 538 | #endif |
| 539 | |
| 540 | |
| 541 | #endif /* MBTK_INFO_INCLUDE */ |
| 542 | |
| 543 | |