comparison gsm-fw/g23m-aci/aci/cmh_mmis.c @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children c77d5b1fd6a2
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
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 /* Implements Measure#32: Row 976 */
126 EF_CLNG lng;
127 T_SIM_CMD_PRM *pSIMCmdPrm; /* points to SIM command parameters */
128 T_PHB_CMD_PRM *pPHBCmdPrm; /* points to PHB command parameter */
129 T_ACI_LAN_SUP LngPCMsupLst[MAX_LAN];
130 SHORT lastIdx;
131 BOOL Suplng = FALSE;
132
133 TRACE_FUNCTION ("sAT_PlusCLAN ()");
134
135 /*
136 *-----------------------------------------------------------------
137 * check command source
138 *-----------------------------------------------------------------
139 */
140 if(!cmh_IsVldCmdSrc (srcId))
141 {
142 return( AT_FAIL );
143 }
144
145 pSIMCmdPrm = &cmhPrm[srcId].simCmdPrm;
146 pPHBCmdPrm = &cmhPrm[srcId].phbCmdPrm;
147
148 /*
149 *-------------------------------------------------------------------
150 * if Automatic language is set then read language from the sim
151 *-------------------------------------------------------------------
152 */
153 if ( lngCode->lng EQ CLAN_LNG_AUT )
154 {
155 /*
156 *-------------------------------------------------------------
157 * check entity status
158 *-------------------------------------------------------------
159 */
160 if( simEntStat.curCmd NEQ AT_CMD_NONE )
161 return( AT_BUSY );
162
163 pSIMCmdPrm->CLANact=CLAN_ACT_Write;
164 /*
165 *-------------------------------------------------------------
166 * request EF ELP from SIM
167 *-------------------------------------------------------------
168 */
169 /* Implements Measure 150 and 159 */
170 return cmhSIM_ReqLanguage_LP_or_ELP ( srcId, SIM_ELP );
171 }
172
173 /*
174 *-------------------------------------------------------------
175 * check if the language is supported in PCM
176 *-------------------------------------------------------------
177 */
178 getSupLangFromPCM(&LngPCMsupLst[0], &lastIdx);
179 Suplng=checkSuppLang(&LngPCMsupLst[0],lastIdx, lngCode);
180
181 if (Suplng)
182 {
183 /*
184 *-------------------------------------------------------------
185 * copy the set code and write it in PCM
186 *-------------------------------------------------------------
187 */
188
189 memcpy ( lng.data, lngCode->str,CLAN_CODE_LEN);
190
191 /* Implements Measure#32: Row 976 */
192 if ( pcm_WriteFile (( UBYTE* )ef_clng_id,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 return( AT_FAIL );
246 }
247
248 pPHBCmdPrm = &cmhPrm[srcId].phbCmdPrm;
249
250 /*
251 *-------------------------------------------------------------------
252 * process the mode parameter
253 *-------------------------------------------------------------------
254 */
255 switch( mode )
256 {
257 case( CLAE_MOD_Disable ):
258 case( CLAE_MOD_Enable ):
259 pPHBCmdPrm -> CLAEmode = mode;
260 break;
261
262 default:
263 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
264 return( AT_FAIL );
265 }
266
267 return( AT_CMPL );
268 }
269
270 #ifdef TI_PS_FF_AT_P_CMD_CUST
271 /*
272 +-------------------------------------------------------------------+
273 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS |
274 | ROUTINE : sAT_PercentCUST |
275 +-------------------------------------------------------------------+
276
277 PURPOSE : This function will set the customisation mode for the ACI and
278 other required entities
279 */
280
281 GLOBAL T_ACI_RETURN sAT_PercentCUST( T_ACI_CMD_SRC srcId,
282 T_CUST_MOD customisation_mode)
283 {
284 /*
285 *-------------------------------------------------------------------
286 * check command source
287 *-------------------------------------------------------------------
288 */
289 if(!cmh_IsVldCmdSrc (srcId))
290 {
291 return( AT_FAIL );
292 }
293
294 /*
295 ** This command is only valid before the ME is put into Fully Functional Mode
296 */
297 if (psaSIM_hasCustModeBeenSet() != FALSE)
298 {
299 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Unknown);
300 return( AT_FAIL );
301 }
302
303 /*
304 ** Switch on the Customisation mode
305 */
306 switch (customisation_mode)
307 {
308 case CUST_NORMAL_BEHAVIOUR: /* Default Value, No Customisation */
309 case CUST_MODE_BEHAVIOUR_1: /* Cust1 */
310
311 if (simShrdPrm.setPrm[srcId].cust_mode != customisation_mode)
312 {
313 /*
314 ** Set the customisation mode, and notify ALL other affected entities
315 */
316 simShrdPrm.setPrm[srcId].cust_mode = customisation_mode;
317 }
318 break;
319
320 default:
321 /*
322 ** This is an error
323 */
324 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
325 return (AT_FAIL);
326 }
327
328 return (AT_CMPL);
329
330 }
331 #endif /* TI_PS_FF_AT_P_CMD_CUST */
332
333 /*
334 +-------------------------------------------------------------------+
335 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS |
336 | ROUTINE : sAT_PercentSATCC |
337 +-------------------------------------------------------------------+
338
339 PURPOSE : This function will set the call and short message control by SIM functionality
340 to Enabled or Disabled according to the value in sat_cc_mode.
341 */
342
343 GLOBAL T_ACI_RETURN sAT_PercentSATCC( T_ACI_CMD_SRC srcId,
344 T_SAT_CC_MOD sat_cc_mode)
345 {
346 /*
347 *-------------------------------------------------------------------
348 * check command source
349 *-------------------------------------------------------------------
350 */
351 if(!cmh_IsVldCmdSrc (srcId))
352 {
353 return( AT_FAIL );
354 }
355
356 /*
357 ** Enable or Disbale the Call or Short Message Control by SIM, according to the passed parameter
358 */
359 switch (sat_cc_mode)
360 {
361 case SATCC_CONTROL_BY_SIM_INACTIVE:
362 case SATCC_CONTROL_BY_SIM_ACTIVE:
363 simShrdPrm.setPrm[srcId].sat_cc_mode = sat_cc_mode;
364 break;
365
366 default:
367 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
368 return( AT_FAIL );
369 }
370
371 return (AT_CMPL);
372
373 }
374
375
376 /*
377 * Implemetation of IBT handling by ME for ACI only stacks
378 */
379
380 #ifdef ACI
381
382 /*
383 +-------------------------------------------------------------------+
384 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS |
385 | ROUTINE : cmhMMI_setAudioVolume |
386 +-------------------------------------------------------------------+
387
388 PURPOSE : This function sets the volume for the audio input and
389 audio output path.
390
391 <audioIn>: input volume
392 <audioOut>: output volume
393 */
394
395 GLOBAL void cmhMMI_setAudioVolume (BYTE audioIn, BYTE audioOut)
396 {
397 TRACE_FUNCTION("cmhMMI_setAudioVolume");
398
399 audio_SetAmplf (AUDIO_MICROPHONE, audioIn);
400 audio_SetAmplf (AUDIO_SPEAKER, audioOut);
401
402 }
403
404 /*
405 +-------------------------------------------------------------------+
406 | PROJECT : GSM-PS (6147) MODULE : CMH_MMIS |
407 | ROUTINE : cmhMMI_handleAudioTone |
408 +-------------------------------------------------------------------+
409
410 PURPOSE : This function is to switch on/off a specified tone.
411
412 <cmdId>: command identifier
413 <response>: response type
414 <msgType>: CPI message type
415 */
416
417 GLOBAL void cmhMMI_handleAudioTone (T_ACI_AT_CMD cmdId,
418 UBYTE response,
419 T_ACI_CPI_MSG msgType )
420 {
421 T_ACI_IBT_ACT new_audio_action = SWITCH_AUDIO_NONE;
422
423 TRACE_FUNCTION("cmhMMI_handleAudioTone");
424
425 /* only for test purposes */
426 /*ibt_params.ati_currTch = CPI_TCH_False;*/
427
428 switch (response)
429 {
430 case RAT_CCWA:
431 new_audio_action = SWITCH_AUDIO_CALLWAIT;
432 break;
433
434 case RAT_BUSY:
435 new_audio_action = SWITCH_AUDIO_BUSY;
436 break;
437
438 case RAT_OK:
439 if ((cmdId EQ AT_CMD_H) OR (cmdId EQ AT_CMD_D) OR (cmdId EQ AT_CMD_CTFR))
440 {
441 new_audio_action = SWITCH_AUDIO_OFF;
442 }
443 break;
444
445 case RAT_CONNECT:
446 if ((ibt_params.ati_currIbt NEQ CPI_IBT_True) OR
447 (ibt_params.ati_currTch NEQ CPI_TCH_True))
448 {
449 new_audio_action = SWITCH_AUDIO_OFF;
450 }
451 break;
452
453 case RAT_NO_ANSWER:
454 case RAT_NO_CARRIER:
455 if (cmdId EQ AT_CMD_D)
456 {
457 new_audio_action = SWITCH_AUDIO_OFF;
458 }
459 break;
460
461 case RAT_CPI:
462 /* The network is not allowed to stop the BUSY tone.
463 This can only be done by ATH */
464 if (ibt_params.last_action NEQ SWITCH_AUDIO_BUSY)
465 {
466 if ((ibt_params.ati_currIbt EQ CPI_IBT_True) AND
467 (ibt_params.ati_currTch EQ CPI_TCH_True))
468 {
469 new_audio_action = SWITCH_AUDIO_OFF;
470 }
471 else
472 {
473 if ((msgType EQ CPI_MSG_Disc) OR (msgType EQ CPI_MSG_Conn))
474 {
475 new_audio_action = SWITCH_AUDIO_OFF;
476 }
477 else if (msgType EQ CPI_MSG_Alert)
478 {
479 new_audio_action = SWITCH_AUDIO_ALERT;
480 }
481 }
482 } /* if (ibt_params.last_action NEQ SWITCH_AUDIO_BUSY) */
483 break;
484
485 case RAT_CME:
486 if ((cmdId EQ AT_CMD_D) OR (cmdId EQ AT_CMD_CHLD))
487 {
488 if (curAbrtCmd NEQ AT_CMD_ABRT)
489 {
490 new_audio_action = SWITCH_AUDIO_OFF;
491 }
492 }
493 break;
494
495 default:
496 break;
497 }
498
499 if (new_audio_action EQ ibt_params.last_action)
500 {
501 if(!((rdlPrm.rdlMod EQ AUTOM_REPEAT_ON) AND (rdlPrm.rdlcId NEQ -1)))
502 {
503 /* it is not necessary to perform the same action twice */
504 return;
505 }
506 }
507
508 switch (new_audio_action)
509 {
510 case SWITCH_AUDIO_OFF:
511 if (ibt_params.last_action EQ SWITCH_AUDIO_ALERT)
512 {
513 audio_StopSoundbyID (AUDIO_SPEAKER, TONES_RINGING_TONE);
514 }
515 else if (ibt_params.last_action EQ SWITCH_AUDIO_BUSY)
516 {
517 audio_StopSoundbyID (AUDIO_SPEAKER, TONES_BUSY);
518 }
519 else if (ibt_params.last_action EQ SWITCH_AUDIO_CALLWAIT)
520 {
521 audio_StopSoundbyID (AUDIO_SPEAKER, TONES_CW);
522 }
523
524 TRACE_EVENT("AUDIO FUNCTION CALLED: OFF");
525 ibt_params.last_action = SWITCH_AUDIO_OFF;
526 break;
527
528 case SWITCH_AUDIO_ALERT:
529 audio_PlaySoundID (AUDIO_SPEAKER,
530 TONES_RINGING_TONE,
531 RINGER,
532 AUDIO_PLAY_INFINITE);
533 TRACE_EVENT("AUDIO FUNCTION CALLED: ALERT");
534 ibt_params.last_action = SWITCH_AUDIO_ALERT;
535 break;
536
537 case SWITCH_AUDIO_BUSY:
538 audio_PlaySoundID (AUDIO_SPEAKER,
539 TONES_BUSY,
540 RINGER,
541 AUDIO_PLAY_ONCE);
542 TRACE_EVENT("AUDIO FUNCTION CALLED: BUSY");
543 ibt_params.last_action = SWITCH_AUDIO_BUSY;
544 break;
545
546 case SWITCH_AUDIO_CALLWAIT:
547 audio_PlaySoundID (AUDIO_SPEAKER,
548 TONES_CW,
549 RINGER,
550 AUDIO_PLAY_ONCE);
551 TRACE_EVENT("AUDIO FUNCTION CALLED: CALL WAIT");
552 ibt_params.last_action = SWITCH_AUDIO_CALLWAIT;
553
554 default:
555 break;
556 }
557 }
558
559
560 #endif
561 /*==== EOF ========================================================*/