📄 mfw_sat.c
字号:
TRACE_FUNCTION("decItemIcons()");
res = decTLV(0x1F,mandatory,"Item Icon List");
m->itemIconQual = 0xFF; /* default: not present */
if (res > 1)
{
m->itemIconQual = *curVal++;
curLen--;
if (nItems > curLen)
nItems = curLen;
while (nItems--)
{
t->icon = *curVal++; /* next action identifier */
t++;
}
return 1;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decDefItem |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: default item
*/
static U8 decDefItem (SatItem *t, U8 nItems, U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decDefItem()");
res = decTLV(0x10,mandatory,"Default Item");
if (res > 1)
{
if (curLen != 1)
return res; /* ES!! error */
while (nItems--)
{
if (t->id == *curVal)
t->action |= 0x40; /* flag as default */
t++;
}
return 1;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decTone |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: tone
*/
static U8 decTone (U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decTone()");
res = decTLV(0x0E,mandatory,"Tone");
if (res > 1)
{
cmd.c.tone.tone = *curVal; /* tone type */
return 1;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decDuration |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: duration
*/
static U8 decDuration (U8 *dur, U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decDuration()");
res = decTLV(0x04,mandatory,"Duration");
if (res > 1)
{
*dur++ = *curVal++; /* duration unit */
*dur++ = *curVal; /* duration value */
return 1;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decDevId |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: device identities
*/
static U8 decDevId (U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decDevId()");
res = decTLV(0x02,mandatory,"Devices");
if (res > 1)
{
cmd.source = *curVal++; /* source identifier */
cmd.dest = *curVal; /* destination identifier */
return 1;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decRespLen |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: response length
*/
static U8 decRespLen (U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decRespLen()");
res = decTLV(0x11,mandatory,"Response Length");
if (res > 1)
{
cmd.c.inp.rspMin = *curVal++; /* minimal length */
cmd.c.inp.rspMax = *curVal; /* maximal length */
return 1;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decIconId |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: icon identifier
*/
static U8 decIconId (SatIconId *id, U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decIconId()");
res = decTLV(0x1E,mandatory,"IconID");
if (res > 1)
{
id->qual = *curVal++; /* icon qualifier */
id->id = *curVal; /* icon identifier */
return 1;
}
else
{
id->qual = 0xFF; /* not present */
id->id = 0xFF;
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decRespFlag |
+--------------------------------------------------------------------+
PURPOSE : decode TLV: immediate response
*/
static U8 decRespFlag (U8 *flag, U8 mandatory)
{
U8 res;
TRACE_FUNCTION("decRespFlag()");
res = decTLV(0x2B,mandatory,"ResponseFlag");
if (res > 1)
{
*flag = 1; /* immediate response */
return 1;
}
else
{
*flag = 0; /* no immediate response */
}
return res;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decDispText |
+--------------------------------------------------------------------+
PURPOSE : decode command: display text
*/
static U32 decDispText (void)
{
TRACE_FUNCTION("decDispText()");
while (curCmdLen > 0)
{
if (!decDevId(1))
return 0;
if (cmd.source == SatDevSIM && cmd.dest == SatDevDisplay)
break; /* success */
TRACE_ERROR("illegal device combination");
if (curCR)
{
satResponse(SatResUnknownData);
return 0;
}
partialCompr = 1;
}
if (!decText(&cmd.c.text,0x0D,1))
return 0;
if (!decIconId(&cmd.c.text.icon,0))
return 0; /* fatal error */
if (!decRespFlag(&cmd.c.text.responseFlag,0))
return 0; /* fatal error */
/* SPR#2340 - DS - If len is zero, string is empty */
if (cmd.c.text.len == 0x00)
{
/* If no text string is supplied send result "Command data not understood by ME" */
satResponse(SatResUnknownData);
}
return MfwSatTextOut;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decGetKey |
+--------------------------------------------------------------------+
PURPOSE : decode command: get inkey
*/
static U32 decGetKey (void)
{
TRACE_FUNCTION("decGetKey()");
while (curCmdLen > 0)
{
if (!decDevId(1))
return 0;
if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
break; /* success */
TRACE_ERROR("illegal device combination");
if (curCR)
{
satResponse(SatResUnknownData);
return 0;
}
partialCompr = 1;
}
if (!decText(&cmd.c.text,0x0D,1))
return 0;
if (!decIconId(&cmd.c.text.icon,0))
return 0; /* fatal error */
return MfwSatGetKey;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decGetString |
+--------------------------------------------------------------------+
PURPOSE : decode command: get input
*/
static U32 decGetString (void)
{
TRACE_FUNCTION("decGetString()");
while (curCmdLen > 0)
{
if (!decDevId(1))
return 0;
if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
break; /* success */
TRACE_ERROR("illegal device combination");
if (curCR)
{
satResponse(SatResUnknownData);
return 0;
}
partialCompr = 1;
}
if (!decText(&cmd.c.inp.prompt,0x0D,1))
return 0;
if (!decRespLen(1))
return 0;
cmd.c.inp.defRsp.len = 0; /* default settings */
cmd.c.inp.defRsp.code = 0;
cmd.c.inp.defRsp.text = 0;
if (!decText(&cmd.c.inp.defRsp,0x17,0))
return 0; /* fatal error */
if (!decIconId(&cmd.c.inp.prompt.icon,0))
return 0; /* fatal error */
return MfwSatGetString;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decPlayTone |
+--------------------------------------------------------------------+
PURPOSE : decode command: play tone
*/
static U32 decPlayTone (void)
{
TRACE_FUNCTION("decPlayTone()");
while (curCmdLen > 0)
{
if (!decDevId(1))
return 0;
if (cmd.source == SatDevSIM && cmd.dest == SatDevSpeaker)
break; /* success */
TRACE_ERROR("illegal device combination");
if (curCR)
{
satResponse(SatResUnknownData);
return 0;
}
partialCompr = 1;
}
cmd.c.tone.alpha.len = 0; /* default settings */
cmd.c.tone.alpha.code = 0;
cmd.c.tone.alpha.text = 0;
cmd.c.tone.tone = 0;
cmd.c.tone.durUnit = 0;
cmd.c.tone.durValue = 0;
if (!decAlpha(&cmd.c.tone.alpha,0))
return 0;
if (!decTone(0))
return 0;
if (!decDuration(&cmd.c.tone.durUnit,0))
return 0;
return MfwSatPlayTone;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
| STATE : code ROUTINE : decSetMenu |
+--------------------------------------------------------------------+
PURPOSE : decode command: setup menu
*/
static U32 decSetMenu (void)
{
SatItem *ip;
S16 oldLen;
U8 nItems;
TRACE_FUNCTION("decSetMenu()");
while (curCmdLen > 0)
{
if (!decDevId(1))
return 0;
if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
break; /* success */
TRACE_ERROR("illegal device combination");
if (curCR)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -