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

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