📄 mfw_cphs.c
字号:
else
{
cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
}
}
}
else
{
maxRec = simShrdPrm.atb[table_id].recMax;
dataLen = simShrdPrm.atb[table_id].dataLen;
if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
{
/* VO patch 040501 - add dataLen check: if (patch) else ... */
if (dataLen < MFW_CPHS_MIN_INS_SIZE )
{
simStatus = MFW_SIMOP_UNKNOWN;
infoEntry.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
}
else
cphs_req_info_num_read(startIdx, dataLen);
}
else /* Read list of information numbers */
{
/* VO patch 040501 - add dataLen check: if (patch) else ... */
if (dataLen < MFW_CPHS_MIN_INS_SIZE )
cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
else
{
if (idxLevel EQ 1) /* read this entry */
cphs_read_info_num(table_id);
else /* read the startIndex record */
cphs_req_info_num_read(startIdx, dataLen);
}
}
}
}
/*
+---------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_read_info_num |
+---------------------------------------------------------------------+
PURPOSE : Read first record of information numbers
*/
void cphs_read_info_num(SHORT table_id)
{
UBYTE* pData; /* points to data buffer */
UBYTE dataLen;
UBYTE alphaLen;
UBYTE recNr;
T_ACI_TOA type;
TRACE_FUNCTION ("cphs_read_info_num()");
pData = simShrdPrm.atb[table_id].exchData;
dataLen = simShrdPrm.atb[table_id].dataLen;
recNr = simShrdPrm.atb[table_id].recNr;
if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR OR
pData EQ NULL OR
dataLen < MFW_CPHS_MIN_INS_SIZE )
{
if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
{
simStatus = MFW_SIMOP_UNKNOWN;
infoEntry.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
}
else
{// if we are here then its possible the read of 7F20 6F19 failed.
// so we must try reading 7F10 EA01 instead.
if (cphsPrevRead == SIM_CPHS_INFN2)
{
if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
{
infoEntry.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_INFO_LIST, &infoEntry);
}
else
{
cphsPrevRead = SIM_CPHS_INFN2;
}
}
else
{
cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
}
}
cphs_signal(E_CPHS_GET_INFO_LIST, &numList); // correct ??? VO
}
else
{
if (simStatus EQ MFW_SIMOP_READ_OK)
{
/* Read entry of information numbers */
alphaLen = *pData;
if (alphaLen)
{
/* copy/encode entry */
infoEntry.index = recNr;
infoEntry.entryStat = *(pData + 1);
cmhPHB_getMfwTagNt(pData + 2, alphaLen,
infoEntry.alpha.data, &infoEntry.alpha.len);
pData += alphaLen + 2;
if (*pData NEQ 0xFF)
{
cmhPHB_getAdrStr ( (CHAR *)infoEntry.number,
3, /* length of number */
pData + 2,
*pData );
cmhPHB_toaDmrg ( *( pData + 1 ), &type );
infoEntry.ton = phb_cvtTon(type.ton);
infoEntry.npi = phb_cvtNpi(type.npi);
infoEntry.entryStat = infoEntry.entryStat | 0x80;
}
else
{
infoEntry.number[0] = '\0';
infoEntry.ton = MFW_TON_UNKNOWN;
infoEntry.npi = MFW_NPI_UNKNOWN;
}
}
infoEntry.result = MFW_SIMOP_READ_OK;
cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
return;
}
else if ((*(pData + 1) & 0x0F) < idxLevel)
{
/* The index level is out the wished index level. */
cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
}
else if ((*(pData + 1) & 0x0F) > idxLevel)
{
/* This is not wished index level. Read the next */
recNr++;
cphs_req_info_num_read(recNr, dataLen);
}
else
{
/* This is the wished index level. Read it. */
alphaLen = *pData;
if (alphaLen) /* check alpha length */
{
/* copy/encode this entry in list */
numList.level = idxLevel;
numList.entry[numList.count].index = recNr;
numList.entry[numList.count].entryStat = *(pData + 1) & 0x7F; /* set bit 8 to 0 */
cmhPHB_getMfwTagNt(pData + 2, alphaLen,
numList.entry[numList.count].alpha.data,
&numList.entry[numList.count].alpha.len);
pData += alphaLen + 2;
if (*pData NEQ 0xFF)
{
numList.entry[numList.count].entryStat = numList.entry[numList.count].entryStat | 0x80;
}
numList.count++;
}
recNr++;
/* Read the next record */
cphs_req_info_num_read(recNr, dataLen);
}
}
}
/*
+--------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_read_eeprom_mailbox |
+--------------------------------------------------------------------------+
PURPOSE : Read mailbox number from EEPROM
*/
void cphs_read_eeprom_mailbox(void)
{
U8 version;
EF_MBN mbn;
T_ACI_TOA numTp;
int i;
USHORT max_rcd;
for (i=0; i<MAX_CPHS_ENTRY; i++)
{
if (pcm_ReadRecord((UBYTE *)EF_MBN_ID,
(USHORT)(i+1),
SIZE_EF_MBN,
(UBYTE *)&mbn,
&version,
&max_rcd) == PCM_OK)
{
if (mbn.len)
{
mbNum.entries[mbNum.count].index = i+1;
cmhPHB_getAdrStr ( (char *)mbNum.entries[mbNum.count].number,
PHB_MAX_LEN - 1, mbn.mbNum, mbn.len );
cmhPHB_getMfwTagNt ( mbn.alphId, 10,
mbNum.entries[mbNum.count].alpha.data,
&mbNum.entries[mbNum.count].alpha.len );
cmhPHB_toaDmrg ( mbn.numTp, &numTp );
mbNum.entries[mbNum.count].ton = phb_cvtTon(numTp.ton);
mbNum.entries[mbNum.count].npi = phb_cvtNpi(numTp.npi);
mbNum.entries[mbNum.count].service = i;
mbNum.count++;
}
}
}
cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
}
/*
+---------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_write_eeprom_mailbox |
+---------------------------------------------------------------------------+
PURPOSE : Write mailbox number in EEPROM
*/
void cphs_write_eeprom_mailbox(T_MFW_CPHS_ENTRY *entry)
{
T_ACI_PB_TEXT text;
UBYTE len;
//EF_MBN mbn;
T_ACI_TOA type;
UBYTE *pNumber;
UBYTE result;
UBYTE outLen;
len = MINIMUM ( MAX_PCM_MAILBOX_LEN, entry->alpha.len);
text.len = len;
memcpy(text.data, entry->alpha.data, len);
text.cs = CS_Sim;
cmhPHB_getMfwTagSim ( &text, FFS_flashData.mbn_AlphId, &outLen, MAX_PCM_MAILBOX_LEN );
if ( entry->number[0] EQ '+')
{
type.ton = TON_International;
pNumber = &entry->number[1];
}
else
{
type.ton = entry->ton;
pNumber = &entry->number[0];
}
type.npi = entry->npi;
//MC- switching from PCM to FFS
cmhPHB_toaMrg ( &type, /*&mbn.numTp*/&FFS_flashData.mbn_numTp );
cmhPHB_getAdrBcd ((UBYTE*) FFS_flashData.mbn_Num/*mbn.mbNum*/, /*&mbn.len*/&FFS_flashData.mbn_len,
MAX_PCM_MAILBOX_LEN, (CHAR *)pNumber );
FFS_flashData.mbn_len/*mbn.len*/++;
if (flash_write() == EFFS_OK)
result = MFW_SIMOP_WRITE_OK;
else
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_VC_NUM, &result);
}
/*
+-----------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_read_eeprom_als |
+-----------------------------------------------------------------------+
PURPOSE : Read alternate line service information from EEPROM
*/
void cphs_read_eeprom_als()
{
EF_ALS alsInfo;
UBYTE version;
TRACE_FUNCTION ("cphs_read_eeprom_als()");
alsInfo.selLine = FFS_flashData.als_selLine;
alsInfo.statLine = FFS_flashData.als_statLine;
{
switch (alsInfo.selLine)
{
case 0:
alsStatus.selectedLine = MFW_SERV_LINE1;
break;
case 1:
alsStatus.selectedLine = MFW_SERV_LINE2;
break;
default:
alsStatus.selectedLine = MFW_SERV_LINE2;
break;
}
switch (alsInfo.statLine)
{
case 0:
alsStatus.status = MFW_LINE_LOCKED;
break;
case 1:
alsStatus.status = MFW_LINE_UNLOCKED;
break;
default:
alsStatus.status = MFW_LINE_UNLOCKED;
break;
}
}
}
/*
+-----------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_write_eeprom_als |
+-----------------------------------------------------------------------+
PURPOSE : Write selected alternate line in EEPROM
*/
void cphs_write_eeprom_als(UBYTE *res)
{
EF_ALS alsInfo;
UBYTE version;
TRACE_FUNCTION ("cphs_write_eeprom_als()");
{
if (alsStatus.status EQ MFW_LINE_LOCKED)
*res = MFW_SIMOP_WRITE_ERR;
alsStatus.selectedLine = alsData;
FFS_flashData.als_selLine = alsData;
if (flash_write() == EFFS_OK)
*res = MFW_SIMOP_WRITE_OK;
else
*res = MFW_SIMOP_WRITE_ERR;
}
}
/*
+-----------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_write_eeprom_alss|
+-----------------------------------------------------------------------+
PURPOSE : Write line lock status in EEPROM
*/
void cphs_write_eeprom_alss(UBYTE *res)
{
EF_ALS alsInfo;
UBYTE version;
TRACE_FUNCTION ("cphs_write_eeprom_als()");
{
alsStatus.status = alsData;
if (flash_write() == EFFS_OK)
*res = MFW_SIMOP_WRITE_OK;
else
*res = MFW_SIMOP_WRITE_ERR;
}
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
| STATE : code ROUTINE: cphs_read_sim_dat |
+----------------------------------------------------------------------+
PURPOSE : Request to read SIM card.
*/
BOOL cphs_read_sim_dat(USHORT data_id, UBYTE len, UBYTE max_length)
{
T_ACI_RETURN res;
TRACE_FUNCTION ("cphs_read_sim_dat()");
res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
AT_CMD_NONE,
data_id,
0,
max_length,
NULL,
cphs_read_sim_dat_cb);
if (res NEQ AT_EXCT)
return FALSE;
return TRUE;
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
| STATE : code ROUTINE: cphs_read_sim_dat_cb |
+----------------------------------------------------------------------+
PURPOSE : Call back for SIM read.
*/
void cphs_read_sim_dat_cb(SHORT table_id)
{
UBYTE dataLen;
UBYTE result;
char debug[50];
TRACE_FUNCTION ("cphs_read_sim_dat_cb()");
sprintf(debug, "SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
TRACE_EVENT(debug);
switch (simShrdPrm.atb[table_id].reqDataFld)
{
case SIM_CPHS_CINF: /* CPHS information */
if (!cphsUpdate)
cphs_read_information(simShrdPrm.atb[table_id].errCode,
simShrdPrm.atb[table_id].exchData,
simShrdPrm.atb[table_id].dataLen);
#ifdef SIM_TOOLKIT
else
cphs_update_info_cnf(simShrdPrm.atb[table_id].errCode,
simShrdPrm.atb[table_id].exchData,
simShrdPrm.atb[table_id].dataLen);
#endif
break;
case SIM_CPHS_ONSTR: /* operator name string */
cphs_read_ons(simShrdPrm.atb[table_id].errCode,
simShrdPrm.atb[table_id].exchData,
simShrdPrm.atb[table_id].dataLen);
break;
case SIM_CPHS_ONSHF: /* operator name short form */
cphs_read_onsf(simShrdPrm.atb[table_id].errCode,
simShrdPrm.atb[table_id].exchData,
simShrdPrm.atb[table_id].dataLen);
break;
case SIM_CPHS_VMW: /* voice message waiting flag */
/* PATCH VO 22.01.01 */
if (simStatus EQ MFW_SIMOP_WRITE_OK)
{
/* Determine the size of this field, and write the data.
When the writing is not possible, write this voice
message waiting flag in EEPROM. */
simStatus = MFW_SIMOP_UNKNOWN;
if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
{
dataLen = simShrdPrm.atb[table_id].dataLen;
/* Write voice message waiting flag.
When this writing failed, send event with "write error" parameter to MMI */
if (!cphs_write_sim_dat(SIM_CPHS_VMW, mbsData, dataLen))
{
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_VC_STAT, &result);
}
}
else
{
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_VC_STAT, &result);
}
}
else
/* PATCH VO 22.01.01 end */
cphs_read_mbs (simShrdPrm.atb[table_id].errCode,
simShrdPrm.atb[table_id].exchData,
simShrdPrm.atb[table_id].dataLen);
break;
case SIM_CPHS_CFF: /* call forwarding flag */
/* PATCH VO 22.01.01 */
if (simStatus EQ MFW_SIMOP_WRITE_OK)
{
/* Determine the size of this field, and write the data.
When the writing is not possible, write this voice
message waiting flag in EEPROM. */
simStatus = MFW_SIMOP_UNKNOWN;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -