b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 1 | #ifndef MBTK_INFO_INCLUDE |
| 2 | #define MBTK_INFO_INCLUDE |
| 3 | #include <netinet/in.h> |
| 4 | #include <pthread.h> |
b.liu | 6917e9b | 2025-03-26 17:23:11 +0800 | [diff] [blame] | 5 | #include <time.h> |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 6 | |
| 7 | #include "mbtk_type.h" |
| 8 | #include "mbtk_list.h" |
| 9 | #include "mbtk_log.h" |
| 10 | #include "mbtk_utils.h" |
| 11 | #include "mbtk_ril_api.h" |
| 12 | |
| 13 | #define RIL_SOCK_PACKET_TAG 0x5F6F7F8F |
| 14 | #define RIL_SOCK_NAME "/tmp/mbtk_ril_sock" |
b.liu | 10a3410 | 2024-08-20 20:36:24 +0800 | [diff] [blame] | 15 | #define RIL_SOCK_MSG_LEN_MAX (1024 * 6) |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 16 | |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 17 | #define IND_REGISTER_MAX 20 |
| 18 | #define PACK_PROCESS_QUEUE_MAX 20 |
| 19 | |
| 20 | |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 21 | // Tag(4) + Packet_Length(2) |
| 22 | #define RIL_SOCK_PACK_EXTRA_LEN 6 |
b.liu | b171c9a | 2024-11-12 19:23:29 +0800 | [diff] [blame] | 23 | // RIL_SOCK_PACK_EXTRA_LEN + at_port(1) + Index(2) + Type(2) + Id(2) + Error(2) + data_len(2) |
| 24 | #define RIL_SOCK_PACK_LEN_MIN (RIL_SOCK_PACK_EXTRA_LEN + 11) |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 25 | |
| 26 | #define RIL_MSG_INDEX_AUTO (-1) // automatically , refor to : ril_index |
| 27 | #define RIL_MSG_INDEX_INVALID (0) // Invalid msg index. |
| 28 | |
| 29 | typedef enum |
| 30 | { |
| 31 | RIL_MSG_TYPE_REQ, |
| 32 | RIL_MSG_TYPE_RSP, |
| 33 | RIL_MSG_TYPE_IND |
| 34 | } ril_msg_type_enum; |
| 35 | |
| 36 | typedef enum |
| 37 | { |
| 38 | // Device Information |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 39 | RIL_MSG_ID_DEV_BEGIN = 0x0, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 40 | // <string> IMEI |
| 41 | RIL_MSG_ID_DEV_IMEI, |
| 42 | // <string> SN |
| 43 | RIL_MSG_ID_DEV_SN, |
| 44 | // <string> MEID |
| 45 | RIL_MSG_ID_DEV_MEID, |
| 46 | // <string> VERSION |
| 47 | RIL_MSG_ID_DEV_VERSION, |
| 48 | // <string> MODEL |
| 49 | RIL_MSG_ID_DEV_MODEL, |
| 50 | // <uint8> 0:Close 1:Open |
| 51 | RIL_MSG_ID_DEV_VOLTE, |
| 52 | // <string> Temperature |
| 53 | RIL_MSG_ID_DEV_TEMP, // Temperature |
| 54 | // <string> 23/03/20,01:58:00+32 |
| 55 | RIL_MSG_ID_DEV_CELL_TIME, // Time |
| 56 | // <uint8><uint8> |
| 57 | RIL_MSG_ID_DEV_MODEM, |
b.liu | 9c19cc6 | 2024-11-28 09:43:02 +0800 | [diff] [blame] | 58 | // <uint8> |
| 59 | RIL_MSG_ID_DEV_POWERIND, |
b.liu | 7d102f8 | 2025-03-26 18:30:21 +0800 | [diff] [blame] | 60 | RIL_MSG_ID_DEV_MD_VERSION_REQ, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 61 | RIL_MSG_ID_DEV_END, |
| 62 | |
| 63 | // Sim Information |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 64 | RIL_MSG_ID_SIM_BEGIN = 0x100, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 65 | // <uint8> 0:NOT_EXIST 1:READY ... |
| 66 | RIL_MSG_ID_SIM_STATE, |
| 67 | // <uint8> 0: SIM 1: USIM 2: TEST SIM 3: TEST USIM 4: UNKNOWN |
| 68 | RIL_MSG_ID_SIM_TYPE, |
| 69 | // <string> IMSI |
| 70 | RIL_MSG_ID_SIM_IMSI, |
| 71 | // <string> ICCID |
| 72 | RIL_MSG_ID_SIM_ICCID, |
| 73 | // <string> Phone Number |
| 74 | RIL_MSG_ID_SIM_PN, |
| 75 | // <string> PUK |
| 76 | RIL_MSG_ID_SIM_LOCK, |
| 77 | // <uint8> <uint8> <uint8> <uint8> PIN PUK LAST TIMES |
| 78 | RIL_MSG_ID_SIM_PINPUK_TIMES, |
| 79 | // <string> PLMN |
| 80 | RIL_MSG_ID_SIM_PLMN, |
| 81 | |
| 82 | RIL_MSG_ID_SIM_END, |
| 83 | |
| 84 | // Network Information |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 85 | RIL_MSG_ID_NET_BEGIN = 0x200, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 86 | // sel_mode(uint8)type(uint8)plmn(uint32)...sel_mode(uint8)type(uint8)plmn(uint32) |
| 87 | RIL_MSG_ID_NET_AVAILABLE, |
| 88 | // <uint8> 0: automatic 1: manual |
| 89 | // or |
| 90 | // sel_mode(uint8)type(uint8)plmn(uint32) |
| 91 | RIL_MSG_ID_NET_SEL_MODE, |
| 92 | // mbtk_band_info_t |
| 93 | RIL_MSG_ID_NET_BAND, |
| 94 | // mbtk_signal_info_t |
| 95 | RIL_MSG_ID_NET_SIGNAL, |
| 96 | // mbtk_net_reg_info_t |
| 97 | RIL_MSG_ID_NET_REG, |
| 98 | // mbtk_cell_info_t[] |
| 99 | RIL_MSG_ID_NET_CELL, |
b.liu | 557c81d | 2024-11-19 16:52:45 +0800 | [diff] [blame] | 100 | // mbtk_ril_oos_info_t |
| 101 | RIL_MSG_ID_NET_OOS, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 102 | |
| 103 | RIL_MSG_ID_NET_END, |
| 104 | |
| 105 | |
| 106 | // Network Information |
| 107 | RIL_MSG_ID_DATA_CALL_BEGIN = 0x300, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 108 | // mbtk_apn_info_t |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 109 | RIL_MSG_ID_DATA_CALL_APN, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 110 | // REQ: |
| 111 | // <call_type[1]><cid[1]><timeout[1]> |
| 112 | // call_type : mbtk_data_call_type_enum |
| 113 | // cid : 1 - 15 |
| 114 | // timeout : second |
| 115 | // RSP: |
| 116 | // <type[1]><ipv4><ipv6> |
| 117 | // type : 0-IPV4 1-IPV6 2-IPV4V6 |
| 118 | // ipv4 : mbtk_ipv4_info_t |
| 119 | // ipv6 : mbtk_ipv6_info_t |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 120 | RIL_MSG_ID_DATA_CALL_OPT, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 121 | |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 122 | RIL_MSG_ID_DATA_CALL_END, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 123 | |
| 124 | |
| 125 | // Call Information |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 126 | RIL_MSG_ID_CALL_BEGIN = 0x400, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 127 | RIL_MSG_ID_CALL_STATE, |
| 128 | |
| 129 | // Start call. |
| 130 | RIL_MSG_ID_CALL_START, |
| 131 | //answer call |
| 132 | RIL_MSG_ID_CALL_ANSWER, |
| 133 | //hang up all call |
| 134 | RIL_MSG_ID_CALL_HANGUP, |
| 135 | //hang up a call |
| 136 | RIL_MSG_ID_CALL_HANGUP_A, |
| 137 | //hang up waiting or background call |
| 138 | RIL_MSG_ID_CALL_HANGUP_B, |
| 139 | //hang up foreground resume background |
| 140 | RIL_MSG_ID_CALL_HANGUP_C, |
| 141 | //wait in call |
| 142 | RIL_MSG_ID_CALL_WAITIN, |
| 143 | //mute call |
| 144 | RIL_MSG_ID_CALL_MUTE, |
| 145 | //dtmf call |
| 146 | RIL_MSG_ID_CALL_DTMF, |
liuyang | 3c60be9 | 2024-12-19 16:42:32 +0800 | [diff] [blame] | 147 | //centric |
| 148 | RIL_MSG_ID_CALL_CENTRIC, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 149 | RIL_MSG_ID_CALL_END, |
| 150 | |
| 151 | // SMS Information |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 152 | RIL_MSG_ID_SMS_BEGIN = 0x500, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 153 | RIL_MSG_ID_SMS_STATE, |
| 154 | RIL_MSG_ID_SMS_CMGF, |
| 155 | RIL_MSG_ID_SMS_CPMS, |
| 156 | RIL_MSG_ID_SMS_CMGS, |
| 157 | RIL_MSG_ID_SMS_CMSS, |
| 158 | RIL_MSG_ID_SMS_CMGR, |
| 159 | RIL_MSG_ID_SMS_CMGW, |
| 160 | RIL_MSG_ID_SMS_CMGD, |
| 161 | RIL_MSG_ID_SMS_CMGL, |
| 162 | RIL_MSG_ID_SMS_CSCA, |
| 163 | RIL_MSG_ID_SMS_CSMP, |
| 164 | RIL_MSG_ID_SMS_CSCB, |
| 165 | RIL_MSG_ID_SMS_CNMI, |
| 166 | |
| 167 | RIL_MSG_ID_SMS_END, |
| 168 | |
| 169 | // PhoneBook Information |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 170 | RIL_MSG_ID_PB_BEGIN = 0x600, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 171 | RIL_MSG_ID_PB_STATE, |
| 172 | |
| 173 | RIL_MSG_ID_PB_END, |
| 174 | |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 175 | // Ecall Information |
| 176 | RIL_MSG_ID_ECALL_BEGIN = 0x700, |
| 177 | // mbtk_ecall_msd_cfg_info_t |
| 178 | RIL_MSG_ID_ECALL_MSDCFG, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 179 | // NULL |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 180 | RIL_MSG_ID_ECALL_MSDGEN, |
| 181 | // uint8[] |
| 182 | RIL_MSG_ID_ECALL_MSD, |
| 183 | // NULL |
| 184 | RIL_MSG_ID_ECALL_PUSH, |
| 185 | // mbtk_ecall_only_info_t |
| 186 | RIL_MSG_ID_ECALL_ONLY, |
| 187 | // reg <uint8> |
| 188 | RIL_MSG_ID_ECALL_REG, |
| 189 | // mbtk_ecall_dial_type_enum |
| 190 | RIL_MSG_ID_ECALL_DIAL, |
| 191 | // mbtk_ecall_mode_type_enum |
| 192 | RIL_MSG_ID_ECALL_MODE, |
| 193 | // mbtk_ecall_cfg_item_enum / mbtk_ecall_cfg_info_t |
| 194 | RIL_MSG_ID_ECALL_CFG, |
| 195 | // uint8[] |
| 196 | RIL_MSG_ID_ECALL_SMS_NUM, |
| 197 | // uint8 |
| 198 | RIL_MSG_ID_ECALL_MUTESPK, |
| 199 | // mbtk_ecall_gain_info_t |
| 200 | RIL_MSG_ID_ECALL_DSP_GAIN, |
| 201 | |
| 202 | RIL_MSG_ID_ECALL_END, |
| 203 | |
| 204 | // IND Information |
| 205 | RIL_MSG_ID_IND_BEGIN = 0x1000, |
| 206 | // mbtk_ril_ser_state_enum |
| 207 | RIL_MSG_ID_IND_SER_STATE_CHANGE, |
| 208 | // mbtk_ril_net_reg_state_info_t |
| 209 | RIL_MSG_ID_IND_NET_REG_STATE_CHANGE, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 210 | // <uint8> State |
| 211 | RIL_MSG_ID_IND_CALL_STATE_CHANGE, |
b.liu | aced4f9 | 2024-12-31 11:14:51 +0800 | [diff] [blame] | 212 | // mbtk_ril_sms_state_info_t |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 213 | RIL_MSG_ID_IND_SMS_STATE_CHANGE, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 214 | // mbtk_ril_radio_state_info_t |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 215 | RIL_MSG_ID_IND_RADIO_STATE_CHANGE, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 216 | // mbtk_ril_sim_state_info_t |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 217 | RIL_MSG_ID_IND_SIM_STATE_CHANGE, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 218 | // mbtk_ril_pdp_state_info_t |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 219 | RIL_MSG_ID_IND_PDP_STATE_CHANGE, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 220 | // mbtk_ril_signal_state_info_t |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 221 | RIL_MSG_ID_IND_SIGNAL_STATE_CHANGE, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 222 | // mbtk_ril_ecall_state_info_t |
| 223 | RIL_MSG_ID_IND_ECALL_STATE_CHANGE, |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 224 | |
| 225 | |
| 226 | RIL_MSG_ID_IND_END, |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 227 | |
| 228 | // URC message |
| 229 | RIL_URC_MSG_BEGIN = 0x2000, |
| 230 | RIL_URC_MSG_GET_SIM_STATE, //check sim status |
b.liu | 472cfaf | 2024-12-19 19:08:19 +0800 | [diff] [blame] | 231 | RIL_URC_MSG_BAND_SET, // Band set message |
b.liu | 15f456b | 2024-10-31 20:16:06 +0800 | [diff] [blame] | 232 | RIL_URC_MSG_NET_STATE_LOG, // Save Network state into file. |
| 233 | RIL_URC_MSG_END, |
| 234 | |
| 235 | RIL_MSG_ID_UNKNOWN = 0xFFFF // Unknown information. |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 236 | } ril_msg_id_enum; |
| 237 | |
| 238 | typedef struct { |
| 239 | uint32 tag; // Refor to : RIL_SOCK_PACKET_TAG |
| 240 | uint16 msg_len; |
| 241 | |
b.liu | b171c9a | 2024-11-12 19:23:29 +0800 | [diff] [blame] | 242 | uint8 at_port; // ATPortType_enum |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 243 | uint16 msg_index; // Message index(Start from 1) |
| 244 | // 0 : For unknown msg id |
| 245 | uint16 msg_type; // Refor to : ril_msg_type_enum |
| 246 | uint16 msg_id; // Refor to : ril_msg_id_enum |
| 247 | uint16 err; // Only for RSP(Refor to : mbtk_ril_err_enum) |
| 248 | uint16 data_len; |
| 249 | uint8 *data; |
| 250 | } __attribute__((packed)) ril_msg_pack_info_t; |
| 251 | |
| 252 | typedef struct { |
| 253 | pthread_t pid; |
| 254 | char name[20]; |
| 255 | bool is_waitting; |
| 256 | pthread_cond_t cond; |
| 257 | pthread_mutex_t mutex; |
b.liu | 6917e9b | 2025-03-26 17:23:11 +0800 | [diff] [blame] | 258 | timer_t timer_id; |
| 259 | uint16 msg_index; |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 260 | } ril_cli_thread_info_t; |
| 261 | |
| 262 | typedef struct { |
| 263 | pthread_t pid; |
| 264 | bool is_async; |
| 265 | int *rsp_data_len; // Save response data length. |
| 266 | char *rsp_data; // Save response date. |
| 267 | int *rsp_err; // Save response error, refor to mbtk_ril_err_enum . |
| 268 | ril_msg_pack_info_t *pack; |
| 269 | } ril_msg_info_t; |
| 270 | |
| 271 | /* |
| 272 | GSM band�� |
| 273 | 1 �C PGSM 900 (standard or primary) |
| 274 | 2 �C DCS GSM 1800 |
| 275 | 4 �C PCS GSM 1900 |
| 276 | 8 �C EGSM 900 (extended) |
| 277 | 16 �C GSM 450 |
| 278 | 32 �C GSM 480 |
| 279 | 64 �C GSM 850 |
| 280 | 512 - BAND_LOCK_BIT // used for GSM band setting |
| 281 | */ |
| 282 | typedef enum |
| 283 | { |
| 284 | MBTK_GSM_BAND_PGSM_900 = 1, |
| 285 | MBTK_GSM_BAND_DCS_GSM_1800 = 2, |
| 286 | MBTK_GSM_BAND_PCS_GSM_1900 = 4, |
| 287 | MBTK_GSM_BAND_EGSM_900 = 8, |
| 288 | MBTK_GSM_BAND_GSM_450 = 16, |
| 289 | MBTK_GSM_BAND_GSM_480 = 32, |
| 290 | MBTK_GSM_BAND_GSM_850 = 64, |
| 291 | MBTK_GSM_BAND_BAND_LOCK_BIT = 512 |
| 292 | } mbtk_gsm_band_enum; |
| 293 | |
| 294 | /* |
| 295 | UMTS band�� |
| 296 | 1 �C UMTS_BAND_1 |
| 297 | 2 �C UMTS_BAND_2 |
| 298 | 4 �C UMTS_BAND_3 |
| 299 | 8 �C UMTS_BAND_4 |
| 300 | 16 �C UMTS_BAND_5 |
| 301 | 32 �C UMTS_BAND_6 |
| 302 | 64 �C UMTS_BAND_7 |
| 303 | 128 �C UMTS_BAND_8 |
| 304 | 256 �C UMTS_BAND_9 |
| 305 | */ |
| 306 | typedef enum |
| 307 | { |
| 308 | MBTK_UMTS_BAND_1 = 1, |
| 309 | MBTK_UMTS_BAND_2 = 2, |
| 310 | MBTK_UMTS_BAND_3 = 4, |
| 311 | MBTK_UMTS_BAND_4 = 8, |
| 312 | MBTK_UMTS_BAND_5 = 16, |
| 313 | MBTK_UMTS_BAND_6 = 32, |
| 314 | MBTK_UMTS_BAND_7 = 64, |
| 315 | MBTK_UMTS_BAND_8 = 128, |
| 316 | MBTK_UMTS_BAND_9 = 256 |
| 317 | } mbtk_umts_band_enum; |
| 318 | |
| 319 | /* |
| 320 | LTEbandH(TDD-LTE band) |
| 321 | 32 �C TDLTE_BAND_38 |
| 322 | 64 �C TDLTE_BAND_39 |
| 323 | 128 �C TDLTE_BAND_40 |
| 324 | 256 �C TDLTE_BAND_41 |
| 325 | */ |
| 326 | typedef enum |
| 327 | { |
| 328 | MBTK_TDLTE_BAND_38 = 32, |
| 329 | MBTK_TDLTE_BAND_39 = 64, |
| 330 | MBTK_TDLTE_BAND_40 = 128, |
| 331 | MBTK_TDLTE_BAND_41 = 256 |
| 332 | } mbtk_tdlte_band_enum; |
| 333 | |
| 334 | /* |
| 335 | LTEbandL(FDD-LTE band) |
| 336 | 1 �C FDDLTE_BAND_1 |
| 337 | 4 �C FDDLTE _BAND_3 |
| 338 | 8 �C FDDLTE _BAND_4 |
| 339 | 64 �C FDDLTE _BAND_7 |
| 340 | 65536 �C FDDLTE _BAND_17 |
| 341 | 524288 �C FDDLTE _BAND_20 |
| 342 | */ |
| 343 | typedef enum |
| 344 | { |
| 345 | MBTK_FDDLTE_BAND_1 = 1, |
| 346 | MBTK_FDDLTE_BAND_3 = 4, |
| 347 | MBTK_FDDLTE_BAND_4 = 8, |
| 348 | MBTK_FDDLTE_BAND_7 = 64, |
| 349 | MBTK_FDDLTE_BAND_17 = 65536, |
| 350 | MBTK_FDDLTE_BAND_20 = 524288 |
| 351 | } mbtk_fddlte_band_enum; |
| 352 | |
| 353 | typedef enum |
| 354 | { |
| 355 | MBTK_LTE_EXT_BAND_65 = 1, |
| 356 | MBTK_LTE_EXT_BAND_66 = 2, |
| 357 | MBTK_LTE_EXT_BAND_67 = 4, |
| 358 | MBTK_LTE_EXT_BAND_68 = 8, |
| 359 | MBTK_LTE_EXT_BAND_69 = 16 |
| 360 | } mbtk_lte_ext_band_enum; |
| 361 | |
b.liu | b477207 | 2024-08-15 14:47:03 +0800 | [diff] [blame] | 362 | typedef struct |
| 363 | { |
| 364 | uint8 type; // 0: GSM 1: UMTS 2: LTE |
| 365 | bool running; |
| 366 | |
| 367 | int cell_num; |
| 368 | mbtk_cell_info_t cell[CELL_NUM_MAX]; |
| 369 | } mbtK_cell_pack_info_t; |
| 370 | |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 371 | #ifdef __cplusplus |
| 372 | extern "C" { |
| 373 | #endif |
| 374 | |
| 375 | char* type2str(ril_msg_type_enum type); |
| 376 | |
| 377 | char* apn2str(mbtk_ip_type_enum type); |
| 378 | |
| 379 | /* |
| 380 | IPv6 : 254.128.0.0.0.0.0.0.0.1.0.2.144.5.212.239 -> uint128 |
| 381 | */ |
| 382 | int str_2_ipv6(const void *ip_str, void *ipv6); |
| 383 | |
| 384 | /* |
| 385 | IPv6 : uint128 -> fe80::215:1dff:fe81:484c |
| 386 | */ |
| 387 | int ipv6_2_str(const void *ipv6, void *ipv6_str); |
| 388 | |
| 389 | char* id2str(int id); |
| 390 | |
| 391 | char* err2str(mbtk_ril_err_enum err); |
| 392 | |
| 393 | void *mbtk_memcpy(const void *src, unsigned int n); |
| 394 | |
| 395 | /* |
| 396 | 0 GSM |
| 397 | 1 GSM_COMPACT |
| 398 | 2 UTRAN |
| 399 | 3 GSM_EGPRS |
| 400 | 4 UTRAN_HSDPA |
| 401 | 5 UTRAN_HSUPA |
| 402 | 6 UTRAN_HSDPA_HSUPA |
| 403 | 7 EUTRAN |
| 404 | 8 ECGSM |
| 405 | */ |
| 406 | mbtk_net_type_enum mbtk_net_type_get(mbtk_radio_technology_enum radio_tech); |
| 407 | |
| 408 | void ril_msg_pack_free(ril_msg_pack_info_t* pack); |
| 409 | |
b.liu | b171c9a | 2024-11-12 19:23:29 +0800 | [diff] [blame] | 410 | ril_msg_pack_info_t* ril_msg_pack_creat(ATPortType_enum port, int msg_type, int msg_id, int msg_index, const void *data, int data_len); |
b.liu | 87afc4c | 2024-08-14 17:33:45 +0800 | [diff] [blame] | 411 | |
| 412 | int ril_pack_send(int fd, ril_msg_pack_info_t *pack); |
| 413 | |
| 414 | ril_msg_pack_info_t** ril_pack_recv(int fd, bool is_server, mbtk_ril_err_enum *err); |
| 415 | |
| 416 | #ifdef __cplusplus |
| 417 | } |
| 418 | #endif |
| 419 | |
| 420 | |
| 421 | #endif /* MBTK_INFO_INCLUDE */ |
| 422 | |
| 423 | |