📄 mfw_cphs.c
字号:
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_get_mailbox |
+--------------------------------------------------------------------+
PURPOSE : Request the Mailbox Numbers
*/
void cphs_get_mailbox (void)
{
TRACE_FUNCTION ("cphs_get_mailbox()");
mbNum.count = 0;
/* Check CPHS support status.
When CPHS is not support, read mailbox numbers from EEPROM */
if (cphsStatus EQ CPHS_NotPresent)
{
cphs_read_eeprom_mailbox();
return;
}
/* Check CPHS service table.
When CPHS is not support, read mailbox numbers from EEPROM */
if (cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED)
{
cphs_read_eeprom_mailbox();
return;
}
/* Read mailbox numbers from SIM.
When this reading failed, read mailbox numbers from EEPROM */
if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, 1, 0)) /* read the first record */
cphs_read_eeprom_mailbox();
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_set_mailbox |
+--------------------------------------------------------------------+
PURPOSE : Save the Mailbox Numbers
*/
T_MFW cphs_set_mailbox (T_MFW_CPHS_ENTRY *entry)
{
TRACE_FUNCTION ("cphs_set_mailbox()");
if (entry NEQ NULL AND
strlen((char *)entry->number) NEQ 0 )
/* PATCH JPS 16.01.01: must copy the data and not only point on it!! */
{
memcpy((char *)&MbnEntry, (char *)entry, sizeof(T_MFW_CPHS_ENTRY));
//vcEntry = entry;
vcEntry = &MbnEntry; // VO ???
}
else
return CPHS_ERR;
if ((entry->index <= 0) OR
(entry->index > 4) )
return CPHS_ERR;
/* Check CPHS support status.
When CPHS is not support, write mailbox numbers to EEPROM */
if (cphsStatus EQ CPHS_NotPresent)
{
cphs_write_eeprom_mailbox(entry);
return CPHS_OK;
}
/* Check CPHS service table.
When CPHS is not support, write mailbox numbers to EEPROM */
if ( cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED)
{
cphs_write_eeprom_mailbox(entry);
return CPHS_OK;
}
/* Read first record to determine the data length,
When the reading failed, write mailbox numbers to EEPROM */
simStatus = MFW_SIMOP_WRITE_OK;
if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, 1, 0))
{
simStatus = MFW_SIMOP_UNKNOWN;
cphs_write_eeprom_mailbox(entry);
}
return CPHS_OK;
}
/*
+-------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_get_mailbox_status |
+-------------------------------------------------------------------------+
PURPOSE : get the voice message waiting flag
*/
T_MFW cphs_get_mailbox_status ()
{
TRACE_FUNCTION ("cphs_get_mailbox_status()");
/* Read voice message waiting flag.
When this reading failed, send event with "read error" parameter to MMI */
if (!cphs_read_sim_dat(SIM_CPHS_VMW, NOT_PRESENT_8BIT, MFW_CPHS_MBS_SIZE))
{
mbStatus.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_VC_STAT, &mbStatus);
}
return cphsStatus;
}
/*
+-------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_set_mailbox_status |
+-------------------------------------------------------------------------+
PURPOSE : Save the voice message waiting flag
*/
T_MFW cphs_set_mailbox_status (T_MFW_CFLAG_STATUS line1,
T_MFW_CFLAG_STATUS line2,
T_MFW_CFLAG_STATUS fax,
T_MFW_CFLAG_STATUS data)
{
UBYTE result;
TRACE_FUNCTION ("cphs_set_mailbox_status()");
/* Check CPHS support status. */
if (cphsStatus EQ CPHS_NotPresent)
{
TRACE_EVENT("cphsStatus is CPHS_NotPresent !");
return cphsStatus;
}
/* Write status in buffer */
if (line1 EQ MFW_CFLAG_SET OR
line1 EQ MFW_CFLAG_NOTSet )
{ mbsData[0] &=0xF0; //zero the lower nibble
mbsData[0] |= line1&0x0F; /* low Nibble */
}
/*else
mbsData[0] = 0x0F;*/
if (line2 EQ MFW_CFLAG_SET OR
line2 EQ MFW_CFLAG_NOTSet )
{ mbsData[0]&=0x0F;
mbsData[0] |= (line2 << 4)&0xF0;; /* high Nibble */
}
if (fax EQ MFW_CFLAG_SET OR
fax EQ MFW_CFLAG_NOTSet )
{ mbsData[1] &= 0xF0; //zero the low nibble
mbsData[1] |= fax&0x0F; /* low Nibble */
}
if (data EQ MFW_CFLAG_SET OR
data EQ MFW_CFLAG_NOTSet )
{ mbsData[1] &= 0x0F; //zero the high nibble
mbsData[1] |= (data << 4)&0xF0; /* high Nibble */
}
/* Read voice message waiting flag to determine the size */
simStatus = MFW_SIMOP_WRITE_OK;
if (!cphs_read_sim_dat(SIM_CPHS_VMW, NOT_PRESENT_8BIT, MFW_CPHS_MBS_SIZE))
{
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_VC_STAT, &result);
}
/* PATCH VO 22.01.01 end */
return cphsStatus;
}
/*
+------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_get_divert_status |
+------------------------------------------------------------------------+
PURPOSE : Request the call forwarding flags
*/
T_MFW cphs_get_divert_status ()
{
TRACE_FUNCTION ("cphs_get_divert_status()");
/* Read call forwarding flags.
When this reading failed, send event with "read error" parameter to MMI */
if (!cphs_read_sim_dat(SIM_CPHS_CFF, NOT_PRESENT_8BIT, MFW_CPHS_CFF_SIZE))
{
dvStatus.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_DV_STAT, &dvStatus);
}
return cphsStatus;
}
/*
+-------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_set_divert_status |
+-------------------------------------------------------------------------+
PURPOSE : Save the call forwarding flag
*/
T_MFW cphs_set_divert_status (T_MFW_CFLAG_STATUS line1,
T_MFW_CFLAG_STATUS line2,
T_MFW_CFLAG_STATUS fax,
T_MFW_CFLAG_STATUS data)
{
UBYTE result;
TRACE_FUNCTION ("cphs_set_divert_status()");
/* Write status in buffer */
if (line1 EQ MFW_CFLAG_SET OR
line1 EQ MFW_CFLAG_NOTSet )
{ dvData[0]&= 0xF0; //zero the lower nibble
dvData[0] |= line1&0x0F; /* low Nibble */
}
if (line2 EQ MFW_CFLAG_SET OR
line2 EQ MFW_CFLAG_NOTSet )
{ dvData[0]&= 0x0F;
dvData[0] |= (line2 << 4)&0xF0; /* high Nibble */
}
if (fax EQ MFW_CFLAG_SET OR
fax EQ MFW_CFLAG_NOTSet )
{ dvData[1]&= 0xF0; //zero the lower nibble
dvData[1] |= fax&0x0F; /* low Nibble */
}
if (data EQ MFW_CFLAG_SET OR
data EQ MFW_CFLAG_NOTSet )
{ dvData[1] &=0x0F;
dvData[1] |= (data << 4)&0xF0; /* high Nibble */
}
/* Read call forwarding flag to determine the size */
simStatus = MFW_SIMOP_WRITE_OK;
if (!cphs_read_sim_dat(SIM_CPHS_CFF, NOT_PRESENT_8BIT, MFW_CPHS_CFF_SIZE))
{
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_DV_STAT, &result);
}
return cphsStatus;
}
/*
+---------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_get_als_info |
+---------------------------------------------------------------------+
PURPOSE : Request the Status of Alternate Line Service information
(first read selected ALS line, dann status of this line).
When the field does not exist in SIM, read it from EEPROM.
*/
void cphs_get_als_info ()
{
TRACE_FUNCTION ("cphs_get_als_info()");
/* read alternate line service from EEPROM */
cphs_read_eeprom_als();
cphs_signal(E_CPHS_GET_ALS_STATUS, &alsStatus);
}
/*
+---------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_select_line |
+---------------------------------------------------------------------+
PURPOSE : Select the current used line. When the field does not
exist in SIM, read it from EEPROM.
*/
void cphs_select_line (T_MFW_LINE_INDEX line)
{
UBYTE result;
T_ACI_ALS_MOD alsMode;
TRACE_FUNCTION ("cphs_select_line()");
if (line NEQ MFW_SERV_LINE1 AND
line NEQ MFW_SERV_LINE2 )
{
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_LINE, &result);
return;
}
alsData = (UBYTE) line;
/* write alternate line service in EEPROM */
cphs_write_eeprom_als(&result);
if (line EQ MFW_SERV_LINE1)
alsMode = ALS_MOD_SPEECH;
if (line EQ MFW_SERV_LINE2)
alsMode = ALS_MOD_AUX_SPEECH;
sAT_PercentALS(CMD_SRC_LCL, alsMode);
cphs_signal(E_CPHS_SET_LINE, &result);
}
/*
+---------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_set_als_status |
+---------------------------------------------------------------------+
PURPOSE : Change the lock status of the line. When the field does
not exist in SIM, read it from EEPROM.
*/
T_MFW cphs_set_als_status (T_MFW_LINE_STATUS status)
{
UBYTE result;
T_MFW_SIM_PIN_STATUS pinStatus;
TRACE_FUNCTION ("cphs_set_als_status()");
/* check PIN 2 requirement */
pinStatus.type = MFW_SIM_PIN2;
sim_pin_status(&pinStatus);
if (pinStatus.set NEQ MFW_SIM_NO_PIN)
return MFW_SIM_PIN2_REQ;
/* check given parameter */
if (status NEQ MFW_LINE_LOCKED AND
status NEQ MFW_LINE_UNLOCKED )
{
result = MFW_SIMOP_WRITE_ERR;
cphs_signal(E_CPHS_SET_ALS_STATUS, &result);
return CPHS_ERR;
}
alsData = (UBYTE) status;
/* write lock status in EEPROM */
cphs_write_eeprom_alss(&result);
cphs_signal(E_CPHS_SET_LINE, &result);
return CPHS_OK;
}
/*
+---------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_get_csp |
+---------------------------------------------------------------------+
PURPOSE : Request the customer service profile
*/
T_MFW cphs_get_csp ()
{
UBYTE res;
TRACE_FUNCTION ("cphs_get_csp()");
/* check CPHS service table */
res = cphs_ssc(MFW_CPHS_CSP, cphsServTab);
if ( res NEQ ALLOCATED_AND_ACTIVATED)
return res;
/* Read customer service profile.
When this reading failed, send event with empty parameter array to MMI */
if (!cphs_read_sim_dat(SIM_CPHS_CSP, NOT_PRESENT_8BIT, MFW_CPHS_CSP_SIZE))
{
csProfile.result = MFW_SIMOP_READ_ERR;
memset(csProfile.csp, 0, sizeof(csProfile.csp));
cphs_signal(E_CPHS_GET_CSP, &csProfile);
}
return cphsStatus;
}
/*
+---------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_get_info_num |
+---------------------------------------------------------------------+
PURPOSE : Request information numbers directory
*/
T_MFW cphs_get_info_num (UBYTE level, UBYTE startIndex)
{
UBYTE res;
T_MFW_CPHS_INFO cf_info;
TRACE_FUNCTION ("cphs_get_info_num()");
if (level < 1 OR
startIndex < 1 )
return CPHS_ERR;
cphs_config(&cf_info);
/* Read customer service profile to check
whether information numbers are supported. */
numList.count = 0;
idxLevel = level;
startIdx = startIndex;
simStatus = MFW_SIMOP_READ_OK;
if (!cphs_read_sim_dat(SIM_CPHS_CSP, NOT_PRESENT_8BIT, MFW_CPHS_CSP_SIZE))
{
simStatus = MFW_SIMOP_UNKNOWN;
TRACE_EVENT("Can't read CSP for info nums");
return CPHS_NotPresent;
}
return cphsStatus;
}
/*
+----------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
| STATE : code ROUTINE : cphs_select_info_num |
+----------------------------------------------------------------------+
PURPOSE : read a information number entry
*/
T_MFW cphs_select_info_num (UBYTE index)
{
TRACE_FUNCTION ("cphs_select_info_num()");
/* Read a information number entry.
When this reading failed, send event with "read error" parameter to MMI */
simStatus = MFW_SIMOP_READ_OK;
startIdx = index;
// By now we know if 6F19 or EA01 are present for reading info. num entries from
// So lets use this knowledge.
if (cphsPrevRead == SIM_CPHS_INFN)
{
if (!cphs_read_sim_rcd(SIM_CPHS_INFN, 1, 0))
{
infoEntry.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
TRACE_EVENT("Error reading single info num");
}
else
{
cphsPrevRead = SIM_CPHS_INFN;
}
}
else
{
if (cphsPrevRead == SIM_CPHS_INFN2)
{
if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
{TRACE_EVENT("Error reading single info num 2");
infoEntry.result = MFW_SIMOP_READ_ERR;
cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
}
else
{
cphsPrevRead = SIM_CPHS_INFN2;
}
}
}
return cphsStatus;
}
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -