📄 smi_aca.c
字号:
/*
+-----------------------------------------------------------------------------
| Project : GSM-F&D (8411)
| Modul : SMI_ACA
+-----------------------------------------------------------------------------
| Copyright 2002 Texas Instruments Berlin, AG
| All rights reserved.
|
| This file is confidential and a trade secret of Texas
| Instruments Berlin, AG
| The receipt of or possession of this file does not convey
| any rights to reproduce or disclose its contents or to
| manufacture, use, or sell anything it may describe, in
| whole, or in part, without the specific written consent of
| Texas Instruments Berlin, AG.
+-----------------------------------------------------------------------------
| Purpose : This module defines the interfacing with
| the ACI on the base of function calls
+-----------------------------------------------------------------------------
*/
#ifndef SMI_ACA_C
#define SMI_ACA_C
#endif
#define ENTITY_SMI
/*==== INCLUDES ===================================================*/
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "tok.h"
#include "message.h"
#include "aci_cmh.h"
#include "ksd.h"
#include "aca.h"
#include "smi.h"
#include "gdi.h"
#include "audio.h"
#ifdef BT_ADAPTER
#include "dti.h"
#include "bti.h"
#endif
#ifdef BT_INTERFACE
#include "bti_btp.h"
#endif /* BT_ADAPTER */
/*==== CONSTANTS ==================================================*/
/*==== EXPORT =====================================================*/
/*==== VARIABLES ==================================================*/
LOCAL T_ACI_AT_CMD currAbrtCmd = AT_CMD_NONE;
LOCAL CHAR* atRedirect[] = { "D", NULL };
#ifdef BT_ADAPTER
static UBYTE dummy[BTI_BD_ADDR_LENGTH];
static UBYTE hs_addr[BTI_BD_ADDR_LENGTH];
static UBYTE du_addr[BTI_BD_ADDR_LENGTH];
#endif /* BT_ADAPTER */
/*==== FUNCTIONS ==================================================*/
EXTERN T_ACI_RETURN cmhSS_ksdIMEI ( T_ACI_CMD_SRC srcId );
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : aca_init |
+--------------------------------------------------------------------+
PURPOSE : This function initializes the ACI adapter parameters.
*/
GLOBAL void aca_init (BOOL isStartup)
{
/*
*-----------------------------------------------------------------
* redirect ATD commands from the AT command interpreter to the
* extension mechanism if necessary
*-----------------------------------------------------------------
*/
// sAT_CfgEXT ( atRedirect );
/*
*-----------------------------------------------------------------
* initialize general parameter
*-----------------------------------------------------------------
*/
mmi_data->state = MMI_OFF;
mmi_data->serviceType = SRV_NONE;
/*
*-----------------------------------------------------------------
* initialize the modul SMI_REG
*-----------------------------------------------------------------
*/
reg_initialize(isStartup);
/*
*-----------------------------------------------------------------
* initialize the modul SMI_SEC
*-----------------------------------------------------------------
*/
sec_initialize(isStartup);
/*
*-----------------------------------------------------------------
* initialize the modul SMI_CAL
*-----------------------------------------------------------------
*/
cal_initialize(isStartup);
/*
*-----------------------------------------------------------------
* initialize the modul SMI_SS
*-----------------------------------------------------------------
*/
ss_initialize(isStartup);
/*
*-----------------------------------------------------------------
* initialize the modul SMI_SMS
*-----------------------------------------------------------------
*/
sms_initialize(isStartup);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : aca_setupVolume |
+--------------------------------------------------------------------+
PURPOSE : This function sets the volume for the audio input and
audio output path.
<audioIn>: input volume
<audioOut>: output volume
returns: status information concerning the setting
progress
*/
GLOBAL T_ACI_RETURN aca_setupVolume (UBYTE audioIn, UBYTE audioOut)
{
TRACE_FUNCTION ("aca_setupVolume ()");
audio_SetAmplf (AUDIO_MICROPHONE, audioIn);
audio_SetAmplf (AUDIO_SPEAKER, audioOut);
return (AT_CMPL);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : rAT_PercentSQ |
+--------------------------------------------------------------------+
PURPOSE : This function is called when the RX level changes with
respect to the further set profile.
<segm>: number of RX level segment
*/
GLOBAL void rAT_PercentSQ (BYTE segm)
{
TRACE_FUNCTION ("rAT_PercentSQ ()");
ui_signal (UI_SIG_RXLEV, segm);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : rAT_PercentBC |
+--------------------------------------------------------------------+
PURPOSE : This function is called when battery charge changes with
respect to the further set profile.
<segm>: number of battery charge segment
*/
GLOBAL void rAT_PercentBC (BYTE segm)
{
TRACE_FUNCTION ("rAT_PercentBC ()");
ui_signal (UI_SIG_BATLEV, segm);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : aca_signal |
+--------------------------------------------------------------------+
PURPOSE : This function processs the ACA_SIG_XXX signals that are
send by the MMI_UI logic.
*/
static USHORT aca_siglevel = 0; /* used to indicate a recursion */
GLOBAL void aca_signal (UBYTE sigCode, ...)
{
va_list varpars;
CHAR buf[30];
sprintf (buf, "[%d], ACA-Signal: %d", aca_siglevel++, sigCode);
TRACE_EVENT (buf);
switch (sigCode)
{
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_KEYSEQUENCE
*---------------------------------------------------------------
*/
case ACA_SIG_KEYSEQUENCE:
{
static T_KEYSEQ_HND hnd; /* handle for key sequence */
/* decoding */
CHAR *input; /* keystroke sequence */
va_start (varpars, sigCode);
input = va_arg (varpars, CHAR*);
va_end (varpars);
aca_keySeqHndInit (&hnd);
aca_keySeqInd (input, &hnd);
break;
}
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_PININPUT
*---------------------------------------------------------------
*/
case ACA_SIG_PININPUT:
{
CHAR *input; /* entered PIN */
va_start (varpars, sigCode);
input = va_arg (varpars, CHAR*);
va_end (varpars);
/*
if (mmi_data->state EQ MMI_WAIT_FOR_PIN)
*/
sec_pinEntered (input);
break;
}
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_PUKINPUT
*---------------------------------------------------------------
*/
case ACA_SIG_PUKINPUT:
{
CHAR *puk; /* entered PUK */
CHAR *npin1; /* entered new pin the first time */
CHAR *npin2; /* entered new pin the second time */
va_start (varpars, sigCode);
puk = va_arg (varpars, CHAR*);
npin1 = va_arg (varpars, CHAR*);
npin2 = va_arg (varpars, CHAR*);
va_end (varpars);
if (mmi_data->state EQ MMI_WAIT_FOR_PUK)
sec_pukEntered (puk, npin1, npin2);
break;
}
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_POWER_ON
*---------------------------------------------------------------
*/
case ACA_SIG_POWER_ON:
reg_powerOn ();
break;
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_POWER_OFF
*---------------------------------------------------------------
*/
case ACA_SIG_POWER_OFF:
reg_powerOff ();
break;
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_RELEASE
*---------------------------------------------------------------
*/
case ACA_SIG_RELEASE:
cal_releaseCall ();
break;
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_ACCEPT
*---------------------------------------------------------------
*/
case ACA_SIG_ACCEPT:
cal_acceptCall ();
break;
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_SEND_DTMF
*---------------------------------------------------------------
*/
case ACA_SIG_SEND_DTMF:
{
CHAR key; /* DTMF key */
UBYTE stat;
va_start (varpars, sigCode);
key = va_arg (varpars, CHAR);
stat = va_arg (varpars, UBYTE);
va_end (varpars);
cal_sendDtmf (key, stat EQ KEY_STAT_PRS);
break;
}
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_REGISTER
*---------------------------------------------------------------
*/
case ACA_SIG_REGISTER:
{
va_start (varpars, sigCode);
reg_setOperName (va_arg (varpars, CHAR*));
va_end (varpars);
reg_startReg ();
break;
}
/*
*---------------------------------------------------------------
* handling of signal ACA_SIG_VOLUME
*---------------------------------------------------------------
*/
case ACA_SIG_VOLUME:
{
UBYTE volume; /* level of volume */
va_start (varpars, sigCode);
volume = va_arg (varpars, UBYTE);
va_end (varpars);
aca_setupVolume (volume, volume);
break;
}
}
aca_siglevel--;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : aca_keySeqHndInit |
+--------------------------------------------------------------------+
PURPOSE : This function initializes the structure for handling
of keystroke sequences.
<hnd>: keystroke sequence decoder handle
*/
GLOBAL void aca_keySeqHndInit (T_KEYSEQ_HND* hnd)
{
*hnd->keySeq = NULL_TERM;
hnd->nextSeq = hnd->keySeq;
hnd->restSeq = hnd->nextSeq;
hnd->grp = SEQGRP_UNKNOWN;
hnd->atReturn = AT_FAIL;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_ACA |
| STATE : code ROUTINE : aca_keySeqInd |
+--------------------------------------------------------------------+
PURPOSE : This function is used to decode a keystroke sequence and
to initiate an appropriate action.
<inSeq>: incoming keystroke sequence
<hnd>: keystroke sequence decoder handle
*/
GLOBAL void aca_keySeqInd (CHAR* inSeq, T_KEYSEQ_HND* hnd)
{
TRACE_FUNCTION ("aca_keySeqInd ()");
if (strlen (hnd->nextSeq) NEQ 0 OR
strlen (inSeq) EQ 0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -