📄 smi_cal.c
字号:
*/
LOCAL void cal_sigChldCtfr (T_SS_ACA_RSLT rslt)
{
TRACE_FUNCTION ("cal_sigChldCtfr ()");
ui_signal (UI_SIG_SSWC, rslt);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_changeCall |
+--------------------------------------------------------------------+
PURPOSE : This function is used for handling of supplementary
services within a call according to GSM 02.30.
<chld>: holds all information concerning SS within a call
returns: status information concerning the changing
progress
*/
GLOBAL T_ACI_RETURN cal_changeCall (T_KSD_CHLD* chld)
{
T_ACI_RETURN ret = AT_FAIL; /* holds the status information */
TRACE_FUNCTION ("cal_changeCall ()");
/*
*-----------------------------------------------------------------
* call to ACI function when no answer on a further ACI function
* call is expected
*-----------------------------------------------------------------
*/
if (currCalCmd EQ AT_CMD_NONE)
{
ret = sAT_PlusCHLD (CMD_SRC_LCL, chld->mode, chld->call);
CHLDmode = chld->mode;
currCalCmd = AT_CMD_CHLD;
/*
*---------------------------------------------------------------
* process result code of ACI function call
*---------------------------------------------------------------
*/
switch (ret)
{
case (AT_CMPL):
rAT_OK (currCalCmd);
break;
case (AT_EXCT):
break;
default:
rAT_PlusCME (currCalCmd, CME_ERR_Unknown);
break;
}
}
else
{
/*
*---------------------------------------------------------------
* error handling while waiting for answer on further ACI
* function call
*---------------------------------------------------------------
*/
ui_signal (UI_SIG_UNHND_CME_ERR, CME_ERR_Unknown);
ret = AT_CMPL;
}
return ret;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_invokeCTFR |
+--------------------------------------------------------------------+
PURPOSE : This function is used for handling call deflection.
returns: status information concerning the changing
progress
*/
GLOBAL T_ACI_RETURN cal_invokeCTFR (T_KSD_CTFR *ctfr)
{
T_ACI_RETURN ret = AT_FAIL; /* holds the status information */
TRACE_FUNCTION ("cal_invokeCTFR ()");
/*
*-----------------------------------------------------------------
* call to ACI function when no answer on a further ACI function
* call is expected
*-----------------------------------------------------------------
*/
if (currCalCmd EQ AT_CMD_NONE)
{
ret = sAT_PlusCTFR (CMD_SRC_LCL,
ctfr->number, &ctfr->type,
ctfr->subaddr, &ctfr->satype);
currCalCmd = AT_CMD_CTFR;
/*
*---------------------------------------------------------------
* process result code of ACI function call
*---------------------------------------------------------------
*/
switch (ret)
{
case (AT_CMPL):
rAT_OK (currCalCmd); /* Not expected here */
break;
case (AT_EXCT):
break;
default:
rAT_PlusCME (currCalCmd, CME_ERR_Unknown);
break;
}
}
else
{
/*
*---------------------------------------------------------------
* error handling while waiting for answer on further ACI
* function call
*---------------------------------------------------------------
*/
ui_signal (UI_SIG_UNHND_CME_ERR, CME_ERR_Unknown);
ret = AT_CMPL;
}
return ret;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_ChldCtfrCnf |
+--------------------------------------------------------------------+
PURPOSE : This function is called when handling of supplementary
services via sAT_PlusCHLD() or sAT_PlusCTFR within a call
is successfull.
*/
GLOBAL void cal_ChldCtfrCnf (T_ACI_AT_CMD cmdId)
{
TRACE_FUNCTION ("cal_ChldCtfrCnf ()");
if (cmdId EQ currCalCmd)
{
currCalCmd = AT_CMD_NONE;
cal_sigChldCtfr (SS_RSLT_OK);
}
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_ChldCtfrRej |
+--------------------------------------------------------------------+
PURPOSE : This function is called when handling of supplementary
services via sAT_PlusCHLD() or sAT_PlusCTFR within a call
failed.
<err>: error code
*/
GLOBAL void cal_ChldCtfrRej (T_ACI_AT_CMD cmdId,
T_ACI_CME_ERR err)
{
TRACE_FUNCTION ("cal_ChldCtfrRej ()");
if (cmdId EQ currCalCmd)
currCalCmd = AT_CMD_NONE;
cal_sigChldCtfr (SS_RSLT_FAIL);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_showCallTable |
+--------------------------------------------------------------------+
PURPOSE : This function is used to stimulate the display of
the call table.
returns: status information of call table query
*/
EXTERN T_ACI_RETURN cal_showCallTable (void)
{
T_ACI_RETURN ret = AT_FAIL; /* holds the status information */
T_ACI_CAL_LST callTable; /* holds call table */
T_CTB_INFO lstItem[MAX_CALL_NR + 1];
/* holds call table information */
/* relevant for display */
USHORT i = 0; /* used as counter */
TRACE_FUNCTION ("cal_showCallTable ()");
ret = qAT_PercentCAL (CMD_SRC_LCL, &callTable[0]);
if (ret EQ AT_CMPL)
{
/*
*---------------------------------------------------------------
* extract all relevant information out of the call table that
* should be displayed to the user
*---------------------------------------------------------------
*/
while (i < MAX_CALL_NR AND
callTable[i].index NEQ -1)
{
lstItem[i].index = callTable[i].index;
lstItem[i].status = callTable[i].status;
i++;
}
/*
*---------------------------------------------------------------
* terinate the list
*---------------------------------------------------------------
*/
lstItem[i].index = -1;
lstItem[i].status = CAL_STAT_NotPresent;
ui_signal (UI_SIG_SHOW_CALL_TABLE, &lstItem[0]);
}
else
ui_signal (UI_SIG_UNHND_CME_ERR, CME_ERR_Unknown);
return ret;
}
#if 0 /* Disable code as it seems not to be needed anymore */
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_isCallActive |
+--------------------------------------------------------------------+
PURPOSE : This function is used to request whether at least one
call is active.
returns: TRUE if at least one call is active, otherwise
FALSE
*/
GLOBAL BOOL cal_isCallActive (void)
{
T_ACI_RETURN ret = AT_FAIL; /* holds status information */
T_ACI_CAL_LST callTable; /* holds call table */
USHORT i = 0; /* used as counter */
BOOL isCallActive = FALSE; /* holds result of request */
TRACE_FUNCTION ("cal_isCallActive ()");
ret = qAT_PercentCAL (CMD_SRC_LCL, &callTable[0]);
if (ret EQ AT_CMPL)
{
/*
*---------------------------------------------------------------
* searching for active calls
*---------------------------------------------------------------
*/
// I have my doubts whether the expression (callTable[i].index NEQ -1)
// should be in the while loop and not in the if clause, but I'm
// not expirienced enough in the SMI code to change that now... (HM)
while (i < MAX_CALL_NR AND
callTable[i].index NEQ -1)
{
if (callTable[i].status EQ CAL_STAT_Active)
isCallActive = TRUE;
i++;
}
}
return isCallActive;
}
#endif
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_isDTMFPossible |
+--------------------------------------------------------------------+
PURPOSE : This function is used to request whether in the current
situation DTMF maybe possible. The final decision whether
DTMF is possible is met by the call control entitity, the
attempt maybe rejected.
returns: TRUE if DTMF maybe possible, otherwise FALSE.
*/
GLOBAL BOOL cal_isDTMFPossible (void)
{
T_ACI_RETURN ret;
T_ACI_CAL_LST callTable;
USHORT i;
TRACE_FUNCTION ("cal_isDTMFPossible()");
ret = qAT_PercentCAL (CMD_SRC_LCL, &callTable[0]);
assert (ret EQ AT_CMPL); /* All other return values are really unexpected */
/*
* Search for calls which are in a state which may allow DTMF
*/
for (i = 0; i < MAX_CALL_NR; i++)
{
if ((callTable[i].index NEQ -1) AND
((callTable[i].status EQ CAL_STAT_Active) OR
(callTable[i].status EQ CAL_STAT_Dial) OR
(callTable[i].status EQ CAL_STAT_DeactiveReq)OR
(callTable[i].status EQ CAL_STAT_Incomming)))
return TRUE;
}
/* No call present which may be able to do DTMF */
return FALSE;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_isCallWaiting |
+--------------------------------------------------------------------+
PURPOSE : This function is used to request whether at least one
call is waiting.
returns: TRUE if at least one call is waiting, otherwise
FALSE
*/
GLOBAL BOOL cal_isCallWaiting (void)
{
T_ACI_RETURN ret = AT_FAIL; /* holds status information */
T_ACI_CAL_LST callTable; /* holds call table */
USHORT i = 0; /* used as counter */
BOOL isCallWaiting = FALSE; /* holds result of request */
TRACE_FUNCTION ("cal_isCallWaiting ()");
ret = qAT_PercentCAL (CMD_SRC_LCL, &callTable[0]);
if (ret EQ AT_CMPL)
{
/*
*---------------------------------------------------------------
* searching for waiting calls
*---------------------------------------------------------------
*/
while (i < MAX_CALL_NR AND
callTable[i].index NEQ -1)
{
if (callTable[i].status EQ CAL_STAT_Wait)
isCallWaiting = TRUE;
i++;
}
}
return isCallWaiting;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_isFirstCallWait |
+--------------------------------------------------------------------+
PURPOSE : This function is used to request whether there is only
one call in the call table and whether this call is
waiting.
returns: TRUE if the above condition is correct, otherwise
FALSE
*/
GLOBAL BOOL cal_isFirstCallWait (void)
{
T_ACI_RETURN ret = AT_FAIL; /* holds status information */
T_ACI_CAL_LST callTable; /* holds call table */
USHORT i = 0; /* used as counter */
BOOL isCallWait = FALSE; /* holds whether calls are */
/* waiting */
TRACE_FUNCTION ("cal_isFirstCallWait ()");
ret = qAT_PercentCAL (CMD_SRC_LCL, &callTable[0]);
if (ret EQ AT_CMPL)
{
/*
*---------------------------------------------------------------
* searching for waiting calls
*---------------------------------------------------------------
*/
while (i < MAX_CALL_NR AND
callTable[i].index NEQ -1)
{
if (callTable[i].status EQ CAL_STAT_Wait)
isCallWait = TRUE;
i++;
}
}
/*
*-----------------------------------------------------------------
* calculating the result
*-----------------------------------------------------------------
*/
return (i EQ 1 AND isCallWait);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_CAL |
| STATE : code ROUTINE : cal_isWithinCall |
+--------------------------------------------------------------------+
PURPOSE : This function is used to request whether at least one call
is present (any non-idle state).
Definition from GSM 02.30 subclause 4.5.3.2:
A MS is "in a call" from the time that signalling related to the
establishment or attempted establishment of a MO or MT call
commences and before the call or call attempt ends,
and (if applicable) the ME has stopped generating tones related
to this call to the user.
returns: TRUE if the above condition is correct, otherwise FALSE.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -