FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/cmh_smsr.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children | f5a1a37cbece |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_SMSR | |
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 module defines the functions which are responsible | |
18 | for the responses of the protocol stack adapter for | |
19 | the short message service. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef CMH_SMSR_C | |
24 #define CMH_SMSR_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 /*==== INCLUDES ===================================================*/ | |
29 #include "aci_cmh.h" | |
30 #include "ati_cmd.h" | |
31 #include "aci_cmd.h" | |
32 | |
33 #ifdef FAX_AND_DATA | |
34 #include "aci_fd.h" | |
35 #endif /* of #ifdef FAX_AND_DATA */ | |
36 | |
37 #ifdef UART | |
38 #include "dti.h" | |
39 #include "dti_conn_mng.h" | |
40 #endif | |
41 | |
42 #include "aci.h" | |
43 #include "aci_lst.h" | |
44 #include "aci_mem.h" | |
45 #include "psa.h" | |
46 #include "psa_sms.h" | |
47 #include "psa_mmi.h" | |
48 #include "psa_cc.h" | |
49 | |
50 #include "cmh.h" | |
51 #include "cmh_sms.h" | |
52 #include "psa_sim.h" | |
53 #include "cmh_sim.h" | |
54 #include "psa_util.h" | |
55 #include "Phb.h" | |
56 | |
57 #ifdef SIM_TOOLKIT | |
58 #include "psa_sat.h" | |
59 #include "cmh_sat.h" | |
60 #endif /* of SIM_TOOLKIT */ | |
61 | |
62 #if (defined (MFW) AND !defined (FF_MMI_RIV)) OR defined (_CONC_TESTING_) OR defined (SMI) | |
63 #include "conc_sms.h" | |
64 #endif /* ##if (defined (MFW) AND !defined (FF_MMI_RIV)) OR defined (_CONC_TESTING_) OR defined (SMI)*/ | |
65 | |
66 #ifdef _CONC_TESTING_ | |
67 #include "aci_mfw.h" | |
68 #endif | |
69 | |
70 /*==== CONSTANTS ==================================================*/ | |
71 | |
72 /* TP-User-Data-Header-Indicator (TP-UDHI) */ | |
73 #define UDHI_MASK 0x40 | |
74 #define UDHI_PRESENT 0x40 | |
75 #define UDHI_ABSENT 0x00 | |
76 | |
77 /*==== TYPES ======================================================*/ | |
78 | |
79 /*==== EXPORT =====================================================*/ | |
80 | |
81 /*==== VARIABLES ==================================================*/ | |
82 | |
83 EXTERN T_ACI_LIST *set_prm_list; | |
84 | |
85 /*==== FUNCTIONS ==================================================*/ | |
86 | |
87 /* Implements Measure # 59 */ | |
88 LOCAL void cmhSMS_SendCbDwnlSIM(UBYTE *data, int data_len); | |
89 /* Implements Measure # 104 */ | |
90 LOCAL void cmhSMS_ResCSAS(T_ACI_CMD_SRC ownBuf, T_ACI_AT_CMD cmdBuf, USHORT errCode); | |
91 /* Implements Measure 114 */ | |
92 LOCAL void cmhSMS_ErrRes(T_ACI_CMD_SRC ownBuf, T_ACI_AT_CMD cmdBuf, USHORT cause); | |
93 | |
94 LOCAL BOOL cmhSMS_cpySTtoSM(T_ACI_CMGL_SM *p_sm,T_MNSMS_READ_CNF * mnsms_read_cnf); | |
95 | |
96 /* help function for cmhSMS_SMRead to inform user in case of | |
97 * CCD decoding error with SMS | |
98 * for this case the T_ACI_SMS_STAT has been extended with a value | |
99 * of SMS_STAT_Invalid = -2 (e.g to tell BMI to emit "INVALID MESSAGE") */ | |
100 LOCAL void cmhSMS_invalidSMS_notification_to_user(T_MNSMS_READ_CNF * mnsms_read_cnf) | |
101 { | |
102 T_ACI_AT_CMD cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
103 T_ACI_CMD_SRC ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
104 | |
105 TRACE_FUNCTION ("cmhSMS_SMRead_invalidSMS_notification_to_user()"); | |
106 if (smsShrdPrm.pDecMsg->stat EQ SMS_STAT_Invalid) | |
107 { | |
108 switch( smsShrdPrm.smsEntStat.curCmd ) | |
109 { | |
110 case ( AT_CMD_CMGR ): | |
111 { | |
112 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
113 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
114 smsShrdPrm.smsEntStat.entOwn =CMD_SRC_NONE; | |
115 if (smsShrdPrm.rplyCB.cmgr NEQ NULL) | |
116 { | |
117 smsShrdPrm.rplyCB.cmgr( smsShrdPrm.pDecMsg, NULL ); | |
118 } | |
119 R_AT ( RAT_OK, ownBuf) ( cmdBuf ); | |
120 break; | |
121 } | |
122 case ( AT_CMD_CMGL ): | |
123 { | |
124 R_AT ( RAT_CMGL, smsShrdPrm.smsEntStat.entOwn ) ( smsShrdPrm.pDecMsg ); /* intermediate result */ | |
125 if (mnsms_read_cnf->rec_next NEQ SMS_RECORD_NOT_EXIST) | |
126 { | |
127 psaSMS_ReadReq ( smsShrdPrm.mem1, mnsms_read_cnf->rec_next, | |
128 smsShrdPrm.rdMode, cmglStat ); | |
129 } | |
130 break; | |
131 } | |
132 } | |
133 } | |
134 else | |
135 { | |
136 /* | |
137 * SMS decoding failed, but the status has not been set to SMS_STAT_Invalid | |
138 */ | |
139 TRACE_FUNCTION ("cmhSMS_SMRead_invalidSMS_notification_to_MFW(): [ERR] status not SMS_STAT_Invalid !"); | |
140 } | |
141 } | |
142 | |
143 | |
144 #ifdef SIM_TOOLKIT | |
145 LOCAL void cmhSMS_SATResult (T_ACI_SAT_TERM_RESP *p_resp_data, | |
146 USHORT cause) | |
147 { | |
148 if (GET_CAUSE_ORIGIN_ENTITY(cause) EQ SMSCP_ORIGINATING_ENTITY) | |
149 { /* CP-CAUSE */ | |
150 p_resp_data->add_content = GET_CAUSE_VALUE(cause) | 0x80; | |
151 psaSAT_SendTrmResp( RSLT_NTW_UNAB_PROC, p_resp_data ); | |
152 } | |
153 else | |
154 { /* RP-CAUSE or other */ | |
155 if (GET_CAUSE_ORIGIN_ENTITY(cause) EQ SMSRP_ORIGINATING_ENTITY) | |
156 p_resp_data->add_content = GET_CAUSE_VALUE(cause); | |
157 else | |
158 p_resp_data->add_content = ADD_NO_CAUSE; | |
159 psaSAT_SendTrmResp( RSLT_SMS_ERR, p_resp_data); | |
160 } | |
161 } | |
162 #endif /* #ifdef SIM_TOOLKIT */ | |
163 | |
164 /* | |
165 +-------------------------------------------------------------------+ | |
166 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
167 | STATE : code ROUTINE : cmhSMS_CBMIndication | | |
168 +-------------------------------------------------------------------+ | |
169 | |
170 PURPOSE : This function is used to notify the command handler of | |
171 the receiving of a cell broadcast message. | |
172 */ | |
173 GLOBAL SHORT cmhSMS_CBMIndication ( T_MMI_CBCH_IND * mmi_cbch_ind ) | |
174 { | |
175 USHORT sn; /* serial number */ | |
176 USHORT mid; /* message identifier */ | |
177 UBYTE dcs; /* data coding scheme */ | |
178 UBYTE page; /* actual page number */ | |
179 UBYTE pages; /* total number of pages */ | |
180 T_ACI_CBM_DATA msg; /* cell broadcast message data */ | |
181 UBYTE idx; | |
182 | |
183 TRACE_FUNCTION ("cmhSMS_CBMIndication ()"); | |
184 | |
185 /* | |
186 *----------------------------------------------------------------- | |
187 * process parameters for new message indication | |
188 *----------------------------------------------------------------- | |
189 */ | |
190 sn = ( ( SHORT )mmi_cbch_ind->cbch_msg[0] << 8 ) + | |
191 mmi_cbch_ind->cbch_msg[1]; | |
192 mid = ( ( SHORT )mmi_cbch_ind->cbch_msg[2] << 8 ) + | |
193 mmi_cbch_ind->cbch_msg[3]; | |
194 dcs = mmi_cbch_ind->cbch_msg[4]; | |
195 page = ( mmi_cbch_ind->cbch_msg[5] & 0xF0 ) >> 4; | |
196 pages = ( mmi_cbch_ind->cbch_msg[5] & 0x0F ); | |
197 | |
198 /* | |
199 *----------------------------------------------------------------- | |
200 * process message data, expanding from 7 to 8 bit | |
201 *----------------------------------------------------------------- | |
202 */ | |
203 cmhSMS_expdSmsCb ( dcs, | |
204 &mmi_cbch_ind->cbch_msg[CBCH_HEAD_LEN], | |
205 (UBYTE)(mmi_cbch_ind->cbch_len - CBCH_HEAD_LEN), | |
206 msg.data, &msg.len ); | |
207 | |
208 /* | |
209 *----------------------------------------------------------------- | |
210 * new message indication | |
211 *----------------------------------------------------------------- | |
212 */ | |
213 #ifdef FF_MMI_RIV | |
214 { | |
215 T_ACI_CMGF_MOD sms_input_mode = CMGF_MOD_NotPresent; | |
216 | |
217 qAT_PlusCMGF (CMD_SRC_LCL, &sms_input_mode); | |
218 if (sms_input_mode EQ CMGF_MOD_Pdu) | |
219 { | |
220 rAT_PlusCBMPdu (mmi_cbch_ind); | |
221 } | |
222 else | |
223 { | |
224 R_AT( RAT_CBM, CMD_SRC_LCL ) | |
225 ( sn, mid, dcs, page, pages, &msg ); | |
226 } | |
227 } | |
228 #else | |
229 R_AT( RAT_CBM, CMD_SRC_LCL ) | |
230 ( sn, mid, dcs, page, pages, &msg ); | |
231 #endif | |
232 | |
233 /* If the SMS shared params indicate no valid source interested in | |
234 * the SMS indications, the indication is buffered */ /* Issue 25033 */ | |
235 if( smsShrdPrm.smsSrcId EQ CMD_SRC_NONE ) | |
236 { | |
237 #ifdef DTI | |
238 T_CNMI_IND ind; | |
239 | |
240 memcpy (&ind.cbm, mmi_cbch_ind, sizeof(T_MMI_CBCH_IND)); | |
241 cmd_addCnmiNtry ( CNMI_CBM, &ind ); | |
242 #endif | |
243 } | |
244 else | |
245 { | |
246 #ifdef FF_ATI | |
247 /* tell any remote source */ | |
248 for( idx = CMD_SRC_LCL+1; idx < CMD_SRC_MAX; idx++ ) | |
249 { | |
250 if (IS_SRC_USED (idx)) | |
251 { | |
252 R_AT( RAT_CBM, (T_ACI_CMD_SRC)idx ) ( mmi_cbch_ind ); | |
253 } | |
254 } | |
255 #endif | |
256 } | |
257 | |
258 return 0; | |
259 } | |
260 | |
261 /* Implements Measure#32: Row 1105 */ | |
262 /* | |
263 +-------------------------------------------------------------------+ | |
264 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
265 | STATE : code ROUTINE : cmhSMS_sdu_buf_print | | |
266 +-------------------------------------------------------------------+ | |
267 | |
268 PURPOSE : This function will print the sdu_bug contents | |
269 | |
270 */ | |
271 GLOBAL void cmhSMS_sdu_buf_print ( U8 *buf, | |
272 USHORT offset ) | |
273 { | |
274 char trcBuf[80]; | |
275 char *writeP; | |
276 int count,i,j; | |
277 | |
278 TRACE_EVENT("buf: "); | |
279 | |
280 count = offset; | |
281 for(i=0;i<2;i++) | |
282 { | |
283 writeP = trcBuf; | |
284 for (j=0; j<20; j++, count++) | |
285 { | |
286 writeP += sprintf (writeP, " %02X", buf[count]); | |
287 } | |
288 *writeP = '\0'; | |
289 TRACE_EVENT(trcBuf); | |
290 } | |
291 } | |
292 /* | |
293 +-------------------------------------------------------------------+ | |
294 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
295 | STATE : code ROUTINE : cmhSMS_SMSInitState | | |
296 +-------------------------------------------------------------------+ | |
297 | |
298 PURPOSE : This function is used to handle the | |
299 SMS_STATE_INITIALISING state. | |
300 */ | |
301 GLOBAL SHORT cmhSMS_SMSInitState ( T_MNSMS_MESSAGE_IND * mnsms_message_ind ) | |
302 { | |
303 #if defined SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
304 T_ACI_CMGL_SM sm; | |
305 T_ACI_SMS_STOR mem; /* holds message storage */ | |
306 UBYTE retCode = TRUE; | |
307 UBYTE msg_type; | |
308 #endif /* SMI OR defined MFW */ | |
309 | |
310 #ifdef _CONC_TESTING_ | |
311 #ifndef NTRACE | |
312 /* Implements Measure#32: Row 1105 */ | |
313 USHORT offset; | |
314 | |
315 TRACE_EVENT_P1("initstate:rec_num: %d", mnsms_message_ind->rec_num); | |
316 TRACE_EVENT_P1("initstate:status: %d", mnsms_message_ind->status); | |
317 offset = mnsms_message_ind->sms_sdu.o_buf>>3; | |
318 /* Implements Measure#32: Row 1105 */ | |
319 cmhSMS_sdu_buf_print(&(mnsms_message_ind->sms_sdu.buf[0]), offset); | |
320 #endif | |
321 #endif | |
322 | |
323 | |
324 TRACE_FUNCTION ("cmhSMS_SMSInitState()"); | |
325 | |
326 | |
327 switch (mnsms_message_ind->mem_type) | |
328 { | |
329 case MEM_ME: | |
330 if (mnsms_message_ind->rec_num NEQ SMS_RECORD_NOT_EXIST) | |
331 { | |
332 smsShrdPrm.aci_sms_parameter.meUsed++; | |
333 } | |
334 if (smsShrdPrm.aci_sms_parameter.meTotal EQ 0) | |
335 { | |
336 smsShrdPrm.aci_sms_parameter.meTotal = mnsms_message_ind->rec_max; | |
337 } | |
338 break; | |
339 case MEM_SM: | |
340 if (mnsms_message_ind->rec_num NEQ SMS_RECORD_NOT_EXIST) | |
341 { | |
342 smsShrdPrm.aci_sms_parameter.simUsed++; | |
343 TRACE_EVENT_P1("simUsed: %d", smsShrdPrm.aci_sms_parameter.simUsed); | |
344 } | |
345 if (smsShrdPrm.aci_sms_parameter.simTotal EQ 0) | |
346 { | |
347 smsShrdPrm.aci_sms_parameter.simTotal = mnsms_message_ind->rec_max; | |
348 TRACE_EVENT_P1("simTotal: %d", smsShrdPrm.aci_sms_parameter.simTotal); | |
349 } | |
350 break; | |
351 default: | |
352 TRACE_EVENT("wrong memtype"); | |
353 } | |
354 | |
355 #if defined SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
356 cmhSMS_getMemCmh ( mnsms_message_ind->mem_type, &mem ); | |
357 cmhSMS_SMSQueryType (&mnsms_message_ind->sms_sdu , &msg_type); | |
358 memset(&sm,0,sizeof(T_ACI_CMGL_SM) ); | |
359 if(msg_type NEQ TP_MTI_SMS_STATUS_REP) | |
360 { | |
361 /* Implements Measure # 110 */ | |
362 retCode = cmhSMS_cpyMsgIndReadCnf (&sm, | |
363 &mnsms_message_ind->status, | |
364 &mnsms_message_ind->sms_sdu, | |
365 mnsms_message_ind->rec_num); | |
366 } | |
367 if (retCode EQ FALSE) | |
368 { | |
369 TRACE_EVENT("cmhSMS_SMSInitState():[ERR] decoding of SMS"); | |
370 if (sm.stat NEQ SMS_STAT_Invalid) | |
371 { | |
372 TRACE_EVENT("cmhSMS_SMSInitState():[ERR] SMS decoding failed, but status not SMS_STAT_Invalid"); | |
373 } | |
374 } | |
375 | |
376 #if defined FF_MMI_RIV | |
377 /* in case of RIV MMI: check if SMBS is enabled for sending also PDU data */ | |
378 if(smsShrdPrm.perccmgf_smbs_mode EQ PERC_SMBS_MOD_ENABLE) | |
379 { | |
380 rAT_PlusCMTPdu (mnsms_message_ind); | |
381 } | |
382 #endif /* FF_MMI_RIV */ | |
383 //TISH, patch for class 0 SMS when initializing. | |
384 //start | |
385 if (mnsms_message_ind->rec_num EQ SMS_RECORD_NOT_EXIST) | |
386 { | |
387 | |
388 R_AT( RAT_CMT, CMD_SRC_LCL ) (&sm); | |
389 | |
390 } | |
391 else | |
392 //end | |
393 R_AT( RAT_CMTI, CMD_SRC_LCL ) | |
394 (mem, sm.msg_ref, &sm); | |
395 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */ | |
396 | |
397 return 0; | |
398 } | |
399 | |
400 | |
401 /* | |
402 +-------------------------------------------------------------------+ | |
403 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
404 | STATE : code ROUTINE : cmhSMS_SMSDelCnf | | |
405 +-------------------------------------------------------------------+ | |
406 | |
407 PURPOSE : This function is used to handle MNSMS_DELETE_CNF primitive. | |
408 */ | |
409 GLOBAL SHORT cmhSMS_SMSDelCnf ( T_MNSMS_DELETE_CNF * mnsms_delete_cnf ) | |
410 { | |
411 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
412 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
413 | |
414 #ifdef _CONC_TESTING_ | |
415 T_ACI_CMD_SRC srcId; /* Hold the request Source ID */ | |
416 T_CONC_INIT_RETURN ret; | |
417 #endif | |
418 | |
419 TRACE_FUNCTION ("cmhSMS_SMSDelCnf()"); | |
420 | |
421 /*-------------------------------------------------------------------------* | |
422 * In R99 one more flag is added in CMGD command which is used to delete * | |
423 * multiple messages of the same status ( READ, UNSENT, SENT etc ). * | |
424 * For this purpose the setting of global variables are done, once * | |
425 * the it is confirmed that all the messages of the same status are * | |
426 * deleted. * | |
427 *-------------------------------------------------------------------------*/ | |
428 | |
429 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
430 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
431 #ifdef _CONC_TESTING_ | |
432 srcId = smsShrdPrm.smsEntStat.entOwn; | |
433 #endif | |
434 #if defined SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
435 SET_OWNBUF_CONC; | |
436 #endif /*#if defined SMI OR defined MFW*/ | |
437 | |
438 | |
439 if(smsShrdPrm.status > CMGD_DEL_INDEX) | |
440 { | |
441 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
442 } | |
443 | |
444 if (IS_CAUSE_INVALID(mnsms_delete_cnf->cause)) /* no error */ | |
445 { | |
446 /* Check if the mnsms_delete_req for deleting messages of particular | |
447 status returned indicating no messages of requested status. Note | |
448 that in this case also we return OK to the user */ | |
449 if(mnsms_delete_cnf->rec_num NEQ 0) | |
450 { | |
451 switch (mnsms_delete_cnf->mem_type) | |
452 { | |
453 case MEM_ME: | |
454 smsShrdPrm.aci_sms_parameter.meUsed--; | |
455 break; | |
456 case MEM_SM: | |
457 smsShrdPrm.aci_sms_parameter.simUsed--; | |
458 break; | |
459 default: | |
460 TRACE_EVENT("wrong memtype"); | |
461 return AT_FAIL; | |
462 } | |
463 } | |
464 /*-----------------------------------------------------------------------* | |
465 * The below code is the new code added on 07/08/2003 due to the new * | |
466 * flag for CMGD command as mentioned in R99. This flag handles the * | |
467 * deletion of multiple messages. The deletion of concatination is * | |
468 * handled with different way other than handling normal indexed * | |
469 * messages. The deletion of normal concatination messages is done as * | |
470 * in the exiting code. But deletion of concatination message is handled * | |
471 * in the different way when delete flag is greater than ZERO. If the * | |
472 * delete flag in CMGD command is greater than ZERO, then there is no * | |
473 * concatination check is done. After receiving the response from SMS * | |
474 * with the deleted messages number, then we will do the concatination * | |
475 * check. If CONC_NEEDED flag is set, then we will clear the * | |
476 * concatinated list from the ACI. If CONC_NOT_NEEDED is set then check * | |
477 * for the next record values, if it is greater than ZERO then send one * | |
478 * more request for SMS to delete that message and repeat the above * | |
479 * process untill ACI recive's the next record values as ZERO. * | |
480 *-----------------------------------------------------------------------*/ | |
481 | |
482 if( smsShrdPrm.status > CMGD_DEL_INDEX AND | |
483 mnsms_delete_cnf->rec_num NEQ 0) | |
484 { | |
485 #if defined _CONC_TESTING_ | |
486 /*-----------------------------------------------------------------* | |
487 * Check for the concatination * | |
488 *-----------------------------------------------------------------*/ | |
489 | |
490 ret= concSMS_initDeleteFromMem (srcId, mnsms_delete_cnf->rec_num); | |
491 | |
492 if( ret EQ CONC_NEEDED ) | |
493 { | |
494 SET_CONC; | |
495 concSMS_DeleteConcList(); | |
496 } | |
497 #endif | |
498 if ( mnsms_delete_cnf->delete_rec_next NEQ 0 ) | |
499 { | |
500 cmhSMS_SendDelete_Req (mnsms_delete_cnf->delete_rec_next, | |
501 smsShrdPrm.status); | |
502 return 0; | |
503 } | |
504 } | |
505 /*-----------------------------------------------------------------------* | |
506 * Reset the command context * | |
507 *-----------------------------------------------------------------------*/ | |
508 | |
509 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
510 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
511 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
512 | |
513 /*-----------------------------------------------------------------------* | |
514 * The below code is used to handle the existing way where there is no * | |
515 * delete falg is set ( i.e. delete flag == 0 ) * | |
516 *-----------------------------------------------------------------------*/ | |
517 | |
518 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
519 if (ownBuf EQ CMD_SRC_LCL) | |
520 { | |
521 if( smsShrdPrm.status EQ CMGD_DEL_INDEX ) | |
522 { | |
523 #ifdef _CONC_TESTING_ | |
524 if (!ISSET_CONC) | |
525 { | |
526 #endif /* _CONC_TESTING_ */ | |
527 TRACE_EVENT("you just erased a normal SMS !"); | |
528 if(smsShrdPrm.rplyCB.cmgd NEQ NULL) | |
529 { | |
530 smsShrdPrm.rplyCB.cmgd( ); | |
531 } | |
532 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
533 #ifdef _CONC_TESTING_ | |
534 } | |
535 else | |
536 { | |
537 /*-----------------------------------------------------------------* | |
538 * Looks just about the same BUT: ISSET_CONC could be unsent * | |
539 * in RAT_CMGD, so let this after checking ISSET_CONC * | |
540 *-----------------------------------------------------------------*/ | |
541 | |
542 if(smsShrdPrm.rplyCB.cmgd NEQ NULL) | |
543 { | |
544 smsShrdPrm.rplyCB.cmgd( ); | |
545 } | |
546 } | |
547 #endif /* _CONC_TESTING_ */ | |
548 } | |
549 else | |
550 { | |
551 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
552 if(smsShrdPrm.rplyCB.cmgd NEQ NULL) | |
553 { | |
554 smsShrdPrm.rplyCB.cmgd( ); | |
555 } | |
556 | |
557 #if defined FF_MMI_RIV | |
558 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
559 #else | |
560 /* GPF-MMI */ | |
561 #ifdef _CONC_TESTING_ | |
562 if (!ISSET_CONC) | |
563 #endif /* _CONC_TESTING_ */ | |
564 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
565 } | |
566 #endif | |
567 } | |
568 else /* if (ownBuf EQ CMD_SRC_LCL) */ | |
569 #endif /*defined MFW OR defined FF_MMI_RIV*/ | |
570 { | |
571 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
572 } | |
573 } | |
574 else | |
575 { | |
576 /*-----------------------------------------------------------------------* | |
577 * Reset the command context * | |
578 *-----------------------------------------------------------------------*/ | |
579 | |
580 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
581 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
582 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
583 | |
584 if (smsShrdPrm.errorCB NEQ NULL) | |
585 { | |
586 smsShrdPrm.errorCB | |
587 ( | |
588 cmdBuf, | |
589 cmhSMS_GetCmsFromSms(mnsms_delete_cnf->cause), | |
590 NULL | |
591 ); | |
592 } | |
593 else | |
594 { | |
595 R_AT ( RAT_CMS, ownBuf ) ( cmdBuf, cmhSMS_GetCmsFromSms(mnsms_delete_cnf->cause), NULL ); | |
596 } | |
597 } | |
598 /* Reset status flag to CMGD_DEL_INDEX = 0 */ | |
599 smsShrdPrm.status = CMGD_DEL_INDEX; | |
600 return 0; | |
601 } | |
602 | |
603 | |
604 /* | |
605 +-------------------------------------------------------------------+ | |
606 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
607 | STATE : code ROUTINE : cmhSMS_SMSStoCnf | | |
608 +-------------------------------------------------------------------+ | |
609 | |
610 PURPOSE : This function is used to handle MNSMS_STORE_CNF primitive. | |
611 */ | |
612 GLOBAL SHORT cmhSMS_SMSStoCnf ( T_MNSMS_STORE_CNF * mnsms_store_cnf ) | |
613 { | |
614 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
615 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
616 | |
617 TRACE_FUNCTION ("cmhSMS_SMSStoCnf()"); | |
618 | |
619 /* | |
620 *----------------------------------------------------------------- | |
621 * reset the command context | |
622 *----------------------------------------------------------------- | |
623 */ | |
624 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
625 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
626 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
627 | |
628 #ifdef _CONC_TESTING_ | |
629 /* this is only for testing */ | |
630 SET_OWNBUF_CONC; | |
631 #endif | |
632 | |
633 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
634 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
635 | |
636 /* Check for current cmd is CMGMDU */ | |
637 if ( cmdBuf EQ AT_CMD_P_CMGMDU ) | |
638 { | |
639 if (IS_CAUSE_INVALID(mnsms_store_cnf->cause)) | |
640 { | |
641 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
642 if (ownBuf EQ CMD_SRC_LCL) | |
643 { | |
644 if(smsShrdPrm.rplyCB.cmgmdu NEQ NULL) | |
645 { | |
646 smsShrdPrm.rplyCB.cmgmdu(); | |
647 } | |
648 } | |
649 else | |
650 #endif /*#if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ */ | |
651 { | |
652 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
653 } | |
654 } | |
655 else | |
656 { | |
657 if ( ownBuf NEQ CMD_SRC_LCL ) | |
658 R_AT ( RAT_CMS, ownBuf ) | |
659 ( | |
660 cmdBuf, | |
661 cmhSMS_GetCmsFromSms(mnsms_store_cnf->cause), | |
662 NULL | |
663 ); | |
664 return -1; | |
665 } | |
666 } | |
667 else if (IS_CAUSE_INVALID(mnsms_store_cnf->cause)) | |
668 { | |
669 switch (mnsms_store_cnf->mem_type) | |
670 { | |
671 case MEM_ME: | |
672 smsShrdPrm.aci_sms_parameter.meUsed++; | |
673 break; | |
674 case MEM_SM: | |
675 smsShrdPrm.aci_sms_parameter.simUsed++; | |
676 break; | |
677 default: | |
678 TRACE_EVENT("incorrect memtype"); | |
679 return AT_FAIL; | |
680 } | |
681 #ifdef FF_ATI | |
682 /* "internal storage" handling -> storing from CNMI-buf to SIM/MS */ | |
683 if( smsShrdPrm.uiInternalSmsStorage NEQ CMD_SRC_NONE ) | |
684 { | |
685 if(mnsms_store_cnf->cause NEQ SMS_NO_ERROR) | |
686 { | |
687 TRACE_EVENT("cmhSMS_SMSStoCnf() : error at internal SMS storaging"); | |
688 cmd_clearCnmiBuf(); /* clear CNMI buffer */ | |
689 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
690 return -1; | |
691 } | |
692 | |
693 /* storing was succesful -> clear the stored msg. in CNMI buf */ | |
694 cmd_clearFirstCnmiMessage(); | |
695 | |
696 /* try with the next msg. in CNMI-buf */ | |
697 if( cmd_storeNextCnmiBufMsgToSim() NEQ TRUE ) /* do nothing if no more Msg's in CNMI buffer */ | |
698 { /* no more messagees could be sent */ | |
699 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
700 } | |
701 return 0; /* returns immediately if internal storage is running */ | |
702 } | |
703 #endif /* FF_ATI */ | |
704 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
705 if (ownBuf EQ CMD_SRC_LCL) | |
706 { | |
707 if(smsShrdPrm.rplyCB.cmgw NEQ NULL) | |
708 { | |
709 smsShrdPrm.rplyCB.cmgw( mnsms_store_cnf->rec_num, 1, mnsms_store_cnf->mem_type); | |
710 } | |
711 #if defined FF_MMI_RIV | |
712 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
713 #else | |
714 /* GPF-MMI */ | |
715 if (!ISSET_CONC) | |
716 { | |
717 TRACE_EVENT("you just wrote a normal SMS !"); | |
718 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
719 } | |
720 #endif /*#if !defined FF_MMI_RIV*/ | |
721 } | |
722 else | |
723 #endif /*#if defined MFW OR defined FF_MMI_RIV*/ | |
724 { | |
725 R_AT ( RAT_CMGW, ownBuf ) ( mnsms_store_cnf->rec_num ); | |
726 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
727 /* inform BMI */ | |
728 cmh_logRslt ( ownBuf, RAT_OK, AT_CMD_CMGW, mnsms_store_cnf->rec_num, | |
729 BS_SPEED_NotPresent,CME_ERR_NotPresent); | |
730 } | |
731 } | |
732 else | |
733 { | |
734 if( smsShrdPrm.uiInternalSmsStorage NEQ CMD_SRC_NONE ) | |
735 { | |
736 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
737 return 0; | |
738 } | |
739 | |
740 /* Implements Measure 114 */ | |
741 cmhSMS_ErrRes(ownBuf, cmdBuf, mnsms_store_cnf->cause); | |
742 } | |
743 return 0; | |
744 } | |
745 | |
746 | |
747 | |
748 /* | |
749 +-------------------------------------------------------------------+ | |
750 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
751 | STATE : code ROUTINE : cmhSMS_SMSSbmCnf | | |
752 +-------------------------------------------------------------------+ | |
753 | |
754 PURPOSE : This function is used to handle MNSMS_SUBMIT_CNF primitive. | |
755 */ | |
756 GLOBAL SHORT cmhSMS_SMSSbmCnf ( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf ) | |
757 { | |
758 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
759 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
760 #ifdef SIM_TOOLKIT | |
761 T_ACI_SAT_TERM_RESP resp_data; | |
762 #endif | |
763 | |
764 | |
765 #ifdef _CONC_TESTING_ | |
766 #ifndef NTRACE | |
767 /* Implements Measure#32: Row 1105 */ | |
768 USHORT offset; | |
769 | |
770 TRACE_EVENT_P1("cause: %d", mnsms_submit_cnf->cause); | |
771 offset = mnsms_submit_cnf->sms_sdu.o_buf>>3; | |
772 /* Implements Measure#32: Row 1105 */ | |
773 cmhSMS_sdu_buf_print(&(mnsms_submit_cnf->sms_sdu.buf[0]), offset); | |
774 #endif | |
775 #endif | |
776 | |
777 TRACE_FUNCTION ("cmhSMS_SMSSbmCnf()"); | |
778 | |
779 /* | |
780 *----------------------------------------------------------------- | |
781 * reset the command context | |
782 *----------------------------------------------------------------- | |
783 */ | |
784 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
785 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
786 | |
787 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
788 | |
789 #ifdef _CONC_TESTING_ | |
790 /* this is only for testing */ | |
791 SET_OWNBUF_CONC; | |
792 #endif | |
793 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
794 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
795 | |
796 #ifdef SIM_TOOLKIT | |
797 psaSAT_InitTrmResp( &resp_data ); | |
798 #endif | |
799 | |
800 if (IS_CAUSE_INVALID(mnsms_submit_cnf->cause)) | |
801 { | |
802 #ifdef REL99 | |
803 /* Since message transmission is successful, set the manual | |
804 retransmission flag as FALSE */ | |
805 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
806 #endif | |
807 smsShrdPrm.aci_sms_parameter.snd_msg_ref = mnsms_submit_cnf->tp_mr; | |
808 switch (cmdBuf) | |
809 { | |
810 case( AT_CMD_CMSS ): | |
811 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
812 if (ownBuf EQ CMD_SRC_LCL) | |
813 { | |
814 if(smsShrdPrm.rplyCB.cmss NEQ NULL) | |
815 { | |
816 smsShrdPrm.rplyCB.cmss( mnsms_submit_cnf->tp_mr, 1 ); | |
817 } | |
818 #if defined FF_MMI_RIV | |
819 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
820 #else | |
821 if (!ISSET_CONC) | |
822 { | |
823 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
824 } | |
825 #endif /* FF_MMI_RIV */ | |
826 } | |
827 else /* if (ownBuf EQ CMD_SRC_LCL) */ | |
828 #endif /*#if defined MFW OR defined FF_MMI_RIV*/ | |
829 { | |
830 R_AT ( RAT_CMSS, ownBuf ) ( mnsms_submit_cnf ); | |
831 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
832 /* inform BMI */ | |
833 cmh_logRslt ( ownBuf, RAT_OK, AT_CMD_CMSS, mnsms_submit_cnf->rec_num, | |
834 BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
835 } | |
836 break; | |
837 case( AT_CMD_CMGS ): | |
838 #if defined (SIM_TOOLKIT) | |
839 if (ownBuf EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT)) | |
840 { | |
841 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
842 break; | |
843 } | |
844 #endif | |
845 if (mnsms_submit_cnf->rec_num NEQ SMS_RECORD_NOT_EXIST) | |
846 { | |
847 switch (mnsms_submit_cnf->mem_type) | |
848 { | |
849 case MEM_ME: | |
850 smsShrdPrm.aci_sms_parameter.meUsed++; | |
851 break; | |
852 case MEM_SM: | |
853 smsShrdPrm.aci_sms_parameter.simUsed++; | |
854 break; | |
855 default: | |
856 TRACE_EVENT("incorrect memtype"); | |
857 return AT_FAIL; | |
858 } | |
859 } | |
860 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
861 if (ownBuf EQ CMD_SRC_LCL) | |
862 { | |
863 if(smsShrdPrm.rplyCB.cmgs NEQ NULL) | |
864 { | |
865 smsShrdPrm.rplyCB.cmgs( mnsms_submit_cnf->tp_mr, 1 ); | |
866 } | |
867 #if defined FF_MMI_RIV | |
868 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
869 #else | |
870 if (!ISSET_CONC) | |
871 { | |
872 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
873 } | |
874 #endif /* FF_MMI_RIV */ | |
875 } | |
876 else /* if (ownBuf EQ CMD_SRC_LCL) */ | |
877 #endif /*#if defined MFW OR defined FF_MMI_RIV*/ | |
878 { | |
879 R_AT ( RAT_CMGS, ownBuf ) ( mnsms_submit_cnf ); | |
880 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
881 /* inform BMI */ | |
882 cmh_logRslt ( ownBuf, RAT_OK, AT_CMD_CMGS, mnsms_submit_cnf->rec_num, | |
883 BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
884 } | |
885 } /* switch */ | |
886 } | |
887 else /* if (mnsms_submit_cnf->rslt_type EQ SMS_RT_NON) */ | |
888 { | |
889 #if defined (SIM_TOOLKIT) | |
890 if (ownBuf EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT)) | |
891 { | |
892 #ifdef REL99 | |
893 /* Manual retransmission is not allowed when last failed message | |
894 was sent from SAT */ | |
895 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
896 #endif /* REL99 */ | |
897 cmhSMS_SATResult (&resp_data, mnsms_submit_cnf->cause); | |
898 } | |
899 #endif | |
900 | |
901 #ifdef REL99 | |
902 #if defined _CONC_TESTING_ | |
903 if (ISSET_CONC) | |
904 { | |
905 /* Manual retransmission is not allowed when last failed message | |
906 is part of a long message */ | |
907 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
908 } | |
909 else | |
910 #endif | |
911 { | |
912 /* Last failed message is available for retransmission */ | |
913 smsShrdPrm.is_msg_present_for_retrans = TRUE; | |
914 } | |
915 #endif /* REL99 */ | |
916 | |
917 /* Implements Measure 114 */ | |
918 cmhSMS_ErrRes (ownBuf, cmdBuf, mnsms_submit_cnf->cause); | |
919 } | |
920 return 0; | |
921 } | |
922 | |
923 /* | |
924 +-------------------------------------------------------------------+ | |
925 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
926 | STATE : code ROUTINE : cmhSMS_SMSCmdCnf | | |
927 +-------------------------------------------------------------------+ | |
928 | |
929 PURPOSE : This function is used to handle MNSMS_COMMAND_CNF primitive. | |
930 */ | |
931 GLOBAL SHORT cmhSMS_SMSCmdCnf ( T_MNSMS_COMMAND_CNF * mnsms_command_cnf ) | |
932 { | |
933 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
934 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
935 #ifdef SIM_TOOLKIT | |
936 T_ACI_SAT_TERM_RESP resp_data; | |
937 psaSAT_InitTrmResp( &resp_data ); | |
938 #endif | |
939 | |
940 TRACE_FUNCTION ("cmhSMS_SMSCmdCnf()"); | |
941 | |
942 | |
943 /* | |
944 *----------------------------------------------------------------- | |
945 * reset the command context | |
946 *----------------------------------------------------------------- | |
947 */ | |
948 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
949 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
950 | |
951 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
952 | |
953 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
954 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
955 | |
956 if (IS_CAUSE_INVALID(mnsms_command_cnf->cause)) | |
957 { | |
958 #ifdef REL99 | |
959 /* Since message transmission is successful, set the manual | |
960 retransmission flag as FALSE */ | |
961 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
962 #endif /* REL99 */ | |
963 #ifdef _CONC_TESTING_ | |
964 /* this is only for testing */ | |
965 SET_OWNBUF_CONC; | |
966 #endif | |
967 | |
968 #if defined (SIM_TOOLKIT) | |
969 if (ownBuf EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT)) | |
970 { | |
971 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
972 } | |
973 #endif | |
974 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
975 if (ownBuf EQ CMD_SRC_LCL) | |
976 { | |
977 if(smsShrdPrm.rplyCB.cmgc NEQ NULL) | |
978 { | |
979 smsShrdPrm.rplyCB.cmgc( mnsms_command_cnf->tp_mr ); | |
980 } | |
981 #if defined FF_MMI_RIV | |
982 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
983 #else | |
984 if (!ISSET_CONC) | |
985 { | |
986 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
987 } | |
988 #endif /*!defined FF_MMI_RIV*/ | |
989 } | |
990 else /* if (ownBuf EQ CMD_SRC_LCL) */ | |
991 #endif /*defined MFW OR defined FF_MMI_RIV*/ | |
992 { | |
993 R_AT ( RAT_CMGC, ownBuf ) ( mnsms_command_cnf ); | |
994 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
995 /* inform BMI */ | |
996 /* This does not make much sense, but nice to have it for future requests */ | |
997 /* cmh_logRslt ( ownBuf, RAT_OK, AT_CMD_CMGC, -1, -1, -1 ); */ | |
998 } | |
999 | |
1000 } | |
1001 else | |
1002 { | |
1003 #if defined (SIM_TOOLKIT) | |
1004 if (ownBuf EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT)) | |
1005 { | |
1006 #ifdef REL99 | |
1007 /* Manual retransmission is not allowed when last failed message | |
1008 was sent from SAT */ | |
1009 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
1010 #endif /* REL99 */ | |
1011 cmhSMS_SATResult (&resp_data, mnsms_command_cnf->cause); | |
1012 } | |
1013 #endif | |
1014 | |
1015 #ifdef REL99 | |
1016 #if defined _CONC_TESTING_ | |
1017 if (ISSET_CONC) | |
1018 { | |
1019 /* Manual retransmission is not allowed when last failed message | |
1020 is part of a long message */ | |
1021 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
1022 } | |
1023 else | |
1024 #endif | |
1025 { | |
1026 /* Last failed message is available for retransmission */ | |
1027 smsShrdPrm.is_msg_present_for_retrans = TRUE; | |
1028 } | |
1029 #endif /* REL99 */ | |
1030 | |
1031 #ifdef REL99 | |
1032 if (ownBuf NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
1033 #endif | |
1034 | |
1035 | |
1036 R_AT ( RAT_CMS, ownBuf ) | |
1037 ( | |
1038 cmdBuf, | |
1039 cmhSMS_GetCmsFromSms(mnsms_command_cnf->cause), | |
1040 NULL | |
1041 ); | |
1042 } | |
1043 return 0; | |
1044 } | |
1045 | |
1046 #ifdef REL99 | |
1047 /* | |
1048 +-------------------------------------------------------------------+ | |
1049 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1050 | STATE : code ROUTINE : cmhSMS_SMSRetransCnf | | |
1051 +-------------------------------------------------------------------+ | |
1052 | |
1053 PURPOSE : This function is used to handle MNSMS_RETRANS_CNF primitive. | |
1054 */ | |
1055 GLOBAL SHORT cmhSMS_SMSRetransCnf ( T_MNSMS_RETRANS_CNF * mnsms_retrans_cnf ) | |
1056 { | |
1057 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
1058 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1059 | |
1060 TRACE_FUNCTION ("cmhSMS_SMSRetransCnf()"); | |
1061 | |
1062 /* | |
1063 *----------------------------------------------------------------- | |
1064 * reset the command context | |
1065 *----------------------------------------------------------------- | |
1066 */ | |
1067 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
1068 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
1069 | |
1070 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
1071 | |
1072 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
1073 smsShrdPrm.owner = OWN_SRC_INV; | |
1074 | |
1075 if (IS_CAUSE_INVALID(mnsms_retrans_cnf->cause)) | |
1076 { | |
1077 /* Since message transmission is successful, set the manual | |
1078 retransmission flag as FALSE */ | |
1079 smsShrdPrm.is_msg_present_for_retrans = FALSE; | |
1080 | |
1081 smsShrdPrm.aci_sms_parameter.snd_msg_ref = mnsms_retrans_cnf->tp_mr; | |
1082 | |
1083 if (mnsms_retrans_cnf->rec_num NEQ SMS_RECORD_NOT_EXIST) | |
1084 { | |
1085 switch (mnsms_retrans_cnf->mem_type) | |
1086 { | |
1087 case MEM_ME: | |
1088 smsShrdPrm.aci_sms_parameter.meUsed++; | |
1089 break; | |
1090 case MEM_SM: | |
1091 smsShrdPrm.aci_sms_parameter.simUsed++; | |
1092 break; | |
1093 default: | |
1094 TRACE_EVENT("incorrect memtype"); | |
1095 return AT_FAIL; | |
1096 } | |
1097 } | |
1098 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
1099 if (ownBuf EQ CMD_SRC_LCL) | |
1100 { | |
1101 if (smsShrdPrm.rplyCB.cmgrs NEQ NULL) | |
1102 { | |
1103 smsShrdPrm.rplyCB.cmgrs( CMGRS_MODE_MANUAL_RETRANS, | |
1104 mnsms_retrans_cnf->tp_mr, | |
1105 NOT_PRESENT_8BIT, NOT_PRESENT_8BIT); | |
1106 } | |
1107 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
1108 } | |
1109 else /* if (ownBuf EQ CMD_SRC_LCL) */ | |
1110 #endif /*#if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_*/ | |
1111 { | |
1112 R_AT ( RAT_P_CMGRS, ownBuf ) ( CMGRS_MODE_MANUAL_RETRANS, | |
1113 mnsms_retrans_cnf, NULL ); | |
1114 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
1115 } | |
1116 } | |
1117 else /* if (IS_CAUSE_INVALID(mnsms_retrans_cnf->cause)) */ | |
1118 { | |
1119 if (ownBuf EQ CMD_SRC_LCL) | |
1120 { | |
1121 if (smsShrdPrm.errorCB NEQ NULL) | |
1122 { | |
1123 smsShrdPrm.errorCB | |
1124 ( | |
1125 cmdBuf, | |
1126 cmhSMS_GetCmsFromSms(mnsms_retrans_cnf->cause), | |
1127 NULL | |
1128 ); | |
1129 } | |
1130 } | |
1131 else if (ownBuf NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
1132 { | |
1133 R_AT ( RAT_CMS, ownBuf ) | |
1134 ( | |
1135 cmdBuf, | |
1136 cmhSMS_GetCmsFromSms(mnsms_retrans_cnf->cause), | |
1137 NULL | |
1138 ); | |
1139 } | |
1140 } | |
1141 return 0; | |
1142 } | |
1143 | |
1144 /* | |
1145 +-------------------------------------------------------------------+ | |
1146 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1147 | STATE : code ROUTINE : cmhSMS_SMSSendProgInd | | |
1148 +-------------------------------------------------------------------+ | |
1149 | |
1150 PURPOSE : This function is used to handle MNSMS_SEND_PROG_IND primitive. | |
1151 */ | |
1152 | |
1153 GLOBAL SHORT cmhSMS_SMSSendProgInd (T_MNSMS_SEND_PROG_IND * mnsms_send_prog_ind) | |
1154 { | |
1155 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1156 | |
1157 TRACE_FUNCTION ("cmhSMS_SMSSendProgInd()"); | |
1158 | |
1159 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
1160 | |
1161 #if defined (MFW) OR defined (FF_MMI_RIV) OR defined (_CONC_TESTING_) | |
1162 if (ownBuf EQ CMD_SRC_LCL) | |
1163 { | |
1164 rAT_PercentCMGRS( CMGRS_MODE_ENABLE_AUTO_RETRANS, NOT_PRESENT_8BIT, | |
1165 mnsms_send_prog_ind->resend_count, | |
1166 mnsms_send_prog_ind->max_retrans); | |
1167 } | |
1168 else | |
1169 #endif /*#if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_*/ | |
1170 { | |
1171 R_AT ( RAT_P_CMGRS, ownBuf ) ( CMGRS_MODE_ENABLE_AUTO_RETRANS, | |
1172 NULL, | |
1173 mnsms_send_prog_ind ); | |
1174 } | |
1175 return 0; | |
1176 } | |
1177 #endif /* REl99 */ | |
1178 | |
1179 | |
1180 /* | |
1181 +-------------------------------------------------------------------+ | |
1182 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1183 | STATE : code ROUTINE : cmhSMS_SMSErrorInd | | |
1184 +-------------------------------------------------------------------+ | |
1185 | |
1186 PURPOSE : This function is used to handle MNSMS_ERROR_IND primitive. | |
1187 */ | |
1188 GLOBAL SHORT cmhSMS_SMSErrorInd ( T_MNSMS_ERROR_IND * mnsms_error_ind ) | |
1189 { | |
1190 T_ACI_MM_CIND_VAL_TYPE sIndValues; | |
1191 int i; | |
1192 | |
1193 TRACE_FUNCTION ("cmhSMS_SMSErrorInd()"); | |
1194 | |
1195 TRACE_EVENT_P1("MNSMS_ERROR_IND: 0x%4.4X", (int)mnsms_error_ind->cause); | |
1196 | |
1197 if( (mnsms_error_ind->cause NEQ SMS_CAUSE_MEM_FULL) AND | |
1198 (mnsms_error_ind->cause NEQ SMS_CAUSE_MEM_AVAIL) ) | |
1199 { | |
1200 smsShrdPrm.cnma_ack_expected = FALSE; | |
1201 cmhSMS_resetMtDsCnmiParam(); | |
1202 } | |
1203 else | |
1204 { /* process the SMS memory full/avail indication */ | |
1205 sIndValues.sCindSmsFullParam = (mnsms_error_ind->cause EQ SMS_CAUSE_MEM_AVAIL) | |
1206 ? CIND_SMSFULL_INDICATOR_MEMAVAIL | |
1207 : CIND_SMSFULL_INDICATOR_MEMFULL; | |
1208 sIndValues.sCindSignalParam = CIND_SIGNAL_INDICATOR_INVALID; | |
1209 | |
1210 for( i = CMD_SRC_LCL; i < CMD_SRC_MAX; i++) | |
1211 { | |
1212 if( ((cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCINDSettings.sCindSmsFullParam EQ CIND_SMSFULL_INDICATOR_MEMFULL) AND | |
1213 (cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCMERSettings.sCmerIndParam EQ CMER_INDICATOR_2)) OR | |
1214 ((cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCINDSettings.sCindSmsFullParam <= CIND_SMSFULL_INDICATOR_MEMAVAIL) AND | |
1215 (cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCMERSettings.sCmerIndParam EQ CMER_INDICATOR_1)) ) | |
1216 { /* process the service of +CIEV */ | |
1217 TRACE_EVENT("send +CIEV (SMS-full/avail)"); | |
1218 R_AT (RAT_CIEV, (T_ACI_CMD_SRC)i) ( sIndValues, cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCMERSettings ); | |
1219 } | |
1220 } | |
1221 } | |
1222 return 0; | |
1223 } | |
1224 | |
1225 /* | |
1226 +-------------------------------------------------------------------+ | |
1227 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1228 | STATE : code ROUTINE : cmhSMS_SMSDeliver | | |
1229 +-------------------------------------------------------------------+ | |
1230 | |
1231 PURPOSE : This function is used to notify the command handler of | |
1232 the receiving of a SMS-DELIVER. | |
1233 */ | |
1234 #ifndef NTRACE | |
1235 LOCAL void trace_SMSDeliver ( T_MNSMS_MESSAGE_IND * mnsms_message_ind ) | |
1236 { | |
1237 #ifdef _CONC_TESTING_ | |
1238 | |
1239 /* Implements Measure#32: Row 1105 */ | |
1240 USHORT offset; | |
1241 | |
1242 TRACE_FUNCTION ("trace_SMSDeliver"); | |
1243 | |
1244 TRACE_EVENT_P1("cmt:bitoffset:%d", mnsms_message_ind->sms_sdu.o_buf); | |
1245 TRACE_EVENT_P1("cmt:lenght:%d", mnsms_message_ind->sms_sdu.l_buf); | |
1246 offset = mnsms_message_ind->sms_sdu.o_buf>>3; | |
1247 /* Implements Measure#32: Row 1105 */ | |
1248 cmhSMS_sdu_buf_print(&(mnsms_message_ind->sms_sdu.buf[0]), offset); | |
1249 #endif | |
1250 } | |
1251 #endif | |
1252 | |
1253 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1254 LOCAL void rAT_SMS_Deliver(T_MNSMS_MESSAGE_IND * mnsms_message_ind, T_ACI_CMGL_SM *p_sm) | |
1255 { | |
1256 #ifdef FF_MMI_RIV | |
1257 T_ACI_CMGF_MOD sms_input_mode = CMGF_MOD_NotPresent; | |
1258 #endif /* FF_MMI_RIV */ | |
1259 | |
1260 TRACE_FUNCTION ("rAT_SMS_Deliver"); | |
1261 | |
1262 #ifdef FF_MMI_RIV | |
1263 if(smsShrdPrm.perccmgf_smbs_mode EQ PERC_SMBS_MOD_ENABLE) | |
1264 { | |
1265 /*send both formats*/ | |
1266 rAT_PlusCMTPdu (mnsms_message_ind); | |
1267 R_AT( RAT_CMT, CMD_SRC_LCL ) (p_sm); | |
1268 return; | |
1269 } | |
1270 | |
1271 /* else: no SMBS enabled, CMGF mode decides */ | |
1272 qAT_PlusCMGF (CMD_SRC_LCL, &sms_input_mode); | |
1273 if (sms_input_mode EQ CMGF_MOD_Pdu) | |
1274 { | |
1275 rAT_PlusCMTPdu (mnsms_message_ind); | |
1276 } | |
1277 else | |
1278 { | |
1279 R_AT( RAT_CMT, CMD_SRC_LCL ) (p_sm); | |
1280 } | |
1281 return; | |
1282 #endif /* FF_MMI_RIV */ | |
1283 | |
1284 /* if GPF MMI call usual callback */ | |
1285 R_AT( RAT_CMT, CMD_SRC_LCL ) (p_sm); | |
1286 } | |
1287 #endif /* SMI OR defined MFW OR defined FF_MMI_RIV */ | |
1288 | |
1289 GLOBAL SHORT cmhSMS_SMSDeliver ( T_MNSMS_MESSAGE_IND * mnsms_message_ind ) | |
1290 { | |
1291 UBYTE idx; | |
1292 #if defined SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
1293 T_ACI_CMGL_SM *p_sm; | |
1294 #endif /* SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_*/ | |
1295 | |
1296 TRACE_FUNCTION ("cmhSMS_SMSDeliver"); | |
1297 | |
1298 #ifndef NTRACE | |
1299 trace_SMSDeliver ( mnsms_message_ind ); | |
1300 #endif | |
1301 | |
1302 if( smsShrdPrm.CNMImt EQ 0 ) | |
1303 { | |
1304 TRACE_EVENT("cmhSMS_SMSDeliver():[ERR] <mt>==0 -> SMS will not be routed "); | |
1305 return 0; | |
1306 } | |
1307 | |
1308 #if defined SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
1309 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CMGL_SM) ); | |
1310 p_sm = smsShrdPrm.pDecMsg; | |
1311 /* Implements Measure # 110 */ | |
1312 if (cmhSMS_cpyMsgIndReadCnf (p_sm, &mnsms_message_ind->status, | |
1313 &mnsms_message_ind->sms_sdu, mnsms_message_ind->rec_num) EQ FALSE ) | |
1314 { | |
1315 TRACE_EVENT("cmhSMS_SMSDeliver():[ERR] decoding of SMS"); | |
1316 if (p_sm->stat NEQ SMS_STAT_Invalid) | |
1317 { | |
1318 TRACE_EVENT("cmhSMS_SMSDeliver():[ERR] SMS decoding failed, but status not SMS_STAT_Invalid"); | |
1319 } | |
1320 } | |
1321 #endif /* SMI OR defined MFW OR defined FF_MMI_RIV */ | |
1322 | |
1323 | |
1324 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
1325 smsShrdPrm.cnma_ack_expected = TRUE; | |
1326 | |
1327 /* | |
1328 *----------------------------------------------------------------- | |
1329 * new message indication | |
1330 *----------------------------------------------------------------- | |
1331 */ | |
1332 | |
1333 /* inform LOCAL MMI of new message */ | |
1334 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1335 rAT_SMS_Deliver(mnsms_message_ind, p_sm); | |
1336 #endif /* SMI OR defined MFW OR defined FF_MMI_RIV */ | |
1337 | |
1338 /* If the SMS shared params indicate no valid source interested in | |
1339 * the SMS indications, the indication is buffered */ /* Issue 25033 */ | |
1340 if( smsShrdPrm.smsSrcId EQ CMD_SRC_NONE ) | |
1341 { | |
1342 T_CNMI_IND ind; | |
1343 | |
1344 TRACE_EVENT("cmhSMS_SMSDeliver(): No registered source for "); | |
1345 memcpy ( &ind.cmt, mnsms_message_ind, sizeof ( T_MNSMS_MESSAGE_IND) ); | |
1346 #ifdef DTI | |
1347 cmd_addCnmiNtry ( CNMI_CMT, &ind ); | |
1348 #endif | |
1349 if ( smsShrdPrm.cnma_ack_expected EQ TRUE ) | |
1350 { /* the acknowledge must be send automatically, because terminal is busy */ | |
1351 PALLOC (mnsms_ack_res, MNSMS_ACK_RES); | |
1352 | |
1353 TRACE_EVENT("rCI_PlusCMT(): send 'automatic' acknowledge (Phase2+ mode and buffer)"); | |
1354 | |
1355 mnsms_ack_res->resp = SMS_RP_ACK; | |
1356 mnsms_ack_res->sms_sdu.o_buf = 0; | |
1357 mnsms_ack_res->sms_sdu.l_buf = 0; | |
1358 | |
1359 PSENDX (SMS, mnsms_ack_res); | |
1360 | |
1361 smsShrdPrm.cnma_ack_expected = FALSE; | |
1362 } | |
1363 } | |
1364 else | |
1365 { | |
1366 /* tell any remote source */ | |
1367 for( idx = CMD_SRC_LCL+1; idx < CMD_SRC_MAX; idx++ ) | |
1368 { | |
1369 #if defined _SIMULATION_ AND defined _CONC_TESTING_ | |
1370 /* don't display "+CMT: ..." in simulation if conc testing */ | |
1371 if (!concShrdPrm.concTesting) | |
1372 #endif | |
1373 { | |
1374 R_AT( RAT_CMT, (T_ACI_CMD_SRC)idx ) ( mnsms_message_ind ); | |
1375 } | |
1376 } | |
1377 } | |
1378 | |
1379 if (smsShrdPrm.pDecMsg) | |
1380 { | |
1381 ACI_MFREE(smsShrdPrm.pDecMsg); | |
1382 smsShrdPrm.pDecMsg = NULL; | |
1383 } | |
1384 | |
1385 return 0; | |
1386 } | |
1387 | |
1388 | |
1389 /* | |
1390 +-------------------------------------------------------------------+ | |
1391 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1392 | STATE : code ROUTINE : cmhSMS_SMSMemory | | |
1393 +-------------------------------------------------------------------+ | |
1394 | |
1395 PURPOSE : This function is used to notify the command handler of | |
1396 an incoming SMS written to preferred message storage. | |
1397 */ | |
1398 GLOBAL SHORT cmhSMS_SMSMemory ( T_MNSMS_MESSAGE_IND * mnsms_message_ind) | |
1399 { | |
1400 USHORT idx; /* holds command source id */ | |
1401 T_ACI_SMS_STOR mem; /* holds message storage */ | |
1402 T_ACI_CMGL_SM sm; | |
1403 | |
1404 #ifdef _CONC_TESTING_ | |
1405 #ifndef NTRACE | |
1406 /* Implements Measure#32: Row 1105 */ | |
1407 USHORT offset; | |
1408 | |
1409 TRACE_EVENT_P1("cmti:rec_num: %d", mnsms_message_ind->rec_num); | |
1410 TRACE_EVENT_P1("cmti:status: %d", mnsms_message_ind->status); | |
1411 offset = mnsms_message_ind->sms_sdu.o_buf>>3; | |
1412 /* Implements Measure#32: Row 1105 */ | |
1413 cmhSMS_sdu_buf_print(&(mnsms_message_ind->sms_sdu.buf[0]), offset); | |
1414 #endif | |
1415 #endif | |
1416 | |
1417 TRACE_FUNCTION ("cmhSMS_SMSMemory ()"); | |
1418 | |
1419 cmhSMS_getMemCmh ( mnsms_message_ind->mem_type, &mem ); | |
1420 | |
1421 switch (mnsms_message_ind->mem_type) | |
1422 { | |
1423 case MEM_ME: | |
1424 smsShrdPrm.aci_sms_parameter.meUsed++; | |
1425 break; | |
1426 case MEM_SM: | |
1427 smsShrdPrm.aci_sms_parameter.simUsed++; | |
1428 break; | |
1429 default: | |
1430 TRACE_EVENT("wrong memtype"); | |
1431 return AT_FAIL; | |
1432 } | |
1433 | |
1434 #if defined SMI OR defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
1435 /* Implements Measure # 110 */ | |
1436 if (cmhSMS_cpyMsgIndReadCnf (&sm, &mnsms_message_ind->status, | |
1437 &mnsms_message_ind->sms_sdu, mnsms_message_ind->rec_num) EQ FALSE ) | |
1438 { | |
1439 TRACE_EVENT("cmhSMS_SMSMemory ():[ERR] decoding of SMS"); | |
1440 if (sm.stat NEQ SMS_STAT_Invalid) | |
1441 { | |
1442 TRACE_EVENT("cmhSMS_SMSMemory():[ERR] SMS decoding failed, but status not SMS_STAT_Invalid"); | |
1443 } | |
1444 } | |
1445 #endif | |
1446 | |
1447 | |
1448 /* | |
1449 *----------------------------------------------------------------- | |
1450 * new message indication | |
1451 *----------------------------------------------------------------- | |
1452 */ | |
1453 | |
1454 | |
1455 #if defined FF_MMI_RIV | |
1456 /* in case of RIV MMI: check if SMBS is enabled for sending also PDU data */ | |
1457 if(smsShrdPrm.perccmgf_smbs_mode EQ PERC_SMBS_MOD_ENABLE) | |
1458 { | |
1459 rAT_PlusCMTPdu (mnsms_message_ind); | |
1460 } | |
1461 #endif /* FF_MMI_RIV */ | |
1462 | |
1463 R_AT( RAT_CMTI, CMD_SRC_LCL ) (mem, sm.msg_ref, &sm); | |
1464 | |
1465 /* If the SMS shared params indicate no valid source interested in | |
1466 * the SMS indications, the indication is buffered */ /* Issue 25033 */ | |
1467 if( smsShrdPrm.smsSrcId EQ CMD_SRC_NONE ) | |
1468 { | |
1469 T_CNMI_IND ind; | |
1470 ind.cmti.mem = mem; | |
1471 ind.cmti.index = mnsms_message_ind->rec_num; | |
1472 #ifdef DTI | |
1473 cmd_addCnmiNtry ( CNMI_CMTI, &ind ); | |
1474 #endif | |
1475 } | |
1476 else | |
1477 { | |
1478 for( idx = CMD_SRC_LCL+1; idx < CMD_SRC_MAX; idx++ ) | |
1479 { | |
1480 #if defined _SIMULATION_ AND defined _CONC_TESTING_ | |
1481 /* don't display "+CMT: ..." in simulation if conc testing */ | |
1482 if (!concShrdPrm.concTesting) | |
1483 #endif | |
1484 { | |
1485 /* don't need the decoded message for Command Interpreter */ | |
1486 R_AT( RAT_CMTI, (T_ACI_CMD_SRC)idx ) ( mem, mnsms_message_ind->rec_num ); | |
1487 } | |
1488 } | |
1489 } | |
1490 | |
1491 return AT_CMPL; | |
1492 } | |
1493 | |
1494 /* | |
1495 +-------------------------------------------------------------------+ | |
1496 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1497 | STATE : code ROUTINE : cmhSMS_SMSStatRpt | | |
1498 +-------------------------------------------------------------------+ | |
1499 | |
1500 PURPOSE : This function is used to notify the command handler of | |
1501 the receiving of a SMS-STATUS-REPORT. | |
1502 */ | |
1503 GLOBAL SHORT cmhSMS_SMSStatRpt ( T_MNSMS_STATUS_IND * mnsms_status_ind ) | |
1504 { | |
1505 USHORT idx; /* holds command source id */ | |
1506 T_ACI_CDS_SM* p_st; | |
1507 | |
1508 TRACE_FUNCTION ("cmhSMS_SMSStatRpt ()"); | |
1509 | |
1510 | |
1511 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1512 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CDS_SM) ); | |
1513 p_st = (T_ACI_CDS_SM*)smsShrdPrm.pDecMsg; | |
1514 cmhSMS_cpyStatInd ( p_st, mnsms_status_ind); | |
1515 #endif | |
1516 | |
1517 | |
1518 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus) | |
1519 smsShrdPrm.cnma_ack_expected = TRUE; | |
1520 | |
1521 /* | |
1522 *----------------------------------------------------------------- | |
1523 * new message indication | |
1524 *----------------------------------------------------------------- | |
1525 */ | |
1526 { | |
1527 #ifdef FF_MMI_RIV | |
1528 T_ACI_CMGF_MOD sms_input_mode = CMGF_MOD_NotPresent; | |
1529 #endif /* FF_MMI_RIV */ | |
1530 | |
1531 /* If the SMS shared params indicate no valid source interested in | |
1532 * the SMS indications, the indication is buffered */ /* Issue 25033 */ | |
1533 if( smsShrdPrm.smsSrcId EQ CMD_SRC_NONE ) | |
1534 { | |
1535 T_CNMI_IND ind; | |
1536 | |
1537 memcpy ( &ind.cds, mnsms_status_ind, sizeof ( T_MNSMS_STATUS_IND) ); | |
1538 #ifdef DTI | |
1539 cmd_addCnmiNtry ( CNMI_CDS, &ind ); | |
1540 #endif | |
1541 } | |
1542 | |
1543 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
1544 { | |
1545 if (idx EQ CMD_SRC_LCL) | |
1546 { | |
1547 #ifdef FF_MMI_RIV | |
1548 qAT_PlusCMGF (CMD_SRC_LCL, &sms_input_mode); | |
1549 if (sms_input_mode EQ CMGF_MOD_Pdu) | |
1550 { | |
1551 rAT_PlusCDSPdu (mnsms_status_ind); | |
1552 } | |
1553 else | |
1554 { | |
1555 R_AT( RAT_CDS, idx ) ( p_st ); | |
1556 } | |
1557 #else | |
1558 R_AT( RAT_CDS,(T_ACI_CMD_SRC)idx ) ( p_st ); | |
1559 #endif | |
1560 } | |
1561 else | |
1562 { | |
1563 R_AT( RAT_CDS, (T_ACI_CMD_SRC)idx ) ( mnsms_status_ind ); | |
1564 } | |
1565 | |
1566 } | |
1567 } | |
1568 | |
1569 if (smsShrdPrm.pDecMsg) | |
1570 { | |
1571 ACI_MFREE(smsShrdPrm.pDecMsg); | |
1572 smsShrdPrm.pDecMsg = NULL; | |
1573 } | |
1574 | |
1575 return 0; | |
1576 } | |
1577 | |
1578 | |
1579 /* | |
1580 +-------------------------------------------------------------------+ | |
1581 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1582 | STATE : code ROUTINE : cmhSMS_cpyLstData | | |
1583 +-------------------------------------------------------------------+ | |
1584 | |
1585 PURPOSE : This function is used to copy the data read from memory. | |
1586 It sends a notification using the callback mechanism of | |
1587 ACI if necessary. | |
1588 */ | |
1589 GLOBAL void cmhSMS_cpyLstData ( T_ACI_AT_CMD curCmd, | |
1590 T_ACI_CMD_SRC entOwn, | |
1591 T_MNSMS_READ_CNF * mnsms_read_cnf ) | |
1592 { | |
1593 SHORT nextIdx; /* index of next short message */ | |
1594 | |
1595 TRACE_FUNCTION ("cmhSMS_cpyLstData ()"); | |
1596 | |
1597 nextIdx = mnsms_read_cnf->rec_next; | |
1598 | |
1599 if ( entOwn EQ CMD_SRC_LCL) | |
1600 { | |
1601 #ifdef FF_MMI_RIV | |
1602 { | |
1603 T_ACI_CMGF_MOD sms_input_mode = CMGF_MOD_NotPresent; | |
1604 | |
1605 qAT_PlusCMGF (CMD_SRC_LCL, &sms_input_mode); | |
1606 if (sms_input_mode EQ CMGF_MOD_Pdu ) | |
1607 { | |
1608 if (curCmd EQ AT_CMD_CMGL) | |
1609 { | |
1610 rAT_PlusCMGLPdu (mnsms_read_cnf); | |
1611 } | |
1612 else if (curCmd EQ AT_CMD_P_CMGL) | |
1613 { | |
1614 rAT_PercentCMGLPdu (mnsms_read_cnf); | |
1615 } | |
1616 } | |
1617 else if (curCmd EQ AT_CMD_CMGL) | |
1618 { | |
1619 R_AT ( RAT_CMGL, entOwn ) ( smsShrdPrm.pDecMsg ); | |
1620 } | |
1621 else if (curCmd EQ AT_CMD_P_CMGL) | |
1622 { | |
1623 R_AT ( RAT_P_CMGL, entOwn ) ( smsShrdPrm.pDecMsg ); | |
1624 } | |
1625 } | |
1626 #else | |
1627 if (curCmd EQ AT_CMD_CMGL) | |
1628 { | |
1629 R_AT ( RAT_CMGL, entOwn ) ( smsShrdPrm.pDecMsg ); | |
1630 } | |
1631 else if (curCmd EQ AT_CMD_P_CMGL) | |
1632 { | |
1633 R_AT ( RAT_P_CMGL, entOwn ) ( smsShrdPrm.pDecMsg ); | |
1634 } | |
1635 | |
1636 #endif | |
1637 } | |
1638 else if (curCmd EQ AT_CMD_CMGL) | |
1639 { | |
1640 R_AT ( RAT_CMGL, entOwn ) ( mnsms_read_cnf ); | |
1641 /* inform BMI */ | |
1642 cmh_logRslt ( entOwn, RAT_OK, AT_CMD_CMGL, mnsms_read_cnf->rec_num, | |
1643 BS_SPEED_NotPresent,CME_ERR_NotPresent); | |
1644 } | |
1645 else if (curCmd EQ AT_CMD_P_CMGL) | |
1646 { | |
1647 /* the message shall not be displayed for ReadMode as Status Change */ | |
1648 if (smsShrdPrm.rdMode NEQ SMS_READ_StatusChange) | |
1649 { | |
1650 R_AT ( RAT_P_CMGL, entOwn ) ( mnsms_read_cnf ); | |
1651 /* inform BMI */ | |
1652 cmh_logRslt ( entOwn, RAT_OK, AT_CMD_P_CMGL, mnsms_read_cnf->rec_num, | |
1653 BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
1654 } | |
1655 } | |
1656 | |
1657 if (nextIdx NEQ SMS_RECORD_NOT_EXIST) | |
1658 { | |
1659 /* | |
1660 *----------------------------------------------------------- | |
1661 * request the next list elements of given cmglStat state | |
1662 *----------------------------------------------------------- | |
1663 */ | |
1664 psaSMS_ReadReq ( smsShrdPrm.mem1, nextIdx, | |
1665 smsShrdPrm.rdMode, cmglStat ); | |
1666 } | |
1667 else | |
1668 { | |
1669 /* | |
1670 *----------------------------------------------------------- | |
1671 * no more messages are available | |
1672 *----------------------------------------------------------- | |
1673 */ | |
1674 | |
1675 /* reset the command context */ | |
1676 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
1677 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
1678 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
1679 | |
1680 R_AT ( RAT_OK, entOwn ) ( curCmd ); | |
1681 } | |
1682 } | |
1683 | |
1684 | |
1685 /* | |
1686 +-------------------------------------------------------------------+ | |
1687 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1688 | STATE : code ROUTINE : cmhSMS_SMReadCMSS | | |
1689 +-------------------------------------------------------------------+ | |
1690 | |
1691 PURPOSE : This function processes the mnsms_read_cnf which was | |
1692 triggered by +CMSS. | |
1693 */ | |
1694 GLOBAL void cmhSMS_SMReadCMSS ( T_MNSMS_READ_CNF * mnsms_read_cnf) | |
1695 { | |
1696 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
1697 UBYTE srcId; | |
1698 UBYTE fo; | |
1699 T_ACI_CMGL_SM *p_sm; | |
1700 T_tp_da da_addr; | |
1701 T_ACI_RETURN ret=AT_CMPL; | |
1702 UBYTE modify=SMS_MODIFY_NON; | |
1703 | |
1704 #ifdef _CONC_TESTING_ | |
1705 /* Implements Measure#32: Row 1105 */ | |
1706 #endif | |
1707 | |
1708 TRACE_FUNCTION ("cmhSMS_SMReadCMSS ()"); | |
1709 | |
1710 | |
1711 srcId = smsShrdPrm.smsEntStat.entOwn; | |
1712 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
1713 | |
1714 if (smsShrdPrm.pDecMsg EQ NULL) | |
1715 { | |
1716 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CMGL_SM) ); | |
1717 p_sm = smsShrdPrm.pDecMsg; | |
1718 /* decode message */ | |
1719 /* Implements Measure # 110 */ | |
1720 cmhSMS_cpyMsgIndReadCnf (p_sm, | |
1721 &mnsms_read_cnf->status, | |
1722 &mnsms_read_cnf->sms_sdu, | |
1723 mnsms_read_cnf->rec_num); | |
1724 } | |
1725 else | |
1726 p_sm = smsShrdPrm.pDecMsg; | |
1727 | |
1728 memset (&da_addr, 0, sizeof(T_tp_da)); | |
1729 | |
1730 /* start: check FDN if enabled */ | |
1731 if (pb_get_fdn_mode () EQ FDN_ENABLE AND | |
1732 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms ) | |
1733 { | |
1734 | |
1735 TRACE_EVENT_P1("cmhSMS_SMReadCMSS: FDN check: %s", p_sm->adress ); | |
1736 | |
1737 if (pb_check_fdn (0, (const UBYTE*) p_sm->adress) EQ PHB_OK) | |
1738 { | |
1739 TRACE_EVENT("cmhSMS_SMReadCMSS: Found match in FDN!"); | |
1740 } | |
1741 else | |
1742 { | |
1743 TRACE_EVENT("cmhSMS_SMReadCMSS: No match in FDN found, SMS rejected!"); | |
1744 /* error notification */ | |
1745 R_AT( RAT_CMS, smsShrdPrm.smsEntStat.entOwn ) | |
1746 ( smsShrdPrm.smsEntStat.curCmd, CMS_ERR_OpNotAllowed, NULL ); | |
1747 /* release context */ | |
1748 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
1749 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
1750 smsShrdPrm.smsEntStat.entOwn =CMD_SRC_NONE; | |
1751 return; | |
1752 } | |
1753 } | |
1754 /* end: check FDN if enabled */ | |
1755 | |
1756 /* | |
1757 * ACI-SPR-17004: set RFU bits of status to 0 if present since these | |
1758 * should be ignored in a GSM session (GSM 11.11 section 9.3) | |
1759 */ | |
1760 cmhSMS_removeStatusRFUBits( &mnsms_read_cnf->status ); | |
1761 | |
1762 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT)); | |
1763 | |
1764 /* SMS-SUBMIT received */ | |
1765 if ((mnsms_read_cnf->status EQ SMS_RECORD_STO_UNSENT) OR | |
1766 (mnsms_read_cnf->status EQ SMS_RECORD_STO_SENT) OR | |
1767 (mnsms_read_cnf->status EQ SMS_RECORD_STAT_UNRCVD) OR | |
1768 (mnsms_read_cnf->status EQ SMS_RECORD_STAT_UNSTRD) OR | |
1769 (mnsms_read_cnf->status EQ SMS_RECORD_STAT_STRD) ) | |
1770 { | |
1771 | |
1772 /* destination address from stored message */ | |
1773 if (p_sm->adress[0] NEQ '\0') | |
1774 { | |
1775 da_addr.ton = p_sm->toa.ton; | |
1776 da_addr.npi = p_sm->toa.npi; | |
1777 | |
1778 if ( da_addr.ton EQ TON_Alphanumeric ) | |
1779 { | |
1780 cmhSMS_packAlphaNumAddr(p_sm->adress, &da_addr); | |
1781 } | |
1782 else | |
1783 { | |
1784 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, p_sm->adress); | |
1785 da_addr.digits = da_addr.c_num; | |
1786 } | |
1787 | |
1788 } | |
1789 | |
1790 /* service center address from shared parameter */ | |
1791 if (pSMSSetPrm->sca.c_num NEQ 0) | |
1792 { | |
1793 memcpy (&smsShrdPrm.tpdu.sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr)); | |
1794 modify |= SMS_MODIFY_SCA; | |
1795 | |
1796 } | |
1797 | |
1798 /* ACI-SPR-22528.The memory is allocated for smsShrdPrm.tpdu.tp_submit | |
1799 only when it is necessary*/ | |
1800 | |
1801 | |
1802 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit, | |
1803 (T_ACI_CMD_SRC)srcId, | |
1804 0, /* fo */ | |
1805 0, | |
1806 &da_addr, | |
1807 NULL, | |
1808 0, | |
1809 NULL ); | |
1810 } | |
1811 else | |
1812 { | |
1813 /* SMS-DELIVER received */ | |
1814 | |
1815 T_ACI_SM_DATA packedData; | |
1816 UBYTE byte_offset=0; | |
1817 | |
1818 /* service center address from shared parameter */ | |
1819 if (pSMSSetPrm->sca.c_num NEQ 0) | |
1820 { | |
1821 memcpy (&smsShrdPrm.tpdu.sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr)); | |
1822 } | |
1823 else | |
1824 { | |
1825 if (p_sm->sca[0] NEQ '\0') | |
1826 { | |
1827 cmhSMS_getAdrBcd( smsShrdPrm.tpdu.sc_addr.num, | |
1828 &smsShrdPrm.tpdu.sc_addr.c_num, | |
1829 MAX_SMS_ADDR_DIG, p_sm->sca); | |
1830 smsShrdPrm.tpdu.sc_addr.ton = p_sm->tosca.ton; | |
1831 smsShrdPrm.tpdu.sc_addr.npi = p_sm->tosca.npi; | |
1832 smsShrdPrm.tpdu.sc_addr.v_ton = TRUE; | |
1833 smsShrdPrm.tpdu.sc_addr.v_npi = TRUE; | |
1834 } | |
1835 } | |
1836 | |
1837 fo = (pSMSSetPrm->msgType & (~TP_MTI_MASK)) | TP_MTI_SMS_SUBMIT; | |
1838 | |
1839 if (p_sm->udh.len) | |
1840 byte_offset = p_sm->udh.len+1; | |
1841 | |
1842 /* ACI-SPR-22528.The memory is allocated for smsShrdPrm.tpdu.tp_submit | |
1843 only when it is necessary*/ | |
1844 | |
1845 cmhSMS_rdcSmsPp ( byte_offset, | |
1846 p_sm -> dcs, | |
1847 ( UBYTE * ) p_sm->data.data, ( UBYTE ) p_sm->data.len, | |
1848 packedData.data, &packedData.len); | |
1849 | |
1850 if (p_sm->adress[0] NEQ '\0') | |
1851 { | |
1852 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, p_sm->adress); | |
1853 da_addr.ton = p_sm->toa.ton; | |
1854 da_addr.npi = p_sm->toa.npi; | |
1855 da_addr.digits = da_addr.c_num; | |
1856 } | |
1857 | |
1858 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit, | |
1859 (T_ACI_CMD_SRC)srcId, | |
1860 fo, | |
1861 0, | |
1862 &da_addr, | |
1863 &packedData, | |
1864 p_sm->data.len, | |
1865 &p_sm->udh ); | |
1866 | |
1867 modify = SMS_MODIFY_ALL; | |
1868 } | |
1869 | |
1870 { | |
1871 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ); | |
1872 mnsms_submit_req->rec_num = mnsms_read_cnf->rec_num; | |
1873 mnsms_submit_req->mem_type = smsShrdPrm.mem2; | |
1874 mnsms_submit_req->condx = SMS_CONDX_OVR_ANY; | |
1875 mnsms_submit_req->modify = modify; | |
1876 | |
1877 #ifdef REL99 | |
1878 if(srcId NEQ OWN_SRC_SAT) | |
1879 { | |
1880 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
1881 } | |
1882 else | |
1883 { | |
1884 mnsms_submit_req -> auto_rep_flag = FALSE; | |
1885 } | |
1886 #endif /* REL99 */ | |
1887 | |
1888 | |
1889 #ifdef SIM_TOOLKIT | |
1890 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )) | |
1891 { | |
1892 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE) | |
1893 { | |
1894 ret = cmhSAT_MoSmCntr( smsShrdPrm.tpdu.sc_addr, | |
1895 da_addr, | |
1896 srcId); | |
1897 } | |
1898 else | |
1899 { | |
1900 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
1901 } | |
1902 | |
1903 } | |
1904 | |
1905 if (ret NEQ AT_CMPL) | |
1906 { | |
1907 /* save primitive address for SIM_TOOLKIT response */ | |
1908 sat_mnsms_submit_req = mnsms_submit_req; | |
1909 return; | |
1910 } | |
1911 #endif | |
1912 /* code SMS-SUBMIT here */ | |
1913 cmhSMS_codeMsg (&mnsms_submit_req->sms_sdu, SMS_VT_SUBMIT, | |
1914 &smsShrdPrm.tpdu.sc_addr, SMS_SUBMIT, | |
1915 (UBYTE*)smsShrdPrm.tpdu.tp_submit); | |
1916 | |
1917 PSENDX (SMS, mnsms_submit_req); | |
1918 #ifdef _CONC_TESTING_ | |
1919 #ifndef NTRACE | |
1920 /* Implements Measure#32: Row 1105 */ | |
1921 cmhSMS_sdu_buf_print(&(mnsms_submit_req->sms_sdu.buf[0]), 0); | |
1922 #endif | |
1923 #endif | |
1924 if (smsShrdPrm.tpdu.tp_submit NEQ NULL) | |
1925 { | |
1926 ACI_MFREE(smsShrdPrm.tpdu.tp_submit); | |
1927 smsShrdPrm.tpdu.tp_submit = NULL; | |
1928 } | |
1929 } | |
1930 } | |
1931 | |
1932 /* | |
1933 +-------------------------------------------------------------------+ | |
1934 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
1935 | STATE : code ROUTINE : cmhSMS_SMRead | | |
1936 +-------------------------------------------------------------------+ | |
1937 | |
1938 PURPOSE : This function is used to notify the command handler of | |
1939 a successfull reading of a short message from preferred | |
1940 message storage. | |
1941 */ | |
1942 #ifndef NTRACE | |
1943 LOCAL void trace_read_sms( T_MNSMS_READ_CNF * mnsms_read_cnf) | |
1944 { | |
1945 /* Implements Measure#32: Row 1105 */ | |
1946 | |
1947 TRACE_FUNCTION ("trace_read_sms ()"); | |
1948 | |
1949 TRACE_EVENT_P1(" rec_num: %u", mnsms_read_cnf->rec_num); | |
1950 TRACE_EVENT_P1(" rec_next: %u", mnsms_read_cnf->rec_next); | |
1951 TRACE_EVENT_P1(" rec_max: %u", mnsms_read_cnf->rec_max); | |
1952 TRACE_EVENT_P1(" status %u", mnsms_read_cnf->status); | |
1953 TRACE_EVENT_P1(" cause 0x%04x", mnsms_read_cnf->cause); | |
1954 /* Implements Measure#32: Row 1105 */ | |
1955 cmhSMS_sdu_buf_print(&(mnsms_read_cnf->sms_sdu.buf[0]), 0); | |
1956 } | |
1957 #endif | |
1958 | |
1959 | |
1960 | |
1961 GLOBAL SHORT cmhSMS_SMRead ( T_MNSMS_READ_CNF * mnsms_read_cnf) | |
1962 { | |
1963 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
1964 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1965 T_ACI_CMGL_SM *p_sm=NULL; | |
1966 T_rp_addr rp_addr; | |
1967 UBYTE* message; | |
1968 T_TP_DELIVER *sms_deliver, decoded_mesg; | |
1969 BOOL retCode = FALSE; | |
1970 UBYTE msg_type; | |
1971 | |
1972 TRACE_FUNCTION ("cmhSMS_SMRead ()"); | |
1973 | |
1974 #ifndef NTRACE | |
1975 trace_read_sms(mnsms_read_cnf); | |
1976 #endif | |
1977 | |
1978 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
1979 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
1980 | |
1981 /* (SIM) error occurred */ | |
1982 if (!IS_CAUSE_INVALID(mnsms_read_cnf->cause)) | |
1983 { | |
1984 if (mnsms_read_cnf->cause NEQ SMS_NO_ERROR) | |
1985 { | |
1986 /* reset the command context */ | |
1987 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
1988 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
1989 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
1990 | |
1991 if( ownBuf NEQ CMD_SRC_LCL OR cmdBuf NEQ AT_CMD_P_CMGMDU ) | |
1992 { | |
1993 R_AT ( RAT_CMS, ownBuf ) | |
1994 ( | |
1995 cmdBuf, | |
1996 cmhSMS_GetCmsFromSms(mnsms_read_cnf->cause), | |
1997 NULL | |
1998 ); | |
1999 } | |
2000 return 1; | |
2001 } | |
2002 } | |
2003 | |
2004 #ifdef _CONC_TESTING_ | |
2005 /* this is only for testing */ | |
2006 SET_OWNBUF_CONC; | |
2007 #endif | |
2008 | |
2009 /* | |
2010 *----------------------------------------------------------------- | |
2011 * ignore primitives with incorrect message status | |
2012 *----------------------------------------------------------------- | |
2013 */ | |
2014 TRACE_EVENT_P1("mnsms_read_cnf->status: %d", mnsms_read_cnf->status); | |
2015 | |
2016 if ( (mnsms_read_cnf->status EQ SMS_RECORD_FREE) OR | |
2017 (mnsms_read_cnf->status EQ SMS_RECORD_INVALID) ) | |
2018 { | |
2019 /* reset the command context */ | |
2020 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2021 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2022 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2023 | |
2024 TRACE_EVENT("incorrect message status"); | |
2025 return 1; | |
2026 } | |
2027 | |
2028 /* always decode for local source */ | |
2029 if (ownBuf EQ CMD_SRC_LCL) /* ACI-SPR-9528 */ | |
2030 { /* pass dummy p_sm to CB */ | |
2031 if (((cmdBuf EQ AT_CMD_CMGL OR cmdBuf EQ AT_CMD_CMGR) OR | |
2032 (cmdBuf EQ AT_CMD_P_CMGR OR cmdBuf EQ AT_CMD_P_CMGL)) | |
2033 AND smsShrdPrm.rdMode NEQ READ_STATUS_CHANGE) /* ACI-FIX-9510 */ | |
2034 { | |
2035 retCode = cmhSMS_SMSQueryType (&mnsms_read_cnf->sms_sdu, &msg_type); | |
2036 if (retCode EQ FALSE) | |
2037 { | |
2038 /* reset the command context */ | |
2039 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2040 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2041 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2042 | |
2043 TRACE_EVENT("Error decoding message type"); | |
2044 return 1; | |
2045 } | |
2046 ACI_MALLOC(smsShrdPrm.pDecMsg, sizeof(T_ACI_CMGL_SM) ); | |
2047 memset(smsShrdPrm.pDecMsg,0,sizeof(T_ACI_CMGL_SM) ); | |
2048 p_sm = smsShrdPrm.pDecMsg; | |
2049 if (msg_type EQ TP_MTI_SMS_STATUS_REP) | |
2050 { | |
2051 retCode=cmhSMS_cpySTtoSM(p_sm ,mnsms_read_cnf); | |
2052 } | |
2053 else | |
2054 { | |
2055 /* Implements Measure # 110 */ | |
2056 retCode = cmhSMS_cpyMsgIndReadCnf (p_sm, | |
2057 &mnsms_read_cnf->status, | |
2058 &mnsms_read_cnf->sms_sdu, | |
2059 mnsms_read_cnf->rec_num); | |
2060 } | |
2061 if (retCode EQ FALSE) | |
2062 { | |
2063 TRACE_EVENT("cmhSMS_SMRead ():[ERR] decoding of SMS"); | |
2064 cmhSMS_invalidSMS_notification_to_user (mnsms_read_cnf); | |
2065 | |
2066 ACI_MFREE(smsShrdPrm.pDecMsg); | |
2067 | |
2068 /* reset the command context */ | |
2069 //Added by Jinshu Wang, 23/05/2005 OMAPS00108199 | |
2070 //start | |
2071 if (smsShrdPrm.smsEntStat.curCmd!=AT_CMD_CMGL) | |
2072 { | |
2073 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2074 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2075 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2076 | |
2077 smsShrdPrm.pDecMsg = NULL; | |
2078 } | |
2079 //end | |
2080 if (mnsms_read_cnf->rec_next EQ SMS_RECORD_NOT_EXIST) | |
2081 { | |
2082 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2083 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2084 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2085 if( cmdBuf NEQ AT_CMD_P_CMGMDU ) | |
2086 { | |
2087 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
2088 } | |
2089 } | |
2090 return 1; | |
2091 } | |
2092 } | |
2093 } | |
2094 else | |
2095 p_sm = smsShrdPrm.pDecMsg; | |
2096 | |
2097 /* | |
2098 *----------------------------------------------------------------- | |
2099 * check for command context | |
2100 *----------------------------------------------------------------- | |
2101 */ | |
2102 switch( smsShrdPrm.smsEntStat.curCmd ) | |
2103 { | |
2104 case ( AT_CMD_CMGR ): | |
2105 case ( AT_CMD_P_CMGR ): | |
2106 { | |
2107 /* | |
2108 *------------------------------------------------------------- | |
2109 * process event for +CGMR | |
2110 *------------------------------------------------------------- | |
2111 */ | |
2112 | |
2113 /* reset the command context */ | |
2114 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2115 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2116 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2117 | |
2118 /* The message need not be displayed for Status Change */ | |
2119 if (cmdBuf EQ AT_CMD_P_CMGR | |
2120 AND smsShrdPrm.rdMode EQ READ_STATUS_CHANGE) | |
2121 { | |
2122 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
2123 /* inform BMI */ | |
2124 cmh_logRslt ( ownBuf, RAT_OK, AT_CMD_P_CMGR, mnsms_read_cnf->rec_num, | |
2125 BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
2126 break; | |
2127 } | |
2128 | |
2129 | |
2130 #if defined MFW OR defined FF_MMI_RIV OR defined _CONC_TESTING_ | |
2131 if (ownBuf EQ CMD_SRC_LCL) /* AND ACI-FIX-9510 */ | |
2132 /* smsShrdPrm.rdMode NEQ READ_STATUS_CHANGE) */ /* call rplyCB (with invalid p_sm) anyway | |
2133 to touch all segments while in | |
2134 READ_STATUS_CHANGE */ | |
2135 { | |
2136 #if defined FF_MMI_RIV | |
2137 T_ACI_CMGF_MOD sms_input_mode = CMGF_MOD_NotPresent; | |
2138 qAT_PlusCMGF (CMD_SRC_LCL, &sms_input_mode); | |
2139 if (sms_input_mode EQ CMGF_MOD_Pdu ) | |
2140 { | |
2141 if (cmdBuf EQ AT_CMD_CMGR ) | |
2142 { | |
2143 rAT_PlusCMGRPdu (mnsms_read_cnf); | |
2144 } | |
2145 else if (cmdBuf EQ AT_CMD_P_CMGR ) | |
2146 { | |
2147 rAT_PercentCMGRPdu (mnsms_read_cnf); | |
2148 } | |
2149 } | |
2150 else | |
2151 { | |
2152 if (smsShrdPrm.rplyCB.cmgr NEQ NULL) | |
2153 { | |
2154 smsShrdPrm.rplyCB.cmgr( p_sm, NULL ); | |
2155 } | |
2156 } | |
2157 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
2158 #else | |
2159 /* GPF-MMI */ | |
2160 if (smsShrdPrm.rplyCB.cmgr NEQ NULL) | |
2161 { | |
2162 smsShrdPrm.rplyCB.cmgr( p_sm, NULL ); | |
2163 } | |
2164 if (!ISSET_CONC) | |
2165 { | |
2166 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
2167 } | |
2168 #endif | |
2169 } | |
2170 else /* if (ownBuf EQ CMD_SRC_LCL) */ | |
2171 #endif /*#if defined MFW OR defined FF_MMI_RIV*/ | |
2172 { | |
2173 if (cmdBuf EQ AT_CMD_CMGR ) | |
2174 { | |
2175 R_AT ( RAT_CMGR, ownBuf ) ( mnsms_read_cnf, NULL ); | |
2176 } | |
2177 else if (cmdBuf EQ AT_CMD_P_CMGR ) | |
2178 { | |
2179 R_AT ( RAT_P_CMGR, ownBuf ) ( mnsms_read_cnf, NULL ); | |
2180 } | |
2181 | |
2182 R_AT ( RAT_OK, ownBuf ) ( cmdBuf ); | |
2183 /* inform BMI */ | |
2184 cmh_logRslt ( ownBuf, RAT_OK, AT_CMD_CMGR, mnsms_read_cnf->rec_num, | |
2185 BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
2186 } | |
2187 | |
2188 break; | |
2189 } | |
2190 | |
2191 case ( AT_CMD_P_CMGL ): | |
2192 case ( AT_CMD_CMGL ): | |
2193 { | |
2194 /* | |
2195 *------------------------------------------------------------- | |
2196 * process event for +CMGL | |
2197 *------------------------------------------------------------- | |
2198 */ | |
2199 cmhSMS_cpyLstData ( cmdBuf, ownBuf, mnsms_read_cnf ); | |
2200 | |
2201 break; | |
2202 } | |
2203 | |
2204 case ( AT_CMD_P_CMGMDU ): | |
2205 { | |
2206 /* | |
2207 *------------------------------------------------------------- | |
2208 * process event for %CMGMDU | |
2209 *------------------------------------------------------------- | |
2210 */ | |
2211 message = cmhSMS_decodeMsg(&mnsms_read_cnf->sms_sdu, &rp_addr, SMS_VT_DELIVER); | |
2212 sms_deliver = (T_TP_DELIVER*)message; | |
2213 sms_deliver->tp_rp = 0; | |
2214 memcpy(&decoded_mesg, sms_deliver, sizeof(T_TP_DELIVER)); | |
2215 | |
2216 { | |
2217 PALLOC (mnsms_store_req, MNSMS_STORE_REQ); | |
2218 | |
2219 mnsms_store_req -> mem_type = smsShrdPrm.mem1; | |
2220 mnsms_store_req -> condx = SMS_CONDX_OVR_ANY; | |
2221 mnsms_store_req -> rec_num = mnsms_read_cnf->rec_num; | |
2222 mnsms_store_req -> status = mnsms_read_cnf->status; | |
2223 | |
2224 cmhSMS_codeMsg ( &mnsms_store_req->sms_sdu, | |
2225 SMS_VT_DELIVER, | |
2226 &rp_addr, | |
2227 SMS_DELIVER, | |
2228 (UBYTE*) &decoded_mesg); | |
2229 | |
2230 PSENDX (SMS, mnsms_store_req); | |
2231 } | |
2232 break; | |
2233 } | |
2234 #if defined (SIM_TOOLKIT) | |
2235 case ( AT_CMD_CMSS ): | |
2236 { | |
2237 /* | |
2238 *------------------------------------------------------------- | |
2239 * process event for +CMSS (only for SAT) | |
2240 *------------------------------------------------------------- | |
2241 */ | |
2242 cmhSMS_SMReadCMSS (mnsms_read_cnf); | |
2243 | |
2244 break; | |
2245 } | |
2246 #endif | |
2247 | |
2248 default: | |
2249 { | |
2250 TRACE_EVENT("error in command context"); | |
2251 } | |
2252 } | |
2253 | |
2254 if (smsShrdPrm.pDecMsg) | |
2255 { | |
2256 ACI_MFREE(smsShrdPrm.pDecMsg); | |
2257 smsShrdPrm.pDecMsg = NULL; | |
2258 } | |
2259 | |
2260 return 0; | |
2261 } | |
2262 | |
2263 /* | |
2264 +-------------------------------------------------------------------+ | |
2265 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2266 | STATE : code ROUTINE : cmhSMS_Result | | |
2267 +-------------------------------------------------------------------+ | |
2268 | |
2269 PURPOSE : This function is used to notify the command handler of | |
2270 a successfull transaction concerning the short message | |
2271 service. | |
2272 */ | |
2273 GLOBAL SHORT cmhSMS_Result ( T_MNSMS_REPORT_IND * mnsms_report_ind ) | |
2274 { | |
2275 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
2276 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
2277 | |
2278 | |
2279 TRACE_FUNCTION ("cmhSMS_Result ()"); | |
2280 | |
2281 if (mnsms_report_ind->v_cmms_mode) | |
2282 { | |
2283 smsShrdPrm.CMMSmode = mnsms_report_ind->cmms_mode; | |
2284 return 0; | |
2285 } | |
2286 | |
2287 cmdBuf = AT_CMD_NONE; | |
2288 ownBuf = CMD_SRC_LCL; | |
2289 | |
2290 smsShrdPrm.smsStat = mnsms_report_ind->state; | |
2291 | |
2292 | |
2293 if (mnsms_report_ind->state EQ SMS_STATE_READY) | |
2294 { | |
2295 /* reading of SMs from SIM is completed, | |
2296 * read SMSP, CBMIR, CMBI fields now | |
2297 */ | |
2298 if (cmhSMS_ReadParams ((T_ACI_CMD_SRC)OWN_SRC_INV, AT_CMD_CFUN, 1) NEQ AT_EXCT) | |
2299 { | |
2300 cmhSMS_ready (); | |
2301 } | |
2302 R_AT ( RAT_SIG_SMS, ownBuf ) ( SMS_STATE_READY ); | |
2303 } | |
2304 else if (mnsms_report_ind->state EQ SMS_STATE_INITIALISING) | |
2305 { | |
2306 { /*ACI-FIX-18055 resetting total and used storage counters of SIM and ME storages which will be updated by cmhSMS_SMSInitState */ | |
2307 smsShrdPrm.aci_sms_parameter.simTotal = 0; | |
2308 smsShrdPrm.aci_sms_parameter.simUsed = 0; | |
2309 smsShrdPrm.aci_sms_parameter.meTotal = 0; | |
2310 smsShrdPrm.aci_sms_parameter.meUsed = 0; | |
2311 } /*ACI-FIX-18055 Changes end here */ | |
2312 R_AT ( RAT_SIG_SMS, ownBuf ) ( SMS_STATE_INITIALISING ); | |
2313 } | |
2314 else if (mnsms_report_ind->state > SMS_STATE_INITIALISING) | |
2315 { | |
2316 R_AT ( RAT_CMS, ownBuf ) ( cmdBuf, CMS_ERR_UnknownErr, NULL ); | |
2317 } | |
2318 | |
2319 return 0; | |
2320 } | |
2321 | |
2322 /* | |
2323 +-------------------------------------------------------------------+ | |
2324 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2325 | STATE : code ROUTINE : cmhSMS_WrCnfCSAS | | |
2326 +-------------------------------------------------------------------+ | |
2327 | |
2328 PURPOSE : This function is used to notify the command handler of | |
2329 the usage of SIM and ME memory. | |
2330 */ | |
2331 GLOBAL void cmhSMS_WrCnfCSAS (SHORT aId) | |
2332 { | |
2333 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
2334 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
2335 USHORT errCode; | |
2336 USHORT dataField = 0xFF; | |
2337 UBYTE dataLen = 0; | |
2338 UBYTE data[MAX_SIM_CMD]; | |
2339 | |
2340 TRACE_FUNCTION ("cmhSMS_WrCnfCSAS ()"); | |
2341 | |
2342 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
2343 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
2344 | |
2345 /* | |
2346 *----------------------------------------------------------------- | |
2347 * check for next SIM access | |
2348 *----------------------------------------------------------------- | |
2349 */ | |
2350 switch (smsShrdPrm.prmRdSeq) | |
2351 { | |
2352 case SMS_READ_SIM_SMSP: /* EF(SMSP) written */ | |
2353 errCode = simShrdPrm.atb[aId].errCode; | |
2354 | |
2355 if (smsShrdPrm.cbmPrm.cbmSIMmaxIdRge > 0 AND | |
2356 cmhSMS_PutCbmirSIM (ownBuf, data, | |
2357 (int)smsShrdPrm.cbmPrm.cbmSIMmaxIdRge * 4)) /* write CBMIR */ | |
2358 { | |
2359 dataField = SIM_CBMIR; | |
2360 dataLen = smsShrdPrm.cbmPrm.cbmSIMmaxIdRge * 4; | |
2361 break; | |
2362 } | |
2363 else | |
2364 smsShrdPrm.prmRdSeq--; | |
2365 | |
2366 if (smsShrdPrm.cbmPrm.cbmSIMmaxId > 0 AND | |
2367 cmhSMS_PutCbmiSIM (ownBuf, data, | |
2368 (int)smsShrdPrm.cbmPrm.cbmSIMmaxId * 2)) /* write CBMI */ | |
2369 { | |
2370 dataField = SIM_CBMI; | |
2371 dataLen = smsShrdPrm.cbmPrm.cbmSIMmaxId * 2; | |
2372 } | |
2373 else /* nothing else to write */ | |
2374 { | |
2375 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2376 } | |
2377 break; | |
2378 | |
2379 case SMS_READ_SIM_CBMIR: /* CBMIR written */ | |
2380 errCode = simShrdPrm.atb[aId].errCode; | |
2381 | |
2382 if (smsShrdPrm.cbmPrm.cbmSIMmaxId > 0 AND /* write CBMI */ | |
2383 cmhSMS_PutCbmiSIM (ownBuf, data, | |
2384 (int)smsShrdPrm.cbmPrm.cbmSIMmaxId * 2)) | |
2385 { | |
2386 dataField = SIM_CBMI; | |
2387 dataLen = smsShrdPrm.cbmPrm.cbmSIMmaxId * 2; | |
2388 } | |
2389 else /* nothing else to write */ | |
2390 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2391 break; | |
2392 | |
2393 case SMS_READ_SIM_CBMI: /* CBMI written */ | |
2394 errCode = simShrdPrm.atb[aId].errCode; | |
2395 | |
2396 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; /* nothing else to write */ | |
2397 break; | |
2398 | |
2399 default: /* nothing else to write */ | |
2400 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2401 errCode = SIM_CAUSE_OTHER_ERROR; | |
2402 break; | |
2403 } | |
2404 if ( smsShrdPrm.prmRdSeq EQ SMS_READ_SIM_CMPL) | |
2405 { | |
2406 /* Implements Measure # 104 */ | |
2407 cmhSMS_ResCSAS(ownBuf, cmdBuf, errCode); | |
2408 } | |
2409 else | |
2410 { | |
2411 if (cmhSIM_WriteTranspEF (CMD_SRC_NONE, cmdBuf, FALSE, NULL, | |
2412 dataField, 0, dataLen, | |
2413 data, cmhSMS_WrCnfCSAS) EQ AT_FAIL) | |
2414 { | |
2415 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2416 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2417 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2418 | |
2419 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2420 | |
2421 R_AT( RAT_CMS, ownBuf ) ( cmdBuf, CMS_ERR_UnknownErr, NULL ); | |
2422 } | |
2423 else | |
2424 smsShrdPrm.prmRdSeq--; | |
2425 } | |
2426 | |
2427 simShrdPrm.atb[aId].ntryUsdFlg = FALSE; | |
2428 } | |
2429 | |
2430 /* | |
2431 +-------------------------------------------------------------------+ | |
2432 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2433 | STATE : code ROUTINE : cmhSMS_RdCnfCRES | | |
2434 +-------------------------------------------------------------------+ | |
2435 | |
2436 PURPOSE : This function is used to notify the command handler of | |
2437 the usage of SIM and ME memory. | |
2438 */ | |
2439 GLOBAL void cmhSMS_RdCnfCRES (SHORT aId) | |
2440 { | |
2441 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
2442 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
2443 | |
2444 USHORT errCode; | |
2445 USHORT dataField = 0xFF; | |
2446 UBYTE dataLen = 0; | |
2447 TRACE_FUNCTION ("cmhSMS_RdCnfCRES ()"); | |
2448 | |
2449 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
2450 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
2451 | |
2452 /* | |
2453 *----------------------------------------------------------------- | |
2454 * check for next SIM access | |
2455 *----------------------------------------------------------------- | |
2456 */ | |
2457 switch (smsShrdPrm.prmRdSeq) | |
2458 { | |
2459 case SMS_READ_SIM_SMSP: | |
2460 if ((errCode = simShrdPrm.atb[aId].errCode) EQ SIM_NO_ERROR) | |
2461 { | |
2462 /* successful EF(SMSP) read */ | |
2463 | |
2464 | |
2465 if (!cmhSMS_GetPrmSIM (ownBuf, | |
2466 simShrdPrm.atb[aId].exchData, | |
2467 simShrdPrm.atb[aId].dataLen)) | |
2468 { | |
2469 errCode = SIM_CAUSE_OTHER_ERROR; | |
2470 } | |
2471 } | |
2472 if (smsShrdPrm.cbmPrm.cbmSIMmaxIdRge > 0) | |
2473 { | |
2474 dataField = SIM_CBMIR; | |
2475 dataLen = smsShrdPrm.cbmPrm.cbmSIMmaxIdRge * 4; | |
2476 break; | |
2477 } | |
2478 else | |
2479 smsShrdPrm.prmRdSeq--; | |
2480 | |
2481 if (smsShrdPrm.cbmPrm.cbmSIMmaxId > 0) | |
2482 { | |
2483 dataField = SIM_CBMI; | |
2484 dataLen = smsShrdPrm.cbmPrm.cbmSIMmaxId * 2; | |
2485 break; | |
2486 } | |
2487 else | |
2488 smsShrdPrm.prmRdSeq--; | |
2489 | |
2490 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)ownBuf; | |
2491 psaMMI_Cbch(); | |
2492 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
2493 | |
2494 #ifdef SIM_TOOLKIT | |
2495 smsShrdPrm.prmRdSeq--; /* when SAT is on, then SMS_READ_CBMID is defined | |
2496 which is irrelevant for +CRES */ | |
2497 #endif /* of SIM_TOOLKIT */ | |
2498 | |
2499 break; | |
2500 | |
2501 case SMS_READ_SIM_CBMIR: | |
2502 if ((errCode = simShrdPrm.atb[aId].errCode) EQ SIM_NO_ERROR) | |
2503 { /* successful EF(CBMIR) read */ | |
2504 if (!cmhSMS_GetCbmirSIM (ownBuf, | |
2505 simShrdPrm.atb[aId].exchData, | |
2506 simShrdPrm.atb[aId].dataLen)) | |
2507 { | |
2508 errCode = SIM_CAUSE_OTHER_ERROR; | |
2509 } | |
2510 } | |
2511 if (smsShrdPrm.cbmPrm.cbmSIMmaxId > 0) | |
2512 { | |
2513 dataField = SIM_CBMI; | |
2514 dataLen = smsShrdPrm.cbmPrm.cbmSIMmaxId * 2; | |
2515 } | |
2516 else | |
2517 { | |
2518 smsShrdPrm.prmRdSeq--; | |
2519 | |
2520 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)ownBuf; | |
2521 psaMMI_Cbch(); | |
2522 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
2523 | |
2524 #ifdef SIM_TOOLKIT | |
2525 smsShrdPrm.prmRdSeq--; /* when SAT is on, then SMS_READ_CBMID is defined | |
2526 which is irrelevant for +CRES */ | |
2527 #endif /* of SIM_TOOLKIT */ | |
2528 | |
2529 } | |
2530 break; | |
2531 | |
2532 case SMS_READ_SIM_CBMI: | |
2533 if ((errCode = simShrdPrm.atb[aId].errCode) EQ SIM_NO_ERROR) | |
2534 { /* successful EF(CBMI) read */ | |
2535 if (!cmhSMS_GetCbmiSIM (ownBuf, | |
2536 simShrdPrm.atb[aId].exchData, | |
2537 simShrdPrm.atb[aId].dataLen)) | |
2538 { | |
2539 errCode = SIM_CAUSE_OTHER_ERROR; | |
2540 } | |
2541 } | |
2542 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)ownBuf; | |
2543 psaMMI_Cbch(); | |
2544 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
2545 | |
2546 #ifdef SIM_TOOLKIT | |
2547 smsShrdPrm.prmRdSeq--; /* when SAT is on, then SMS_READ_CBMID is defined | |
2548 which is irrelevant for +CRES */ | |
2549 #endif /* of SIM_TOOLKIT */ | |
2550 | |
2551 break; | |
2552 | |
2553 default: | |
2554 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2555 errCode = SIM_CAUSE_OTHER_ERROR; | |
2556 break; | |
2557 } | |
2558 if (--smsShrdPrm.prmRdSeq <= SMS_READ_SIM_CMPL) | |
2559 { | |
2560 | |
2561 /* Implements Measure # 104 */ | |
2562 cmhSMS_ResCSAS(ownBuf, cmdBuf, errCode); | |
2563 } | |
2564 else | |
2565 if (cmhSIM_ReadTranspEF (CMD_SRC_NONE, cmdBuf, FALSE, NULL, | |
2566 dataField, 0, dataLen, | |
2567 NULL, cmhSMS_RdCnfCRES) EQ AT_FAIL) | |
2568 | |
2569 { | |
2570 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2571 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2572 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2573 | |
2574 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2575 | |
2576 #ifdef SIM_TOOLKIT | |
2577 if (ownBuf EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT )/*smsShrdPrm.fuRef >= 0*/) | |
2578 { | |
2579 psaSAT_FUConfirm ((int)simShrdPrm.fuRef, SIM_FU_ERROR); | |
2580 } | |
2581 else | |
2582 { | |
2583 #endif | |
2584 R_AT( RAT_CMS, ownBuf ) ( cmdBuf, CMS_ERR_UnknownErr, NULL ); | |
2585 #ifdef SIM_TOOLKIT | |
2586 } | |
2587 #endif | |
2588 } | |
2589 | |
2590 simShrdPrm.atb[aId].ntryUsdFlg = FALSE; | |
2591 } | |
2592 | |
2593 /* | |
2594 +-------------------------------------------------------------------+ | |
2595 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2596 | STATE : code ROUTINE : cmhSMS_InitSMSP | | |
2597 +-------------------------------------------------------------------+ | |
2598 | |
2599 PURPOSE : This function is used to store the parameters of EF(SMSP). | |
2600 */ | |
2601 GLOBAL void cmhSMS_InitSMSP (SHORT aId) | |
2602 { | |
2603 T_ACI_CMD_SRC srcId; | |
2604 T_SMS_SET_PRM * elem ; /* points to SMS parameter set */ | |
2605 UBYTE idx; | |
2606 UBYTE profile; | |
2607 | |
2608 TRACE_FUNCTION ("cmhSMS_InitSMSP ()"); | |
2609 | |
2610 /* | |
2611 *----------------------------------------------------------------- | |
2612 * process SIM result | |
2613 *----------------------------------------------------------------- | |
2614 */ | |
2615 srcId = (T_ACI_CMD_SRC)smsShrdPrm.owner; | |
2616 | |
2617 switch (smsShrdPrm.prmRdSeq) | |
2618 { | |
2619 case SMS_READ_SIM_SMSP: | |
2620 if (simShrdPrm.atb[aId].errCode EQ SIM_NO_ERROR) | |
2621 { /* successful EF(SMSP) read */ | |
2622 smsShrdPrm.aci_sms_parameter.smsParamMaxRec = simShrdPrm.atb[aId].recMax; | |
2623 smsShrdPrm.aci_sms_parameter.smsParamRecLen = simShrdPrm.atb[aId].dataLen; | |
2624 | |
2625 if (set_prm_list EQ NULL) | |
2626 { | |
2627 set_prm_list = new_list(); | |
2628 } | |
2629 profile = simShrdPrm.atb[aId].recNr; | |
2630 elem = find_element(set_prm_list, profile, cmhSMS_findPrflId); | |
2631 | |
2632 if (elem EQ NULL) | |
2633 { | |
2634 ACI_MALLOC(elem, sizeof(T_SMS_SET_PRM)); | |
2635 memset(elem, 0, sizeof(T_SMS_SET_PRM)); | |
2636 insert_list(set_prm_list, elem); | |
2637 elem->prflId = profile; | |
2638 elem->numOfRefs = OWN_SRC_MAX; | |
2639 for( idx = 0; idx < OWN_SRC_MAX; idx++ ) | |
2640 { | |
2641 smsShrdPrm.pSetPrm[idx] = (T_SMS_SET_PRM*) elem; | |
2642 } | |
2643 | |
2644 } | |
2645 else | |
2646 { | |
2647 smsShrdPrm.pSetPrm[0] = (T_SMS_SET_PRM*) elem; | |
2648 } | |
2649 | |
2650 cmhSMS_GetPrmSIM (CMD_SRC_LCL, | |
2651 simShrdPrm.atb[aId].exchData, | |
2652 simShrdPrm.atb[aId].dataLen); | |
2653 } | |
2654 else | |
2655 { | |
2656 smsShrdPrm.aci_sms_parameter.smsParamMaxRec = 0; | |
2657 smsShrdPrm.aci_sms_parameter.smsParamRecLen = 0; | |
2658 } | |
2659 if( !psaSIM_ChkSIMSrvSup( SRV_CBMIdRnge )) | |
2660 { | |
2661 smsShrdPrm.prmRdSeq--; | |
2662 goto CBMIR; | |
2663 } | |
2664 if (cmhSIM_ReadTranspEF (CMD_SRC_NONE, smsShrdPrm.smsEntStat.curCmd, | |
2665 FALSE, NULL, SIM_CBMIR, 0, 255, | |
2666 NULL, cmhSMS_InitSMSP) NEQ AT_FAIL) | |
2667 smsShrdPrm.prmRdSeq--; | |
2668 else | |
2669 { | |
2670 goto CBMIR; | |
2671 } | |
2672 break; | |
2673 | |
2674 case SMS_READ_SIM_CBMIR: | |
2675 if (simShrdPrm.atb[aId].errCode EQ SIM_NO_ERROR) | |
2676 { | |
2677 smsShrdPrm.cbmPrm.cbmSIMmaxIdRge = simShrdPrm.atb[aId].dataLen / 4; | |
2678 cmhSMS_GetCbmirSIM (CMD_SRC_NONE, | |
2679 simShrdPrm.atb[aId].exchData, | |
2680 simShrdPrm.atb[aId].dataLen); | |
2681 } | |
2682 else | |
2683 smsShrdPrm.cbmPrm.cbmSIMmaxIdRge = 0; | |
2684 | |
2685 CBMIR: | |
2686 if( !psaSIM_ChkSIMSrvSup( SRV_CBM_Ident )) | |
2687 { | |
2688 smsShrdPrm.prmRdSeq--; | |
2689 goto CBMI; | |
2690 } | |
2691 if (cmhSIM_ReadTranspEF (CMD_SRC_NONE, smsShrdPrm.smsEntStat.curCmd, | |
2692 FALSE, NULL, SIM_CBMI, 0, 255, | |
2693 NULL, cmhSMS_InitSMSP) NEQ AT_FAIL) | |
2694 smsShrdPrm.prmRdSeq--; | |
2695 else | |
2696 { | |
2697 #ifdef SIM_TOOLKIT | |
2698 goto CBMI; | |
2699 #else | |
2700 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2701 | |
2702 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2703 smsShrdPrm.smsEntStat.entOwn = simShrdPrm.owner = CMD_SRC_NONE; | |
2704 #endif /* of SIM_TOOLKIT */ | |
2705 } | |
2706 break; | |
2707 | |
2708 case SMS_READ_SIM_CBMI: | |
2709 if (simShrdPrm.atb[aId].errCode EQ SIM_NO_ERROR) | |
2710 { | |
2711 smsShrdPrm.cbmPrm.cbmSIMmaxId = simShrdPrm.atb[aId].dataLen / 2; | |
2712 cmhSMS_GetCbmiSIM (CMD_SRC_NONE, | |
2713 simShrdPrm.atb[aId].exchData, | |
2714 simShrdPrm.atb[aId].dataLen); | |
2715 } | |
2716 else | |
2717 smsShrdPrm.cbmPrm.cbmSIMmaxId = 0; | |
2718 | |
2719 #ifdef SIM_TOOLKIT | |
2720 CBMI: | |
2721 if( (!psaSIM_ChkSIMSrvSup( SRV_DtaDownlCB )) OR | |
2722 smsShrdPrm.owner NEQ OWN_SRC_SAT) | |
2723 { | |
2724 smsShrdPrm.prmRdSeq--; | |
2725 goto CBMID; | |
2726 } | |
2727 if (cmhSIM_ReadTranspEF (CMD_SRC_NONE, smsShrdPrm.smsEntStat.curCmd, | |
2728 FALSE, NULL, SIM_CBMID, 0, 255, | |
2729 NULL, cmhSMS_InitSMSP) NEQ AT_FAIL) | |
2730 smsShrdPrm.prmRdSeq--; | |
2731 else | |
2732 { | |
2733 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2734 | |
2735 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2736 simShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2737 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2738 } | |
2739 break; | |
2740 | |
2741 case SMS_READ_SIM_CBMID: | |
2742 if (simShrdPrm.atb[aId].errCode EQ SIM_NO_ERROR) | |
2743 { | |
2744 /* Implements Measure # 59 */ | |
2745 cmhSMS_SendCbDwnlSIM (simShrdPrm.atb[aId].exchData, | |
2746 simShrdPrm.atb[aId].dataLen); | |
2747 } | |
2748 else | |
2749 smsShrdPrm.cbmPrm.cbmSIMmaxSATId = 0; | |
2750 | |
2751 | |
2752 /*lint -fallthrough */ | |
2753 default: | |
2754 CBMID: | |
2755 | |
2756 #else | |
2757 /*lint -fallthrough*/ | |
2758 default: | |
2759 CBMI: | |
2760 #endif /*SIM_TOOLKIT */ | |
2761 | |
2762 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)srcId; | |
2763 psaMMI_Cbch(); | |
2764 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
2765 { | |
2766 smsShrdPrm.prmRdSeq = SMS_READ_SIM_CMPL; | |
2767 | |
2768 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2769 simShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2770 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2771 } | |
2772 #ifdef SIM_TOOLKIT | |
2773 if (srcId EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT) /*smsShrdPrm.fuRef >= 0*/) | |
2774 { | |
2775 smsShrdPrm.accessEnabled = TRUE; | |
2776 psaSAT_FUConfirm (simShrdPrm.fuRef,(USHORT) | |
2777 ((simShrdPrm.atb[aId].errCode EQ SIM_NO_ERROR)? | |
2778 SIM_FU_SUCC_ADD: SIM_FU_ERROR)); | |
2779 } | |
2780 else | |
2781 #endif | |
2782 cmhSMS_ready (); | |
2783 break; | |
2784 } | |
2785 | |
2786 simShrdPrm.atb[aId].ntryUsdFlg = FALSE; | |
2787 } | |
2788 | |
2789 /* | |
2790 +-------------------------------------------------------------------+ | |
2791 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2792 | STATE : code ROUTINE : cmhSMS_SMSResumeCnf | | |
2793 +-------------------------------------------------------------------+ | |
2794 | |
2795 PURPOSE : This function processes the MNSMS_RESUME_CNF primitive. | |
2796 | |
2797 */ | |
2798 GLOBAL void cmhSMS_SMSResumeCnf (T_MNSMS_RESUME_CNF * mnsms_resume_cnf) | |
2799 { | |
2800 UBYTE cmdBuf; | |
2801 UBYTE ownBuf; | |
2802 | |
2803 TRACE_FUNCTION("cmhSMS_ResumeCnf()"); | |
2804 | |
2805 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
2806 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
2807 | |
2808 /* check whether resume has been successfully processed */ | |
2809 if (mnsms_resume_cnf->cause EQ SMS_NO_ERROR) | |
2810 { | |
2811 R_AT( RAT_OK, (T_ACI_CMD_SRC)ownBuf ) ( cmdBuf ); | |
2812 } | |
2813 else | |
2814 { | |
2815 /* command unsuccessful */ | |
2816 R_AT ( RAT_CMS, (T_ACI_CMD_SRC)ownBuf ) | |
2817 ( | |
2818 cmdBuf, | |
2819 cmhSMS_GetCmsFromSms(mnsms_resume_cnf->cause), | |
2820 NULL | |
2821 ); | |
2822 } | |
2823 | |
2824 /* reset command */ | |
2825 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2826 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2827 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2828 } | |
2829 | |
2830 /* | |
2831 +-------------------------------------------------------------------+ | |
2832 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2833 | STATE : code ROUTINE : cmhSMS_SMSQueryCnf | | |
2834 +-------------------------------------------------------------------+ | |
2835 | |
2836 PURPOSE : This function processes the MNSMS_QUERY_CNF primitive. | |
2837 | |
2838 */ | |
2839 GLOBAL void cmhSMS_SMSQueryCnf (T_MNSMS_QUERY_CNF * mnsms_query_cnf) | |
2840 { | |
2841 UBYTE cmdBuf; | |
2842 UBYTE ownBuf; | |
2843 | |
2844 TRACE_FUNCTION("cmhSMS_SMSQueryCnf()"); | |
2845 | |
2846 cmdBuf = smsShrdPrm.smsEntStat.curCmd; | |
2847 ownBuf = smsShrdPrm.smsEntStat.entOwn; | |
2848 | |
2849 /* check type of query request and process it */ | |
2850 switch (mnsms_query_cnf->query_type) | |
2851 { | |
2852 case SMS_QUERY_DELIVER_STATUS: | |
2853 { | |
2854 if ( mnsms_query_cnf->v_deliver_status ) | |
2855 { | |
2856 #ifdef TI_PS_FF_AT_P_CMD_CPRSM | |
2857 R_AT ( RAT_CPRSM, (T_ACI_CMD_SRC)ownBuf ) | |
2858 ( cmhSMS_convertDeliverStatusToACI(mnsms_query_cnf->deliver_status ) ); | |
2859 #endif /* TI_PS_FF_AT_P_CMD_CPRSM */ | |
2860 R_AT( RAT_OK, (T_ACI_CMD_SRC)ownBuf ) ( cmdBuf ); | |
2861 } | |
2862 else /* paramter inalid - unspecified protocol error */ | |
2863 { | |
2864 TRACE_EVENT("cmhSMS_QueryCnf: ERROR: paramter invalid"); | |
2865 R_AT ( RAT_CMS, (T_ACI_CMD_SRC)ownBuf )( cmdBuf, CMS_ERR_InValManInfo, NULL ); | |
2866 } | |
2867 break; | |
2868 } | |
2869 default: /* unsupported query type - ME failure */ | |
2870 { | |
2871 TRACE_EVENT("cmhSMS_QueryCnf: ERROR: unsupported query type"); | |
2872 R_AT ( RAT_CMS, (T_ACI_CMD_SRC)ownBuf )( cmdBuf, CMS_ERR_MeFail, NULL ); | |
2873 } | |
2874 } /* end switch */ | |
2875 | |
2876 /* reset command */ | |
2877 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
2878 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
2879 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
2880 } | |
2881 | |
2882 /* | |
2883 +-------------------------------------------------------------------+ | |
2884 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2885 | STATE : code ROUTINE : cmhSMS_ReadCbDtaDwnl | | |
2886 +-------------------------------------------------------------------+ | |
2887 | |
2888 PURPOSE : This function processes the T_SIM_MMI_INSERT_IND primitive. | |
2889 | |
2890 */ | |
2891 GLOBAL void cmhSMS_ReadCbDtaDwnl (T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind) | |
2892 { | |
2893 | |
2894 TRACE_FUNCTION("cmhSMS_ReadCbDtaDwnl()"); | |
2895 | |
2896 if (sim_mmi_insert_ind->cbmid_rec.c_rec NEQ 0) | |
2897 { | |
2898 /* Implements Measure # 59 */ | |
2899 cmhSMS_SendCbDwnlSIM (sim_mmi_insert_ind->cbmid_rec.rec, | |
2900 sim_mmi_insert_ind->cbmid_rec.c_rec); | |
2901 } | |
2902 else | |
2903 { | |
2904 TRACE_EVENT(" CBMID records zero"); | |
2905 smsShrdPrm.cbmPrm.cbmSIMmaxSATId = 0; | |
2906 } | |
2907 } | |
2908 | |
2909 /* | |
2910 +-------------------------------------------------------------------+ | |
2911 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2912 | STATE : code ROUTINE : cmhSMS_SMSQueryType | | |
2913 +-------------------------------------------------------------------+ | |
2914 | |
2915 PURPOSE : This function queries the message type of the T_MNSMS_MESSAGE_IND. | |
2916 | |
2917 */ | |
2918 GLOBAL BOOL cmhSMS_SMSQueryType (T_sms_sdu *sms_sdu, | |
2919 UBYTE *msg_type) | |
2920 { | |
2921 UBYTE ccdRet; | |
2922 | |
2923 TRACE_FUNCTION("cmhSMS_SMSQueryType()"); | |
2924 | |
2925 if (sms_sdu->l_buf EQ 0) | |
2926 { | |
2927 TRACE_EVENT("empty SDU: no decoding"); | |
2928 return FALSE; | |
2929 } | |
2930 | |
2931 CCD_START; | |
2932 { | |
2933 | |
2934 MCAST( sim_pdu, SIM_PDU ); /* sim_pdu points to _decodedMsg */ | |
2935 | |
2936 /* decoding outer layer */ | |
2937 ccdRet = ccd_decodeMsg ( CCDENT_SMS, | |
2938 BOTH /* doesn't work with DOWNLINK!!! */, | |
2939 (T_MSGBUF *) sms_sdu, | |
2940 (UBYTE *) _decodedMsg, /* target */ | |
2941 SMS_VT_SIM_PDU); | |
2942 | |
2943 if ((ccdRet NEQ ccdOK) OR (!sim_pdu->v_tpdu) | |
2944 OR (_decodedMsg[0] NEQ SMS_VT_SIM_PDU)) | |
2945 { | |
2946 TRACE_EVENT_P1("CCD Decoding Error: %d", ccdRet); | |
2947 CCD_END; | |
2948 return FALSE; | |
2949 } | |
2950 *msg_type = sim_pdu->tp_mti; | |
2951 } | |
2952 CCD_END; | |
2953 | |
2954 return TRUE; | |
2955 | |
2956 } | |
2957 | |
2958 LOCAL BOOL cmhSMS_cpySTtoSM(T_ACI_CMGL_SM *p_sm,T_MNSMS_READ_CNF * mnsms_read_cnf) | |
2959 { | |
2960 T_ACI_CDS_SM p_st; | |
2961 T_MNSMS_STATUS_IND mnsms_status_ind; | |
2962 BOOL retCode = FALSE; | |
2963 | |
2964 memcpy (&mnsms_status_ind.sms_sdu, &mnsms_read_cnf->sms_sdu, | |
2965 sizeof (T_sms_sdu)); | |
2966 retCode = cmhSMS_cpyStatInd ( &p_st, &mnsms_status_ind); | |
2967 memcpy(p_sm->adress, p_st.addr, MAX_SMS_ADDR_DIG - 1 ); | |
2968 cmhSMS_getStatCmh ( mnsms_read_cnf->status, &p_sm->stat ); | |
2969 p_sm->msg_ref = mnsms_read_cnf->rec_num ; | |
2970 p_sm->tp_status=p_st.tp_status ; | |
2971 p_sm->toa .ton = p_st.toa .ton ; | |
2972 p_sm->toa.npi = p_st.toa.npi; | |
2973 p_sm->fo = p_st.fo; | |
2974 p_sm->scts =p_st.vpabs_scts ; | |
2975 | |
2976 return (retCode); | |
2977 } | |
2978 /* Implements Measure # 59 */ | |
2979 /* | |
2980 +-------------------------------------------------------------------+ | |
2981 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
2982 | STATE : code ROUTINE : cmhSMS_SendCbDwnlSIM | | |
2983 +-------------------------------------------------------------------+ | |
2984 PARAMETERS : data - CBMID information | |
2985 data_len - Number of bytes in 'data' parameter | |
2986 RETURN : None | |
2987 | |
2988 PURPOSE : This function gets the CBMID information and sends to SIM | |
2989 | |
2990 */ | |
2991 | |
2992 LOCAL void cmhSMS_SendCbDwnlSIM(UBYTE *data, int data_len) | |
2993 { | |
2994 TRACE_FUNCTION("cmhSMS_SendCbDwnlSIM()"); | |
2995 smsShrdPrm.cbmPrm.cbmSIMmaxSATId = data_len / 2; | |
2996 cmhSMS_GetCbDtaDwnlSIM (CMD_SRC_NONE, | |
2997 data, | |
2998 data_len); | |
2999 { | |
3000 PALLOC (sat_cbch_req, MMI_SAT_CBCH_DWNLD_REQ); | |
3001 | |
3002 sat_cbch_req->count = (USHORT)smsShrdPrm.cbmPrm.CBDtaDwnlFoundIds; | |
3003 memset (sat_cbch_req->msg_id, NOT_PRESENT_16BIT, | |
3004 sizeof (sat_cbch_req->msg_id)); | |
3005 memcpy (sat_cbch_req->msg_id, smsShrdPrm.cbmPrm.CBDtaDwnlIdent, | |
3006 (size_t)smsShrdPrm.cbmPrm.CBDtaDwnlFoundIds * 2); | |
3007 | |
3008 PSENDX (PL, sat_cbch_req); | |
3009 } | |
3010 } | |
3011 | |
3012 /* Implements Measure # 104 */ | |
3013 /* | |
3014 +-------------------------------------------------------------------+ | |
3015 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
3016 | STATE : code ROUTINE : cmhSMS_ResCSAS | | |
3017 +-------------------------------------------------------------------+ | |
3018 PARAMETERS : ownBuf - ACI command source | |
3019 cmdBuf - ACI Command type | |
3020 errCode - Error Code from SIM | |
3021 RETURN : None | |
3022 | |
3023 PURPOSE : This function sends response to CSAS | |
3024 | |
3025 */ | |
3026 LOCAL void cmhSMS_ResCSAS(T_ACI_CMD_SRC ownBuf, T_ACI_AT_CMD cmdBuf, USHORT errCode) | |
3027 { | |
3028 TRACE_FUNCTION("cmhSMS_ResCSAS()"); | |
3029 | |
3030 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
3031 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
3032 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
3033 | |
3034 if (errCode EQ SIM_NO_ERROR) | |
3035 { | |
3036 R_AT( RAT_OK, ownBuf ) ( cmdBuf ); | |
3037 } | |
3038 else | |
3039 { | |
3040 R_AT( RAT_CMS, ownBuf ) /* unsuccessful SIM write */ | |
3041 ( | |
3042 cmdBuf, | |
3043 cmhSMS_GetCmsFromSim ( errCode ), | |
3044 NULL | |
3045 ); | |
3046 } | |
3047 } | |
3048 | |
3049 /* Implements Measure # 114 */ | |
3050 /* | |
3051 +-------------------------------------------------------------------+ | |
3052 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSR | | |
3053 | STATE : code ROUTINE : cmhSMS_ErrRes | | |
3054 +-------------------------------------------------------------------+ | |
3055 PARAMETERS : ownBuf - ACI command source | |
3056 cmdBuf - ACI Command type | |
3057 cause - Error cause that has come from SMS entity | |
3058 RETURN : None | |
3059 | |
3060 PURPOSE : This function sends error response. | |
3061 | |
3062 */ | |
3063 LOCAL void cmhSMS_ErrRes(T_ACI_CMD_SRC ownBuf, T_ACI_AT_CMD cmdBuf, USHORT cause) | |
3064 { | |
3065 TRACE_FUNCTION("cmhSMS_ErrRes()"); | |
3066 | |
3067 if (ownBuf EQ CMD_SRC_LCL) | |
3068 { | |
3069 if (smsShrdPrm.errorCB NEQ NULL) | |
3070 { | |
3071 smsShrdPrm.errorCB | |
3072 ( | |
3073 cmdBuf, | |
3074 cmhSMS_GetCmsFromSms(cause), | |
3075 NULL | |
3076 ); | |
3077 } | |
3078 } | |
3079 else | |
3080 { | |
3081 R_AT ( RAT_CMS, ownBuf ) | |
3082 ( | |
3083 cmdBuf, | |
3084 cmhSMS_GetCmsFromSms(cause), | |
3085 NULL | |
3086 ); | |
3087 } | |
3088 } | |
3089 /*==== EOF ========================================================*/ |