blob: e9cb822e5a262f11fd66193ff435ad6be9a9ff04 [file] [log] [blame]
b.liu87afc4c2024-08-14 17:33:45 +08001/*
2* ril_info.h
3*
4* MBTK Ril information header.
5*
6* Author : lb
7* Date : 2024/8/6 10:53:08
8*/
9#ifndef _RIL_INFO_H
10#define _RIL_INFO_H
11#include <stdio.h>
12
13#include "mbtk_type.h"
14#include "mbtk_ril_api.h"
15#include "mbtk_log.h"
16#include "atchannel.h"
17#include "at_tok.h"
18#include "mbtk_list.h"
19#include "mbtk_device.h"
20#include "mbtk_queue.h"
21
22#define SOCK_CLIENT_MAX 100
23#define EPOLL_LISTEN_MAX 100
24#define IND_REGISTER_MAX 10
25#define PACK_PROCESS_QUEUE_MAX 20
26
b.liu10a34102024-08-20 20:36:24 +080027#if 0
b.liu87afc4c2024-08-14 17:33:45 +080028#define MBTK_APN_PROP "persist.mbtk.apn"
b.liu10a34102024-08-20 20:36:24 +080029#else
30#define MBTK_APN_PROP "/etc/mbtk/apn"
31#endif
32
b.liu87afc4c2024-08-14 17:33:45 +080033#define MBTK_DEF_ROUTE_CID "persist.mbtk.def_route_cid"
b.liubcf86c92024-08-19 19:48:28 +080034#define MBTK_DEF_DNS_CID "persist.mbtk.def_dns_cid"
b.liu87afc4c2024-08-14 17:33:45 +080035
36typedef struct
37{
38 int fd;
39
40 uint32 ind_num;
41 uint16 ind_register[IND_REGISTER_MAX];
42} sock_cli_info_t;
43
44typedef struct
45{
46 sock_cli_info_t *cli_info;
47 void* pack; // Refro to : ril_msg_pack_info_t
48} ril_msg_queue_info_t;
49
50typedef struct {
51 mbtk_radio_state_enum radio_state;
52 mbtk_sim_state_enum sim_state;
53 int sock_listen_fd;
54 int epoll_fd;
55 bool at_process;
56
57 list_node_t *sock_client_list; // Refor to : sock_cli_info_t
58 mbtk_queue_node_t msg_queue; // Refor to : ril_msg_queue_info_t
59 pthread_cond_t msg_cond;
60 pthread_mutex_t msg_mutex;
61} ril_info_t;
62
63typedef struct {
64 bool band_set_success;
65 mbtk_modem_band_area_enum band_area;
66 mbtk_band_info_t band_support;
67} ril_band_info_t;
68
69typedef enum {
70 RIL_URC_MSG_RADIO_STATE,
71 RIL_URC_MSG_CGEV,
72 RIL_URC_MSG_NET_CS_REG_STATE,
73 RIL_URC_MSG_NET_PS_REG_STATE,
74 RIL_URC_MSG_CALL_STATE,
75 RIL_URC_MSG_SIM_STATE,
76 RIL_URC_MSG_PDP_STATE,
77 RIL_URC_MSG_SMS_STATE,
78 RIL_URC_MSG_SET_BAND,
79 RIL_URC_MSG_GET_SIM_STATE, //check sim status
80 RIL_URC_MSG_NET_STATE_LOG // Save Network state into file.
81} ril_urc_msg_id_enum;
82
83/*
840: unknown
851: available
862: current
873: forbidden
88*/
89typedef enum
90{
91 MBTK_NET_AVIL_STATE_UNKNOWN = 0,
92 MBTK_NET_AVIL_STATE_AVAILABLE,
93 MBTK_NET_AVIL_STATE_CURRENT,
94 MBTK_NET_AVIL_STATE_FORBIDDEN
95} mbtk_net_avil_state_enum;
96
97typedef enum {
98 RIL_DATA_CALL_STATE_STOP,
99 RIL_DATA_CALL_STATE_STARTED,
100 RIL_DATA_CALL_STATE_STARTING, // Data dialing in progress
101 RIL_DATA_CALL_STATE_STOPPING // Ending data dialing
102} ril_data_call_state_enum;
103
104typedef struct {
105 ril_urc_msg_id_enum msg;
106
107 void *data;
108 int data_len;
109} ril_urc_msg_info_t;
110
b.liubcf86c92024-08-19 19:48:28 +0800111typedef struct
112{
113 int cid;
114 bool act;
115 bool waitting;
116} ril_cgact_wait_t;
117
b.liu87afc4c2024-08-14 17:33:45 +0800118extern ril_info_t ril_info;
119
120
121mbtk_radio_state_enum ril_radio_state_get();
122mbtk_ril_err_enum ril_radio_state_set(mbtk_radio_state_enum state, bool reset);
123
124mbtk_sim_state_enum ril_sim_state_get();
125
126void apn_auto_conf_from_prop();
127
128bool is_ipv4(const char *ip);
129
b.liubcf86c92024-08-19 19:48:28 +0800130int net_ifc_config(mbtk_ril_cid_enum cid, bool def_route, bool as_dns, mbtk_ip_info_t *ip_info);
131
132int net_ifc_reconfig(mbtk_ril_cid_enum cid, bool def_route, bool as_dns, mbtk_ip_info_t *ip_info);
133
b.liu87afc4c2024-08-14 17:33:45 +0800134#endif /* _RIL_INFO_H */