yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | #ifndef LIBZTE_PBM
|
| 2 | #define LIBZTE_PBM
|
| 3 |
|
| 4 | //#include "comdef.h"
|
| 5 |
|
| 6 | //typedef unsigned char uint8;
|
| 7 | //typedef unsigned short uint16;
|
| 8 | //typedef unsigned char boolean;
|
| 9 |
|
| 10 | #ifndef uint8
|
| 11 | #define uint8 unsigned char
|
| 12 | #endif
|
| 13 |
|
| 14 | #ifndef uint16
|
| 15 | #define uint16 unsigned short
|
| 16 | #endif
|
| 17 |
|
| 18 | #ifndef boolean
|
| 19 | #define boolean unsigned char
|
| 20 | #endif
|
| 21 |
|
| 22 | #ifndef TRUE
|
| 23 | #define TRUE 1
|
| 24 | #endif
|
| 25 |
|
| 26 | #ifndef FALSE
|
| 27 | #define FALSE 0
|
| 28 | #endif
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 | //db path
|
| 33 | #ifdef _MBB_OS_UCLINUX
|
| 34 | #define ZTE_PBM_DB_DIR "/mnt/jffs2/etc_rw/config"
|
| 35 | #define ZTE_PBM_DB_PATH "/mnt/jffs2/etc_rw/config/pbm.db"
|
| 36 | #else
|
| 37 | #define ZTE_PBM_DB_DIR "/etc_rw/"
|
| 38 | //#ifdef WEBS_SECURITY
|
| 39 | #define ZTE_PBM_DB_PATH_SEC "/tmp/pbm.db"
|
| 40 | //#else
|
| 41 | #define ZTE_PBM_DB_PATH "/etc_rw/pbm.db"
|
| 42 | //#endif
|
| 43 | #endif
|
| 44 |
|
| 45 | #define ZTE_DB_PBM_TABLE "pbm"
|
| 46 | #define ZTE_DB_PBM_DEVICE_TABLE "pbm_device"
|
| 47 | #define ZTE_DB_PBM_SIM_TABLE "pbm_sim"
|
| 48 | #define ZTE_DB_PBM_SIM_CAPABILITY_TABLE "pbm_sim_capability"
|
| 49 | #define ZTE_DB_PBM_DEVICE_CAPABILITY_TABLE "pbm_device_capability"
|
| 50 |
|
| 51 | #define MAX_NUMBER_OF_BYTES_FOR_SQL 1024
|
| 52 |
|
| 53 |
|
| 54 | //socket parameters
|
| 55 | //socket path
|
| 56 | #ifndef ZTE_PBM_PATH
|
| 57 | #define ZTE_PBM_PATH "zte_pbm"
|
| 58 | #endif
|
| 59 |
|
| 60 | //socket buffer size
|
| 61 | #ifndef ZTE_SOCKET_DATA_BUF_MAX
|
| 62 | #define ZTE_SOCKET_DATA_BUF_MAX 1024
|
| 63 | #endif
|
| 64 |
|
| 65 | //socket max liscen num
|
| 66 | #ifndef ZTE_SOCKET_MAX_LISCEN_NUM
|
| 67 | #define ZTE_SOCKET_MAX_LISCEN_NUM 50
|
| 68 | #endif
|
| 69 |
|
| 70 | //web ui pbm
|
| 71 | #ifndef PBM_MAX_DEL_LEN
|
| 72 | #define PBM_MAX_DEL_LEN 50
|
| 73 | #endif
|
| 74 |
|
| 75 | #ifndef ZTE_PB_INDEX_MAX
|
| 76 | #define ZTE_PB_INDEX_MAX 500
|
| 77 | #endif
|
| 78 |
|
| 79 | #ifndef ZTE_WEB_PBM_REC_LEN
|
| 80 | #define ZTE_WEB_PBM_REC_LEN 5
|
| 81 | #endif
|
| 82 |
|
| 83 | #ifndef PBM_WEB_MAX_CHAR_LEN
|
| 84 | #define PBM_WEB_MAX_CHAR_LEN ZTE_WEB_PBM_REC_LEN*ZTE_PB_INDEX_MAX
|
| 85 | #endif
|
| 86 |
|
| 87 | //number length
|
| 88 | #ifndef PBM_MAX_NUM_LENGTH
|
| 89 | #define PBM_MAX_NUM_LENGTH 40
|
| 90 | #endif
|
| 91 |
|
| 92 | #ifndef PBM_NUM_SIZE
|
| 93 | #define PBM_NUM_SIZE (PBM_MAX_NUM_LENGTH+2) /* + and null for string */
|
| 94 | #endif
|
| 95 |
|
| 96 | //name length
|
| 97 | #ifndef PBM_MAX_TEXT_LENGTH
|
| 98 | #define PBM_MAX_TEXT_LENGTH 90
|
| 99 | #endif
|
| 100 |
|
| 101 | #ifndef PBM_TEXT_SIZE_CHARS
|
| 102 | #define PBM_TEXT_SIZE_CHARS (PBM_MAX_TEXT_LENGTH+1) /* Null terminated string */
|
| 103 | #endif
|
| 104 |
|
| 105 | #ifndef PBM_TEXT_SIZE_BYTES
|
| 106 | #define PBM_TEXT_SIZE_BYTES (PBM_TEXT_SIZE_CHARS*sizeof(uint16)) /* size in bytes */
|
| 107 | #endif
|
| 108 |
|
| 109 | //the max numbers of record in modem location
|
| 110 | #define PBM_PC_MAX_RECORD 100
|
| 111 |
|
| 112 |
|
| 113 | #define PBM_OPERATE_SUC "0"
|
| 114 | #define PBM_LOADING "1"
|
| 115 | #define PBM_NEWING "2"
|
| 116 | #define PBM_DELING "3"
|
| 117 | #define PBM_MUT_DELING "4"
|
| 118 | #define PBM_ALL_DELING "5"
|
| 119 | #define PBM_LOAD_ERROR "6"
|
| 120 | #define PBM_NEW_ERROR "7"
|
| 121 | #define PBM_DEL_ERROR "8"
|
| 122 | #define PBM_NEW_ERROR_MEM_FULL "9"
|
| 123 | #define PBM_ERROR_CONVERT_CHEST "10"
|
| 124 | #define PBM_LOCATION_IS_NULL "11"
|
| 125 | #define ZTE_SUPPORT_SIM_PBM "12"
|
| 126 | #define ZTE_SUPPORT_USIM_PBM "13"
|
| 127 | #define ZTE_PBM_ERROR "14"
|
| 128 | #define PBM_MUL_DEL_PART_SUC "15"
|
| 129 |
|
| 130 |
|
| 131 | #define ZTE_PBM_NVCFG_LEN 15
|
| 132 |
|
| 133 | //the nvconfig of pbm module
|
| 134 | #ifndef ZTE_PBM_NV
|
| 135 | #define ZTE_PBM_NV "pbm_write_flag"
|
| 136 | #endif
|
| 137 |
|
| 138 | #ifndef ZTE_PBM_GROUP_NV
|
| 139 | #define ZTE_PBM_GROUP_NV "pbm_group"
|
| 140 | #endif
|
| 141 |
|
| 142 | #ifndef ZTE_SUPPORT_PBM_NV
|
| 143 | #define ZTE_SUPPORT_PBM_NV "support_pbm_flag"
|
| 144 | #endif
|
| 145 |
|
| 146 | #ifndef ZTE_PBM_INIT_NV
|
| 147 | #define ZTE_PBM_INIT_NV "pbm_init_flag"
|
| 148 | #endif
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 | //the location of pbm in web ui
|
| 153 | //#define PBM_LOCATION_DEVICE 1
|
| 154 | //#define PBM_LOCATION_SIM 0
|
| 155 |
|
| 156 | typedef enum
|
| 157 | {
|
| 158 | PBM_LOCATION_SIM = 0, //sim card only,exsit in database
|
| 159 | PBM_LOCATION_DEVICE = 1, //device only,exit in database
|
| 160 | PBM_LOCATION_ALL = 2, //sim card and device, not exsit in database, only use in pbm code
|
| 161 | PBM_LOCATION_GROUP = 3, //group in device,for example:common,family and so on,not exsit in database, only use in pbm code
|
| 162 |
|
| 163 | PBM_LOCATION_MAX
|
| 164 | } zte_pbm_location_e_type;
|
| 165 |
|
| 166 |
|
| 167 | typedef enum
|
| 168 | {
|
| 169 | ZTE_PBM_FAILURE = -1,
|
| 170 | ZTE_PBM_SUCCESS = 0,
|
| 171 | ZTE_PBM_NOT_SUPPORT = 1, //do not support web ui pbm
|
| 172 |
|
| 173 | ZTE_PBM_MAX
|
| 174 | } zte_pbm_return_e_type;
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 | typedef struct
|
| 179 | {
|
| 180 | int sim_type;
|
| 181 | int max_record_number;
|
| 182 | int used_record_number;
|
| 183 | int max_name_len;
|
| 184 | int max_number_len;
|
| 185 | int max_anr_num;
|
| 186 | int max_anr_len;
|
| 187 | int max_anr1_num;
|
| 188 | int max_anr1_len;
|
| 189 | int max_email_num;
|
| 190 | int max_email_len;
|
| 191 | int max_sne_len;
|
| 192 | } zte_pbm_sim_capability_s_type;
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 | typedef struct
|
| 197 | {
|
| 198 | int max_record_number;
|
| 199 | int used_record_number;
|
| 200 | } zte_pbm_device_capability_s_type;
|
| 201 |
|
| 202 | //////*******///these structs must define in the libzte_mc.h begin
|
| 203 | #ifndef ZTE_MC_PBM_TYPE
|
| 204 | #define ZTE_MC_PBM_TYPE
|
| 205 | #ifdef ZTE_MC_PBM_TYPE
|
| 206 | typedef struct zte_pbm_create_ext_record_s_type
|
| 207 | {
|
| 208 | int zte_pbm_id; //the id in the pbm table,unique,ASC
|
| 209 | int zte_pbm_index;
|
| 210 | int zte_pbm_location;
|
| 211 | char zte_pbm_name[PBM_TEXT_SIZE_BYTES];
|
| 212 | char zte_pbm_number[PBM_NUM_SIZE];
|
| 213 | int zte_pbm_type;
|
| 214 | char zte_pbm_anr[PBM_NUM_SIZE];
|
| 215 | char zte_pbm_anr1[PBM_NUM_SIZE];
|
| 216 | char zte_pbm_email[PBM_TEXT_SIZE_BYTES];
|
| 217 | //char zte_pbm_sne[PBM_TEXT_SIZE_BYTES];
|
| 218 | //char zte_pbm_group[PBM_TEXT_SIZE_BYTES];
|
| 219 | char zte_pbm_sne[32];// 91*2 ---> 32 ÔÝʱδÓõ½¸Ã²ÎÊý
|
| 220 | char zte_pbm_group[32]; // 91*2 ---> 32
|
| 221 | int zte_pbm_del_id;
|
| 222 | } zte_pbm_create_ext_record_s_type;
|
| 223 |
|
| 224 |
|
| 225 | typedef struct zte_pbm_del_multi_records_s_type
|
| 226 | {
|
| 227 | int zte_del_pbm_id[PBM_MAX_DEL_LEN];
|
| 228 | int zte_del_pbm_total;
|
| 229 | int zte_del_pbm_location;
|
| 230 | int zte_del_pbm_index[PBM_MAX_DEL_LEN];
|
| 231 | } zte_pbm_del_multi_records_s_type;
|
| 232 | #endif
|
| 233 | #endif
|
| 234 |
|
| 235 | //////*******///these structs must define in the libzte_mc.h end
|
| 236 |
|
| 237 | /*
|
| 238 | typedef enum zte_pbm_cmd_e_type
|
| 239 | {
|
| 240 | ZTE_PBM_LOAD_REC_MSG=0,-
|
| 241 | ZTE_PBM_WRITE_REC_MSG,-
|
| 242 | ZTE_PBM_DEL_A_REC_MSG,-
|
| 243 | ZTE_PBM_DEL_MUTI_REC_MSG,-
|
| 244 | ZTE_PBM_DEL_ALL_REC_MSG,-
|
| 245 | ZTE_PBM_SLEEP_MSG,
|
| 246 | ZTE_PBM_WAKEUP_MSG,
|
| 247 | ZTE_PBM_LOAD_WITHOUT_SIM_MSG,-
|
| 248 | ZTE_PBM_MAX_MSG,
|
| 249 | } zte_pbm_cmd_e_type;
|
| 250 | */
|
| 251 |
|
| 252 | /*
|
| 253 | typedef union zte_pbm_data_u_type
|
| 254 | {
|
| 255 | zte_pbm_create_ext_record_s_type zte_new_pbm_data;
|
| 256 | zte_pbm_del_multi_records_s_type zte_del_pbm_data;
|
| 257 |
|
| 258 | } zte_pbm_data_u_type;
|
| 259 | */
|
| 260 |
|
| 261 | /*
|
| 262 | typedef struct zte_pbm_msg_s_type
|
| 263 | {
|
| 264 | zte_pbm_cmd_e_type zte_pbm_msg;
|
| 265 | zte_pbm_data_u_type zte_pbm_data;
|
| 266 |
|
| 267 | } zte_pbm_msg_s_type;
|
| 268 | */
|
| 269 |
|
| 270 | typedef struct zte_pbm_header_s_type
|
| 271 | {
|
| 272 | int zte_id; //the id in the pbm table,unique,ASC
|
| 273 | int zte_index;
|
| 274 | int zte_location;
|
| 275 | } zte_pbm_header_s_type;
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 | typedef struct
|
| 280 | {
|
| 281 | uint8 page;
|
| 282 | uint8 num_per_page;
|
| 283 | zte_pbm_location_e_type location;
|
| 284 | boolean asc_flag;
|
| 285 | uint8 order_by;
|
| 286 | } zte_pbm_query_req_s_type;
|
| 287 |
|
| 288 | typedef struct
|
| 289 | {
|
| 290 | uint8 count;
|
| 291 | zte_pbm_create_ext_record_s_type data[0];/*lint !e1501*/
|
| 292 | } zte_pbm_query_resp_s_type;
|
| 293 |
|
| 294 |
|
| 295 | //////*******///these functions must define in the libzte_mc.h begin
|
| 296 | #ifndef ZTE_MC_PBM_TYPE
|
| 297 | #define ZTE_MC_PBM_TYPE
|
| 298 | #ifdef ZTE_MC_PBM_TYPE
|
| 299 | //void zte_mc_pbm_load_rec();
|
| 300 | //void zte_mc_pbm_write_rec(zte_pbm_create_ext_record_s_type *pbm_recv_record);
|
| 301 | //void zte_mc_pbm_del_a_rec(zte_pbm_del_multi_records_s_type *pbm_recv_record);
|
| 302 | //void zte_mc_pbm_del_multi_recs(zte_pbm_del_multi_records_s_type *pbm_recv_record);
|
| 303 | //void zte_mc_pbm_del_all_recs(zte_pbm_del_multi_records_s_type *pbm_recv_record);
|
| 304 | //void zte_mc_pbm_load_if_no_sim();
|
| 305 | void aaa(int i);
|
| 306 | #endif
|
| 307 | #endif
|
| 308 | //////*******///these functions must define in the libzte_mc.h end
|
| 309 |
|
| 310 | //void zte_mc_pbm_sleep_wakeup(zte_pbm_cmd_e_type pbm_msg_type);
|
| 311 |
|
| 312 | //////the interface for get pbm data and capability for web server
|
| 313 | int zte_libpbm_get_capability
|
| 314 | (
|
| 315 | zte_pbm_query_req_s_type *req,
|
| 316 | zte_pbm_sim_capability_s_type *sim_para,
|
| 317 | zte_pbm_device_capability_s_type *device_para
|
| 318 | );
|
| 319 | int zte_libpbm_get_rec_data (zte_pbm_query_req_s_type *req, zte_pbm_query_resp_s_type*resp);
|
| 320 | int zte_libpbm_get_name_by_number(char *pbm_number, char *pbm_name);
|
| 321 |
|
| 322 |
|
| 323 | #endif
|
| 324 |
|