📄 mmicphs.c
字号:
$Returns: see above
$Arguments: none
*******************************************************************************/
T_MFW_CPHS_OP_NAME* CphsRequestOperatorName()
{
return &operator_name;
}
/*******************************************************************************
$Function: CphsPresent()
$Description: indicates whether CPHS sim or not
$Returns: TRUE if it is, FALSe if it isn't
$Arguments: none
*******************************************************************************/
UBYTE CphsPresent()
{
if (cphs_status == CPHS_OK)
return TRUE;
else
{ if (cphs_status == CPHS_NotPresent)
return FALSE;
else /*MC 21/05/02, CONQ5999->6007 Helps diagnose initialisation probs*/
return CPHS_ERR;
}
}
/*******************************************************************************
$Function: CphsMailboxPresent
$Description: indicates whether a CPHS SIM which supports mailbox numbers
$Returns: TRUE if it is, FALSe if it isn't
$Arguments: none
*******************************************************************************/
USHORT CphsMailboxPresent( /*struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi*/ )
{ T_MFW_CPHS_INFO config_info;
cphs_config(&config_info);
if (config_info.mbNum &0x03 && CphsPresent())
return /*0*/TRUE;
else
return /*1*/FALSE;
}
/*******************************************************************************
$Function: ALSPresent
$Description: indicates whether a CPHS SIM supports ALS by checking CSP
$Returns: 0 if it does, 1 if it doesn't
$Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
this is merely the format for menu display/suppression functions)
*******************************************************************************/
USHORT ALSPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
{ int i;
char debug[50];
for(i=0; i< 20/*length of CSP*/; i+=2)
{ sprintf(debug, "CSP: %d, %d", customer_service_profile.csp[i], customer_service_profile.csp[i+1]);
TRACE_EVENT(debug);
if (customer_service_profile.csp[i] ==CPHS_TELESERVICES_BYTE_VALUE)
{ if (customer_service_profile.csp[i+1] & ALS_MASK)
{
return 0; //ALS is supported
}
}
}
return !(cphs_E_plus_ALS_supported()); //check if E-plus ALS supported
//return 1;
}
/*******************************************************************************
$Function: InfoNumbersPresent
$Description: indicates whether a CPHS SIM has Info Numbers by checking CSP
$Returns: 0 if it does, 1 if it doesn't
$Arguments: none
*******************************************************************************/
USHORT InfoNumbersPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
{ T_MFW_CPHS_INFO config_info;
char debug[30];
int i;
cphs_config(&config_info);
sprintf(debug, "InfoNum config: %d", config_info.iNum);
for(i=0; i< strlen((char*)customer_service_profile.csp); i+=2)
{
if (customer_service_profile.csp[i] ==CPHS_INFONUMS_BYTE_VALUE)
if (customer_service_profile.csp[(i+1)] & INFONUM_MASK)
return 0; //ALS is supported
}
return 1;
}
/*******************************************************************************
$Function: GetCphsVoicemailStatus
$Description: Asks MFW to check voicemail status on CPHS SIM
cphs_mfw_cb handles callback from this
$Returns: status of line passed as parameter
$Arguments: line
*******************************************************************************/
T_MFW_CFLAG_STATUS GetCphsVoicemailStatus(UBYTE line)
{ MfwHnd idle_win = idle_get_window();
UBYTE temp =1;
cphs_get_mailbox_status ();
TRACE_EVENT("Requesting voicemail status");
switch (line)
{
case LINE1: return cphs_voicemail_status->line1; break;
case LINE2: return cphs_voicemail_status->line2; break;
case FAX: return cphs_voicemail_status->fax; break;
case DATA: return cphs_voicemail_status->data; break;
default: return MFW_CFLAG_NotPresent;
}
}
/*******************************************************************************
$Function: GetCphsDivertStatus
$Description: get call forwarding status of specified line
cphs_mfw_cb handles callback from this
$Returns: status of line passed as parameter
$Arguments: line
*******************************************************************************/
T_MFW_CFLAG_STATUS GetCphsDivertStatus(UBYTE line)
{
switch (line)
{
case MFW_SERV_LINE1: return call_forwarding_status.line1; break;
case MFW_SERV_LINE2: return call_forwarding_status.line2; break;
case MFW_SERV_FAX: return call_forwarding_status.fax; break;
case MFW_SERV_DATA: return call_forwarding_status.data; break;
default: return MFW_CFLAG_NotPresent;
}
}
/*******************************************************************************
$Function: GetAlsLine
$Description: gets current als line
$Returns: current als line
$Arguments: line
*******************************************************************************/
UBYTE GetAlsLine()
{
return als_status.selectedLine;
}
/*******************************************************************************
$Function: ShowMessage
$Description: Displays screen with passed text ids
$Returns: nothing
$Arguments: parent window, 2 text ids
*******************************************************************************/
void ShowMessage(T_MFW_HND win, USHORT TextId1, USHORT TextId2)
{
T_DISPLAY_DATA Dialog;
/* Initialise the dialog control block with default information
*/
dlg_initDisplayData_TextId( &Dialog, TxtNull, TxtNull, TextId1, TextId2 , COLOUR_STATUS);
dlg_initDisplayData_events( &Dialog, NULL, THREE_SECS, KEY_LEFT| KEY_RIGHT|KEY_CLEAR );
/* Show the dialog
*/
info_dialog( win, &Dialog );
}
/******************************************************************************
Private functions
*******************************************************************************/
T_MFW_HND edit_mailbox_start(T_MFW_HND parent_window)
{
T_MFW_HND win = mmi_cphs_create(parent_window);
TRACE_FUNCTION("calc_start()");
if (win NEQ NULL)
{
SEND_EVENT(win, MAILBOX, NULL, NULL);
}
return win;
}
T_MFW_HND mmi_cphs_create(T_MFW_HND parent)
{ T_MMI_CPHS_DATA * data = (T_MMI_CPHS_DATA *)ALLOC_MEMORY (sizeof (T_MMI_CPHS_DATA ));
T_MFW_WIN * mailbox_win;
if (data EQ NULL)
{
return NULL;
}
// Create window handler
data->mailbox_win = win_create (parent, 0, E_WIN_VISIBLE, (MfwCb)cphs_win_cb);
if (data->mailbox_win EQ NULL)
{
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)cphs_dialog_cb;
data->mmi_control.data = data;
mailbox_win = ((T_MFW_HDR *)data->mailbox_win)->data;
mailbox_win->user = (void *)data;
data->parent_win = parent;
data->win = mailbox_win;
return data->mailbox_win;
}
void mailbox_destroy(MfwHnd own_window)
{
T_MFW_WIN * win_data;
T_MMI_CPHS_DATA * data = NULL;
if (own_window)
{
win_data = ((T_MFW_HDR *)own_window)->data;
if (win_data != NULL) //PATCH TB
data = (T_MMI_CPHS_DATA *)win_data->user;
if (data)
{
TRACE_EVENT ("mailbox_destroy()");
win_delete (data->win);
// Free Memory
FREE_MEMORY ((void *)data, sizeof (T_MMI_CPHS_DATA));
}
else
{
TRACE_EVENT ("mailbox_destroy() called twice");
}
}
}
void cphs_dialog_cb(T_MFW_HND win, USHORT e, SHORT identifier, void *parameter)
{ TRACE_EVENT("cphs_dialog_cb()");
switch(e)
{ case (MAILBOX):
cphs_get_mailbox();break;
default: break;
}
}
static int cphs_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{
T_MMI_CPHS_DATA * data = (T_MMI_CPHS_DATA *)win->user;
TRACE_FUNCTION ("cphs_win_cb()");
if(data EQ 0)
return 1;
switch (event)
{
case E_WIN_VISIBLE:
if (win->flags & E_WIN_VISIBLE)
{
/* Print the information dialog */
/* Clear Screen */
dspl_ClearAll();
}
default:
return 0;
}
return 1;
}
/*******************************************************************************
$Function: show_cphs_mb_numbers
$Description: Show the list of mailbox numbers
$Returns: nothing
$Arguments: none
*******************************************************************************/
void show_cphs_mb_numbers()
{
T_MFW_HND win;
T_MFW_HND parent_win= mfw_parent(mfw_header());
{
win = buildInfoNumberMenu(parent_win);
if (win NEQ NULL)
{
SEND_EVENT (win, E_INIT, 0, 0);
}
}
}
/*******************************************************************************
$Function: show_cphs_mb_number
$Description: Show the passed mailbox number in editor
$Returns: status int
$Arguments: mailbox number entry
*******************************************************************************/
int show_cphs_mb_number(T_MFW_CPHS_ENTRY* mb_number)
{ T_MFW_HND parent_win = mfw_parent(mfw_header());
#ifdef NEW_EDITOR
T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data*/
#else
T_EDITOR_DATA editor_data;
#endif
char temp_number[PHB_MAX_LEN];
memset(temp_number, 0, PHB_MAX_LEN);
//if it's an international number without a '+'
if (mb_number->ton == MFW_TON_INTERNATIONAL && mb_number->number[0] != '+')
{ strcat(temp_number, "+"); //put a + in front of number
strcat(temp_number, (char*)mb_number->number);
strcpy((char*)mb_number->number, temp_number);
}
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
AUI_edit_SetDefault(&editor_data);
AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)mb_number->number, PHB_MAX_LEN-1);
AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
AUI_edit_SetDisplay(&editor_data, 0, COLOUR_EDITOR, EDITOR_FONT);
AUI_edit_SetEvents(&editor_data, 0, TRUE, FOREVER, (T_AUI_EDIT_CB)mailbox_edit_cb);
AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtNull, NULL);
AUI_edit_Start(parent_win, &editor_data);
#else /* NEW_EDITOR */
editor_attr_init(&editor_data.editor_attr, 0, edtCurBar1, NULL, (char*)mb_number->number, PHB_MAX_LEN-1, COLOUR_EDITOR);
editor_data_init(&editor_data, (T_EDIT_CB)mailbox_edit_cb, TxtSoftOK, TxtDelete, NULL, 1, DIGITS_MODE, FOREVER);
editor_data.Identifier = 0;
editor_data.hide = FALSE;
editor_data.destroyEditor = TRUE;
editor_data.TextString = NULL; /*MC SPR 1257, stops glitch in Chinese*/
editor_start(parent_win,&editor_data); /* start the editor */
#endif /* NEW_EDITOR */
}
/*******************************************************************************
$Function: mailbox_edit_cb
$Description: callback for mailbox editor screen
$Returns: nothing
$Arguments: window, identifier, reason
*******************************************************************************/
static void mailbox_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason)
{
TRACE_FUNCTION("mailbox_edit_cb()");
switch (reason )
{
case INFO_KCD_LEFT:
{
TRACE_EVENT((char*)cphs_voicemail_num.number);
cphs_set_mailbox(&cphs_voicemail_num);
}
break;
default:
{
/* otherwise no action to be performed
*/
break;
}
}
}
/*******************************************************************************
$Function: cphs_mfw_cb
$Description: Callback handler for mfw_cphs events
$Returns: status int
$Arguments: event, parameter pointer
*******************************************************************************/
int cphs_mfw_cb(T_MFW_EVENT event, void* para)
{ T_MFW_HND parent = mfwParent( mfw_header());
T_MFW_CPHS_VC_NUM* number_list =(T_MFW_CPHS_VC_NUM* )para;
char debug[50];
T_MFW_CPHS_PARA* parameter = (T_MFW_CPHS_PARA*)para;
T_MFW_CPHS_STATUS temp;
switch(event)
{ case E_CPHS_IND:
TRACE_EVENT("Getting cphs status");
if(para != NULL)
{ cphs_status =(* (T_MFW_CPHS_STATUS*)para);
if (cphs_status != CPHS_OK)
{ sprintf(debug,"cphs not supported, apparently%d", cphs_status);
TRACE_EVENT(debug);
}
cphs_operator_name();
}
break;
case E_CPHS_OP_NAME:
if(para != NULL)
{
memcpy(&operator_name, para, sizeof(T_MFW_CPHS_OP_NAME));
TRACE_EVENT("operator name callback");
if (operator_name.longName.data[0] == NULL)
TRACE_EVENT("Blank long name");
if (operator_name.shortName.data[0] == NULL)
TRACE_EVENT("Blank short name");
cphs_get_csp();
}
break;
case E_CPHS_GET_VC_NUM:
{
if (para!= NULL)
{ memcpy(&cphs_voicemail_numbers, para, sizeof(T_MFW_CPHS_VC_NUM));
sprintf(debug,"Voicemail No %s", cphs_voicemail_numbers.entries[0].number);
TRACE_EVENT(debug);
show_cphs_mb_numbers();
}
}
break;
case E_CPHS_SET_VC_NUM:
{ //result of writing mailbox number
UBYTE write_result;
if(para != NULL)
{ write_result = *(UBYTE*)para;
if (write_result == MFW_SIMOP_WRITE_OK)
ShowMessage(parent, TxtSaved, TxtNull);
else
ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
}
}
break;
case E_CPHS_GET_VC_STAT:
{
MfwHnd idle_win =idle_get_window();
UBYTE line;
if(para != NULL)
{ cphs_voicemail_status = (T_MFW_CPHS_VC_STAT*)para;
TRACE_EVENT("Getting voicemail status");
if (cphs_voicemail_status->line1 == MFW_CFLAG_SET)
ShowMessage(idle_win, TxtVoicemail, TxtLine1);
if (cphs_voicemail_status->line2 == MFW_CFLAG_SET)
{
ShowMessage(idle_win, TxtVoicemail, TxtLine2);
}
}
}
break;
case E_CPHS_SET_VC_STAT:
{ //result of resetting mailbox status
UBYTE write_result;
TRACE_EVENT("Mailbox status set");
//Update our copy of the mailbox status
GetCphsVoicemailStatus(0);
}
break;
case E_CPHS_GET_DV_STAT:
{
TRACE_EVENT("Getting divert status");
if(para != NULL)
memcpy(&call_forwarding_status, para, sizeof(T_MFW_CPHS_DV_STAT));
{UBYTE line;
//check for divert on active line
line = GetAlsLine();
//check if current outgoing line diverted
if (line == MFW_SERV_LINE2)
DivertStatus = GetCphsDivertStatus(MFW_SERV_LINE2);
else//if (line == MFW_SERV_LINE1)
DivertStatus = GetCphsDivertStatus(MFW_SERV_LINE1);
//set the call forwarding icon
if (DivertStatus == MFW_CFLAG_SET)
iconsSetState(iconIdCallFor);
//gid rid of call forwarding icon
if (DivertStatus == MFW_CFLAG_NOTSet)
iconsDeleteState(iconIdCallFor);
}
}break;
case E_CPHS_SET_DV_STAT:
{ //result of setting divert status
UBYTE write_result;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -