FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/cmh_mmis.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_MMIS | |
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 provides the set functions related to the | |
18 | protocol stack adapter for the man machine interface. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CMH_MMIS_C | |
23 #define CMH_MMIS_C | |
24 #endif | |
25 | |
26 #include "config.h" | |
27 #include "fixedconf.h" | |
28 #include "condat-features.h" | |
29 #include "aci_conf.h" | |
30 | |
31 #include "aci_all.h" | |
32 | |
33 /*==== INCLUDES ===================================================*/ | |
34 #include "aci_cmh.h" | |
35 #include "ati_cmd.h" | |
36 #include "aci_cmd.h" | |
37 #include "psa_mmi.h" | |
38 #include "cmh_mmi.h" | |
39 #include "pcm.h" | |
40 | |
41 #ifdef UART | |
42 #include "dti.h" /* functionality of the dti library */ | |
43 #include "dti_conn_mng.h" | |
44 #endif | |
45 | |
46 #ifdef FAX_AND_DATA | |
47 #include "aci_fd.h" | |
48 #endif /* of #ifdef FAX_AND_DATA */ | |
49 #include "psa.h" | |
50 #include "psa_sim.h" | |
51 #include "cmh.h" | |
52 #include "cmh_sim.h" | |
53 #include "cmh_cc.h" | |
54 #include "aoc.h" | |
55 | |
56 #include "aci_prs.h" | |
57 | |
58 #ifdef ACI | |
59 #include "gdi.h" | |
60 #include "audio.h" | |
61 #include "aci_lst.h" | |
62 #include "ati_int.h" | |
63 #endif | |
64 | |
65 /*==== CONSTANTS ==================================================*/ | |
66 | |
67 /*==== EXPORT =====================================================*/ | |
68 | |
69 /*==== VARIABLES ==================================================*/ | |
70 | |
71 /*==== FUNCTIONS ==================================================*/ | |
72 | |
73 /*=================================================================*/ | |
74 | |
75 /* | |
76 +--------------------------------------------------------------------+ | |
77 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
78 | STATE : code ROUTINE : sAT_PercentDRV | | |
79 +--------------------------------------------------------------------+ | |
80 | |
81 PURPOSE : This is the functional counterpart to the %DRV AT command | |
82 which is responsible to set the parameters for relatet | |
83 operations regarding audio and keyboard. | |
84 | |
85 <device>: defines the addressed device. | |
86 <function>: defines the function to access | |
87 <val1>,<val2>: additional parameters | |
88 */ | |
89 #if 0 | |
90 GLOBAL T_ACI_RETURN sAT_PercentDRV( T_ACI_CMD_SRC srcId, | |
91 T_ACI_DRV_DEV device, | |
92 T_ACI_DRV_FCT function, | |
93 UBYTE val1, | |
94 UBYTE val2, | |
95 void* ptr1 ) | |
96 { | |
97 | |
98 TRACE_FUNCTION ("sAT_PercentDRV()"); | |
99 | |
100 /* process the <device> and <function> parameter */ | |
101 if(device EQ DRV_DEV_Display ) | |
102 { | |
103 if(function EQ DRV_FCT_DisplayReq ) | |
104 { | |
105 mmiShrdPrm.dspRq = ptr1; | |
106 psaMMI_Display(); | |
107 return( AT_CMPL ); | |
108 } | |
109 } | |
110 return(AT_FAIL); | |
111 } | |
112 #endif | |
113 | |
114 /* | |
115 +-------------------------------------------------------------------+ | |
116 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
117 | STATE : code ROUTINE : sAT_PlusCLAN | | |
118 +-------------------------------------------------------------------+ | |
119 | |
120 PURPOSE : PURPOSE : This is the functional counterpart to the +CLAN | |
121 AT command which is responsible for test supporetd | |
122 language code in ME. | |
123 | |
124 <lngCode>: string language Code | |
125 */ | |
126 GLOBAL T_ACI_RETURN sAT_PlusCLAN ( T_ACI_CMD_SRC srcId, | |
127 T_ACI_LAN_SUP *lngCode) | |
128 | |
129 { | |
130 /* Implements Measure#32: Row 976 */ | |
131 EF_CLNG lng; | |
132 T_SIM_CMD_PRM *pSIMCmdPrm; /* points to SIM command parameters */ | |
133 T_PHB_CMD_PRM *pPHBCmdPrm; /* points to PHB command parameter */ | |
134 T_ACI_LAN_SUP LngPCMsupLst[MAX_LAN]; | |
135 SHORT lastIdx; | |
136 BOOL Suplng = FALSE; | |
137 | |
138 TRACE_FUNCTION ("sAT_PlusCLAN ()"); | |
139 | |
140 /* | |
141 *----------------------------------------------------------------- | |
142 * check command source | |
143 *----------------------------------------------------------------- | |
144 */ | |
145 if(!cmh_IsVldCmdSrc (srcId)) | |
146 { | |
147 return( AT_FAIL ); | |
148 } | |
149 | |
150 pSIMCmdPrm = &cmhPrm[srcId].simCmdPrm; | |
151 pPHBCmdPrm = &cmhPrm[srcId].phbCmdPrm; | |
152 | |
153 /* | |
154 *------------------------------------------------------------------- | |
155 * if Automatic language is set then read language from the sim | |
156 *------------------------------------------------------------------- | |
157 */ | |
158 if ( lngCode->lng EQ CLAN_LNG_AUT ) | |
159 { | |
160 /* | |
161 *------------------------------------------------------------- | |
162 * check entity status | |
163 *------------------------------------------------------------- | |
164 */ | |
165 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
166 return( AT_BUSY ); | |
167 | |
168 pSIMCmdPrm->CLANact=CLAN_ACT_Write; | |
169 /* | |
170 *------------------------------------------------------------- | |
171 * request EF ELP from SIM | |
172 *------------------------------------------------------------- | |
173 */ | |
174 /* Implements Measure 150 and 159 */ | |
175 return cmhSIM_ReqLanguage_LP_or_ELP ( srcId, SIM_ELP ); | |
176 } | |
177 | |
178 /* | |
179 *------------------------------------------------------------- | |
180 * check if the language is supported in PCM | |
181 *------------------------------------------------------------- | |
182 */ | |
183 getSupLangFromPCM(&LngPCMsupLst[0], &lastIdx); | |
184 Suplng=checkSuppLang(&LngPCMsupLst[0],lastIdx, lngCode); | |
185 | |
186 if (Suplng) | |
187 { | |
188 /* | |
189 *------------------------------------------------------------- | |
190 * copy the set code and write it in PCM | |
191 *------------------------------------------------------------- | |
192 */ | |
193 | |
194 memcpy ( lng.data, lngCode->str,CLAN_CODE_LEN); | |
195 | |
196 /* Implements Measure#32: Row 976 */ | |
197 if ( pcm_WriteFile (( UBYTE* )ef_clng_id,SIZE_EF_CLNG,( UBYTE*) &lng) EQ PCM_OK) | |
198 { | |
199 | |
200 /* | |
201 *------------------------------------------------------------- | |
202 * check if the result code after setting is enabled | |
203 *------------------------------------------------------------- | |
204 */ | |
205 if (pPHBCmdPrm->CLAEmode EQ CLAE_MOD_Enable) | |
206 {R_AT( RAT_CLAE, srcId ) (lngCode);} | |
207 return( AT_CMPL ); | |
208 } | |
209 else | |
210 { | |
211 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_MemFail ); | |
212 return( AT_FAIL ); | |
213 } | |
214 | |
215 } | |
216 else | |
217 { | |
218 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown ); | |
219 return( AT_FAIL ); | |
220 } | |
221 | |
222 } | |
223 | |
224 /* | |
225 +--------------------------------------------------------------------+ | |
226 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
227 | STATE : code ROUTINE : sAT_PlusCLAE | | |
228 +--------------------------------------------------------------------+ | |
229 | |
230 PURPOSE : This is the functional counterpart to the +CLAE AT command | |
231 which is responsible to enable or disable the presentation | |
232 of Language Event. | |
233 | |
234 */ | |
235 | |
236 GLOBAL T_ACI_RETURN sAT_PlusCLAE ( T_ACI_CMD_SRC srcId, | |
237 T_ACI_CLAE_MOD mode ) | |
238 { | |
239 T_PHB_CMD_PRM * pPHBCmdPrm; /* points to PHB command parameter */ | |
240 | |
241 TRACE_FUNCTION ("sAT_PlusCLAE()"); | |
242 | |
243 /* | |
244 *------------------------------------------------------------------- | |
245 * check command source | |
246 *------------------------------------------------------------------- | |
247 */ | |
248 if(!cmh_IsVldCmdSrc (srcId)) | |
249 { | |
250 return( AT_FAIL ); | |
251 } | |
252 | |
253 pPHBCmdPrm = &cmhPrm[srcId].phbCmdPrm; | |
254 | |
255 /* | |
256 *------------------------------------------------------------------- | |
257 * process the mode parameter | |
258 *------------------------------------------------------------------- | |
259 */ | |
260 switch( mode ) | |
261 { | |
262 case( CLAE_MOD_Disable ): | |
263 case( CLAE_MOD_Enable ): | |
264 pPHBCmdPrm -> CLAEmode = mode; | |
265 break; | |
266 | |
267 default: | |
268 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
269 return( AT_FAIL ); | |
270 } | |
271 | |
272 return( AT_CMPL ); | |
273 } | |
274 | |
275 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
276 /* | |
277 +-------------------------------------------------------------------+ | |
278 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
279 | ROUTINE : sAT_PercentCUST | | |
280 +-------------------------------------------------------------------+ | |
281 | |
282 PURPOSE : This function will set the customisation mode for the ACI and | |
283 other required entities | |
284 */ | |
285 | |
286 GLOBAL T_ACI_RETURN sAT_PercentCUST( T_ACI_CMD_SRC srcId, | |
287 T_CUST_MOD customisation_mode) | |
288 { | |
289 /* | |
290 *------------------------------------------------------------------- | |
291 * check command source | |
292 *------------------------------------------------------------------- | |
293 */ | |
294 if(!cmh_IsVldCmdSrc (srcId)) | |
295 { | |
296 return( AT_FAIL ); | |
297 } | |
298 | |
299 /* | |
300 ** This command is only valid before the ME is put into Fully Functional Mode | |
301 */ | |
302 if (psaSIM_hasCustModeBeenSet() != FALSE) | |
303 { | |
304 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Unknown); | |
305 return( AT_FAIL ); | |
306 } | |
307 | |
308 /* | |
309 ** Switch on the Customisation mode | |
310 */ | |
311 switch (customisation_mode) | |
312 { | |
313 case CUST_NORMAL_BEHAVIOUR: /* Default Value, No Customisation */ | |
314 case CUST_MODE_BEHAVIOUR_1: /* Cust1 */ | |
315 | |
316 if (simShrdPrm.setPrm[srcId].cust_mode != customisation_mode) | |
317 { | |
318 /* | |
319 ** Set the customisation mode, and notify ALL other affected entities | |
320 */ | |
321 simShrdPrm.setPrm[srcId].cust_mode = customisation_mode; | |
322 } | |
323 break; | |
324 | |
325 default: | |
326 /* | |
327 ** This is an error | |
328 */ | |
329 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
330 return (AT_FAIL); | |
331 } | |
332 | |
333 return (AT_CMPL); | |
334 | |
335 } | |
336 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
337 | |
338 /* | |
339 +-------------------------------------------------------------------+ | |
340 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
341 | ROUTINE : sAT_PercentSATCC | | |
342 +-------------------------------------------------------------------+ | |
343 | |
344 PURPOSE : This function will set the call and short message control by SIM functionality | |
345 to Enabled or Disabled according to the value in sat_cc_mode. | |
346 */ | |
347 | |
348 GLOBAL T_ACI_RETURN sAT_PercentSATCC( T_ACI_CMD_SRC srcId, | |
349 T_SAT_CC_MOD sat_cc_mode) | |
350 { | |
351 /* | |
352 *------------------------------------------------------------------- | |
353 * check command source | |
354 *------------------------------------------------------------------- | |
355 */ | |
356 if(!cmh_IsVldCmdSrc (srcId)) | |
357 { | |
358 return( AT_FAIL ); | |
359 } | |
360 | |
361 /* | |
362 ** Enable or Disbale the Call or Short Message Control by SIM, according to the passed parameter | |
363 */ | |
364 switch (sat_cc_mode) | |
365 { | |
366 case SATCC_CONTROL_BY_SIM_INACTIVE: | |
367 case SATCC_CONTROL_BY_SIM_ACTIVE: | |
368 simShrdPrm.setPrm[srcId].sat_cc_mode = sat_cc_mode; | |
369 break; | |
370 | |
371 default: | |
372 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
373 return( AT_FAIL ); | |
374 } | |
375 | |
376 return (AT_CMPL); | |
377 | |
378 } | |
379 | |
380 | |
381 /* | |
382 * Implemetation of IBT handling by ME for ACI only stacks | |
383 */ | |
384 | |
385 #ifdef ACI | |
386 | |
387 /* | |
388 +-------------------------------------------------------------------+ | |
389 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
390 | ROUTINE : cmhMMI_setAudioVolume | | |
391 +-------------------------------------------------------------------+ | |
392 | |
393 PURPOSE : This function sets the volume for the audio input and | |
394 audio output path. | |
395 | |
396 <audioIn>: input volume | |
397 <audioOut>: output volume | |
398 */ | |
399 | |
400 GLOBAL void cmhMMI_setAudioVolume (BYTE audioIn, BYTE audioOut) | |
401 { | |
402 TRACE_FUNCTION("cmhMMI_setAudioVolume"); | |
403 | |
404 audio_SetAmplf (AUDIO_MICROPHONE, audioIn); | |
405 audio_SetAmplf (AUDIO_SPEAKER, audioOut); | |
406 | |
407 } | |
408 | |
409 /* | |
410 +-------------------------------------------------------------------+ | |
411 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS | | |
412 | ROUTINE : cmhMMI_handleAudioTone | | |
413 +-------------------------------------------------------------------+ | |
414 | |
415 PURPOSE : This function is to switch on/off a specified tone. | |
416 | |
417 <cmdId>: command identifier | |
418 <response>: response type | |
419 <msgType>: CPI message type | |
420 */ | |
421 | |
422 GLOBAL void cmhMMI_handleAudioTone (T_ACI_AT_CMD cmdId, | |
423 UBYTE response, | |
424 T_ACI_CPI_MSG msgType ) | |
425 { | |
426 T_ACI_IBT_ACT new_audio_action = SWITCH_AUDIO_NONE; | |
427 | |
428 TRACE_FUNCTION("cmhMMI_handleAudioTone"); | |
429 | |
430 /* only for test purposes */ | |
431 /*ibt_params.ati_currTch = CPI_TCH_False;*/ | |
432 | |
433 switch (response) | |
434 { | |
435 case RAT_CCWA: | |
436 new_audio_action = SWITCH_AUDIO_CALLWAIT; | |
437 break; | |
438 | |
439 case RAT_BUSY: | |
440 new_audio_action = SWITCH_AUDIO_BUSY; | |
441 break; | |
442 | |
443 case RAT_OK: | |
444 if ((cmdId EQ AT_CMD_H) OR (cmdId EQ AT_CMD_D) OR (cmdId EQ AT_CMD_CTFR)) | |
445 { | |
446 new_audio_action = SWITCH_AUDIO_OFF; | |
447 } | |
448 break; | |
449 | |
450 case RAT_CONNECT: | |
451 if ((ibt_params.ati_currIbt NEQ CPI_IBT_True) OR | |
452 (ibt_params.ati_currTch NEQ CPI_TCH_True)) | |
453 { | |
454 new_audio_action = SWITCH_AUDIO_OFF; | |
455 } | |
456 break; | |
457 | |
458 case RAT_NO_ANSWER: | |
459 case RAT_NO_CARRIER: | |
460 if (cmdId EQ AT_CMD_D) | |
461 { | |
462 new_audio_action = SWITCH_AUDIO_OFF; | |
463 } | |
464 break; | |
465 | |
466 case RAT_CPI: | |
467 /* The network is not allowed to stop the BUSY tone. | |
468 This can only be done by ATH */ | |
469 if (ibt_params.last_action NEQ SWITCH_AUDIO_BUSY) | |
470 { | |
471 if ((ibt_params.ati_currIbt EQ CPI_IBT_True) AND | |
472 (ibt_params.ati_currTch EQ CPI_TCH_True)) | |
473 { | |
474 new_audio_action = SWITCH_AUDIO_OFF; | |
475 } | |
476 else | |
477 { | |
478 if ((msgType EQ CPI_MSG_Disc) OR (msgType EQ CPI_MSG_Conn)) | |
479 { | |
480 new_audio_action = SWITCH_AUDIO_OFF; | |
481 } | |
482 else if (msgType EQ CPI_MSG_Alert) | |
483 { | |
484 new_audio_action = SWITCH_AUDIO_ALERT; | |
485 } | |
486 } | |
487 } /* if (ibt_params.last_action NEQ SWITCH_AUDIO_BUSY) */ | |
488 break; | |
489 | |
490 case RAT_CME: | |
491 if ((cmdId EQ AT_CMD_D) OR (cmdId EQ AT_CMD_CHLD)) | |
492 { | |
493 if (curAbrtCmd NEQ AT_CMD_ABRT) | |
494 { | |
495 new_audio_action = SWITCH_AUDIO_OFF; | |
496 } | |
497 } | |
498 break; | |
499 | |
500 default: | |
501 break; | |
502 } | |
503 | |
504 if (new_audio_action EQ ibt_params.last_action) | |
505 { | |
506 if(!((rdlPrm.rdlMod EQ AUTOM_REPEAT_ON) AND (rdlPrm.rdlcId NEQ -1))) | |
507 { | |
508 /* it is not necessary to perform the same action twice */ | |
509 return; | |
510 } | |
511 } | |
512 | |
513 switch (new_audio_action) | |
514 { | |
515 case SWITCH_AUDIO_OFF: | |
516 if (ibt_params.last_action EQ SWITCH_AUDIO_ALERT) | |
517 { | |
518 audio_StopSoundbyID (AUDIO_SPEAKER, TONES_RINGING_TONE); | |
519 } | |
520 else if (ibt_params.last_action EQ SWITCH_AUDIO_BUSY) | |
521 { | |
522 audio_StopSoundbyID (AUDIO_SPEAKER, TONES_BUSY); | |
523 } | |
524 else if (ibt_params.last_action EQ SWITCH_AUDIO_CALLWAIT) | |
525 { | |
526 audio_StopSoundbyID (AUDIO_SPEAKER, TONES_CW); | |
527 } | |
528 | |
529 TRACE_EVENT("AUDIO FUNCTION CALLED: OFF"); | |
530 ibt_params.last_action = SWITCH_AUDIO_OFF; | |
531 break; | |
532 | |
533 case SWITCH_AUDIO_ALERT: | |
534 audio_PlaySoundID (AUDIO_SPEAKER, | |
535 TONES_RINGING_TONE, | |
536 RINGER, | |
537 AUDIO_PLAY_INFINITE); | |
538 TRACE_EVENT("AUDIO FUNCTION CALLED: ALERT"); | |
539 ibt_params.last_action = SWITCH_AUDIO_ALERT; | |
540 break; | |
541 | |
542 case SWITCH_AUDIO_BUSY: | |
543 audio_PlaySoundID (AUDIO_SPEAKER, | |
544 TONES_BUSY, | |
545 RINGER, | |
546 AUDIO_PLAY_ONCE); | |
547 TRACE_EVENT("AUDIO FUNCTION CALLED: BUSY"); | |
548 ibt_params.last_action = SWITCH_AUDIO_BUSY; | |
549 break; | |
550 | |
551 case SWITCH_AUDIO_CALLWAIT: | |
552 audio_PlaySoundID (AUDIO_SPEAKER, | |
553 TONES_CW, | |
554 RINGER, | |
555 AUDIO_PLAY_ONCE); | |
556 TRACE_EVENT("AUDIO FUNCTION CALLED: CALL WAIT"); | |
557 ibt_params.last_action = SWITCH_AUDIO_CALLWAIT; | |
558 | |
559 default: | |
560 break; | |
561 } | |
562 } | |
563 | |
564 | |
565 #endif | |
566 /*==== EOF ========================================================*/ |