comparison g23m/condat/ms/src/aci/ati_bat.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : ATI_SRC_TST
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : this source is used for W32 tests
18 +-----------------------------------------------------------------------------
19 */
20
21 #include "aci_all.h"
22 /*==== INCLUDES ===================================================*/
23 #include "line_edit.h"
24 #include "aci_cmh.h"
25 #include "ati_cmd.h"
26 #include "aci_cmd.h"
27 #include "dti.h" /* functionality of the dti library */
28 #include "cmh_dti.h"
29
30 #include "aci_lst.h"
31 #include "dti_conn_mng.h"
32 #ifdef UART
33 #include "psa_uart.h"
34 #include "cmh_uart.h"
35 #endif
36 #ifdef FF_PSI
37 #include "psa_psi.h"
38 #include "cmh_psi.h"
39 #endif /*FF_PSI*/
40 #include "aci_io.h"
41 #include "aci_mem.h"
42 #include "aci.h"
43 #include "ati_io.h"
44 #include "sap_dti.h"
45
46 #include "ati_int.h"
47 #ifdef UART
48 #include "ati_src_uart.h"
49 #endif
50 #ifdef FF_PSI
51 #include "ati_src_psi.h"
52 #endif /*FF_PSI*/
53
54 #ifdef FF_FAX
55 #include "aci_fd.h"
56 #endif
57
58
59 #include "aci_bat_cmh.h"
60 #include "typedefs.h"
61 #include "gdd.h"
62 #include "gdd_aci.h"
63 #include "bat.h"
64 #include "bat_ctrl.h"
65 #include "bat_intern.h"
66 #include "cmh_sms.h"
67 #ifdef GPRS
68 #include "gaci_cmh.h"
69 #include "gaci_cmd.h"
70 #endif
71 #include "aci_bat.h"
72 #include "aci_bat_cb.h"
73
74 #define ATI_BAT_GLOBALS
75 #include "ati_bat.h"
76
77 #include "cphs.h"
78 #include "aci_cphs.h"
79
80 #ifdef _SIMULATION_
81 #include "gdd_aci.h"
82 #endif
83
84
85 #define MAX_CEER_DESC_LTH (50)
86 #define MAGIC_EMPTY_APN "\x0ff"
87 #define BAT_BIT_12 0x1000
88 #define HIGHEST_BAND_SUPPORTED (0x1F)
89
90 /*==== EXTERNS ==================================================*/
91
92 EXTERN CHAR *cmdExtError (T_ACI_EXT_ERR e);
93 EXTERN void psi_InitCmdStruct (T_ACI_DTI_PRC_PSI *cmd_struct);
94 EXTERN void getCeerDesc(USHORT cause, char *desc);
95 EXTERN T_CAP_ID map_dti_cpblty (UBYTE dti_cpblty);
96
97 EXTERN void rCI_PercentCCCN ( T_ACI_FAC_DIR tDirection,
98 SHORT cId,
99 T_fac_inf *fie );
100
101 #ifdef SIM_TOOLKIT
102 EXTERN UBYTE sat[CMD_SRC_MAX];
103 #endif
104
105 EXTERN const T_CAP_NAME ati_cap_name[];
106 EXTERN UBYTE cpmsCallType;
107
108 LOCAL const SMS_Memory sms_mem [] =
109
110 {
111 {"ME", SMS_STOR_Me},
112 {"me", SMS_STOR_Me},
113 {"SM", SMS_STOR_Sm},
114 {"sm", SMS_STOR_Sm},
115 {0,0}
116 };
117
118 /*==== TYPES ======================================================*/
119 typedef struct
120 {
121 int (*fptr)(T_ACI_DTI_PRC_PSI *src_infos_psi,
122 T_BAT_cmd_response *resp_p); /* BAT Response wrapper func */
123 } BATResponse;
124
125 /*==== VARIABLES ==================================================*/
126
127 LOCAL BOOL cops_flag=FALSE;
128 LOCAL BOOL CLCC_flag=FALSE;
129 LOCAL CHAR *clan_buf=NULL;
130
131
132 #ifdef FF_ATI
133 #define RSP_ATI(rspFoo) {Resp_##rspFoo}
134 #else
135 #define RSP_ATI(rspFoo) {0}
136 #endif
137
138 #ifdef FAX_AND_DATA
139 #define RSP_FAD(rspFoo) {Resp_##rspFoo}
140 #else
141 #define RSP_FAD(rspFoo) {0}
142 #endif
143
144 #ifdef SIM_TOOLKIT
145 #define RSP_STK(rspFoo) {Resp_##rspFoo}
146 #else
147 #define RSP_STK(rspFoo) {0}
148 #endif
149
150 #ifdef GPRS
151 #define RSP_GPR(rspFoo) {Resp_##rspFoo}
152 #else
153 #define RSP_GPR(rspFoo) {0}
154 #endif
155
156 static BATResponse ResponseTab[] =
157 {
158 RSP_ATI(AtOk), /* BAT_RES_AT_OK = 0x0, */
159 RSP_ATI(AtConnect), /* BAT_RES_AT_CONNECT = 0x1, */
160 RSP_ATI(AtNoCarrierFinal), /* BAT_RES_AT_NO_CARRIER_FINAL = 0x2, */
161 RSP_ATI(PlusCmeError), /* BAT_RES_PLUS_CME_ERROR = 0x3, */
162 RSP_ATI(PlusCmsError), /* BAT_RES_PLUS_CMS_ERROR = 0x4, */
163 RSP_ATI(AtBusy), /* BAT_RES_AT_BUSY = 0x5, */
164 RSP_ATI(AtChannelBusy), /* BAT_RES_AT_CHANNEL_BUSY = 0x6, */
165 RSP_ATI(AtNoAnswer), /* BAT_RES_AT_NO_ANSWER = 0x7, */
166 RSP_ATI(PlusExtError), /* BAT_RES_PLUS_EXT_ERROR = 0x8, */
167 RSP_ATI(qPercentALS), /* BAT_RES_QUE_PERCENT_ALS = 0x9, */
168 RSP_ATI(tPercentALS), /* BAT_RES_TST_PERCENT_ALS = 0xa, */
169 RSP_ATI(qPercentATR), /* BAT_RES_QUE_PERCENT_ATR = 0xb, */
170 RSP_ATI(qPercentBAND), /* BAT_RES_QUE_PERCENT_BAND = 0xc, */
171 RSP_ATI(tPercentBAND), /* BAT_RES_TST_PERCENT_BAND = 0xd, */
172 RSP_ATI(qPlusCACM), /* BAT_RES_QUE_PLUS_CACM = 0xe, */
173 RSP_ATI(qPlusCAMM), /* BAT_RES_QUE_PLUS_CAMM = 0xf, */
174 RSP_ATI(sPlusCAOC), /* BAT_RES_SET_PLUS_CAOC = 0x10, */
175 RSP_ATI(sPlusCBC), /* BAT_RES_SET_PLUS_CBC = 0x11, */
176 RSP_ATI(qPercentCBHZ), /* BAT_RES_QUE_PERCENT_CBHZ = 0x12, */
177 RSP_ATI(tPercentCBHZ), /* BAT_RES_TST_PERCENT_CBHZ = 0x13, */
178 RSP_ATI(qPlusCBST), /* BAT_RES_QUE_PLUS_CBST = 0x14, */
179 RSP_ATI(qPercentCCBS), /* BAT_RES_QUE_PERCENT_CCBS = 0x15, */
180 RSP_ATI(sPlusCCFC), /* BAT_RES_SET_PLUS_CCFC = 0x16, */
181 RSP_ATI(qPlusCCLK), /* BAT_RES_QUE_PLUS_CCLK = 0x17, */
182 RSP_ATI(qPlusCCUG), /* BAT_RES_QUE_PLUS_CCUG = 0x18, */
183 RSP_ATI(sPlusCCWA), /* BAT_RES_SET_PLUS_CCWA = 0x19, */
184 RSP_ATI(sPlusCCWA_W), /* BAT_RES_SET_PLUS_CCWA_W = 0x1a, */
185 RSP_ATI(sPlusCEER), /* BAT_RES_SET_PLUS_CEER = 0x1b, */
186 RSP_ATI(qPlusCFUN), /* BAT_RES_QUE_PLUS_CFUN = 0x1c, */
187 RSP_GPR(qPercentCGAATT), /* BAT_RES_QUE_PERCENT_CGAATT = 0x1d, */
188 RSP_GPR(qPlusCGACT), /* BAT_RES_QUE_PLUS_CGACT = 0x1e, */
189 RSP_GPR(qPlusCGATT), /* BAT_RES_QUE_PLUS_CGATT = 0x1f, */
190 RSP_GPR(qPercentCGCLASS), /* BAT_RES_QUE_PERCENT_CGCLASS = 0x20, */
191 RSP_GPR(qPlusCGCLASS), /* BAT_RES_QUE_PLUS_CGCLASS = 0x21, */
192 RSP_GPR(qPlusCGDCONT), /* BAT_RES_QUE_PLUS_CGDCONT = 0x22, */
193 RSP_GPR(sPlusCGPADDR), /* BAT_RES_SET_PLUS_CGPADDR = 0x23, */
194 RSP_GPR(tPlusCGPADDR), /* BAT_RES_TST_PLUS_CGPADDR = 0x24, */
195 RSP_GPR(sPercentCGPCO), /* BAT_RES_SET_PERCENT_CGPCO = 0x25, */
196 RSP_GPR(qPercentCGPPP), /* BAT_RES_QUE_PERCENT_CGPPP = 0x26, */
197 RSP_GPR(qPlusCGQMIN), /* BAT_RES_QUE_PLUS_CGQMIN = 0x27, */
198 RSP_GPR(qPlusCGQREQ), /* BAT_RES_QUE_PLUS_CGQREQ = 0x28, */
199 RSP_GPR(qPercentCGREG), /* BAT_RES_QUE_PERCENT_CGREG = 0x29, */
200 RSP_GPR(qPlusCGREG), /* BAT_RES_QUE_PLUS_CGREG = 0x2a, */
201 RSP_GPR(qPlusCGSMS), /* BAT_RES_QUE_PLUS_CGSMS = 0x2b, */
202 RSP_ATI(sPercentCHPL), /* BAT_RES_SET_PERCENT_CHPL = 0x2c, */
203 RSP_ATI(sPercentCHPL_W), /* BAT_RES_SET_PERCENT_CHPL_W = 0x2d, */
204 RSP_ATI(sPlusCIMI), /* BAT_RES_SET_PLUS_CIMI = 0x2e, */
205 RSP_ATI(qPlusCIND), /* BAT_RES_QUE_PLUS_CIND = 0x2f, */
206 RSP_ATI(qPlusCLAN), /* BAT_RES_QUE_PLUS_CLAN = 0x30, */
207 RSP_ATI(tPlusCLAN), /* BAT_RES_TST_PLUS_CLAN = 0x31, */
208 RSP_ATI(qPlusCLCC), /* BAT_RES_QUE_PLUS_CLCC = 0x32, */
209 RSP_ATI(sPlusCLCK), /* BAT_RES_SET_PLUS_CLCK = 0x33, */
210 RSP_ATI(qPlusCLIP), /* BAT_RES_QUE_PLUS_CLIP = 0x34, */
211 RSP_ATI(qPlusCLIP_W), /* BAT_RES_QUE_PLUS_CLIP_W = 0x35, */
212 RSP_ATI(qPlusCLIR), /* BAT_RES_QUE_PLUS_CLIR = 0x36, */
213 RSP_ATI(sPlusCLVL), /* BAT_RES_SET_PLUS_CLVL = 0x37, */
214 RSP_ATI(qPlusCLVL), /* BAT_RES_QUE_PLUS_CLVL = 0x38, */
215 RSP_ATI(qPlusCMER), /* BAT_RES_QUE_PLUS_CMER = 0x39, */
216 RSP_ATI(sPlusCMGC), /* BAT_RES_SET_PLUS_CMGC = 0x3a, */
217 RSP_ATI(sPlusCMGL), /* BAT_RES_SET_PLUS_CMGL = 0x3b, */
218 RSP_ATI(sPlusCMGL_W), /* BAT_RES_SET_PLUS_CMGL_W = 0x3c, */
219 RSP_ATI(sPlusCMGR), /* BAT_RES_SET_PLUS_CMGR = 0x3d, */
220 RSP_ATI(sPlusCMGR_W), /* BAT_RES_SET_PLUS_CMGR_W = 0x3e, */
221 RSP_ATI(sPlusCMGS), /* BAT_RES_SET_PLUS_CMGS = 0x3f, */
222 RSP_ATI(sPlusCMGW), /* BAT_RES_SET_PLUS_CMGW = 0x40, */
223 RSP_ATI(qPlusCMOD), /* BAT_RES_QUE_PLUS_CMOD = 0x41, */
224 RSP_ATI(qPlusCMUT), /* BAT_RES_QUE_PLUS_CMUT = 0x42, */
225 RSP_ATI(qPlusCMUX), /* BAT_RES_QUE_PLUS_CMUX = 0x43, */
226 RSP_ATI(qPercentCNAP), /* BAT_RES_QUE_PERCENT_CNAP = 0x44, */
227 RSP_ATI(qPlusCNMI), /* BAT_RES_QUE_PLUS_CNMI = 0x45, */
228 RSP_ATI(sPlusCNUM), /* BAT_RES_SET_PLUS_CNUM = 0x46, */
229 RSP_ATI(sPlusCNUM_W), /* BAT_RES_SET_PLUS_CNUM_W = 0x47, */
230 RSP_ATI(qPlusCOLP), /* BAT_RES_QUE_PLUS_COLP = 0x48, */
231 RSP_ATI(qPlusCOLP_W), /* BAT_RES_QUE_PLUS_COLP_W = 0x49, */
232 RSP_ATI(qPercentCOPS), /* BAT_RES_QUE_PERCENT_COPS = 0x4a, */
233 RSP_ATI(tPercentCOPS), /* BAT_RES_TST_PERCENT_COPS = 0x4b, */
234 RSP_ATI(qPlusCOPS), /* BAT_RES_QUE_PLUS_COPS = 0x4c, */
235 RSP_ATI(tPlusCOPS), /* BAT_RES_TST_PLUS_COPS = 0x4d, */
236 RSP_ATI(qPercentCOPS_W), /* BAT_RES_QUE_PERCENT_COPS_W = 0x4e, */
237 RSP_ATI(tPercentCOPS_W), /* BAT_RES_TST_PERCENT_COPS_W = 0x4f, */
238 RSP_ATI(sPercentCPALS), /* BAT_RES_SET_PERCENT_CPALS = 0x50, */
239 RSP_ATI(qPercentCPALS), /* BAT_RES_QUE_PERCENT_CPALS = 0x51, */
240 RSP_ATI(sPercentCPALS_W), /* BAT_RES_SET_PERCENT_CPALS_W = 0x52, */
241 RSP_ATI(qPercentCPALS_W), /* BAT_RES_QUE_PERCENT_CPALS_W = 0x53, */
242 RSP_ATI(sPlusCPAS), /* BAT_RES_SET_PLUS_CPAS = 0x54, */
243 RSP_ATI(sPlusCPBF), /* BAT_RES_SET_PLUS_CPBF = 0x55, */
244 RSP_ATI(tPlusCPBF), /* BAT_RES_TST_PLUS_CPBF = 0x56, */
245 RSP_ATI(sPlusCPBF_W), /* BAT_RES_SET_PLUS_CPBF_W = 0x57, */
246 RSP_ATI(tPlusCPBF_W), /* BAT_RES_TST_PLUS_CPBF_W = 0x58, */
247 RSP_ATI(sPlusCPBR), /* BAT_RES_SET_PLUS_CPBR = 0x59, */
248 RSP_ATI(tPlusCPBR), /* BAT_RES_TST_PLUS_CPBR = 0x5a, */
249 RSP_ATI(sPlusCPBR_W), /* BAT_RES_SET_PLUS_CPBR_W = 0x5b, */
250 RSP_ATI(tPlusCPBR_W), /* BAT_RES_TST_PLUS_CPBR_W = 0x5c, */
251 RSP_ATI(qPercentCPBS), /* BAT_RES_QUE_PERCENT_CPBS = 0x5d, */
252 RSP_ATI(qPlusCPBS), /* BAT_RES_QUE_PLUS_CPBS = 0x5e, */
253 RSP_ATI(tPlusCPBW), /* BAT_RES_TST_PLUS_CPBW = 0x5f, */
254 RSP_ATI(tPlusCPBW_W), /* BAT_RES_TST_PLUS_CPBW_W = 0x60, */
255 RSP_ATI(sPercentCPCFU), /* BAT_RES_SET_PERCENT_CPCFU = 0x61, */
256 RSP_ATI(qPercentCPHS), /* BAT_RES_QUE_PERCENT_CPHS = 0x62, */
257 RSP_ATI(qPlusCPIN), /* BAT_RES_QUE_PLUS_CPIN = 0x63, */
258 RSP_ATI(qPercentCPINF), /* BAT_RES_QUE_PERCENT_CPINF = 0x64, */
259 RSP_ATI(sPercentCPMB), /* BAT_RES_SET_PERCENT_CPMB = 0x65, */
260 RSP_ATI(qPercentCPMB), /* BAT_RES_QUE_PERCENT_CPMB = 0x66, */
261 RSP_ATI(tPercentCPMBW), /* BAT_RES_TST_PERCENT_CPMBW = 0x67, */
262 RSP_ATI(tPercentCPMBW_W), /* BAT_RES_TST_PERCENT_CPMBW_W = 0x68, */
263 RSP_ATI(sPercentCPMB_W), /* BAT_RES_SET_PERCENT_CPMB_W = 0x69, */
264 RSP_ATI(sPlusCPMS), /* BAT_RES_SET_PLUS_CPMS = 0x6a, */
265 RSP_ATI(qPlusCPMS), /* BAT_RES_QUE_PLUS_CPMS = 0x6b, */
266 RSP_ATI(sPercentCPNUMS), /* BAT_RES_SET_PERCENT_CPNUMS = 0x6c, */
267 RSP_ATI(tPercentCPNUMS), /* BAT_RES_TST_PERCENT_CPNUMS = 0x6d, */
268 RSP_ATI(sPercentCPNUMS_W), /* BAT_RES_SET_PERCENT_CPNUMS_W = 0x6e, */
269 RSP_ATI(tPercentCPNUMS_W), /* BAT_RES_TST_PERCENT_CPNUMS_W = 0x6f, */
270 RSP_ATI(qPlusCPOL), /* BAT_RES_QUE_PLUS_CPOL = 0x70, */
271 RSP_ATI(tPlusCPOL), /* BAT_RES_TST_PLUS_CPOL = 0x71, */
272 RSP_ATI(qPlusCPOL_W), /* BAT_RES_QUE_PLUS_CPOL_W = 0x72, */
273 RSP_ATI(tPlusCPOL_W), /* BAT_RES_TST_PLUS_CPOL_W = 0x73, */
274 RSP_ATI(qPercentCPOPN), /* BAT_RES_QUE_PERCENT_CPOPN = 0x74, */
275 RSP_ATI(qPercentCPRSM), /* BAT_RES_QUE_PERCENT_CPRSM = 0x75, */
276 RSP_ATI(qPlusCPUC), /* BAT_RES_QUE_PLUS_CPUC = 0x76, */
277 RSP_ATI(qPlusCPUC_W), /* BAT_RES_QUE_PLUS_CPUC_W = 0x77, */
278 RSP_ATI(sPercentCPVWI), /* BAT_RES_SET_PERCENT_CPVWI = 0x78, */
279 RSP_ATI(qPercentCREG), /* BAT_RES_QUE_PERCENT_CREG = 0x79, */
280 RSP_ATI(tPlusCRES), /* BAT_RES_TST_PLUS_CRES = 0x7a, */
281 RSP_ATI(qPlusCRLP), /* BAT_RES_QUE_PLUS_CRLP = 0x7b, */
282 RSP_ATI(sPlusCRSM), /* BAT_RES_SET_PLUS_CRSM = 0x7c, */
283 RSP_ATI(tPlusCSAS), /* BAT_RES_TST_PLUS_CSAS = 0x7d, */
284 RSP_ATI(qPlusCSCA), /* BAT_RES_QUE_PLUS_CSCA = 0x7e, */
285 RSP_ATI(qPlusCSCB), /* BAT_RES_QUE_PLUS_CSCB = 0x7f, */
286 RSP_ATI(qPlusCSCS), /* BAT_RES_QUE_PLUS_CSCS = 0x80, */
287 RSP_ATI(sPlusCSIM), /* BAT_RES_SET_PLUS_CSIM = 0x81, */
288 RSP_ATI(qPlusCSMS), /* BAT_RES_QUE_PLUS_CSMS = 0x82, */
289 RSP_ATI(qPlusCSNS), /* BAT_RES_QUE_PLUS_CSNS = 0x83, */
290 RSP_ATI(qPercentCSQ), /* BAT_RES_QUE_PERCENT_CSQ = 0x84, */
291 RSP_ATI(sPlusCSQ), /* BAT_RES_SET_PLUS_CSQ = 0x85, */
292 RSP_ATI(qPlusCSTA), /* BAT_RES_QUE_PLUS_CSTA = 0x86, */
293 RSP_ATI(qPlusCSVM), /* BAT_RES_QUE_PLUS_CSVM = 0x87, */
294 RSP_ATI(qPercentCTTY), /* BAT_RES_QUE_PERCENT_CTTY = 0x88, */
295 RSP_ATI(qPlusCTZU), /* BAT_RES_QUE_PLUS_CTZU = 0x89, */
296 RSP_ATI(qPercentCUST), /* BAT_RES_QUE_PERCENT_CUST = 0x8a, */
297 RSP_ATI(qPercentDATA), /* BAT_RES_QUE_PERCENT_DATA = 0x8b, */
298 RSP_ATI(sPercentDINF), /* BAT_RES_SET_PERCENT_DINF = 0x8c, */
299 RSP_FAD(qPlusDS), /* BAT_RES_QUE_PLUS_DS = 0x8d, */
300 RSP_FAD(qPlusFAP), /* BAT_RES_QUE_PLUS_FAP = 0x8e, */
301 RSP_FAD(qPlusFBO), /* BAT_RES_QUE_PLUS_FBO = 0x8f, */
302 RSP_FAD(qPlusFBS), /* BAT_RES_QUE_PLUS_FBS = 0x90, */
303 RSP_FAD(qPlusFBU), /* BAT_RES_QUE_PLUS_FBU = 0x91, */
304 RSP_FAD(qPlusFCC), /* BAT_RES_QUE_PLUS_FCC = 0x92, */
305 RSP_FAD(qPlusFCLASS), /* BAT_RES_QUE_PLUS_FCLASS = 0x93, */
306 RSP_FAD(qPlusFCQ), /* BAT_RES_QUE_PLUS_FCQ = 0x94, */
307 RSP_FAD(qPlusFCR), /* BAT_RES_QUE_PLUS_FCR = 0x95, */
308 RSP_FAD(qPlusFCS), /* BAT_RES_QUE_PLUS_FCS = 0x96, */
309 RSP_FAD(qPlusFCT), /* BAT_RES_QUE_PLUS_FCT = 0x97, */
310 RSP_FAD(qPlusFEA), /* BAT_RES_QUE_PLUS_FEA = 0x98, */
311 RSP_FAD(qPlusFFC), /* BAT_RES_QUE_PLUS_FFC = 0x99, */
312 RSP_FAD(qPlusFHS), /* BAT_RES_QUE_PLUS_FHS = 0x9a, */
313 RSP_FAD(qPlusFIE), /* BAT_RES_QUE_PLUS_FIE = 0x9b, */
314 RSP_FAD(qPlusFIS), /* BAT_RES_QUE_PLUS_FIS = 0x9c, */
315 RSP_FAD(qPlusFIT), /* BAT_RES_QUE_PLUS_FIT = 0x9d, */
316 RSP_FAD(qPlusFLI), /* BAT_RES_QUE_PLUS_FLI = 0x9e, */
317 RSP_FAD(qPlusFLO), /* BAT_RES_QUE_PLUS_FLO = 0x9f, */
318 RSP_FAD(qPlusFLP), /* BAT_RES_QUE_PLUS_FLP = 0xa0, */
319 RSP_FAD(qPlusFMS), /* BAT_RES_QUE_PLUS_FMS = 0xa1, */
320 RSP_FAD(qPlusFNS), /* BAT_RES_QUE_PLUS_FNS = 0xa2, */
321 RSP_FAD(qPlusFPA), /* BAT_RES_QUE_PLUS_FPA = 0xa3, */
322 RSP_FAD(qPlusFPI), /* BAT_RES_QUE_PLUS_FPI = 0xa4, */
323 RSP_FAD(qPlusFPS), /* BAT_RES_QUE_PLUS_FPS = 0xa5, */
324 RSP_FAD(qPlusFPW), /* BAT_RES_QUE_PLUS_FPW = 0xa6, */
325 RSP_FAD(qPlusFRQ), /* BAT_RES_QUE_PLUS_FRQ = 0xa7, */
326 RSP_FAD(qPlusFSA), /* BAT_RES_QUE_PLUS_FSA = 0xa8, */
327 RSP_FAD(qPlusFSP), /* BAT_RES_QUE_PLUS_FSP = 0xa9, */
328 RSP_ATI(qPlusICF), /* BAT_RES_QUE_PLUS_ICF = 0xaa, */
329 RSP_ATI(qPlusIFC), /* BAT_RES_QUE_PLUS_IFC = 0xab, */
330 RSP_ATI(qPercentIMEI), /* BAT_RES_QUE_PERCENT_IMEI = 0xac, */
331 RSP_ATI(qPlusIPR), /* BAT_RES_QUE_PLUS_IPR = 0xad, */
332 RSP_ATI(qPercentPBCF), /* BAT_RES_QUE_PERCENT_PBCF = 0xae, */
333 RSP_ATI(qPercentPPP), /* BAT_RES_QUE_PERCENT_PPP = 0xaf, */
334 RSP_ATI(qPercentPVRF), /* BAT_RES_QUE_PERCENT_PVRF = 0xb0, */
335 RSP_ATI(qPercentRDL), /* BAT_RES_QUE_PERCENT_RDL = 0xb1, */
336 RSP_ATI(qPercentRDLB), /* BAT_RES_QUE_PERCENT_RDLB = 0xb2, */
337 RSP_STK(qPercentSATC), /* BAT_RES_QUE_PERCENT_SATC = 0xb3, */
338 RSP_STK(qPercentSATCC), /* BAT_RES_QUE_PERCENT_SATCC = 0xb4, */
339 RSP_STK(sPercentSATE), /* BAT_RES_SET_PERCENT_SATE = 0xb5, */
340 RSP_ATI(qPlusWS46), /* BAT_RES_QUE_PLUS_WS46 = 0xb6, */
341 RSP_ATI(qPlusCDIP), /* BAT_RES_QUE_PLUS_CDIP = 0xb7, */
342 RSP_ATI(sPercentCMGR), /* BAT_RES_SET_PERCENT_CMGR = 0xb8 ,*/
343 RSP_ATI(sPercentCMGL), /* BAT_RES_SET_PERCENT_CMGL = 0xb9, */
344 RSP_ATI(sPlusCGMI), /*BAT_RES_SET_PLUS_CGMI = 0xba, */
345 RSP_ATI(sPlusCGMM), /*BAT_RES_SET_PLUS_CGMM = 0xbb, */
346 RSP_ATI(sPlusCGMR), /*BAT_RES_SET_PLUS_CGMR = 0xbc, */
347 RSP_ATI(sPlusCGSN) /*BAT_RES_SET_PLUS_CGSN = 0xbd, */
348 };
349
350 static BATResponse UnsResponseTab[] =
351 {
352 RSP_ATI(uAtBusy), /* BAT_RES_UNS_AT_BUSY = 0x1000, */
353 RSP_ATI(uAtNoAnswer), /* BAT_RES_UNS_AT_NO_ANSWER = 0x1001, */
354 RSP_ATI(uPlusCBM), /* BAT_RES_UNS_PLUS_CBM = 0x1002, */
355 RSP_ATI(uPlusCBMI), /* BAT_RES_UNS_PLUS_CBMI = 0x1003, */
356 RSP_ATI(uPercentCCBS), /* BAT_RES_UNS_PERCENT_CCBS = 0x1004, */
357 RSP_ATI(uPlusCCCM), /* BAT_RES_UNS_PLUS_CCCM = 0x1005, */
358 RSP_ATI(uPercentCCCN), /* BAT_RES_UNS_PERCENT_CCCN = 0x1006, */
359 RSP_ATI(uPlusCCWA), /* BAT_RES_UNS_PLUS_CCWA = 0x1007, */
360 RSP_ATI(uPlusCCWA_W), /* BAT_RES_UNS_PLUS_CCWA_W = 0x1008, */
361 RSP_ATI(uPlusCCWE), /* BAT_RES_UNS_PLUS_CCWE = 0x1009, */
362 RSP_ATI(uPlusCDIP), /* BAT_RES_UNS_PLUS_CDIP = 0x100a, */
363 RSP_ATI(uPlusCDS), /* BAT_RES_UNS_PLUS_CDS = 0x100b, */
364 RSP_ATI(uPlusCCWV), /* BAT_RES_UNS_PLUS_CCWV = 0x100c, */
365 RSP_GPR(uPercentCGEV), /* BAT_RES_UNS_PERCENT_CGEV = 0x100d, */
366 RSP_GPR(uPlusCGEV), /* BAT_RES_UNS_PLUS_CGEV = 0x100e, */
367 RSP_GPR(uPercentCGREG), /* BAT_RES_UNS_PERCENT_CGREG = 0x100f, */
368 RSP_GPR(uPlusCGREG), /* BAT_RES_UNS_PLUS_CGREG = 0x1010, */
369 RSP_ATI(uPlusCLAE), /* BAT_RES_UNS_PLUS_CLAE = 0x1011, */
370 RSP_ATI(uPlusCLAV), /* BAT_RES_UNS_PLUS_CLAV = 0x1012, */
371 RSP_ATI(uPlusCLIP), /* BAT_RES_UNS_PLUS_CLIP = 0x1013, */
372 RSP_ATI(uPlusCLIP_W), /* BAT_RES_UNS_PLUS_CLIP_W = 0x1014, */
373 RSP_ATI(uPlusCMT), /* BAT_RES_UNS_PLUS_CMT = 0x1015, */
374 RSP_ATI(uPlusCMTI), /* BAT_RES_UNS_PLUS_CMTI = 0x1016, */
375 RSP_ATI(uPlusCMT_W), /* BAT_RES_UNS_PLUS_CMT_W = 0x1017, */
376 RSP_ATI(uPercentCNAP), /* BAT_RES_UNS_PERCENT_CNAP = 0x1018, */
377 RSP_ATI(uPlusCOLP), /* BAT_RES_UNS_PLUS_COLP = 0x1019, */
378 RSP_ATI(uPlusCOLP_W), /* BAT_RES_UNS_PLUS_COLP_W = 0x101a, */
379 RSP_ATI(uPercentCPI), /* BAT_RES_UNS_PERCENT_CPI = 0x101b, */
380 RSP_ATI(uPercentCPI_W), /* BAT_RES_UNS_PERCENT_CPI_W = 0x101c, */
381 RSP_ATI(uPercentCPRI), /* BAT_RES_UNS_PERCENT_CPRI = 0x101d, */
382 RSP_ATI(uPercentCPROAM), /* BAT_RES_UNS_PERCENT_CPROAM = 0x101e, */
383 RSP_ATI(uPercentCPVWI), /* BAT_RES_UNS_PERCENT_CPVWI = 0x101f, */
384 RSP_ATI(uPlusCR), /* BAT_RES_UNS_PLUS_CR = 0x1020, */
385 RSP_ATI(uPercentCREG), /* BAT_RES_UNS_PERCENT_CREG = 0x1021, */
386 RSP_ATI(uPlusCRING), /* BAT_RES_UNS_PLUS_CRING = 0x1022, */
387 RSP_ATI(uPercentCSQ), /* BAT_RES_UNS_PERCENT_CSQ = 0x1023, */
388 RSP_ATI(uPlusCSSI), /* BAT_RES_UNS_PLUS_CSSI = 0x1024, */
389 RSP_ATI(uPercentCSSN), /* BAT_RES_UNS_PERCENT_CSSN = 0x1025, */
390 RSP_ATI(uPlusCSSU), /* BAT_RES_UNS_PLUS_CSSU = 0x1026, */
391 RSP_ATI(uPercentCSTAT), /* BAT_RES_UNS_PERCENT_CSTAT = 0x1027, */
392 RSP_ATI(uPercentCTYI), /* BAT_RES_UNS_PERCENT_CTYI = 0x1028, */
393 RSP_ATI(uPlusCTZR), /* BAT_RES_UNS_PLUS_CTZR = 0x1029, */
394 RSP_ATI(uPercentCTZV), /* BAT_RES_UNS_PERCENT_CTZV = 0x102a, */
395 RSP_ATI(uPlusCTZV), /* BAT_RES_UNS_PLUS_CTZV = 0x102b, */
396 RSP_ATI(uPercentCTZV_W), /* BAT_RES_UNS_PERCENT_CTZV_W = 0x102c, */
397 RSP_ATI(uPlusCUSD), /* BAT_RES_UNS_PLUS_CUSD = 0x102d, */
398 RSP_ATI(uPlusCUSD_W), /* BAT_RES_UNS_PLUS_CUSD_W = 0x102e, */
399 RSP_ATI(uAtNoCarrier), /* BAT_RES_UNS_AT_NO_CARRIER = 0x102f, */
400 RSP_ATI(uPlusFHS), /* BAT_RES_UNS_PLUS_FHS = 0x1030, */
401 RSP_ATI(uPlusILRR), /* BAT_RES_UNS_PLUS_ILRR = 0x1031, */
402 RSP_ATI(uPercentRDL), /* BAT_RES_UNS_PERCENT_RDL = 0x1032, */
403 RSP_ATI(uPercentRDLB), /* BAT_RES_UNS_PERCENT_RDLB = 0x1033, */
404 RSP_STK(uPercentSATA), /* BAT_RES_UNS_PERCENT_SATA = 0x1034, */
405 RSP_STK(uPercentSATI), /* BAT_RES_UNS_PERCENT_SATI = 0x1035, */
406 RSP_STK(uPercentSATN), /* BAT_RES_UNS_PERCENT_SATN = 0x1036, */
407 RSP_ATI(uPercentSIMEF), /* BAT_RES_UNS_PERCENT_SIMEF = 0x1037, */
408 RSP_ATI(uPercentSIMINS), /* BAT_RES_UNS_PERCENT_SIMINS = 0x1038, */
409 RSP_ATI(uPercentSIMREM), /* BAT_RES_UNS_PERCENT_SIMREM = 0x1039, */
410 RSP_ATI(uPercentSNCNT) /* BAT_RES_UNS_PERCENT_SNCNT = 0x103a, */
411 };
412
413 void ati_bat_inst_sig_cb(T_BAT_signal signal);
414 #ifdef _SIMULATION_
415 int ati_bat_resp_cb_simulation (T_BAT_client client, T_BAT_cmd_response *response);
416 int ati_bat_uns_resp_cb_simulation (T_BAT_client client, T_BAT_cmd_response *response);
417 LOCAL BOOL asynch_resp = FALSE;
418 #endif
419 int ati_bat_resp_cb (T_BAT_client client, T_BAT_cmd_response *response);
420 int ati_bat_uns_resp_cb(T_BAT_client client, T_BAT_cmd_response *response);
421
422 void ati_bat_sig_cb (T_BAT_client client, T_BAT_signal signal);
423
424 /* ========================================================================================== */
425
426
427 /* Get PSI Source Info */
428 void Get_psi_src_info(T_ACI_DTI_PRC_PSI **psi_src_info)
429 {
430 /* Use the function 'find_element()' to search for the PSI
431 source that has the correct command source ID. */
432
433 *psi_src_info=find_element(psi_src_params,srcId_cb,cmhPSItest_srcId);
434 }
435
436 /* Some ATI maintenance is needed for BAT */
437
438 void Perform_ati_bat_maint(UBYTE srcId)
439 {
440 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
441
442 src_params->curAtCmd = AT_CMD_NONE;
443 ledit_ctrl (srcId,LEDIT_CTRL_CMPL, NULL);
444 src_params->cmd_state = CMD_IDLE;
445 cmdErrStr = NULL;
446
447 #ifdef _SIMULATION_
448 asynch_resp = FALSE;
449 #endif
450 }
451
452 /* BAT instance_signal_cb */
453 void ati_bat_inst_sig_cb(T_BAT_signal signal)
454 {
455 TRACE_FUNCTION ("ati_bat_inst_sig_cb ()");
456
457 /* Result tells application if instance is successfully created/deleted */
458 }
459
460 #ifdef _SIMULATION_
461 /* this function is called by sig_dti_data_received_ind() */
462 void ati_bat_response_simulation(T_ACI_BAT_RES *res)
463 {
464 TRACE_EVENT("ati_bat_response_simulation(): simulation of asynchronous response");
465 if (BITFIELD_CHECK(res->response->ctrl_response, BAT_BIT_12) || /* 0x1000 */
466 res->response->ctrl_response EQ BAT_RES_UNS_PLUS_CRING ||
467 res->response->ctrl_response EQ BAT_RES_UNS_PLUS_CCWV)
468 {
469 ati_bat_uns_resp_cb(res->client, res->response);
470 }
471 else
472 {
473 ati_bat_resp_cb(res->client, res->response);
474 }
475 if (asynch_resp EQ FALSE)
476 {
477 res->response = NULL;
478 }
479 }
480
481 int ati_bat_resp_cb_simulation (T_BAT_client client, T_BAT_cmd_response *response)
482 {
483 T_ACI_DTI_PRC_PSI *psi_src_info=find_element(psi_src_params,srcId_cb,cmhPSItest_srcId);
484 psi_src_info->res.client = client;
485 psi_src_info->res.response = response;
486 if (psi_src_info->bat_client[psi_src_info->active_client].curCmd EQ (T_BAT_ctrl_params)-1)
487 {
488 ati_bat_resp_cb(client,response);
489 }
490 else
491 {
492 ati_bat_resp_cb(client,response);
493 // TRACE_EVENT("ati_bat_resp_cb_simulation(): prepare simulation of asynchronous response");
494 // asynch_resp = TRUE;
495 }
496 return 0;
497 }
498
499 int ati_bat_uns_resp_cb_simulation (T_BAT_client client, T_BAT_cmd_response *response)
500 {
501 T_ACI_DTI_PRC_PSI *psi_src_info=find_element(psi_src_params,srcId_cb,cmhPSItest_srcId);
502 psi_src_info->res.client = client;
503 psi_src_info->res.response = response;
504 if (psi_src_info->bat_client[psi_src_info->active_client].curCmd EQ (T_BAT_ctrl_params)-1)
505 {
506 ati_bat_uns_resp_cb(client,response);
507 }
508 else
509 {
510 ati_bat_uns_resp_cb(client,response);
511 // TRACE_EVENT("ati_bat_uns_resp_cb_simulation(): prepare simulation of asynchronous response");
512 // asynch_resp = TRUE;
513 }
514 return 0;
515 }
516 #endif _SIMULATION_
517
518 /* BAT unsolicited_result_cb */
519 int ati_bat_uns_resp_cb (T_BAT_client client, T_BAT_cmd_response *response)
520 {
521 int ret = 0;
522 T_ACI_DTI_PRC_PSI *psi_src_info;
523 U16 index = 0;
524
525 TRACE_FUNCTION ("ati_bat_uns_resp_cb ()");
526
527 Get_psi_src_info(&psi_src_info);
528
529 if (psi_src_info)
530 {
531 if (response)
532 {
533 T_BAT_cmd_response *resp_p = response;
534
535 if (resp_p->ctrl_response EQ BAT_RES_UNS_PLUS_CRING || /* Cases where Ids < 0x1000 */
536 resp_p->ctrl_response EQ BAT_RES_UNS_PLUS_CCWV)
537 {
538 index = (U16)resp_p->ctrl_response;
539
540 if (ResponseTab[index].fptr)
541 {
542 ret = ResponseTab[index].fptr(psi_src_info, resp_p);
543 }
544 else
545 {
546 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
547 }
548 }
549 else /* Cases where Ids >= 0x1000 */
550 {
551 index = ((U16)resp_p->ctrl_response - BAT_BIT_12);
552
553 if (UnsResponseTab[index].fptr)
554 {
555 ret = UnsResponseTab[index].fptr(psi_src_info, resp_p);
556 }
557 else
558 {
559 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
560 }
561 }
562 }
563
564 #ifdef _SIMULATION_
565 if (asynch_resp EQ FALSE)
566 #endif
567 Perform_ati_bat_maint(psi_src_info->srcId);
568 }
569 return 0;
570 }
571
572 /* BAT response_cb */
573 int ati_bat_resp_cb (T_BAT_client client, T_BAT_cmd_response *response)
574 {
575 int ret = 0;
576 T_ACI_DTI_PRC_PSI *psi_src_info;
577 U16 index;
578
579 TRACE_FUNCTION ("ati_bat_resp_cb()");
580
581 Get_psi_src_info(&psi_src_info);
582
583 if (psi_src_info)
584 {
585 /* Check if response is complete */
586 if (response)
587 {
588 T_BAT_cmd_response *resp_p = response;
589
590 index = (U16)resp_p->ctrl_response;
591 TRACE_EVENT_P1("ati_bat_resp_cb(): resp_p->ctrl_response = 0x%04X", resp_p->ctrl_response);
592 if (ResponseTab[index].fptr)
593 {
594 ret = ResponseTab[index].fptr(psi_src_info, resp_p);
595 }
596 else
597 {
598 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
599 }
600 }
601 #ifdef _SIMULATION_
602 if (asynch_resp EQ FALSE)
603 #endif
604 Perform_ati_bat_maint(psi_src_info->srcId);
605 }
606 return 0; /* Ok for now */
607 }
608
609
610 /* BAT signal_cb */
611 void ati_bat_sig_cb(T_BAT_client client, T_BAT_signal signal)
612 {
613 TRACE_FUNCTION ("ati_bat_sig_cb ()");
614 }
615
616
617 GLOBAL void ati_bat_lib_init (U8 src_id)
618 {
619 U8 num_instances = ATI_BAT_MAX_INSTANCES;
620 U8 *mem;
621
622 /* allocate memory for maintaining the instances */
623 ACI_MALLOC(mem, num_instances * BAT_INSTANCE_HEADER_SIZE);
624
625 if (0 != bat_init (mem, num_instances))
626 {
627 TRACE_ERROR("bat_init failure");
628 return;
629 }
630 ati_bat_globs.bat_lib_initialized = TRUE;
631
632 if (GDD_OK != gdd_aci_func.gdd_init(src_id, 0, CMD_SRC_MAX))
633 {
634 TRACE_ERROR("gdd_aci_init failure");
635 return;
636 }
637 }
638
639 /* because the ATI src_id is the only identifier, we create for every ATI source
640 a BAT Lib instance, but with only one client */
641 GLOBAL void ati_bat_lib_new (U8 src_id, T_ATI_SRC_TYPE src_type)
642 {
643 T_GDD_SIGNAL signal = {GDD_SIGTYPE_SEND_BUF_AVAILABLE};
644 U8 num_clients = ATI_BAT_MAX_CLIENTS;
645 U8 *mem;
646
647 T_ACI_DTI_PRC_PSI *cmd_struct;
648
649
650 if (src_type NEQ ATI_SRC_TYPE_PSI)
651 {
652 /* because BAT has been designed for PSI connections only, we must fake one.
653 in the real life psi_new_source() creates such a thing */
654 ACI_MALLOC(cmd_struct, sizeof(T_ACI_DTI_PRC_PSI));
655
656 psi_InitCmdStruct(cmd_struct);
657
658 cmd_struct->srcId = src_id;
659 cmd_struct->devId = 0xBACDBACD; /* to distinguish from DIO_DATA_PKT used in acibat_test suite */
660 cmd_struct->dlci = 0;
661
662 if (insert_list (psi_src_params, cmd_struct) NEQ TRUE)
663 {
664 TRACE_ERROR ("ati_bat_open_client(): failed to create PSI source");
665 return;
666 }
667 }
668
669 aci_cmd_src_mode_set(src_id,CMD_MODE_BAT);
670 ati_bat_globs.instance[src_id].src_type = src_type;
671 gdd_aci_remember_src_id(src_id);
672
673 /* allocate memory for maintaining the clients in the instance */
674 ACI_MALLOC(mem, BAT_INSTANCE_SIZE + (num_clients * BAT_CLIENT_SIZE));
675
676 if ((bat_new(&(ati_bat_globs.instance[src_id].inst_hndl),
677 mem,
678 num_clients,
679 &(ati_bat_globs.config),
680 ati_bat_inst_sig_cb)) NEQ 0)
681 {
682 TRACE_ERROR("bat_new failure");
683 return;
684 }
685
686 /* simulate an asynch response from GDD to BAT Lib to tell BAT Lib that GDD has an open channel */
687 signal.sig = GDD_SIGTYPE_SEND_BUF_AVAILABLE;
688 bat_gdd_signal_cb(gdd_aci_get_con_handle(src_id), signal);
689 }
690
691
692 GLOBAL void ati_bat_lib_finit (void)
693 {
694 int i = 0;
695 if (ati_bat_globs.bat_lib_initialized)
696 {
697 for (i=0; i<ATI_BAT_MAX_INSTANCES; i++)
698 {
699 if (ati_bat_globs.instance[i].src_type NEQ ATI_SRC_TYPE_UNKNOWN)
700 {
701 if (aci_cmd_src_mode_get(i) EQ CMD_MODE_BAT)
702 {
703 bat_delete(ati_bat_globs.instance[i].inst_hndl);
704 }
705 ati_bat_globs.instance[i].client_id[0]= 0xFF;
706 ati_bat_globs.instance[i].uns_client_id = 0xFF;
707 ati_bat_globs.instance[i].src_type = ATI_SRC_TYPE_UNKNOWN;
708 }
709 }
710 bat_deinit();
711 ati_bat_globs.bat_lib_initialized = FALSE;
712 }
713 }
714
715
716 GLOBAL void ati_bat_open_client (U8 src_id)
717 {
718 T_ACI_DTI_PRC_PSI *src_infos_psi;
719
720 src_infos_psi = find_element (psi_src_params, src_id, cmhPSItest_srcId);
721
722 if (src_infos_psi EQ NULL)
723 {
724 TRACE_ERROR ("ati_bat_open_client(): failed to get PSI source");
725 return;
726 }
727
728 aci_cmd_src_mode_set(src_id,CMD_MODE_BAT);
729
730 /* all ATI sources use the same response callback */
731 if ((bat_open(ati_bat_globs.instance[src_id].inst_hndl,
732 &(ati_bat_globs.instance[src_id].client_id[0]),
733 #ifdef _SIMULATION_
734 ati_bat_resp_cb_simulation,
735 #else
736 ati_bat_resp_cb,
737 #endif
738 ati_bat_sig_cb)) NEQ 0)
739 {
740 TRACE_ERROR("bat_open failure");
741 return;
742 }
743 /* all ATI sources use the same unsolicited response callback */
744 if ((bat_uns_open(ati_bat_globs.instance[src_id].inst_hndl,
745 &(ati_bat_globs.instance[src_id].uns_client_id),
746 #ifdef _SIMULATION_
747 ati_bat_uns_resp_cb_simulation)) NEQ 0)
748 #else
749 ati_bat_uns_resp_cb)) NEQ 0)
750 #endif
751
752 {
753 TRACE_ERROR("bat_uns_open failure");
754 return;
755 }
756 }
757
758
759 GLOBAL U16 ati_bat_get_client (U8 src_id)
760 {
761 /* currently we have only one client per instance, else need a mux_src_id */
762 if (ati_bat_globs.instance[src_id].client_id[0] NEQ 0xFF)
763 {
764 return (ati_bat_globs.instance[src_id].client_id[0]);
765 }
766 TRACE_ERROR("ati_bat_get_client(): no BAT client");
767 return (0xFF);
768 }
769
770
771 GLOBAL void ati_bat_close_client (U8 src_id)
772 {
773 if (ati_bat_globs.bat_lib_initialized)
774 {
775 /* currently we have only one client per instance, else need a mux_src_id */
776 if (ati_bat_globs.instance[src_id].client_id[0] NEQ 0xFF)
777 {
778 bat_close(ati_bat_globs.instance[src_id].client_id[0]);
779 ati_bat_globs.instance[src_id].client_id[0] = 0xFF;
780 }
781 }
782 }
783
784
785 GLOBAL BOOL ati_bat_all_clients_closed (void)
786 {
787 int i,k;
788 for (i=0; i<ATI_BAT_MAX_INSTANCES; i++)
789 {
790 for (k=0; k<ATI_BAT_MAX_CLIENTS; k++)
791 {
792 if (ati_bat_globs.instance[i].client_id[k] NEQ 0xFF)
793 {
794 return (FALSE);
795 }
796 }
797 }
798 return (TRUE);
799 }
800
801
802 GLOBAL void ati_bat_reset (void)
803 {
804 int i,k;
805
806 for (i=0; i<ATI_BAT_MAX_INSTANCES; i++)
807 {
808 ati_bat_globs.instance[i].src_type = ATI_SRC_TYPE_UNKNOWN;
809 ati_bat_globs.instance[i].uns_client_id = 0xFF;
810 for (k=0; k<ATI_BAT_MAX_CLIENTS; k++)
811 {
812 ati_bat_globs.instance[i].client_id[k] = 0xFF;
813 }
814 }
815
816 ati_bat_globs.bat_lib_initialized = FALSE;
817 ati_bat_globs.config.adapter.gdd_if = gdd_aci_func;
818 ati_bat_globs.config.adapter.cap.dio_cap.mtu_size = 300; /*GDD_DIO_MTU_SIZE*/
819 ati_bat_globs.config.device = DEVICE_PACKET;
820 ati_bat_globs.config.l2p.protocol_id = L2P_SP_PSI;
821 }
822
823
824 /***************************************************************************/
825 /* Response Function Definitions Start Here */
826 /***************************************************************************/
827
828 int Resp_AtOk (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
829 {
830 TRACE_FUNCTION ("Resp_AtOk ()");
831
832 /*
833 * If we have been receiving COPS responses, this OK signals
834 * the end of them, so clear the flag.
835 */
836 cops_flag=FALSE;
837 CLCC_flag=FALSE;
838
839 if (clan_buf)
840 {
841 io_sendMessage(srcId_cb,g_sa,ATI_NORMAL_OUTPUT);
842 clan_buf=NULL;
843 }
844
845 #ifdef _SIMULATION_
846 {
847 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_infos_psi->srcId, search_ati_src_id);
848 T_ACI_AT_CMD cmdId = src_params->curAtCmd;
849 if (ledit_ctrl(src_params->src_id,LEDIT_CTRL_MORE_CMDS, NULL) EQ LEDIT_CMPL)
850 {
851 rCI_OK(cmdId);
852
853 return 0;
854 }
855 }
856 #endif
857
858 io_sendConfirm(src_infos_psi->srcId, cmdAtError(atOk), ATI_NORMAL_OUTPUT);
859
860 Perform_ati_bat_maint(src_infos_psi->srcId);
861
862 return 0; /* Ok */
863 }
864
865 int Resp_AtConnect(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
866 {
867 T_ACI_BS_SPEED speed;
868 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_infos_psi->srcId, search_ati_src_id);
869
870 TRACE_FUNCTION ("Resp_AtConnect()");
871 /*
872 * We're in trouble if we don't have 'src_params', as we need
873 * to know the command ID.
874 */
875 if (src_params==NULL)
876 {
877 TRACE_EVENT("No src_params in CONNECT.");
878 return 1; /* Indicate error */
879 }
880
881 /*
882 * rCI_CONNECT() only cares about the speed, not the rate adaption /
883 * modulation type.
884 */
885 switch(resp_p->response.ptr_at_connect->data_rate)
886 {
887 default:
888 case BAT_AT_CONNECT_RATE_NOT_PRESENT: speed=BS_SPEED_NotPresent; break;
889 case BAT_AT_CONNECT_RATE_300: speed=BS_SPEED_300_V110; break;
890 case BAT_AT_CONNECT_RATE_1200: speed=BS_SPEED_1200_V110; break;
891 case BAT_AT_CONNECT_RATE_2400: speed=BS_SPEED_2400_V110; break;
892 case BAT_AT_CONNECT_RATE_4800: speed=BS_SPEED_4800_V110; break;
893 case BAT_AT_CONNECT_RATE_9600: speed=BS_SPEED_9600_V110; break;
894 case BAT_AT_CONNECT_RATE_14400: speed=BS_SPEED_14400_V110; break;
895 case BAT_AT_CONNECT_RATE_19200: speed=BS_SPEED_19200_V110; break;
896 case BAT_AT_CONNECT_RATE_38400: speed=BS_SPEED_38400_V110; break;
897 }
898
899 /*
900 * BAT does not provide the call ID, the current command or the
901 * flow control flag. rCI_CONNECT() doesn't care about the call ID,
902 * so we can set that to 0. I'm not sure about flow control, setting
903 * it to FALSE seems safest.
904 */
905 rCI_CONNECT(src_params->curAtCmd,speed,0,FALSE);
906 return 0; /* Ok */
907 }
908
909 int Resp_AtNoCarrierFinal(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
910 {
911 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_infos_psi->srcId, search_ati_src_id);
912 TRACE_FUNCTION ("Resp_AtNoCarrierFinal()");
913
914 /*
915 * We're in trouble if we don't have 'src_params', as we need
916 * to know the command ID.
917 */
918 if (src_params==NULL)
919 {
920 TRACE_EVENT("No src_params in NO_CARRIER_FINAL.");
921 return 1; /* Indicate error */
922 }
923
924 /*
925 * BAT does not provide the call ID or the current command.
926 * rCI_NO_CARRIER() doesn't care about the call ID,
927 * so we can set that to 0.
928 */
929 rCI_NO_CARRIER(src_params->curAtCmd,0);
930 return 0; /* Ok */
931 }
932
933 int Resp_PlusCmeError(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
934 {
935 TRACE_FUNCTION ("Resp_PlusCmeError()");
936
937 io_sendConfirm(src_infos_psi->srcId,
938 cmdCmeError(resp_p->response.ptr_plus_cme_error->error),
939 ATI_ERROR_OUTPUT);
940
941 return 0; /* Ok */
942 }
943
944 int Resp_PlusCmsError(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
945 {
946 TRACE_FUNCTION ("Resp_PlusCmsError()");
947
948 io_sendConfirm(src_infos_psi->srcId,
949 cmdCmsError(resp_p->response.ptr_plus_cms_error->err),
950 ATI_ERROR_OUTPUT);
951
952 return 0; /* Ok */
953 }
954
955 int Resp_AtBusy(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
956 {
957 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_infos_psi->srcId, search_ati_src_id);
958 TRACE_FUNCTION ("Resp_AtBusy()");
959 /*
960 * We're in trouble if we don't have 'src_params', as we need
961 * to know the command ID.
962 */
963 if (src_params==NULL)
964 {
965 TRACE_EVENT("No src_params in BUSY.");
966 return 1; /* Indicate error */
967 }
968
969 /*
970 * BAT does not provide the call ID or the current command.
971 * rCI_BUSY() doesn't care about the call ID,
972 * so we can set that to -1 safely.
973 */
974 rCI_BUSY(src_params->curAtCmd,-1);
975 return 0; /* Ok */
976 }
977
978 int Resp_AtNoAnswer(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
979 {
980 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_infos_psi->srcId, search_ati_src_id);
981 TRACE_FUNCTION ("Resp_AtNoAnswer()");
982
983 /*
984 * We're in trouble if we don't have 'src_params', as we need
985 * to know the command ID.
986 */
987 if (src_params==NULL)
988 {
989 TRACE_EVENT("No src_params in NO_ANSWER.");
990 return 1; /* Indicate error */
991 }
992
993 /*
994 * BAT does not provide the call ID or the current command.
995 * rCI_NO_ANSWER() doesn't care about the call ID,
996 * so we can set that to -1 safely.
997 */
998 rCI_NO_ANSWER(src_params->curAtCmd,-1);
999
1000 return 0; /* Ok */
1001 }
1002
1003 int Resp_AtChannelBusy(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1004 {
1005 }
1006
1007
1008 int Resp_uAtNoCarrier(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1009 {
1010 TRACE_FUNCTION ("Resp_uAtNoCarrier()");
1011
1012 return 0; /* Ok */
1013 }
1014
1015 int Resp_uPlusCRING(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1016 {
1017 T_ACI_CRING_MOD mode;
1018 T_ACI_CRING_TYP type1;
1019 T_ACI_CRING_TYP type2;
1020 T_BAT_res_uns_plus_cring *cring;
1021
1022 TRACE_FUNCTION ("Resp_uPlusCRING()");
1023 /*
1024 * Get a pointer to the CRING structure for convenience.
1025 */
1026 cring=resp_p->response.ptr_plus_cring;
1027
1028 /*
1029 * This relies on T_ACI_CRING_TYP being the same as
1030 * T_BAT_cring_type/T_BAT_plus_cring_type2.
1031 */
1032 type1=(T_ACI_CRING_TYP)cring->type1;
1033 type2=(T_ACI_CRING_TYP)cring->type2;
1034
1035 /*
1036 * This relies on T_ACI_CRING_MOD being the same as
1037 * T_BAT_plus_cring_alt.
1038 */
1039 mode=(T_ACI_CRING_MOD)cring->alt;
1040
1041 rCI_PlusCRING(mode,type1,type2);
1042 return 0; /* Ok */
1043 }
1044
1045 int Resp_uPlusCCWV(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1046 {
1047 TRACE_FUNCTION ("Resp_uPlusCCWV() ");
1048
1049 rCI_PlusCCWV((T_ACI_CCWV_CHRG)resp_p->response.ptr_plus_ccwv->bat_dummy );
1050
1051 return 0; /* Ok */
1052 }
1053
1054 int Resp_qPercentALS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1055 {
1056 TRACE_FUNCTION ("Resp_qPercentALS() ");
1057
1058 resp_disp((UBYTE)src_infos_psi->srcId, NULL,"b",resp_p->response.ptr_que_percent_als->mode);
1059 return 0; /* Ok */
1060 }
1061
1062 int Resp_tPercentALS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1063 {
1064 char *me = "%ALS";
1065 TRACE_FUNCTION ("Resp_tPercentALS() ");
1066
1067 if (resp_p->response.ptr_tst_percent_als->mode EQ BAT_P_ALS_MOD_SPEECH)
1068 sprintf(g_sa,"%s: (0)", me);
1069 if (resp_p->response.ptr_tst_percent_als->mode EQ BAT_P_ALS_MOD_AUX_SPEECH)
1070 sprintf(g_sa,"%s: (1)", me);
1071 if (resp_p->response.ptr_tst_percent_als->mode EQ (BAT_P_ALS_MOD_SPEECH | BAT_P_ALS_MOD_AUX_SPEECH))
1072 sprintf(g_sa,"%s: (0,1)", me);
1073 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1074
1075 return 0; /* Ok */
1076 }
1077
1078 int Resp_qPercentATR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1079 {
1080 T_BAT_res_que_percent_atr *atr;
1081 UBYTE i;
1082 TRACE_FUNCTION ("Resp_qPercentATR()");
1083
1084 atr=resp_p->response.ptr_que_percent_atr;
1085 i=sprintf(g_sa,"%s%d,","%ATR: ",atr->phase);
1086 utl_binToHex(atr->atr,atr->c_atr,g_sa+i);
1087 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1088 return 0; /* Ok */
1089 }
1090
1091 int Resp_qPercentBAND(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1092 {
1093 T_BAT_res_que_percent_band band;
1094 TRACE_FUNCTION ("Resp_qPercentBAND()");
1095
1096 band= *(resp_p->response.ptr_que_percent_band);
1097 if( band.band EQ 0x00 OR band.mode EQ BAND_MODE_Auto )
1098 {
1099 sprintf(g_sa, "%s: %d", "%BAND", band.mode);
1100 }
1101 else
1102 {
1103 sprintf(g_sa, "%s: %d,%d", "%BAND", band.mode, band.band);
1104 }
1105 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1106 return 0; /* Ok */
1107 }
1108
1109 int Resp_tPercentBAND(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1110 {
1111 UBYTE c_set_bit = 0;
1112 USHORT pos = 0;
1113 UBYTE i, tested_filter_byte, highest_set_bit_only=0;
1114
1115 TRACE_FUNCTION ("Resp_tPercentBAND() ");
1116
1117 /* initialization of the string */
1118 pos += sprintf(g_sa, "%s: (0-%d)", "%BAND", resp_p->response.ptr_tst_percent_band->mode);
1119 pos += sprintf( g_sa+pos, ",(" );
1120
1121 if(resp_p->response.ptr_tst_percent_band->band EQ 0x00)
1122 {
1123 /* no particular settings from manufacturer */
1124 pos += sprintf( g_sa+pos, "1-%d)", HIGHEST_BAND_SUPPORTED );
1125 }
1126 else
1127 {
1128 /* search holes between highest bit and lowest bit */
1129 for( i=0; i<8 ; i++ )
1130 {
1131 tested_filter_byte = 0x01 << i;
1132
1133 if( (resp_p->response.ptr_tst_percent_band->band & tested_filter_byte) )
1134 {
1135 highest_set_bit_only = tested_filter_byte;
1136 c_set_bit++;
1137 }
1138 }
1139
1140 if(c_set_bit) /* alignment at the end */
1141 {
1142 c_set_bit--;
1143 }
1144
1145 if( highest_set_bit_only EQ (0x01 << c_set_bit) )
1146 {
1147 /* there is no hole in the supported values, form 1 to max_value */
1148 pos += sprintf( g_sa+pos, "1-%d)", resp_p->response.ptr_tst_percent_band->band);
1149 }
1150 else
1151 {
1152 for(i=1 ; i<=resp_p->response.ptr_tst_percent_band->band; i++) /* bands_bitfield is obviously the highest possible value */
1153 {
1154 if( (i & resp_p->response.ptr_tst_percent_band->band) EQ i )
1155 {
1156 pos += sprintf( g_sa+pos, "%d,", i);
1157 }
1158 if(pos>MAX_CMD_LEN-5) /* -5 to have some buffer */
1159 {
1160 TRACE_EVENT("output buffer is too short !!!");
1161 break;
1162 }
1163 }
1164 pos--; /* erase last comma */
1165 sprintf( g_sa+pos, ")");
1166 }
1167 }
1168
1169 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1170
1171 return 0; /* Ok */
1172 }
1173
1174 int Resp_qPlusCACM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1175 {
1176 LONG acm = 0L;
1177 TRACE_FUNCTION ("Resp_qPlusCACM()");
1178
1179 acm=resp_p->response.ptr_que_plus_cacm->acm;
1180 sprintf(g_sa,"+CACM: \"%06X\"", acm);
1181 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1182 return 0; /* Ok */
1183 }
1184
1185 int Resp_qPlusCAMM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1186 {
1187 LONG acmmax = 0L;
1188 TRACE_FUNCTION ("Resp_qPlusCAMM()");
1189
1190 acmmax=resp_p->response.ptr_que_plus_camm->acmmax;
1191 sprintf (g_sa,"+CAMM: \"%06X\"", acmmax);
1192 io_sendMessage ((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1193 return 0; /* Ok */
1194 }
1195
1196 int Resp_sPlusCAOC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1197 {
1198 LONG ccm = 0L;
1199 TRACE_FUNCTION ("Resp_sPlusCAOC() ");
1200 ccm=resp_p->response.ptr_set_plus_caoc->ccm;
1201 sprintf (g_sa,"+CAOC: \"%06X\"", ccm);
1202 io_sendMessage ((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1203
1204 return 0; /* Ok */
1205 }
1206
1207 int Resp_sPlusCBC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1208 {
1209 TRACE_FUNCTION ("Resp_sPlusCBC()");
1210
1211 sprintf(g_sa, "+CBC: %d,%d",resp_p->response.ptr_set_plus_cbc->bsc, resp_p->response.ptr_set_plus_cbc->bcl );
1212 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1213 return 0; /* Ok */
1214 }
1215
1216 int Resp_qPercentCBHZ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1217 {
1218 TRACE_FUNCTION ("Resp_qPercentCBHZ() Not Implemented");
1219
1220 return 0; /* Ok */
1221 }
1222
1223 int Resp_tPercentCBHZ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1224 {
1225 TRACE_FUNCTION ("Resp_tPercentCBHZ() Not Implemented");
1226
1227 return 0; /* Ok */
1228 }
1229
1230 int Resp_qPlusCBST(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1231 {
1232 TRACE_FUNCTION ("Resp_qPlusCBST()");
1233 resp_disp((UBYTE)src_infos_psi->srcId, NULL,"eee",&resp_p->response.ptr_que_plus_cbst->speed,
1234 &resp_p->response.ptr_que_plus_cbst->name,&resp_p->response.ptr_que_plus_cbst->ce);
1235 return 0; /* Ok */
1236 }
1237
1238 int Resp_qPercentCCBS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1239 {
1240 T_ACI_CCBS_IND ind;
1241 T_ACI_CCBS_STAT status;
1242 T_ACI_CCBS_SET setting;
1243 T_BAT_res_que_percent_ccbs *ccbs;
1244 TRACE_FUNCTION ("Resp_qPercentCCBS()");
1245 /*
1246 * Get a pointer to the CCBS structure for convenience.
1247 */
1248 ccbs=resp_p->response.ptr_que_percent_ccbs;
1249
1250 /*
1251 * This relies on T_ACI_CCBS_IND being identical to
1252 * T_BAT_percent_ccbs_ind and T_ACI_CCBS_STAT being identical
1253 * to T_BAT_percent_ccbs_stat.
1254 */
1255 ind=(T_ACI_CCBS_IND)ccbs->ind;
1256 status=(T_ACI_CCBS_STAT)ccbs->stat;
1257
1258 /*
1259 * The main reason for zeroing this memory is to ensure we
1260 * end up with zero-terminated 'number' and 'subaddress'
1261 * strings.
1262 */
1263 memset(&setting,0,sizeof(T_ACI_CCBS_SET));
1264
1265 setting.idx=(SHORT)ccbs->idx;
1266
1267 if ((ccbs->v_number==TRUE) && (ccbs->c_number<MAX_B_SUBSCR_NUM_LEN))
1268 memcpy(setting.number,ccbs->number,ccbs->c_number);
1269
1270 setting.type=toa_demerge((SHORT)ccbs->type);
1271
1272 if ((ccbs->v_subaddr==TRUE) && (ccbs->c_subaddr<MAX_SUBADDR_LEN))
1273 memcpy(setting.subaddr,ccbs->subaddr,ccbs->c_subaddr);
1274
1275 setting.satype=tos_demerge((SHORT)ccbs->satype);
1276
1277 /*
1278 * This relies on T_ACI_CLASS being identical to T_BAT_bearer_class
1279 * and T_ACI_ALRT_PATTERN being identical to T_BAT_percent_ccbs_ptn.
1280 */
1281 setting.class_type=(T_ACI_CLASS)ccbs->bearer_class;
1282 setting.alrtPtn=(T_ACI_ALRT_PTRN)ccbs->ptn;
1283
1284 rCI_PercentCCBS(ind,status,&setting,TRUE);
1285
1286 return 0; /* Ok */
1287 }
1288
1289 int Resp_sPlusCCFC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1290 {
1291 T_ACI_CCFC_SET setting = {0}, *set_p = &setting;
1292
1293 TRACE_FUNCTION ("Resp_sPlusCCFC()");
1294
1295 /* Load from BAT response structure before calling rCI_... */
1296 set_p->clsstat.status = (T_ACI_STATUS)resp_p->response.ptr_set_plus_ccfc->status;
1297 set_p->clsstat.class_type = (T_ACI_CLASS)resp_p->response.ptr_set_plus_ccfc->bearer_class;
1298
1299 if(resp_p->response.ptr_set_plus_ccfc->v_number)
1300 {
1301 memcpy(set_p->number,
1302 (U8 *)resp_p->response.ptr_set_plus_ccfc->number,
1303 resp_p->response.ptr_set_plus_ccfc->c_number);
1304 }
1305
1306 if(resp_p->response.ptr_set_plus_ccfc->type NEQ 0)
1307 {
1308 set_p->type=toa_demerge(resp_p->response.ptr_set_plus_ccfc->type);
1309 }
1310
1311 if(resp_p->response.ptr_set_plus_ccfc->v_subaddr)
1312 {
1313 memcpy(set_p->subaddr,
1314 (U8 *)resp_p->response.ptr_set_plus_ccfc->subaddr,
1315 resp_p->response.ptr_set_plus_ccfc->c_subaddr);
1316 }
1317
1318 if(resp_p->response.ptr_set_plus_ccfc->satype NEQ 0)
1319 {
1320 set_p->satype=tos_demerge(resp_p->response.ptr_set_plus_ccfc->satype);
1321 }
1322
1323 set_p->time = (SHORT)resp_p->response.ptr_set_plus_ccfc->time;
1324
1325 rCI_PlusCCFC(set_p);
1326
1327 return 0; /* Ok */
1328 }
1329
1330 int Resp_qPlusCCLK(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1331 {
1332 T_BAT_res_que_plus_cclk *cclk;
1333 char sign;
1334 int tz;
1335 TRACE_FUNCTION ("Resp_qPlusCCLK()");
1336 /*
1337 * Get a pointer to the CCLK structure for convenience.
1338 */
1339 cclk=resp_p->response.ptr_que_plus_cclk;
1340 tz=(char)cclk->time_zone;
1341 #ifndef _SIMULATION_
1342 #ifdef FF_TIMEZONE
1343 if (tz<0)
1344 {
1345 sign='-';
1346 tz=tz*(-1);
1347 }
1348 else
1349 {
1350 sign='+';
1351 }
1352
1353 #endif /*FF_TIMEZONE*/
1354 #else
1355 sign='-';
1356 tz=tz*(-1);
1357 #endif /*_SIMULATION_*/
1358
1359 #if defined(_SIMULATION_) || defined(FF_TIMEZONE)
1360 sprintf(
1361 g_sa,
1362 "%d/%d/%d,%d:%d:%d%c%d",
1363 cclk->year,
1364 cclk->month,
1365 cclk->day,
1366 cclk->hour,
1367 cclk->minutes,
1368 cclk->seconds,
1369 sign,
1370 tz);
1371 #else
1372 sprintf(
1373 g_sa,
1374 "%d/%d/%d,%d:%d:%d",
1375 cclk->year,
1376 cclk->month,
1377 cclk->day,
1378 cclk->hour,
1379 cclk->minutes,
1380 cclk->seconds);
1381 #endif
1382 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1383 return 0; /* Ok */
1384 }
1385
1386 int Resp_qPlusCCUG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1387 {
1388 TRACE_FUNCTION ("Resp_qPlusCCUG()");
1389 resp_disp (src_infos_psi->srcId,NULL,"eee",&resp_p->response.ptr_que_plus_ccug->n,
1390 &resp_p->response.ptr_que_plus_ccug->index,&resp_p->response.ptr_que_plus_ccug->info);
1391 return 0; /* Ok */
1392 }
1393
1394 int Resp_sPlusCCWA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1395 {
1396 TRACE_FUNCTION ("Resp_sPlusCCWA() Not implemented no callback which fills set response not present");
1397
1398 return 0; /* Ok */
1399 }
1400
1401 int Resp_sPlusCCWA_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1402 {
1403 TRACE_FUNCTION ("Resp_sPlusCCWA_W() Not Implemented");
1404
1405 return 0; /* Ok */
1406 }
1407
1408 int Resp_qPlusCDIP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1409 {
1410 T_BAT_res_que_plus_cdip *cdip;
1411
1412 TRACE_FUNCTION ("Resp_qPlusCDIP() Not Implemented");
1413
1414 cdip = resp_p->response.ptr_que_plus_cdip;
1415
1416 /* from ati_cc.c use bat params here! */
1417 resp_disp(src_infos_psi->srcId, NULL, "be", &ati_user_output_cfg[src_infos_psi->srcId].CDIP_stat, &cdip->m);
1418
1419 return 0; /* Ok */
1420 }
1421
1422 int Resp_sPlusCEER(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1423 {
1424 T_BAT_res_set_plus_ceer *ceer;
1425 char desc[MAX_CEER_DESC_LTH];
1426 USHORT cause;
1427 TRACE_FUNCTION ("Resp_sPlusCEER()");
1428 /*
1429 * Get a pointer to the CEER structure for convenience.
1430 */
1431 ceer=resp_p->response.ptr_set_plus_ceer;
1432
1433 cause=CAUSE_MAKE(
1434 ceer->definedby,
1435 ceer->originatingside,
1436 ceer->originatingentity,
1437 ceer->causevalue);
1438
1439 getCeerDesc(cause, desc);
1440
1441 if (desc[0]==0)
1442 {
1443 /*
1444 * No description text is available
1445 */
1446 sprintf( g_sa, "+CEER: %d,%d,%d,%d",
1447 ceer->definedby,
1448 ceer->originatingside,
1449 ceer->originatingentity,
1450 ceer->causevalue);
1451 }
1452 else
1453 {
1454 /*
1455 * Description text is available
1456 */
1457 sprintf( g_sa, "+CEER: %d,%d,%d,%d,%s",
1458 ceer->definedby,
1459 ceer->originatingside,
1460 ceer->originatingentity,
1461 ceer->causevalue,
1462 desc);
1463 }
1464 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1465 return 0; /* Ok */
1466 }
1467
1468 int Resp_qPlusCFUN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1469 {
1470 TRACE_FUNCTION ("Resp_qPlusCFUN()");
1471
1472 sprintf(g_sa,
1473 "%s: %d","+CFUN",
1474 resp_p->response.ptr_que_plus_cfun->fun);
1475
1476 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1477
1478 return 0; /* Ok */
1479 }
1480
1481 #ifdef GPRS
1482 int Resp_qPercentCGAATT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1483 {
1484 TRACE_FUNCTION ("Resp_qPercentCGAATT()");
1485 sprintf(g_sa,"%s: %d,%d", "%CGAATT",
1486 resp_p->response.ptr_que_percent_cgaatt->att_m,
1487 resp_p->response.ptr_que_percent_cgaatt->det_m);
1488 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1489 return 0; /* Ok */
1490 }
1491
1492 int Resp_qPlusCGACT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1493 {
1494 T_BAT_res_que_plus_cgact *cgact;
1495 TRACE_FUNCTION ("Resp_qPlusCGACT()");
1496 /*
1497 * Get a pointer to the CGACT structure for convenience.
1498 */
1499 cgact=resp_p->response.ptr_que_plus_cgact;
1500 sprintf(
1501 g_sa,
1502 "+CGACT: %hd,%d",
1503 cgact->cid,
1504 (cgact->state==BAT_CGACT_STATE_ACTIVATED) ? 1:0);
1505 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1506 return 0; /* Ok */
1507 }
1508
1509 int Resp_qPlusCGATT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1510 {
1511 TRACE_FUNCTION ("Resp_qPlusCGATT()");
1512 sprintf(g_sa,"+CGATT: %d",resp_p->response.ptr_que_plus_cgatt->state);
1513 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1514 return 0; /* Ok */
1515 }
1516
1517 int Resp_qPercentCGCLASS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1518 {
1519 char *classes[] = {"A","B","BG","BC","BX","CG","CC"};
1520 TRACE_FUNCTION ("Resp_qPercentCGCLASS()");
1521 if(resp_p->response.ptr_que_percent_cgclass->p_mobile_class NEQ
1522 resp_p->response.ptr_que_percent_cgclass->current_mobile_class)
1523 {
1524 sprintf(g_sa,"%s: \"%s\",\"%s\"", "%CGCLASS", classes[resp_p->response.ptr_que_percent_cgclass->p_mobile_class],
1525 classes[resp_p->response.ptr_que_percent_cgclass->current_mobile_class]);
1526 }
1527 else
1528 {
1529 sprintf(g_sa,"%s: \"%s\"", "%CGCLASS", classes[resp_p->response.ptr_que_percent_cgclass->p_mobile_class]);
1530 }
1531 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1532 return 0; /* Ok */
1533 }
1534
1535 int Resp_qPlusCGCLASS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1536 {
1537 char *me="+CGCLASS: ";
1538 char *classes[] = {"A","B","CG","CC"};
1539 TRACE_FUNCTION ("Resp_qPlusCGCLASS()");
1540 sprintf(g_sa,"%s\"%s\"", me, classes[resp_p->response.ptr_que_plus_cgclass->mobile_class]);
1541 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1542 return 0; /* Ok */
1543 }
1544
1545 int Resp_qPlusCGDCONT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1546 {
1547 char *me="+CGDCONT: ";
1548 T_BAT_res_que_plus_cgdcont *cgdcont;
1549 U8 apn[BAT_MAX_APN_LEN+1];
1550 U8 pdp_addr[BAT_MAX_PDP_ADD+1];
1551 CHAR *type;
1552 TRACE_FUNCTION ("Resp_qPlusCGDCONT()");
1553 /*
1554 * Get a pointer to the CGDCONT structure for convenience.
1555 */
1556 cgdcont=resp_p->response.ptr_que_plus_cgdcont;
1557 memset(apn,0,sizeof(apn));
1558 memset(pdp_addr,0,sizeof(pdp_addr));
1559 /*
1560 * Make these into null terminated strings.
1561 */
1562 memcpy(apn,cgdcont->apn,cgdcont->c_apn);
1563 memcpy(pdp_addr,cgdcont->pdp_addr,cgdcont->c_pdp_addr);
1564 type=(cgdcont->pdp_type==BAT_PDP_TYPE_IPV4) ? "IP":"";
1565
1566 if (!strcmp(apn, MAGIC_EMPTY_APN))
1567 {
1568 sprintf(g_sa,"%s%hd,\"%s\",\"\",\"%s\",%hd,%hd",
1569 me,
1570 cgdcont->cid,
1571 type,
1572 pdp_addr,
1573 cgdcont->d_comp,
1574 cgdcont->h_comp);
1575 }
1576 else if (apn[0]==0)
1577 {
1578 sprintf(g_sa,"%s%hd,\"%s\",,\"%s\",%hd,%hd",
1579 me,
1580 cgdcont->cid,
1581 type,
1582 pdp_addr,
1583 cgdcont->d_comp,
1584 cgdcont->h_comp);
1585 }
1586 else
1587 {
1588 sprintf(g_sa,"%s%hd,\"%s\",\"%s\",\"%s\",%hd,%hd",
1589 me,
1590 cgdcont->cid,
1591 type,
1592 apn,
1593 pdp_addr,
1594 cgdcont->d_comp,
1595 cgdcont->h_comp);
1596 }
1597 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1598 return 0; /* Ok */
1599 }
1600
1601 int Resp_sPlusCGPADDR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1602 {
1603 T_BAT_res_set_plus_cgpaddr *cgpaddr;
1604 TRACE_FUNCTION ("Resp_sPlusCGPADDR() ");
1605 /*
1606 * Get a pointer to the CGPADDR structure for convenience.
1607 */
1608 cgpaddr=resp_p->response.ptr_set_plus_cgpaddr;
1609 if (cgpaddr->c_pdp_addr)
1610 {
1611 U8 pa[BAT_MAX_PDP_ADD+1];
1612 memset(pa,0,sizeof(pa));
1613 memcpy(pa,cgpaddr->pdp_addr,cgpaddr->c_pdp_addr);
1614 sprintf(g_sa,"+CGPADDR: %hd,\"%s\"",cgpaddr->cid,pa);
1615 }
1616 else
1617 {
1618 sprintf(g_sa,"+CGPADDR: %hd",cgpaddr->cid);
1619 }
1620 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1621 return 0; /* Ok */
1622 }
1623
1624 int Resp_tPlusCGPADDR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1625 {
1626 T_BAT_res_tst_plus_cgpaddr *cgpaddr;
1627 int pos=0;
1628 UBYTE n;
1629 TRACE_FUNCTION ("Resp_tPlusCGPADDR() ");
1630 /*
1631 * Get a pointer to the CGPADDR structure for convenience.
1632 */
1633 cgpaddr=resp_p->response.ptr_tst_plus_cgpaddr;
1634
1635 pos=sprintf(g_sa,"+CGPADDR: (");
1636
1637 for (n=0;n<cgpaddr->c_cid;n++)
1638 {
1639 if (n!=0)
1640 {
1641 g_sa[pos]=',';
1642 pos++;
1643 }
1644
1645 pos+=sprintf(g_sa+pos,"%hd",cgpaddr->cid[n]);
1646 }
1647 g_sa[pos]=')';
1648 pos++;
1649 g_sa[pos]=0;
1650 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1651 return 0; /* Ok */
1652 }
1653
1654 int Resp_sPercentCGPCO(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1655 {
1656 T_BAT_res_set_percent_cgpco *cgpco;
1657 U8 pco[BAT_MAX_CGPCO_PCO_LEN+1];
1658 TRACE_FUNCTION ("Resp_sPercentCGPCO()");
1659 /*
1660 * Get a pointer to the CGPCO structure for convenience.
1661 */
1662 cgpco=resp_p->response.ptr_set_percent_cgpco;
1663 /*
1664 * Get a zero-terminated version of the pco string.
1665 */
1666 memset(pco,0,sizeof(pco));
1667 memcpy(pco,cgpco->pco,cgpco->c_pco);
1668 sprintf(g_sa,"%s\"%s\",%d","%CGPCO: ",pco,cgpco->cid);
1669 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1670 return 0; /* Ok */
1671 }
1672
1673 int Resp_qPercentCGPPP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1674 {
1675 TRACE_FUNCTION ("Resp_qPercentCGPPP()");
1676
1677 sprintf (g_sa, "%s: %d", "%CGPPP", resp_p->response.ptr_que_percent_cgppp->protocol);
1678 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1679
1680 return 0; /* Ok */
1681 }
1682
1683 int Resp_qPlusCGQMIN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1684 {
1685 T_BAT_res_que_plus_cgqmin *cgqmin;
1686 UBYTE precedence;
1687 UBYTE delay;
1688 UBYTE reliability;
1689 UBYTE peak;
1690 UBYTE mean;
1691 TRACE_FUNCTION ("Resp_qPlusCGQMIN()");
1692 /*
1693 * Get a pointer to the CGQMIN structure for convenience.
1694 */
1695 cgqmin=resp_p->response.ptr_que_plus_cgqmin;
1696
1697 precedence=(UBYTE)cgqmin->precedence;
1698 delay=(UBYTE)cgqmin->delay;
1699 reliability=(UBYTE)cgqmin->reliability;
1700 peak=(UBYTE)cgqmin->peak;
1701 mean=(UBYTE)cgqmin->mean;
1702
1703 if (precedence==(UBYTE)BAT_PRECEDENCE_NOT_PRESENT)
1704 precedence=GPRS_QOS_OMITTED;
1705
1706 if (delay==(UBYTE)BAT_DELAY_NOT_PRESENT)
1707 delay=GPRS_QOS_OMITTED;
1708
1709 if (reliability==(UBYTE)BAT_RELIABILITY_NOT_PRESENT)
1710 reliability=GPRS_QOS_OMITTED;
1711
1712 if (peak==(UBYTE)BAT_PEAK_NOT_PRESENT)
1713 peak=GPRS_QOS_OMITTED;
1714
1715 if (mean==(UBYTE)BAT_MEAN_NOT_PRESENT)
1716 mean=GPRS_QOS_OMITTED;
1717
1718 sprintf(
1719 g_sa,
1720 "%s%hd,%d,%d,%d,%d,%d",
1721 "+CGQMIN: ",
1722 cgqmin->cid,
1723 precedence,
1724 delay,
1725 reliability,
1726 peak,
1727 mean);
1728 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1729 return 0; /* Ok */
1730 }
1731
1732 int Resp_qPlusCGQREQ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1733 {
1734 T_BAT_res_que_plus_cgqreq *cgqreq;
1735 UBYTE precedence;
1736 UBYTE delay;
1737 UBYTE reliability;
1738 UBYTE peak;
1739 UBYTE mean;
1740 TRACE_FUNCTION ("Resp_qPlusCGQREQ()");
1741 /*
1742 * Get a pointer to the CGQREQ structure for convenience.
1743 */
1744 cgqreq=resp_p->response.ptr_que_plus_cgqreq;
1745
1746 precedence=(UBYTE)cgqreq->precedence;
1747 delay=(UBYTE)cgqreq->delay;
1748 reliability=(UBYTE)cgqreq->reliability;
1749 peak=(UBYTE)cgqreq->peak;
1750 mean=(UBYTE)cgqreq->mean;
1751
1752 if (precedence==(UBYTE)BAT_PRECEDENCE_NOT_PRESENT)
1753 precedence=GPRS_QOS_OMITTED;
1754
1755 if (delay==(UBYTE)BAT_DELAY_NOT_PRESENT)
1756 delay=GPRS_QOS_OMITTED;
1757
1758 if (reliability==(UBYTE)BAT_RELIABILITY_NOT_PRESENT)
1759 reliability=GPRS_QOS_OMITTED;
1760
1761 if (peak==(UBYTE)BAT_PEAK_NOT_PRESENT)
1762 peak=GPRS_QOS_OMITTED;
1763
1764 if (mean==(UBYTE)BAT_MEAN_NOT_PRESENT)
1765 mean=GPRS_QOS_OMITTED;
1766
1767 sprintf(g_sa,"%s%hd,%d,%d,%d,%d,%d",
1768 "+CGQREQ: ",
1769 cgqreq->cid,
1770 precedence,
1771 delay,
1772 reliability,
1773 peak,
1774 mean);
1775 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1776 return 0; /* Ok */
1777 }
1778
1779 int Resp_qPercentCGREG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1780 {
1781 T_P_CGREG_STAT stat;
1782 USHORT lac, cid;
1783 T_ATI_CREG_MOD mode;
1784 SHORT pos;
1785 T_BAT_res_que_percent_cgreg *cgreg;
1786 TRACE_FUNCTION ("Resp_qPercentCGREG()");
1787 /*
1788 * Get a pointer to the CGREG structure for convenience.
1789 */
1790 cgreg=resp_p->response.ptr_que_percent_cgreg;
1791 stat=(T_P_CGREG_STAT)cgreg->stat;
1792 lac=(USHORT)cgreg->lac;
1793 cid=(USHORT)cgreg->ci;
1794
1795 mode=ati_gprs_user_output_cfg[(src_infos_psi->srcId)].percent_cgreg.mod_lac_cid.pres_mode;
1796 pos=sprintf(g_sa,"%s: %d,%d","%CGREG",mode,stat);
1797 if ((mode==CREG_MOD_LOC_INF_ON) || (mode==CREG_MOD_LOC_INF_ON_CTXACT))
1798 {
1799 if ((stat==P_CGREG_STAT_REG_HOME) || (stat==P_CGREG_STAT_REG_ROAM))
1800 pos += sprintf(g_sa+pos, ",\"%04X\",\"%04X\"", lac, cid);
1801 else if (mode==CREG_MOD_LOC_INF_ON_CTXACT)
1802 pos += sprintf(g_sa+pos, ",,"); /* if CTXACT follows so lac and cid are ommitted */
1803 }
1804 if (mode==CREG_MOD_LOC_INF_ON_CTXACT)
1805 sprintf(g_sa+pos,(cgreg->state==BAT_P_CGREG_STATE_STAT_1) ? ",1" : ",0");
1806 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1807 return 0; /* Ok */
1808 }
1809
1810 int Resp_qPlusCGREG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1811 {
1812 T_CGREG_STAT stat;
1813 USHORT lac, cid;
1814 T_ATI_CREG_MOD mode;
1815 SHORT pos;
1816 T_BAT_res_que_plus_cgreg *cgreg;
1817 TRACE_FUNCTION ("Resp_qPlusCGREG()");
1818 /*
1819 * Get a pointer to the CGREG structure for convenience.
1820 */
1821 cgreg=resp_p->response.ptr_que_plus_cgreg;
1822 stat=(T_P_CGREG_STAT)cgreg->stat;
1823 lac=(USHORT)cgreg->lac;
1824 cid=(USHORT)cgreg->ci;
1825 mode=ati_gprs_user_output_cfg[src_infos_psi->srcId].plus_cgreg.mod_lac_cid.pres_mode;
1826 pos=sprintf(g_sa, "+CGREG: %d,%d", mode, stat);
1827 if (mode==CREG_MOD_LOC_INF_ON)
1828 {
1829 if((stat==CGREG_STAT_REG_HOME) || (stat==CGREG_STAT_REG_ROAM))
1830 sprintf(g_sa+pos, ",\"%04X\",\"%04X\"", lac, cid);
1831 }
1832
1833 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1834 return 0; /* Ok */
1835 }
1836
1837 int Resp_qPlusCGSMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1838 {
1839 char *me="+CGSMS: ";
1840 TRACE_FUNCTION ("Resp_qPlusCGSMS()");
1841
1842 sprintf(g_sa,"%s%hd", me, (T_CGSMS_SERVICE)resp_p->response.ptr_que_plus_cgsms->service);
1843 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1844
1845 return 0; /* Ok */
1846 }
1847
1848 #endif /* GPRS */
1849
1850 int Resp_sPercentCHPL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1851 {
1852 T_BAT_res_set_percent_chpl *chpl;
1853 CHAR str[BAT_MAX_CHPL_OPER_LEN+1];
1854 TRACE_FUNCTION ("Resp_sPercentCHPL()");
1855 /*
1856 * Get a pointer to the CHPL structure for convenience.
1857 */
1858 chpl=resp_p->response.ptr_set_percent_chpl;
1859 /*
1860 * Make a zero-terminated version of the operator string.
1861 */
1862 memset(str,0,sizeof(str));
1863 memcpy(str,chpl->oper,chpl->c_oper);
1864 /*
1865 * This relies on the BAT representation of the numeric
1866 * format being the same as the ATI representation.
1867 */
1868 sprintf(g_sa,"%s: %s","%CHPL",str);
1869 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1870 return 0; /* Ok */
1871 }
1872
1873 int Resp_sPercentCHPL_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1874 {
1875 TRACE_FUNCTION ("Resp_sPercentCHPL_W() Not Implemented");
1876
1877 return 0; /* Ok */
1878 }
1879
1880 int Resp_sPlusCIMI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1881 {
1882 CHAR imsi[MAX_IMSI_LEN+1];
1883 TRACE_FUNCTION ("Resp_sPlusCIMI()");
1884
1885 utl_binToHex(resp_p->response.ptr_set_plus_cimi->imsi,
1886 resp_p->response.ptr_set_plus_cimi->c_imsi,imsi);
1887 sprintf(g_sa,"%s",imsi);
1888 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1889 return 0; /* Ok */
1890 }
1891
1892 int Resp_qPlusCIND(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1893 {
1894 TRACE_FUNCTION ("Resp_qPlusCIND() ");
1895 resp_disp(src_infos_psi->srcId, NULL,"ee", &resp_p->response.ptr_que_plus_cind->signal,
1896 &resp_p->response.ptr_que_plus_cind->smsfull);
1897
1898 return 0; /* Ok */
1899 }
1900
1901 int Resp_qPlusCLAN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1902 {
1903 T_BAT_res_que_plus_clan *clan;
1904 CHAR code[BAT_MAX_CLAN_CODE_LEN+1];
1905 TRACE_FUNCTION ("Resp_qPlusCLAN()");
1906 /*
1907 * Get a pointer to the CLAN structure for convenience.
1908 */
1909 clan=resp_p->response.ptr_que_plus_clan;
1910 memset(code,0,sizeof(code));
1911 memcpy(code,clan->code,clan->c_code);
1912 sprintf(g_sa,"+CLAN: %s",code);
1913 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
1914 return 0; /* Ok */
1915 }
1916
1917 int Resp_tPlusCLAN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1918 {
1919 T_BAT_res_tst_plus_clan *clan;
1920 CHAR code[BAT_MAX_CLAN_CODE_LEN+1];
1921 TRACE_FUNCTION ("Resp_tPlusCLAN() ");
1922 /*
1923 * Get a pointer to the CLAN structure for convenience.
1924 */
1925 clan=resp_p->response.ptr_tst_plus_clan;
1926 memset(code,0,sizeof(code));
1927 memcpy(code,clan->code,clan->c_code);
1928 if (clan_buf==NULL)
1929 {
1930 clan_buf=g_sa;
1931 clan_buf+=sprintf(clan_buf,"+CLAN: ");
1932 }
1933 else
1934 {
1935 *clan_buf++=',';
1936 }
1937 clan_buf+=sprintf(clan_buf,"%s",code);
1938 return 0; /* Ok */
1939 }
1940
1941 int Resp_sPlusCLCK(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1942 {
1943 SHORT pos;
1944 TRACE_FUNCTION ("Resp_sPlusCLCK()");
1945
1946 pos = sprintf(g_sa,"+CLCK: ");
1947 pos += sprintf(g_sa+pos,"%d,",resp_p->response.ptr_set_plus_clck->status);
1948 if (resp_p->response.ptr_set_plus_clck->bearer_class NEQ BAT_CLASS_NOT_PRESENT)
1949 {
1950 pos += sprintf(g_sa+pos,"%d,",resp_p->response.ptr_set_plus_clck->bearer_class);
1951 }
1952 ci_remTrailCom(g_sa, pos);
1953 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1954 return 0; /* Ok */
1955 }
1956
1957 int Resp_qPlusCLIP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1958 {
1959 TRACE_FUNCTION ("Resp_qPlusCLIP() ");
1960 resp_disp(src_infos_psi->srcId,NULL,"be",&ati_user_output_cfg[src_infos_psi->srcId].CLIP_stat,
1961 &resp_p->response.ptr_que_plus_clip->m);
1962 return 0; /* Ok */
1963 }
1964
1965 int Resp_qPlusCLIP_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1966 {
1967 TRACE_FUNCTION ("Resp_qPlusCLIP_W() Not Implemented");
1968
1969 return 0; /* Ok */
1970 }
1971
1972 int Resp_qPlusCLIR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1973 {
1974 char *me = "+CLIR: ";
1975 TRACE_FUNCTION ("Resp_qPlusCLIR()");
1976 sprintf(g_sa,"%s%d,%d",me,resp_p->response.ptr_que_plus_clir->n,
1977 resp_p->response.ptr_que_plus_clir->m);
1978 io_sendMessage(src_infos_psi->srcId,g_sa, ATI_NORMAL_OUTPUT);
1979
1980 return 0; /* Ok */
1981 }
1982
1983 int Resp_sPlusCLVL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1984 {
1985 TRACE_FUNCTION ("Resp_sPlusCLVL() ");
1986 /* Output nothing as input is bat_dummy*/
1987
1988 return 0; /* Ok */
1989 }
1990
1991 int Resp_qPlusCLVL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
1992 {
1993 TRACE_FUNCTION ("Resp_qPlusCLVL()");
1994
1995 sprintf ( g_sa, "+CLVL: %d", resp_p->response.ptr_que_plus_clvl->level );
1996 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
1997
1998 return 0; /* Ok */
1999 }
2000
2001 int Resp_qPlusCMER(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2002 {
2003 TRACE_FUNCTION ("Resp_qPlusCMER() not implemented");
2004
2005 return 0; /* Ok */
2006 }
2007
2008 int Resp_sPlusCMGC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2009 {
2010 T_MNSMS_COMMAND_CNF mnsms_command_cnf;
2011 TRACE_FUNCTION ("Resp_sPlusCMGC()");
2012
2013 mnsms_command_cnf.tp_mr = resp_p->response.ptr_set_plus_cmgc->mr;
2014 mnsms_command_cnf.sms_sdu.l_buf= resp_p->response.ptr_set_plus_cmgc->c_ackpdu;
2015 memcpy(mnsms_command_cnf.sms_sdu.buf,resp_p->response.ptr_set_plus_cmgc->ackpdu,mnsms_command_cnf.sms_sdu.l_buf);
2016
2017 rCI_PlusCMGCPdu(&mnsms_command_cnf);
2018 return 0; /* Ok */
2019 }
2020
2021 int Resp_sPlusCMGL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2022 {
2023 T_MNSMS_READ_CNF mnsms_read_cnf;
2024 TRACE_FUNCTION ("Resp_sPlusCMGL()");
2025
2026 mnsms_read_cnf.status = resp_p->response.ptr_set_plus_cmgl->stat;
2027 /*mnsms_read_cnf.rec_status = resp_p->response.ptr_set_plus_cmgl->stat;*/
2028 mnsms_read_cnf.rec_num = (UBYTE)resp_p->response.ptr_set_plus_cmgl->sms_index;
2029 mnsms_read_cnf.sms_sdu.l_buf = resp_p->response.ptr_set_plus_cmgl->c_pdu;
2030 memcpy(mnsms_read_cnf.sms_sdu.buf,resp_p->response.ptr_set_plus_cmgl->pdu,
2031 resp_p->response.ptr_set_plus_cmgl->c_pdu);
2032 rCI_Plus_Percent_CMGLPdu(&mnsms_read_cnf, AT_CMD_CMGL);
2033 return 0; /* Ok */
2034 }
2035
2036 int Resp_sPercentCMGL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2037 {
2038 T_MNSMS_READ_CNF mnsms_read_cnf;
2039 TRACE_FUNCTION ("Resp_sPercentCMGL()");
2040
2041 mnsms_read_cnf.status = resp_p->response.ptr_set_percent_cmgl->stat;
2042 mnsms_read_cnf.rec_num = (UBYTE)resp_p->response.ptr_set_percent_cmgl->sms_index;
2043 mnsms_read_cnf.sms_sdu.l_buf = resp_p->response.ptr_set_percent_cmgl->c_pdu;
2044 memcpy(mnsms_read_cnf.sms_sdu.buf,resp_p->response.ptr_set_percent_cmgl->pdu,
2045 resp_p->response.ptr_set_percent_cmgl->c_pdu);
2046 rCI_Plus_Percent_CMGLPdu(&mnsms_read_cnf, AT_CMD_P_CMGL);
2047 return 0; /* Ok */
2048 }
2049
2050
2051 int Resp_sPlusCMGL_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2052 {
2053 TRACE_FUNCTION ("Resp_sPlusCMGL_W() Not Implemented");
2054
2055 return 0; /* Ok */
2056 }
2057
2058 int Resp_sPlusCMGR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2059 {
2060 T_MNSMS_READ_CNF mnsms_read_cnf;
2061
2062 TRACE_FUNCTION ("Resp_sPlusCMGR()");
2063
2064 mnsms_read_cnf.status = resp_p->response.ptr_set_plus_cmgr->sms_stat;
2065 mnsms_read_cnf.sms_sdu.l_buf = resp_p->response.ptr_set_plus_cmgr->c_pdu;
2066 memcpy(mnsms_read_cnf.sms_sdu.buf,resp_p->response.ptr_set_plus_cmgr->pdu,
2067 resp_p->response.ptr_set_plus_cmgr->c_pdu);
2068
2069 rCI_Plus_Percent_CMGRPdu(&mnsms_read_cnf, AT_CMD_CMGR);
2070
2071 return 0; /* Ok */
2072 }
2073
2074 int Resp_sPercentCMGR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2075 {
2076 T_MNSMS_READ_CNF mnsms_read_cnf;
2077
2078 TRACE_FUNCTION ("Resp_sPercentCMGR()");
2079
2080 mnsms_read_cnf.status = resp_p->response.ptr_set_percent_cmgr->sms_stat;
2081 mnsms_read_cnf.sms_sdu.l_buf = resp_p->response.ptr_set_percent_cmgr->c_pdu;
2082 memcpy(mnsms_read_cnf.sms_sdu.buf,resp_p->response.ptr_set_percent_cmgr->pdu,
2083 resp_p->response.ptr_set_percent_cmgr->c_pdu);
2084
2085 rCI_Plus_Percent_CMGRPdu(&mnsms_read_cnf, AT_CMD_P_CMGR);
2086
2087 return 0; /* Ok */
2088 }
2089
2090
2091
2092 int Resp_sPlusCMGR_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2093 {
2094 TRACE_FUNCTION ("Resp_sPlusCMGR_W() Not Implemented");
2095
2096 return 0; /* Ok */
2097 }
2098
2099 int Resp_sPlusCMGS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2100 {
2101 T_MNSMS_SUBMIT_CNF mnsms_submit_cnf;
2102
2103 TRACE_FUNCTION ("Resp_sPlusCMGS()");
2104
2105 /*
2106 * Set up the bits of mnsms_submit_cnf that are used by
2107 * rCI_PlusCMGSPdu().
2108 */
2109 mnsms_submit_cnf.tp_mr=resp_p->response.ptr_set_plus_cmgs->mr;
2110 mnsms_submit_cnf.sms_sdu.l_buf=0;
2111
2112 rCI_PlusCMGS(&mnsms_submit_cnf);
2113 return 0; /* Ok */
2114 }
2115
2116 int Resp_sPlusCMGW(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2117 {
2118 TRACE_FUNCTION ("Resp_sPlusCMGW()");
2119
2120 rCI_PlusCMGW((UBYTE)resp_p->response.ptr_set_plus_cmgw->index);
2121 return 0; /* Ok */
2122 }
2123
2124 int Resp_qPlusCMOD(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2125 {
2126 TRACE_FUNCTION ("Resp_qPlusCMOD()");
2127 resp_disp (src_infos_psi->srcId, NULL, "e",&resp_p->response.ptr_que_plus_cmod->mode);
2128 return 0; /* Ok */
2129 }
2130
2131 int Resp_qPlusCMUT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2132 {
2133 TRACE_FUNCTION ("Resp_qPlusCMUT()");
2134 sprintf ( g_sa, "+CMUT: %d", resp_p->response.ptr_que_plus_cmut->n);
2135 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2136 return 0; /* Ok */
2137 }
2138
2139 int Resp_qPlusCMUX(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2140 {
2141 TRACE_FUNCTION ("Resp_qPlusCMUX() not implemented");
2142
2143 return 0; /* Ok */
2144 }
2145
2146 int Resp_qPercentCNAP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2147 {
2148 TRACE_FUNCTION ("Resp_qPercentCNAP() ");
2149
2150 sprintf(g_sa, "%s%d,%d", "%CNAP: ", ati_user_output_cfg[src_infos_psi->srcId].cnap_mode,
2151 resp_p->response.ptr_que_percent_cnap->status);
2152 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
2153
2154 return 0; /* Ok */
2155 }
2156
2157 int Resp_qPlusCNMI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2158 {
2159 char* me = "+CNMI: ";
2160
2161 TRACE_FUNCTION ("Resp_qPlusCNMI()");
2162
2163 sprintf ( g_sa,"%s%d,%d,%d,%d,%d", me, at.CNMI_mode,
2164 resp_p->response.ptr_que_plus_cnmi->mt, resp_p->response.ptr_que_plus_cnmi->bm,
2165 resp_p->response.ptr_que_plus_cnmi->ds, at.CNMI_bfr );
2166 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
2167
2168 return 0; /* Ok */
2169 }
2170
2171 int Resp_sPlusCNUM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2172 {
2173 T_ACI_CNUM_MSISDN msisdn[MAX_MSISDN];
2174 UBYTE n;
2175 T_BAT_res_set_plus_cnum *cnum;
2176 T_ACI_CNUM_MSISDN *ms;
2177
2178 TRACE_FUNCTION ("Resp_sPlusCNUM()");
2179
2180 /*
2181 * Get a pointer to the CNUM structure for convenience.
2182 */
2183 cnum=resp_p->response.ptr_set_plus_cnum;
2184
2185 /*
2186 * Get a pointer to the output data for convenience.
2187 */
2188 ms=&msisdn[0];
2189
2190 /*
2191 * rCI_PlusCNUM() ignores the 'num' parameter which is supposed
2192 * to indicate the number of items. Instead it assumes that its
2193 * 'msisdn' parameter is a pointer to an array of MAX_MSISDN
2194 * items. We are providing only a single item so here we set
2195 * all the other items in the array invalid.
2196 */
2197 for (n=1;n<MAX_MSISDN;n++)
2198 msisdn[n].vldFlag=FALSE;
2199
2200 ms->vldFlag=TRUE;
2201
2202 /*
2203 * Convert the alphanumeric data into a null terminated string,
2204 * which is what the ATI expects.
2205 */
2206 memset(ms->alpha,0,MAX_ALPHA_LEN);
2207
2208 if (cnum->v_alpha==TRUE)
2209 {
2210 if (cnum->c_alpha>=MAX_ALPHA_LEN)
2211 memcpy(ms->alpha,cnum->alpha,MAX_ALPHA_LEN-1);
2212 else
2213 memcpy(ms->alpha,cnum->alpha,cnum->c_alpha);
2214 }
2215
2216 /*
2217 * Convert the number into a null terminated string,
2218 * which is what the ATI expects.
2219 */
2220 memset(ms->number,0,MAX_PHB_NUM_LEN);
2221
2222 if (cnum->c_number>=MAX_PHB_NUM_LEN)
2223 memcpy(ms->number,cnum->number,MAX_PHB_NUM_LEN-1);
2224 else
2225 memcpy(ms->number,cnum->number,cnum->c_number);
2226
2227 ms->type=toa_demerge(cnum->type);
2228
2229 /*
2230 * These are not included in the BAT message, so set them
2231 * all to 'not present'.
2232 */
2233 ms->speed=BS_SPEED_NotPresent;
2234 ms->service=CNUM_SERV_NotPresent;
2235 ms->itc=CNUM_ITC_NotPresent;
2236
2237 rCI_PlusCNUM(msisdn,1);
2238
2239 return 0; /* Ok */
2240 }
2241
2242 int Resp_sPlusCNUM_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2243 {
2244 TRACE_FUNCTION ("Resp_sPlusCNUM_W() Not Implemented");
2245
2246 return 0; /* Ok */
2247 }
2248
2249 int Resp_qPlusCOLP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2250 {
2251 UBYTE x = 0;
2252
2253 TRACE_FUNCTION ("Resp_qPlusCOLP()");
2254
2255 x = (at.flags.COLP_stat?1:0);
2256 resp_disp(src_infos_psi->srcId, NULL,"be",&x,
2257 &resp_p->response.ptr_que_plus_colp->m);
2258
2259 return 0; /* Ok */
2260 }
2261
2262 int Resp_qPlusCOLP_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2263 {
2264 TRACE_FUNCTION ("Resp_qPlusCOLP_W() Not Implemented");
2265
2266 return 0; /* Ok */
2267 }
2268
2269 int Resp_qPercentCOPS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2270 {
2271 U8 oper[40] = {'\0'};
2272 TRACE_FUNCTION ("Resp_qPercentCOPS()");
2273
2274 /* resp_p->response.ptr_que_percent_cops->oper is not NULL terminated */
2275 memcpy(oper,
2276 resp_p->response.ptr_que_percent_cops->oper,
2277 resp_p->response.ptr_que_percent_cops->c_oper);
2278
2279 /* Added an empty comma and the service Status parameter */
2280 sprintf(g_sa,
2281 "%s: %d,%d,\"%s\",,%d","%COPS",
2282 resp_p->response.ptr_que_percent_cops->mode,
2283 resp_p->response.ptr_que_percent_cops->format,
2284 oper, /* resp_p->response.ptr_que_percent_cops->oper, */
2285 resp_p->response.ptr_que_percent_cops->service);
2286
2287 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2288 return 0; /* Ok */
2289 }
2290
2291 int Resp_tPercentCOPS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2292 {
2293 char *cmdstr="%COPS";
2294 T_BAT_res_tst_percent_cops *cops;
2295
2296 TRACE_FUNCTION ("Resp_tPercentCOPS()");
2297 /*
2298 * Get a pointer to the BAT structure for convenience.
2299 */
2300 cops=resp_p->response.ptr_tst_percent_cops;
2301
2302 if (cops_flag==FALSE)
2303 {
2304 cops_flag=TRUE;
2305
2306 /*
2307 * First operator.
2308 */
2309 sprintf(g_sa, "%s: (%d,\"%s\",\"%s\",\"%s\")",
2310 cmdstr,
2311 cops->status,
2312 cops->long_oper,
2313 cops->short_oper,
2314 cops->num_oper);
2315 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
2316 }
2317 else
2318 {
2319 /*
2320 * Subsequent operators.
2321 */
2322 sprintf(g_sa, ",(%d,\"%s\",\"%s\",\"%s\")",
2323 cops->status,
2324 cops->long_oper,
2325 cops->short_oper,
2326 cops->num_oper);
2327 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
2328 }
2329
2330 return 0; /* Ok */
2331 }
2332
2333 int Resp_qPlusCOPS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2334 {
2335 T_BAT_res_que_plus_cops *cops;
2336 TRACE_FUNCTION ("Resp_qPlusCOPS()");
2337 /*
2338 * Get a pointer to the COPS structure for convenience.
2339 */
2340 cops=resp_p->response.ptr_que_plus_cops;
2341 if (cops->v_oper==TRUE)
2342 {
2343 U8 op[BAT_MAX_COPS_OPER_LEN+1];
2344 /*
2345 * Create a zero-terminated version of the operator name.
2346 */
2347 memset(op,0,sizeof(op));
2348 memcpy(op,cops->oper,cops->c_oper);
2349 sprintf(g_sa,"+COPS: %d,%d,\"%s\"",cops->mode,cops->format,op);
2350 }
2351 else
2352 {
2353 sprintf(g_sa,"+COPS: %d",cops->mode);
2354 }
2355
2356 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2357 return 0; /* Ok */
2358 }
2359
2360 int Resp_tPlusCOPS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2361 {
2362 char *cmdstr;
2363 T_BAT_res_tst_plus_cops *cops;
2364 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_infos_psi->srcId, search_ati_src_id);
2365
2366 TRACE_FUNCTION ("Resp_tPlusCOPS()");
2367 /*
2368 * We're in trouble if we don't have 'src_params', as we need
2369 * to know the command ID.
2370 */
2371 if (src_params==NULL)
2372 {
2373 TRACE_EVENT("No src_params in COPS response.");
2374 return 1; /* Indicate error */
2375 }
2376
2377 /*
2378 * rBAT_PlusCOPS doubles for both %COPS and +COPS responses.
2379 */
2380 if (src_params->curAtCmd==AT_CMD_P_COPS)
2381 cmdstr = "%COPS";
2382 else
2383 cmdstr = "+COPS";
2384
2385 /*
2386 * Get a pointer to the BAT structure for convenience.
2387 */
2388 cops=resp_p->response.ptr_tst_plus_cops;
2389
2390 if (cops_flag==FALSE)
2391 {
2392 cops_flag=TRUE;
2393
2394 /*
2395 * First operator.
2396 */
2397 sprintf(g_sa, "%s: (%d,\"%s\",\"%s\",\"%s\")",
2398 cmdstr,
2399 cops->status,
2400 cops->long_oper,
2401 cops->short_oper,
2402 cops->num_oper);
2403
2404 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
2405 }
2406 else
2407 {
2408 /*
2409 * Subsequent operators.
2410 */
2411 sprintf(g_sa, ",(%d,\"%s\",\"%s\",\"%s\")",
2412 cops->status,
2413 cops->long_oper,
2414 cops->short_oper,
2415 cops->num_oper);
2416
2417 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
2418 }
2419 return 0; /* Ok */
2420 }
2421
2422 int Resp_qPercentCOPS_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2423 {
2424 TRACE_FUNCTION ("Resp_qPercentCOPS_W() Not Implemented");
2425
2426 return 0; /* Ok */
2427 }
2428
2429 int Resp_tPercentCOPS_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2430 {
2431 TRACE_FUNCTION ("Resp_tPercentCOPS_W() Not Implemented");
2432
2433 return 0; /* Ok */
2434 }
2435
2436 int Resp_sPercentCPALS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2437 {
2438 CHAR msisdn_id[BAT_MAX_CPALS_MSISDN_ID_LEN + 1] ;
2439 TRACE_FUNCTION ("Resp_sPercentCPALS() ");
2440
2441 utl_binToHex(resp_p->response.ptr_set_percent_cpals->msisdn_id,
2442 (SHORT)resp_p->response.ptr_set_percent_cpals->c_msisdn_id ,
2443 msisdn_id);
2444
2445 sprintf(g_sa, "%s: %d,\"%s\"", "%CPALS",
2446 resp_p->response.ptr_set_percent_cpals->lines,
2447 msisdn_id);
2448 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2449
2450 return 0; /* Ok */
2451 }
2452
2453 int Resp_qPercentCPALS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2454 {
2455 TRACE_FUNCTION ("Resp_qPercentCPALS() ");
2456
2457 sprintf(g_sa, "%s: %d", "%CPALS",
2458 resp_p->response.ptr_que_percent_cpals->lines);
2459
2460 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2461
2462 return 0; /* Ok */
2463 }
2464
2465 int Resp_sPercentCPALS_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2466 {
2467 TRACE_FUNCTION ("Resp_sPercentCPALS_W() not implemented");
2468
2469 return 0; /* Ok */
2470 }
2471
2472 int Resp_qPercentCPALS_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2473 {
2474 TRACE_FUNCTION ("Resp_qPercentCPALS_W() Not Implemented");
2475
2476 return 0; /* Ok */
2477 }
2478
2479 int Resp_sPlusCPAS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2480 {
2481 TRACE_FUNCTION ("Resp_sPlusCPAS()");
2482
2483 resp_disp(src_infos_psi->srcId, NULL, "e", &resp_p->response.ptr_set_plus_cpas->pas);
2484 return 0; /* Ok */
2485 }
2486
2487 int Resp_sPlusCPBF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2488 {
2489 T_BAT_res_set_plus_cpbf *cpbf;
2490 USHORT pos;
2491 U8 num[BAT_MAX_CPBF_NUMBER_LEN+1];
2492 CHAR cvtd_text[2*BAT_MAX_CPBF_TEXT_LEN];
2493 USHORT len_cvtd_text;
2494 TRACE_FUNCTION ("Resp_sPlusCPBF()");
2495 /*
2496 * Get a pointer to the CPBF structure for convenience.
2497 */
2498 cpbf=resp_p->response.ptr_set_plus_cpbf;
2499 memset(num,0,sizeof(num));
2500 memcpy(num,cpbf->number,cpbf->c_number);
2501 pos=sprintf(g_sa,"+CPBF: %d,\"%s\",%d,",cpbf->index,num,cpbf->type);
2502 utl_chsetFromSim(
2503 (UBYTE*)cpbf->text,
2504 (USHORT)cpbf->c_text,
2505 (UBYTE*)cvtd_text,
2506 sizeof(cvtd_text),
2507 &len_cvtd_text,
2508 GSM_ALPHA_Def);
2509 pos+=sprints(g_sa+pos,cvtd_text,len_cvtd_text);
2510 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2511 return 0; /* Ok */
2512 }
2513
2514 int Resp_tPlusCPBF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2515 {
2516 T_BAT_res_tst_plus_cpbf *cpbf;
2517 TRACE_FUNCTION ("Resp_tPlusCPBF()");
2518 /*
2519 * Get a pointer to the CPBF structure for convenience.
2520 */
2521 cpbf=resp_p->response.ptr_tst_plus_cpbf;
2522 resp_disp(src_infos_psi->srcId,NULL,"bb",(UBYTE *)&cpbf->nlength,(UBYTE *)&cpbf->tlength);
2523 return 0; /* Ok */
2524 }
2525
2526 int Resp_sPlusCPBF_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2527 {
2528
2529 TRACE_FUNCTION ("Resp_sPlusCPBF_W() Not Implemented");
2530
2531 return 0; /* Ok */
2532 }
2533
2534 int Resp_tPlusCPBF_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2535 {
2536 TRACE_FUNCTION ("Resp_tPlusCPBF_W() Not Implemented");
2537
2538 return 0; /* Ok */
2539 }
2540
2541 int Resp_sPlusCPBR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2542 {
2543 USHORT pos = 0;
2544 TRACE_FUNCTION ("Resp_sPlusCPBR()");
2545
2546 if (resp_p->response.ptr_set_plus_cpbr->index NEQ ACI_NumParmNotPresent)
2547 {
2548 CHAR cvtdText[4*MAX_ALPHA_LEN] = {0x00}; /* need enough space for UCS2 strings */
2549 USHORT lenCvtdText = 0;
2550
2551 pos=sprintf(g_sa,"+CPBR: %d,\"%s\",%d,",
2552 resp_p->response.ptr_set_plus_cpbr->index,
2553 resp_p->response.ptr_set_plus_cpbr->number,
2554 resp_p->response.ptr_set_plus_cpbr->type);
2555
2556 utl_chsetFromSim((UBYTE*)resp_p->response.ptr_set_plus_cpbr->text,
2557 resp_p->response.ptr_set_plus_cpbr->c_text,
2558 (UBYTE*)cvtdText,
2559 sizeof(cvtdText),
2560 &lenCvtdText,
2561 GSM_ALPHA_Def);
2562
2563 pos+=sprints(g_sa+pos,cvtdText,lenCvtdText);
2564 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2565 }
2566
2567 return 0; /* Ok */
2568 }
2569
2570 int Resp_tPlusCPBR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2571 {
2572 TRACE_FUNCTION ("Resp_tPlusCPBR()");
2573
2574 sprintf(g_sa,"+CPBR: (%d-%d),%d,%d",
2575 resp_p->response.ptr_tst_plus_cpbr->index_f,
2576 resp_p->response.ptr_tst_plus_cpbr->index_l,
2577 resp_p->response.ptr_tst_plus_cpbr->nlength,
2578 resp_p->response.ptr_tst_plus_cpbr->tlength);
2579 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2580 return 0; /* Ok */
2581 }
2582
2583 int Resp_sPlusCPBR_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2584 {
2585 TRACE_FUNCTION ("Resp_sPlusCPBR_W() Not Implemented");
2586
2587 return 0; /* Ok */
2588 }
2589
2590 int Resp_tPlusCPBR_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2591 {
2592 TRACE_FUNCTION ("Resp_tPlusCPBR_W() Not Implemented");
2593 return 0; /* Ok */
2594 }
2595
2596 int Resp_qPercentCPBS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2597 {
2598 SHORT i;
2599 TRACE_FUNCTION ("Resp_qPercentCPBS()");
2600
2601 for(i=0;phb_mem_names[i].name NEQ NULL;i++)
2602 {
2603 if (phb_mem_names[i].stor EQ resp_p->response.ptr_que_percent_cpbs->storage)
2604 {
2605 sprintf(g_sa,"%s: \"%s\",%d,%d,%d","%CPBS",
2606 phb_mem_names[i].name,
2607 resp_p->response.ptr_que_percent_cpbs->used,
2608 resp_p->response.ptr_que_percent_cpbs->total,
2609 resp_p->response.ptr_que_percent_cpbs->first);
2610
2611 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2612 break;
2613 }
2614 }
2615
2616 return(0); /* Ok */
2617 }
2618
2619 int Resp_qPlusCPBS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2620 {
2621 SHORT i;
2622 TRACE_FUNCTION ("Resp_qPlusCPBS()");
2623
2624 for(i=0;phb_mem_names[i].name NEQ NULL;i++)
2625 {
2626 if (phb_mem_names[i].stor EQ resp_p->response.ptr_que_plus_cpbs->storage)
2627 {
2628 sprintf(g_sa,"+CPBS: \"%s\",%d,%d",
2629 phb_mem_names[i].name,
2630 resp_p->response.ptr_que_plus_cpbs->used,
2631 resp_p->response.ptr_que_plus_cpbs->total);
2632 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2633 break;
2634 }
2635 }
2636
2637 return 0; /* Ok */
2638 }
2639
2640 int Resp_tPlusCPBW(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2641 {
2642 TRACE_FUNCTION ("Resp_tPlusCPBW()");
2643 sprintf(g_sa,"%s(%d-%d),%d,%s,%d",
2644 "+CPBW: ",
2645 resp_p->response.ptr_tst_plus_cpbw->index1,
2646 resp_p->response.ptr_tst_plus_cpbw->index2,
2647 resp_p->response.ptr_tst_plus_cpbw->nlength,
2648 "(128-201)",
2649 resp_p->response.ptr_tst_plus_cpbw->tlength);
2650 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2651 return 0; /* Ok */
2652 }
2653
2654 int Resp_tPlusCPBW_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2655 {
2656 TRACE_FUNCTION ("Resp_tPlusCPBW_W() Not Implemented");
2657
2658 return 0; /* Ok */
2659 }
2660
2661 int Resp_sPercentCPCFU(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2662 {
2663 TRACE_FUNCTION ("Resp_sPercentCPCFU()");
2664
2665 if(resp_p->response.ptr_set_percent_cpcfu->status EQ BAT_P_CPCFU_STATUS_ACTIVATED)
2666 {
2667 sprintf(g_sa, "%s: %d,%d", "%CPCFU", CPHS_FLAG_ACTIVATED,
2668 resp_p->response.ptr_set_percent_cpcfu->line);
2669 }
2670 else
2671 {
2672 sprintf(g_sa, "%s: %d", "%CPCFU", CPHS_FLAG_DEACTIVATED);
2673 }
2674
2675 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2676
2677 return 0; /* Ok */
2678 }
2679
2680 int Resp_qPercentCPHS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2681 {
2682 TRACE_FUNCTION ("Resp_qPercentCPHS() ");
2683
2684 sprintf(g_sa, "%s%d", "%CPHS: ",
2685 resp_p->response.ptr_que_percent_cphs->init_mode);
2686 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2687
2688 return 0; /* Ok */
2689 }
2690
2691 int Resp_qPlusCPIN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2692 {
2693 TRACE_FUNCTION ("Resp_qPlusCPIN() ");
2694
2695 rCI_PlusCPIN(resp_p->response.ptr_que_plus_cpin->code);
2696
2697 return 0; /* Ok */
2698 }
2699
2700 int Resp_qPercentCPINF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2701 {
2702 TRACE_FUNCTION ("Resp_qPercentCPINF()");
2703
2704 if (resp_p->response.ptr_que_percent_cpinf->c_csp > 0)
2705 {
2706 if (resp_p->response.ptr_que_percent_cpinf->c_csp2 > 0)
2707 {
2708 sprintf(g_sa, "%s: %d,\"%04X\",\"%s\",\"%s\"", "%CPINF",
2709 resp_p->response.ptr_que_percent_cpinf->phase,
2710 resp_p->response.ptr_que_percent_cpinf->sst,
2711 resp_p->response.ptr_que_percent_cpinf->csp,
2712 resp_p->response.ptr_que_percent_cpinf->csp2);
2713 }
2714 else
2715 {
2716 sprintf(g_sa, "%s: %d,\"%04X\",\"%s\"", "%CPINF",
2717 resp_p->response.ptr_que_percent_cpinf->phase,
2718 resp_p->response.ptr_que_percent_cpinf->sst,
2719 resp_p->response.ptr_que_percent_cpinf->csp);
2720 }
2721
2722 }
2723 else
2724 {
2725 sprintf(g_sa, "%s: %d,\"%04X\"", "%CPINF",
2726 resp_p->response.ptr_que_percent_cpinf->phase,
2727 resp_p->response.ptr_que_percent_cpinf->sst);
2728 }
2729 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2730 return 0; /* Ok */
2731 }
2732
2733 int Resp_qPercentCPMB(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2734 {
2735 TRACE_FUNCTION ("Resp_qPercentCPMB()");
2736
2737 sprintf(g_sa,"%s: %d","%CPMB",resp_p->response.ptr_que_percent_cpmb->first);
2738 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2739
2740 return(0); /* Ok */
2741 }
2742
2743 int Resp_sPercentCPMB(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2744 {
2745 CHAR number[BAT_MAX_CPMB_NUMBER_LEN + 1] = {'\0'};
2746 CHAR* p_number;
2747 CHAR alpha_id[BAT_MAX_CPMB_ALPHA_ID_LEN + 1] = {'\0'};
2748 CHAR* p_alpha_id;
2749 T_BAT_res_set_percent_cpmb *cpmb;
2750
2751 TRACE_FUNCTION ("Resp_sPercentCPMB()");
2752
2753 /*
2754 * Get a pointer to the CPMB structure for convenience.
2755 */
2756 cpmb=resp_p->response.ptr_set_percent_cpmb;
2757
2758 /*
2759 * Don't output anything if there is no actual number. This is in line
2760 * with the existing ATI implementation (see setatPercentCPMB()) and
2761 * is necessary in order to pass tests such as ACI583.
2762 */
2763 if (cpmb->v_number EQ FALSE)
2764 return(0);
2765
2766 p_number = number;
2767 p_alpha_id = alpha_id ;
2768
2769 /*
2770 * Zero the arrays to ensure that we end up with null-terminated
2771 * strings following the memcpy.
2772 */
2773 memset(number,0,sizeof(number));
2774 memset(alpha_id,0,sizeof(alpha_id));
2775
2776 if ((cpmb->v_number NEQ FALSE) AND (cpmb->c_number<=BAT_MAX_CPMB_NUMBER_LEN))
2777 memcpy(number,cpmb->number,cpmb->c_number);
2778 else
2779 p_number = NULL;
2780
2781 if ((cpmb->v_alpha_id NEQ FALSE) AND (cpmb->c_alpha_id<=BAT_MAX_CPMB_ALPHA_ID_LEN))
2782 memcpy(alpha_id,cpmb->alpha_id,cpmb->c_alpha_id);
2783 else
2784 p_alpha_id = NULL;
2785
2786 sprintf(g_sa,"%s: %d,%d,\"%s\",%d,\"%s\"", "%CPMB",
2787 resp_p->response.ptr_set_percent_cpmb->record_id,
2788 resp_p->response.ptr_set_percent_cpmb->line,
2789 p_number,
2790 resp_p->response.ptr_set_percent_cpmb->type,
2791 p_alpha_id);
2792 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2793
2794 return 0; /* Ok */
2795 }
2796
2797 int Resp_tPercentCPMBW(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2798 {
2799 char *me = "%CPMBW: ";
2800 TRACE_FUNCTION ("Resp_tPercentCPMBW() ");
2801
2802 sprintf(g_sa,"%s(%d-%d),%d,%s,%d",me,
2803 resp_p->response.ptr_tst_percent_cpmbw->min_rec_id,
2804 resp_p->response.ptr_tst_percent_cpmbw->max_rec_id,
2805 resp_p->response.ptr_tst_percent_cpmbw->nlength,
2806 "(128-201)",
2807 resp_p->response.ptr_tst_percent_cpmbw->tlength);
2808 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2809
2810 return 0; /* Ok */
2811 }
2812
2813 int Resp_tPercentCPMBW_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2814 {
2815 TRACE_FUNCTION ("Resp_tPercentCPMBW_W() Not Implemented");
2816
2817 return 0; /* Ok */
2818 }
2819
2820 int Resp_sPercentCPMB_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2821 {
2822 TRACE_FUNCTION ("Resp_sPercentCPMB_W() Not Implemented");
2823
2824 return 0; /* Ok */
2825 }
2826
2827
2828 int Resp_sPlusCPMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2829 {
2830 T_ACI_SMS_STOR_OCC mem1;
2831 T_ACI_SMS_STOR_OCC mem2;
2832 T_ACI_SMS_STOR_OCC mem3;
2833
2834 TRACE_FUNCTION ("Resp_sPlusCPMS() ");
2835
2836 mem1.mem = (T_ACI_SMS_STOR)resp_p->response.ptr_set_plus_cpms->mem1;
2837 mem1.total = (SHORT)resp_p->response.ptr_set_plus_cpms->total1;
2838 mem1.used = (SHORT)resp_p->response.ptr_set_plus_cpms->used1;
2839
2840 mem2.mem = (T_ACI_SMS_STOR)resp_p->response.ptr_set_plus_cpms->mem2;
2841 mem2.total = (SHORT)resp_p->response.ptr_set_plus_cpms->total2;
2842 mem2.used = (SHORT)resp_p->response.ptr_set_plus_cpms->used2;
2843
2844 mem3.mem = (T_ACI_SMS_STOR)resp_p->response.ptr_set_plus_cpms->mem3;
2845 mem3.total = (SHORT)resp_p->response.ptr_set_plus_cpms->total3;
2846 mem3.used = (SHORT)resp_p->response.ptr_set_plus_cpms->used3;
2847
2848 rCI_PlusCPMS (&mem1, &mem2, &mem3);
2849
2850 return 0; /* Ok */
2851 }
2852
2853 int Resp_qPlusCPMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2854 {
2855 CHAR* me = "+CPMS: ";
2856 int i = 0;
2857 CHAR memstr1[3] = {0};
2858 CHAR memstr2[3] = {0};
2859 CHAR memstr3[3] = {0};
2860 BOOL f1 = TRUE;
2861 BOOL f2 = TRUE;
2862 BOOL f3 = TRUE;
2863
2864 TRACE_FUNCTION ("Resp_qPlusCPMS() ");
2865
2866 if ( cpmsCallType EQ QAT_CALL )
2867 {
2868 for ( i=0; sms_mem[i].name != NULL; i++ )
2869 {
2870 if ( ( sms_mem[i].stor EQ resp_p->response.ptr_que_plus_cpms->mem1) AND f1 )
2871 {
2872 strcpy ( memstr1, sms_mem[i].name );
2873 f1 = FALSE;
2874 }
2875
2876 if ( ( sms_mem[i].stor EQ resp_p->response.ptr_que_plus_cpms->mem2) AND f2 )
2877 {
2878 strcpy ( memstr2, sms_mem[i].name );
2879 f2 = FALSE;
2880 }
2881
2882 if ( ( sms_mem[i].stor EQ resp_p->response.ptr_que_plus_cpms->mem3) AND f3 )
2883 {
2884 strcpy ( memstr3, sms_mem[i].name );
2885 f3 = FALSE;
2886 }
2887 }
2888 sprintf ( g_sa, "%s\"%s\",%d,%d,\"%s\",%d,%d,\"%s\",%d,%d",
2889 me, memstr1, resp_p->response.ptr_que_plus_cpms->used1, resp_p->response.ptr_que_plus_cpms->total1,
2890 memstr2, resp_p->response.ptr_que_plus_cpms->used2, resp_p->response.ptr_que_plus_cpms->total2,
2891 memstr3, resp_p->response.ptr_que_plus_cpms->used3, resp_p->response.ptr_que_plus_cpms->total3);
2892 }
2893 else
2894 {
2895 sprintf ( g_sa, "%s%d,%d,%d,%d,%d,%d",
2896 me, resp_p->response.ptr_que_plus_cpms->used1, resp_p->response.ptr_que_plus_cpms->total1,
2897 memstr2, resp_p->response.ptr_que_plus_cpms->used2, resp_p->response.ptr_que_plus_cpms->total2,
2898 memstr3, resp_p->response.ptr_que_plus_cpms->used3, resp_p->response.ptr_que_plus_cpms->total3);
2899 }
2900
2901 io_sendMessage ( src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
2902
2903 cpmsCallType = NONE_CALL;
2904 return 0; /* Ok */
2905
2906 }
2907
2908 int Resp_sPercentCPNUMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2909 {
2910 TRACE_FUNCTION ("Resp_sPercentCPNUMS() ");
2911
2912 sprintf(g_sa, "%s%d,\"%s\",\"%s\",%d,%d,%d", "%CPNUMS: ",
2913 resp_p->response.ptr_set_percent_cpnums->element_id,
2914 resp_p->response.ptr_set_percent_cpnums->alpha_tag,
2915 resp_p->response.ptr_set_percent_cpnums->number,
2916 resp_p->response.ptr_set_percent_cpnums->index_level,
2917 resp_p->response.ptr_set_percent_cpnums->premium_flag,
2918 resp_p->response.ptr_set_percent_cpnums->network_flag);
2919
2920 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2921
2922 return 0; /* Ok */
2923 }
2924
2925 int Resp_tPercentCPNUMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2926 {
2927 CHAR alpha_tag[BAT_MAX_CPNUMS_ALPHA_TAG_LEN + 1];
2928 CHAR number[BAT_MAX_CPNUMS_NUMBER_LEN + 1];
2929
2930 TRACE_FUNCTION ("Resp_tPercentCPNUMS() ");
2931
2932 utl_binToHex(resp_p->response.ptr_set_percent_cpnums->alpha_tag,
2933 (SHORT)resp_p->response.ptr_set_percent_cpnums->c_alpha_tag,
2934 alpha_tag);
2935
2936 utl_binToHex(resp_p->response.ptr_set_percent_cpnums->number,
2937 (SHORT)resp_p->response.ptr_set_percent_cpnums->c_number,
2938 number);
2939
2940 sprintf(g_sa, "%s%d,\"%s\",\"%s\",%d,%d,%d", "%CPNUMS: ",
2941 resp_p->response.ptr_tst_percent_cpnums->element_id,
2942 alpha_tag, number,
2943 resp_p->response.ptr_tst_percent_cpnums->index_level,
2944 resp_p->response.ptr_tst_percent_cpnums->premium_flag,
2945 resp_p->response.ptr_tst_percent_cpnums->network_flag);
2946
2947 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
2948
2949 return 0; /* Ok */
2950 }
2951
2952 int Resp_sPercentCPNUMS_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2953 {
2954 TRACE_FUNCTION ("Resp_sPercentCPNUMS_W() Not Implemented");
2955
2956 return 0; /* Ok */
2957 }
2958
2959 int Resp_tPercentCPNUMS_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2960 {
2961 TRACE_FUNCTION ("Resp_tPercentCPNUMS_W() Not Implemented");
2962
2963 return 0; /* Ok */
2964 }
2965
2966 int Resp_qPlusCPOL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
2967 {
2968 T_ACI_CPOL_OPDESC op[2];
2969 T_BAT_res_que_plus_cpol *cpol;
2970
2971 TRACE_FUNCTION ("Resp_qPlusCPOL()");
2972
2973 /*
2974 * Get a pointer to the CPOL structure for convenience.
2975 */
2976 cpol=resp_p->response.ptr_que_plus_cpol;
2977
2978 /*
2979 * This represents a termination of the list of operators
2980 * as far as rCI_PlusCPOL() is concerned. In this case
2981 * our list contains only a single operator.
2982 */
2983 op[1].index=ACI_NumParmNotPresent;
2984
2985 /*
2986 * Convert the operator name into a null terminated string,
2987 * which is what the ATI expects.
2988 */
2989 memset(op[0].oper,0,MAX_ALPHA_OPER_LEN);
2990 if (cpol->c_oper>=MAX_ALPHA_OPER_LEN)
2991 memcpy(op[0].oper,cpol->oper,MAX_ALPHA_OPER_LEN-1);
2992 else
2993 memcpy(op[0].oper,cpol->oper,cpol->c_oper);
2994
2995 /*
2996 * This relies on T_ACI_CPOL_FRMT being identical to
2997 * T_BAT_plus_cpol_format.
2998 */
2999 op[0].format=(T_ACI_CPOL_FRMT)cpol->format;
3000
3001 op[0].index=(SHORT)cpol->index;
3002
3003 rCI_PlusCPOL(
3004 ACI_NumParmNotPresent,
3005 ACI_NumParmNotPresent,
3006 op,
3007 ACI_NumParmNotPresent);
3008 return 0; /* Ok */
3009 }
3010
3011 int Resp_tPlusCPOL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3012 {
3013 TRACE_FUNCTION ("Resp_tPlusCPOL()");
3014
3015 rCI_PlusCPOL((SHORT)resp_p->response.ptr_tst_plus_cpol->index1,
3016 (SHORT)resp_p->response.ptr_tst_plus_cpol->index2,
3017 NULL,
3018 ACI_NumParmNotPresent);
3019
3020 return 0; /* Ok */
3021 }
3022
3023 int Resp_qPlusCPOL_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3024 {
3025 TRACE_FUNCTION ("Resp_qPlusCPOL_W() Not Implemented");
3026
3027 return 0; /* Ok */
3028 }
3029
3030 int Resp_tPlusCPOL_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3031 {
3032 TRACE_FUNCTION ("Resp_tPlusCPOL_W() Not Implemented");
3033
3034 return 0; /* Ok */
3035 }
3036
3037 int Resp_qPercentCPOPN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3038 {
3039 CHAR long_name[BAT_MAX_CPOPN_LONG_NAME_LEN + 1];
3040 CHAR short_name[BAT_MAX_CPOPN_SHORT_NAME_LEN + 1];
3041
3042 TRACE_FUNCTION ("Resp_qPercentCPOPN() ");
3043
3044 utl_binToHex(resp_p->response.ptr_que_percent_cpopn->long_name,
3045 (SHORT)resp_p->response.ptr_que_percent_cpopn->c_long_name,
3046 long_name);
3047
3048 if(resp_p->response.ptr_que_percent_cpopn->v_short_name)
3049 utl_binToHex(resp_p->response.ptr_que_percent_cpopn->short_name,
3050 (SHORT)resp_p->response.ptr_que_percent_cpopn->c_short_name,
3051 short_name);
3052
3053 if ( resp_p->response.ptr_que_percent_cpopn->v_short_name)
3054 {
3055 sprintf(g_sa, "%s: \"%s\",\"%s\"", "%CPOPN", long_name, short_name);
3056 }
3057 else
3058 {
3059 sprintf(g_sa, "%s: \"%s\"", "%CPOPN", long_name);
3060 }
3061 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3062
3063 return 0; /* Ok */
3064 }
3065
3066 int Resp_qPercentCPRSM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3067 {
3068 char *me = "%CPRSM";
3069 TRACE_FUNCTION ("Resp_qPercentCPRSM()");
3070
3071 sprintf(g_sa,"%s: %d", me, resp_p->response.ptr_que_percent_cprsm->mode);
3072 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3073
3074 return 0; /* Ok */
3075 }
3076
3077 int Resp_qPlusCPUC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3078 {
3079 char currency [BAT_MAX_CPUC_CURRENCY_LEN+1] = {0x00};
3080 char cvtdCurrency [2*BAT_MAX_CPUC_CURRENCY_LEN+1] = {0x00};
3081 USHORT lenCurrency = 0;
3082 USHORT lenCvtdCurrency = 0;
3083 USHORT pos = 0;
3084 char ppu [BAT_MAX_CPUC_PPU_LEN+1] = {0x00};
3085
3086 TRACE_FUNCTION ("Resp_qPlusCPUC()");
3087 utl_binToHex(resp_p->response.ptr_que_plus_cpuc->currency,
3088 (SHORT)resp_p->response.ptr_que_plus_cpuc->c_currency,
3089 currency);
3090 utl_binToHex(resp_p->response.ptr_que_plus_cpuc->ppu,
3091 (SHORT)resp_p->response.ptr_que_plus_cpuc->c_ppu,
3092 ppu);
3093 utl_chsetFromGsm((UBYTE*)currency,
3094 (USHORT)strlen(currency),
3095 (UBYTE*)cvtdCurrency,
3096 sizeof(cvtdCurrency),
3097 &lenCvtdCurrency,
3098 GSM_ALPHA_Def);
3099 pos = sprintf(g_sa,"+CPUC: ");
3100 pos += sprints(g_sa+pos,cvtdCurrency,lenCvtdCurrency);
3101 pos += sprintf(g_sa+pos,",\"%s\"",ppu);
3102 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3103
3104 return 0; /* Ok */
3105 }
3106
3107 int Resp_qPlusCPUC_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3108 {
3109 TRACE_FUNCTION ("Resp_qPlusCPUC_W() Not Implemented");
3110
3111 return 0; /* Ok */
3112 }
3113
3114 int Resp_sPercentCPVWI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3115 {
3116 TRACE_FUNCTION ("Resp_sPercentCPVWI()");
3117
3118 if(resp_p->response.ptr_set_percent_cpvwi->status EQ BAT_P_CPVWI_FLAG_ACTIVATED)
3119
3120 sprintf(g_sa, "%s: %d,%d", "%CPVWI", resp_p->response.ptr_set_percent_cpvwi->status,
3121 resp_p->response.ptr_set_percent_cpvwi->line);
3122 else
3123 sprintf(g_sa, "%s: %d", "%CPVWI", resp_p->response.ptr_set_percent_cpvwi->status);
3124
3125 io_sendMessage((UBYTE)src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3126
3127
3128 return 0; /* Ok */
3129 }
3130
3131 int Resp_qPercentCREG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3132 {
3133 T_ATI_CREG_MOD mode;
3134 T_ACI_CREG_STAT stat;
3135 short pos;
3136 TRACE_FUNCTION ("Resp_qPercentCREG() ");
3137 /*
3138 r_plus_percent_CREG ( src_infos_psi->srcId,
3139 resp_p->response.ptr_que_percent_creg->stat,
3140 (USHORT)resp_p->response.ptr_que_percent_creg->lac,
3141 (USHORT)resp_p->response.ptr_que_percent_creg->ci,
3142 PercentCREG_CMD,
3143 resp_p->response.ptr_que_percent_creg->gprs_ind,
3144 FALSE );
3145 */
3146
3147 mode = ati_user_output_cfg[src_infos_psi->srcId].percent_creg.mod_lac_cid.pres_mode;
3148 stat = resp_p->response.ptr_que_percent_creg->stat;
3149
3150 pos = sprintf(g_sa, "%s: %d,%d", "%CREG", mode, stat);
3151
3152 if ((mode EQ CREG_MOD_LOC_INF_ON) AND
3153 (stat EQ CREG_STAT_Reg OR stat EQ CREG_STAT_Roam))
3154 {
3155 pos += sprintf(g_sa+pos, ",\"%04X\",\"%04X\"",
3156 (USHORT)resp_p->response.ptr_que_percent_creg->lac,
3157 (USHORT)resp_p->response.ptr_que_percent_creg->ci);
3158 }
3159 else
3160 {
3161 pos += sprintf(g_sa+pos, ",,");
3162 }
3163
3164 sprintf(g_sa+pos,",%d", resp_p->response.ptr_que_percent_creg->gprs_ind);
3165
3166 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3167
3168 return 0; /* Ok */
3169 }
3170
3171 int Resp_tPlusCRES(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3172 {
3173 TRACE_FUNCTION ("Resp_tPlusCRES() some error no min filed present!!!");
3174
3175 sprintf ( g_sa, "+CRES: (%d-%d)",resp_p->response.ptr_tst_plus_cres->max,
3176 /*need a min filed*/
3177 resp_p->response.ptr_tst_plus_cres->max);
3178 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
3179
3180 return 0; /* Ok */
3181 }
3182
3183 int Resp_qPlusCRLP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3184 {
3185 TRACE_FUNCTION ("Resp_qPlusCRLP()");
3186
3187 resp_disp(src_infos_psi->srcId,NULL,"ssss",&(resp_p->response.ptr_que_plus_crlp->iws),
3188 &(resp_p->response.ptr_que_plus_crlp->mws),
3189 &(resp_p->response.ptr_que_plus_crlp->t1),
3190 &(resp_p->response.ptr_que_plus_crlp->n2));
3191
3192 return 0; /* Ok */
3193 }
3194
3195 int Resp_sPlusCRSM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3196 {
3197 T_BAT_res_set_plus_crsm *crsm;
3198
3199 TRACE_FUNCTION ("Resp_sPlusCRSM() ");
3200 /*
3201 * Get a pointer to the CRSM structure for convenience.
3202 */
3203 crsm=resp_p->response.ptr_set_plus_crsm;
3204 rCI_PlusCRSM(
3205 (SHORT)crsm->sw1,
3206 (SHORT)crsm->sw2,
3207 (SHORT)crsm->c_response,
3208 (UBYTE *)crsm->response);
3209 return 0; /* Ok */
3210 }
3211
3212 int Resp_tPlusCSAS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3213 {
3214 TRACE_FUNCTION ("Resp_tPlusCSAS() ");
3215
3216 sprintf ( g_sa, "+CSAS: (0-%d)", resp_p->response.ptr_tst_plus_csas->max - 1 );
3217 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
3218
3219 return 0; /* Ok */
3220 }
3221
3222 int Resp_qPlusCSCA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3223 {
3224 CHAR sca[MAX_SMS_NUM_LEN] = {'\0'};
3225 T_ACI_TOA tosca;
3226 TRACE_FUNCTION ("Resp_qPlusCSCA() ");
3227
3228 /* utl_binToHex(resp_p->response.ptr_que_plus_csca->sca,
3229 (SHORT)resp_p->response.ptr_que_plus_csca->c_sca,
3230 sca);
3231 */
3232 if (resp_p->response.ptr_que_plus_csca->c_sca > 0)
3233 {
3234 memcpy(sca,
3235 resp_p->response.ptr_que_plus_csca->sca,
3236 (SHORT)resp_p->response.ptr_que_plus_csca->c_sca);
3237 }
3238
3239 tosca=toa_demerge((SHORT)resp_p->response.ptr_que_plus_csca->tosca);
3240 sprintf(g_sa, "+CSCA: \"%s%s\",%d", (tosca.ton EQ TON_International)?"+":"",
3241 sca, resp_p->response.ptr_que_plus_csca->tosca);
3242 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3243
3244 return 0; /* Ok */
3245 }
3246
3247 int Resp_qPlusCSCB(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3248 {
3249 int i, pos;
3250 char mids_str[6*BAT_MAX_IDENTS+1]={'\0'};
3251 char dcss_str[4*BAT_MAX_IDENTS+1]={'\0'};
3252
3253 TRACE_FUNCTION ("Resp_qPlusCSCB()");
3254
3255 /* assemble the string for message identifiers */
3256 pos = i = 0;
3257 while ((resp_p->response.ptr_que_plus_cscb->mids[i] NEQ 0xFFFF)
3258 AND (resp_p->response.ptr_que_plus_cscb->mids[i+1] NEQ 0xFFFF)
3259 AND (i < BAT_MAX_IDENTS-1))
3260 {
3261 if (resp_p->response.ptr_que_plus_cscb->mids[i] EQ resp_p->response.ptr_que_plus_cscb->mids[i+1])
3262 {
3263 pos += sprintf ( mids_str + pos, "%d,", resp_p->response.ptr_que_plus_cscb->mids[i] );
3264 }
3265 else
3266 {
3267 pos += sprintf ( mids_str + pos, "%d-%d,", resp_p->response.ptr_que_plus_cscb->mids[i],
3268 resp_p->response.ptr_que_plus_cscb->mids[i+1] );
3269 }
3270 i += 2;
3271 }
3272
3273 if (pos > 0) /* remove the last ',' */
3274 {
3275 mids_str[pos-1] = '\0';
3276 }
3277
3278 /* assemble the string for data coding schemes */
3279 pos = i = 0;
3280
3281 while ((resp_p->response.ptr_que_plus_cscb->dcss[i] NEQ 0xFF)
3282 AND (resp_p->response.ptr_que_plus_cscb->dcss[i+1] NEQ 0xFF)
3283 AND (i < BAT_MAX_IDENTS-1))
3284 {
3285 if (resp_p->response.ptr_que_plus_cscb->dcss[i] EQ resp_p->response.ptr_que_plus_cscb->dcss[i+1])
3286 {
3287 pos += sprintf(dcss_str + pos, "%d,", resp_p->response.ptr_que_plus_cscb->dcss[i]);
3288 }
3289 else
3290 {
3291 pos += sprintf(dcss_str + pos, "%d-%d,", resp_p->response.ptr_que_plus_cscb->dcss[i],
3292 resp_p->response.ptr_que_plus_cscb->dcss[i+1]);
3293 }
3294 i += 2;
3295 }
3296
3297 if (pos > 0) /* remove the last ',' */
3298 {
3299 dcss_str[pos-1] = '\0';
3300 }
3301
3302 sprintf(g_sa,"+CSCB: %d,\"%s\",\"%s\"",resp_p->response.ptr_que_plus_cscb->mode,mids_str,dcss_str);
3303 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3304 return 0; /* Ok */
3305 }
3306
3307 int Resp_qPlusCSCS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3308 {
3309 TRACE_FUNCTION ("Resp_qPlusCSCS()");
3310
3311 strcpy ( g_sa, "+CSCS: ");
3312
3313 switch (resp_p->response.ptr_que_plus_cscs->cs)
3314 {
3315 case (BAT_CSCS_CS_IRA ): strcat (g_sa,"\"IRA\"" ); break;
3316 case (BAT_CSCS_CS_PCDN ): strcat (g_sa,"\"PCDN\"" ); break;
3317 case (BAT_CSCS_CS_8859_1 ): strcat (g_sa,"\"8859-1\"" ); break;
3318 case (BAT_CSCS_CS_PCCP_437): strcat (g_sa,"\"PCCP437\""); break;
3319 case (BAT_CSCS_CS_GSM ): strcat (g_sa,"\"GSM\"" ); break;
3320 case (BAT_CSCS_CS_HEX ): strcat (g_sa,"\"HEX\"" ); break;
3321 case (BAT_CSCS_CS_UCS2 ): strcat (g_sa,"\"UCS2\"" ); break;
3322
3323 default:
3324 /*
3325 * It's probably best to do nothing at all at this point. An
3326 * error message would just confuse the issue as aci_bat_wrapper()
3327 * will cause an OK to be sent and we can't stop it now.
3328 * Shouldn't get here anyway.
3329 */
3330 cmdErrStr=NULL;
3331 return(0);
3332 }
3333
3334 io_sendMessage(src_infos_psi->srcId,g_sa,ATI_NORMAL_OUTPUT);
3335
3336 return 0; /* Ok */
3337 }
3338
3339 int Resp_sPlusCSIM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3340 {
3341 T_BAT_res_set_plus_csim *csim;
3342
3343 TRACE_FUNCTION ("Resp_sPlusCSIM()");
3344 /*
3345 * Get a pointer to the CSIM structure for convenience.
3346 */
3347 csim=resp_p->response.ptr_set_plus_csim;
3348 rCI_PlusCSIM(
3349 (SHORT)csim->c_response,
3350 (UBYTE *)csim->response);
3351 return 0; /* Ok */
3352 }
3353
3354 int Resp_qPlusCSMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3355 {
3356 TRACE_FUNCTION ("Resp_qPlusCSMS()");
3357 sprintf(g_sa,"+CSMS: %d,%d,%d,%d",resp_p->response.ptr_que_plus_csms->service,
3358 resp_p->response.ptr_que_plus_csms->mt,resp_p->response.ptr_que_plus_csms->mo,
3359 resp_p->response.ptr_que_plus_csms->bm);
3360 io_sendMessage(src_infos_psi->srcId,g_sa, ATI_NORMAL_OUTPUT);
3361
3362 return 0; /* Ok */
3363 }
3364
3365 int Resp_qPlusCSNS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3366 {
3367 TRACE_FUNCTION ("Resp_qPlusCSNS()");
3368 resp_disp (src_infos_psi->srcId, NULL,"e",&resp_p->response.ptr_que_plus_csns->mode);
3369
3370 return 0; /* Ok */
3371 }
3372
3373 int Resp_qPercentCSQ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3374 {
3375 TRACE_FUNCTION ("Resp_qPercentCSQ()");
3376 sprintf (g_sa, "%s %d, %d, %d", "%CSQ: ",resp_p->response.ptr_que_percent_csq->rssi,
3377 resp_p->response.ptr_que_percent_csq->ber, resp_p->response.ptr_que_percent_csq->actlevel);
3378 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3379
3380 return 0; /* Ok */
3381 }
3382
3383 int Resp_sPlusCSQ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3384 {
3385 TRACE_FUNCTION ("Resp_sPlusCSQ()");
3386
3387 sprintf (g_sa, "+CSQ: %d,%d ", resp_p->response.ptr_set_plus_csq->rssi,
3388 resp_p->response.ptr_set_plus_csq->ber );
3389 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3390
3391 return 0; /* Ok */
3392 }
3393
3394 int Resp_qPlusCSTA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3395 {
3396 TRACE_FUNCTION ("Resp_qPlusCSTA()");
3397 resp_disp(src_infos_psi->srcId, NULL,"s",&resp_p->response.ptr_que_plus_csta->type);
3398
3399 return 0; /* Ok */
3400 }
3401
3402 int Resp_qPlusCSVM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3403 {
3404 CHAR num[BAT_MAX_CSVM_NUMBER_LEN+1];
3405
3406 TRACE_FUNCTION ("Resp_qPlusCSVM()");
3407 /*
3408 * Get a pointer to the CSVM structure for convenience.
3409 */
3410 memset(num,0,sizeof(num));
3411 utl_binToHex(resp_p->response.ptr_que_plus_csvm->number,
3412 resp_p->response.ptr_que_plus_csvm->c_number, num);
3413 sprintf(g_sa,"+CSVM: %d,\"%s\",%d",resp_p->response.ptr_que_plus_csvm->mode,
3414 num,resp_p->response.ptr_que_plus_csvm->type);
3415 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3416 return 0; /* Ok */
3417 }
3418
3419 int Resp_qPercentCTTY(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3420 {
3421 TRACE_FUNCTION ("Resp_qPercentCTTY()");
3422 if (resp_p->response.ptr_que_percent_ctty->trx EQ CTTY_TRX_Unknown)
3423 resp_disp (src_infos_psi->srcId,NULL,"ee",
3424 &resp_p->response.ptr_que_percent_ctty->req,
3425 &resp_p->response.ptr_que_percent_ctty->m);
3426 else
3427 resp_disp (src_infos_psi->srcId, NULL ,"eee", &resp_p->response.ptr_que_percent_ctty->req,
3428 &resp_p->response.ptr_que_percent_ctty->m, &resp_p->response.ptr_que_percent_ctty->trx);
3429
3430 return 0; /* Ok */
3431 }
3432
3433 int Resp_qPlusCTZU(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3434 {
3435 TRACE_FUNCTION ("Resp_qPlusCTZU() ");
3436 sprintf(g_sa,"+CTZU: %d", resp_p->response.ptr_que_plus_ctzu->onoff);
3437 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3438
3439 return 0; /* Ok */
3440 }
3441
3442 int Resp_qPercentCUST(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3443 {
3444 TRACE_FUNCTION ("Resp_qPercentCUST()");
3445 sprintf(g_sa,"%CUST: %d", resp_p->response.ptr_que_percent_cust->mode);
3446 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3447
3448 return 0; /* Ok */
3449 }
3450
3451 int Resp_qPercentSATCC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3452 {
3453 TRACE_FUNCTION ("Resp_qPercentSATCC()");
3454 sprintf(g_sa,"%%SATCC: %d", resp_p->response.ptr_que_percent_satcc->mode);
3455 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3456
3457 return 0; /* Ok */
3458 }
3459
3460 int Resp_qPercentDATA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3461 {
3462 char *pktioName = "PKTIO";
3463 char* des_name;
3464 char* src_name;
3465 T_CAP_ID capability = DEV_CPBLTY_NONE;
3466
3467 TRACE_FUNCTION ("Resp_qPercentDATA() ");
3468
3469 des_name = dti_entity_name[resp_p->response.ptr_que_percent_data->des_dev_name].name;
3470 src_name = dti_entity_name[resp_p->response.ptr_que_percent_data->src_dev_name].name;
3471 capability = map_dti_cpblty((U8)resp_p->response.ptr_que_percent_data->capability);
3472
3473 #ifdef GPRS
3474 if (resp_p->response.ptr_que_percent_data->des_dev_name
3475 EQ BAT_DEV_NAME_PKTIO)
3476 {
3477 des_name = pktioName;
3478 }
3479
3480 if (resp_p->response.ptr_que_percent_data->src_dev_name
3481 EQ BAT_DEV_NAME_PKTIO)
3482 {
3483 src_name = pktioName;
3484 }
3485 #endif
3486
3487 sprintf (g_sa,"%s: %d,\"%s\",%d,%d,\"%s\",\"%s\",%d,%d,%d",
3488 "%DATA",
3489 resp_p->response.ptr_que_percent_data->mode,
3490 des_name,
3491 resp_p->response.ptr_que_percent_data->des_dev_no,
3492 resp_p->response.ptr_que_percent_data->des_sub_no,
3493 ati_cap_name[capability].name,
3494 src_name,
3495 resp_p->response.ptr_que_percent_data->src_dev_no,
3496 resp_p->response.ptr_que_percent_data->src_sub_no,
3497 resp_p->response.ptr_que_percent_data->cid);
3498
3499 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3500
3501 return 0; /* Ok */
3502 }
3503
3504
3505 int Resp_sPercentDINF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3506 {
3507 T_CAP_ID capability = DEV_CPBLTY_NONE;
3508 T_CAP_ID cur_cap = DEV_CPBLTY_NONE;
3509
3510 TRACE_FUNCTION ("Resp_sPercentDINF() IMPLEMENTED but without outputing mode !");
3511 capability = map_dti_cpblty((U8)(resp_p->response.ptr_set_percent_dinf->cap));
3512 cur_cap = map_dti_cpblty((U8)(resp_p->response.ptr_set_percent_dinf->cur_cap));
3513
3514 sprintf (g_sa,"%s:\"%s\",%d,%d,\"%s\",\"%s\"", "%DINF",
3515 dti_entity_name[(resp_p->response.ptr_set_percent_dinf->dev_name)].name,
3516 resp_p->response.ptr_set_percent_dinf->dev_no,
3517 resp_p->response.ptr_set_percent_dinf->sub_no,
3518 ati_cap_name[capability].name,
3519 ati_cap_name[cur_cap].name
3520 /*mode*/);
3521 /* dont know how to get mode?? */
3522 /*shd we call qBAT_PercentDINF??*/
3523
3524 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3525 return 0;
3526 }
3527
3528
3529 int Resp_qPlusDS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3530 {
3531 TRACE_FUNCTION ("Resp_qPlusDS()");
3532 resp_disp(src_infos_psi->srcId,NULL,"eels",&resp_p->response.ptr_que_plus_ds->dir,
3533 &resp_p->response.ptr_que_plus_ds->neg,
3534 &resp_p->response.ptr_que_plus_ds->p1,
3535 &resp_p->response.ptr_que_plus_ds->p2);
3536 return 0; /* Ok */
3537 }
3538
3539 int Resp_qPlusFAP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3540 {
3541 TRACE_FUNCTION ("Resp_qPlusFAP()");
3542
3543 return 0; /* Ok */
3544 }
3545
3546 int Resp_qPlusFBO(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3547 {
3548 TRACE_FUNCTION ("Resp_qPlusFBO()");
3549
3550 return 0; /* Ok */
3551 }
3552
3553 int Resp_qPlusFBS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3554 {
3555 TRACE_FUNCTION ("Resp_qPlusFBS()");
3556
3557 return 0; /* Ok */
3558 }
3559
3560 int Resp_qPlusFBU(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3561 {
3562 TRACE_FUNCTION ("Resp_qPlusFBU()");
3563
3564 return 0; /* Ok */
3565 }
3566
3567 int Resp_qPlusFCC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3568 {
3569 TRACE_FUNCTION ("Resp_qPlusFCC()");
3570
3571 return 0; /* Ok */
3572 }
3573
3574 int Resp_qPlusFCLASS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3575 {
3576 TRACE_FUNCTION ("Resp_qPlusFCLASS()");
3577
3578 return 0; /* Ok */
3579 }
3580
3581 int Resp_qPlusFCQ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3582 {
3583 TRACE_FUNCTION ("Resp_qPlusFCQ()");
3584
3585 return 0; /* Ok */
3586 }
3587
3588 int Resp_qPlusFCR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3589 {
3590 TRACE_FUNCTION ("Resp_qPlusFCR()");
3591
3592 return 0; /* Ok */
3593 }
3594
3595
3596 int Resp_qPlusFCS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3597 {
3598 TRACE_FUNCTION ("Resp_qPlusFCS()");
3599
3600 return 0; /* Ok */
3601 }
3602
3603 int Resp_qPlusFCT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3604 {
3605 TRACE_FUNCTION ("Resp_qPlusFCT()");
3606
3607 return 0; /* Ok */
3608 }
3609
3610 int Resp_qPlusFEA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3611 {
3612 TRACE_FUNCTION ("Resp_qPlusFEA()");
3613
3614 return 0; /* Ok */
3615 }
3616
3617 int Resp_qPlusFFC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3618 {
3619 TRACE_FUNCTION ("Resp_qPlusFFC()");
3620
3621 return 0; /* Ok */
3622 }
3623
3624 int Resp_qPlusFHS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3625 {
3626 TRACE_FUNCTION ("Resp_qPlusFHS()");
3627
3628 return 0; /* Ok */
3629 }
3630
3631 int Resp_qPlusFIE(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3632 {
3633 TRACE_FUNCTION ("Resp_qPlusFIE()");
3634
3635 return 0; /* Ok */
3636 }
3637
3638 int Resp_qPlusFIS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3639 {
3640 TRACE_FUNCTION ("Resp_qPlusFIS()");
3641
3642 return 0; /* Ok */
3643 }
3644
3645 int Resp_qPlusFIT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3646 {
3647 TRACE_FUNCTION ("Resp_qPlusFIT()");
3648
3649 return 0; /* Ok */
3650 }
3651
3652 int Resp_qPlusFLI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3653 {
3654 TRACE_FUNCTION ("Resp_qPlusFLI()");
3655
3656 return 0; /* Ok */
3657 }
3658
3659 int Resp_qPlusFLO(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3660 {
3661 TRACE_FUNCTION ("Resp_qPlusFLO()");
3662
3663 return 0; /* Ok */
3664 }
3665
3666 int Resp_qPlusFLP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3667 {
3668 TRACE_FUNCTION ("Resp_qPlusFLP()");
3669
3670 return 0; /* Ok */
3671 }
3672
3673 int Resp_qPlusFMS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3674 {
3675 TRACE_FUNCTION ("Resp_qPlusFMS()");
3676
3677 return 0; /* Ok */
3678 }
3679
3680 int Resp_qPlusFNS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3681 {
3682 TRACE_FUNCTION ("Resp_qPlusFNS()");
3683
3684 return 0; /* Ok */
3685 }
3686
3687 int Resp_qPlusFPA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3688 {
3689 TRACE_FUNCTION ("Resp_qPlusFPA()");
3690
3691 return 0; /* Ok */
3692 }
3693
3694 int Resp_qPlusFPI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3695 {
3696 TRACE_FUNCTION ("Resp_qPlusFPI()");
3697
3698 return 0; /* Ok */
3699 }
3700
3701 int Resp_qPlusFPS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3702 {
3703 TRACE_FUNCTION ("Resp_qPlusFPS()");
3704
3705 return 0; /* Ok */
3706 }
3707
3708 int Resp_qPlusFPW(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3709 {
3710 TRACE_FUNCTION ("Resp_qPlusFPW()");
3711
3712 return 0; /* Ok */
3713 }
3714
3715 int Resp_qPlusFRQ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3716 {
3717 TRACE_FUNCTION ("Resp_qPlusFRQ()");
3718
3719 return 0; /* Ok */
3720 }
3721
3722 int Resp_qPlusFSA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3723 {
3724 TRACE_FUNCTION ("Resp_qPlusFSA()");
3725
3726 return 0; /* Ok */
3727 }
3728
3729 int Resp_qPlusFSP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3730 {
3731 TRACE_FUNCTION ("Resp_qPlusFSP()");
3732
3733 sprintf(g_sa,"+FSP:%d",resp_p->response.ptr_que_plus_fsp->poll);
3734 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3735
3736 return 0; /* Ok */
3737 }
3738
3739 int Resp_qPlusICF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3740 {
3741 T_ACI_BS_FRM format;
3742 T_ACI_BS_PAR parity;
3743 T_BAT_res_que_plus_icf *icf;
3744 TRACE_FUNCTION ("Resp_qPlusICF()");
3745 /*
3746 * Get a pointer to the ICF structure for convenience.
3747 */
3748 icf=resp_p->response.ptr_que_plus_icf;
3749 /*
3750 * This relies on T_ACI_BS_FRM being identical to
3751 * T_BAT_framing_format and T_ACI_BS_PAR being identical
3752 * to T_BAT_framing_parity.
3753 */
3754 format=(T_ACI_BS_FRM)icf->framing_format;
3755 parity=(T_ACI_BS_PAR)icf->framing_parity;
3756 if ((format==BS_FRM_Dat8_Par1_St1) || (format==BS_FRM_Dat7_Par1_St1))
3757 resp_disp(src_infos_psi->srcId,NULL,"ee",&format,&parity);
3758 else
3759 resp_disp(src_infos_psi->srcId,NULL,"e",&format);
3760
3761 return 0; /* Ok */
3762 }
3763
3764 int Resp_qPlusIFC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3765 {
3766 TRACE_FUNCTION ("Resp_qPlusIFC()");
3767 sprintf(g_sa,"+IFC: %d,%d", resp_p->response.ptr_que_plus_ifc->by_te,
3768 resp_p->response.ptr_que_plus_ifc->by_ta);
3769 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3770
3771 return 0; /* Ok */
3772 }
3773
3774
3775 int Resp_qPercentIMEI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3776 {
3777 TRACE_FUNCTION ("Resp_qPercentIMEI()");
3778 sprintf ( g_sa,
3779 "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d",
3780 (resp_p->response.ptr_que_percent_imei->tac1 >> 4) & 0x0F,
3781 resp_p->response.ptr_que_percent_imei->tac1 & 0x0F,
3782
3783 (resp_p->response.ptr_que_percent_imei->tac2 >> 4) & 0x0F,
3784 resp_p->response.ptr_que_percent_imei->tac2 & 0x0F,
3785
3786 (resp_p->response.ptr_que_percent_imei->tac3 >> 4) & 0x0F,
3787 resp_p->response.ptr_que_percent_imei->tac3 & 0x0F,
3788
3789 (resp_p->response.ptr_que_percent_imei->fac >> 4) & 0x0F,
3790 resp_p->response.ptr_que_percent_imei->fac & 0x0F,
3791
3792 (resp_p->response.ptr_que_percent_imei->snr1 >> 4) & 0x0F,
3793 resp_p->response.ptr_que_percent_imei->snr1 & 0x0F,
3794
3795 (resp_p->response.ptr_que_percent_imei->snr2 >> 4) & 0x0F,
3796 resp_p->response.ptr_que_percent_imei->snr2 & 0x0F,
3797
3798 (resp_p->response.ptr_que_percent_imei->snr3 >> 4) & 0x0F,
3799 resp_p->response.ptr_que_percent_imei->snr3 & 0x0F,
3800
3801 resp_p->response.ptr_que_percent_imei->cd,
3802 (resp_p->response.ptr_que_percent_imei->svn >> 4) & 0x0F,
3803 resp_p->response.ptr_que_percent_imei->svn & 0x0F );
3804
3805 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
3806 return 0; /* Ok */
3807 }
3808
3809
3810
3811 int Resp_qPlusIPR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3812 {
3813 int rate_value;
3814 TRACE_FUNCTION ("Resp_qPlusIPR()");
3815 switch (resp_p->response.ptr_que_plus_ipr->rate)
3816 {
3817 case BD_RATE_75: rate_value = 75; break;
3818 case BD_RATE_150: rate_value = 150; break;
3819 case BD_RATE_300: rate_value = 300; break;
3820 case BD_RATE_600: rate_value = 600; break;
3821 case BD_RATE_1200: rate_value = 1200; break;
3822 case BD_RATE_2400: rate_value = 2400; break;
3823 case BD_RATE_4800: rate_value = 4800; break;
3824 case BD_RATE_7200: rate_value = 7200; break;
3825 case BD_RATE_9600: rate_value = 9600; break;
3826 case BD_RATE_14400: rate_value = 14400; break;
3827 case BD_RATE_19200: rate_value = 19200; break;
3828 case BD_RATE_28800: rate_value = 28800; break;
3829 case BD_RATE_33900: rate_value = 33900; break;
3830 case BD_RATE_38400: rate_value = 38400; break;
3831 case BD_RATE_57600: rate_value = 57600; break;
3832 case BD_RATE_115200: rate_value = 115200; break;
3833 case BD_RATE_203125: rate_value = 203125; break;
3834 case BD_RATE_406250: rate_value = 406250; break;
3835 case BD_RATE_812500: rate_value = 812500; break;
3836 default: rate_value = 0; break;
3837 }
3838 sprintf(g_sa,"+IPR: %d", rate_value);
3839 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3840 return 0; /* Ok */
3841 }
3842
3843 int Resp_qPercentPBCF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3844 {
3845 CHAR *me="%PBCF: ";
3846
3847 TRACE_FUNCTION ("Resp_qPercentPBCF()");
3848 sprintf(g_sa,"%s%d, %d, %d", me, resp_p->response.ptr_que_percent_pbcf->ldn,
3849 resp_p->response.ptr_que_percent_pbcf->lrn,
3850 resp_p->response.ptr_que_percent_pbcf->lmn);
3851 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3852
3853 return 0; /* Ok */
3854 }
3855
3856 int Resp_qPercentPPP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3857 {
3858 TRACE_FUNCTION ("Resp_qPercentPPP()");
3859 #define IPADDR_BYTE(b, a) (((a) >> ((b) * 8)) & 0xff)
3860
3861 sprintf(g_sa, "%%PPP: %u.%u.%u.%u,%u.%u.%u.%u,%u.%u.%u.%u",
3862 IPADDR_BYTE(3, resp_p->response.ptr_que_percent_ppp->ipaddr),
3863 IPADDR_BYTE(2, resp_p->response.ptr_que_percent_ppp->ipaddr),
3864 IPADDR_BYTE(1, resp_p->response.ptr_que_percent_ppp->ipaddr),
3865 IPADDR_BYTE(0, resp_p->response.ptr_que_percent_ppp->ipaddr),
3866 IPADDR_BYTE(3, resp_p->response.ptr_que_percent_ppp->dns1),
3867 IPADDR_BYTE(2, resp_p->response.ptr_que_percent_ppp->dns1),
3868 IPADDR_BYTE(1, resp_p->response.ptr_que_percent_ppp->dns1),
3869 IPADDR_BYTE(0, resp_p->response.ptr_que_percent_ppp->dns1),
3870 IPADDR_BYTE(3, resp_p->response.ptr_que_percent_ppp->dns2),
3871 IPADDR_BYTE(2, resp_p->response.ptr_que_percent_ppp->dns2),
3872 IPADDR_BYTE(1, resp_p->response.ptr_que_percent_ppp->dns2),
3873 IPADDR_BYTE(0, resp_p->response.ptr_que_percent_ppp->dns2)) ;
3874 io_sendMessage (src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3875 return 0; /* Ok */
3876 }
3877
3878 int Resp_qPercentPVRF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3879 {
3880 T_BAT_res_que_percent_pvrf *pvrf;
3881 CHAR *me="%PVRF: ";
3882 TRACE_FUNCTION ("Resp_qPercentPVRF()");
3883 /*
3884 * Get a pointer to the PVRF structure for convenience.
3885 */
3886 pvrf=resp_p->response.ptr_que_percent_pvrf;
3887
3888 sprintf(g_sa,"%s%d, %d, %d, %d, %d, %d",
3889 me,
3890 pvrf->pn1cnt,
3891 pvrf->pn2cnt,
3892 pvrf->pk1cnt,
3893 pvrf->pk2cnt,
3894 pvrf->ps1,
3895 pvrf->ps2);
3896
3897 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3898
3899 return 0; /* Ok */
3900 }
3901
3902 int Resp_qPercentRDL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3903 {
3904 TRACE_FUNCTION ("Resp_qPercentRDL() ");
3905 resp_disp (src_infos_psi->srcId, NULL,"b",&resp_p->response.ptr_que_percent_rdl->mode);
3906 return 0; /* Ok */
3907 }
3908
3909 int Resp_qPercentRDLB(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3910 {
3911 CHAR number[MAX_CC_CALLED_NUMBER+1];
3912 UBYTE i,j;
3913 USHORT pos = 0;
3914 TRACE_FUNCTION ("Resp_qPercentRDLB() ");
3915 memset(number,0,MAX_CC_CALLED_NUMBER+1);
3916 // resp_disp (srcId, cl,"b", &usr_notif); /* output user notification state */
3917 for(i=0; i<resp_p->response.ptr_que_percent_rdlb->c_number; i++) /* output black list */
3918 {
3919 for(j=0; j<resp_p->response.ptr_que_percent_rdlb->c_number; j++)
3920 {
3921 resp_p->response.ptr_que_percent_rdlb->number[j] = (resp_p->response.ptr_que_percent_rdlb->number[j] | 0x30);
3922 }
3923 utl_binToHex(resp_p->response.ptr_que_percent_rdlb->number,
3924 resp_p->response.ptr_que_percent_rdlb->c_number, number);
3925 pos=sprintf(g_sa,"%s:\"%s\",%d","%RDLB",number,
3926 (int)resp_p->response.ptr_que_percent_rdlb->type);
3927
3928 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3929 }
3930
3931 return 0; /* Ok */
3932 }
3933
3934 #ifdef SIM_TOOLKIT
3935 int Resp_qPercentSATC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3936 {
3937 UBYTE i;
3938 TRACE_FUNCTION ("Resp_qPercentSATC()");
3939
3940 i=sprintf(g_sa,"%s: %d,", "%SATC", sat[src_infos_psi->srcId]);
3941
3942 if (resp_p->response.ptr_que_percent_satc->c_satprfl)
3943 {
3944 utl_binToHex( resp_p->response.ptr_que_percent_satc->satprfl,
3945 resp_p->response.ptr_que_percent_satc->c_satprfl, g_sa +i );
3946 }
3947
3948 i+=resp_p->response.ptr_que_percent_satc->c_satprfl*2;
3949 g_sa[i++]='"';
3950 g_sa[i]='\0';
3951
3952 ci_remTrailCom(g_sa,(USHORT)strlen(g_sa));
3953 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
3954
3955 return 0; /* Ok */
3956 }
3957 #endif /* SIM_TOOLKIT */
3958
3959 #ifdef GPRS
3960 int Resp_qPercentSNCNT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3961 {
3962 TRACE_FUNCTION ("Resp_qPercentSNCNT() ");
3963
3964 rCI_PercentSNCNT ((UBYTE)resp_p->response.ptr_uns_percent_sncnt->cid,
3965 resp_p->response.ptr_uns_percent_sncnt->oct_up,
3966 resp_p->response.ptr_uns_percent_sncnt->oct_down,
3967 resp_p->response.ptr_uns_percent_sncnt->pkt_up,
3968 resp_p->response.ptr_uns_percent_sncnt->pkt_down);
3969
3970 return 0; /* Ok */
3971 }
3972 #endif /* GPRS */
3973
3974 int Resp_qPlusWS46(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3975 {
3976 TRACE_FUNCTION ("Resp_qPlusWS46() ");
3977
3978 resp_disp(src_infos_psi->srcId, NULL,"e",
3979 &resp_p->response.ptr_que_plus_ws46->n);
3980
3981 return 0; /* Ok */
3982 }
3983
3984 int Resp_qPlusCLCC(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
3985 {
3986 SHORT pos = 0;
3987 char *me = "+CLCC: ";
3988 USHORT lenCvtdAlpha = 0;
3989 CHAR number[BAT_MAX_CLCC_NUMBER_LEN + 1];
3990
3991 TRACE_FUNCTION ("Resp_qPlusCLCC() ");
3992
3993 /* Call info is sent at a time, this flag will mark the start and end of this call list */
3994 if(CLCC_flag == FALSE)
3995 CLCC_flag = TRUE;
3996
3997 if(resp_p->response.ptr_que_plus_clcc->idx EQ ACI_NumParmNotPresent)
3998 return 0;
3999
4000 pos = sprintf(g_sa,"%s%d", me, resp_p->response.ptr_que_plus_clcc->idx);
4001
4002 if (resp_p->response.ptr_que_plus_clcc->dir NEQ CLCC_DIR_NotPresent)
4003 pos += sprintf(g_sa+pos,",%d",resp_p->response.ptr_que_plus_clcc->dir);
4004 else
4005 pos += sprintf(g_sa+pos,",");
4006 if (resp_p->response.ptr_que_plus_clcc->stat NEQ CLCC_STAT_NotPresent)
4007 pos += sprintf(g_sa+pos,",%d",resp_p->response.ptr_que_plus_clcc->stat);
4008 else
4009 pos += sprintf(g_sa+pos,",");
4010 if (resp_p->response.ptr_que_plus_clcc->mode NEQ CLCC_MODE_NotPresent)
4011 pos += sprintf(g_sa+pos,",%d",resp_p->response.ptr_que_plus_clcc->mode);
4012 else
4013 pos += sprintf(g_sa+pos,",");
4014 if (resp_p->response.ptr_que_plus_clcc->mpty NEQ CLCC_MPTY_NotPresent)
4015 pos += sprintf(g_sa+pos,",%d",resp_p->response.ptr_que_plus_clcc->mpty);
4016 else
4017 pos += sprintf(g_sa+pos,",");
4018
4019 if (resp_p->response.ptr_que_plus_clcc->number[0] NEQ 0x0)
4020 {
4021 utl_binToHex(resp_p->response.ptr_que_plus_clcc->number,
4022 resp_p->response.ptr_que_plus_clcc->c_number, number);
4023 pos += sprintf(g_sa+pos,",\"%s\",%d",number,(int)(resp_p->response.ptr_que_plus_clcc->type));
4024 }
4025 #ifdef NO_ASCIIZ /* Need to add other struct ?! */
4026 /* if (resp_p->response.ptr_que_plus_clcc->c_alpha.len NEQ 0x0)
4027 {
4028 pos += sprintf(g_sa+pos,",");
4029 utl_chsetFromGsm ( resp_p->response.ptr_que_plus_clcc->alpha.data,
4030 resp_p->response.ptr_que_plus_clcc->alpha.len,
4031 (UBYTE*)cvtdAlpha,
4032 sizeof(cvtdAlpha),
4033 &lenCvtdAlpha,
4034 GSM_ALPHA_Def );
4035 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha );
4036 } */
4037 #else /* #ifdef NO_ASCIIZ */
4038 if (resp_p->response.ptr_que_plus_clcc->alpha[0] NEQ 0x0)
4039 {
4040 pos += sprintf(g_sa+pos,",");
4041 utl_chsetFromGsm ( (UBYTE*)resp_p->response.ptr_que_plus_clcc->alpha,
4042 0,
4043 (UBYTE*)cvtdAlpha,
4044 sizeof(cvtdAlpha),
4045 &lenCvtdAlpha,
4046 GSM_ALPHA_Int );
4047 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha );
4048 }
4049 #endif /* #ifdef NO_ASCIIZ */
4050 ci_remTrailCom(g_sa, pos);
4051 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
4052 return 0; /* Ok */
4053 }
4054
4055
4056 int Resp_uPlusCBM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4057 {
4058 T_MMI_CBCH_IND mmi_cbch_ind ;
4059 TRACE_FUNCTION ("Resp_uPlusCBM() ");
4060
4061 mmi_cbch_ind.cbch_len = resp_p->response.ptr_res_plus_cbm->c_pdu;
4062 memcpy(resp_p->response.ptr_res_plus_cbm->pdu,
4063 mmi_cbch_ind.cbch_msg,
4064 resp_p->response.ptr_res_plus_cbm->c_pdu);
4065
4066 return 0; /* Ok */
4067 }
4068
4069 int Resp_uPlusCBMI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4070 {
4071 TRACE_FUNCTION ("Resp_uPlusCBMI() not implemented");
4072
4073 return 0; /* Ok */
4074 }
4075
4076 int Resp_uPercentCCBS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4077 {
4078 T_ACI_CCBS_IND ind;
4079 T_ACI_CCBS_STAT status;
4080 T_ACI_CCBS_SET setting;
4081 T_BAT_res_uns_percent_ccbs *ccbs;
4082 TRACE_FUNCTION ("Resp_uPercentCCBS()");
4083 /*
4084 * Get a pointer to the CCBS structure for convenience.
4085 */
4086 ccbs=resp_p->response.ptr_res_percent_ccbs;
4087 /*
4088 * This relies on T_ACI_CCBS_IND being identical to
4089 * T_BAT_percent_ccbs_ind and T_ACI_CCBS_STAT being identical
4090 * to T_BAT_percent_ccbs_stat.
4091 */
4092 ind=(T_ACI_CCBS_IND)ccbs->ind;
4093 status=(T_ACI_CCBS_STAT)ccbs->stat;
4094 /*
4095 * The main reason for zeroing this memory is to ensure we
4096 * end up with zero-terminated 'number' and 'subaddress'
4097 * strings.
4098 */
4099 memset(&setting,0,sizeof(T_ACI_CCBS_SET));
4100 setting.idx=(SHORT)ccbs->idx;
4101 if ((ccbs->v_number==TRUE) && (ccbs->c_number<MAX_B_SUBSCR_NUM_LEN))
4102 memcpy(setting.number,ccbs->number,ccbs->c_number);
4103 setting.type=toa_demerge((SHORT)ccbs->type);
4104 if ((ccbs->v_subaddr==TRUE) && (ccbs->c_subaddr<MAX_SUBADDR_LEN))
4105 memcpy(setting.subaddr,ccbs->subaddr,ccbs->c_subaddr);
4106 setting.satype=tos_demerge((SHORT)ccbs->satype);
4107 /*
4108 * This relies on T_ACI_CLASS being identical to T_BAT_bearer_class
4109 * and T_ACI_ALRT_PATTERN being identical to T_BAT_percent_ccbs_ptn.
4110 */
4111 setting.class_type=(T_ACI_CLASS)ccbs->bearer_class;
4112 setting.alrtPtn=(T_ACI_ALRT_PTRN)ccbs->ptn;
4113 rCI_PercentCCBS(ind,status,&setting,FALSE);
4114 return 0; /* Ok */
4115 }
4116
4117 int Resp_uPlusCCCM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4118 {
4119 TRACE_FUNCTION ("Resp_uPlusCCCM()");
4120 rCI_PlusCCCM(&resp_p->response.ptr_res_plus_cccm->ccm);
4121 return 0; /* Ok */
4122 }
4123
4124 int Resp_uPercentCCCN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4125 {
4126 T_fac_inf fie;
4127 TRACE_FUNCTION ("Resp_uPercentCCCN() ");
4128
4129 fie.l_fac = resp_p->response.ptr_res_percent_cccn->c_facility;
4130 memcpy(fie.fac,resp_p->response.ptr_res_percent_cccn->facility,
4131 fie.l_fac);
4132
4133 rCI_PercentCCCN((T_ACI_FAC_DIR)resp_p->response.ptr_res_percent_cccn->direction,
4134 (SHORT)resp_p->response.ptr_res_percent_cccn->cid,
4135 &fie );
4136
4137 return 0; /* Ok */
4138 }
4139
4140 int Resp_uPlusCCWA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4141 {
4142 T_ACI_CLSSTAT clsStat;
4143 T_ACI_TOA type ;
4144 CHAR number[BAT_MAX_CCWA_NUMBER_LEN+1];
4145
4146 #ifdef NO_ASCIIZ
4147 T_ACI_PB_TEXT alpha_text ;
4148 #else
4149 CHAR * p_alpha;
4150 CHAR alpha[BAT_MAX_CCWA_NUMBER_LEN+1];
4151 #endif
4152
4153 TRACE_FUNCTION ("Resp_uPlusCCWA()");
4154
4155 clsStat.class_type = resp_p->response.ptr_res_plus_ccwa->bearer_class;
4156 clsStat.status = STATUS_NotPresent;/*response structure has no info abt sttus*/
4157 /*
4158 utl_binToHex(resp_p->response.ptr_res_plus_ccwa->number,
4159 (SHORT)resp_p->response.ptr_res_plus_ccwa->c_number,
4160 number);
4161 */
4162 memcpy(number,
4163 resp_p->response.ptr_res_plus_ccwa->number,
4164 (SHORT)resp_p->response.ptr_res_plus_ccwa->c_number);
4165
4166 type = toa_demerge((SHORT)resp_p->response.ptr_res_plus_ccwa->type);
4167
4168 #ifdef NO_ASCIIZ
4169
4170 alpha_text.len = resp_p->response.ptr_res_plus_ccwa->c_alpha;
4171 memcpy(alpha_text.data, resp_p->response.ptr_res_plus_ccwa->alpha, alpha_text.len);
4172
4173 rCI_PlusCCWA(resp_p->response.ptr_res_plus_ccwa->bearer_class EQ BAT_CCWA_CLASS_NOT_PRESENT
4174 ? NULL
4175 : &clsStat,
4176 number,
4177 &type,
4178 (U8)resp_p->response.ptr_res_plus_ccwa->cli,
4179 (T_ACI_CLASS)resp_p->response.ptr_res_plus_ccwa->bearer_class,
4180 alpha_text.len
4181 ? &alpha_text
4182 : NULL);
4183 #else
4184
4185 p_alpha = alpha;
4186 if(resp_p->response.ptr_res_plus_ccwa.->v_alpha)
4187 {
4188 utl_binToHex(resp_p->response.ptr_res_plus_ccwa->alpha,
4189 (SHORT)resp_p->response.ptr_res_plus_ccwa->c_alpha,
4190 alpha);
4191 }
4192 else
4193 {
4194 p_alpha = NULL;
4195 }
4196 rCI_PlusCCWA(resp_p->response.ptr_res_plus_ccwa->bearer_class EQ BAT_CCWA_CLASS_NOT_PRESENT
4197 ? NULL
4198 : &clsStat,
4199 number,
4200 &type,
4201 (U8)resp_p->response.ptr_res_plus_ccwa->cli,
4202 (T_ACI_CLASS)resp_p->response.ptr_res_plus_ccwa->bearer_class,
4203 p_alpha);
4204 #endif
4205
4206 return 0; /* Ok */
4207 }
4208
4209 int Resp_uPlusCCWA_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4210 {
4211 TRACE_FUNCTION ("Resp_uPlusCCWA_W() Not Implemented");
4212
4213 return 0; /* Ok */
4214 }
4215
4216 int Resp_uPlusCCWE(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4217 {
4218 TRACE_FUNCTION ("Resp_uPlusCCWE() contains bat dummy out put nothing");
4219
4220 return 0; /* Ok */
4221 }
4222
4223 int Resp_uPlusCDIP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4224 {
4225 T_BAT_res_uns_plus_cdip *cdip;
4226 CHAR number[BAT_MAX_CDIP_NUMBER_LEN+1];
4227 T_ACI_TOA type;
4228 CHAR *sub_ptr;
4229 CHAR subaddr[BAT_MAX_SUBADDR_LENGTH+1];
4230 T_ACI_TOS *satype_ptr;
4231 T_ACI_TOS satype;
4232
4233 TRACE_FUNCTION ("Resp_uPlusCDIP()");
4234
4235 sub_ptr=NULL;
4236 satype_ptr=NULL;
4237
4238 /*
4239 * Get a pointer to the CDIP structure for convenience.
4240 */
4241 cdip = (T_BAT_res_uns_plus_cdip *)resp_p->response.ptr_res_plus_cdip;
4242
4243 memset(number,0,sizeof(number));
4244 memcpy(number,cdip->number,BAT_MAX_CDIP_NUMBER_LEN);
4245
4246 type=toa_demerge(cdip->type);
4247
4248 if (cdip->v_subaddr)
4249 {
4250 memset(subaddr,0,sizeof(subaddr));
4251 memcpy(subaddr,cdip->subaddr,BAT_MAX_SUBADDR_LENGTH);
4252 sub_ptr=subaddr;
4253
4254 satype=tos_demerge(cdip->satype);
4255 satype_ptr=&satype;
4256 }
4257
4258 rCI_PlusCDIP(number,
4259 &type,
4260 sub_ptr,
4261 satype_ptr);
4262 return 0; /* Ok */
4263 }
4264
4265 int Resp_uPlusCDS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4266 {
4267 T_MNSMS_STATUS_IND mnsms_status_ind;
4268
4269 TRACE_FUNCTION ("Resp_uPlusCDS()");
4270
4271 mnsms_status_ind.sms_sdu.l_buf = resp_p->response.ptr_res_plus_cds->c_pdu;
4272 memcpy(mnsms_status_ind.sms_sdu.buf,resp_p->response.ptr_res_plus_cds->pdu,
4273 resp_p->response.ptr_res_plus_cds->c_pdu);
4274
4275 rCI_PlusCDSPdu(&mnsms_status_ind);
4276
4277 return 0; /* Ok */
4278 }
4279
4280 #ifdef GPRS
4281 int Resp_uPercentCGEV(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4282 {
4283 T_CGEREP_EVENT event;
4284 T_CGEREP_EVENT_REP_PARAM param;
4285 T_BAT_res_uns_percent_cgev *cgev;
4286 TRACE_FUNCTION ("Resp_uPercentCGEV()");
4287 /*
4288 * Get a pointer to the CGEV structure for convenience.
4289 */
4290 cgev=resp_p->response.ptr_res_percent_cgev;
4291
4292 memset(&param,0,sizeof(param));
4293
4294 /*
4295 * This relies on T_CGEREP_EVENT being identical to
4296 * T_BAT_percent_cgev_evt.
4297 */
4298 event=(T_CGEREP_EVENT)cgev->evt;
4299
4300 switch (event)
4301 {
4302 case CGEREP_EVENT_REJECT:
4303 if (cgev->v_pdp_addr==TRUE)
4304 {
4305 if (cgev->c_pdp_addr<MAX_PDP_ADDR_LEN)
4306 memcpy(param.reject.pdp_addr,cgev->pdp_addr,cgev->c_pdp_addr);
4307 }
4308 break;
4309
4310 case CGEREP_EVENT_NW_CLASS:
4311 case CGEREP_EVENT_ME_CLASS:
4312 /*
4313 * This relies on T_PERCENT_CGCLASS being identical to
4314 * T_BAT_p_mobile_class.
4315 */
4316 param.mobile_class=(T_PERCENT_CGCLASS)cgev->p_mobile_class;
4317 break;
4318
4319 case CGEREP_EVENT_NW_REACT:
4320 case CGEREP_EVENT_NW_DEACT:
4321 case CGEREP_EVENT_ME_DEACT:
4322 case CGEREP_EVENT_NW_ACT:
4323 case CGEREP_EVENT_ME_ACT:
4324 if (cgev->v_pdp_addr==TRUE)
4325 {
4326 if (cgev->c_pdp_addr<MAX_PDP_ADDR_LEN)
4327 memcpy(param.act.pdp_addr,cgev->pdp_addr,cgev->c_pdp_addr);
4328 }
4329
4330 param.act.cid=(SHORT)cgev->cid;
4331 break;
4332
4333 default:
4334 break;
4335 }
4336 rCI_PercentCGEV(event,&param);
4337 return 0; /* Ok */
4338 }
4339
4340 int Resp_uPlusCGEV(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4341 {
4342 TRACE_FUNCTION ("Resp_uPlusCGEV() Not Implemented no res plus cgev structure filler found");
4343
4344 return 0; /* Ok */
4345 }
4346
4347 int Resp_uPercentCGREG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4348 {
4349 T_P_CGREG_STAT stat;
4350 USHORT lac;
4351 USHORT ci;
4352 T_BAT_res_uns_percent_cgreg *cgreg;
4353 TRACE_FUNCTION ("Resp_uPercentCGREG()");
4354 /*
4355 * Get a pointer to the CGREG structure for convenience.
4356 */
4357 cgreg=resp_p->response.ptr_res_percent_cgreg;
4358 stat=(T_P_CGREG_STAT)cgreg->stat;
4359 lac=(USHORT)cgreg->lac;
4360 ci=(USHORT)cgreg->ci;
4361 rCI_PercentCGREG(stat,lac,ci,FALSE);
4362 return 0; /* Ok */
4363 }
4364
4365 int Resp_uPlusCGREG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4366 {
4367 TRACE_FUNCTION ("Resp_uPlusCGREG()");
4368
4369 rCI_PlusCGREG((T_CGREG_STAT)resp_p->response.ptr_res_plus_cgreg->stat,
4370 (USHORT)resp_p->response.ptr_res_plus_cgreg->lac,
4371 (USHORT)resp_p->response.ptr_res_plus_cgreg->ci );
4372
4373 return 0; /* Ok */
4374 }
4375 #endif /* GPRS */
4376
4377 int Resp_uPlusCLAE(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4378 {
4379 T_BAT_res_uns_plus_clae *clae;
4380 T_ACI_LAN_SUP lang;
4381 CHAR code[BAT_MAX_CLAE_CODE_LEN+1];
4382 TRACE_FUNCTION ("Resp_uPlusCLAE()");
4383 /*
4384 * Get a pointer to the CLAE structure for convenience.
4385 */
4386 clae=resp_p->response.ptr_res_plus_clae;
4387 memset(code,0,sizeof(code));
4388 memcpy(code,clae->code,clae->c_code);
4389 /*
4390 * NB rCI_PlusCLAE only cares about the code string, so
4391 * we don't need to populate 'lang' any further than this.
4392 */
4393 lang.str=code;
4394 rCI_PlusCLAE(&lang);
4395 return 0; /* Ok */
4396 }
4397
4398 int Resp_uPlusCLAV(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4399 {
4400 CHAR code[BAT_MAX_CLAV_CODE_LEN + 1];
4401
4402 TRACE_FUNCTION ("Resp_uPlusCLAV() recheck");
4403
4404 utl_binToHex(resp_p->response.ptr_res_plus_clav->code,
4405 (SHORT)resp_p->response.ptr_res_plus_clav->c_code,
4406 code) ;
4407
4408 sprintf(g_sa,"+CLAN: %s",code);
4409 io_sendMessage(src_infos_psi->srcId,g_sa, ATI_NORMAL_OUTPUT);
4410 return 0; /* Ok */
4411 }
4412
4413 int Resp_uPlusCLIP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4414 {
4415 T_BAT_res_uns_plus_clip *clip;
4416 CHAR number[BAT_MAX_CLIP_NUMBER_LEN+1];
4417 T_ACI_TOA type;
4418 U8 validity;
4419 CHAR *sub_ptr;
4420 CHAR subaddr[BAT_MAX_SUBADDR_LENGTH+1];
4421 T_ACI_TOS *satype_ptr;
4422 T_ACI_TOS satype;
4423 #ifdef NO_ASCIIZ
4424 T_ACI_PB_TEXT *alpha_ptr;
4425 T_ACI_PB_TEXT alpha;
4426 #else
4427 CHAR *alpha_ptr;
4428 CHAR alpha[BAT_MAX_PHB_NUM_LEN+1];
4429 #endif
4430
4431 TRACE_FUNCTION ("Resp_uPlusCLIP()");
4432
4433 sub_ptr=NULL;
4434 satype_ptr=NULL;
4435 alpha_ptr=NULL;
4436
4437 /*
4438 * Get a pointer to the CLIP structure for convenience.
4439 */
4440 clip=resp_p->response.ptr_res_plus_clip;
4441
4442 memset(number,0,sizeof(number));
4443 memcpy(number,clip->number,BAT_MAX_CLIP_NUMBER_LEN);
4444
4445 type=toa_demerge(clip->type);
4446
4447 if (clip->v_subaddr)
4448 {
4449 memset(subaddr,0,sizeof(subaddr));
4450 memcpy(subaddr,clip->subaddr,BAT_MAX_SUBADDR_LENGTH);
4451 sub_ptr=subaddr;
4452
4453 satype=tos_demerge(clip->satype);
4454 satype_ptr=&satype;
4455 }
4456
4457 if (clip->v_alpha)
4458 {
4459 #ifdef NO_ASCIIZ
4460
4461 memcpy(alpha.data,clip->alpha,MAX_PHB_NUM_LEN);
4462
4463 if (clip->c_alpha>MAX_PHB_NUM_LEN)
4464 alpha.len=MAX_PHB_NUM_LEN;
4465 else
4466 alpha.len=clip->c_alpha;
4467
4468 alpha.cs=CS_NotPresent;
4469
4470 alpha_ptr=&alpha;
4471
4472 #else
4473
4474 memset(alpha,0,sizeof(alpha));
4475 memcpy(alpha,clip->alpha,BAT_MAX_PHB_NUM_LEN);
4476 alpha_ptr=alpha;
4477
4478 #endif
4479 }
4480
4481 validity=(U8)clip->cli;
4482
4483 rCI_PlusCLIP(
4484 CLIP_STAT_NotPresent, /* <=== not always true, but BAT does not provide status infromation */
4485 number,
4486 &type,
4487 validity,
4488 sub_ptr,
4489 satype_ptr,
4490 alpha_ptr);
4491
4492 return 0; /* Ok */
4493 }
4494
4495 int Resp_uPlusCLIP_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4496 {
4497 TRACE_FUNCTION ("Resp_uPlusCLIP_W() Not Implemented");
4498
4499 return 0; /* Ok */
4500 }
4501
4502 int Resp_uPlusCMT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4503 {
4504 T_MNSMS_MESSAGE_IND mnsms_message_ind;
4505 T_BAT_res_uns_plus_cmt *cmt;
4506
4507 TRACE_FUNCTION ("Resp_uPlusCMT()");
4508 /*
4509 * Get a pointer to the CMT structure for convenience.
4510 */
4511 cmt=resp_p->response.ptr_res_plus_cmt;
4512
4513 /*
4514 * Check that the received BAT message is not too big. If it is,
4515 * we discard it.
4516 */
4517 if (cmt->c_pdu>SIM_PDU_LEN)
4518 {
4519 TRACE_EVENT("BAT CMT too big");
4520 }
4521 else
4522 {
4523 /*
4524 * Set up the bits of mnsms_message_ind that are used by
4525 * rCI_PlusCMT().
4526 */
4527 memcpy(&mnsms_message_ind.sms_sdu.buf,cmt->pdu,cmt->c_pdu);
4528 mnsms_message_ind.sms_sdu.l_buf=cmt->c_pdu<<3;
4529 mnsms_message_ind.sms_sdu.o_buf=0;
4530
4531 /*
4532 * This is not part of the BAT response, so choose a sensible
4533 * value.
4534 */
4535 mnsms_message_ind.status=REC_UNREAD;
4536
4537 rCI_PlusCMT(&mnsms_message_ind);
4538 }
4539 return 0; /* Ok */
4540 }
4541
4542 int Resp_uPlusCMTI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4543 {
4544 TRACE_FUNCTION ("Resp_uPlusCMTI() ");
4545 rCI_PlusCMTI((T_ACI_SMS_STOR)resp_p->response.ptr_res_plus_cmti->sms_mem,
4546 (UBYTE)resp_p->response.ptr_res_plus_cmti->sms_index);
4547
4548 return 0; /* Ok */
4549 }
4550
4551 int Resp_uPlusCMT_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4552 {
4553 TRACE_FUNCTION ("Resp_uPlusCMT_W() Not Implemented");
4554
4555 return 0; /* Ok */
4556 }
4557
4558 int Resp_uPercentCNAP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4559 {
4560 CHAR name[BAT_MAX_CNAP_NAME_LEN + 1];
4561
4562 UBYTE pos = 0;
4563
4564 TRACE_FUNCTION ("Resp_uPercentCNAP() Not implemented");
4565
4566 if(resp_p->response.ptr_res_percent_cnap->v_name)
4567 {
4568 utl_binToHex(resp_p->response.ptr_res_percent_cnap->name,
4569 (SHORT)resp_p->response.ptr_res_percent_cnap->c_name,
4570 name) ;
4571 }
4572
4573 pos += sprintf(g_sa+pos,"%s%d", "%CNAP: ",
4574 resp_p->response.ptr_res_percent_cnap->pres_mode);
4575
4576 if(resp_p->response.ptr_res_percent_cnap->v_name)
4577 {
4578 pos += sprintf(g_sa+pos,",%hd,", resp_p->response.ptr_res_percent_cnap->dcs);
4579
4580 switch(resp_p->response.ptr_res_percent_cnap->pres_mode)
4581 {
4582 case BAT_P_CNAP_PRES_NAME:
4583 case BAT_P_CNAP_PRES_NAME_RESTRICTED:
4584 {
4585 TRACE_EVENT("CNAP: name presentation is allowed or restrcited");
4586 pos += sprintf(g_sa+pos,"%d,\"%s\"",
4587 resp_p->response.ptr_res_percent_cnap->c_name),
4588 resp_p->response.ptr_res_percent_cnap->name;
4589 break;
4590 }
4591 case BAT_P_CNAP_PRES_RESTRICTED:
4592 case BAT_P_CNAP_PRES_NO_NAME:
4593 {
4594 TRACE_EVENT("CNAP: presentation is restricted or no name");
4595 break;
4596 }
4597 default:
4598 {
4599 TRACE_ERROR("CNAP: wrong presentation mode");
4600 }
4601 }
4602 }
4603 io_sendIndication(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT );
4604
4605 return 0; /* Ok */
4606 }
4607
4608 int Resp_uPlusCOLP(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4609 {
4610 T_BAT_res_uns_plus_colp *colp;
4611 CHAR *num_ptr;
4612 CHAR number[BAT_MAX_COLP_NUMBER_LEN+1];
4613 T_ACI_TOA *type_ptr;
4614 T_ACI_TOA type;
4615 CHAR *sub_ptr;
4616 CHAR subaddr[BAT_MAX_SUBADDR_LENGTH+1];
4617 T_ACI_TOS *satype_ptr;
4618 T_ACI_TOS satype;
4619 #ifdef NO_ASCIIZ
4620 T_ACI_PB_TEXT *alpha_ptr;
4621 T_ACI_PB_TEXT alpha;
4622 #else
4623 CHAR *alpha_ptr;
4624 CHAR alpha[BAT_MAX_COLP_ALPHA_LEN+1];
4625 #endif
4626
4627 TRACE_FUNCTION ("Resp_uPlusCOLP()");
4628
4629 num_ptr=NULL;
4630 type_ptr=NULL;
4631 sub_ptr=NULL;
4632 satype_ptr=NULL;
4633 alpha_ptr=NULL;
4634
4635 /*
4636 * Get a pointer to the COLP structure for convenience.
4637 */
4638 colp=resp_p->response.ptr_res_plus_colp;
4639
4640 if (colp->v_number)
4641 {
4642 memset(number,0,sizeof(number));
4643 memcpy(number,colp->number,BAT_MAX_COLP_NUMBER_LEN);
4644 num_ptr=number;
4645
4646 type=toa_demerge(colp->type);
4647 type_ptr=&type;
4648 }
4649
4650 if (colp->v_subaddr)
4651 {
4652 memset(subaddr,0,sizeof(subaddr));
4653 memcpy(subaddr,colp->subaddr,BAT_MAX_SUBADDR_LENGTH);
4654 sub_ptr=subaddr;
4655
4656 satype=tos_demerge(colp->satype);
4657 satype_ptr=&satype;
4658 }
4659
4660 if (colp->v_alpha)
4661 {
4662 #ifdef NO_ASCIIZ
4663
4664 memcpy(alpha.data,colp->alpha,MAX_PHB_NUM_LEN);
4665
4666 if (colp->c_alpha>MAX_PHB_NUM_LEN)
4667 alpha.len=MAX_PHB_NUM_LEN;
4668 else
4669 alpha.len=colp->c_alpha;
4670
4671 alpha.cs=CS_NotPresent;
4672 alpha_ptr=&alpha;
4673
4674 #else
4675
4676 memset(alpha,0,sizeof(alpha));
4677 memcpy(alpha,colp->alpha,BAT_MAX_COLP_ALPHA_LEN);
4678 alpha_ptr=alpha;
4679
4680 #endif
4681 }
4682
4683 rCI_PlusCOLP(
4684 COLP_STAT_NotPresent,
4685 num_ptr,
4686 type_ptr,
4687 sub_ptr,
4688 satype_ptr,
4689 alpha_ptr);
4690
4691 return 0; /* Ok */
4692 }
4693
4694 int Resp_uPlusCOLP_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4695 {
4696 TRACE_FUNCTION ("Resp_uPlusCOLP_W() Not Implemented");
4697
4698 return 0; /* Ok */
4699 }
4700
4701 int Resp_uPercentCPI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4702 {
4703 T_BAT_res_uns_percent_cpi *cpi;
4704 SHORT cId;
4705 T_ACI_CPI_MSG msgType;
4706 T_ACI_CPI_IBT ibt;
4707 T_ACI_CPI_TCH tch;
4708 USHORT cause;
4709
4710 TRACE_FUNCTION ("Resp_uPercentCPI()");
4711 /*
4712 * Get a pointer to the CPI structure for convenience.
4713 */
4714 cpi=resp_p->response.ptr_res_percent_cpi;
4715
4716 cId=(SHORT)cpi->cid;
4717
4718 /*
4719 * This relies on T_ACI_CPI_MSG being equivalent to
4720 * T_BAT_percent_cpi_msgtype.
4721 */
4722 msgType=(T_ACI_CPI_MSG)cpi->msgtype;
4723
4724 /*
4725 * This relies on T_ACI_CPI_IBT being equivalent to
4726 * T_BAT_percent_cpi_ibt.
4727 */
4728 ibt=(T_ACI_CPI_IBT)cpi->ibt;
4729 /*
4730 * This relies on T_ACI_CPI_TCH being equivalent to
4731 * T_BAT_percent_cpi_tch.
4732 */
4733 tch=(T_ACI_CPI_TCH)cpi->tch;
4734 cause=(USHORT)cpi->cause;
4735 rCI_PercentCPI(cId,msgType,ibt,tch,cause);
4736 return 0; /* Ok */
4737 }
4738
4739 int Resp_uPercentCPI_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4740 {
4741 TRACE_FUNCTION ("Resp_uPercentCPI_W() not implemented");
4742
4743 return 0; /* Ok */
4744 }
4745
4746 int Resp_uPercentCPRI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4747 {
4748 T_BAT_res_uns_percent_cpri *cpri;
4749 TRACE_FUNCTION ("Resp_uPercentCPRI()");
4750 /*
4751 * Get a pointer to the CPRI structure for convenience.
4752 */
4753 cpri=resp_p->response.ptr_res_percent_cpri;
4754
4755 rCI_PercentCPRI((UBYTE)cpri->gsm_ciph,(UBYTE)cpri->gprs_ciph);
4756
4757 return 0; /* Ok */
4758 }
4759
4760 int Resp_uPercentCPROAM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4761 {
4762 TRACE_FUNCTION ("Resp_uPercentCPROAM()");
4763
4764 rCI_PercentCPROAM((UBYTE)resp_p->response.ptr_res_percent_cproam->roam_status);
4765
4766 return 0; /* Ok */
4767 }
4768
4769 int Resp_uPercentCPVWI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4770 {
4771 TRACE_FUNCTION ("Resp_uPercentCPVWI() ");
4772 rCI_PercentCPVWI((UBYTE)resp_p->response.ptr_res_percent_cpvwi->status,
4773 (USHORT)resp_p->response.ptr_res_percent_cpvwi->line);
4774
4775 return 0; /* Ok */
4776 }
4777
4778 int Resp_uPlusCR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4779 {
4780 char service[BAT_MAX_CR_SERV_LEN];
4781 T_ACI_CR_SERV serv;
4782
4783 TRACE_FUNCTION ("Resp_uPlusCR()");
4784
4785 utl_binToHex(resp_p->response.ptr_res_plus_cr->serv,
4786 (SHORT)resp_p->response.ptr_res_plus_cr->c_serv,
4787 service);
4788
4789 if(!strcmp(service,"ASYNC"))
4790 serv=CR_SERV_Async;
4791 else if(!strcmp(service,"SYNC"))
4792 serv=CR_SERV_Sync;
4793 else if(!strcmp(service,"REL ASYNC"))
4794 serv=CR_SERV_RelAsync;
4795 else if(!strcmp(service,"REL SYNC"))
4796 serv=CR_SERV_RelSync;
4797
4798 #ifdef GPRS
4799 else if(!strcmp(service,"GPRS"))
4800 serv=CR_SERV_GPRS;
4801 #endif
4802
4803 else
4804 return 0;
4805
4806 rCI_PlusCR( serv);
4807
4808 return 0; /* Ok */
4809 }
4810
4811 int Resp_uPercentCREG(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4812 {
4813 T_BAT_res_uns_percent_creg *creg;
4814 T_ACI_CREG_STAT status;
4815 USHORT lac;
4816 USHORT cid;
4817 T_ACI_P_CREG_GPRS_IND gprs_ind;
4818
4819 TRACE_FUNCTION ("Resp_uPercentCREG()");
4820
4821 /*
4822 * Get a pointer to the CREG structure for convenience.
4823 */
4824 creg=resp_p->response.ptr_res_percent_creg;
4825
4826 /*
4827 * This relies on T_ACI_CREG_STAT and T_BAT_percent_creg_stat being
4828 * identical.
4829 */
4830 status=(T_ACI_CREG_STAT)creg->stat;
4831
4832 lac=(USHORT)creg->lac;
4833 cid=(USHORT)creg->ci;
4834
4835 /*
4836 * This relies on T_ACI_P_CREG_GPRS_IND and T_BAT_percent_creg_gprs_ind
4837 * being identical.
4838 */
4839 gprs_ind=(T_ACI_P_CREG_GPRS_IND)creg->gprs_ind;
4840
4841 rCI_PercentCREG(status,lac,cid,gprs_ind);
4842 return 0; /* Ok */
4843 }
4844
4845 int Resp_uPercentCSQ(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4846 {
4847 TRACE_FUNCTION ("Resp_uPercentCSQ() ");
4848
4849 rCI_PercentCSQ((UBYTE)resp_p->response.ptr_res_percent_csq->rssi,
4850 (UBYTE)resp_p->response.ptr_res_percent_csq->ber,
4851 (UBYTE)resp_p->response.ptr_res_percent_csq->actlevel);
4852
4853 return 0; /* Ok */
4854 }
4855
4856 int Resp_uPlusCSSI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4857 {
4858 TRACE_FUNCTION ("Resp_uPlusCSSI()");
4859
4860 rCI_PlusCSSI((T_ACI_CSSI_CODE)resp_p->response.ptr_res_plus_cssi->code1,
4861 (SHORT)resp_p->response.ptr_res_plus_cssi->index);
4862
4863 return 0; /* Ok */
4864 }
4865
4866 int Resp_uPercentCSSN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4867 {
4868 T_fac_inf fie;
4869 TRACE_FUNCTION ("Resp_uPercentCSSN() ");
4870
4871 fie.l_fac = resp_p->response.ptr_res_percent_cssn->c_facility;
4872 memcpy(fie.fac,resp_p->response.ptr_res_percent_cssn->facility,BAT_MAX_CSSN_FACILITY_LEN);
4873
4874 rCI_PercentCSSN (resp_p->response.ptr_res_percent_cssn->direction,
4875 resp_p->response.ptr_res_percent_cssn->trans_type,
4876 &fie );
4877 return 0; /* Ok */
4878 }
4879
4880 int Resp_uPlusCSSU(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4881 {
4882 char *me="+CSSU: ";
4883 char number[BAT_MAX_CSSU_NUMBER_LEN+1];
4884 char subaddr[BAT_MAX_SUBADDR_LENGTH+1];
4885 char* p_number;
4886 char* p_subaddr;
4887 T_ACI_TOA type ;
4888 T_ACI_TOS satype ;
4889 SHORT pos=0;
4890 TRACE_FUNCTION ("Resp_uPlusCSSU()");
4891
4892 p_number = number;
4893 p_subaddr = subaddr;
4894
4895 type = toa_demerge((SHORT)resp_p->response.ptr_res_plus_cssu->type);
4896 satype = tos_demerge((SHORT)resp_p->response.ptr_res_plus_cssu->satype);
4897
4898 if(resp_p->response.ptr_res_plus_cssu->v_number)
4899 {
4900 utl_binToHex(resp_p->response.ptr_res_plus_cssu->number,
4901 (SHORT)resp_p->response.ptr_res_plus_cssu->c_number,
4902 number);
4903 }
4904 else
4905 p_number = NULL;
4906
4907 if(resp_p->response.ptr_res_plus_cssu->v_subaddr)
4908 {
4909 utl_binToHex(resp_p->response.ptr_res_plus_cssu->subaddr,
4910 (SHORT)resp_p->response.ptr_res_plus_cssu->c_subaddr,
4911 subaddr);
4912 }
4913 else
4914 p_subaddr=NULL;
4915
4916 rCI_PlusCSSU((T_ACI_CSSU_CODE)resp_p->response.ptr_res_plus_cssu->code2,
4917 (SHORT)resp_p->response.ptr_res_plus_cssu->index,
4918 p_number,
4919 &type,
4920 p_subaddr,
4921 &satype) ;
4922
4923 return 0; /* Ok */
4924 }
4925
4926 int Resp_uPercentCSTAT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4927 {
4928 SHORT pos = 0;
4929 TRACE_FUNCTION ("Resp_uPercentCSTAT() ");
4930
4931 pos = sprintf(g_sa,"%s: ","%CSTAT");
4932
4933 switch(resp_p->response.ptr_res_percent_cstat->entity_id)
4934 {
4935 case BAT_P_CSTAT_ENT_ID_PBOOK:
4936 pos += sprintf(g_sa+pos,"PHB, %d",resp_p->response.ptr_res_percent_cstat->status);
4937 break;
4938 case BAT_P_CSTAT_ENT_ID_SMS :
4939 pos += sprintf(g_sa+pos,"SMS, %d",resp_p->response.ptr_res_percent_cstat->status);
4940 break;
4941 case BAT_P_CSTAT_ENT_ID_RDY :
4942 pos += sprintf(g_sa+pos,"RDY, %d",resp_p->response.ptr_res_percent_cstat->status);
4943 break;
4944 default:
4945 return 0;
4946 }
4947
4948 #ifndef _SIMULATION_ /* SKA: a lot of test cases do not expect %CSTAT: xxx unsolicited responses */
4949 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
4950 #endif
4951
4952 return 0; /* Ok */
4953 }
4954
4955 int Resp_uPercentCTYI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4956 {
4957 TRACE_FUNCTION ("Resp_uPercentCTYI()");
4958
4959 rCI_PercentCTYI ((T_ACI_CTTY_NEG)resp_p->response.ptr_res_percent_ctyi->neg,
4960 (T_ACI_CTTY_TRX)resp_p->response.ptr_res_percent_ctyi->trx);
4961
4962 return 0; /* Ok */
4963 }
4964
4965 int Resp_uPlusCTZR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4966 {
4967 TRACE_FUNCTION ("Resp_uPlusCTZR()");
4968
4969 sprintf(g_sa,"+CTZR: %d", resp_p->response.ptr_res_plus_ctzr->tz);
4970 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
4971
4972 return 0; /* Ok */
4973 }
4974
4975 int Resp_uPercentCTZV(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4976 {
4977 T_MMR_INFO_IND mmr_info_ind;
4978
4979 TRACE_FUNCTION ("Resp_uPercentCTZV() ");
4980
4981 mmr_info_ind.time.year = resp_p->response.ptr_res_percent_ctzv->year;
4982 mmr_info_ind.time.month = resp_p->response.ptr_res_percent_ctzv->month;
4983 mmr_info_ind.time.day = resp_p->response.ptr_res_percent_ctzv->day;
4984 mmr_info_ind.time.hour = resp_p->response.ptr_res_percent_ctzv->hour;
4985 mmr_info_ind.time.minute = resp_p->response.ptr_res_percent_ctzv->minutes;
4986 mmr_info_ind.time.second = resp_p->response.ptr_res_percent_ctzv->seconds;
4987
4988 rCI_PercentCTZV (&mmr_info_ind, (S32)resp_p->response.ptr_res_percent_ctzv->time_zone);
4989
4990 return 0; /* Ok */
4991 }
4992
4993 int Resp_uPlusCTZV(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
4994 {
4995 TRACE_FUNCTION ("Resp_uPlusCTZV()");
4996
4997 #ifdef FF_TIMEZONE
4998 rCI_PlusCTZV((S32)resp_p->response.ptr_res_plus_ctzv->tz);
4999 #else
5000 rCI_PlusCTZV(&((UBYTE)resp_p->response.ptr_res_plus_ctzv->tz));
5001 #endif
5002
5003 return 0; /* Ok */
5004 }
5005
5006 int Resp_uPercentCTZV_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5007 {
5008 TRACE_FUNCTION ("Resp_uPercentCTZV_W() Not Implemented");
5009
5010 return 0; /* Ok */
5011 }
5012
5013 int Resp_uPlusCUSD(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5014 {
5015 T_ACI_CUSD_MOD m;
5016 T_BAT_res_uns_plus_cusd *cusd;
5017 T_ACI_USSD_DATA ussd;
5018 SHORT dcs;
5019
5020 TRACE_FUNCTION ("Resp_uPlusCUSD()");
5021
5022 /*
5023 * Get a pointer to the CUSD structure for convenience.
5024 */
5025 cusd=resp_p->response.ptr_res_plus_cusd;
5026
5027 /*
5028 * If the string isn't valid, just ignore the message.
5029 */
5030 if (cusd->v_str==TRUE)
5031 {
5032 /*
5033 * This assumes that T_ACI_CUSD_MOD and
5034 * T_BAT_VAL_plus_cusd_m are equivalent.
5035 */
5036 m=(T_ACI_CUSD_MOD)cusd->m;
5037
5038 dcs=(SHORT)cusd->dcs;
5039
5040 /*
5041 * Copy in as much data as the ACI structure can take.
5042 */
5043 memcpy(ussd.data,cusd->str,MAX_USSD_LEN);
5044
5045 /*
5046 * Set the length of the data. If there was too much for the
5047 * ACI structure then the data will be truncated.
5048 */
5049 ussd.len=(cusd->c_str>MAX_USSD_LEN) ? MAX_USSD_LEN:cusd->c_str;
5050
5051 rCI_PlusCUSD(m,&ussd,dcs);
5052 }
5053 return 0; /* Ok */
5054 }
5055
5056
5057 int Resp_uPlusCUSD_W(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5058 {
5059 TRACE_FUNCTION ("Resp_uPlusCUSD_W() Not implemented");
5060
5061 return 0; /* Ok */
5062 }
5063
5064 int Resp_PlusExtError(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5065 {
5066 TRACE_FUNCTION ("Resp_uPlusExtError()");
5067
5068 /*
5069 * ACI_ERR_CLASS_Ext ("EXT ERROR: ...")is very often set on CMH level,
5070 * but on ATI level it is overwritten with plain "ERROR".
5071 * Almost all test cases want to see plain "ERROR" only.
5072 * There are only 4 test cases, which want to see "EXT ERROR:..."
5073 * ACI1220, ACICC044, ACICC074 and ACICC107. Let these 4 FAIL
5074 * and all other let PASS by sending a plain "ERROR"
5075 */
5076 #ifdef _SIMULATION_
5077 TRACE_EVENT("Resp_uPlusExtError(): overwrite EXT ERROR with plain ERROR to make TAP happy");
5078 io_sendConfirm (src_infos_psi->srcId, cmdAtError(atError), ATI_NORMAL_OUTPUT);
5079 #else
5080 io_sendConfirm(src_infos_psi->srcId,
5081 cmdExtError(resp_p->response.ptr_res_plus_ext_error->err),
5082 ATI_ERROR_OUTPUT);
5083 #endif
5084 return 0; /* Ok */
5085 }
5086
5087 int Resp_uPlusFHS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5088 {
5089 TRACE_FUNCTION ("Resp_uPlusFHS() ");
5090
5091 rCI_PlusFHS(resp_p->response.ptr_res_plus_fhs->status);
5092
5093 return 0; /* Ok */
5094 }
5095
5096 int Resp_uPlusILRR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5097 {
5098 LONG val;
5099 TRACE_FUNCTION ("Resp_uPlusILRR()");
5100
5101 if ( ati_user_output_cfg[src_infos_psi->srcId].ILRR_stat )
5102 {
5103 switch(resp_p->response.ptr_res_plus_ilrr->rate)
5104 {
5105 case(BAT_ILRR_RATE_300): val= 300; break;
5106 case(BAT_ILRR_RATE_1200): val= 1200; break;
5107 case(BAT_ILRR_RATE_2400): val= 2400; break;
5108 case(BAT_ILRR_RATE_4800): val= 4800; break;
5109 case(BAT_ILRR_RATE_9600): val= 9600; break;
5110 case(BAT_ILRR_RATE_14400): val=14400; break;
5111 case(BAT_ILRR_RATE_19200): val=19200; break;
5112 case(BAT_ILRR_RATE_38400): val=38400; break;
5113 default: val= 1; break;
5114 }
5115 sprintf(g_sa,"+ILRR: %d,%d,%d",val,resp_p->response.ptr_res_plus_ilrr->framing_format
5116 ,resp_p->response.ptr_res_plus_ilrr->framing_parity);
5117 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
5118 }
5119
5120 return 0; /* Ok */
5121 }
5122
5123 int Resp_uPercentRDL(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5124 {
5125 TRACE_FUNCTION ("Resp_uPercentRDL()");
5126
5127 rCI_PercentRDL (resp_p->response.ptr_res_percent_rdl->state );
5128 return 0; /* Ok */
5129 }
5130
5131 int Resp_uPercentRDLB(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5132 {
5133 TRACE_FUNCTION ("Resp_uPercentRDLB()");
5134
5135 rCI_PercentRDLB(resp_p->response.ptr_res_percent_rdlb->state);
5136 return 0; /* Ok */
5137 }
5138
5139 #ifdef SIM_TOOLKIT
5140
5141 int Resp_uPercentSATA(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5142 {
5143 TRACE_FUNCTION ("Resp_uPercentSATA()");
5144
5145 #ifdef FF_SAT_E
5146 rCI_PercentSATA(0, /* cId not used */
5147 resp_p->response.ptr_res_percent_sata->redial_timeout, &Addparm);
5148 #else /* FF_SAT_E */
5149 rCI_PercentSATA(0, /* cId not used */
5150 resp_p->response.ptr_res_percent_sata->redial_timeout);
5151 #endif /* FF_SAT_E */
5152 return 0; /* Ok */
5153 }
5154
5155 int Resp_sPercentSATE(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5156 {
5157 TRACE_FUNCTION ("Resp_sPercentSATE()");
5158
5159 rCI_PercentSATE((SHORT)resp_p->response.ptr_set_percent_sate->c_satrsp,
5160 resp_p->response.ptr_set_percent_sate->satrsp);
5161 return 0; /* Ok */
5162 }
5163
5164 int Resp_uPercentSATI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5165 {
5166 TRACE_FUNCTION ("Resp_uPercentSATI()");
5167
5168 rCI_PercentSATI((SHORT)resp_p->response.ptr_res_percent_sati->c_satcmd,
5169 resp_p->response.ptr_res_percent_sati->satcmd);
5170 return 0; /* Ok */
5171 }
5172
5173 int Resp_uPercentSATN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5174 {
5175 TRACE_FUNCTION ("Resp_uPercentSATN()");
5176
5177 /* use SATN_CNTRL_BY_SIM_SS as this is required by the acisat test */
5178 rCI_PercentSATN((SHORT)resp_p->response.ptr_res_percent_satn->c_satcmd,
5179 (UBYTE*)resp_p->response.ptr_res_percent_satn->satcmd,
5180 SATN_CNTRL_BY_SIM_SS);
5181
5182 return 0; /* Ok */
5183 }
5184
5185 int Resp_uPercentSIMEF(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5186 {
5187 UBYTE n;
5188 T_BAT_res_uns_percent_simef *simef;
5189 SHORT ef[BAT_MAX_SIMEF_EF_LEN];
5190
5191 /*
5192 * Get a pointer to the SIMEF structure for convenience.
5193 */
5194 simef=resp_p->response.ptr_res_percent_simef;
5195
5196 for (n=0;((n<simef->c_ef) AND (n<BAT_MAX_SIMEF_EF_LEN));n++)
5197 {
5198 ef[n]=(SHORT)simef->ef[n];
5199 }
5200
5201 rCI_PercentSIMEF(ef,(UBYTE)simef->c_ef);
5202
5203 return(0);
5204 }
5205
5206 #endif /* SIM_TOOLKIT */
5207
5208 int Resp_uPercentSIMINS(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5209 {
5210 T_ACI_CME_ERR err ;
5211
5212 TRACE_FUNCTION ("Resp_uPercentSIMINS()");
5213
5214 switch (resp_p->response.ptr_res_percent_simins->n)
5215 {
5216 case BAT_P_SIMINS_N_NO_PIN:
5217 err =CME_ERR_NotPresent;
5218 break;
5219
5220 case BAT_P_SIMINS_N_SIM_PIN:
5221 err =CME_ERR_SimPinReq;
5222 break;
5223
5224 case BAT_P_SIMINS_N_SIM_PUK:
5225 err=CME_ERR_SimPinReq;
5226 break;
5227
5228 case BAT_P_SIMINS_N_SIM_FAIL:
5229 err=CME_ERR_SimFail;
5230 break;
5231
5232 case BAT_P_SIMINS_N_SIM_BUSY:
5233 err=CME_ERR_SimBusy;
5234 break;
5235
5236 case BAT_P_SIMINS_N_SIM_WRONG:
5237 err=CME_ERR_SimWrong;
5238 break;
5239
5240 default:
5241 err=CME_ERR_Unknown;
5242 break;
5243 }
5244
5245 rCI_PercentSIMINS ( err ) ;
5246
5247 return 0; /* Ok */
5248 }
5249
5250 int Resp_uPercentSIMREM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5251 {
5252 TRACE_FUNCTION ("Resp_uPercentSIMREM)()");
5253 /*
5254 * This relies on T_ACI_SIMREM_TYPE being identical to
5255 * T_BAT_percent_simrem_m.
5256 */
5257 rCI_PercentSIMREM(
5258 (T_ACI_SIMREM_TYPE)resp_p->response.ptr_res_percent_simrem->m);
5259 return 0; /* Ok */
5260 }
5261
5262 int Resp_sPlusCGMI(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5263 {
5264 TRACE_FUNCTION ("Resp_sPlusCGMI()");
5265 sprintf(g_sa,"%s",resp_p->response.ptr_set_plus_cgmi->manufacturer);
5266 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
5267 return 0; /* Ok */
5268 }
5269
5270 int Resp_sPlusCGMM(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5271 {
5272 TRACE_FUNCTION ("Resp_sPlusCGMM()");
5273 sprintf(g_sa,"%s",resp_p->response.ptr_set_plus_cgmm->model);
5274 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
5275 return 0; /* Ok */
5276 }
5277
5278 int Resp_sPlusCGMR(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5279 {
5280 TRACE_FUNCTION ("Resp_sPlusCGMR()");
5281 sprintf(g_sa,"%s",resp_p->response.ptr_set_plus_cgmr->revision);
5282 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
5283 return 0; /* Ok */
5284 }
5285
5286 int Resp_sPlusCGSN(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5287 {
5288 TRACE_FUNCTION ("Resp_sPlusCGSN()");
5289 sprintf(g_sa,"%s",resp_p->response.ptr_set_plus_cgsn->sn);
5290 io_sendMessage(src_infos_psi->srcId, g_sa, ATI_NORMAL_OUTPUT);
5291 return 0; /* Ok */
5292 }
5293
5294
5295 int Resp_uPercentSNCNT(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5296 {
5297 }
5298
5299 int Resp_uAtBusy(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5300 {
5301 }
5302
5303 int Resp_uAtNoAnswer(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_response *resp_p)
5304 {
5305 }
5306
5307
5308
5309
5310